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

◆ check_tensors()

std::string MayaFlux::Yantra::TensorKernels::check_tensors ( const Kakshya::TensorSet & weights,
std::span< const TensorRequirement > required )
inlinenodiscard

Whether a set holds every required tensor with the required shape.

Parameters
weightsCandidate tensors.
requiredWhat the network needs.
Returns
Empty when it does, otherwise the first missing tensor or shape mismatch, in the order of required.

Definition at line 57 of file Yantra/Executors/TensorKernels/Weights.hpp.

58{
59 for (const auto& need : required) {
60 const auto* tensor = weights.find(need.name);
61 if (tensor == nullptr) {
62 return std::format("missing tensor '{}'", need.name);
63 }
64 if (tensor->spec().shape != need.shape) {
65 return std::format("tensor '{}' has shape {} but {} is required",
66 need.name, detail::shape_text(tensor->spec().shape), detail::shape_text(need.shape));
67 }
68 }
69 return {};
70}
std::string shape_text(const std::vector< uint64_t > &shape)
const TensorData * find(std::string_view name) const
Tensor with this exact name, or nullptr.
Definition Tensor.cpp:176

References MayaFlux::Kakshya::TensorSet::find(), and MayaFlux::Yantra::TensorKernels::detail::shape_text().

Referenced by MayaFlux::Yantra::HubertPhonemeModel::diagnose(), MayaFlux::Yantra::SileroVadModel::diagnose(), and pack_weights().

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