Question about errors that occur when exporting models with residualBlockLayer to Tensorflow.

3 views (last 30 days)
I get an error
’nnet.internal.cnn.tf_exporter.ConverterForUnsupportedLayer/verifyNumericLearnablesAndState (行 171)
Layer 'layer': This network has nonnumeric Learnable or State parameters and cannot be exported.'
when I run the following code.
where residentialBlockLayer is a custom layer defined in the bottom layer code of
Should I change the way I define custom layers?
We would appreciate it if you could include the method of change definition.
nt = 10;
ns = 10;
numFilters = 10;
layers = [
imageInputLayer([nt ns 1],'Normalization','none')
convolution2dLayer(3,numFilters,'Padding','same')
residualBlockLayer(numFilters)
convolution2dLayer(3,2,'Padding','same')
];
net = dlnetwork(layers);
exportNetworkToTensorFlow(net,"myModel")

Answers (1)

Poorna
Poorna on 2 Jun 2024
Hi Yoshinobu,
I see you are facing errors while trying to export a custom network to TensorFlow using the "exportNetworkToTensorFlow" function. I was able to reproduce the error. The error says that the network has nonnumeric learnable parameters. This is caused by the custom network "residualBlockLayer" having "Network" as a learnable/state propery which is causing the export function to categorize it as nonnumeric. If you examine the code, then you would see that the "Network" property holds the dlnetwork object of the custom network itself.
Now, instead of using the "residualBlockLayer" function to include the custom layer, you can look at the code and see what layers are defined inside the network and directly use those layers to create your desired network.
Also, you need to connect the second input of the addition layer manually just like how it is done in the "residualBlockLayer" class when "IncludeSkipConvolution" is set to true.
Refer to the following documentation to know more about "additionLayer"
Hope this Helps!

Categories

Find more on Image Data Workflows in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!