torch_numopt.utils.param_operations#

Functions

param_add(params_a, params_b)

Element-wise addition of two parameter groups.

param_argnums(params)

Return a tuple of indices (0, 1, ..., len(params)-1) for the parameter groups.

param_copy(params)

Creates a deep copy of a parameter group (each tensor cloned).

param_detach(params)

Detach (and clone) all tensors from the computation graph.

param_diff(params_a, params_b)

Element-wise subtraction of two parameter groups.

param_dot(params_a, params_b)

Computes the dot product between two parameter groups treated as a single flat vector.

param_flatten(params)

Flattens an entire parameter group into a single 1-dimensional tensor.

param_is_finite(params)

Checks that all elements in a parameter group are finite.

param_mult(params_a, params_b)

Element-wise (Hadamard) product of two parameter groups.

param_neg(params)

Negates every tensor in a parameter group.

param_norm(params)

Euclidean (L2) norm of a parameter group treated as a flat vector.

param_numel(params)

Returns the total amount of parameters.

param_reshape_like(params_flat, params)

Reshapes a vector into a sequence of matrices with the same shapes as the params parameter.

param_scalar_prod(scalar, params)

Multiplies every tensor in a parameter group by a scalar.

param_scaled_add(params_a, params_b, scale)

Computes params_a + scale * params_b element-wise.

param_sizes(params)

Obtains the shape of every matrix in the parameters provided.

param_transpose(params)

Transposes every 2-dimensional tensor in the parameter group.

param_zero_like(params)

Create a tuple of zero tensors with the same shapes as the input parameters.