Error using DAGNetwork/layerGraph

clear all;
close all;
classdef DAGNetwork.layerGraph
methods
function Igraph = DAGNetwork.layerGraph(this)
% Convert DAGNetwork to layer graph
internalLayerGraph = this.getLayerGraph();
layerMap = this.getLayerMap();
disp(internalLayerGraph);
disp(layerMap);
% Strip the QuantizationInfo from the layers
internalLayers = nnet.internal.cnn.layer.util.resetQuantizationInfo(internalLayerGraph.Layers);
externalLayers = iExternalLayers(internalLayers, layerMap);
Igraph = nnet.cnn.LayerGraph.createFromLayersAndInternalConnections(externalLayers, internalLayerGraph.Connections);
end
end
methods (Static)
% Define any static methods here if needed
end
end
function externalLayers = iExternalLayers(internalLayers, layersMap)
externalLayers = layersMap.externalLayers(internalLayers);
end
Error using DAGNetwork/layerGraph
Error: File: layerGraph.m Line: 5 Column: 48
Dotted names can be used only within a CLASS block.

3 Kommentare

Matt J
Matt J am 9 Apr. 2025
Bearbeitet: Matt J am 9 Apr. 2025
Please provide a question to explain what you are doing and to provide context for the code. Is this your own modification of Matlab's built-in DAGNetwork class? Also, please provide code and steps that can be run by others to reproduce the error. A classdef by itself cannot be run.
Faisal
Faisal am 10 Apr. 2025
I'm trying to use mobilenetv2 snd resnet50 to deep learning and I just Finish all the code and the code is fine but every time I do run for my code it is show this error and I didn't know what can I do with this error pleas I need hlep
Faisal
Faisal am 10 Apr. 2025
>> mobilenetv2_Results
Error using DAGNetwork/layerGraph
File: layerGraph.m Line: 1 Column: 20
Invalid use of operator.
Error in mobilenetv2_Results (line 136)
lgraph = layerGraph(net);
^^^^^^^^^^^^^^^

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Gayathri
Gayathri am 12 Mai 2025

0 Stimmen

The error mentioned in the comments is due to the fact that the "layerGraph" MATLAB function is being overrided by your custom function.
This can be verified by running the following command in the Command Window.
which layerGraph -all
The error can be resolved by renaming or removing the custom "layerGraph.m" file from your local folder, so that MATLAB uses its built-in function instead.
It is unclear why a custom function was created for this purpose, but the issue arises because MATLAB does NOT support dotted class names like "DAGNetwork.layerGraph" unless they are defined within a package or as nested classes.
Hope this helps!

Kategorien

Gefragt:

am 9 Apr. 2025

Beantwortet:

am 12 Mai 2025

Community Treasure Hunt

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

Start Hunting!

Translated by