Giter VIP home page Giter VIP logo

Comments (2)

farizrahman4u avatar farizrahman4u commented on August 22, 2024 1
import recurrentshop
import numpy
import keras.layers
from keras.layers import Dense, Input, LSTM
from keras.models import Model

prior_out = Input(batch_shape=(1,5),name='prior_out')
main_input = Input(batch_shape=(1,5),name='main_input')
h_tm1 = Input(batch_shape=(1, 10))
c_tm1 = Input(batch_shape=(1, 10))
added_layer = keras.layers.add([prior_out,main_input])
# hidden = LSTM(10,stateful=True,return_sequences=False,name='hidden')(added_layer)
hidden, h, c = recurrentshop.cells.LSTMCell(10)([added_layer, h_tm1, c_tm1])
out = Dense(5,name='out')(hidden)
rnn = recurrentshop.RecurrentModel(input=main_input, initial_states=[prior_out, h_tm1, c_tm1], output=out, final_states=[out, h, c])
rnn_input = Input(batch_shape=(1,1,5),name='rnn_input')
rnn_output = rnn(rnn_input)
model = Model(inputs=rnn_input,outputs=rnn_output)
model.compile(optimizer='adam',loss='mae')
print model.predict(numpy.random.random((3,1,5)),batch_size=1)

from recurrentshop.

cpernoud avatar cpernoud commented on August 22, 2024

Thanks @farizrahman4u , and there it was right on the front page, I just wasn't getting what it was doing.

from recurrentshop.

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.