3.3. unit_scaling.constraints

Common scale-constraints used in unit-scaled operations.

Type Aliases

Functions

amean(*scales)

Computes the arithmetic mean of the provided scales.

apply_constraint(constraint_name, *scales)

Retrieves the constraint function corresponding to constraint_name and applies it to the group of scales.

gmean(*scales)

Computes the geometric mean of the provided scales.

hmean(*scales)

Computes the harmonic mean of the provided scales.

to_grad_input_scale(output_scale, ...)

Assumes two provided scales: (output_scale, grad_input_scale).

to_left_grad_scale(output_scale, ...)

Assumes three provided scales: (output_scale, left_grad_scale, right_grad_scale).

to_output_scale(output_scale, *grad_input_scale)

Assumes an output scale is provided and any number of grad input scales: (output_scale, *grad_input_scales).

to_right_grad_scale(output_scale, ...)

Assumes three provided scales: (output_scale, left_grad_scale, right_grad_scale).