Skip to content

Replace _graphdef with _ for unused variables in NNX tutorials#307

Merged
da-niao-dan merged 2 commits into
peicheng/nnx_split_learning_tutorialfrom
copilot/sub-pr-304
Dec 19, 2025
Merged

Replace _graphdef with _ for unused variables in NNX tutorials#307
da-niao-dan merged 2 commits into
peicheng/nnx_split_learning_tutorialfrom
copilot/sub-pr-304

Conversation

Copilot AI commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Replace prefixed unused variable _graphdef with the standard Python convention _ for intentionally unused return values in tutorial examples.

Changes

  • tutorials/v1/device/08_initialize_nnx_on_device.py: Replace _graphdef, state = nnx.split(model) with _, state = nnx.split(model) (2 instances)
  • tutorials/v1/device/09_split_learning_vertical.py: Replace _graphdef, state = nnx.split(model) with _, state = nnx.split(model) (3 instances in model initialization functions)
# Before
_graphdef, state = nnx.split(model)

# After
_, state = nnx.split(model)

The graphdef is not needed in these contexts as models are reconstructed from their class definitions when deserializing state dicts.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: da-niao-dan <9532472+da-niao-dan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add more NNX and SL tutorials Replace _graphdef with _ for unused variables in NNX tutorials Dec 19, 2025
Copilot AI requested a review from da-niao-dan December 19, 2025 02:43

@da-niao-dan da-niao-dan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@da-niao-dan da-niao-dan marked this pull request as ready for review December 19, 2025 02:44
@da-niao-dan da-niao-dan requested a review from a team as a code owner December 19, 2025 02:44
@da-niao-dan da-niao-dan merged commit 85cdb7a into peicheng/nnx_split_learning_tutorial Dec 19, 2025
4 checks passed
@da-niao-dan da-niao-dan deleted the copilot/sub-pr-304 branch December 19, 2025 02:44
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants