Skip to content

PowBackward always operates in Complex dtype #46936

@zou3519

Description

@zou3519

🐛 Bug

auto in the following line is always deduced to be c10::complex:

auto exponent = (exponent_.isComplex()) ? exponent_.toComplexDouble() : exponent_.toDouble();

This leads to PowBackward always operating on complex tensors due to type promotion:
auto out = grad * (exponent * self.pow(exponent - 1)).conj();

which should lead to a performance regression.

cc @ezyang @anjali411 @dylanbespalko @mruberry @VitalyFedyunin @ngimel

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: complexRelated to complex number support in PyTorchmodule: performanceIssues related to performance, either of kernel code or framework gluemodule: regressionIt used to work, and now it doesn'ttriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions