torch.nn

若API未标明支持情况,则代表该API的支持情况待验证。

API名称

是否支持

限制与说明

torch.nn.parameter.Parameter

  

torch.nn.parameter.UninitializedParameter

  

torch.nn.parameter.UninitializedParameter.cls_to_become

     

torch.nn.parameter.UninitializedBuffer

  

torch.nn.Module

  

torch.nn.Module.add_module

  

torch.nn.Module.apply

  

torch.nn.Module.bfloat16

  

torch.nn.Module.buffers

  

torch.nn.Module.children

  

torch.nn.Module.compile

     

torch.nn.Module.cpu

  

torch.nn.Module.cuda

  

torch.nn.Module.double

     

torch.nn.Module.eval

  

torch.nn.Module.extra_repr

  

torch.nn.Module.float

  

torch.nn.Module.forward

  

torch.nn.Module.get_buffer

  

torch.nn.Module.get_extra_state

  

torch.nn.Module.get_parameter

  

torch.nn.Module.get_submodule

  

torch.nn.Module.half

  

torch.nn.Module.ipu

     

torch.nn.Module.load_state_dict

  

torch.nn.Module.modules

  

torch.nn.Module.named_buffers

  

torch.nn.Module.named_children

  

torch.nn.Module.named_modules

  

torch.nn.Module.named_parameters

  

torch.nn.Module.parameters

  

torch.nn.Module.register_backward_hook

  

torch.nn.Module.register_buffer

  

torch.nn.Module.register_forward_hook

  

torch.nn.Module.register_forward_pre_hook

  

torch.nn.Module.register_full_backward_hook

  

torch.nn.Module.register_full_backward_pre_hook

  

torch.nn.Module.register_load_state_dict_post_hook

  

torch.nn.Module.register_module

  

torch.nn.Module.register_parameter

  

torch.nn.Module.register_state_dict_pre_hook

  

torch.nn.Module.requires_grad_

  

torch.nn.Module.set_extra_state

  

torch.nn.Module.share_memory

     

torch.nn.Module.state_dict

  

torch.nn.Module.to

  

torch.nn.Module.to_empty

  

torch.nn.Module.train

  

torch.nn.Module.type

  

torch.nn.Module.xpu

     

torch.nn.Module.zero_grad

  

torch.nn.Sequential

  

torch.nn.Sequential.append

  

torch.nn.ModuleList

  

torch.nn.ModuleList.append

  

torch.nn.ModuleList.extend

  

torch.nn.ModuleList.insert

  

torch.nn.ModuleDict

  

torch.nn.ModuleDict.clear

  

torch.nn.ModuleDict.items

  

torch.nn.ModuleDict.keys

  

torch.nn.ModuleDict.pop

  

torch.nn.ModuleDict.update

  

torch.nn.ModuleDict.values

  

torch.nn.ParameterList

  

torch.nn.ParameterList.append

  

torch.nn.ParameterList.extend

  

torch.nn.ParameterDict

  

torch.nn.ParameterDict.clear

  

torch.nn.ParameterDict.copy

  

torch.nn.ParameterDict.fromkeys

  

torch.nn.ParameterDict.get

  

torch.nn.ParameterDict.items

  

torch.nn.ParameterDict.keys

  

torch.nn.ParameterDict.pop

  

torch.nn.ParameterDict.popitem

  

torch.nn.ParameterDict.setdefault

  

torch.nn.ParameterDict.update

  

torch.nn.ParameterDict.values

  

torch.nn.modules.module.register_module_forward_pre_hook

  

torch.nn.modules.module.register_module_forward_hook

  

torch.nn.modules.module.register_module_backward_hook

  

torch.nn.modules.module.register_module_full_backward_pre_hook

     

torch.nn.modules.module.register_module_full_backward_hook

  

torch.nn.modules.module.register_module_buffer_registration_hook

     

torch.nn.modules.module.register_module_module_registration_hook

     

torch.nn.modules.module.register_module_parameter_registration_hook

     

torch.nn.Conv1d

     

