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

◆ is_contiguous()

bool MayaFlux::Kakshya::TensorSpec::is_contiguous ( ) const
nodiscardnoexcept

Whether elements are laid out densely in C order.

Definition at line 52 of file TensorSpec.cpp.

53{
54 if (strides.empty())
55 return true;
56 if (strides.size() != shape.size())
57 return false;
58
59 const auto count = element_count();
60 if (count && *count == 0)
61 return true;
62
63 int64_t expected = 1;
64 for (size_t i = shape.size(); i-- > 0;) {
65 if (shape[i] != 1 && strides[i] != expected)
66 return false;
67 if (shape[i] > max_signed / static_cast<uint64_t>(std::max<int64_t>(expected, 1)))
68 return false;
69 expected *= static_cast<int64_t>(shape[i]);
70 }
71 return true;
72}
std::vector< double > count(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sample count per window (as double for pipeline uniformity).
Definition Analysis.cpp:506
std::optional< uint64_t > element_count() const noexcept
Product of the shape, or std::nullopt on overflow.
std::vector< int64_t > strides
std::vector< uint64_t > shape

References element_count(), shape, and strides.

Referenced by MayaFlux::Kakshya::TensorData::copy_of(), and diagnose().

Here is the call graph for this function:
Here is the caller graph for this function: