Giter VIP home page Giter VIP logo

noisydensekeras's People

Contributors

luee-c avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

noisydensekeras's Issues

TypeError: __init__() missing 1 required positional argument: 'units' when using the NoisyDense Class

Hello,
I am actually new to Keras and I ran into an error when I used your class is my model as a layer.
Here the code: -


self.model = self._model()
# target network
self.target_model = clone_model(self.model)
self.target_model.set_weights(self.model.get_weights())

 def _model(self):
      model = Sequential()
      model.add(Dense(units=128, activation="relu", input_dim=self.state_size))
      model.add(Dense(units=256, activation="relu"))
      model.add(Dense(units=256, activation="relu"))
      model.add(NoisyDense(128, activation="relu"))
      model.add(NoisyDense(self.action_size + 1, activation='linear'))
      model.compile(loss=self.loss, optimizer=self.optimizer)
      return model

also tried: -

def _model(self):
        inp = Input((self.state_size,))
        x = Dense(units=128, activation="relu")(inp)
        x = Dense(units=256, activation="relu")(x)
        x = Dense(units=256, activation="relu")(x)
        x = NoisyDense(units = 128, activation="relu", sigma_init = 0.02)(x)
        out = NoisyDense(units  = self.action_size + 1, activation='linear',sigma_init = 0.02)(x)
        model = Model(inputs = inp, outputs = out)
        model.compile(loss=self.loss, optimizer=self.optimizer)
        return model

I ran into this error

Traceback (most recent call last):
  File "train.py", line 85, in <module>
    pretrained=pretrained, debug=debug)
  File "train.py", line 52, in main
    agent = Agent(window_size, strategy=strategy, pretrained=pretrained, model_name=model_name)
  File "C:\Users\Desktop\agent.py", line 158, in __init__
    self.target_model = clone_model(self.model)
  File "D:\anaconda\lib\site-packages\keras\models.py", line 255, in clone_model
    return _clone_sequential_model(model, input_tensors=input_tensors)
  File "D:\anaconda\lib\site-packages\keras\models.py", line 207, in _clone_sequential_model
    layers = [clone(layer) for layer in model.layers]
  File "D:\anaconda\lib\site-packages\keras\models.py", line 207, in <listcomp>
    layers = [clone(layer) for layer in model.layers]
  File "D:\anaconda\lib\site-packages\keras\models.py", line 205, in clone
    return layer.__class__.from_config(layer.get_config())
  File "D:\anaconda\lib\site-packages\keras\engine\base_layer.py", line 1179, in from_config
    return cls(**config)
TypeError: __init__() missing 1 required positional argument: 'units'

How do I solve this error? Does it expect an input_dimension?
Thank you

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.