Skip to content

[complex] {lin,log}space: raises warning incorrectly #53171

@kshitij12345

Description

@kshitij12345

With PR #38875, linspace and logspace support complex numbers for start and end but they raise noisy warnings even when not required.

import torch
torch.linspace(1j, 2j, steps=100) # Unnecessary warning raised.
torch.linspace(1j, 2j, steps=100, dtype=torch.float) # Valid warning raised/future: throw an error.

Warning Message Raised:

UserWarning: As either `start` or `stop` is complex, return type will be the complex dtype corresponding to default dtype.In future, this may throw an error when a non-complex dtype arg is passed as input along with complex valued start or end value. (Triggered internally at  ../aten/src/ATen/native/TensorFactories.cpp:468.)

More context
#38875 (comment)

cc @ezyang @anjali411 @dylanbespalko @mruberry @gchanan

Metadata

Metadata

Assignees

Labels

module: complexRelated to complex number support in PyTorchmodule: tensor creationtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions