Skip to content

Conversation

@abhro
Copy link
Contributor

@abhro abhro commented Nov 20, 2025

It's more visually suggestive of the data being moved. Also, in an assignment expression, the main data piece/function call is closer to the equal sign rather than the device call.

It's more visually suggestive of the data being moved.
Also, in an assignment expression, the main data piece/function call is
closer to the equal sign rather than the device call.
@gemini-code-assist
Copy link

Summary of Changes

Hello @abhro, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors how data and model components are transferred to computational devices within the codebase. It transitions from a functional wrapping style (e.g., dev(data)) to using Julia's pipe operator (data |> dev). This change aims to improve code readability and consistency, making the data flow more explicit and visually intuitive across several machine learning examples.

Highlights

  • Consistent Data Movement: Standardized the use of Julia's pipe operator (|>) for moving data and model components to computational devices (CPU/GPU) across various examples. This replaces direct function calls like xdev(data) with the more idiomatic data |> xdev.
  • Improved Readability: Enhanced code clarity by making data flow more explicit and visually intuitive, aligning with Julia's functional programming style. This change improves the aesthetic of assignment expressions by keeping the main data piece closer to the assignment operator.
  • Refactored Examples: Applied the new piping convention to numerous example files, including ConvolutionalVAE, GCN_Cora, HyperNet, ImageNet, NeuralODE, OptimizationIntegration, PolynomialFitting, RealNVP, SimpleChains, and SimpleRNN, ensuring consistency throughout the codebase.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a stylistic change to use the pipe operator |> for moving data to devices. This is a great improvement for code readability, making the data flow more explicit and aligning with idiomatic Julia style. The changes have been applied across numerous example files. I've found one minor inconsistency where the old style is still present in a modified line, which I've pointed out in a specific comment. Otherwise, the changes are excellent.

@avik-pal
Copy link
Member

Run for formatter

@abhro
Copy link
Contributor Author

abhro commented Nov 21, 2025

Run for formatter

Hi! Just to confirm, you're asking me to run the formatter over this PR?

@avik-pal
Copy link
Member

avik-pal commented Nov 21, 2025

@abhro
Copy link
Contributor Author

abhro commented Nov 21, 2025

Alrighty! Will do! Thank you :D

@abhro abhro force-pushed the data-moving-to-device branch from 2d4954e to 2afbe0b Compare November 21, 2025 14:55
@avik-pal avik-pal merged commit 255ad78 into LuxDL:main Nov 21, 2025
13 of 15 checks passed
@abhro abhro deleted the data-moving-to-device branch November 21, 2025 16:49
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