For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
causal_conv1d_update_cpu_no_bias
def causal_conv1d_update_cpu_no_bias[x_dtype: DType, conv_state_dtype: DType, weight_dtype: DType, output_dtype: DType](batch: Int, dim: Int, seqlen: Int, width: Int, state_len: Int, x: TileTensor[x_dtype, Storage=x.Storage, address_space=x.address_space, linear_idx_type=x.linear_idx_type], conv_state: TileTensor[conv_state_dtype, Storage=conv_state.Storage, address_space=conv_state.address_space, linear_idx_type=conv_state.linear_idx_type], weight: TileTensor[weight_dtype, Storage=weight.Storage, address_space=weight.address_space, linear_idx_type=weight.linear_idx_type], output: TileTensor[output_dtype, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type], x_batch_stride: UInt32, x_c_stride: UInt32, x_l_stride: UInt32, conv_state_batch_stride: UInt32, conv_state_c_stride: UInt32, conv_state_l_stride: UInt32, weight_c_stride: UInt32, weight_width_stride: UInt32, out_batch_stride: UInt32, out_c_stride: UInt32, out_l_stride: UInt32, silu_activation: Bool)
CPU implementation of causal conv1d update without bias.
Performs incremental convolution for autoregressive decode by treating
conv_state followed by x as a virtual sliding window, computing the
output for the new positions, then shifting the newest state_len
values back into conv_state in place.
Parameters:
- βx_dtype (
DType): Element type of the input tensorx. - βconv_state_dtype (
DType): Element type of the convolution state tensorconv_state. - βweight_dtype (
DType): Element type of the weight tensorweight. - βoutput_dtype (
DType): Element type of the output tensoroutput.
Args:
- βbatch (
Int): Number of sequences processed in parallel. - βdim (
Int): Number of channels per sequence position. - βseqlen (
Int): Number of new input positions inx(1 for autoregressive decode). - βwidth (
Int): Convolution kernel width in positions. - βstate_len (
Int): Length of the rolling buffer stored inconv_state; must be at leastwidth - 1. - βx (
TileTensor[x_dtype, Storage=x.Storage, address_space=x.address_space, linear_idx_type=x.linear_idx_type]): Input tensor of shape (B, C, L) holding the new positions to convolve. - βconv_state (
TileTensor[conv_state_dtype, Storage=conv_state.Storage, address_space=conv_state.address_space, linear_idx_type=conv_state.linear_idx_type]): Rolling convolution state of shape (B, C, S) that holds the laststate_lenvalues; updated in place. - βweight (
TileTensor[weight_dtype, Storage=weight.Storage, address_space=weight.address_space, linear_idx_type=weight.linear_idx_type]): Convolution weights of shape (C, W). - βoutput (
TileTensor[output_dtype, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): Output tensor of shape (B, C, L) receiving the convolved values for the new positions. - βx_batch_stride (
UInt32): Stride in elements between batches ofx. - βx_c_stride (
UInt32): Stride in elements between channels ofx. - βx_l_stride (
UInt32): Stride in elements between sequence positions ofx. - βconv_state_batch_stride (
UInt32): Stride in elements between batches ofconv_state. - βconv_state_c_stride (
UInt32): Stride in elements between channels ofconv_state. - βconv_state_l_stride (
UInt32): Stride in elements between state positions ofconv_state. - βweight_c_stride (
UInt32): Stride in elements between channels ofweight. - βweight_width_stride (
UInt32): Stride in elements between taps ofweightalong the kernel-width dimension. - βout_batch_stride (
UInt32): Stride in elements between batches ofoutput. - βout_c_stride (
UInt32): Stride in elements between channels ofoutput. - βout_l_stride (
UInt32): Stride in elements between sequence positions ofoutput. - βsilu_activation (
Bool): Whether to apply the SiLU activation to the output values before storing.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!