I am getting an error
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (2 件)
Torsten
2024 年 7 月 25 日
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 件のコメント
Torsten
2024 年 7 月 25 日
編集済み: Torsten
2024 年 7 月 25 日
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":
Steven Lord
2024 年 7 月 25 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!