On Keras 3 with TensorFlow 2.16.1, DropBlock2D fails on graph mode with the following casting error:
TypeError: Exception encountered when calling DropBlock2D.call().
int() argument must be a string, a bytes-like object or a real number, not 'SymbolicTensor'
Arguments received by DropBlock2D.call():
• x=tf.Tensor(shape=(32, 8, 8, 8), dtype=float32)
• training=True
Thanks for reporting the issue. I have tested the code snippet and reproduces the reported behaviour. Attached gist file for reference.
We will look into the issue and update you the same.
Current Behavior:
On Keras 3 with TensorFlow 2.16.1,
DropBlock2D
fails on graph mode with the following casting error:Steps To Reproduce:
See the following collab: DropBlock2D Graph Mode
Version:
Anything Else:
The fix is trivial, just use
ops.cast()
instead of pythonint()
in thecall
method of theLayer
.