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

Update error handling logic in convolutional.ts #8248

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

gaikwadrahul8
Copy link
Contributor

@gaikwadrahul8 gaikwadrahul8 commented Apr 16, 2024

Hi, Team

I have updated error handling code in this file tfjs/tfjs-layers/src/layers/convolutional.ts the if statement checks if bias is not null and its shape.length (number of dimensions) is not equal to 1. This is the correct check to ensure a valid bias tensor for a 1D convolution.However, the error message incorrectly references kernel.shape.length when it should be referencing bias.shape.length. If I'm not wrong, it seems like there is typo while writing error handling code logic so please do the needful.

The following error message would be more accurate and clearly indicates that the issue lies with the number of dimensions in the bias tensor, not the kernel.

if (bias != null && bias.shape.length !== 1) {
      throw new ValueError(
          `The bias for a conv1dWithBias operation should be 1, but is ` +
          `${bias.shape.length} instead`);
    }

I would request you to please review the changes and if you've any suggestion or feedback please let me know. Thank you.

@gaikwadrahul8 gaikwadrahul8 changed the title Update exception logic in convolutional.ts Update error handling logic in convolutional.ts Apr 16, 2024
@pyu10055 pyu10055 merged commit 1bf2fca into master Apr 17, 2024
2 checks passed
@pyu10055 pyu10055 deleted the gaikwadrahul8-patch-7 branch April 17, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants