function#

Classes

BackwardContext(backward_fn[, backward_engine])

Represents a context for backward computation.

class BackwardContext(backward_fn: Callable, backward_engine: BackwardEngine = None, *args, **kwargs)[source]#

Bases: object

Represents a context for backward computation.

Parameters:
  • backward_fn (callable) – The backward function to be called during backward computation.

  • args – Variable length argument list to be passed to the backward function.

  • kwargs – Arbitrary keyword arguments to be passed to the backward function.

Variables:
  • backward_fn (callable) – The backward function to be called during backward computation.

  • fn_name (str) – The fully qualified name of the backward function.

  • args – Variable length argument list to be passed to the backward function.

  • kwargs – Arbitrary keyword arguments to be passed to the backward function.

Method __call__(backward_engine:

EngineLM) -> Any: Calls the backward function with the given backward engine and returns the result.

Method __repr__() -> str:

Returns a string representation of the BackwardContext object.