Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i get this error. what do i do? new to python and programming and just want to execute this cool program. #13

Open
n4hid opened this issue Nov 26, 2020 · 7 comments

Comments

@n4hid
Copy link

n4hid commented Nov 26, 2020

2020-11-26 23:16:55.536092: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-11-26 23:16:55.550165: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fdf6d52e130 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-11-26 23:16:55.550181: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
File "/Users/nahidahmed/Desktop/SnakeGame/snakeClass.py", line 309, in
run(args.display, args.speed, params)
File "/Users/nahidahmed/Desktop/SnakeGame/snakeClass.py", line 223, in run
agent = DQNAgent(params)
File "/Users/nahidahmed/Desktop/SnakeGame/DQN.py", line 29, in init
self.model = self.network()
File "/Users/nahidahmed/Desktop/SnakeGame/DQN.py", line 33, in network
model.add(Dense(output_dim=self.first_layer, activation='relu', input_dim=11))
TypeError: init() missing 1 required positional argument: 'units'

@Ad1tyaV
Copy link

Ad1tyaV commented Dec 1, 2020

Same error on windows as well, could you please let us know

@CodeBlog-x64
Copy link

Sorry for pushing this thread but I’m also struggling with this as well. I didn’t know if I should change the output_dims to units instead. If anyone could clarify how we could fix this problem and confusion we would greatly appreciate it.

Ps: I am using windows 10, python 3.8, and Tensorflow 2.

@tipycalFlow
Copy link

tipycalFlow commented Dec 5, 2020

Removing param name output_dim fixes this:
Replace model.add(Dense(output_dim=self.first_layer, activation='relu', input_dim=11)) with
model.add(Dense(self.first_layer, activation='relu', input_dim=11)) for all instances where Dense layer is created

@n4hid
Copy link
Author

n4hid commented Dec 6, 2020

Removing param name output_dim fixes this:

@n4hid n4hid closed this as completed Dec 6, 2020
@n4hid n4hid reopened this Dec 6, 2020
@n4hid
Copy link
Author

n4hid commented Dec 6, 2020

@tipycalFlow hey can you send me a video of this working, whether its a youtube link or something. this would be very helpful.

@Sviskon0
Copy link

Sorry for not bringing a solution, but this replaces the error with

Traceback (most recent call last):
File "thonnyfiler/snake/snake-ga-master1/snakeClass.py", line 308, in
run(args.display, args.speed, params)
File "thonnyfiler/snake/snake-ga-master1/snakeClass.py", line 222, in run
agent = DQNAgent(params)
File "C:\Users\Elev\thonnyfiler\snake\snake-ga-master1\DQN.py", line 27, in init
self.model = self.network()
File "C:\Users\Elev\thonnyfiler\snake\snake-ga-master1\DQN.py", line 34, in network
model.add(Dense(activation='softmax'))
TypeError: init() missing 1 required positional argument: 'units'

Removing param name output_dim fixes this:
Replace model.add(Dense(output_dim=self.first_layer, activation='relu', input_dim=11)) with
model.add(Dense(self.first_layer, activation='relu', input_dim=11)) for all instances where Dense layer is created

@robert-lara
Copy link

Change these lines to units instead of output_dim in DQN.py lines 31-34:

model.add(Dense(units=self.first_layer, activation='relu', input_dim=11))
model.add(Dense(units=self.second_layer, activation='relu'))
model.add(Dense(units=self.third_layer, activation='relu'))
model.add(Dense(units=3, activation='softmax'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants