repo
stringlengths
1
152
file
stringlengths
14
221
code
stringlengths
501
25k
file_length
int64
501
25k
avg_line_length
float64
20
99.5
max_line_length
int64
21
134
extension_type
stringclasses
2 values
null
pytorch-main/aten/src/ATen/autocast_mode.h
#pragma once #include <ATen/ATen.h> #include <ATen/NativeFunctions.h> #include <ATen/Operators.h> #include <torch/library.h> #include <c10/core/impl/LocalDispatchKeySet.h> #include <c10/util/intrusive_ptr.h> namespace at { namespace autocast { TORCH_API bool is_enabled(); TORCH_API void set_enabled(bool enabled); T...
24,267
36.392912
117
h
null
pytorch-main/aten/src/ATen/code_template.h
#pragma once #include <c10/util/irange.h> #include <sstream> #include <string> #include <unordered_map> #include <vector> namespace at { namespace jit { // A template environment is a mapping from template variable names, e.g., // identifier (corresponding to $identifier) to their expansions. // // This template en...
6,928
27.052632
80
h
null
pytorch-main/aten/src/ATen/cpp_custom_type_hack.h
// STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP // STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP // STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP // STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP // STOP ...
5,455
47.283186
87
h
null
pytorch-main/aten/src/ATen/dlpack.h
/*! * Copyright (c) 2017 by Contributors * \file dlpack.h * \brief The common header of DLPack. */ #ifndef DLPACK_DLPACK_H_ #define DLPACK_DLPACK_H_ /** * \brief Compatibility with C++ */ #ifdef __cplusplus #define DLPACK_EXTERN_C extern "C" #else #define DLPACK_EXTERN_C #endif /*! \brief The current version o...
6,833
28.205128
80
h
null
pytorch-main/aten/src/ATen/jiterator_macros.h
#pragma once #include <c10/macros/Macros.h> #include <string> #define JITERATOR_HOST_DEVICE C10_HOST_DEVICE #if defined(_MSC_VER) && defined(__CUDACC__) // NVRTC on Windows errors if __host__ __device__ attribute is // present on kernel. // error: attribute "__host__" does not apply here // error: attribute "__device_...
1,506
37.641026
80
h
null
pytorch-main/aten/src/ATen/record_function.h
#pragma once #include <ATen/core/ivalue.h> #include <ATen/core/operator_name.h> #include <c10/macros/Export.h> #include <c10/util/Optional.h> #include <c10/util/SmallVector.h> #include <c10/util/variant.h> #include <array> #include <atomic> #include <functional> #include <memory> namespace c10 { class TORCH_API Oper...
22,083
29.252055
80
h
null
pytorch-main/aten/src/ATen/core/ATen_fwd.h
#pragma once #include <c10/core/QScheme.h> // Forward declarations of core ATen types used in dispatch functions namespace c10 { template<typename T> class optional; template<typename T> class List; template<typename T> class IListRef; class Stream; class Scalar; class SymInt; class SymIntList; struct Storage; struct...
1,061
20.673469
69
h
null
pytorch-main/aten/src/ATen/core/ATen_pch.h
// This global header must not depend on native_functions.yaml or // incremental builds will be next to useless #pragma push_macro("TORCH_ASSERT_NO_OPERATORS") #define TORCH_ASSERT_NO_OPERATORS // This macro doesn't work if defined after the first time inttypes.h // is included, so won't work anywhere if not defined h...
5,407
29.727273
118
h
null
pytorch-main/aten/src/ATen/core/CheckMemoryFormat.h
#include <c10/core/TensorOptions.h> namespace c10 { namespace impl { inline c10::optional<MemoryFormat> check_tensor_options_and_extract_memory_format( const TensorOptions& options, c10::optional<MemoryFormat> memory_format) { TORCH_CHECK( options.requires_grad_opt() == c10::nullopt || options.r...
864
32.269231
92
h
null
pytorch-main/aten/src/ATen/core/DeprecatedTypeProperties.h
#pragma once #include <c10/core/Backend.h> #include <c10/core/ScalarType.h> #include <c10/core/Layout.h> #include <c10/core/TensorOptions.h> #include <c10/core/Storage.h> #include <ATen/core/DeprecatedTypePropertiesRegistry.h> #include <ATen/core/Generator.h> namespace at { class Tensor; // This class specifies a ...
3,778
26.786765
101
h
null
pytorch-main/aten/src/ATen/core/DeprecatedTypePropertiesRegistry.h
#pragma once // In order to preserve bc, we make DeprecatedTypeProperties instances unique // just like they are for Type. #include <c10/core/Backend.h> #include <c10/core/ScalarType.h> namespace at { class DeprecatedTypeProperties; struct TORCH_API DeprecatedTypePropertiesDeleter { void operator()(DeprecatedTyp...
795
23.875
87
h
null
pytorch-main/aten/src/ATen/core/Dimname.h
#pragma once #include <ATen/core/symbol.h> #include <c10/util/ArrayRef.h> #include <c10/util/Optional.h> #include <ostream> namespace at { enum class NameType: uint8_t { BASIC, WILDCARD }; struct TORCH_API Dimname { static Dimname fromSymbol(Symbol name); static Dimname wildcard(); static bool isValidName(con...
1,178
23.061224
78
h
null
pytorch-main/aten/src/ATen/core/DistributionsHelper.h
#pragma once #include <ATen/core/Array.h> #include <ATen/core/TransformationHelper.h> #include <c10/util/Half.h> #include <c10/util/BFloat16.h> #include <c10/util/MathConstants.h> #include <c10/util/Optional.h> #include <c10/macros/Macros.h> #include <type_traits> #include <limits> #include <cmath> /** * Distributi...
12,578
36.215976
119
h
null
pytorch-main/aten/src/ATen/core/Formatting.h
#pragma once #include <ostream> #include <string> #include <c10/core/Scalar.h> #include <ATen/core/Tensor.h> namespace c10 { TORCH_API std::ostream& operator<<(std::ostream& out, Backend b); TORCH_API std::ostream& operator<<(std::ostream & out, const Scalar& s); TORCH_API std::string toString(const Scalar& s); } na...
700
25.961538
89
h
null
pytorch-main/aten/src/ATen/core/GeneratorForPrivateuseone.h
#pragma once #include <ATen/core/Generator.h> #include <c10/util/intrusive_ptr.h> namespace at { using GeneratorFuncType = std::function<at::Generator(c10::DeviceIndex)>; c10::optional<GeneratorFuncType>& GetGeneratorPrivate(); class TORCH_API _GeneratorRegister { public: explicit _GeneratorRegister(GeneratorFu...
1,064
25.625
80
h
null
pytorch-main/aten/src/ATen/core/IListRef.h
#pragma once #include <ATen/core/ivalue_to.h> #include <c10/util/ArrayRef.h> #include <c10/util/Exception.h> #include <functional> #include <initializer_list> #include <iterator> #include <type_traits> /* * [Note: IListRef] * Wrapper around different API containers (e.g. boxed and unboxed). * * What is it? * ==...
20,992
32.164297
95
h
null
pytorch-main/aten/src/ATen/core/IListRef_inl.h
#pragma once #include <ATen/core/List.h> #include <ATen/core/Tensor.h> namespace at { class Tensor; class OptionalTensorRef; } namespace c10 { namespace detail { /* * Specializations of `IListRefTagImplBase` that implement the default * implementation for `IListRefTag::Unboxed`. */ template <typename T, typename...
6,127
29.336634
99
h
null
pytorch-main/aten/src/ATen/core/LegacyTypeDispatch.h
#pragma once // The legacy mechanism for dispatching operators in ATen is a Type // object, which is essentially a giant virtual dispatch table // for every operation we support dynamically dispatching over. // // This has been deprecated in favor of ATenDispatch, and in the future, // c10 dispatcher. // TODO: Clean u...
4,857
42.375
103
h
null
pytorch-main/aten/src/ATen/core/MT19937RNGEngine.h
#pragma once #include <c10/util/irange.h> // define constants like M_PI and C keywords for MSVC #ifdef _MSC_VER #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #include <math.h> #endif #include <array> #include <cmath> #include <cstdint> namespace at { constexpr int MERSENNE_STATE_N = 624; constexpr int...
6,458
31.954082
94
h
null
pytorch-main/aten/src/ATen/core/NamedTensor.h
#pragma once #include <ATen/core/Dimname.h> #include <c10/core/TensorImpl.h> #include <c10/util/C++17.h> namespace at { class TensorBase; // XXX: This file exists because TensorImpl is in c10, but Dimname is in ATen. // Due to the c10/ATen library split, TensorImpl cannot depend on Dimname, // so we have a couple o...
5,050
34.822695
132
h
null
pytorch-main/aten/src/ATen/core/PythonOpRegistrationTrampoline.h
#pragma once #include <ATen/core/dispatch/Dispatcher.h> // TODO: this can probably live in c10 namespace at { namespace impl { class TORCH_API PythonOpRegistrationTrampoline final { static std::atomic<c10::impl::PyInterpreter*> interpreter_; public: // Returns true if you successfully registered yourself (tha...
501
22.904762
70
h
null
pytorch-main/aten/src/ATen/core/QuantizerBase.h
#pragma once #include <c10/core/ScalarType.h> #include <c10/core/QScheme.h> #include <c10/util/intrusive_ptr.h> namespace at { class Tensor; struct QTensorImpl; struct Quantizer; using ConstQuantizerPtr = const c10::intrusive_ptr<Quantizer>&; using QuantizerPtr = c10::intrusive_ptr<Quantizer>; /** * Quantizer is t...
2,606
30.035714
80
h
null
pytorch-main/aten/src/ATen/core/Tensor.h
#pragma once #include <ATen/core/TensorBody.h> #include <c10/util/Exception.h> namespace at { class TORCH_API OptionalTensorRef { public: OptionalTensorRef() = default; ~OptionalTensorRef() { ref_.unsafeReleaseTensorImpl(); } OptionalTensorRef(const TensorBase& src) : ref_(Tensor::unsafe_borrow_t...
1,756
22.426667
81
h
null
pytorch-main/aten/src/ATen/core/TensorAccessor.h
#pragma once #include <c10/macros/Macros.h> #include <c10/util/ArrayRef.h> #include <c10/util/Deprecated.h> #include <c10/util/Exception.h> #include <c10/util/irange.h> #include <stdint.h> #include <cstddef> namespace at { // The PtrTraits argument to the TensorAccessor/GenericPackedTensorAccessor // is used to enab...
10,373
37
122
h
null
pytorch-main/aten/src/ATen/core/TransformationHelper.h
#include <c10/macros/Macros.h> #include <c10/util/Half.h> #include <c10/util/BFloat16.h> #include <c10/util/MathConstants.h> #include <ATen/NumericUtils.h> #include <limits> #include <cstdint> #include <cassert> namespace at { // Using DistAccumType in accumulate types for distributions. // Note: Ideally we'd be usin...
6,855
38.402299
122
h
null
pytorch-main/aten/src/ATen/core/UnsafeFromTH.h
#pragma once #include <ATen/core/Tensor.h> namespace at { inline Tensor unsafeTensorFromTH(void * th_pointer, bool retain) { auto tensor_impl = c10::intrusive_ptr<TensorImpl, UndefinedTensorImpl>::reclaim(static_cast<TensorImpl*>(th_pointer)); if (retain && tensor_impl.get() != UndefinedTensorImpl::singleton()) {...
708
31.227273
120
h
null
pytorch-main/aten/src/ATen/core/Variadic.h
#pragma once #include <cstdint> #include <tuple> #include <type_traits> #include <utility> #include <c10/util/ArrayRef.h> #include <ATen/core/List.h> namespace at { // This class allows you to write variadic functions which // call a (possibly overloaded) function on each argument, // in order. This is most common...
2,439
24.416667
71
h
null
pytorch-main/aten/src/ATen/core/Vitals.h
#pragma once #include <cstring> #include <map> #include <memory> #include <ostream> #include <sstream> #include <unordered_map> #include <c10/core/impl/LocalDispatchKeySet.h> namespace at { namespace vitals { TORCH_API bool torchVitalEnabled(); struct TORCH_API TorchVitalAttr { // always initialized to empty st...
2,305
23.273684
74
h
null
pytorch-main/aten/src/ATen/core/alias_info.h
#pragma once #include <unordered_set> #include <vector> #include <ATen/core/symbol.h> #include <c10/util/Exception.h> #include <c10/util/hash.h> namespace c10 { /** * class AliasInfo * * Data structure to hold aliasing information for an `Argument`. They can be * nested to represent aliasing information on contain...
4,160
26.375
80
h
null
pytorch-main/aten/src/ATen/core/blob.h
#pragma once #include <cstddef> #include <sstream> #include <type_traits> #include <typeinfo> #include <vector> #include <c10/util/intrusive_ptr.h> #include <c10/util/typeid.h> #include <c10/macros/Macros.h> namespace caffe2 { class Tensor; /** * @brief Blob is a general container that hosts a typed pointer. * ...
5,441
24.914286
80
h
null
pytorch-main/aten/src/ATen/core/builtin_function.h
#pragma once #include <ATen/core/function.h> #include <ATen/core/ivalue.h> #include <c10/util/Exception.h> #include <c10/util/intrusive_ptr.h> #include <functional> #include <utility> namespace torch { namespace jit { struct BuiltinOpFunction : public Function { BuiltinOpFunction( c10::QualifiedName qualname...
2,044
21.977528
97
h
null
pytorch-main/aten/src/ATen/core/custom_class.h
#pragma once #include <typeindex> #include <memory> #include <c10/macros/Export.h> #include <c10/macros/Macros.h> #include <c10/util/Exception.h> namespace c10 { struct ClassType; using ClassTypePtr = std::shared_ptr<ClassType>; TORCH_API c10::ClassTypePtr getCustomClassTypeImpl(const std::type_index &tindex); te...
744
24.689655
82
h
null
pytorch-main/aten/src/ATen/core/dynamic_type.h
#pragma once #include <memory> #include <type_traits> #include <ATen/core/jit_type_base.h> #include <c10/util/Optional.h> namespace c10 { using DynamicTypeBits = std::uint32_t; #define DYNAMIC_TYPE_BIT(x) (1u << x) constexpr DynamicTypeBits kDynamicCovariantTypeBit = DYNAMIC_TYPE_BIT(31); constexpr DynamicTypeBits...
10,388
42.468619
80
h
null
pytorch-main/aten/src/ATen/core/enum_type.h
#pragma once #include <ATen/core/ivalue.h> #include <utility> namespace c10 { struct EnumType; using EnumTypePtr = std::shared_ptr<EnumType>; using EnumNameValue = std::pair<std::string, IValue>; struct TORCH_API EnumType : public NamedType { friend struct Type; static const TypeKind Kind = TypeKind::EnumType; ...
2,801
26.203883
77
h
null
pytorch-main/aten/src/ATen/core/function.h
#pragma once #include <ATen/core/function_schema.h> #include <ATen/core/ivalue.h> #include <ATen/core/qualified_name.h> #include <c10/util/Exception.h> #include <c10/util/FunctionRef.h> namespace c10 { struct FunctionSchema; }; namespace at { TORCH_API void launch(std::function<void()> func); } namespace torch { na...
3,232
28.935185
92
h
null
pytorch-main/aten/src/ATen/core/function_schema.h
#pragma once #include <c10/util/StringUtil.h> #include <c10/util/string_view.h> #include <c10/util/irange.h> #include <ATen/core/jit_type.h> #include <ATen/core/symbol.h> #include <ATen/core/ivalue.h> #include <ATen/core/alias_info.h> #include <ATen/core/operator_name.h> #include <ATen/core/dispatch/OperatorOptions.h>...
23,899
33.788937
133
h
null
pytorch-main/aten/src/ATen/core/function_schema_inl.h
#pragma once #include <iostream> // note: windows build doesn't find symbols in operator files unless // this is a header file namespace c10 { inline std::ostream& operator<<(std::ostream& out, const FunctionSchema& schema) { // eventually this should look almost identical to python arg parser, but // it is simp...
14,970
29.995859
125
h
null
pytorch-main/aten/src/ATen/core/functional.h
#pragma once #include <vector> #include <c10/util/ArrayRef.h> namespace c10 { // The passed in function must take T by value (T), or by // const reference (const T&); taking T by non-const reference // will result in an error like: // // error: no type named 'type' in 'class std::result_of<foobar::__lambda(T)>' /...
1,460
25.563636
94
h
null
pytorch-main/aten/src/ATen/core/interned_strings.h
#pragma once #include <vector> #include <cstdint> #include <string> #include <unordered_map> #include <algorithm> #include <c10/macros/Macros.h> #include <ATen/core/aten_interned_strings.h> #include <ATen/core/symbol.h> namespace c10 { #define FORALL_NS_SYMBOLS(_) \ _(namespaces, prim) \ ...
13,391
36.407821
78
h
null
pytorch-main/aten/src/ATen/core/interned_strings_class.h
#include <cstdint> #include <cstring> #include <mutex> #include <string> #include <unordered_map> #include <vector> #include <ATen/core/symbol.h> #include <c10/util/Exception.h> namespace c10 { struct TORCH_API InternedStrings { InternedStrings(); Symbol symbol(const std::string& s); std::pair<const char*, cons...
760
20.742857
63
h
null
pytorch-main/aten/src/ATen/core/operator_name.h
#pragma once #include <c10/macros/Macros.h> #include <c10/util/Exception.h> #include <c10/util/Optional.h> #include <c10/util/string_view.h> #include <string> #include <utility> #include <ostream> namespace c10 { // TODO: consider storing namespace separately too struct OperatorName final { std::string name; std...
3,018
31.462366
94
h
null
pytorch-main/aten/src/ATen/core/qualified_name.h
#pragma once #include <c10/util/ArrayRef.h> #include <c10/util/Exception.h> #include <c10/util/StringUtil.h> #include <c10/util/irange.h> #include <string> namespace c10 { // Represents a name of the form "foo.bar.baz" struct QualifiedName { QualifiedName() = default; // `name` can be a dotted string, like "foo...
4,373
26
85
h
null
pytorch-main/aten/src/ATen/core/rref_interface.h
#pragma once #include <c10/util/intrusive_ptr.h> #include <ATen/core/type_ptr.h> namespace c10 { struct Type; using worker_id_t = int16_t; // This abstract class contains only user-facing APIs, and will be shared // between jit and distributed to implement TorchScript support. class C10_EXPORT RRefInterface : publi...
1,138
26.780488
78
h
null
pytorch-main/aten/src/ATen/core/stack.h
#pragma once #include <type_traits> #include <ATen/core/ivalue.h> #include <c10/util/Deprecated.h> #include <c10/util/irange.h> // TODO move this to c10 namespace namespace torch { namespace jit { using c10::IValue; using Stack = std::vector<IValue>; class Operation { template <typename F, typename Arg> using...
6,076
29.233831
87
h
null
pytorch-main/aten/src/ATen/core/symbol.h
#pragma once #include <c10/macros/Export.h> #include <cstdint> #include <functional> // For std::hash #include <string> namespace c10 { // 'prim' symbols are synthetic operators that occur only in the IR // and don't have corresponding implementations in ATen. // 'onnx' symbols correspond to ONNX operators. Their...
5,874
38.695946
104
h
null
pytorch-main/aten/src/ATen/core/type_factory.h
#pragma once #include <type_traits> #include <unordered_map> #include <ATen/core/dynamic_type.h> #include <ATen/core/jit_type_base.h> #include <c10/macros/Macros.h> namespace c10 { template <typename T> struct TORCH_API TypeFactoryBase {}; template <> struct TORCH_API TypeFactoryBase<c10::DynamicType> { template...
3,245
28.779817
80
h
null
pytorch-main/aten/src/ATen/core/type_ptr.h
#pragma once #include <memory> #include <type_traits> #include <c10/util/Exception.h> #include <c10/util/MaybeOwned.h> namespace c10 { // Compatibility wrapper around a raw pointer so that existing code // written to deal with a shared_ptr can keep working. template <typename T> class SingletonTypePtr { public: ...
1,223
21.254545
110
h
null
pytorch-main/aten/src/ATen/core/boxing/BoxedKernel.h
#pragma once #include <ATen/core/boxing/OperatorKernel.h> #include <c10/core/DispatchKeySet.h> #include <c10/util/intrusive_ptr.h> namespace c10 { struct IValue; using Stack = std::vector<IValue>; class OperatorHandle; class KernelFunction; // This kernel implements the behavior of falling through to the next avai...
7,924
43.774011
124
h
null
pytorch-main/aten/src/ATen/core/boxing/OperatorKernel.h
#pragma once #include <c10/util/intrusive_ptr.h> namespace c10 { /** * Inherit from OperatorKernel to implement a c10 kernel. * * Example: * > namespace { * > class my_kernel_cpu final : public c10::OperatorKernel { * > public: * > Tensor operator()(Tensor a, Tensor b) {...} * > }; * > } * * The ...
692
23.75
71
h
null
pytorch-main/aten/src/ATen/core/boxing/impl/test_helpers.h
#pragma once #include <gtest/gtest.h> #include <gmock/gmock.h> #include <ATen/core/Tensor.h> #include <ATen/core/dispatch/Dispatcher.h> #include <ATen/core/ivalue.h> #include <c10/core/CPUAllocator.h> #include <c10/util/irange.h> template<class... Inputs> inline std::vector<c10::IValue> makeStack(Inputs&&... inputs)...
4,296
33.376
127
h
null
pytorch-main/aten/src/ATen/core/dispatch/CppSignature.h
#pragma once #include <typeindex> #include <c10/core/DispatchKeySet.h> #include <c10/macros/Macros.h> #include <c10/util/Metaprogramming.h> #include <c10/util/Type.h> namespace c10 { namespace impl { // A CppSignature object holds RTTI information about a C++ function signature at runtime // and can compare them or ...
2,455
36.212121
123
h
null
pytorch-main/aten/src/ATen/core/dispatch/DispatchKeyExtractor.h
#pragma once #include <cstdint> #include <ATen/core/function_schema.h> #include <ATen/core/jit_type.h> #include <c10/util/Bitset.h> #include <c10/core/DispatchKeySet.h> #include <c10/util/irange.h> #include <ATen/core/Variadic.h> #include <ATen/core/stack.h> namespace c10 { namespace impl { // Take a DispatchKeySet...
9,669
38.794239
116
h
null
pytorch-main/aten/src/ATen/core/dispatch/OperatorOptions.h
#pragma once #include <cstdint> namespace c10 { enum class AliasAnalysisKind : uint8_t { INTERNAL_SPECIAL_CASE, CONSERVATIVE, // The most conservative alias analysis type, assumes // side-effects. This is the default analysis. FROM_SCHEMA, PURE_FUNCTION }; #if !defined(_MSC_VER) constexpr //...
923
28.806452
88
h
null
pytorch-main/aten/src/ATen/core/dispatch/RegistrationHandleRAII.h
#pragma once #include <functional> namespace c10 { class RegistrationHandleRAII final { public: explicit RegistrationHandleRAII(std::function<void()> onDestruction) : onDestruction_(std::move(onDestruction)) {} ~RegistrationHandleRAII() { if (onDestruction_) { onDestruction_(); } } Regi...
858
22.216216
76
h
null
pytorch-main/aten/src/ATen/cpu/vml.h
#pragma once #include <ATen/Config.h> #include <ATen/Parallel.h> #include <ATen/OpMathType.h> #include <ATen/cpu/vec/functional.h> #include <ATen/cpu/vec/vec.h> #include <c10/util/complex.h> // This header implements various unary operations using a MKL VML style // interface. // It implements various functions with...
6,002
34.311765
82
h
null
pytorch-main/aten/src/ATen/cpu/vec/functional_base.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/vec.h> #include <c10/util/irange.h> namespace at { namespace vec { // slow path template <typename scalar_t, typename Op> inline scalar_t vec_reduce_all( const Op& vec_fun, vec...
11,772
34.675758
91
h
null
pytorch-main/aten/src/ATen/cpu/vec/functional_bfloat16.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/vec.h> namespace at { namespace vec { // BFloat16 specification template <typename scalar_t> struct VecScalarType { using type = scalar_t; }; template <> struct VecScalarType<BFloat16>...
24,270
43.946296
116
h
null
pytorch-main/aten/src/ATen/cpu/vec/intrinsics.h
#pragma once #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) /* GCC or clang-compatible compiler, targeting x86/x86-64 */ #include <x86intrin.h> #elif defined(__clang__) && (defined(__ARM_NEON__) || defined(__aarch64__)) /* Clang-compatible compiler, targeting arm neon */ #include <arm_neon.h> #elif...
1,880
41.75
98
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec.h
#pragma once #if defined(CPU_CAPABILITY_AVX512) #include <ATen/cpu/vec/vec512/vec512.h> #else #include <ATen/cpu/vec/vec256/vec256.h> #endif namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { inline Vectorized<bool> convert_to_bool(Vectorized<int8_t> x) { __at_a...
1,296
25.469388
81
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/missing_vld1_neon.h
/* Workaround for missing vld1_*_x2 and vst1_*_x2 intrinsics in gcc-7. */ __extension__ extern __inline uint8x8x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vld1_u8_x2 (const uint8_t *__a) { uint8x8x2_t ret; asm volatile("ld1 {%S0.8b - %T0.8b}, %1" : "=w" (ret) : "Q"(*__a)); return re...
13,559
28.933775
74
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vec256.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #if !(defined(__VSX__) || defined(CPU_CAPABILITY_VSX) || defined(CPU_CAPABILITY_ZVECTOR)) #include <ATen/cpu/vec/vec256/vec256_float.h>...
9,871
34.131673
105
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vec256_double.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <c10/util/irange.h> #if defined(CPU_CAPABILITY_AVX2) && !defined(_MSC_VER) #include <sleef.h> #endif namespace at { namespace v...
14,128
32.011682
124
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vec256_float.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <c10/util/irange.h> #if defined(CPU_CAPABILITY_AVX2) && !defined(_MSC_VER) #include <sleef.h> #endif namespace at { namespace v...
19,023
32.910873
120
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_bfloat16_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <ATen/cpu/vec/vec_base.h> #include <c10/util/irange.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { inline std::tuple<Vectorized<float>, Vectorized<fl...
1,608
27.22807
84
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_common_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> // Note: header order is important here #include <ATen/cpu/vec/vec256/vsx/vec256_double_vsx.h> #include <ATen/cpu/vec/vec256/vsx/vec256_float_vsx.h> #include <ATen/cpu/vec/vec256/vsx/v...
8,052
31.603239
87
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_complex_double_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <c10/util/complex.h> #include <c10/util/irange.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { using ComplexDbl = c10...
18,631
30.314286
99
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_complex_float_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <c10/util/complex.h> #include <c10/util/irange.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { using ComplexFlt = c1...
21,047
30.508982
99
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_double_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <c10/util/irange.h> #include <sleef.h> namespace at { namespace vec { inline namespace CPU_CAPABILITY { template <> class Vectorized<double> { private: union { stru...
13,709
31.956731
97
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_float_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <sleef.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { template <> class Vectorized<float> { private: union { ...
14,249
31.167043
93
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int16_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { template <> class Vectorized<int16_t> { private: union { struct { v...
11,902
32.529577
101
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int32_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { template <> class Vectorized<int32_t> { private: union { struct { v...
9,723
33.119298
101
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> namespace at { namespace vec { // See Note [CPU_CAPABILITY namespace] inline namespace CPU_CAPABILITY { template <> class Vectorized<int64_t> { private: union { struct { v...
7,922
32.43038
101
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_qint32_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <c10/util/qint32.h> #include <array> // This file defines Vectorized<> for the quantized types. // // // Currently, we simply use these classes as efficient converters between...
7,686
32.133621
84
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_qint8_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <c10/util/qint8.h> #include <array> // This file defines Vectorized<> for the quantized types. // // // Currently, we simply use these classes as efficient converters between ...
13,476
32.947103
90
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vec256_quint8_vsx.h
#pragma once #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec256/vsx/vsx_helpers.h> #include <c10/util/irange.h> #include <c10/util/quint8.h> #include <array> // This file defines Vectorized<> for the quantized types. // // // Currently, we simply use these classes a...
13,851
32.95098
92
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec256/vsx/vsx_helpers.h
#pragma once #include <cstdint> #include <c10/macros/Macros.h> #include <ATen/cpu/vec/intrinsics.h> using vbool8 = __attribute__((altivec(vector__))) __attribute__((altivec(bool__))) char; using vbool16 = __attribute__((altivec(vector__))) __attribute__((altivec(bool__))) short; using vbool32 = __attribute__((a...
19,060
40.984581
98
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec512/vec512.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <ATen/cpu/vec/vec512/vec512_float.h> #include <ATen/cpu/vec/vec512/vec512_bfloat16.h> #include <ATen/cpu/vec/vec512/vec512_doub...
9,257
35.448819
91
h
null
pytorch-main/aten/src/ATen/cpu/vec/vec512/vec512_double.h
#pragma once // DO NOT DEFINE STATIC DATA IN THIS HEADER! // See Note [Do not compile initializers with AVX] #include <ATen/cpu/vec/intrinsics.h> #include <ATen/cpu/vec/vec_base.h> #include <c10/util/irange.h> #if (defined(CPU_CAPABILITY_AVX512)) && !defined(_MSC_VER) #include <sleef.h> #endif namespace at { namespa...
16,618
34.81681
124
h
null
pytorch-main/aten/src/ATen/cuda/CUDAContext.h
#pragma once #include <cstdint> #include <cuda_runtime_api.h> #include <cusparse.h> #include <cublas_v2.h> #ifdef CUDART_VERSION #include <cusolverDn.h> #endif #if defined(USE_ROCM) && ROCM_VERSION >= 50300 #include <hipsolver/hipsolver.h> #endif #include <ATen/core/ATenGeneral.h> #include <ATen/Context.h> #includ...
2,469
27.068182
80
h
null
pytorch-main/aten/src/ATen/cuda/CUDADataType.h
#pragma once #include <c10/core/ScalarType.h> #include <cuda.h> #include <library_types.h> namespace at { namespace cuda { template <typename scalar_t> cudaDataType getCudaDataType() { TORCH_INTERNAL_ASSERT(false, "Cannot convert type ", typeid(scalar_t).name(), " to cudaDataType.") } template<> inline cudaDataT...
2,491
24.428571
100
h
null
pytorch-main/aten/src/ATen/cuda/CUDADevice.h
#pragma once #include <ATen/cuda/Exceptions.h> #include <cuda.h> #include <cuda_runtime.h> namespace at { namespace cuda { inline Device getDeviceFromPtr(void* ptr) { cudaPointerAttributes attr{}; AT_CUDA_CHECK(cudaPointerGetAttributes(&attr, ptr)); #if !defined(USE_ROCM) TORCH_CHECK(attr.type != cudaMemory...
544
20.8
96
h
null
pytorch-main/aten/src/ATen/cuda/CUDAEvent.h
#pragma once #include <ATen/cuda/ATenCUDAGeneral.h> #include <ATen/cuda/CUDAContext.h> #include <c10/core/impl/GPUTrace.h> #include <c10/cuda/CUDAStream.h> #include <c10/cuda/CUDAGuard.h> #include <ATen/cuda/Exceptions.h> #include <c10/util/Exception.h> #include <cuda_runtime_api.h> #include <cstdint> #include <util...
6,793
31.352381
90
h
null
pytorch-main/aten/src/ATen/cuda/CUDAGeneratorImpl.h
#pragma once #include <ATen/core/Generator.h> #include <ATen/cuda/detail/PhiloxCudaStateRaw.cuh> #include <ATen/Context.h> #include <limits> #include <atomic> namespace at { /** * Note [CUDA Graph-safe RNG states] * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Strategy: * ~~~~~~~~~ * (It helps to look at * cuda/detai...
4,885
33.652482
80
h
null
pytorch-main/aten/src/ATen/cuda/CUDAGraph.h
#pragma once #include <ATen/Tensor.h> #include <c10/core/Device.h> #include <c10/cuda/CUDAGraphsC10Utils.h> #include <c10/cuda/CUDAStream.h> namespace at { struct CUDAGeneratorImpl; namespace cuda { // Standalone way to get a unique mempool id usable as a pool=... argument // to CUDAGraph::capture_begin TORCH_CUDA...
2,568
30.716049
96
h
null
pytorch-main/aten/src/ATen/cuda/CUDASparseBlas.h
#pragma once /* Provides a subset of cuSPARSE functions as templates: csrgeam2<scalar_t>(...) where scalar_t is double, float, c10::complex<double> or c10::complex<float>. The functions are available in at::cuda::sparse namespace. */ #include <ATen/cuda/CUDAContext.h> #include <ATen/cuda/CUDASparse.h> na...
12,753
38.486068
80
h
null
pytorch-main/aten/src/ATen/cuda/CUDASparseDescriptors.h
#pragma once #include <ATen/Tensor.h> #include <ATen/cuda/CUDAContext.h> #include <ATen/cuda/CUDASparse.h> #include <c10/core/ScalarType.h> #if defined(USE_ROCM) #include <type_traits> #endif namespace at { namespace cuda { namespace sparse { template <typename T, cusparseStatus_t (*destructor)(T*)> struct CuSpars...
8,265
29.958801
113
h
null
pytorch-main/aten/src/ATen/cuda/CachingHostAllocator.h
#pragma once #include <c10/core/Allocator.h> #include <c10/cuda/CUDAStream.h> namespace at { namespace cuda { // // A caching allocator for CUDA host allocations (pinned memory). // // This provides a drop-in replacement for THCudaHostAllocator, which re-uses // freed pinned (page-locked) memory allocations. This av...
1,420
34.525
85
h
null
pytorch-main/aten/src/ATen/cuda/EmptyTensor.h
#pragma once #include <ATen/core/TensorBase.h> namespace at { namespace detail { TORCH_CUDA_CPP_API TensorBase empty_cuda( IntArrayRef size, ScalarType dtype, c10::optional<Device> device_opt, c10::optional<c10::MemoryFormat> memory_format_opt); TORCH_CUDA_CPP_API TensorBase empty_cuda( IntArrayR...
1,218
25.5
56
h
null
pytorch-main/aten/src/ATen/cuda/Exceptions.h
#pragma once #include <cublas_v2.h> #include <cusparse.h> #include <c10/macros/Export.h> #ifdef CUDART_VERSION #include <cusolver_common.h> #endif #include <ATen/Context.h> #include <c10/util/Exception.h> #include <c10/cuda/CUDAException.h> namespace c10 { class CuDNNError : public c10::Error { using Error::Err...
8,643
54.057325
114
h
null
pytorch-main/aten/src/ATen/cuda/cub.h
#pragma once #include <cstdint> #include <c10/core/ScalarType.h> #include <ATen/cuda/CUDAConfig.h> // NOTE: These templates are intentionally not defined in this header, // which aviods re-compiling them for each translation unit. If you get // a link error, you need to add an explicit instantiation for your // types ...
3,397
36.755556
96
h
null
pytorch-main/aten/src/ATen/cuda/jiterator.h
#pragma once #include <ATen/jit_macros.h> #if AT_USE_JITERATOR() #include <c10/macros/Export.h> #include <c10/util/SmallVector.h> #include <ATen/core/Tensor.h> #include <string> #include <vector> namespace at { namespace cuda { TORCH_CUDA_CPP_API c10::SmallVector<at::Tensor> CompileAndLaunchKernel( const std::st...
983
23
71
h
null
pytorch-main/aten/src/ATen/cuda/jiterator_impl.h
#pragma once #include <ATen/jit_macros.h> #if AT_USE_JITERATOR() #include <c10/util/variant.h> #include <ATen/native/TensorIterator.h> #include <ATen/cuda/detail/OffsetCalculator.cuh> #include <ATen/native/cuda/jit_utils.h> #include <ATen/native/cuda/MemoryAccess.cuh> #include <ATen/native/cuda/JitLoops.cuh> #includ...
7,127
27.398406
112
h
null
pytorch-main/aten/src/ATen/cuda/detail/CUDAHooks.h
#pragma once #include <ATen/detail/CUDAHooksInterface.h> #include <ATen/Generator.h> #include <c10/util/Optional.h> // TODO: No need to have this whole header, we can just put it all in // the cpp file namespace at { namespace cuda { namespace detail { // Set the callback to initialize Magma, which is set by // to...
2,210
39.2
89
h
null
pytorch-main/aten/src/ATen/cuda/detail/DeviceThreadHandles.h
// Some stateful GPU libraries, such as cuDNN, cuBLAS, use handles to store states. // These handles are tied to device, and these libraries requires/recommends not to // share handles across host threads. // // These libraries recommend using one handle per host thread. We may not want to do // this because threads ar...
7,020
45.190789
120
h
null
pytorch-main/aten/src/ATen/cuda/detail/KernelUtils.h
#pragma once #include <limits> #include <c10/util/Exception.h> namespace at { namespace cuda { namespace detail { // CUDA: grid stride looping // // int64_t _i_n_d_e_x specifically prevents overflow in the loop increment. // If input.numel() < INT_MAX, _i_n_d_e_x < INT_MAX, except after the final // iteration of the...
1,547
39.736842
99
h
null
pytorch-main/aten/src/ATen/cuda/nvrtc_stub/ATenNVRTC.h
#pragma once #include <ATen/cuda/ATenCUDAGeneral.h> #include <cuda.h> #include <nvrtc.h> namespace at { namespace cuda { // NOTE [ USE OF NVRTC AND DRIVER API ] // // ATen does not directly link to either libnvrtc or libcuda because they // require libcuda to be installed, yet we want our GPU build to work on CPU /...
4,807
37.464
97
h
null
pytorch-main/aten/src/ATen/cudnn/Descriptors.h
#pragma once #include <string> #include <ATen/cuda/CUDAContext.h> #include <ATen/cuda/Exceptions.h> #include <ATen/cudnn/cudnn-wrapper.h> #include <ATen/cudnn/Utils.h> #include <ATen/core/Tensor.h> #include <ATen/TensorUtils.h> #include <ATen/cuda/ATenCUDAGeneral.h> #include <cuda.h> #ifndef AT_PER_OPERATOR_HEADERS...
12,753
35.44
133
h
null
pytorch-main/aten/src/ATen/cudnn/Utils.h
#pragma once #include <ATen/core/Tensor.h> #include <ATen/cuda/Exceptions.h> #include <ATen/cudnn/cudnn-wrapper.h> #include <ATen/cudnn/Handle.h> namespace at { namespace native { // cuDNN has a buggy check for tensor being contiguous (that is, it does // not ignore stride for dimension that is equal to 0). This fu...
577
25.272727
72
h
null
pytorch-main/aten/src/ATen/detail/CUDAHooksInterface.h
#pragma once #include <c10/core/Allocator.h> #include <c10/util/Exception.h> #include <c10/util/Optional.h> #include <c10/util/Registry.h> #include <cstddef> #include <functional> #include <memory> // Forward-declares at::Context, at::Generator and at::cuda::NVRTC namespace at { class Context; struct Generator; name...
7,025
32.942029
115
h
null
pytorch-main/aten/src/ATen/detail/HIPHooksInterface.h
#pragma once #include <c10/core/Allocator.h> #include <ATen/core/Generator.h> #include <c10/util/Exception.h> #include <c10/util/Registry.h> #include <cstddef> #include <functional> #include <memory> namespace at { class Context; } // NB: Class must live in `at` due to limitations of Registry.h. namespace at { //...
1,912
25.569444
80
h