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

◆ grouped_conv1d_stage()

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

One nn_conv1d_grouped dispatch: [batch, c_in, t_in] to [batch, c_out, grouped_conv1d_length].

Parameters
layerThe layer. Both channel counts must be multiples of groups.
srcDevice address of the input.
weightsDevice address of the weights, [c_out, c_in / groups, 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, the groups do not divide the channels or the output would be empty.

Definition at line 110 of file Stages.hpp.

112{
113 const uint32_t t_out = grouped_conv1d_length(layer, t_in);
114 if (layer.c_in == 0 || layer.c_out == 0 || batch == 0 || t_out == 0) {
115 detail::refuse("Grouped Conv1d has no input channels, output channels, batch or output length");
116 }
117 if (layer.c_in % layer.groups != 0 || layer.c_out % layer.groups != 0) {
118 detail::refuse("Grouped Conv1d needs channel counts that are multiples of its groups");
119 }
120 const uint32_t flags = (bias != 0 ? conv1d_flag_bias : 0U)
121 | (static_cast<uint32_t>(layer.activation) << conv1d_activation_shift);
122 const GroupedConv1dPC pc {
123 .src = src,
124 .weights = weights,
125 .bias = bias,
126 .dst = dst,
127 .batch = batch,
128 .c_in = layer.c_in,
129 .t_in = t_in,
130 .c_out = layer.c_out,
131 .t_out = t_out,
132 .kernel_size = layer.kernel,
133 .stride = layer.stride,
134 .pad = layer.pad,
135 .flags = flags,
136 .groups = layer.groups,
137 };
138 return detail::make_grid_stage(grouped_conv1d_shader, pc, static_cast<size_t>(batch) * layer.c_out * t_out);
139}
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
uint32_t grouped_conv1d_length(const GroupedConv1d &layer, uint32_t t_in)
Output length of a grouped convolution after its trim, 0 when nothing is left.
Definition Layers.hpp:104
constexpr const char * grouped_conv1d_shader
Definition Layouts.hpp:27
constexpr uint32_t conv1d_flag_bias
nn_conv1d flag bit: add the bias.
Definition Layouts.hpp:35

References MayaFlux::Yantra::TensorKernels::GroupedConv1d::activation, MayaFlux::Yantra::TensorKernels::GroupedConv1d::c_in, MayaFlux::Yantra::TensorKernels::GroupedConv1d::c_out, conv1d_activation_shift, conv1d_flag_bias, grouped_conv1d_length(), grouped_conv1d_shader, MayaFlux::Yantra::TensorKernels::GroupedConv1d::groups, MayaFlux::Yantra::TensorKernels::GroupedConv1d::kernel, MayaFlux::Yantra::TensorKernels::detail::make_grid_stage(), MayaFlux::Yantra::TensorKernels::GroupedConv1d::pad, MayaFlux::Yantra::TensorKernels::detail::refuse(), and MayaFlux::Yantra::TensorKernels::GroupedConv1d::stride.

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

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