Forge Operations Reference

Welcome to the Forge Operations Reference. This page provides a comprehensive guide to all supported operations in the Forge framework.

Overview

Forge operations are organized into logical categories based on their functionality. Each operation is documented with detailed information including function signatures, parameters, examples, and usage notes.

Quick Navigation


Elementwise Operations

Mathematical operations applied element-wise.

OperationDescriptionLink
AbsComputes the elementwise absolute value of the input tensor.forge.op.Abs
AddElementwise add of two tensorsforge.op.Add
AtanElementwise arctangent (atan)forge.op.Atan
BitwiseAndBitwise and operation.forge.op.BitwiseAnd
CastCastforge.op.Cast
ClipClips tensor values between min and maxforge.op.Clip
ConcatenateConcatenate tensors along axisforge.op.Concatenate
CosineElementwise cosineforge.op.Cosine
DivideElementwise divide of two tensorsforge.op.Divide
EqualElementwise equal of two tensorsforge.op.Equal
ErfError function (erf)forge.op.Erf
ExpExponent operation.forge.op.Exp
GreaterElementwise greater of two tensorsforge.op.Greater
GreaterEqualElementwise greater or equal of two tensorsforge.op.GreaterEqual
HeavisideElementwise max of two tensorsforge.op.Heaviside
IdentityIdentity operation.forge.op.Identity
IndexCopyCopies the elements of value into operandA at index along dimforge.op.IndexCopy
LessElementwise less of two tensorsforge.op.Less
LessEqualElementwise less or equal of two tensorsforge.op.LessEqual
LogLog operation: natural logarithm of the elements of operandAforge.op.Log
LogicalAndLogical and operation.forge.op.LogicalAnd
LogicalNotLogical not operation.forge.op.LogicalNot
MaxElementwise max of two tensorsforge.op.Max
MinElementwise min of two tensorsforge.op.Min
MultiplyElementwise multiply of two tensorsforge.op.Multiply
NotEqualElementwise equal of two tensorsforge.op.NotEqual
PowPow operation: operandA to the power of exponentforge.op.Pow
PowerOperandA to the power of OperandBforge.op.Power
ReciprocalReciprocal operation.forge.op.Reciprocal
Remainderforge.op.Remainder
SineElementwise sineforge.op.Sine
SqrtSquare root.forge.op.Sqrt
StackStack tensors along new axisforge.op.Stack
SubtractElementwise subtraction of two tensorsforge.op.Subtract
Whereforge.op.Where

Convolution Operations

Convolution and related transformations.

OperationDescriptionLink
Conv2dConv2d transformation on input activations, with optional bias.forge.op.Conv2d
Conv2dTransposeConv2dTranspose transformation on input activations, with optional bias.forge.op.Conv2dTranspose

Pooling Operations

Pooling and downsampling operations.

OperationDescriptionLink
AvgPool1dAvgpool1d transformation on input activationsforge.op.AvgPool1d
AvgPool2dAvgpool2d transformation on input activationsforge.op.AvgPool2d
MaxPool1dMaxPool1d transformation on input activationsforge.op.MaxPool1d
MaxPool2dMaxpool2d transformation on input activationsforge.op.MaxPool2d

Normalization Operations

Batch and layer normalization.

OperationDescriptionLink
BatchnormBatch normalization.forge.op.Batchnorm
DropoutDropoutforge.op.Dropout
LayernormLayer normalization.forge.op.Layernorm
LogSoftmaxLogSoftmax operation.forge.op.LogSoftmax
SoftmaxSoftmax operation.forge.op.Softmax

Tensor Manipulation

Reshaping, slicing, and tensor operations.

OperationDescriptionLink
AdvIndexTMforge.op.AdvIndex
BroadcastTMforge.op.Broadcast
ConstantPadTM - Direct TTIR constant padding operation.forge.op.ConstantPad
Downsample2dDownsample 2D operationforge.op.Downsample2d
IndexTMforge.op.Index
PadTMforge.op.Pad
PixelShufflePixel shuffle operation.forge.op.PixelShuffle
RepeatRepeats this tensor along the specified dimensions.forge.op.Repeat
RepeatInterleaveRepeat elements of a tensor.forge.op.RepeatInterleave
ReshapeTMforge.op.Reshape
Resize1dResize input activations, with default mode 'nearest'forge.op.Resize1d
Resize2dResizes the spatial dimensions of a 2D input tensor using interpolation.forge.op.Resize2d
SelectTMforge.op.Select
SqueezeTMforge.op.Squeeze
TransposeTranpose X and Y (i.e. rows and columns) dimensions.forge.op.Transpose
UnsqueezeTMforge.op.Unsqueeze
Upsample2dUpsample 2D operationforge.op.Upsample2d

Reduction Operations

Aggregation and reduction operations.

OperationDescriptionLink
ArgmaxArgmaxforge.op.Argmax
ReduceAvgReduce by averaging along the given dimensionforge.op.ReduceAvg
ReduceMaxReduce by taking maximum along the given dimensionforge.op.ReduceMax
ReduceSumReduce by summing along the given dimensionforge.op.ReduceSum

Linear Operations

Matrix multiplication and linear transformations.

OperationDescriptionLink
MatmulMatrix multiplication transformation on input activations, with optional bias. y...forge.op.Matmul

Activation Functions

Non-linear activation functions.

OperationDescriptionLink
GeluGeLUforge.op.Gelu
LeakyReluLeaky ReLUforge.op.LeakyRelu
ReluApplies the Rectified Linear Unit (ReLU) activation function elementwise.forge.op.Relu
SigmoidSigmoidforge.op.Sigmoid
TanhTanh operation.forge.op.Tanh

Memory Operations

Cache and memory management operations.

OperationDescriptionLink
FillCacheFillCache op writes the input into the cache tensor starting at the specified up...forge.op.FillCache
UpdateCacheUpdateCache writes a single token (S=1) slice into the cache tensor on specified...forge.op.UpdateCache

Other Operations

Miscellaneous operations.

OperationDescriptionLink
ConstantOp representing user-defined constantforge.op.Constant
CumSumCumulative sum operation.forge.op.CumSum
EmbeddingEmbedding lookupforge.op.Embedding

Documentation Structure

Each operation documentation page includes:

  • Overview: Brief description of what the operation does
  • Function Signature: Python API signature with type hints
  • Parameters: Detailed parameter descriptions with types and defaults
  • Returns: Return value description
  • Mathematical Definition: Mathematical formula (where applicable)
  • Related Operations: Links to related operations

This documentation is automatically generated from operation definitions in forge/forge/op/*.py. For the most up-to-date information, refer to the source code.