torch.nn.Conv2d

     

torch.nn.Conv3d

     

torch.nn.ConvTranspose1d

     

torch.nn.ConvTranspose2d

     

torch.nn.ConvTranspose3d

     

torch.nn.LazyConv1d

     

torch.nn.LazyConv1d.cls_to_become

     

torch.nn.LazyConv2d

     

torch.nn.LazyConv2d.cls_to_become

     

torch.nn.LazyConv3d

     

torch.nn.LazyConv3d.cls_to_become

     

torch.nn.LazyConvTranspose1d

     

torch.nn.LazyConvTranspose1d.cls_to_become

     

torch.nn.LazyConvTranspose2d

     

torch.nn.LazyConvTranspose2d.cls_to_become

     

torch.nn.LazyConvTranspose3d

     

torch.nn.LazyConvTranspose3d.cls_to_become

     

torch.nn.Unfold

     

torch.nn.Fold

     

torch.nn.MaxPool1d

     

torch.nn.MaxPool2d

     

torch.nn.MaxPool3d

     

torch.nn.MaxUnpool1d

支持fp16,fp32,int64,bool

torch.nn.MaxUnpool2d

支持fp16,fp32,int64,bool

torch.nn.MaxUnpool3d

     

torch.nn.AvgPool1d

     

torch.nn.AvgPool2d

     

torch.nn.AvgPool3d

     

torch.nn.FractionalMaxPool2d

     

torch.nn.FractionalMaxPool3d

     

torch.nn.LPPool1d

     

torch.nn.LPPool2d

     

torch.nn.AdaptiveMaxPool1d

     

torch.nn.AdaptiveMaxPool2d

     

torch.nn.AdaptiveMaxPool3d

支持fp16,fp32,int64,bool

torch.nn.AdaptiveAvgPool1d

支持fp16,fp32,int64,bool

torch.nn.AdaptiveAvgPool2d

支持fp16,fp32,int64,bool

torch.nn.AdaptiveAvgPool3d

     

torch.nn.ReflectionPad1d

支持fp16,fp32,int64,bool

torch.nn.ReflectionPad2d

支持fp16,fp32,int64,bool

torch.nn.ReflectionPad3d

     

torch.nn.ReplicationPad1d

支持fp16,fp32,int64,bool

torch.nn.ReplicationPad2d

支持fp16,fp32,int64,bool

torch.nn.ReplicationPad3d

     

torch.nn.ZeroPad1d

     

torch.nn.ZeroPad2d

支持fp16,fp32,int64,bool

torch.nn.ZeroPad3d

     

torch.nn.ConstantPad1d

  • 支持fp16,fp32,int64,bool。
  • 在输入x为六维以上时可能会出现性能下降问题。

torch.nn.ConstantPad2d

  • 支持fp16,fp32,int64,bool。
  • 在输入x为六维以上时可能会出现性能下降问题。

torch.nn.ConstantPad3d

  

在输入x为六维以上时可能会出现性能下降问题。

torch.nn.ELU

     

torch.nn.Hardshrink

     

torch.nn.Hardsigmoid

支持fp16,fp32

torch.nn.Hardtanh

支持fp16,fp32,int64,bool

torch.nn.Hardswish

支持fp16,fp32

torch.nn.LeakyReLU

支持fp16,fp32

torch.nn.LogSigmoid

     

torch.nn.MultiheadAttention

     

torch.nn.MultiheadAttention.forward

     

torch.nn.MultiheadAttention.merge_masks

     

torch.nn.PReLU

支持fp16,fp32,int64,bool

torch.nn.ReLU

支持fp16,fp32,int64

torch.nn.ReLU6

支持fp16,fp32,int64,bool

torch.nn.RReLU

     

torch.nn.SELU

支持fp16,fp32,int64,bool

torch.nn.CELU

     

torch.nn.GELU

支持fp16,fp32,int64,bool

torch.nn.Sigmoid

支持fp16,fp32,int64,bool

torch.nn.SiLU

支持fp16,fp32,int64,bool

