mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-19 22:00:35 +08:00
open_dict for tweaking
Summary: Made the config system call open_dict when it calls the tweak function. Reviewed By: shapovalov Differential Revision: D38315334 fbshipit-source-id: 5924a92d8d0bf399bbf3788247f81fc990e265e7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c3f8dad55c
commit
5f069dbb7e
@@ -691,12 +691,17 @@ class TestConfig(unittest.TestCase):
|
||||
fruit2_class_type: str = "Pear"
|
||||
a: A
|
||||
a2: A
|
||||
a3: A
|
||||
|
||||
@classmethod
|
||||
def a_tweak_args(cls, type, args):
|
||||
assert type == A
|
||||
args.n = 993
|
||||
|
||||
@classmethod
|
||||
def a3_tweak_args(cls, type, args):
|
||||
del args["n"]
|
||||
|
||||
@classmethod
|
||||
def fruit_tweak_args(cls, type, args):
|
||||
assert issubclass(type, Fruit)
|
||||
@@ -707,6 +712,7 @@ class TestConfig(unittest.TestCase):
|
||||
args = get_default_args(Wrapper)
|
||||
self.assertEqual(args.a_args.n, 993)
|
||||
self.assertEqual(args.a2_args.n, 9)
|
||||
self.assertEqual(args.a3_args, {})
|
||||
self.assertEqual(args.fruit_Pear_args.n_pips, 19)
|
||||
self.assertEqual(args.fruit2_Pear_args.n_pips, 13)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user