Skip to main content

Module window

Module window 

Source
Expand description

Convolutions and windowed reductions on row-major buffers, with XLA’s semantics.

As in crate::array, shapes are assumed to have been checked (by shape inference); the functions panic on inconsistent inputs.

Structs§

ConvDims
The dimension numbers of a convolution, as JAX’s ConvDimensionNumbers: each spec lists dimensions of an operand or of the result.
ConvWindow
The window of a convolution: one entry per spatial dimension.
Window
The window of a windowed reduction: one entry per operand dimension.

Functions§

conv_general_dilated
conv_general_dilated: XLA’s convolution, with feature groups (the input features and the output features are split into feature_group_count groups, and output group g sees input group g) and batch groups (the input batch is split into batch_group_count groups, the major part of the batch dimension, and output feature group g sees batch group g).
conv_shape
The shape of the result of a convolution.
conv_terms
The products that conv_general_dilated sums, in its order: for each element of the result (row-major), [result, lhs, rhs] positions of the operands’ elements whose products are added, from zero, in this order (to compile small convolutions as a table: the same sums as the kernel, bit for bit, for the types it does not fuse or widen, that is, other than f64, f16, and bf16).
dilate_dim
The size of a dimension of size d after dilation: 1 + dilation * (d - 1), or 0 for an empty dimension.
reduce_window
reduce_window_sum, reduce_window_max, reduce_window_min: combines the elements of each window, from the identity, in row-major order of the window (padding and holes are skipped). This is XLA’s order on CPU for windows without padding; with padding, XLA sums some windows in another order.
reduce_window_shape
The shape of the result of a windowed reduction.
select_and_gather_add
select_and_gather_add: for each window of operand, the element of tangents at the position of the selected element of operand (ge: the first maximum, otherwise the first minimum), or 0 if the window covers no element.
select_and_scatter_add
select_and_scatter_add: for each window of operand (of shape shape), selects an element (ge: the first maximum, otherwise the first minimum, as XLA’s select_and_scatter with the comparison as select) and adds the window’s element of source to it in the result (zeros elsewhere). Windows are visited in row-major order.
stride_dim
The number of windows of size window with step stride in a dimension of size d: max(0, (d - window) / stride + 1).