core.parameters.export_parameters¶
export_parameters
¶
Classes:
Name | Description |
---|---|
ExportParameters |
Handles the export parameters for models exportation processes. |
ExportParameters(log_data)
¶
Bases: Parameters
Handles the export parameters for models exportation processes.
Inherits from the base Parameters
class and is responsible for extracting and managing the
format in which the models will be exported, such as ONNX or other supported formats.
Attributes:
Name | Type | Description |
---|---|---|
export_format |
str
|
The format in which the models will be exported. Defaults to 'onnx'. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
LogDataType
|
The log data schema that contains the parameters for export. |
required |
Methods:
Name | Description |
---|---|
extract_parameter |
Extract a parameter using keys, type, optional default, and optional value range. |
to_dict |
Return parameters as a dictionary, excluding internal fields. |
validate_log_data |
Validate and return log data if it's a dictionary. |
export_format = self.extract_parameter(keys=['export_format'], expected_type=str, default='onnx')
instance-attribute
¶
parameters_data = self.validate_log_data(log_data)
instance-attribute
¶
defaulted_keys = set()
instance-attribute
¶
extract_parameter(keys, expected_type, default=..., range_value=None)
¶
extract_parameter(keys: list, expected_type: type[T], default: Any = ..., range_value: tuple[Any, Any] | None = None) -> T
extract_parameter(keys: list, expected_type: Any, default: Any = ..., range_value: tuple[Any, Any] | None = None) -> Any
Extract a parameter using keys, type, optional default, and optional value range.
Examples:
Extract a required string parameter that cannot be None:
parameter = self.extract_parameter(keys=["key1", "key2"], expected_type=str)
Extract a required integer parameter that can be None:
parameter = self.extract_parameter(keys=["key1"], expected_type=int | None)
Extract an optional float parameter within a specific range:
parameter = self.extract_parameter(keys=["key1"], expected_type=float, default=0.5, range_value=(0.0, 1.0))
Extract an optional string parameter with a default value:
parameter = self.extract_parameter(keys=["key1"], expected_type=str, default="default_value")
Extract an optional string parameter that can be None:
parameter = self.extract_parameter(keys=["key1"], expected_type=Union[str, None], default=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
list
|
A list of possible keys to extract the parameter. |
required |
|
type[T]
|
The expected type of the parameter, can use Union for optional types. |
required |
|
Any
|
The default value if the parameter is not found. Use ... for required parameters. |
...
|
|
tuple[Any, Any] | None
|
A tuple of two numbers representing the allowed range of the parameter. |
None
|
Returns:
Type | Description |
---|---|
Any
|
The parsed parameter. |
to_dict()
¶
Return parameters as a dictionary, excluding internal fields.
validate_log_data(log_data)
¶
Validate and return log data if it's a dictionary.