simet.parser.transform¶
simet.parser.transform ¶
TransformParser ¶
Factory that builds transform objects from config dicts.
Parses a plain mapping (e.g., from YAML/JSON) into a TransformSchema and
delegates construction to :meth:TransformType.get_transform.
parse_transform
staticmethod
¶
parse_transform(transform_data)
Parse transform config and return a concrete transform instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transform_data
|
dict
|
Mapping that must match |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Transform |
Transform
|
An instance of the requested transform |
Transform
|
(currently |
Raises:
| Type | Description |
|---|---|
TypeError
|
If required fields for |
ValueError
|
If the |
Example
cfg = {"type": "InceptionTransform"} t = TransformParser.parse_transform(cfg) t.class.name 'InceptionTransform'
Source code in simet/parser/transform.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
TransformType ¶
Bases: StrEnum
Enum of supported transform identifiers (string-valued).
get_transform
staticmethod
¶
get_transform(transform_schema)
Construct a transform instance from a validated schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transform_schema
|
TransformSchema
|
Validated schema with a |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Transform |
Transform
|
Concrete transform instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Notes
- Extend the
matchwith additional cases as new transforms are added.
Source code in simet/parser/transform.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |