psyclone.psyad.transformations.assignment_trans

This module contains a transformation that replaces a PSyIR assignment node with its adjoint form.

Classes

  • AssignmentTrans: Implements a transformation to translate a Tangent-Linear

class psyclone.psyad.transformations.assignment_trans.AssignmentTrans(active_variables)

Implements a transformation to translate a Tangent-Linear assignment to its Adjoint form.

Inheritance

Inheritance diagram of AssignmentTrans
apply(node, options=None)

Apply the Assignment transformation to the specified node. The node must be a valid tangent-linear assignment. The assignment is replaced with its adjoint version.

Parameters:
property name
Returns:

the name of the transformation as a string.

Return type:

str

validate(node, options=None)

Perform various checks to ensure that it is valid to apply the AssignmentTrans transformation to the supplied PSyIR Node.

Parameters:
  • node (psyclone.psyir.nodes.Assignment) – the node that is being checked.

  • options (Optional[Dict[str, Any]]) – a dictionary with options for transformations.

Raises:
  • TransformationError – if the node argument is not an Assignment.

  • TangentLinearError – if the assignment does not conform to the required tangent-linear structure.