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

◆ conv1d_stage()

DependencyStage MayaFlux::Yantra::TensorKernels::conv1d_stage ( const Conv1d & layer,
uint64_t src,
uint64_t weights,
uint64_t bias,
uint64_t dst,
uint32_t batch,
uint32_t t_in )
inlinenodiscard

One nn_conv1d dispatch: [batch, c_in, t_in] to [batch, c_out, conv1d_length].

Parameters
layerThe layer.
srcDevice address of the input.
weightsDevice address of the weights, [c_out, c_in, kernel].
biasDevice address of the bias, [c_out], or 0 for none.
dstDevice address of the output.
batchIndependent repeats of the input.
t_inInput length.
Exceptions
std::invalid_argumentWhen the layer is empty or the output would be empty.

Definition at line 70 of file Stages.hpp.

72{
73 const uint32_t t_out = conv1d_length(layer, t_in);
74 if (layer.c_in == 0 || layer.c_out == 0 || batch == 0 || t_out == 0) {
75 detail::refuse("Conv1d has no input channels, output channels, batch or output length");
76 }
77 const uint32_t flags = (bias != 0 ? conv1d_flag_bias : 0U)
78 | (layer.relu_input ? conv1d_flag_relu_input : 0U)
79 | (static_cast<uint32_t>(layer.activation) << conv1d_activation_shift);
80 const Conv1dPC pc {
81 .src = src,
82 .weights = weights,
83 .bias = bias,
84 .dst = dst,
85 .batch = batch,
86 .c_in = layer.c_in,
87 .t_in = t_in,
88 .c_out = layer.c_out,
89 .t_out = t_out,
90 .kernel_size = layer.kernel,
91 .stride = layer.stride,
92 .pad = layer.pad,
93 .flags = flags,
94 .dilation = layer.dilation,
95 };
96 return detail::make_grid_stage(conv1d_shader, pc, static_cast<size_t>(batch) * layer.c_out * t_out);
97}
void refuse(std::string_view message)
Definition Layers.hpp:74
DependencyStage make_grid_stage(const char *shader, const PC &pc, size_t invocations)
Definition Stages.hpp:38
constexpr uint32_t conv1d_activation_shift
nn_conv1d and nn_conv1d_grouped flag bits 2 and 3: the output activation, 0 none, 1 ReLU,...
Definition Layouts.hpp:39
constexpr const char * conv1d_shader
Definition Layouts.hpp:24
uint32_t conv1d_length(const Conv1d &layer, uint32_t t_in)
Output length of a convolution, 0 when the window does not fit the padded input.
Definition Layers.hpp:88
constexpr uint32_t conv1d_flag_bias
nn_conv1d flag bit: add the bias.
Definition Layouts.hpp:35
constexpr uint32_t conv1d_flag_relu_input
nn_conv1d flag bit: apply ReLU to the input.
Definition Layouts.hpp:37

References MayaFlux::Yantra::TensorKernels::Conv1d::activation, MayaFlux::Yantra::TensorKernels::Conv1d::c_in, MayaFlux::Yantra::TensorKernels::Conv1d::c_out, conv1d_activation_shift, conv1d_flag_bias, conv1d_flag_relu_input, conv1d_length(), conv1d_shader, MayaFlux::Yantra::TensorKernels::Conv1d::dilation, MayaFlux::Yantra::TensorKernels::Conv1d::kernel, MayaFlux::Yantra::TensorKernels::detail::make_grid_stage(), MayaFlux::Yantra::TensorKernels::Conv1d::pad, MayaFlux::Yantra::TensorKernels::detail::refuse(), MayaFlux::Yantra::TensorKernels::Conv1d::relu_input, and MayaFlux::Yantra::TensorKernels::Conv1d::stride.

Referenced by MayaFlux::Yantra::HubertPhonemeModel::Impl::run(), and MayaFlux::Yantra::SileroVadModel::Impl::run().

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