/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
ATen
/
/usr/local/lib64/python3.6/site-packages/torch/include/ATen
mkdir
upload
Name
Size
Mode
Actions
core/
-
0755
rm
cpu/
-
0755
rm
cuda/
-
0755
rm
cudnn/
-
0755
rm
detail/
-
0755
rm
hip/
-
0755
rm
native/
-
0755
rm
quantized/
-
0755
rm
AccumulateType.h
4438
0644
edit
dl
rm
ArrayRef.h
44
0644
edit
dl
rm
ATen.h
998
0644
edit
dl
rm
autocast_mode.h
6716
0644
edit
dl
rm
Backend.h
43
0644
edit
dl
rm
Backtrace.h
46
0644
edit
dl
rm
BatchedFallback.h
965
0644
edit
dl
rm
BatchedTensorImpl.h
5383
0644
edit
dl
rm
CompositeExplicitAutogradFunctions.h
1622
0644
edit
dl
rm
CompositeExplicitAutogradFunctions_inl.h
54075
0644
edit
dl
rm
CompositeImplicitAutogradFunctions.h
1622
0644
edit
dl
rm
CompositeImplicitAutogradFunctions_inl.h
142082
0644
edit
dl
rm
Config.h
734
0644
edit
dl
rm
Context.h
12767
0644
edit
dl
rm
cpp_custom_type_hack.h
5326
0644
edit
dl
rm
CPUApplyUtils.h
12582
0644
edit
dl
rm
CPUFixedAllocator.h
830
0644
edit
dl
rm
CPUFunctions.h
1600
0644
edit
dl
rm
CPUFunctions_inl.h
171924
0644
edit
dl
rm
CPUGeneratorImpl.h
1431
0644
edit
dl
rm
CUDAFunctions.h
1601
0644
edit
dl
rm
CUDAFunctions_inl.h
185696
0644
edit
dl
rm
CUDAGeneratorImpl.h
4695
0644
edit
dl
rm
Device.h
42
0644
edit
dl
rm
DeviceGuard.h
1134
0644
edit
dl
rm
Dimname.h
31
0644
edit
dl
rm
DimVector.h
46
0644
edit
dl
rm
Dispatch.h
52137
0644
edit
dl
rm
div_rtn.h
204
0644
edit
dl
rm
DLConvertor.h
576
0644
edit
dl
rm
dlpack.h
5244
0644
edit
dl
rm
DynamicLibrary.h
369
0644
edit
dl
rm
ExpandUtils.h
14506
0644
edit
dl
rm
Formatting.h
34
0644
edit
dl
rm
Functions.h
846326
0644
edit
dl
rm
Generator.h
46
0644
edit
dl
rm
InferSize.h
2143
0644
edit
dl
rm
InitialTensorOptions.h
445
0644
edit
dl
rm
Layout.h
42
0644
edit
dl
rm
MapAllocator.h
2999
0644
edit
dl
rm
MatrixRef.h
3016
0644
edit
dl
rm
MemoryOverlap.h
1117
0644
edit
dl
rm
MetaFunctions.h
1601
0644
edit
dl
rm
MetaFunctions_inl.h
84006
0644
edit
dl
rm
NamedTensor.h
35
0644
edit
dl
rm
NamedTensorUtils.h
5747
0644
edit
dl
rm
NativeFunctions.h
354651
0644
edit
dl
rm
NativeMetaFunctions.h
35445
0644
edit
dl
rm
NumericUtils.h
2787
0644
edit
dl
rm
OpaqueTensorImpl.h
6080
0644
edit
dl
rm
Operators.h
1707199
0644
edit
dl
rm
OpMathType.h
460
0644
edit
dl
rm
Parallel.h
4875
0644
edit
dl
rm
ParallelNative.h
2443
0644
edit
dl
rm
ParallelNativeTBB.h
2934
0644
edit
dl
rm
ParallelOpenMP.h
3049
0644
edit
dl
rm
PTThreadPool.h
394
0644
edit
dl
rm
record_function.h
24044
0644
edit
dl
rm
RedispatchFunctions.h
1112886
0644
edit
dl
rm
RegistrationDeclarations.h
545777
0644
edit
dl
rm
SavedTensorHooks.h
328
0644
edit
dl
rm
Scalar.h
44
0644
edit
dl
rm
ScalarOps.h
2272
0644
edit
dl
rm
ScalarType.h
129
0644
edit
dl
rm
SequenceNumber.h
373
0644
edit
dl
rm
SmallVector.h
47
0644
edit
dl
rm
SparseCsrTensorImpl.h
2045
0644
edit
dl
rm
SparseCsrTensorUtils.h
523
0644
edit
dl
rm
SparseTensorImpl.h
12417
0644
edit
dl
rm
SparseTensorUtils.h
4219
0644
edit
dl
rm
Storage.h
43
0644
edit
dl
rm
Tensor.h
48
0644
edit
dl
rm
TensorAccessor.h
51
0644
edit
dl
rm
TensorGeometry.h
1855
0644
edit
dl
rm
TensorIndexing.h
21923
0644
edit
dl
rm
TensorIterator.h
29962
0644
edit
dl
rm
TensorIteratorInternal.h
1862
0644
edit
dl
rm
TensorMeta.h
2917
0644
edit
dl
rm
TensorNames.h
2519
0644
edit
dl
rm
TensorOperators.h
3275
0644
edit
dl
rm
TensorOptions.h
49
0644
edit
dl
rm
TensorUtils.h
5687
0644
edit
dl
rm
ThreadLocalState.h
3289
0644
edit
dl
rm
TracerMode.h
5576
0644
edit
dl
rm
TypeDefault.h
680
0644
edit
dl
rm
Utils.h
5993
0644
edit
dl
rm
Version.h
340
0644
edit
dl
rm
VmapMode.h
952
0644
edit
dl
rm
VmapTransforms.h
7654
0644
edit
dl
rm
WrapDimUtils.h
3438
0644
edit
dl
rm
WrapDimUtilsMulti.h
768
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/TracerMode.h
(5576B)
#pragma once #include <c10/core/impl/LocalDispatchKeySet.h> #include <c10/macros/Macros.h> #include <torch/csrc/WindowsTorchApiMacro.h> // NOTE [Tracing Mode Switches] // // Historically, tracing function was controlled by two switches: // // - `AutoDispatchBelowADInplaceOrView` guard // // Tracing function used to be script-generated inside `VariableType_*.cpp` // kernels, sharing the same `Autograd` dispatch key with autograd function. // Therefore, before tracing function was moved out of VariableType, // `AutoDispatchBelowADInplaceOrView` guard can also disable tracing as a side effect // of disabling `Autograd` dispatching. // // - `setTracingState()` API in `torch/csrc/jit/frontend/tracer.h` // // It stores tracing data in a `TracingState` object in TLS. If the // `TracingState` object in TLS is `null`, then tracing is paused. // // The `TracingState` object is created in `tracer::trace()` - the main // entrance of tracing function. It's temporarily set to `null` inside // generated VariableType (now TraceType) to bypass tracing for intermediate // ops (ops being called by other ops). After the intermediate op call // finishes it's set back to the original `TracingState` object. // // The `TracingState` obect in TLS can also be read/written via its Python // binding in `python_tracer.cpp`, and `get/setTracingState()` C++ APIs, // which are also exposed as `TORCH_API`. // // Two new switches were introduced since tracing function was moved out of // VariableType: // // - `tracer::impl::set_dispatch_enabled()` API // // Unlike the special `Autograd` dispatch key which is included in dispatch // key set by default, `Tracer` dispatch key is off by default. The // dispatching switch can be toggled via this new API. // // - `tracer::impl::NoTracerDispatchMode` guard // // It's used to cover the old semantics of `AutoDispatchBelowADInplaceOrView` after // tracing was moved out of VariableType. // // Before tracing function was moved out of VariableType, tracing was enabled // when the following conditions are satisfied: // // 1) `TracingState` object in TLS != null; // - Either inside the execution scope of `tracer::trace()`, or // - Eagerly called `setTracingState()` with non-null object. // 2) Not inside `AutoDispatchBelowADInplaceOrView` scope; // // After: // // 1) `TracingState` object in TLS != null; // 2) Has called `tracer::impl::set_dispatch_enabled(true)`; // 3) Not inside `tracer::impl::NonDispatchGuard` scope; // // [TODOs] // // - `setTracingState()` v.s. `tracer::impl::set_dispatch_enabled()` // // Currently `set_dispatch_enabled()` is set/unset inside `setTracingState()` // to keep the semantics exactly the same as before - it's confusing to keep // both switches, though. We should consider simplifying/limiting the exposed // `setTracingState()` Python/C++ APIs (and other APIs calling it) so that // these two can be unified. // // - `AutoDispatchBelowADInplaceOrView` v.s. `tracer::impl::NoTracerDispatchMode` // // We don't need to always set both guards together to keep semantics // unchanged. For the follow use cases of `AutoDispatchBelowADInplaceOrView` we don't // need set the new tracer guard: // // * Script-generated VariableType kernels. The guard is not necessary as // tracing is already disabled explicitly by `setTracingState(null)` in // generated TraceType kernels - we could keep it as is or use the new guard // instead. // // * Custom ops. Will be handled by fallback kernel for `Tracer`. // // * Functions that are not likely to be called in tracing context (no python // binding / not an operator), e.g.: all mobile forward() wrappers, test // binaries, and etc. // // * Where new threads are spawned, e.g.: ATen/native/ConvolutionMM2d.cpp. // It's not necessary as tracing is off by default. // // For the rest of cases we might need have both: // // * Functions that might be reachable from eager mode python (especially // factory methods), e.g.: // `internal_new_from_data()` in `torch/csrc/utils/tensor_new.cpp`. // Without the new guard it will add `aten::empty` to the traced graph. // // * Some manually maintained functions, e.g.: // `torch/csrc/autograd/VariableTypeManual.cpp`. // Set the new guard if it's not obvious whether `setTracingState(null)` // has been called before it reaches the `AutoDispatchBelowADInplaceOrView` guard. // // We might need tweak the usage of the new guard to optimize/fix things. // It should only affect the correctness of tracing function, because the // guard is essentially no-op when the master `setTracingState()` switch is // off. namespace at { // TODO: move this from `at::` to `jit::torch::` after // `aten/src/ATen/cpp_custom_type_hack.h` is removed. namespace tracer { namespace impl { static inline bool is_dispatch_enabled() { return c10::impl::tls_is_dispatch_key_included(at::DispatchKey::Tracer) && !c10::impl::tls_is_dispatch_key_excluded(at::DispatchKey::Tracer); } static inline void set_dispatch_enabled(bool enabled) { TORCH_INTERNAL_ASSERT( !c10::impl::tls_is_dispatch_key_excluded(at::DispatchKey::Tracer), "Cannot enable tracing within the scope of NoTracerDispatchMode!"); c10::impl::tls_set_dispatch_key_included(at::DispatchKey::Tracer, enabled); } struct NoTracerDispatchMode { c10::impl::ExcludeDispatchKeyGuard guard_{at::DispatchKey::Tracer}; }; } // namespace impl } // namespace tracer } // namespace at
Save
cmd:
run