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.

Table 1 ATen API list

ATen APIConstraints
torch.nn.BatchNorm1dSupports fp16, fp32. track_running_stats is True
torch.nn.BatchNorm2dSupports fp16, fp32. track_running_stats is True
torch.nn.BatchNorm3dSupports fp16, fp32. track_running_stats is True
torch._native_batch_norm_legit_no_trainingSupports fp16, fp32
torch._softmaxSupports fp32
torch._softmax_backward_dataSupports fp32
torch.ops.aten._to_copy.defaultSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.addmmSupports fp16, fp32
torch.bernoulliSupports fp16, fp32
torch.cloneSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64
torch.divSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.empty_likeSupports fp16, fp32, uint8, int8, int16, int32, int64
torch.Tensor.expandSupports bf16, fp16, fp32, int16, int32, int64
torch.nn.functional.geluSupports bf16, fp16, fp32
torch.nn.functional.hardswishForward: supports fp16, fp32
Backward: supports bf16, fp16, fp32, parameter constraint inplace=False
torch.nn.functional.leaky_reluSupports bf16, fp16, fp32
torch.meanSupports bf16, fp16, fp32, complex64, complex128
torch.native_layer_normSupports bf16, fp16, fp32
torch.nn.functional.layer_normSupports bf16, fp16, fp32
torch.ops.aten.new_empty_strided.default-
torch.permuteSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128
torch.selectSupports fp32
torch.ops.aten.slice.TensorSupports bf16, fp16, fp32
torch.ops.aten.slice_backward.defaultSupports bf16, fp16, fp32
torch.sumSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.tSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64
torch.nn.ThresholdSupports fp32, uint8, int8, int16, int32, int64
torch.nn.MaxPool2dForward: supports fp16, fp32, parameter constraint return_indice=False, dynamic=True
Backward: supports fp16, fp32, bf16, input is 4-dimensional
torch.slice_scatterSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool
torch.nn.functional.avg_pool2dForward: supports fp16, fp32, parameter constraint dynamic=False, kernel_size≤255, stride≤63
Backward: supports fp16, fp32
torch.nn.functional.group_normSupports bf16, fp16, fp32
sigmoidSupports fp16, fp32, int8, int32, int64
torch.sigmoidSupports bf16, fp16, fp32, fp64
torch._native_batch_norm_legitSupports fp16, fp32, parameter constraint track_running_stats=False
torch.index_selectSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool
torch.subSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64
torch.fillSupports 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.mulSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128
torch.nn.functional.hardsigmoidSupports fp16, fp32
torch.clampSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, parameter constraint min<max
torch.ops.aten.alias.defaultSupports 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.embeddingSupports int32, int64, parameter constraint max_norm=False, sparse=False, scale_grad_by_freq=False, forward not supported, _freeze=False
torch.nn.functional.sigmoidSupports bf16, fp16, fp32, fp64
torch.nn.functional.hardtanhForward: when min_val and max_val are floating-point types, input supports bf16, fp16, fp32, fp64
When min_val and max_val are integer types, input supports int32, int64
Backward: supports bf16, fp16, fp32
torch.stackSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64
torch.unbindSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool
torch.nn.functional.padSupports bf16, fp16, fp32, int16, int32, int64
torch.constant_pad_ndSupports bf16, fp16, fp32, int32, int64, bool, parameter constraint inplace=False
torch.nn.avgpool2dSupports fp16, fp32, parameter constraint dynamic=False, kernelsize≤255, stride≤63
torch.nn.Conv2dSupports fp16, fp32
torch.nn.Conv1dSupports fp16, fp32
torch.nn.ConvTranspose1dSupports fp16, fp32
torch.nn.ConvTranspose2dSupports fp16, fp32
torch.ops.aten.floor.defaultSupports fp16, fp32
torch.nn.AdaptiveAvgPool2dSupports fp16, fp32, output_size only supports list
torch.fft.fftSupports complex64
torch.fft.fft2Supports complex64
torch.nn.LogSoftmaxSupports bf16, fp16, fp32
torch.absSupports fp16, fp32, uint8, int8, int16, int32, int64
torch.arangeSupports bf16, fp16, fp32, int32, int64
torch.argmaxSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64
torch.as_stridedSupports fp32
torch.as_strided_scatterSupports 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_andSupports uint8, int8, int16, int32, int64, bool
torch.bitwise_notSupports uint8, int8, int16, int32, int64, bool
torch.ceilSupports fp32, fp16
torch.cumsumSupports bf16, fp16, fp32, int8, int16, int32, int64, bool
torch.detachSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.nn.functional.eluSupports fp16, fp32
torch.emptySupports fp16, fp32, uint8, int8, int16, int32, int64
torch.expSupports bf16, fp16, fp32, int64, bool, complex64, complex128
torch.nn.functional.grid_sampleSupports fp16, fp32, fp64
torch.ops.aten.index.TensorSupports fp16, fp32, uint8, int8, int32, int64, bool
torch.index_addSupports fp16, fp32, int64, bool
torch.leSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.linspaceParameters start and end are floating-point types, parameter steps is a non-negative integer
torch.logSupports bf16, fp16, fp32, int64, bool, complex64, complex128
torch.logsumexpSupports fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.maxSupports bf16, fp16, fp32, int64, bool
torch.minimumSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.nn.functional.mse_lossForward: supports fp16, fp32
Backward: supports fp16, fp32
The data types of parameters self and target must be consistent
torch.new_emptySupports fp32
torch.new_fullSupports int64
torch.nn.functional.nll_lossForward: the data types of parameters weight and input must be the same, data types support bf16, fp16, fp32
The data type of parameter target supports uint8, int32, int64
When parameter self is a 1D-tensor, target must be a 0D-tensor
When 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_likeSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.randInput is the shape of the generated tensor
torch.randintInput is the shape of the generated tensor
torch.randnInput is the shape of the generated tensor
torch.remainderSupports fp16, fp32, int32, int64
torch.scatterSupports int16, int32, int64
torch.scatter_addSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, parameter index must be a non-empty tensor
torch.select_scatterSupports fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.sgnSupports bf16, fp16, fp32, int32
torch.sortSupports fp16, fp32, uint8, int8, int16, int32, int64
torch.sqrtSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128
torch.nn.functional.tanhSupports fp16, fp32, bf16
torch.triuSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool
torch.view_as_complexSupports fp32, fp64
torch.view_as_realSupports complex64
torch.whereSupports 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.zerosSupports fp16, fp32, fp64, uint8, int8, int16, int32, int64
torch.zeros_likeSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128
torch.eqSupports bf16, fp16, fp32, uint8, int8, int32, int64, bool
torch.erfSupports bf16, fp16, fp32
torch.full_likeSupports fp16, fp32, int32, uint8, int16, int64, bool, complex64, complex128
torch.ltSupports bf16, fp16, fp32, uint8, int8, int32, int64
torch.neSupports bf16, fp16, fp32, uint8, int8, int16, int32, int64, bool, complex64, complex128
torch.nn.functional.gluForward: Supports fp16, fp32
The dim value must be within the range of input dimensions, and input.shape[dim] must be an even number
Backward: Supports fp16, fp32
torch.geInput Tensor supports bool, uint8, int8, int16, int32, int64, fp16, bf16, fp32, fp64
torch.ops.aten.sym_size.intInput Tensor supports bf16, fp32, fp16, int8, uint8, int16, int32, int64
math.ceilSupports bf16, fp32, fp16, fp64
torch.logical_andSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, complex64, complex128
torch._foreach_absSupports bf16, fp16, fp32
torch._foreach_acosSupports bf16, fp16, fp32
torch._foreach_addSupports bf16, fp16, fp32, int32. When tensor is bf16, fp16, or fp32, scalar supports fp32. When tensor is int32, scalar supports int64
torch._foreach_addcdivSupports fp32, bf16
torch._foreach_addcmulSupports fp32, bf16
torch._foreach_asinSupports bf16, fp16, fp32
torch._foreach_atanSupports bf16, fp16, fp32
torch._foreach_ceilSupports bf16, fp16, fp32
torch._foreach_cosSupports bf16, fp16, fp32
torch._foreach_coshSupports bf16, fp16, fp32
torch._foreach_divSupports bf16, fp16, fp32, int32. When tensor is bf16, fp16, or fp32, scalar supports fp32. When tensor is int32, scalar supports int64
torch._foreach_erfSupports bf16, fp16, fp32
torch._foreach_erfcSupports bf16, fp16, fp32
torch._foreach_expSupports bf16, fp16, fp32
torch._foreach_expm1Supports bf16, fp16, fp32
torch._foreach_floorSupports bf16, fp16, fp32, int8, uint8, int32, int64
torch._foreach_fracSupports bf16, fp16, fp32, int8, uint8, int32, int64
torch._foreach_lerpSupports fp16, fp32, bf16
torch._foreach_logSupports bf16, fp16, fp32
torch._foreach_log10Supports bf16, fp16, fp32
torch._foreach_log1pSupports bf16, fp16, fp32
torch._foreach_log2Supports bf16, fp16, fp32
torch._foreach_maximumSupports fp16, fp32, int32, bf16
torch._foreach_minimumSupports fp16, fp32, int32, bf16
torch._foreach_mulSupports bf16, fp16, fp32, int32. When tensor is bf16, fp16, or fp32, scalar supports fp32. When tensor is int32, scalar supports int64
torch._foreach_normSupports fp16, fp32, bf16
torch._foreach_powSupports 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_roundSupports bf16, fp16, fp32, int32, int64
torch._foreach_sigmoidSupports bf16, fp16, fp32
torch._foreach_sinSupports bf16, fp16, fp32
torch._foreach_sinhSupports bf16, fp16, fp32
torch._foreach_subSupports 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_tanSupports bf16, fp16, fp32
torch._foreach_tanhSupports bf16, fp16, fp32
torch._foreach_truncSupports bf16, fp16, fp32
torch.searchsortedSupports fp16, fp32, uint8, int8, int16, int32, int64
torch.sym_sumSupports bf16, fp16, fp32, fp64, uint8, int8, int16, int32, int64, bool, complex64, complex128