Skip to content

Annotation for configuration values #99

@bpiwowar

Description

@bpiwowar

Allows to declare easily an external value class, which is useful to avoid initialising resources (e.g. torch) when not needed

class Model(Config):
   ...

@Model.value
class TorchModel(Model, nn.Module):
   ...

class SubModel(Model):
   ...

@SubModel.value
class TorchSubModel(SubModel, TorchModel):
  "We need to inherit from both the configuration `SubModel` and the `Model` value, i.e. `TorchModel`"
   ...
  • Create the tests
  • Implement the value class method which should test whether the value classes (1) is a subclass of the configuration, (2) is a subclass of the parent configuration values (if any)
  • Check that if A has a value class AValue, SubA has none, and SubSubA has, then the latter inherits from SubA.XPMValue and that SubA.XPMValue implicitely inherits drom AValue

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions