-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANN Input/Output Size #1267
Comments
Instead of getting this changed at the codebase , why not change it at the main program of CLI? I mean the user could directly specify the following in the network.conf file: which would essentially be transformed by the CLI to : |
@desai-aditya I think it's very important to make changes in the codebase first. Not everybody will use the CLI. The changes should be universal so that even when we use this within c++, it should work. |
I agree with @akhandait, this should be implemented in the ann codebase. |
I'd like to take this please |
I think @desai-aditya and @akhandait are already working on the issue. |
Sadly, it has been very difficult for me to take time out due to tighly scheduled exams. |
@akhandait : Thanks for letting me know. @zoq : should I wait for @desai-aditya ? Or should I go ahead and start working on this? |
@PlantsAndBuildings : you too can start working with me. |
@desai-aditya take all the time you need, we don't have to rush anything here. @PlantsAndBuildings I think @akhandait was working on the parser and @akhandait on the cli? |
can it be made clear as to who all are working on this issue. I am interested to work on this as well. |
I am working on CLI for ANN along with @desai-aditya. |
@PlantsAndBuildings, can we collaborate over this issue then? |
I have completed nearly half of the CLI approximately . @akhandait How's the parser going? Also if possible make it so that the input to the parser is a csv file in the same format instead of a space separated one. It's a lot easier to handle it that way. Also this issue and CLI for ANN are very closely related. If this issue is solved the parser will need to be updated. So we'll have to see how things go regarding that. |
In the best case, the parser is agnostic of the number of parameters. Let say the layer is defined as:
the config would look something like
if the layer requires only two parameter we just pass those two. |
I think that there are already enough people wanting to work on this, I'll find another issue. @Manthan-R-Sheth please ask @desai-aditya if he needs help |
Also I need a little bit of help for compiling the main using make - |
Based on my understanding (correct me in case i am wrong), So given that you are making CLI for ANN module, you will have to do |
I mean other than whatever you described @Manthan-R-Sheth . I understand that but do we need to make any other changes to any other file? Also what about cmake changes? |
I think, just addition of |
Yes, that should do the trick. |
It has been a while since I've seen any activity on this issue - and no open PRs as well. Is someone working on this, or can I take this one up? |
@PlantsAndBuildings I am working on this. Even I saw the inactivity here and hence started working on this. |
If we implement a new visitor for setting the input size of the layers in the first forward pass, how do we deal with the constructor of the layer objects. |
An easy option would be to implement another constructor for each layer that needs the input/output size. |
In the Linear layer implementation, or any other layer for that matter, the weights are initialized (size is set) in the constructor. template <typename InputDataType, typename OutputDataType>
Linear<InputDataType, OutputDataType>::Linear(
const size_t inSize,
const size_t outSize) :
inSize(inSize),
outSize(outSize)
{
weights.set_size(outSize * inSize + outSize, 1);
} In our case, if we define a constructor which only takes the output size, how do we deal with this? For each layer, the input size will only be known during the first forward pass. |
We could move the initialization in the |
Sorry for being late, I implemented the required visitors but am facing some issues. The |
Thanks for looking into it. |
@zoq moving the initialization to the |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍 |
Currently, if we build a network we have to specify the input and output size for each layer, ideally a user should only specify the input/output size for the first layer, and only specify the output size for the upcoming layer. Here is a simple example:
which should transforms to this:
There is something similar already in place to set the input and output width for the convolution operator:
mlpack/src/mlpack/methods/ann/ffn_impl.hpp
Lines 332 to 369 in af3c00b
What this code does is to read and set the input/output width in the first forward pass. So once we know the output size of the previous layer we know the input size of the current layer and so on.
A first step would be to look at the https://github.com/mlpack/mlpack/blob/master/src/mlpack/methods/ann/visitor/output_height_visitor.hpp and https://github.com/mlpack/mlpack/blob/master/src/mlpack/methods/ann/visitor/set_input_height_visitor_impl.hpp, which should be helpful to implement another visitor for the input/output size.
The text was updated successfully, but these errors were encountered: