tf 🔗
Tensorflow operations.
Buffer 🔗
Bases: CType
Wrapper for the struct vaccel_tf_buffer
C object.
Manages the creation and initialization of a C struct vaccel_tf_buffer
and provides access to it through Python properties.
Inherits
CType: Abstract base class for defining C data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| bytes | bytearray | The buffer data to be passed to the C struct. | required |
Source code in vaccel/ops/tf.py
Node 🔗
Bases: CType
Wrapper for the struct vaccel_tf_node
C object.
Manages the creation and initialization of a C struct vaccel_tf_node
and provides access to it through Python properties.
Inherits
CType: Abstract base class for defining C data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| str | The name to be passed to the C struct. | required |
| int | The ID to be passed to the C struct. | required |
Source code in vaccel/ops/tf.py
value property
🔗
Returns the value of the underlying C struct.
Returns:
Type | Description |
---|---|
CData | The dereferenced 'struct vaccel_tf_node` |
Status 🔗
Status(error_code: int = 0, message: str = '')
Bases: CType
Wrapper for the struct vaccel_tf_status
C object.
Manages the creation and initialization of a C struct vaccel_tf_status
and provides access to it through Python properties.
Inherits
CType: Abstract base class for defining C data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| int | The error code to be passed to the C struct. Defaults to 0. | 0 |
| str | The message to be passed to the C struct. Defaults to "". | '' |
Source code in vaccel/ops/tf.py
TFMixin 🔗
Mixin providing Tensorflow operations for a Session
.
This mixin is intended to be used in combination with BaseSession
and should not be instantiated on its own.
Intended usage
class Session(BaseSession, TensorflowMixin): ...
tf_model_delete 🔗
Performs the Tensorflow model deletion operation.
Wraps the vaccel_tf_session_delete()
C operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| Resource | A resource with the model to unload. | required |
Returns:
Type | Description |
---|---|
Status | The status of the operation execution. |
Raises:
Type | Description |
---|---|
RuntimeError | If the |
FFIError | If the C operation fails. |
Source code in vaccel/ops/tf.py
tf_model_load 🔗
Performs the Tensorflow model loading operation.
Wraps the vaccel_tf_session_load()
C operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| Resource | A resource with the model to load. | required |
Returns:
Type | Description |
---|---|
Status | The status of the operation execution. |
Raises:
Type | Description |
---|---|
RuntimeError | If the |
FFIError | If the C operation fails. |
Source code in vaccel/ops/tf.py
tf_model_run 🔗
tf_model_run(
resource: Resource,
in_nodes: list[Node],
in_tensors: list[Tensor],
out_nodes: list[Node],
run_options: Buffer | None = None,
) -> (list[Tensor], Status)
Performs the Tensorflow model run operation.
Wraps the vaccel_tf_session_run()
C operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| Resource | A resource with the model to run. | required |
| list[Node] | The input nodes for the inference. | required |
| list[Tensor] | The input tensors for the inference. | required |
| list[Node] | The output nodes for the inference. | required |
| Buffer | None | The inference options. | None |
Returns:
Type | Description |
---|---|
(list[Tensor], Status) | A tuple containing: - The output tensors - The status of the operation execution. |
Raises:
Type | Description |
---|---|
RuntimeError | If the |
FFIError | If the C operation fails. |
Source code in vaccel/ops/tf.py
Tensor 🔗
Bases: CType
Wrapper for the struct vaccel_tf_tensor
C object.
Manages the creation and initialization of a C struct vaccel_tf_tensor
and provides access to it through Python properties.
Inherits
CType: Abstract base class for defining C data types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| list[int] | The dims to be passed to the C struct. | required |
| TensorType | The data_type to be passed to the C struct. | required |
| list[Any] | The data to be passed to the C struct. | required |
Source code in vaccel/ops/tf.py
data property
🔗
data_type property
🔗
The tensor data type.
Returns:
Type | Description |
---|---|
TensorType | The data type of the tensor. |
dims property
🔗
value property
🔗
Returns the value of the underlying C struct.
Returns:
Type | Description |
---|---|
CData | The dereferenced 'struct vaccel_tf_tensor` |
empty classmethod
🔗
empty() -> Tensor
Initializes a new empty Tensor
object.
The object a NULL pointer in place of the C struct.
Returns:
Type | Description |
---|---|
Tensor | A new |
Source code in vaccel/ops/tf.py
from_c_obj classmethod
🔗
Initializes a new Tensor
object from an existing C struct.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
| CData | A pointer to a | required |
Returns:
Type | Description |
---|---|
Tensor | A new |