Comments (2)
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.
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)
- Copy weights HOT 1
- Insert Layers HOT 1
- How does W and b randomly initialized? HOT 1
- Different results of AutoNN and DagNN? HOT 1
- weighted multi loss derivative HOT 2
- Multi Loss Backpropagation Error HOT 1
- cann't run the cnn example and debug the code
- issues in the nutshell example HOT 1
- KL HOT 3
- An error occurred when using the power operator in GPU mode. HOT 5
- Operator overloading of the function "gradient" HOT 1
- softmaxlog implementation in autonn
- autograd/tf.gradients - is there support? HOT 3
- Does it lost the function 'vl_argparse'? HOT 2
- Overloading the sampling functions of probability distributions HOT 2
- Does it have fully connected layer? HOT 1
- An error with optimizeGraph function HOT 2
- Way to use a network object in parallel HOT 2
- adding lstm layer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autonn.