TensorSpec.h File
Tensor constraints and matching helpers. More...
Included Headers
#include "pipeline/TensorCore.h"
#include <optional>
#include <string>
#include <vector>
Namespaces Index
| namespace | simaai |
| namespace | neat |
Classes Index
| struct | TensorConstraint |
Description
Tensor constraints and matching helpers.
File Listing
The file content with the documentation metadata removed is:
8#include "pipeline/TensorCore.h"
14namespace simaai::neat {
16struct TensorConstraint {
21 std::vector<Device> allowed_devices;
22 std::optional<Device> preferred_device;
24 std::optional<ImageSpec::PixelFormat> image_format;
25 std::vector<Segment> required_segments;
26 std::vector<std::string> required_segment_names;
27 bool allow_composite = true;
33 for (size_t i = 0; i < shape.size(); ++i) {
38 if (!dtypes.empty()) {
40 for (auto dt : dtypes) {
41 if (dt == t.dtype) {
49 if (device.has_value()) {
53 if (!allowed_devices.empty()) {
55 for (const auto& allowed : allowed_devices) {
64 if (image_format.has_value()) {
67 if (t.semantic.image->format != *image_format)
70 if (!required_segments.empty()) {
73 if (t.storage->sima_segments.size() != required_segments.size())
75 for (size_t i = 0; i < required_segments.size(); ++i) {
76 if (t.storage->sima_segments[i].name != required_segments[i].name)
78 if (t.storage->sima_segments[i].size_bytes != required_segments[i].size_bytes) {
83 if (!required_segment_names.empty()) {
86 for (const auto& name : required_segment_names) {
88 for (const auto& seg : t.storage->sima_segments) {
98 if (!allow_composite && t.is_composite())
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.1.