Extra operators

class stride.utils.operators.Add(*args, **kwargs)[source]

Bases: stride.core.Operator

adjoint(d_sum, a, b, **kwargs)[source]

Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.

The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.

The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not needs_grad).

This method should not be called directly from user code.

Parameters
  • args

  • kwargs

forward(a, b, **kwargs)[source]

Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.

The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.

Positional and keyword arguments to forward are processed so that present variables are tracked.

This method should not be called directly from user code.

Parameters
  • args

  • kwargs

class stride.utils.operators.Concatenate(*args, **kwargs)[source]

Bases: stride.core.Operator

adjoint(d_concat, *args, **kwargs)[source]

Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.

The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.

The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not needs_grad).

This method should not be called directly from user code.

Parameters
  • args

  • kwargs

forward(*args, **kwargs)[source]

Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.

The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.

Positional and keyword arguments to forward are processed so that present variables are tracked.

This method should not be called directly from user code.

Parameters
  • args

  • kwargs

class stride.utils.operators.Mul(*args, **kwargs)[source]

Bases: stride.core.Operator

adjoint(d_mul, a, b, **kwargs)[source]

Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.

The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.

The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not needs_grad).

This method should not be called directly from user code.

Parameters
  • args

  • kwargs

forward(a, b, **kwargs)[source]

Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.

The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.

Positional and keyword arguments to forward are processed so that present variables are tracked.

This method should not be called directly from user code.

Parameters
  • args

  • kwargs