Supported ATen APIs
This section provides a list of ATen APIs that support graph compilation. These API capabilities are equivalent to the ATen API capabilities in eager mode.
If an ATen API used by a custom model is not listed in Table 1, it indicates that the corresponding API capability may be incomplete. You need to perform Converter adaptation based on the actual situation to enable the operator for graph compilation. For detailed steps, refer to Converter Completion.
| ATen API | Constraints |
|---|---|
| torch.nn.BatchNorm1d | Supports fp16, fp32. track_running_stats is True |
| torch.nn.BatchNorm2d | Supports fp16, fp32. track_running_stats is True |
| torch.nn.BatchNorm3d | Supports fp16, fp32. track_running_stats is True |
| torch._native_batch_norm_legit_no_training | Supports fp16, fp32 |
| torch._softmax | Supports fp32 |
| torch._softmax_backward_data | Supports fp32 |
| torch.ops.aten._to_copy.default | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.addmm | Supports fp16, fp32 |
| torch.bernoulli | Supports fp16, fp32 |
| torch.clone | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.div | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.empty_like | Supports fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.Tensor.expand | Supports bf16, fp16, fp32, int16, int32, int64 |
| torch.nn.functional.gelu | Supports bf16, fp16, fp32 |
| torch.nn.functional.hardswish | Forward: supports fp16, fp32Backward: supports bf16, fp16, fp32, parameter constraint inplace=False |
| torch.nn.functional.leaky_relu | Supports bf16, fp16, fp32 |
| torch.mean | Supports bf16, fp16, fp32, complex64, complex128 |
| torch.native_layer_norm | Supports bf16, fp16, fp32 |
| torch.nn.functional.layer_norm | Supports bf16, fp16, fp32 |
| torch.ops.aten.new_empty_strided.default | - |
| torch.permute | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| torch.select | Supports fp32 |
| torch.ops.aten.slice.Tensor | Supports bf16, fp16, fp32 |
| torch.ops.aten.slice_backward.default | Supports bf16, fp16, fp32 |
| torch.sum | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.t | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.nn.Threshold | Supports fp32, uint8, int8, int16, int32, int64 |
| torch.nn.MaxPool2d | Forward: supports fp16, fp32, parameter constraint return_indice=False, dynamic=TrueBackward: supports fp16, fp32, bf16, input is 4-dimensional |
| torch.slice_scatter | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool |
| torch.nn.functional.avg_pool2d | Forward: supports fp16, fp32, parameter constraint dynamic=False, kernel_size≤255, stride≤63Backward: supports fp16, fp32 |
| torch.nn.functional.group_norm | Supports bf16, fp16, fp32 |
| sigmoid | Supports fp16, fp32, int8, int32, int64 |
| torch.sigmoid | Supports bf16, fp16, fp32, fp64 |
| torch._native_batch_norm_legit | Supports fp16, fp32, parameter constraint track_running_stats=False |
| torch.index_select | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool |
| torch.sub | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64 |
| torch.fill | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| self.new_zeros(...) | Supports fp16, fp32, fp64, bf16, int8, int16, int32, int64, uint8, bool, complex64, complex128 |
| torch.mul | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| torch.nn.functional.hardsigmoid | Supports fp16, fp32 |
| torch.clamp | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, parameter constraint min<max |
| torch.ops.aten.alias.default | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool |
| self.new_ones(...) | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool |
| torch.nn.functional.embedding | Supports int32, int64, parameter constraint max_norm=False, sparse=False, scale_grad_by_freq=False, forward not supported, _freeze=False |
| torch.nn.functional.sigmoid | Supports bf16, fp16, fp32, fp64 |
| torch.nn.functional.hardtanh | Forward: when min_val and max_val are floating-point types, input supports bf16, fp16, fp32, fp64When min_val and max_val are integer types, input supports int32, int64Backward: supports bf16, fp16, fp32 |
| torch.stack | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64 |
| torch.unbind | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool |
| torch.nn.functional.pad | Supports bf16, fp16, fp32, int16, int32, int64 |
| torch.constant_pad_nd | Supports bf16, fp16, fp32, int32, int64, bool, parameter constraint inplace=False |
| torch.nn.avgpool2d | Supports fp16, fp32, parameter constraint dynamic=False, kernelsize≤255, stride≤63 |
| torch.nn.Conv2d | Supports fp16, fp32 |
| torch.nn.Conv1d | Supports fp16, fp32 |
| torch.nn.ConvTranspose1d | Supports fp16, fp32 |
| torch.nn.ConvTranspose2d | Supports fp16, fp32 |
| torch.ops.aten.floor.default | Supports fp16, fp32 |
| torch.nn.AdaptiveAvgPool2d | Supports fp16, fp32, output_size only supports list |
| torch.fft.fft | Supports complex64 |
| torch.fft.fft2 | Supports complex64 |
| torch.nn.LogSoftmax | Supports bf16, fp16, fp32 |
| torch.abs | Supports fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.arange | Supports bf16, fp16, fp32, int32, int64 |
| torch.argmax | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64 |
| torch.as_strided | Supports fp32 |
| torch.as_strided_scatter | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, complex64, complex128, the stride attribute of input tensor src must be less than the stride parameter |
| torch.bitwise_and | Supports uint8, int8, int16, int32, int64, bool |
| torch.bitwise_not | Supports uint8, int8, int16, int32, int64, bool |
| torch.ceil | Supports fp32, fp16 |
| torch.cumsum | Supports bf16, fp16, fp32, int8, int16, int32, int64, bool |
| torch.detach | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.nn.functional.elu | Supports fp16, fp32 |
| torch.empty | Supports fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.exp | Supports bf16, fp16, fp32, int64, bool, complex64, complex128 |
| torch.nn.functional.grid_sample | Supports fp16, fp32, fp64 |
| torch.ops.aten.index.Tensor | Supports fp16, fp32, uint8, int8, int32, int64, bool |
| torch.index_add | Supports fp16, fp32, int64, bool |
| torch.le | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.linspace | Parameters start and end are floating-point types, parameter steps is a non-negative integer |
| torch.log | Supports bf16, fp16, fp32, int64, bool, complex64, complex128 |
| torch.logsumexp | Supports fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.max | Supports bf16, fp16, fp32, int64, bool |
| torch.minimum | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.nn.functional.mse_loss | Forward: supports fp16, fp32Backward: supports fp16, fp32The data types of parameters self and target must be consistent |
| torch.new_empty | Supports fp32 |
| torch.new_full | Supports int64 |
| torch.nn.functional.nll_loss | Forward: the data types of parameters weight and input must be the same, data types support bf16, fp16, fp32The data type of parameter target supports uint8, int32, int64When parameter self is a 1D-tensor, target must be a 0D-tensorWhen self is a 2D-tensor, target must be a 1D-tensor, and the shape relationship of the two parameters must satisfy: self.shape[0] = target.shape[0]Backward: supports bf16, fp16, fp32, int64 |
| torch.ones_like | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.rand | Input is the shape of the generated tensor |
| torch.randint | Input is the shape of the generated tensor |
| torch.randn | Input is the shape of the generated tensor |
| torch.remainder | Supports fp16, fp32, int32, int64 |
| torch.scatter | Supports int16, int32, int64 |
| torch.scatter_add | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, parameter index must be a non-empty tensor |
| torch.select_scatter | Supports fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.sgn | Supports bf16, fp16, fp32, int32 |
| torch.sort | Supports fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.sqrt | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| torch.nn.functional.tanh | Supports fp16, fp32, bf16 |
| torch.triu | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool |
| torch.view_as_complex | Supports fp32, fp64 |
| torch.view_as_real | Supports complex64 |
| torch.where | Supports fp16, fp32, fp64, uint8, int8, int16, int32, int64. Input tensor shape must be less than 8 dimensions. Dynamic scenarios are not supported. torch.where(condition) → tuple of LongTensor |
| torch.zeros | Supports fp16, fp32, fp64, uint8, int8, int16, int32, int64 |
| torch.zeros_like | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| torch.eq | Supports bf16, fp16, fp32, uint8, int8, int32, int64, bool |
| torch.erf | Supports bf16, fp16, fp32 |
| torch.full_like | Supports fp16, fp32, int32, uint8, int16, int64, bool, complex64, complex128 |
| torch.lt | Supports bf16, fp16, fp32, uint8, int8, int32, int64 |
| torch.ne | Supports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| torch.nn.functional.glu | Forward: Supports fp16, fp32The dim value must be within the range of input dimensions, and input.shape[dim] must be an even numberBackward: Supports fp16, fp32 |
| torch.ge | Input Tensor supports bool, uint8, int8, int16, int32, int64, fp16, bf16, fp32, fp64 |
| torch.ops.aten.sym_size.int | Input Tensor supports bf16, fp32, fp16, int8, uint8, int16, int32, int64 |
| math.ceil | Supports bf16, fp32, fp16, fp64 |
| torch.logical_and | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, complex64, complex128 |
| torch._foreach_abs | Supports bf16, fp16, fp32 |
| torch._foreach_acos | Supports bf16, fp16, fp32 |
| torch._foreach_add | Supports bf16, fp16, fp32, int32. When tensor is bf16, fp16, or fp32, scalar supports fp32. When tensor is int32, scalar supports int64 |
| torch._foreach_addcdiv | Supports fp32, bf16 |
| torch._foreach_addcmul | Supports fp32, bf16 |
| torch._foreach_asin | Supports bf16, fp16, fp32 |
| torch._foreach_atan | Supports bf16, fp16, fp32 |
| torch._foreach_ceil | Supports bf16, fp16, fp32 |
| torch._foreach_cos | Supports bf16, fp16, fp32 |
| torch._foreach_cosh | Supports bf16, fp16, fp32 |
| torch._foreach_div | Supports bf16, fp16, fp32, int32. When tensor is bf16, fp16, or fp32, scalar supports fp32. When tensor is int32, scalar supports int64 |
| torch._foreach_erf | Supports bf16, fp16, fp32 |
| torch._foreach_erfc | Supports bf16, fp16, fp32 |
| torch._foreach_exp | Supports bf16, fp16, fp32 |
| torch._foreach_expm1 | Supports bf16, fp16, fp32 |
| torch._foreach_floor | Supports bf16, fp16, fp32, int8, uint8, int32, int64 |
| torch._foreach_frac | Supports bf16, fp16, fp32, int8, uint8, int32, int64 |
| torch._foreach_lerp | Supports fp16, fp32, bf16 |
| torch._foreach_log | Supports bf16, fp16, fp32 |
| torch._foreach_log10 | Supports bf16, fp16, fp32 |
| torch._foreach_log1p | Supports bf16, fp16, fp32 |
| torch._foreach_log2 | Supports bf16, fp16, fp32 |
| torch._foreach_maximum | Supports fp16, fp32, int32, bf16 |
| torch._foreach_minimum | Supports fp16, fp32, int32, bf16 |
| torch._foreach_mul | Supports bf16, fp16, fp32, int32. When tensor is bf16, fp16, or fp32, scalar supports fp32. When tensor is int32, scalar supports int64 |
| torch._foreach_norm | Supports fp16, fp32, bf16 |
| torch._foreach_pow | Supports bf16, fp16, fp32. The dtype of the tensor_list input and the scalar dtype are the same. The tensor_list input dtype is a floating-point number, and the scalar type is int |
| torch._foreach_round | Supports bf16, fp16, fp32, int32, int64 |
| torch._foreach_sigmoid | Supports bf16, fp16, fp32 |
| torch._foreach_sin | Supports bf16, fp16, fp32 |
| torch._foreach_sinh | Supports bf16, fp16, fp32 |
| torch._foreach_sub | Supports bf16, fp16, fp32, int32. The dtype of the tensor_list input and the scalar dtype are the same. The tensor_list input dtype is a floating-point number, and the scalar type is int |
| torch._foreach_tan | Supports bf16, fp16, fp32 |
| torch._foreach_tanh | Supports bf16, fp16, fp32 |
| torch._foreach_trunc | Supports bf16, fp16, fp32 |
| torch.searchsorted | Supports fp16, fp32, uint8, int8, int16, int32, int64 |
| torch.sym_sum | Supports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, complex64, complex128 |