luee-c / noisydensekeras Goto Github PK
View Code? Open in Web Editor NEWImplementation of the https://arxiv.org/abs/1706.10295 Noisy Network for implementation dense layer in Keras
Implementation of the https://arxiv.org/abs/1706.10295 Noisy Network for implementation dense layer in Keras
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.