torch.nn.Mish

     

torch.nn.Softplus

支持fp16,fp32

torch.nn.Softshrink

支持fp16,fp32,int64,bool

torch.nn.Softsign

支持fp16,fp32,int64,bool

torch.nn.Tanh

支持fp16,fp32,int64

torch.nn.Tanhshrink

支持fp16,fp32,int64,bool

torch.nn.Threshold

支持fp16,fp32,int64

torch.nn.GLU

支持fp16,fp32,int64,bool

torch.nn.Softmin

支持fp16,fp32,int64,bool

torch.nn.Softmax

支持fp16,fp32,int64,bool

torch.nn.Softmax2d

支持fp16,fp32,int64,bool

torch.nn.LogSoftmax

支持fp16,fp32,int64,bool

torch.nn.AdaptiveLogSoftmaxWithLoss

     

torch.nn.AdaptiveLogSoftmaxWithLoss.log_prob

     

torch.nn.AdaptiveLogSoftmaxWithLoss.predict

     

torch.nn.BatchNorm1d

支持fp16,fp32,int64,bool

torch.nn.BatchNorm2d

支持fp16,fp32,int64,bool

torch.nn.BatchNorm3d

支持fp16,fp32,int64,bool

torch.nn.LazyBatchNorm1d

     

torch.nn.LazyBatchNorm1d.cls_to_become

     

torch.nn.LazyBatchNorm2d

     

torch.nn.LazyBatchNorm2d.cls_to_become

     

torch.nn.LazyBatchNorm3d

     

torch.nn.LazyBatchNorm3d.cls_to_become

     

torch.nn.GroupNorm

     

torch.nn.SyncBatchNorm

支持fp16,fp32,int64,bool

torch.nn.SyncBatchNorm.convert_sync_batchnorm

  

torch.nn.InstanceNorm1d

     

torch.nn.InstanceNorm2d

     

torch.nn.InstanceNorm3d

     

torch.nn.LazyInstanceNorm1d

     

torch.nn.LazyInstanceNorm1d.cls_to_become

     

torch.nn.LazyInstanceNorm2d

     

torch.nn.LazyInstanceNorm2d.cls_to_become

     

torch.nn.LazyInstanceNorm3d

     

torch.nn.LazyInstanceNorm3d.cls_to_become

     

torch.nn.LayerNorm

支持fp16,fp32,int64,bool

torch.nn.LocalResponseNorm

     

torch.nn.RNNBase

     

torch.nn.RNNBase.flatten_parameters

     

torch.nn.RNN

     

torch.nn.LSTM

     

torch.nn.GRU

     

torch.nn.RNNCell

     

torch.nn.LSTMCell

     

torch.nn.GRUCell

     

torch.nn.Transformer

     

torch.nn.Transformer.forward

     

torch.nn.Transformer.generate_square_subsequent_mask

     

torch.nn.TransformerEncoder

     

torch.nn.TransformerEncoder.forward

     

torch.nn.TransformerDecoder

     

torch.nn.TransformerDecoder.forward

     

torch.nn.TransformerEncoderLayer

     

torch.nn.TransformerEncoderLayer.forward

     

torch.nn.TransformerDecoderLayer

     

torch.nn.TransformerDecoderLayer.forward

     

torch.nn.Identity

  

torch.nn.Linear

支持fp16,fp32,int64,bool

torch.nn.Bilinear

支持fp16,fp32,int64,bool

torch.nn.LazyLinear

支持fp16,fp32,int64,bool

torch.nn.LazyLinear.cls_to_become

     

torch.nn.Dropout

     

torch.nn.Dropout1d

     

torch.nn.Dropout2d

支持fp16,fp32,int64,bool

torch.nn.Dropout3d

     

torch.nn.AlphaDropout

支持fp16,fp32,int64,bool

torch.nn.FeatureAlphaDropout

支持fp16,fp32,int64,bool

torch.nn.Embedding

支持fp16,fp32,int64,bool

torch.nn.Embedding.from_pretrained

  

