hydrosdk.signature module¶
- class hydrosdk.signature.AnyDimSize¶
Bases:
object
Validation class for dimensions, used for -1 dims
- class hydrosdk.signature.ProfilingType(value)¶
Bases:
enum.Enum
Profiling Types are used to tell monitoring services how to analyse signature fields.
- hydrosdk.signature.ModelSignature_to_signature_dict(signature)¶
Serializes ModelSignature into a signature dict
- hydrosdk.signature.attach_ds(result_dict, field)¶
Adds dtype or subfields
- Parameters
result_dict (dict) –
field –
- Raises
ValueError – If field invalid
- Returns
result_dict with dtype or subfields
- Return type
- hydrosdk.signature.field_from_dict(field_name, field_dict)¶
Deserialization into ModelField.
- Parameters
- Raises
ValueError – If data_dict is invalid
- Returns
ModelField
- Return type
hydro_serving_grpc.serving.contract.field_pb2.ModelField
- hydrosdk.signature.field_to_dict(field)¶
Serializes model field into name, profile and optional shape
- hydrosdk.signature.mock_input_data(signature)¶
Creates dummy input data
- Parameters
signature (hydro_serving_grpc.serving.contract.signature_pb2.ModelSignature) –
- Returns
list of input tensors
- hydrosdk.signature.parse_field(name, dtype, shape, profile=ProfilingType.NONE)¶
Creates a proto ModelField object
- Parameters
name (str) – name of a model field
dtype (Union[str, int, numpy.dtype]) – data type of model field, either string dtype alias (“double”, “int” .. ), proto DataType value or name, or a Numpy data type
shape (Iterable[int]) – shape of a model field
profile (hydrosdk.signature.ProfilingType) – profile of a model field
- Raises
ValueError – If dtype is invalid
- Returns
ModelField proto object
- Return type
hydro_serving_grpc.serving.contract.field_pb2.ModelField
- hydrosdk.signature.shape_to_dict(shape=None)¶
Serializes model field’s shape to dict
- Parameters
shape (Optional[TensorShape]) – TensorShape
- Returns
dict with dim
- Return type