MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ dimensions()

std::vector< DataDimension > MayaFlux::Kakshya::TensorSpec::dimensions ( ) const
nodiscard

One DataDimension per axis, with size and stride taken from shape and strides.

Definition at line 173 of file TensorSpec.cpp.

174{
175 const auto resolved = resolved_strides();
176 std::vector<DataDimension> result;
177 result.reserve(shape.size());
178
179 for (size_t i = 0; i < shape.size(); ++i) {
180 const int64_t stride = resolved[i];
181 const uint64_t magnitude = stride < 0 ? static_cast<uint64_t>(-(stride + 1)) + 1 : static_cast<uint64_t>(stride);
182 if (i < axes.size()) {
183 auto axis = axes[i];
184 axis.size = shape[i];
185 axis.stride = magnitude;
186 result.push_back(std::move(axis));
187 } else {
188 result.emplace_back("axis" + std::to_string(i), shape[i], magnitude, DataDimension::Role::CUSTOM);
189 }
190 }
191 return result;
192}
@ CUSTOM
User-defined or application-specific.
Definition NDData.hpp:223
std::vector< DataDimension > axes
std::vector< uint64_t > shape
std::vector< int64_t > resolved_strides() const
Element strides, with C order filled in when none are stored.

References axes, MayaFlux::Kakshya::DataDimension::CUSTOM, resolved_strides(), and shape.

Here is the call graph for this function: