Effacer les filtres
Effacer les filtres

I am getting an error

4 vues (au cours des 30 derniers jours)
Neha
Neha le 25 Juil 2024
I am getting an error in my code specially in line convolution1dLayer(128,10,"Name","conv1d","Padding","same").
The error is
File: convolution1dLayer.m
Line: 1 Column: 45 Invalid use of operator.
which leads to
function output = convolution1dLayer(input, "stride",filtersize, "Padding",1 )
I am unable to solve the problem.
Please help

Réponses (2)

Torsten
Torsten le 25 Juil 2024
Do you want to overwrite the MATLAB function "convolution1dLayer" by your own function ?
function output = convolution1dLayer(input, "stride",filtersize, "Padding",1 )
If this is the definition of your newly created function, it's wrong because you cannot hardcode inputs ("stride", "Padding", 1).
  2 commentaires
Neha
Neha le 25 Juil 2024
function output = convolution1dLayer(input, "stride",filtersize, "Padding",1 )
This function is on matlab. I am not creating any convolution1dLayer function
Torsten
Torsten le 25 Juil 2024
Modifié(e) : Torsten le 25 Juil 2024
This line is (ignoring the incorrect definition of inputs) a definition of a new function:
function output = convolution1dLayer(input, "stride",filtersize, "Padding",1 )
If you want to call the MATLAB function "convolution1dLayer", look at the documentation how to call a function and what input arguments are needed for "convolution1dLayer":

Connectez-vous pour commenter.


Steven Lord
Steven Lord le 25 Juil 2024
This line of code:
function output = convolution1dLayer(input, "stride",filtersize, "Padding",1 )
is not a valid definition of the convolution1dLayer function. The only things that can appear in the input arguments section of a function definition are variable names not literal values. [And as Torsten called out, you shouldn't call your function convolution1dLayer as convolution1dLayer already has a meaning in Deep Learning Toolbox.] If you eliminated the function keyword from that line of code (and if input and filtersize were defined) it could be a valid call to the convolution1dLayer function.
This documentation page shows how to define functions (note that the "Input arguments" must be variable names not literal data) and this one shows how to call functions. You're trying to combine the two and that's not going to work.

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by