core.transformer.identity_op#

Module Contents#

Classes#

IdentityOp

This is a placeholder for IdentityOp(x) -> x

IdentityFuncOp

This is a placeholder for IdentityFuncOp(…)(x) -> IdentityOp(x) -> x. Such a func is handy for ops like bias_dropout_fusion which themselves return a function at runtime based on passed arguments

Data#

T

API#

core.transformer.identity_op.T#

‘TypeVar(…)’

class core.transformer.identity_op.IdentityOp(*args: object, **kwargs: object)#

Bases: torch.nn.Module

This is a placeholder for IdentityOp(x) -> x

Initialization

forward(
x: core.transformer.identity_op.T,
*args: object,
**kwargs: object,
) core.transformer.identity_op.T#

Forward pass.

Returns x unchanged.

class core.transformer.identity_op.IdentityFuncOp(*args: object, **kwargs: object)#

Bases: core.transformer.identity_op.IdentityOp

This is a placeholder for IdentityFuncOp(…)(x) -> IdentityOp(x) -> x. Such a func is handy for ops like bias_dropout_fusion which themselves return a function at runtime based on passed arguments

Initialization

forward(*args: object, **kwargs: object)#

Forward pass.

Returns a function which returns its first argument unchanged, and discards all others.