Skip to content

Conversation

@NicolasHug
Copy link
Contributor

TSIA!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 29, 2025
// planar (fltp).
TORCH_CHECK(wf.dim() == 2, "waveform must have 2 dimensions, got ", wf.dim());
return wf;
return wf.contiguous();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confirming that this is load-bearing: newly added test fails if we just return wf without calling contiguous().


torch.testing.assert_close(self.decode(encoded_tensor), samples)

def test_contiguity(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide some narration in the test about what exactly we're testing? I'm afraid I'm not familiar enough with tensor manipulation to fully understand everything. For example, I'm surprised assert_close(contiguous_samples, non_contiguous_samples) passes when they have different strides.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

The strides have to do with the representation of the tensor in memory. But it's not what uniquely determines the values of a tensor. E.g. a 2D tensor

A B
C D

can be represented in memory as

A B C D

or as

A C B D

They'd have different strides, but equal values.

@NicolasHug NicolasHug merged commit d717d6c into meta-pytorch:main Apr 30, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants