Error: “Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’.” This error is shown during using a custom deep layer.
I have created a custom deep learning layer for my network for image classification. While using that layer with cpu the network is properly working during the training process, but when I utilize the gpu available in the workstation it is showing this error:
"Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’."
‘Z’ is the variable used in the predict function which represents the output of the layer. The portion of the code which has error is shown below:
PE_1={PE_even PE_odd};
Z=single(cat(2,PE_1{:}));
Z=dlarray(Z,"CB");
If I change ‘single’ with ‘gpuArray’ the same error will show in reverse way. Can anyone help me with this? I have started the class function like this: "classdef sinusoidalPositionEncoding < nnet.layer.Layer …
& nnet.layer.Formattable …
& nnet.layer.Acceleratable"
Thanks for the help in advanceI have created a custom deep learning layer for my network for image classification. While using that layer with cpu the network is properly working during the training process, but when I utilize the gpu available in the workstation it is showing this error:
"Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’."
‘Z’ is the variable used in the predict function which represents the output of the layer. The portion of the code which has error is shown below:
PE_1={PE_even PE_odd};
Z=single(cat(2,PE_1{:}));
Z=dlarray(Z,"CB");
If I change ‘single’ with ‘gpuArray’ the same error will show in reverse way. Can anyone help me with this? I have started the class function like this: "classdef sinusoidalPositionEncoding < nnet.layer.Layer …
& nnet.layer.Formattable …
& nnet.layer.Acceleratable"
Thanks for the help in advance I have created a custom deep learning layer for my network for image classification. While using that layer with cpu the network is properly working during the training process, but when I utilize the gpu available in the workstation it is showing this error:
"Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’."
‘Z’ is the variable used in the predict function which represents the output of the layer. The portion of the code which has error is shown below:
PE_1={PE_even PE_odd};
Z=single(cat(2,PE_1{:}));
Z=dlarray(Z,"CB");
If I change ‘single’ with ‘gpuArray’ the same error will show in reverse way. Can anyone help me with this? I have started the class function like this: "classdef sinusoidalPositionEncoding < nnet.layer.Layer …
& nnet.layer.Formattable …
& nnet.layer.Acceleratable"
Thanks for the help in advance digital image processing, matrix, matrix array, matrix manipulation, deep learning, machine learning, neural network, image segmentation, deep convolutional neural networks, cnn, mathematics MATLAB Answers — New Questions