Skip to content

[ONNX] Add support for calling tensor.to(tensor.device). #56857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2021
Merged

[ONNX] Add support for calling tensor.to(tensor.device). #56857

merged 2 commits into from
Apr 27, 2021

Conversation

fatcat-z
Copy link
Collaborator

Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Apr 24, 2021

💊 CI failures summary and remediations

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


  • 4/4 failures introduced in this PR

🕵️ 4 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_xla_linux_bionic_py3_6_clang9_test (1/4)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Apr 27 07:52:17 sccache: error: couldn't connect to server
Apr 27 07:52:17 +++ eval 'extract_trap_cmd '
Apr 27 07:52:17 ++++ extract_trap_cmd
Apr 27 07:52:17 ++++ printf '%s\n' ''
Apr 27 07:52:17 +++ printf '%s\n' cleanup
Apr 27 07:52:17 ++ trap -- '
Apr 27 07:52:17 cleanup' EXIT
Apr 27 07:52:17 ++ [[ pytorch-xla-linux-bionic-py3.6-clang9-test != *pytorch-win-* ]]
Apr 27 07:52:17 ++ which sccache
Apr 27 07:52:17 ++ sccache --stop-server
Apr 27 07:52:17 Stopping sccache server...
Apr 27 07:52:17 sccache: error: couldn't connect to server
Apr 27 07:52:17 sccache: caused by: Connection refused (os error 111)
Apr 27 07:52:17 ++ true
Apr 27 07:52:17 ++ rm /var/lib/jenkins/sccache_error.log
Apr 27 07:52:17 ++ [[ -n '' ]]
Apr 27 07:52:17 ++ [[ pytorch-xla-linux-bionic-py3.6-clang9-test == *rocm* ]]
Apr 27 07:52:17 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log
Apr 27 07:52:17 ++ SCCACHE_IDLE_TIMEOUT=1200
Apr 27 07:52:17 ++ RUST_LOG=sccache::server=error
Apr 27 07:52:17 ++ sccache --start-server
Apr 27 07:52:17 sccache: Starting the server...

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_jit_legacy_test (2/4)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Apr 27 07:53:22 sccache: error: couldn't connect to server
Apr 27 07:53:22 +++ eval 'extract_trap_cmd '
Apr 27 07:53:22 ++++ extract_trap_cmd
Apr 27 07:53:22 ++++ printf '%s\n' ''
Apr 27 07:53:22 +++ printf '%s\n' cleanup
Apr 27 07:53:22 ++ trap -- '
Apr 27 07:53:22 cleanup' EXIT
Apr 27 07:53:22 ++ [[ pytorch-linux-xenial-py3.6-gcc5.4-jit_legacy-test != *pytorch-win-* ]]
Apr 27 07:53:22 ++ which sccache
Apr 27 07:53:22 ++ sccache --stop-server
Apr 27 07:53:22 Stopping sccache server...
Apr 27 07:53:22 sccache: error: couldn't connect to server
Apr 27 07:53:22 sccache: caused by: Connection refused (os error 111)
Apr 27 07:53:22 ++ true
Apr 27 07:53:22 ++ rm /var/lib/jenkins/sccache_error.log
Apr 27 07:53:22 ++ [[ -n '' ]]
Apr 27 07:53:22 ++ [[ pytorch-linux-xenial-py3.6-gcc5.4-jit_legacy-test == *rocm* ]]
Apr 27 07:53:22 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log
Apr 27 07:53:22 ++ SCCACHE_IDLE_TIMEOUT=1200
Apr 27 07:53:22 ++ RUST_LOG=sccache::server=error
Apr 27 07:53:22 ++ sccache --start-server
Apr 27 07:53:22 sccache: Starting the server...

