This application provides a neural network operation method, apparatus, and storage medium, including: adding a random
mask layer to a first neural network according to the type of variable dimensions to obtain a second neural network; the random
mask layer is used to perform random masking
processing on tensors input to the random
mask layer; and training the second neural network using sample data. The neural network operation method, apparatus, and storage medium provided in this application, by adding a random
mask layer to the neural network, only require training and deployment of one neural network to adapt to different input and output dimension requirements. This method has low training complexity, low storage overhead, and is easy to deploy and continuously evolve through online training.