Open AGFACBNNR opened 1 month ago
This is technically an invalid case (your output with TF has a size zero dimension, so it's an empty tensor). Weird that TF allows it -- but it's invalid nonetheless.
Hi @AGFACBNNR -
I am not able to reproduce the issue in tensorflow and pytorch backend with latest versions. Attached gist for the reference with additional examples with tensorflow and pytorch backend.
@mehtamansi29 Unfortunately, your code can not correctly reflect this issue. To switch the backend from tensorflow to pytorch, you have to restart the kernel (to clear the import cache). In fact your 'pytorch' result is still the tensorflow result, because TensorShape does not exist in pytorch.
@fchollet As a front end framework supporting different DL libraries, I believe Keras should generate the same results given the same inputs. Maybe adding a checker for this kind of problem?
@AGFACBNNR Would you be open to contributing a PR to add this check to the TF backend? Thanks!
As shown in this colab, I created a Conv3D layer which can generate an output tensor as following:
After switching the backend to Pytorch, with the same parameters and inputs, I met a crash:
![1716529613721](https://github.com/keras-team/keras/assets/20224019/28155e09-931c-44ef-9603-ff89af9c86c6)