See CircleCI build pytorch_linux_backward_compatibility_check_test (3/4)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Apr 27 07:53:09 sccache: error: couldn't connect to server
Apr 27 07:53:09 +++ eval 'extract_trap_cmd '
Apr 27 07:53:09 ++++ extract_trap_cmd
Apr 27 07:53:09 ++++ printf '%s\n' ''
Apr 27 07:53:09 +++ printf '%s\n' cleanup
Apr 27 07:53:09 ++ trap -- '
Apr 27 07:53:09 cleanup' EXIT
Apr 27 07:53:09 ++ [[ pytorch-linux-backward-compatibility-check-test != *pytorch-win-* ]]
Apr 27 07:53:09 ++ which sccache
Apr 27 07:53:09 ++ sccache --stop-server
Apr 27 07:53:09 Stopping sccache server...
Apr 27 07:53:09 sccache: error: couldn't connect to server
Apr 27 07:53:09 sccache: caused by: Connection refused (os error 111)
Apr 27 07:53:09 ++ true
Apr 27 07:53:09 ++ rm /var/lib/jenkins/sccache_error.log
Apr 27 07:53:09 ++ [[ -n '' ]]
Apr 27 07:53:09 ++ [[ pytorch-linux-backward-compatibility-check-test == *rocm* ]]
Apr 27 07:53:09 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log
Apr 27 07:53:09 ++ SCCACHE_IDLE_TIMEOUT=1200
Apr 27 07:53:09 ++ RUST_LOG=sccache::server=error
Apr 27 07:53:09 ++ sccache --start-server
Apr 27 07:53:09 sccache: Starting the server...

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_test (4/4)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Apr 27 07:53:30 sccache: error: couldn't connect to server
Apr 27 07:53:30 +++ eval 'extract_trap_cmd '
Apr 27 07:53:30 ++++ extract_trap_cmd
Apr 27 07:53:30 ++++ printf '%s\n' ''
Apr 27 07:53:30 +++ printf '%s\n' cleanup
Apr 27 07:53:30 ++ trap -- '
Apr 27 07:53:30 cleanup' EXIT
Apr 27 07:53:30 ++ [[ pytorch-linux-xenial-py3.6-gcc5.4-test != *pytorch-win-* ]]
Apr 27 07:53:30 ++ which sccache
Apr 27 07:53:30 ++ sccache --stop-server
Apr 27 07:53:30 Stopping sccache server...
Apr 27 07:53:30 sccache: error: couldn't connect to server
Apr 27 07:53:30 sccache: caused by: Connection refused (os error 111)
Apr 27 07:53:30 ++ true
Apr 27 07:53:30 ++ rm /var/lib/jenkins/sccache_error.log
Apr 27 07:53:30 ++ [[ -n '' ]]
Apr 27 07:53:30 ++ [[ pytorch-linux-xenial-py3.6-gcc5.4-test == *rocm* ]]
Apr 27 07:53:30 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log
Apr 27 07:53:30 ++ SCCACHE_IDLE_TIMEOUT=1200
Apr 27 07:53:30 ++ RUST_LOG=sccache::server=error
Apr 27 07:53:30 ++ sccache --start-server
Apr 27 07:53:30 sccache: Starting the server...

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 to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@BowenBao BowenBao merged commit a38f885 into pytorch:onnx_ms_1 Apr 27, 2021
BowenBao pushed a commit that referenced this pull request May 5, 2021
Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Co-authored-by: Jay Zhang <jiz@microsoft.com>

[ghstack-poisoned]
BowenBao added a commit that referenced this pull request May 7, 2021
Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Co-authored-by: Jay Zhang <jiz@microsoft.com>

[ghstack-poisoned]
BowenBao added a commit that referenced this pull request May 11, 2021
Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Co-authored-by: Jay Zhang <jiz@microsoft.com>

[ghstack-poisoned]
BowenBao added a commit that referenced this pull request May 11, 2021
Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Co-authored-by: Jay Zhang <jiz@microsoft.com>

[ghstack-poisoned]
facebook-github-bot pushed a commit that referenced this pull request May 13, 2021
Summary:
Pull Request resolved: #57599

Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Test Plan: Imported from OSS

Reviewed By: malfet

Differential Revision: D28393523

Pulled By: SplitInfinity

fbshipit-source-id: c41e3c0293932fc90dedb544daadd9c5d4b48792

Co-authored-by: Jay Zhang <jiz@microsoft.com>
BowenBao added a commit to BowenBao/pytorch that referenced this pull request May 14, 2021
Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Co-authored-by: Jay Zhang <jiz@microsoft.com>

ghstack-source-id: e5a436f
Pull Request resolved: pytorch#57599
krshrimali pushed a commit to krshrimali/pytorch that referenced this pull request May 19, 2021
Summary:
Pull Request resolved: pytorch#57599

Currently, if we call tensor.to() method and pass a device as the parameter. It will fail, because in symbolic function of to() we didn't handle such case.

So add a check in the beginning of this symbolic function, if this is a device cast, we return self directly. A test has also been added.

Test Plan: Imported from OSS

Reviewed By: malfet

Differential Revision: D28393523

Pulled By: SplitInfinity

fbshipit-source-id: c41e3c0293932fc90dedb544daadd9c5d4b48792

Co-authored-by: Jay Zhang <jiz@microsoft.com>
@fatcat-z fatcat-z deleted the enable_to_op branch October 14, 2021 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants