ncdl.Stencil

class ncdl.Stencil(stencil: List[Tuple], lattice: Lattice, center: Tuple | None = None)

Stencil – a container class for filters. These specify the exact geometry that convolution filters take.

__init__(stencil: List[Tuple], lattice: Lattice, center: Tuple | None = None)

Wraps a list of stencil points and validates that it belongs to a given lattice structure.

Parameters:
  • stencil – The input list of points. Input points must all be >= 0.

  • lattice – The input lattice factory instance. Stencil points must belong on this lattice.

Methods

__init__(stencil, lattice[, center])

Wraps a list of stencil points and validates that it belongs to a given lattice structure.

coset_decompose([packed_output])

This function partitions the stencil into 'n' sets, where 'n' is the number of Cartesian cosets of the parent lattice.

delta_shift(lt, coset_i, coset_j[, additive])

Returns the appropriate delta shift from the paper.

full_pad_lattice_tensor(lt[, mode, value])

is_coset_square(coset_index)

Testes whether a coset of a stencil is square (i.e. packed).

pad_lattice_tensor(lt[, mode, value])

Utility method to appropriately pad a lattice tensor.

padding_for_lattice_tensor(lt)

Utility method to calculate lattice tensor padding.

stencil_boundaries(coset_index[, canonical, ...])

Returns the boundaries of the stencil.

unpack_weights(coset, weights, indices)

Upacks a weight tensor.

weight_index(coset)

Gets an index into a weight parameter tensor.

zero_weights(coset, channels_in, channels_out)

Creates an empty tensor of weights.