Skip to content

Conversation

@Chillee
Copy link
Collaborator

@Chillee Chillee commented Jul 3, 2019

A combination of #21511 and #21512 that also fixes the test_unsupported_builtin_error test.

Chillee added 3 commits July 2, 2019 04:15
Added similar logic to __init__.py

Formatting

Added compatibility for python2

gh-metadata: pytorch pytorch 21511 gh/chillee/35/head
gh-metadata: pytorch pytorch 21512 gh/chillee/36/head
@Chillee Chillee requested review from ailzhang and driazati July 3, 2019 02:39
@pytorchbot pytorchbot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jul 3, 2019
return x


unimplemented_math_ops = ["fsum", "isclose", "trunc"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it intended to make unimplemented_math_ops available in torch.jit namespace? This is user facing, why do we want this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The goal was to not duplicate the list across __init__ and test_jit: #21511 (comment)

Is there another namespace I can put this in?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if there's another namespace hmmm, I commented below to check if this behavior is expected or not.

_builtin_table[id(math.isfinite)] = "aten::isfinite"
math_ops = [x for x in dir(math) if callable(getattr(math, x))]
special_math_ops = ["remainder"] # We bind this to aten::mathremainder
for op in math_ops:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this sustainable? IIUC say if python3.8 add math.xxx in math module, this might fail?
This also implies number of math ops we support in torchscript varies based on the python version it's compiled with right? e.g. math.xxx is available in python2 but not python3, then it's only registered in torchscript in the python2 build.
cc: @driazati is this behavior expected?

@jerryzh168 jerryzh168 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 12, 2019
@Chillee Chillee closed this Feb 25, 2021
@github-actions github-actions bot deleted the mathtests branch February 6, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed oncall: jit Add this issue/PR to JIT oncall triage queue open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants