-
Notifications
You must be signed in to change notification settings - Fork 74k
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
FusedBatchNorm & Conv2D backwards doesn't support zero batch size #14657
Comments
@zheng-xq this seems like it falls between the boundaries of cuDNN and TF. Is this something we might fix, or should I set to "contributions welcome"? |
Perhaps doc of
|
@ppwwyyxx Thank you! |
@ppwwyyxx Could you point me how to use tf.cond on keras generator type of input? |
I'm not sure I know what you mean. And I think it's already unrelated to the issue anyway. You can search for documentation/examples or ask on stackoverflow for usage questions. |
Turned out that with tf.device('/gpu:0'):
x = tf.random_normal([0, 16, 64, 64])
scale = tf.random_normal([16])
y = tf.nn.fused_batch_norm(x, scale, scale, data_format='NCHW')
with tf.Session() as sess:
print(sess.run(y)) |
There is a problem with conv2d backward as well, though forward works: with tf.device('/gpu:0'):
x = tf.random_normal([0, 16, 64, 64])
W = tf.random_normal([3, 3, 16, 16])
y = tf.nn.conv2d(x, W, [1, 1, 1, 1], padding='SAME', data_format='NCHW')
grad = tf.gradients(y, W)
with tf.Session() as sess:
print(sess.run(grad)) |
…2DBackpropFilter (fix tensorflow#14657)
Anyone can take a look at my PR #15264? |
Thanks for the PR @ppwwyyxx . I will take a look. |
…2DBackpropFilter (fix tensorflow#14657)
* Support empty input tensor for FusedBatchNorm,FusedBatchNormGrad,Conv2DBackpropFilter (fix #14657) * Also fix pooling ops * Add some comments in ops * Add tests for conv/pooling/bn. * Return NaN mean/variance when input is empty * update comments * fix typo * Move fill_functor implementations to :fill_functor
Most ops in TF work well with tensors with zero elements. However,
convolutionfusedbatchnorm with cudnn gives the following error:I would expect it checks and returns a 4D tensor with zero batch-size. Currently I have to work around it by
tf.cond
.The text was updated successfully, but these errors were encountered: