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

Fix channels_first error in 3D Convolution Layers #1386

Merged
merged 4 commits into from
Aug 11, 2021

Conversation

Frightera
Copy link
Contributor

@Frightera Frightera commented Jul 24, 2021

Related to the issue #1384. In 3D Convolutions if the data format is specified as channels_first it throws this error:

TypeError: Failed to convert object of type <class 'list'> to Tensor. Contents: [None, 64, 1024, 32]. Consider casting elements to a supported type. Full traceback can be found on the related issue. This PR should fix that error.

Please find the gist here.

@googlebot googlebot added the cla: yes Declares that the user has signed CLA label Jul 24, 2021
@Frightera Frightera changed the title Fixed #1384 Fixed the Issue #1384 Jul 25, 2021
@Frightera Frightera changed the title Fixed the Issue #1384 Fix channels_first error in 3D Convolution Layers Jul 25, 2021
@SiegeLordEx
Copy link
Member

Is this something that can be reproduced in a test (

)? Technically we already test this layer w/ channels_first inside Sequential (
def _testLayerInSequential(self, layer_class): # pylint: disable=invalid-name
).

You can see how to run tests here: https://github.com/tensorflow/probability/blob/main/CONTRIBUTING.md#unit-tests

@Frightera
Copy link
Contributor Author

Frightera commented Jul 30, 2021

@SiegeLordEx The test cases' input shape includes the batch size. Hence not reproducible. This error pops out when you try to define input_shape without including the batch_size, so it does not occur when input is specified with batch size.. Please find the demo here.

I've tested my changing also, it can also be found here.

@SiegeLordEx
Copy link
Member

I'm asking for the reproduction to be checked into the tests.

@Frightera
Copy link
Contributor Author

Frightera commented Aug 3, 2021

Yes, this can be reproduced in unit tests. Changing the following lines will reproduce:

https://github.com/Frightera/probability/blob/788e7b8c07010414c073ebb4e737632c2d72e786/tensorflow_probability/python/layers/conv_variational_test.py#L611-L614

Please find the gist here.

Edit: @SiegeLordEx If that was not what you've asked, can you be more specific? Thanks.

@Frightera
Copy link
Contributor Author

@SiegeLordEx This was something can be reproduced in tests. Please see my comment above. The first commit should fix that error, second one is also for testing purposes. This was not reproducible in tests before since input_shape was not passed as parameter to layer_class.

What will be the state of this PR? Is there anything should I do now?

Thanks.

@copybara-service copybara-service bot merged commit 25bc475 into tensorflow:main Aug 11, 2021
@SiegeLordEx
Copy link
Member

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Declares that the user has signed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants