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

avoid cryptic SVG rendering error / check that solution output is actually a tensor #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

noahlt
Copy link

@noahlt noahlt commented Mar 2, 2024

The problem: If the user's solution to a puzzle is a rank-0 tensor (eg, tensor(6)), running make_test results in a cryptic TypeError many levels deep in the SVG-rendering code. This is documented pretty well by @ikamensh in #23.

This solution: This change adds a check, torch.is_tensor(yours) and yours.ndim > 0, before adding the user's solution output to the data to be rendered to the SVG.

Caveats: The solution checker seems to accept tensor(6), tensor([6]), tensor([[6]]), equally. Before this change, the SVG-rendering code would error out before solution checker ran, so you could call that "failing". I don't completely understand the solution-checking code and I'm not sure whether that is intended behavior.

Hopefully this makes sense. I'm happy to discuss it or make changes if you'd like. Thanks in advance!

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.

1 participant