unary¶
The Ops that have a single input and output are called Unary Ops. Usually this means that an Operation is applied elementwise.
This file contains all of the unary operations in Tricycle.
- class Batch[source]¶
Bases:
Op
A class for batching a tensor.
- is_batched: bool¶
- class UnaryAdd[source]¶
Bases:
Op
A class for adding a constant to a tensor elementwise.
- class UnaryCos[source]¶
Bases:
Op
A class for computing the cosine of a tensor elementwise.
- class UnaryDivide[source]¶
Bases:
Op
A class for dividing a constant by a tensor elementwise.
- class UnaryExp[source]¶
Bases:
Op
A class for computing the exponential of a tensor elementwise.
- class UnaryLog[source]¶
Bases:
Op
A class for computing the natural logarithm of a tensor elementwise.
- REALLY_SMALL_NUMBER = 1e-06¶
- class UnaryMask[source]¶
Bases:
Op
A class for applying a binary mask to a tensor.
- class UnaryMax[source]¶
Bases:
Op
A class for computing the elementwise maximum of a tensor and a constant.
- class UnaryMin[source]¶
Bases:
Op
A class for computing the elementwise minimum of a tensor and a constant.
- class UnaryMultiply[source]¶
Bases:
Op
A class for multiplying a tensor by a constant elementwise.
- class UnaryPower[source]¶
Bases:
Op
A class for raising a tensor to a constant power elementwise.
- class UnarySin[source]¶
Bases:
Op
A class for computing the sine of a tensor elementwise.
- class UnarySquareRoot[source]¶
Bases:
Op
A class for computing the square root of a tensor elementwise.
- class UnarySubtract[source]¶
Bases:
Op
A class for subtracting a constant from a tensor elementwise.
- class UnarySum[source]¶
Bases:
Op
A class for summing all values in a tensor.
- class Unbatch[source]¶
Bases:
Op
A class for unbatching a tensor.
- is_batched: bool¶
- nothing(tensor)[source]¶
Do nothing to a tensor.
Operations like addition have a back_fn of multiplying by 1 which is equivalent to doing nothing. Instead of adding a bunch of checks to see whether a back_fn exists or not, the logic is much simpler by adding this function that does nothing.
- Parameters:
tensor – The input tensor.
- Returns:
The input tensor unchanged.