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

sequenceMask method throws error when NDArray dimension is 2 but use_sequence_length is True #802

Closed
markbookk opened this issue Mar 30, 2021 · 1 comment · Fixed by #828
Labels
bug Something isn't working

Comments

@markbookk
Copy link
Contributor

Description

Currently sequenceMask in MxNDArray.java throws an error if the dimensions is 2 and use_sequence_length is set True (which currently is always the case).

Expected Behavior

Only throw error when dimensions of NDArray is less than 3 and use_sequence_length is False. If use_sequence_length then throw error if less than 2.

Error Message

sequenceMask is not supported for NDArray with less than 3 dimensions

How to Reproduce?

https:/markbookk/java-d2l-IDE/blob/02a5ce874aa8d3fabc3ce944d5ab765b71c8f6fe/section9_6-7/src/main/java/Main.java#L41

Steps to reproduce

  1. This repo contains multiple projects, but if needed section9_6-7 uses sequenceMask as an example of what will throw an error which shouldn't.

What have you tried to solve it?

  1. Changing the condition to only throw error if the dimensions are less than 2 works fine. This only works though because use_sequence_length is currently always True.
  2. I haven't fully implemented this but another solution is to add a method that allows the user to enter the boolean value use_sequence_length and handle throwing the error based on the boolean.

Environment Info

djl 0.11.0 SNAPSHOT
@markbookk markbookk added the bug Something isn't working label Mar 30, 2021
@markbookk
Copy link
Contributor Author

@frankfliu @stu1130 @zachgk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant