Dynamic Shape Support Status of nn Interface

View Source On Gitee

The following list provides nn interfaces that support dynamic shape functionality in PYNATIVE mode. However, some nn interfaces may have incomplete data type support. If you encounter such issues, you can resolve them by manually incorporating the Cast operator.

nn interfaces outside of this list have limited support for dynamic shape functionality and may fail to execute. Additionally, in graph mode, dynamic shape functionality is also limited and may result in execution failures.

If you encounter issues that the execution of dynamic shape operator fails, it is recommended to avoid introducing dynamic shape in the network. For example, you can adjust the inputs of nn interfaces to construct a fully static shape network or confine dynamic shape to a local scope within the network.

API name

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

✔️