linear_and_affine

linear_and_affine#

Generalized linear operator layer and associated utilities.

Classes

AddBias

Shifts an input by a learnable offset (a bias).

Affine

Affine layer: combination of Linear and AddBias.

ConstantRescale

Applies a constant scaling factor.

Linear

A generalized linear (not affine) operator, for named arrays.

LinearInPlace

Container for "in-place" linear operators that preserve axis names.

LinearOperatorWeightInitializer

Protocol for an initializer for a general linear NamedArray weight.

NamedEinsum

An Einsum operation that contracts based on axis names.

RenameAxes

Convenience layer that renames axes of its input.

Functions

check_unique_axis_names_for_initializer(...)

Checks that indices appear exactly once in the given axis specifications.

constant_initializer(value)

Returns an initializer that uses a constant value.

contract(names, left, right)

Contracts two named arrays along the given axis names.

variance_scaling_initializer(key, *, scale, ...)

Generic variance scaling initializer.

zero_initializer(key, *, input_axes, ...)

Zeros initializer for named arrays.