torch.nn.EmbeddingBag

     

torch.nn.EmbeddingBag.forward

  

torch.nn.EmbeddingBag.from_pretrained

  

torch.nn.CosineSimilarity

     

torch.nn.PairwiseDistance

     

torch.nn.L1Loss

支持fp16,fp32,int64,bool

torch.nn.MSELoss

支持fp16,fp32,int64,bool

torch.nn.CrossEntropyLoss

     

torch.nn.CTCLoss

支持fp16,fp32,int64,bool

torch.nn.NLLLoss

支持fp16,fp32,int64,bool

torch.nn.PoissonNLLLoss

支持fp16,fp32,int64,bool

torch.nn.GaussianNLLLoss

支持fp16,fp32,int64,bool

torch.nn.KLDivLoss

支持fp16,fp32,int64,bool

torch.nn.BCELoss

     

torch.nn.BCEWithLogitsLoss

支持fp16,fp32,int64,bool

torch.nn.MarginRankingLoss

支持fp16,fp32,int64,bool

torch.nn.HingeEmbeddingLoss

支持fp16,fp32,int64,bool

torch.nn.MultiLabelMarginLoss

     

torch.nn.HuberLoss

     

torch.nn.SmoothL1Loss

支持fp16,fp32,int64,bool

torch.nn.SoftMarginLoss

     

torch.nn.MultiLabelSoftMarginLoss

支持fp16,fp32

torch.nn.CosineEmbeddingLoss

     

torch.nn.MultiMarginLoss

     

torch.nn.TripletMarginLoss

     

torch.nn.TripletMarginWithDistanceLoss

     

torch.nn.PixelShuffle

     

torch.nn.PixelUnshuffle

支持fp16,fp32,int64,bool

torch.nn.Upsample

支持fp16,fp32,int64,bool

torch.nn.UpsamplingNearest2d

支持fp16,fp32,int64,bool

torch.nn.UpsamplingBilinear2d

     

torch.nn.ChannelShuffle

     

torch.nn.DataParallel

     

torch.nn.parallel.DistributedDataParallel

  

torch.nn.parallel.DistributedDataParallel.join

  

torch.nn.parallel.DistributedDataParallel.join_hook

  

torch.nn.parallel.DistributedDataParallel.no_sync

  

torch.nn.parallel.DistributedDataParallel.register_comm_hook

  

torch.nn.utils.clip_grad_norm_

     

torch.nn.utils.clip_grad_value_

支持fp16,fp32,int64,bool

torch.nn.utils.parameters_to_vector

     

torch.nn.utils.vector_to_parameters

     

torch.nn.utils.prune.BasePruningMethod

  

torch.nn.utils.prune.BasePruningMethod.apply

  

torch.nn.utils.prune.BasePruningMethod.apply_mask

  

torch.nn.utils.prune.BasePruningMethod.compute_mask

     

torch.nn.utils.prune.BasePruningMethod.prune

  

torch.nn.utils.prune.BasePruningMethod.remove

  

torch.nn.utils.prune.PruningContainer

  

torch.nn.utils.prune.PruningContainer.add_pruning_method

  

torch.nn.utils.prune.PruningContainer.apply

  

torch.nn.utils.prune.PruningContainer.apply_mask

  

torch.nn.utils.prune.PruningContainer.compute_mask

  

torch.nn.utils.prune.PruningContainer.prune

  

torch.nn.utils.prune.PruningContainer.remove

  

torch.nn.utils.prune.Identity

  

torch.nn.utils.prune.Identity.apply

  

torch.nn.utils.prune.Identity.apply_mask

  

torch.nn.utils.prune.Identity.prune

  

torch.nn.utils.prune.Identity.remove

  

torch.nn.utils.prune.RandomUnstructured

  

torch.nn.utils.prune.RandomUnstructured.apply

  

torch.nn.utils.prune.RandomUnstructured.apply_mask

  

torch.nn.utils.prune.RandomUnstructured.prune

  

torch.nn.utils.prune.RandomUnstructured.remove

     

