TensorConstraint Struct
Declarative tensor contract — describes the shape/dtype/device/format a tensor must satisfy. More...
Declaration
Included Headers
Public Member Functions Index
| bool | matches (const Tensor &t) const |
|
Returns true if t satisfies every non-empty constraint in this spec. More... | |
Public Member Attributes Index
| std::vector< simaai::neat::TensorDType > | dtypes |
|
Acceptable dtypes (empty = any). More... | |
| int | rank = -1 |
|
Required rank (-1 = any). More... | |
| std::vector< int64_t > | shape |
|
Required shape; -1 in any position means dynamic. More... | |
| std::optional< Device > | device |
|
Required device (empty = any). More... | |
| std::vector< Device > | allowed_devices |
|
Acceptable devices (empty = any). More... | |
| std::optional< Device > | preferred_device |
|
Preferred device for placement (informational). More... | |
| std::optional< ImageSpec::PixelFormat > | image_format |
|
Required image pixel format (only meaningful for image tensors). More... | |
| std::vector< Segment > | required_segments |
|
Exact required memory-segment layout (advanced). More... | |
| std::vector< std::string > | required_segment_names |
|
Required memory-segment names (must all be present). More... | |
| bool | allow_composite = true |
|
If false, reject composite (multi-plane) tensors like NV12. More... | |
Description
Declarative tensor contract — describes the shape/dtype/device/format a tensor must satisfy.
Used by Model::input_spec()/output_spec() to advertise what the model expects/produces, and by validation code to verify a tensor meets the contract via matches(). Empty fields mean "no constraint on this dimension." Use -1 in shape for dynamic axes.
Definition at line 44 of file TensorSpec.h.
Public Member Functions
matches()
| inline |
Returns true if t satisfies every non-empty constraint in this spec.
Empty fields are skipped (treated as "no constraint"). Useful for inline validation in application code and as the underlying check used by built-in contracts.
Definition at line 65 of file TensorSpec.h.
Public Member Attributes
allow_composite
|
If false, reject composite (multi-plane) tensors like NV12.
Definition at line 57 of file TensorSpec.h.
allowed_devices
|
Acceptable devices (empty = any).
Definition at line 49 of file TensorSpec.h.
device
|
Required device (empty = any).
Definition at line 48 of file TensorSpec.h.
dtypes
|
Acceptable dtypes (empty = any).
Definition at line 45 of file TensorSpec.h.
image_format
|
Required image pixel format (only meaningful for image tensors).
Definition at line 53 of file TensorSpec.h.
preferred_device
|
Preferred device for placement (informational).
Definition at line 50 of file TensorSpec.h.
rank
|
required_segment_names
|
Required memory-segment names (must all be present).
Definition at line 56 of file TensorSpec.h.
required_segments
|
Exact required memory-segment layout (advanced).
Definition at line 54 of file TensorSpec.h.
shape
|
Required shape; -1 in any position means dynamic.
Definition at line 47 of file TensorSpec.h.
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.