-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
optimizer.minimize does not work with maxPooling layers #1189
Comments
Used averagePooling2d pooling layers instead of maxPooling2d due to this bug: tensorflow/tfjs#1189. Once I have more information about this issue I can update the model with different pooling layer types. The input image is downsampled three times from 100 by 100 to 9 by 9. Adding a convolutional element to the network dramatically increased the performance of the training algorithm after several hundred training iterations.
It appears that this is in fact a bug in TensorFlow.js version 0.14 (https://stackoverflow.com/a/54495577/10940584). No error appears when the above code is run in version 0.13.3 and earlier. |
In 0.14+, there is a change that disables backpropagation support in the I.e., change optimizer.minimize(() =>
loss(model.predict([tf.ones([1, 100, 100, 4])]), tf.ones([1, 10]))
); to optimizer.minimize(() =>
loss(model.apply([tf.ones([1, 100, 100, 4])], {training: true}), tf.ones([1, 10]))
); |
Thank you! This solved my problem, I appreciate the help. |
Initially, apply confused me as its similar name to the apply method on functions prototype. |
This doesn't seem to work for me. Has the API been changed? Can anyone help me out? |
TensorFlow.js version
Latest / 0.14.2
Browser version
Google Chrome
Version 71.0.3578.98 (Official Build) (64-bit)
Describe the problem
When using
optimizer.minimize()
withmodel.predict()
to train atf.model
with a loss function, I encounter an issue. This only occurs when I use amaxPooling2D
layer in a convolutional neural network with code similar to the code below. It produces this error:Cannot read property 'backend' of undefined
. I'm not sure what is causing this or how to resolve it. The error does not occur when using a convolutional layer (tf.layers.conv2d()
) without any pooling layers. I have not had this issue withtf.layers.averagePooling2d()
, leading me to believe that this could be a possible bug.Code to reproduce the error
The text was updated successfully, but these errors were encountered: