Welcome to TT-NN documentation!
TTNN
- What is ttnn?
- Getting Started
-
Using ttnn
-
Basic Examples
- 1. Converting from and to torch tensor
- 2. Running an operation on the device
- 3. Using __getitem__ to slice the tensor
- 4. Enabling program cache
- 5. Debugging intermediate tensors
- 6. Tracing the graph of operations
- 7. Using tt_lib operation in ttnn
- 8. Enabling Logging
- 9. Supported Python Operators
- 10. Changing the string representation of the tensor
- 11. Visualize using Web Browser
- 12. Register pre- and/or post-operation hooks
- 13. Query all operations
- 14. Disable Fallbacks
-
Basic Examples
- Tensor
-
APIs
- Device
- Memory Config
-
Operations
- Core
- Tensor Creation
- Matrix Multiplication
-
Pointwise Unary
- ttnn.abs
- ttnn.acos
- ttnn.acosh
- ttnn.asin
- ttnn.asinh
- ttnn.atan
- ttnn.atan2
- ttnn.atanh
- ttnn.cbrt
- ttnn.celu
- ttnn.clip
- ttnn.clone
- ttnn.cos
- ttnn.cosh
- ttnn.deg2rad
- ttnn.digamma
- ttnn.elu
- ttnn.erf
- ttnn.erfc
- ttnn.erfinv
- ttnn.exp
- ttnn.exp2
- ttnn.expm1
- ttnn.geglu
- ttnn.gelu
- ttnn.glu
- ttnn.hardshrink
- ttnn.hardsigmoid
- ttnn.hardswish
- ttnn.hardtanh
- ttnn.heaviside
- ttnn.hypot
- ttnn.i0
- ttnn.isfinite
- ttnn.isinf
- ttnn.isnan
- ttnn.isneginf
- ttnn.isposinf
- ttnn.leaky_relu
- ttnn.lerp
- ttnn.lgamma
- ttnn.log
- ttnn.log10
- ttnn.log1p
- ttnn.log2
- ttnn.log_sigmoid
- ttnn.logical_not
- ttnn.logit
- ttnn.mish
- ttnn.multigammaln
- ttnn.neg
- ttnn.prelu
- ttnn.reglu
- ttnn.relu
- ttnn.relu6
- ttnn.rsqrt
- ttnn.sigmoid
- ttnn.sigmoid_accurate
- ttnn.sign
- ttnn.silu
- ttnn.sin
- ttnn.sinh
- ttnn.softmax
- ttnn.softplus
- ttnn.softshrink
- ttnn.softsign
- ttnn.swish
- ttnn.tan
- ttnn.tanh
- ttnn.signbit
- ttnn.polygamma
- ttnn.rad2deg
- ttnn.reciprocal
- ttnn.sqrt
- ttnn.square
- ttnn.swiglu
- ttnn.tril
- ttnn.triu
- ttnn.tanhshrink
- ttnn.threshold
-
Pointwise Binary
- ttnn.add
- ttnn.multiply
- ttnn.subtract
- ttnn.pow
- ttnn.ldexp
- ttnn.logical_and
- ttnn.logical_or
- ttnn.logical_xor
- ttnn.logaddexp
- ttnn.logaddexp2
- ttnn.xlogy
- ttnn.squared_difference
- ttnn.gtz
- ttnn.ltz
- ttnn.gez
- ttnn.lez
- ttnn.nez
- ttnn.eqz
- ttnn.gt
- ttnn.ge
- ttnn.lt
- ttnn.le
- ttnn.eq
- ttnn.ne
- ttnn.isclose
- ttnn.polyval
- ttnn.nextafter
- ttnn.maximum
- ttnn.minimum
- Pointwise Ternary
- Losses
- Reduction
- Data Movement
- Normalization
- Transformer
- Embedding
- Pooling
- Vision
- KV Cache
- Model Conversion
- Reports
- Operation Hooks
-
Tutorials
-
Tensor and Add Operation
-
Tensor and Add Operation
- Creating a tensor
- Host Storage: Borrowed vs Owned
- Data Type
- Layout
- Device storage
- Open the device
- Initialize tensors a and b with random values using torch
- Add tensor a and b
- Inspect the output tensor of the add in ttnn
- Convert to torch and inspect the attributes of the torch tensor
- Close the device
-
Tensor and Add Operation
- Matmul Operation
-
Multi-Head Attention
-
Multi-Head Attention
- Enable program cache
- Write Multi-Head Attention using ttnn
- Configuration
- Initialize activations and weights using torch
- Convert activations and weights to ttnn
- Run the first iteration of Multi-Head Attention
- Run a subsequent iteration of Multi-Head Attention
- Write optimized version of Multi-Head Attention
- Pre-process the parameters of the optimized model
- Run the first iteration of the optimized Multi-Head Attention
- Run a subsequent iteration of the optimized Multi-Head Attention
- Check that the output of the optimized version matches the output of the original implementation
- Close the device
-
Multi-Head Attention
- ttnn Tracer
- ttnn Profiling
- Resnet Basic Block
- Graphing Torch DiT_XL_2 With TTNN
-
Tensor and Add Operation
- Onboarding New Functionality
- Converting torch Model to ttnn
- Adding New ttnn Operation
- Profiling ttnn Operations
-
Dependencies
-
TT-LIB
- Overview
-
TT-LIB API through
tt_lib-
Primary Operations
layernorm()add_layernorm()softmax_in_place()moreh_softmax()moreh_softmax_backward()moreh_softmin()moreh_softmin_backward()moreh_logsoftmax()moreh_logsoftmax_backward()scale_mask_softmax_in_place()moreh_mean()moreh_mean_backward()moreh_groupnorm()moreh_groupnorm_backward()moreh_norm()moreh_norm_backward()
- Enums
-
Tensor elementwise operations
div()div_no_nan()add_unary()sub_unary()mul_unary()div_unary()gelu()relu()relu6()relu_min()relu_max()exp()recip()sqrt()log()log2()log10()log1p()tanh()clip()hardtanh()deg2rad()rad2deg()cbrt()hypot()softplus()mish()polyval()sign()abs()silu()square()neg()add1()mac()sigmoid()sigmoid_accurate()hardsigmoid()swish()hardswish()leaky_relu()softsign()softshrink()hardshrink()cos()sin()cosh()sinh()acos()asin()elu()exp2()tanhshrink()heaviside()right_shift()left_shift()atan()atanh()atan2()logical_xor()logical_xori()logical_not_unary()subalpha()celu()addalpha()bias_gelu_unary()isfinite()isinf()isposinf()isneginf()isnan()logit()lgamma()logical_andi()erfinv()multigammaln()assign()isclose()i0()digamma()tan()logical_ori()polygamma()floor()trunc()round()floor_div()
- Tensor relational operations
- Tensor ternary operations
- Tensor matrix math operations
- Tensor creation operations
- Broadcast and Reduce
-
Primary Operations
-
Fallback Operations
full()tensor_slice()reshape()chunk()conv2d()group_norm()layer_norm()pad()interpolate()repeat()repeat_interleave()concat()silu()softmax()Conv2dBatchNorm2dGroupNormLayerNormMaxPool2dAdaptiveAvgPool2dceilfloortruncunary_fmodbinary_fmodbitwise_notunary_bitwise_orunary_bitwise_andunary_bitwise_xorbinary_bitwise_orbinary_bitwise_andbinary_bitwise_xorunary_bitwise_left_shiftunary_bitwise_right_shiftbinary_bitwise_left_shiftbinary_bitwise_right_shifttorch_argmaxtorch_argmin
-
Experimental Operations
-
Fused Operations from
tt_libMini-Graph Library - Complex Operations
- Complex Operations (Type 2)
-
Other Operations
concat()sum()log_sigmoid()expm1()asinh()acosh()erf()erfc()rsqrt()lerp()signbit()fill_rm()fill_ones_rm()conv()layernorm()groupnorm()rmsnorm()add_layernorm()convert_conv_weight_tensor_to_tiled_layout()xlogy()prod()tiled_prod()addcmul()addcdiv()mean_hw()var_hw()logical_noti()std_hw()normalize_hw()normalize_global()glu()geglu()reglu()swiglu()embeddings()nextafter()lamb_optimizer()repeat()repeat_interleave()pow()identity()argmax()argmin()
-
Backward Operations
prod_bw()addalpha_bw()addcmul_bw()addcdiv_bw()conj_bw()unary_mul_bw()unary_add_bw()unary_assign_bw()binary_assign_bw()unary_div_bw()div_bw()rdiv_bw()sqrt_bw()mul_bw()max_bw()min_bw()add_bw()tan_bw()exp_bw()exp2_bw()expm1_bw()unary_pow_bw()embedding_bw()where_bw()tanh_bw()fill_zero_bw()fill_bw()sub_bw()unary_sub_bw()log_bw()rsub_bw()abs_bw()complex_abs_bw()rsqrt_bw()neg_bw()lt_bw()gt_bw()relu_bw()ne_bw()clamp_bw()clamp_min_bw()clamp_max_bw()binary_le_bw()atan2_bw()hypot_bw()gelu_bw()bias_gelu_bw()bias_gelu_unary_bw()squared_difference_bw()lerp_bw()ldexp_bw()xlogy_bw()logaddexp_bw()logaddexp2_bw()concat_bw()hardsigmoid_bw()i0_bw()hardshrink_bw()softshrink_bw()hardswish_bw()softplus_bw()polygamma_bw()atan_bw()atanh_bw()asin_bw()asinh_bw()cosh_bw()cos_bw()acosh_bw()acos_bw()erfinv_bw()leaky_relu_bw()elu_bw()hardtanh_bw()angle_bw()sin_bw()sinh_bw()celu_bw()binary_lt_bw()subalpha_bw()log10_bw()log1p_bw()binary_ne_bw()erf_bw()erfc_bw()digamma_bw()deg2rad_bw()rad2deg_bw()reciprocal_bw()relu6_bw()rpow_bw()silu_bw()selu_bw()binary_ge_bw()binary_eq_bw()binary_gt_bw()square_bw()lgamma_bw()trunc_bw()frac_bw()log_sigmoid_bw()tanhshrink_bw()threshold_bw()unary_eq_bw()logit_bw()logiteps_bw()softsign_bw()sign_bw()ceil_bw()log2_bw()ge_bw()le_bw()unary_fmod_bw()unary_remainder_bw()complex_recip_bw()imag_bw()real_bw()complex_mul_bw()complex_div_bw()polar_bw()complex_add_bw()complex_sub_bw()multigammaln_bw()repeat_bw()floor_bw()round_bw()unary_div_no_nan_bw()
- Loss Functions
-
Fused Operations from
- Tensor
- Examples of Tensor and TT-LIB Use
-
TT-LIB
- Building and Uplifting Demos
- Placeholder title
Models