Skip to content

float default values for Scalar in native_functions.yaml don't work #8484

@zou3519

Description

@zou3519

rrelu is affected by this and (probably) gives incorrect behavior (I have not verified this)

func: rrelu(Tensor self, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=false, Generator* generator=nullptr) -> Tensor
variants: function

func: rrelu_(Tensor self, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=false, Generator* generator=nullptr) -> Tensor
variants: function

I gdb'ed into rrelu and printed out "lower":

(gdb) p upper
$1 = {tag = at::Scalar::Tag::HAS_i, v = {d = 0, i = 0}, t = {pImpl =
    0x7fffe951f120 <at::UndefinedTensor::_singleton>}}
(gdb) p lower
$2 = {tag = at::Scalar::Tag::HAS_i, v = {d = 0, i = 0}, t = {
    pImpl = 0x7fffe951f120 <at::UndefinedTensor::_singleton>}}

they have the at::Scalar::Tag::HAS_i flag, so they're both being treated as integers. Sending them to std::cout gives 0.

Metadata

Metadata

Assignees

Labels

todoNot as important as medium or high priority tasks, but we will work on these.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions