Giter Club home page Giter Club logo

Comments (2)

jotaf98 avatar jotaf98 commented on September 1, 2024

Hi, you're right that the 2nd output is missing from the overloaded @max (this output is not differentiable so I didn't think of it). Anyway you can work around it, by creating a non-differentiable layer based on Matlab's @max with 2 outputs:

[~, maxInd] = Layer.create(@max, {scr , [ ] , 3}, 'numInputDer', 0)

(numInputDer is the number of input derivatives, which is 0 for non-differentiable functions)
And yes, gradients will be back-propagated to the selected elements of W :)

from autonn.

ncalik avatar ncalik commented on September 1, 2024

it's very cool solution!..
Firstly, I wrote a function like mcnExtraLayers :

function [y,dzdw ]= z_maxx(fea,w,scr,lbl,varargin)
sz_fea = size(fea);
sz_wei = size(w);
fea_mat = squeeze(fea);
scr_mat = squeeze(scr);

[~ dzdy] = vl_argparsepos(struct(), varargin) ;
if isempty(dzdy)
[~ maxInd] = max(scr(:));
val = 1./( 1 + exp( w(maxInd,:)*fea(:) ) );
y = (val-lbl).^2;
else
[~,maxInd] = max(scr(:));
dzdw = w;
y = fea;
% size(dzdw)
% y = {dzdf,dzdw};

end
end

then I called it by using : customLoss = Layer.fromFunction(@z_maxx,'numInputDer',2 );
I didn't write true derivatives, instead, I wrote same params to test function and it's worked.
So, what is the differences between Layer.fromFunction and Layer.create? Can I use one instead of the other?

Also, I want to inform you about that defining derivatives like y = {dzdf,dzdw} can't work in eval mode. Also, vl_nnaxpy is in the same format, so I couldn't compile it. When I define derivatives as an output argument like [y,dzdw ] it's worked. I also mentioned this porblem in #31.

I have a one more question
(I suppose that I am the one who bother you the most among in autonn users :)) )
in resnet we sum y = F(x)+x. Now I want to try a maxout operation on this way :
F(x)'s channels : C1,C2,C3....CN x's channels G1,G2,G3,......GN new tensor y = C1,G1,C2,G2,C3,G3,....,CN,GN then I will use maxout [2 N], so how can I concat these two tensor in this format??

Many thanks !!

from autonn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.