torch.nn.utils.prune.L1Unstructured

  

torch.nn.utils.prune.L1Unstructured.apply

  

torch.nn.utils.prune.L1Unstructured.apply_mask

  

torch.nn.utils.prune.L1Unstructured.prune

  

torch.nn.utils.prune.L1Unstructured.remove

  

torch.nn.utils.prune.RandomStructured

  

torch.nn.utils.prune.RandomStructured.apply

  

torch.nn.utils.prune.RandomStructured.apply_mask

  

torch.nn.utils.prune.RandomStructured.compute_mask

  

torch.nn.utils.prune.RandomStructured.prune

  

torch.nn.utils.prune.RandomStructured.remove

  

torch.nn.utils.prune.LnStructured

  

torch.nn.utils.prune.LnStructured.apply

  

torch.nn.utils.prune.LnStructured.apply_mask

  

torch.nn.utils.prune.LnStructured.compute_mask

  

torch.nn.utils.prune.LnStructured.prune

  

torch.nn.utils.prune.LnStructured.remove

  

torch.nn.utils.prune.CustomFromMask

  

torch.nn.utils.prune.CustomFromMask.apply

  

torch.nn.utils.prune.CustomFromMask.apply_mask

  

torch.nn.utils.prune.CustomFromMask.prune

  

torch.nn.utils.prune.CustomFromMask.remove

  

torch.nn.utils.prune.identity

  

torch.nn.utils.prune.random_unstructured

  

torch.nn.utils.prune.l1_unstructured

  

torch.nn.utils.prune.random_structured

  

torch.nn.utils.prune.ln_structured

  

torch.nn.utils.prune.global_unstructured

  

torch.nn.utils.prune.custom_from_mask

  

torch.nn.utils.prune.remove

  

torch.nn.utils.prune.is_pruned

  

torch.nn.utils.weight_norm

     

torch.nn.utils.remove_weight_norm

     

torch.nn.utils.spectral_norm

     

torch.nn.utils.remove_spectral_norm

     

torch.nn.utils.skip_init

     

torch.nn.utils.parametrizations.orthogonal

     

torch.nn.utils.parametrizations.spectral_norm

     

torch.nn.utils.parametrize.register_parametrization

     

torch.nn.utils.parametrize.remove_parametrizations

     

torch.nn.utils.parametrize.cached

     

torch.nn.utils.parametrize.is_parametrized

     

torch.nn.utils.parametrize.ParametrizationList

  

torch.nn.utils.parametrize.ParametrizationList.right_inverse

  

torch.nn.utils.stateless.functional_call

     

torch.nn.utils.rnn.PackedSequence

  

torch.nn.utils.rnn.PackedSequence.batch_sizes

     

torch.nn.utils.rnn.PackedSequence.count

  

torch.nn.utils.rnn.PackedSequence.data

     

torch.nn.utils.rnn.PackedSequence.index

  

torch.nn.utils.rnn.PackedSequence.is_cuda

     

torch.nn.utils.rnn.PackedSequence.is_pinned

  

torch.nn.utils.rnn.PackedSequence.sorted_indices

     

torch.nn.utils.rnn.PackedSequence.to

  

torch.nn.utils.rnn.PackedSequence.unsorted_indices

     

torch.nn.utils.rnn.pack_padded_sequence

     

torch.nn.utils.rnn.pad_packed_sequence

     

torch.nn.utils.rnn.pad_sequence

支持fp16,fp32,int64,bool

torch.nn.utils.rnn.pack_sequence

     

torch.nn.utils.rnn.unpack_sequence

     

torch.nn.utils.rnn.unpad_sequence

     

torch.nn.Flatten

支持fp16,fp32,int64,bool

torch.nn.Unflatten

支持fp16,fp32,int64,bool

torch.nn.modules.lazy.LazyModuleMixin

  

torch.nn.modules.lazy.LazyModuleMixin.has_uninitialized_params

  

torch.nn.modules.lazy.LazyModuleMixin.initialize_parameters