Skip to content

Commit

Permalink
Neural Net Layer of GGRBF
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshuvnm authored Mar 10, 2024
1 parent eab18a6 commit 0c8a739
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion Neural Net Layer of GGRBF
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@

classdef ggrbf < nnet.layer.Layer
% Custom GGRBF layer.

properties (Learnable)
% Layer learnable parameters.
% Scaling coefficients.
Alpha
Beta
end

methods
function layer = ggrbf(numChannels, name)


% Set layer name.
layer.Name = name;


% Initialize scaling coefficient.
layer.Alpha = rand([1 1 numChannels]);
layer.Beta = rand([1 1 numChannels]);
end

function Z = predict(layer, X)
% Z = predict(layer, X) forwards the input data X through the layer and outputs the result Z.
Z=exp(-(layer.Alpha).^(-2).*X.*X).*exp(exp(-(layer.Beta).^(-2).*X.*X)-1);
end
end
end

0 comments on commit 0c8a739

Please sign in to comment.