Giter Site home page Giter Site logo

Comments (5)

Met4physics avatar Met4physics commented on September 28, 2024 1

You can write a function which make a traversal in your model to set initial membrane potential. For example:

def set_initial(model, value):
    for module in model.modules():
        if isinstance(module, neuron):
            module.v = value

from spikingjelly.

JackCaster avatar JackCaster commented on September 28, 2024

You can write a function which make a traversal in your model to set initial membrane potential. For example:

def set_initial(model, value):
    for module in model.modules():
        if isinstance(module, neuron):
            module.v = value

Thanks, this is close to what I was looking for! But I was wondering if it would be possible to have the initial value being a parameter to learn

from spikingjelly.

Met4physics avatar Met4physics commented on September 28, 2024

You can write a function which make a traversal in your model to set initial membrane potential. For example:

def set_initial(model, value):

for module in model.modules():
    if isinstance(module, neuron):
        module.v = value

Thanks, this is close to what I was looking for! But I was wondering if it would be possible to have the initial value being a parameter to learn

Then you need to use nn.parameter to represent the initial value.

from spikingjelly.

JackCaster avatar JackCaster commented on September 28, 2024

Yes exactly, I think I need a parameter v_init that by default is set to 0.0. Where is the right place to add this parameter. I usually subclass the base neuron to add these kind of changes, but I struggle to find the right way to add this parameter in there.

from spikingjelly.

Met4physics avatar Met4physics commented on September 28, 2024

Yes exactly, I think I need a parameter v_init that by default is set to 0.0. Where is the right place to add this parameter. I usually subclass the base neuron to add these kind of changes, but I struggle to find the right way to add this parameter in there.

Just like this:

class Neuron():
    def __init__(self):
        self.init_v = nn.parameter([1])

Note that this code is only a draft for illustration. And you should also write a new reset function to set v to be equal with v_init after a timestep.

from spikingjelly.

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.