mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[AutoAccept][Codemod][FBSourceClangFormatLinter] Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh
Differential Revision: D34263670
fbshipit-source-id: 9479899031c817ad8cbefba30db7d0203804fd99
(cherry picked from commit c13e2138f4)
This commit is contained in:
parent
ccdff4c480
commit
f395a75c67
|
|
@ -120,11 +120,11 @@ TensorImpl::TensorImpl(
|
|||
|
||||
// [Note: Python key removal]
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// In most constructors for TensorImpl, you will see Python and PythonTLSSnapshot
|
||||
// keys are removed from the passed in DispatchKeySet. Why?
|
||||
// In most constructors for TensorImpl, you will see Python and
|
||||
// PythonTLSSnapshot keys are removed from the passed in DispatchKeySet. Why?
|
||||
//
|
||||
// INVARIANT: Python and PythonTLSSnapshot dispatch keys are set iff PyObject for
|
||||
// the Tensor has a nontrivial __torch_dispatch__ implementation.
|
||||
// INVARIANT: Python and PythonTLSSnapshot dispatch keys are set iff PyObject
|
||||
// for the Tensor has a nontrivial __torch_dispatch__ implementation.
|
||||
//
|
||||
// When a fresh TensorImpl is created, there is *no* PyObject (this only gets
|
||||
// initialized lazily at the first point in time the Tensor passes into Python).
|
||||
|
|
@ -148,9 +148,10 @@ TensorImpl::TensorImpl(
|
|||
numel_(0),
|
||||
data_type_(data_type),
|
||||
device_opt_(storage_.device()),
|
||||
key_set_(key_set.remove(
|
||||
DispatchKey::Python).remove(
|
||||
DispatchKey::PythonTLSSnapshot)) { // See [Note: Python key removal]
|
||||
key_set_(
|
||||
key_set.remove(DispatchKey::Python)
|
||||
.remove(DispatchKey::PythonTLSSnapshot)) { // See [Note: Python
|
||||
// key removal]
|
||||
init_bitfields();
|
||||
// Inference tensor doesn't have version counter.
|
||||
if (!is_inference()) {
|
||||
|
|
@ -196,7 +197,9 @@ TensorImpl::TensorImpl(
|
|||
key_set = key_set | getAutocastRelatedKeySetFromBackend(k);
|
||||
|
||||
key_set =
|
||||
key_set.remove(DispatchKey::Python).remove(DispatchKey::PythonTLSSnapshot); // See [Note: Python key removal]
|
||||
key_set.remove(DispatchKey::Python)
|
||||
.remove(
|
||||
DispatchKey::PythonTLSSnapshot); // See [Note: Python key removal]
|
||||
|
||||
// Inference tensor doesn't have autograd related keys.
|
||||
if (inference_mode) {
|
||||
|
|
@ -554,7 +557,8 @@ void TensorImpl::copy_tensor_metadata_except_version_counter(
|
|||
dest_impl->storage_offset_ = src_impl->storage_offset_;
|
||||
dest_impl->data_type_ = src_impl->data_type_;
|
||||
dest_impl->device_opt_ = src_impl->device_opt_;
|
||||
dest_impl->key_set_ = src_impl->key_set_.remove(DispatchKey::Python).remove(DispatchKey::PythonTLSSnapshot);
|
||||
dest_impl->key_set_ = src_impl->key_set_.remove(DispatchKey::Python)
|
||||
.remove(DispatchKey::PythonTLSSnapshot);
|
||||
dest_impl->is_contiguous_ = src_impl->is_contiguous_;
|
||||
dest_impl->has_contiguity_ = src_impl->has_contiguity_;
|
||||
dest_impl->is_channels_last_contiguous_ =
|
||||
|
|
|
|||
|
|
@ -1476,9 +1476,11 @@ struct C10_API TensorImpl : public c10::intrusive_ptr_target {
|
|||
|
||||
void set_python_dispatch(bool k) {
|
||||
if (k) {
|
||||
key_set_ = key_set_.add(DispatchKey::Python).add(DispatchKey::PythonTLSSnapshot);
|
||||
key_set_ =
|
||||
key_set_.add(DispatchKey::Python).add(DispatchKey::PythonTLSSnapshot);
|
||||
} else {
|
||||
key_set_ = key_set_.remove(DispatchKey::Python).remove(DispatchKey::PythonTLSSnapshot);
|
||||
key_set_ = key_set_.remove(DispatchKey::Python)
|
||||
.remove(DispatchKey::PythonTLSSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ class C10_API ExcludeDispatchKeyGuard {
|
|||
|
||||
struct C10_API ForceDispatchKeyGuard {
|
||||
public:
|
||||
ForceDispatchKeyGuard(c10::impl::LocalDispatchKeySet key_set) :
|
||||
saved_keyset_(c10::impl::tls_local_dispatch_key_set()) {
|
||||
ForceDispatchKeyGuard(c10::impl::LocalDispatchKeySet key_set)
|
||||
: saved_keyset_(c10::impl::tls_local_dispatch_key_set()) {
|
||||
c10::impl::_force_tls_local_dispatch_key_set(key_set);
|
||||
}
|
||||
~ForceDispatchKeyGuard() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include <torch/csrc/jit/runtime/graph_executor_impl.h>
|
||||
#include <torch/csrc/jit/api/module.h>
|
||||
#include <torch/csrc/jit/runtime/graph_executor_impl.h>
|
||||
|
||||
namespace torch {
|
||||
namespace jit {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user