safestructures.TensorProcessor
Bases: DataProcessor
, ABC
Base class to process tensors.
Source code in src/safestructures/processors/base.py
deserialize(tensor_id, **kwargs)
process_tensor(tensor)
Process a tensor for serialization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tensor
|
ndarray
|
The tensor as Numpy array. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The tensor ID. |
Source code in src/safestructures/processors/base.py
serialize(tensor)
to_numpy(tensor)
abstractmethod
Convert tensor to Numpy array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tensor
|
Any
|
The tensor to convert to Numpy. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The tensor as a Numpy array. |