Example #1
0
    def test_inheritance2(self):
        # This is a case where a class could contain an instance
        # of a subclass, which is ignored.
        class Parent(ReplaceableBase):
            pass

        class Main(Configurable):
            parent: Parent
            # Note - no __post__init__

        @registry.register
        class Derived(Parent, Main):
            pass

        args = get_default_args(Main)
        # Derived has been ignored in processing Main.
        self.assertCountEqual(args.keys(), ["parent_class_type"])

        main = Main(**args)

        with self.assertRaisesRegex(ValueError,
                                    "UNDEFAULTED has not been registered."):
            run_auto_creation(main)

        main.parent_class_type = "Derived"
        # Illustrates that a dict works fine instead of a DictConfig.
        main.parent_Derived_args = {}
        with self.assertRaises(AttributeError):
            main.parent
        run_auto_creation(main)
        self.assertIsInstance(main.parent, Derived)
Example #2
0
    def __post_init__(self):
        super().__init__()
        self.view_metrics = ViewMetrics()

        self._check_and_preprocess_renderer_configs()
        self.raysampler_args[
            "sampling_mode_training"] = self.sampling_mode_training
        self.raysampler_args[
            "sampling_mode_evaluation"] = self.sampling_mode_evaluation
        self.raysampler_args["image_width"] = self.render_image_width
        self.raysampler_args["image_height"] = self.render_image_height
        run_auto_creation(self)

        self._implicit_functions = self._construct_implicit_functions()

        self.log_loss_weights()
Example #3
0
 def __post_init__(self):
     super().__init__()
     run_auto_creation(self)
Example #4
0
 def __post_init__(self):
     run_auto_creation(self)
Example #5
0
 def __post_init__(self):
     self.x_LargeShape_args.inner_class_type = "Triangle"
     run_auto_creation(self)