74 [[noreturn]]
inline void refuse(std::string_view message)
77 std::source_location::current(),
"{}", message);
91 detail::refuse(
"Conv1d needs a kernel, stride and dilation of at least 1");
93 const uint64_t span =
static_cast<uint64_t
>(layer.
dilation) * (layer.
kernel - 1U) + 1U;
94 const uint64_t padded =
static_cast<uint64_t
>(t_in) + 2ULL * layer.
pad;
95 return padded < span ? 0U : static_cast<uint32_t>((padded - span) / layer.
stride + 1U);
107 detail::refuse(
"Grouped Conv1d needs a kernel, stride and groups of at least 1");
109 const uint64_t padded =
static_cast<uint64_t
>(t_in) + 2ULL * layer.
pad;
110 if (padded < layer.
kernel) {
113 const uint64_t full = (padded - layer.
kernel) / layer.
stride + 1U;
114 return full > layer.
trim ?
static_cast<uint32_t
>(full - layer.
trim) : 0U;
120[[nodiscard]]
constexpr uint32_t
frame_audio_length(uint32_t chunk_size, uint32_t context, uint32_t pad)
122 return context + chunk_size + pad;
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
void refuse(std::string_view message)
NormAffine
Which index selects the weight and bias applied after a normalisation.
@ Along
The position along the normalised axis, as layer normalisation does.
@ Outer
The outer index, as a per channel normalisation over time does.
Activation
Output activation of a layer.
constexpr uint32_t frame_audio_length(uint32_t chunk_size, uint32_t context, uint32_t pad)
Length of one frame nn_frame_audio writes.
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.
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.
One convolution layer over [batch, c_in, t_in], with weights [c_out, c_in, kernel].
One grouped convolution layer over [batch, c_in, t_in], with weights [c_out, c_in / groups,...