albumentations.core.tensor
CPU Tensor target validation and NumPy bridge helpers.
Members
- functionvalidate_tensor_input
- functiontensor_to_numpy_annotation
- functiontensor_to_numpy_spatial
- functionvalidate_tensor_metadata_input
- functiontensor_metadata_field_target
- functiontensor_metadata_to_numpy
- functionnumpy_to_tensor_spatial
- functionnumpy_to_tensor_annotation
validate_tensor_inputfunction
validate_tensor_input(
value: torch.Tensor,
data_name: str,
canonical_name: str
)Validate a plain CPU Tensor at the public Compose boundary.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | torch.Tensor | - | - |
| data_name | str | - | - |
| canonical_name | str | - | - |
tensor_to_numpy_annotationfunction
tensor_to_numpy_annotation(
value: torch.Tensor,
target: str
)Return a NumPy view of a validated Tensor annotation matrix.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | torch.Tensor | - | - |
| target | str | - | - |
tensor_to_numpy_spatialfunction
tensor_to_numpy_spatial(
value: torch.Tensor,
target: str
)Return a canonical channel-last NumPy view of a canonical Tensor target.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | torch.Tensor | - | - |
| target | str | - | - |
validate_tensor_metadata_inputfunction
validate_tensor_metadata_input(
value: torch.Tensor,
data_name: str,
target: str | None
)Validate a Tensor read through `targets_as_params` before sampling.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | torch.Tensor | - | - |
| data_name | str | - | - |
| target | One of:
| - | - |
tensor_metadata_field_targetfunction
tensor_metadata_field_target(
name: object
)Return the canonical target for a conventional Tensor metadata field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| name | object | - | - |
tensor_metadata_to_numpyfunction
tensor_metadata_to_numpy(
value: torch.Tensor,
target: str | None
)Convert one validated `targets_as_params` Tensor to the NumPy layout consumed by a transform.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | torch.Tensor | - | - |
| target | One of:
| - | - |
numpy_to_tensor_spatialfunction
numpy_to_tensor_spatial(
value: NDArray[np.generic],
target: str
)Return a canonical Tensor view of a canonical channel-last NumPy target.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | NDArray[np.generic] | - | - |
| target | str | - | - |
numpy_to_tensor_annotationfunction
numpy_to_tensor_annotation(
value: NDArray[np.generic],
target: str
)Return a float32 Tensor annotation matrix from a NumPy processor result.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | NDArray[np.generic] | - | - |
| target | str | - | - |