Skip to content
Snippets Groups Projects
Commit 5cd2d17f authored by Jakob Roth's avatar Jakob Roth
Browse files

Merge branch 'simpler_model_init' into 'NIFTy_8'

Model.__init__: Harden against very early attribute references

Closes #427

See merge request !1010
parents 54be3536 4e2344e8
No related branches found
No related tags found
1 merge request!1010Model.__init__: Harden against very early attribute references
Pipeline #246271 passed
......@@ -216,6 +216,11 @@ class Model(LazyModel):
if domain is NoValue and init is not NoValue:
domain = eval_shape(init, Initializer.domain)
if target is NoValue and domain is not NoValue:
# Set attributes as to allow references back from self.__call__
# They will be set to the correct value in `super().__init__`
self._domain = domain
self._target = None
self._init = None
target = eval_shape(self, domain) # Honor overloaded `__call__`
super().__init__(domain=domain, init=init, target=target)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment