Skip to content

Conversation

@jstac
Copy link
Contributor

@jstac jstac commented Dec 4, 2025

Summary

Refactored train_jax_model to match the implementation pattern used in train_jax_optax by replacing jax.lax.scan with jax.lax.fori_loop and simplifying the return value.

Changes

  • Modified train_jax_model to use fori_loop instead of scan
  • Simplified return value to only include final parameter vector (no longer returns training/validation loss histories)
  • Updated calling code to match train_jax_optax pattern
  • Removed validation loss plotting section (since loss history is no longer tracked)
  • Consolidated initialization code into single cell with consistent comments

Motivation

  • Improves consistency across the lecture by using the same loop construct in both training functions
  • Simplifies the training interface - users can compute losses separately if needed
  • Reduces memory overhead by not accumulating loss histories during training

Testing

  • Converted to Python via jupytext and ran successfully
  • All training methods (Keras, JAX, Optax SGD, Optax ADAM) produce identical results
  • Exercise strategies continue to work correctly

🤖 Generated with Claude Code

Replace jax.lax.scan with jax.lax.fori_loop in train_jax_model to match
the implementation pattern used in train_jax_optax. The function now
returns only the final parameter vector instead of including training
and validation loss histories.

Changes:
- Modified train_jax_model to use fori_loop instead of scan
- Simplified return value to only include final parameters
- Updated calling code to match train_jax_optax pattern
- Removed validation loss plotting (no longer tracked)
- Consolidated initialization code into single cell

This change improves consistency across the lecture and simplifies
the training interface.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Dec 4, 2025

Deploy Preview for incomparable-parfait-2417f8 ready!

Name Link
🔨 Latest commit 111b944
🔍 Latest deploy log https://app.netlify.com/projects/incomparable-parfait-2417f8/deploys/6931688838401e00085caffe
😎 Deploy Preview https://deploy-preview-264--incomparable-parfait-2417f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

@github-actions github-actions bot temporarily deployed to pull request December 4, 2025 11:02 Inactive
@github-actions github-actions bot temporarily deployed to pull request December 4, 2025 11:06 Inactive
@jstac jstac merged commit 9724c6c into main Dec 4, 2025
7 checks passed
@jstac jstac deleted the ifpdescan branch December 4, 2025 11:25
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.

2 participants