MATLAB: Error when using globalAver​agePooling​2dLayer in CNN

neural networkneural networks

I am writing a CNN code for an image classification problem and I want to use global average pooling. I found the globalAveragePooling2dLayer in this link: https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.globalaveragepooling2dlayer.html
However, when I try to use it within my Layers array, I get the following error:
Undefined function or variable 'globalAveragePooling2dLayer'.
Error in cnn_trial (line 64)
globalAveragePooling2dLayer
I have the Neural Networks toolbox and I have used the average pooling layer before. How can I fix this issue?
Thank you,

Best Answer

Hi Nour,
The globalAveragePooling2dLayer was introduced in R2019b. As you are using R2018a, you are facing the Undefined function error.
You cannot use tools from a recent release in an older release. Either, you can upgrade to a new release or you can install the newer version alongside the your older R2018a version.
Hope this helps.
Related Question