Skip to content

Fix UP action arrow drawn as LEFT in FrozenLake visualizations#2694

Open
Chessing234 wants to merge 1 commit into
d2l-ai:masterfrom
Chessing234:fix/frozenlake-up-arrow-direction
Open

Fix UP action arrow drawn as LEFT in FrozenLake visualizations#2694
Chessing234 wants to merge 1 commit into
d2l-ai:masterfrom
Chessing234:fix/frozenlake-up-arrow-direction

Conversation

@Chessing234
Copy link
Copy Markdown

Summary

In show_value_function_progress and show_Q_function_progress, the action2dxdy dictionary maps action 3 (UP) to (-.25, 0), which is identical to action 0 (LEFT). Every cell whose optimal action is UP displays a left-pointing arrow instead of an up-pointing arrow.

The correct mapping for UP in imshow coordinates (where y increases downward) is (0, -.25), consistent with DOWN being (0, .25).

Before: Actions 0 (LEFT) and 3 (UP) both draw arrows pointing left.
After: Action 3 (UP) correctly draws an upward arrow.

Fixed in all four occurrences across d2l/torch.py and chapter_appendix-tools-for-deep-learning/utils.md.

Test plan

  • Run the FrozenLake value iteration example and verify UP arrows point upward in the policy grid

🤖 Generated with Claude Code

In both show_value_function_progress and show_Q_function_progress,
action 3 (UP) is mapped to (-.25, 0) which is identical to action 0
(LEFT). The correct direction for UP in imshow coordinates (where y
increases downward) is (0, -.25).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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