nn接口动态shape支持情况

查看源文件

以下列表列举了PYNATIVE模式下支持动态shape功能的nn接口。其中部分nn接口可能会存在数据类型支持不全的问题,如遇到此类问题,可以通过主动插入Cast算子解决。

列表以外的nn接口对动态shape功能支持尚不完善,可能会执行失败。另外,图模式下,动态shape功能支持也不完善,可能会执行失败。

如遇到动态shape算子执行失败的问题,建议尽量避免在网络中引入动态shape。例如:可以通过调整nn接口输入,构造出全静态shape网络,或将动态shape限制在网络局部范围内。

算子名称

Ascend

GPU

CPU

mindspore.nn.Adam

✔️

✔️

✔️

mindspore.nn.AdaptiveAvgPool1d

✔️

✔️

✔️

mindspore.nn.AdaptiveAvgPool2d

✔️

✔️

✔️

mindspore.nn.AdaptiveAvgPool3d

✔️

✔️

✔️

mindspore.nn.AdaptiveMaxPool1d

✔️

✔️

✔️

mindspore.nn.AvgPool1d

✔️

✔️

✔️

mindspore.nn.AvgPool2d

✔️

✔️

✔️

mindspore.nn.AvgPool3d

✔️

✔️

✔️

mindspore.nn.BatchNorm1d

✔️

✔️

✔️

mindspore.nn.BatchNorm2d

✔️

✔️

✔️

mindspore.nn.BatchNorm3d

✔️

✔️

✔️

mindspore.nn.BCELoss

✔️

✔️

✔️

mindspore.nn.BCEWithLogitsLoss

✔️

✔️

✔️

mindspore.nn.ConstantPad1d

✔️

✔️

✔️

mindspore.nn.ConstantPad2d

✔️

✔️

✔️

mindspore.nn.Conv1d

✔️

✔️

✔️

mindspore.nn.Conv1dTranspose

✔️

✔️

✔️

mindspore.nn.Conv2d

✔️

✔️

✔️

mindspore.nn.Conv2dTranspose

✔️

✔️

✔️

mindspore.nn.Conv3d

✔️

✔️

✔️

mindspore.nn.Conv3dTranspose

✔️

✔️

✔️

mindspore.nn.CosineEmbeddingLoss

✔️

✔️

✔️

mindspore.nn.CrossEntropyLoss

✔️

✔️

✔️

mindspore.nn.CTCLoss

✔️

✔️

✔️

mindspore.nn.Dense

✔️

✔️

✔️

mindspore.nn.Embedding

✔️

✔️

✔️

mindspore.nn.EmbeddingLookup

✔️

✔️

✔️

mindspore.nn.GLU

✔️

✔️

✔️

mindspore.nn.GroupNorm

✔️

✔️

✔️

mindspore.nn.GRU

✔️

mindspore.nn.GRUCell

✔️

✔️

✔️

mindspore.nn.InstanceNorm1d

✔️

mindspore.nn.InstanceNorm2d

✔️

mindspore.nn.InstanceNorm3d

✔️

mindspore.nn.KLDivLoss

✔️

✔️

✔️

mindspore.nn.L1Loss

✔️

✔️

✔️

mindspore.nn.LeakyReLU

✔️

✔️

✔️

mindspore.nn.LRN

✔️

✔️

✔️

mindspore.nn.LSTM

✔️

✔️

✔️

mindspore.nn.MarginRankingLoss

✔️

✔️

✔️

mindspore.nn.MaxPool1d

✔️

✔️

✔️

mindspore.nn.MaxPool2d

✔️

✔️

✔️

mindspore.nn.MaxPool3d

✔️

✔️

✔️

mindspore.nn.MaxUnpool2d

✔️

✔️

mindspore.nn.MSELoss

✔️

✔️

✔️

mindspore.nn.MultiLabelSoftMarginLoss

✔️

✔️

✔️

mindspore.nn.PixelShuffle

✔️

✔️

✔️

mindspore.nn.ReflectionPad1d

✔️

✔️

mindspore.nn.ReplicationPad2d

✔️

mindspore.nn.RReLU

✔️

✔️

✔️

mindspore.nn.SmoothL1Loss

✔️

✔️

✔️

mindspore.nn.Softmax2d

✔️

✔️

✔️

mindspore.nn.SoftmaxCrossEntropyWithLogits

✔️

✔️

✔️

mindspore.nn.ZeroPad2d

✔️

✔️

✔️

mindspore.mint.nn

✔️