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

◆ lstm_sequence_stage()

DependencyStage MayaFlux::Yantra::TensorKernels::lstm_sequence_stage ( uint64_t x,
uint64_t w_ih,
uint64_t w_hh,
uint64_t b_ih,
uint64_t b_hh,
uint64_t state,
uint64_t hs,
uint32_t steps,
uint32_t hidden )
inlinenodiscard

One nn_lstm_sequence dispatch: an LSTM cell over a whole sequence in one workgroup.

The input width equals the hidden width. Weights are in the order of PyTorch: gate rows input, forget, cell, output. w_ih and w_hh are [4 * hidden, hidden], b_ih and b_hh are [4 * hidden]. state holds h then c, 2 * hidden floats, and is read at the start and written at the end so the recurrence continues across dispatches. hs receives the hidden vector of every step.

Parameters
xDevice address of the input, [steps, hidden].
hsDevice address of the output, [steps, hidden].
hiddenHidden width, 1 to lstm_max_hidden.
Exceptions
std::invalid_argumentWhen steps or hidden is out of range.

Definition at line 311 of file Stages.hpp.

313{
314 if (steps == 0 || hidden == 0 || hidden > lstm_max_hidden) {
315 detail::refuse("LSTM needs at least one step and a hidden width from 1 to 256");
316 }
317 const LstmPC pc { .x = x, .w_ih = w_ih, .w_hh = w_hh, .b_ih = b_ih, .b_hh = b_hh, .state = state, .hs = hs, .steps = steps, .hidden = hidden };
319}
DependencyStage make_stage(const char *shader, uint32_t local, const PC &pc, uint32_t groups)
Definition Stages.hpp:48
void refuse(std::string_view message)
Definition Layers.hpp:74
constexpr uint32_t lstm_max_hidden
Widest hidden state nn_lstm_sequence supports.
Definition Layouts.hpp:19
constexpr uint32_t lstm_workgroup
Invocations of the one workgroup nn_lstm_sequence runs in.
Definition Layouts.hpp:17
constexpr const char * lstm_sequence_shader
Definition Layouts.hpp:26

References lstm_max_hidden, lstm_sequence_shader, lstm_workgroup, MayaFlux::Yantra::TensorKernels::detail::make_stage(), and MayaFlux::Yantra::TensorKernels::detail::refuse().

Referenced by MayaFlux::Yantra::SileroVadModel::Impl::run().

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