Tannic
A C++ Tensor Library
|
Expression for 1D convolution operations. More...
#include <convolutions.hpp>
Public Member Functions | |
constexpr type | promote (type signal, type kernel) const |
Type promotion for 1D convolution. | |
constexpr Shape | transform (Shape const &signal, Shape const &kernel) const |
Computes output shape for 1D convolution. | |
void | forward (Tensor const &signal, Tensor const &kernel, Tensor &result) const |
Performs the forward pass of 1D convolution. | |
Public Attributes | |
std::array< std::size_t, 1 > | strides |
Stride values for the convolution operation. | |
std::array< std::size_t, 1 > | padding |
Padding values for the convolution operation. | |
Expression for 1D convolution operations.
Implements 1D convolution with:
void tannic::transformation::Convolution1D::forward | ( | Tensor const & | signal, |
Tensor const & | kernel, | ||
Tensor & | result | ||
) | const |
Performs the forward pass of 1D convolution.
signal | Input signal tensor |
kernel | Convolution kernel tensor |
result | Output tensor to store convolution result |
|
inlineconstexpr |
Type promotion for 1D convolution.
Requires both signal and kernel to have identical data types.
signal | Data type of the input signal tensor |
kernel | Data type of the kernel tensor |
Exception | if signal and kernel dtypes don't match |
|
inlineconstexpr |
Computes output shape for 1D convolution.
Calculates the output shape based on input signal shape, kernel shape, strides, and padding using the standard convolution formula.
signal | Shape of the input signal tensor (N, C_in, L_in) |
kernel | Shape of the kernel tensor (C_out, K_in, K_len) |
Exception | if input ranks are not 3 or channel dimensions don't match |
Expected input shapes:
Output length formula: L_out = (L_in + 2*padding - K_len) / stride + 1
std::array<std::size_t, 1> tannic::transformation::Convolution1D::padding |
Padding values for the convolution operation.
std::array<std::size_t, 1> tannic::transformation::Convolution1D::strides |
Stride values for the convolution operation.