Skip to content

Conversation

YanXiong-Meta
Copy link
Contributor

Summary:

Description

This diff converts the batch size to a float before calculating the standard deviation in the params_reporter module. This change is made to ensure accurate calculations, as torch.std expects a floating-point input.

Changes

  • Modified code in bench_params_reporter.py
    • Changed the line torch.std(torch.tensor([b for bs in batch_size_per_feature_per_rank for b in bs])) to torch.std(torch.tensor([b for bs in batch_size_per_feature_per_rank for b in bs])).float().

Reason

The torch.std function requires a floating-point tensor to calculate the standard deviation. By converting the batch size to a float, we ensure that the calculation is performed correctly.

Differential Revision: D81809491

Summary:
### Description
This diff converts the batch size to a float before calculating the standard deviation in the `params_reporter` module. This change is made to ensure accurate calculations, as `torch.std` expects a floating-point input.

### Changes
- **Modified code in `bench_params_reporter.py`**
  - Changed the line `torch.std(torch.tensor([b for bs in batch_size_per_feature_per_rank for b in bs]))` to `torch.std(torch.tensor([b for bs in batch_size_per_feature_per_rank for b in bs])).float()`.

### Reason
The `torch.std` function requires a floating-point tensor to calculate the standard deviation. By converting the batch size to a float, we ensure that the calculation is performed correctly.

Differential Revision: D81809491
Copy link

netlify bot commented Sep 5, 2025

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
🔨 Latest commit bd8d904
🔍 Latest deploy log https://app.netlify.com/projects/pytorch-fbgemm-docs/deploys/68bb4f6a5757c3000853f895
😎 Deploy Preview https://deploy-preview-4828--pytorch-fbgemm-docs.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.

@meta-cla meta-cla bot added the cla signed label Sep 5, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81809491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants