Skip to content

[FX] Fix tests warnings#4083

Merged
AlexanderDokuchaev merged 1 commit into
openvinotoolkit:developfrom
daniil-lyakhov:dl/fx/test_warns
May 19, 2026
Merged

[FX] Fix tests warnings#4083
AlexanderDokuchaev merged 1 commit into
openvinotoolkit:developfrom
daniil-lyakhov:dl/fx/test_warns

Conversation

@daniil-lyakhov
Copy link
Copy Markdown
Collaborator

@daniil-lyakhov daniil-lyakhov commented May 18, 2026

Changes

Fix Fx tests warnings

  • UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow.
  • UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.detach().clone()

Reason for changes

To fix warnings

Related tickets

CVS-178300

Tests

Copilot AI review requested due to automatic review settings May 18, 2026 14:26
@daniil-lyakhov daniil-lyakhov requested a review from a team as a code owner May 18, 2026 14:26
@github-actions github-actions Bot added the NNCF PT Pull requests that updates NNCF PyTorch label May 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes two categories of PyTorch UserWarnings in FX-related tests by converting list-of-ndarrays to a single numpy array before tensor creation, and replacing torch.tensor(existing_tensor) with .detach().clone().

Changes:

  • Wrap list of ndarrays with np.array(...) before torch.tensor(...) in statistics aggregator test fixture.
  • Replace torch.tensor(tensor_input) with tensor.detach().clone() (with .to(dtype=...) where needed) in weights compression tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/torch/fx/test_statistics_aggregator.py Avoid slow tensor creation warning by converting list of ndarrays via np.array.
tests/torch/function_hook/quantization/test_weights_compression.py Use .detach().clone() instead of torch.tensor(tensor) to avoid copy-construct warning.

@AlexanderDokuchaev AlexanderDokuchaev merged commit ef8e1db into openvinotoolkit:develop May 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NNCF PT Pull requests that updates NNCF PyTorch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants