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

◆ reshape()

bool MayaFlux::Kakshya::TensorInsertion::reshape ( std::vector< uint64_t > shape)

Change the shape without moving data.

Parameters
shapeNew shape with the same element count; the tensor becomes dense.
Returns
False when the count differs or the tensor is strided.

Definition at line 93 of file TensorInsertion.cpp.

94{
95 auto& spec = m_tensor->m_spec;
96 if (!spec.is_contiguous())
97 return false;
98
99 TensorSpec candidate = spec;
100 candidate.shape = std::move(shape);
101 candidate.strides.clear();
102 candidate.axes.clear();
103 candidate.quantization.reset();
104
105 if (candidate.element_count() != spec.element_count() || !candidate.is_valid())
106 return false;
107
108 spec = std::move(candidate);
109 return true;
110}

References MayaFlux::Kakshya::TensorSpec::axes, MayaFlux::Kakshya::TensorSpec::element_count(), MayaFlux::Kakshya::TensorSpec::is_valid(), m_tensor, MayaFlux::Kakshya::TensorSpec::quantization, MayaFlux::Kakshya::TensorSpec::shape, and MayaFlux::Kakshya::TensorSpec::strides.

Here is the call graph for this function: