Skip to content

Conversation

@durumu
Copy link
Contributor

@durumu durumu commented May 28, 2020

Stack from ghstack:

Differential Revision: D21771202

durumu added a commit that referenced this pull request May 28, 2020
ghstack-source-id: f83f79f
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: f83f79f
Pull Request resolved: #39200

Added tests

ghstack-source-id: f83f79f
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: f83f79f
Pull Request resolved: #39202
@durumu durumu requested review from supriyar and vkuzo May 28, 2020 21:23
@durumu durumu changed the title Dummy operator building correctly Add quantized CELU operator by adding additional parameters to quantized ELU May 28, 2020
@dr-ci
Copy link

dr-ci bot commented May 28, 2020

💊 CI failures summary and remediations

As of commit d48959e (more details on the Dr. CI page):


  • 1/1 failures introduced in this PR

XLA failure

Job pytorch_xla_linux_bionic_py3_6_clang9_test is failing. Please create an issue with title prefixed by [PT_BREAK] in pytorch/xla and link to to this PR. If you have questions, please reach out to @ailzhang / @dlibenzi / @JackCaoG.


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 116 times.

@vkuzo
Copy link
Contributor

vkuzo commented May 29, 2020

there are some failing tests (like https://app.circleci.com/pipelines/github/pytorch/pytorch/174752/workflows/fa9a3d4b-602d-45b3-955f-8c32409c2eb5/jobs/5611015/steps), we should figure out what's going on with them before landing. The failure looks odd to me, do we have a local repro?

return output
elif inplace:
return torch._C._nn.elu_(input, alpha)
return torch._C._nn.elu_(input, alpha, 1., 1.)
Copy link
Contributor

Choose a reason for hiding this comment

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

these have a default of 1 in native_functions.yaml, would it work to revert this and next line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can do that -- I didn't realize the C-style functions could have default arguments.

}

Tensor& quantized_celu_(Tensor& self, Scalar alpha) {
double inv_alpha = 1. / alpha.to<double>();
Copy link
Contributor

Choose a reason for hiding this comment

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

can we verify that division by zero if alpha == 0 gives a good error message?

Copy link
Contributor

@vkuzo vkuzo left a comment

Choose a reason for hiding this comment

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

thanks for working on this! in general looks great, we should figure out why the derivative tests are failing before landing

# type: (Tensor, Optional[float], Optional[bool]) -> Tensor
r"""celu(input, inplace=False) -> Tensor
Applies the quantized continuously differentiable ELU function element-wise.
Copy link
Contributor

Choose a reason for hiding this comment

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

ELU -> CELU

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CELU stands for continuously differentiable ELU -- maybe I should capitalize the C to make it clearer this is what I mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh right, missed that! Maybe we should say Continuously Differentiable Exponential Linear Units (CELU)

durumu added a commit that referenced this pull request May 29, 2020
…zed ELU

ghstack-source-id: 37c1a45
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 37c1a45
Pull Request resolved: #39200

Added tests

ghstack-source-id: 37c1a45
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 37c1a45
Pull Request resolved: #39202
durumu added a commit that referenced this pull request May 29, 2020
…zed ELU

ghstack-source-id: 389d2df
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 389d2df
Pull Request resolved: #39200

Added tests

ghstack-source-id: 389d2df
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 389d2df
Pull Request resolved: #39202
@supriyar
Copy link
Contributor

Changes look good! @vkuzo could you take a look as well?

@vkuzo
Copy link
Contributor

vkuzo commented May 30, 2020

looks good, can we verify that alpha == 0 is handled well with a good error message?

durumu added a commit that referenced this pull request Jun 2, 2020
…zed ELU

ghstack-source-id: 9d1f973
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 9d1f973
Pull Request resolved: #39200

Added tests

ghstack-source-id: 9d1f973
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 9d1f973
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jun 2, 2020
…zed ELU

ghstack-source-id: c20f914
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: c20f914
Pull Request resolved: #39200

Added tests

ghstack-source-id: c20f914
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: c20f914
Pull Request resolved: #39202
@durumu
Copy link
Contributor Author

durumu commented Jun 2, 2020

@vkuzo I added a new error message that's more verbose - "ZeroDivisionError: alpha cannot be 0 in CELU".

Copy link
Contributor

@vkuzo vkuzo left a comment

Choose a reason for hiding this comment

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

looks great! thank you for working on this!

Comment on lines +799 to +800
Scalar scale,
Scalar input_scale,
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 try giving default values to these arguments.

durumu added a commit that referenced this pull request Jun 23, 2020
…zed ELU

ghstack-source-id: f2649e0
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: f2649e0
Pull Request resolved: #39200

Added tests

ghstack-source-id: f2649e0
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: f2649e0
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jun 23, 2020
…zed ELU

ghstack-source-id: d75cf20
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: d75cf20
Pull Request resolved: #39200

Added tests

ghstack-source-id: d75cf20
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: d75cf20
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jun 24, 2020
…zed ELU

ghstack-source-id: ca5c035
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: ca5c035
Pull Request resolved: #39200

Added tests

ghstack-source-id: ca5c035
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: ca5c035
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jun 24, 2020
…zed ELU

ghstack-source-id: 447308a
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 447308a
Pull Request resolved: #39200

Added tests

ghstack-source-id: 447308a
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 447308a
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jun 24, 2020
…zed ELU

ghstack-source-id: 2b58934
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 2b58934
Pull Request resolved: #39200

Added tests

ghstack-source-id: 2b58934
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 2b58934
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jun 26, 2020
…zed ELU

ghstack-source-id: 3a7f60d
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 3a7f60d
Pull Request resolved: #39200

Added tests

ghstack-source-id: 3a7f60d
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 3a7f60d
Pull Request resolved: #39202
dtype=torch_type)

# test regular
qY = torch.nn.quantized.functional.celu(qX, output_scale, output_zero_point, alpha=alpha)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you can call torch.ops.quantized.celu here instead of functional

durumu added a commit that referenced this pull request Jun 26, 2020
…zed ELU

ghstack-source-id: f70040e
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: f70040e
Pull Request resolved: #39200

Added tests

ghstack-source-id: f70040e
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: f70040e
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jul 7, 2020
…zed ELU

ghstack-source-id: dc6071a
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: dc6071a
Pull Request resolved: #39200

Added tests

ghstack-source-id: dc6071a
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: dc6071a
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jul 7, 2020
…zed ELU

ghstack-source-id: 86c2437
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: 86c2437
Pull Request resolved: #39200

Added tests

ghstack-source-id: 86c2437
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: 86c2437
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jul 8, 2020
…zed ELU

ghstack-source-id: b92cff1
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: b92cff1
Pull Request resolved: #39200

Added tests

ghstack-source-id: b92cff1
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: b92cff1
Pull Request resolved: #39202
durumu added a commit that referenced this pull request Jul 13, 2020
…zed ELU

ghstack-source-id: c5e88ba
Pull Request resolved: #39199

Updated ELU to accept additional parameters

ghstack-source-id: c5e88ba
Pull Request resolved: #39200

Added tests

ghstack-source-id: c5e88ba
Pull Request resolved: #39201

Improved tests to fail when formula is wrong

ghstack-source-id: c5e88ba
Pull Request resolved: #39202
@facebook-github-bot
Copy link
Contributor

@durumu merged this pull request in 445e7eb.

@facebook-github-bot facebook-github-bot deleted the gh/durumu/2/head branch July 21, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants