"Example: Define Custom Deep Learning Layer with Learnable Parameters" doesn't work
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
DoGyeom Jeong
am 26 Nov. 2019
Kommentiert: Asvin Kumar
am 9 Jan. 2020
Hellow, I wrote this question due to getting error for abstract method inheritance.
The example is here: https://kr.mathworks.com/help/deeplearning/ug/define-custom-deep-learning-layer.html
In this example, The written class file in the part named 'Completed Layer' is just used to test for the below 'check validity of Layer Using checkLayer' part:
layer = preluLayer(20,'prelu');
validInputSize = [24 24 20];
checkLayer(layer,validInputSize,'ObservationDimension',4)
But, in 'layer = preluLayer(20, 'prelu'); part, the error message was created: "Creating an instance of the Abstract class is not allowd"
Actually, I know the nnet.layer.Layer object has 2 abstract method named as 'predict' and 'backward', and this example just define 'predict' so the error will be from undefining 'backward'. Even though, I just had followed the example but I got error.
Could you please some tips to resolve this problem?
0 Kommentare
Akzeptierte Antwort
Asvin Kumar
am 23 Dez. 2019
Thanks for pointing this out. Check out the complete file by running the following command:
edit(fullfile(matlabroot,'examples','nnet','main','preluLayer.m'))
This file contains the implementation for the backward function too.
As mentioned in the example, it is not required to implement a backward function for layers whose predict/forward functions use only dlarray supported functions. In this example, the predict uses layer.Alpha which is created using randn. The randn function has a limitation for dlarray support. It works when used along with the ‘like’ argument.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!