Coder Social home page Coder Social logo

Comments (5)

rcurtin avatar rcurtin commented on July 21, 2024

Hey there @SinghKislay, I think that this is not specific to ensmallen but instead mlpack. In any case, I'd suggest taking a careful look at src/mlpack/tests/feedforward_network_test.cpp and src/mlpack/tests/convolutional_network_test.cpp and related files to get an idea of how to build neural networks with mlpack. The strategy you described for building a network is pretty straightforward, but you don't need a special ResNet struct---you can just build an FFN<> and add the right layers.

from ensmallen.

SinghKislay avatar SinghKislay commented on July 21, 2024

Hi, @rcurtin I have read the examples from test/convolutional_network_test.cpp, model/kaggle/DigitRecogniser/src/DigitRecogniser.cpp I have also read the example from vae in model reository. All of them use Add() method to add the layer and then they just use Train() method with input and target. I understad this and have also built one. But what I want to do is modify the outputs of each layer which is not done in any of the examples. Could u you point me to an example Where the Feedforward() method is used so that I could do f(x)+x. I don't know why is this so hard am I missing something here. Thankyou

from ensmallen.

zoq avatar zoq commented on July 21, 2024

@SinghKislay Sorry for the slow response, in this case you have to manually step through each layer or implement a new one that you could add right after each layer you like to modify. Here is the code to get the output after each layer:

https://github.com/mlpack/mlpack/blob/6faf0b782705c29267fbfeb1eca527b6006e5a04/src/mlpack/methods/ann/ffn_impl.hpp#L134-L146

in this case network[begin + i].OutputParameter() does contain the result. Let me know if I should clarify anything.

from ensmallen.

SinghKislay avatar SinghKislay commented on July 21, 2024

@zoq thanks for reply, I understand we have to add layers manually, which is why I made the resnet struct on top of ffn class. Where I am facing problem is propagating the gradients back and the loss function. Say I push the input all the way through to the last layer and then push it into the loss fuction. How do I backprop. All the examples that I saw regarding back prop were using simple train method which we can't use in this case.

from ensmallen.

mlpack-bot avatar mlpack-bot commented on July 21, 2024

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! 👍

from ensmallen.

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.