Not defining backward loss leads to an 'Abstract classes cannot be instantiated' error. Why is that?
12 views (last 30 days)
Show older comments
Using the examples given in a Mathworks document I implemented my own neural network layer without defining the backward loss, which results in the following error message:
"Abstract classes cannot be instantiated. Class 'weightAdditionLayer' inherits abstract methods or properties but does not implement them. See the list of methods and properties that 'weightAdditionLayer' must implement if you do not intend the class to be abstract."
The meaning of the error message is clear to me. What is unclear is the fact that the mathworks implementation does not define the backward loss function and explicitly says that this is optional, as the class is able to find the derivative itself. Although I haven't tested the Mathworks code I assume it works. I want to know why I am getting this error message after all despite that I am following mathworks' example.
0 Comments
Answers (2)
Ajay Pattassery
on 29 Oct 2019
I think your MATLAB version is R2019a or earlier and you are referring to the documentation of R2019b.
In MATLAB R2019a and earlier versions, while creating the custom neural network layer, we need to create a backward function. It is not optional. Refer the same document in R2019a
If you want to refer to the documentation of previous releases, you could refer
0 Comments
Ba Mo
on 30 Oct 2019
Same problem occurs with the deep learning toolbox
Abstract classes cannot be instantiated. Class 'maeRegressionLayer' inherits ...
abstract methods or properties but does not implement them. Use ...
meta.abstractDetails to see the list of methods and properties that ...
'maeRegressionLayer' must implement if you do not intend the class to be ...
abstract.
Abstract classes cannot be instantiated. Class 'preluLayer' inherits ...
abstract methods or properties but does not implement them. Use ...
meta.abstractDetails to see the list of methods and properties that ...
'preluLayer' must implement if you do not intend the class to be ...
abstract.
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!