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/detail/MPSHooksInterface.h | // Copyright © 2022 Apple Inc.
#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>
namespace at {
class Context;
}
namespace at {
struct TORCH_API MPSHooksInterface {
// this fails ... | 2,254 | 24.055556 | 91 | h |
null | pytorch-main/aten/src/ATen/detail/MTIAHooksInterface.h | #pragma once
#include <c10/core/Device.h>
#include <c10/util/Exception.h>
#include <c10/util/Registry.h>
#include <cstddef>
#include <functional>
#include <memory>
namespace at {
class Context;
}
// We use forward declaration here instead of #include <ATen/dlpack.h> to avoid
// leaking DLPack implementation detail... | 1,538 | 24.65 | 102 | h |
null | pytorch-main/aten/src/ATen/detail/ORTHooksInterface.h | #pragma once
#include <c10/util/Exception.h>
#include <c10/util/Registry.h>
constexpr const char* ORT_HELP =
" You need to 'import torch_ort' to use the 'ort' device in PyTorch. "
"The 'torch_ort' module is provided by the ONNX Runtime itself "
"(https://onnxruntime.ai).";
// NB: Class must live in `at` due to... | 1,113 | 29.108108 | 83 | h |
null | pytorch-main/aten/src/ATen/detail/XPUHooksInterface.h | #pragma once
#include <c10/core/Device.h>
#include <c10/util/Exception.h>
#include <c10/util/Registry.h>
#include <cstddef>
#include <functional>
#include <memory>
namespace at {
class Context;
}
// We use forward declaration here instead of #include <ATen/dlpack.h> to avoid
// leaking DLPack implementation detail... | 2,176 | 25.876543 | 102 | h |
null | pytorch-main/aten/src/ATen/functorch/ADInterpreters.h | #pragma once
#include <ATen/functorch/Interpreter.h>
namespace at::functorch {
// These are the interpreters for our AD transforms
// (grad, vjp and jvp).
// See NOTE: [functorch interpreter stack] for more details.
struct TORCH_API GradInterpreterPtr {
explicit GradInterpreterPtr(const Interpreter* base): base_(b... | 1,560 | 39.025641 | 130 | h |
null | pytorch-main/aten/src/ATen/functorch/BatchedFallback.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <ATen/ATen.h>
#include <ATen/core/op_registration/op_registration.h>
#include <torch/l... | 3,341 | 40.259259 | 119 | h |
null | pytorch-main/aten/src/ATen/functorch/BatchedTensorImpl.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <bitset>
#include <utility>
#include <ATen/ArrayRef.h>
#include <ATen/SmallVector.h>... | 6,166 | 35.928144 | 128 | h |
null | pytorch-main/aten/src/ATen/functorch/BatchingMetaprogramming.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <ATen/Tensor.h>
#include <ATen/VmapGeneratedPlumbing.h>
// This file contains templat... | 4,940 | 37.905512 | 116 | h |
null | pytorch-main/aten/src/ATen/functorch/DynamicLayer.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <ATen/functorch/Macros.h>
#include <c10/core/DispatchKey.h>
#include <ATen/core/functi... | 5,544 | 42.320313 | 125 | h |
null | pytorch-main/aten/src/ATen/functorch/Interpreter.h | #pragma once
#include <ATen/functorch/Macros.h>
#include <ATen/core/dispatch/Dispatcher.h>
#include <c10/core/impl/LocalDispatchKeySet.h>
#include <c10/util/Optional.h>
#include <c10/util/variant.h>
#include <bitset>
namespace at::functorch {
// NOTE: [functorch interpreter stack]
//
// functorch's dispatching syste... | 7,874 | 36.679426 | 117 | h |
null | pytorch-main/aten/src/ATen/functorch/LegacyVmapTransforms.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <ATen/functorch/Macros.h>
#include <ATen/functorch/BatchedTensorImpl.h>
namespace at... | 8,241 | 42.840426 | 89 | h |
null | pytorch-main/aten/src/ATen/functorch/PlumbingHelper.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <ATen/Tensor.h>
#include <ATen/functorch/BatchedTensorImpl.h>
#include <ATen/functorch/... | 2,838 | 43.359375 | 123 | h |
null | pytorch-main/aten/src/ATen/functorch/TensorWrapper.h | // Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#pragma once
#include <ATen/functorch/Macros.h>
#include <ATen/Tensor.h>
#include <ATen/functorch/Interpret... | 4,021 | 37.673077 | 114 | h |
null | pytorch-main/aten/src/ATen/functorch/VmapInterpreter.h | #pragma once
#include <ATen/functorch/Interpreter.h>
namespace at::functorch {
// This is the interpreter that handles the functionalize() transform.
// See NOTE: [functorch interpreter stack] for more details.
struct VmapInterpreterPtr {
explicit VmapInterpreterPtr(const Interpreter* base): base_(base) { TORCH_IN... | 957 | 35.846154 | 130 | h |
null | pytorch-main/aten/src/ATen/hip/impl/HIPAllocatorMasqueradingAsCUDA.h | #pragma once
#include <c10/core/Allocator.h>
#include <c10/core/DeviceType.h>
// Use of c10::hip namespace here makes hipification easier, because
// I don't have to also fix namespaces. Sorry!
namespace c10 { namespace hip {
// Takes a valid HIPAllocator (of any sort) and turns it into
// an allocator pretending t... | 875 | 29.206897 | 75 | h |
null | pytorch-main/aten/src/ATen/hip/impl/HIPCachingAllocatorMasqueradingAsCUDA.h | #pragma once
#include <c10/hip/HIPCachingAllocator.h>
#include <ATen/hip/impl/HIPAllocatorMasqueradingAsCUDA.h>
#include <ATen/hip/impl/HIPStreamMasqueradingAsCUDA.h>
namespace c10 {
// forward declaration
class DataPtr;
namespace hip {
namespace HIPCachingAllocatorMasqueradingAsCUDA {
C10_HIP_API Allocator* get();
... | 517 | 26.263158 | 104 | h |
null | pytorch-main/aten/src/ATen/hip/impl/HIPGuardImplMasqueradingAsCUDA.h | #pragma once
#include <ATen/hip/HIPConfig.h>
// The includes of HIPGuard.h
#include <c10/hip/impl/HIPGuardImpl.h>
#include <c10/hip/HIPMacros.h>
#include <c10/core/DeviceType.h>
#include <c10/core/impl/InlineDeviceGuard.h>
#include <c10/core/impl/InlineStreamGuard.h>
#include <c10/util/Exception.h>
#include <c10/hip... | 13,949 | 38.40678 | 115 | h |
null | pytorch-main/aten/src/ATen/hip/impl/HIPStreamMasqueradingAsCUDA.h | #pragma once
#include <c10/hip/HIPStream.h>
// Use of c10::hip namespace here makes hipification easier, because
// I don't have to also fix namespaces. Sorry!
namespace c10 { namespace hip {
// See Note [Masquerading as CUDA] for motivation
class HIPStreamMasqueradingAsCUDA {
public:
enum Unchecked { UNCHECKED... | 4,318 | 31.969466 | 105 | h |
null | pytorch-main/aten/src/ATen/miopen/Exceptions.h | #pragma once
#include <ATen/miopen/miopen-wrapper.h>
#include <string>
#include <stdexcept>
#include <sstream>
namespace at { namespace native {
class miopen_exception : public std::runtime_error {
public:
miopenStatus_t status;
miopen_exception(miopenStatus_t status, const char* msg)
: std::runtime_error(... | 1,076 | 24.642857 | 84 | h |
null | pytorch-main/aten/src/ATen/mkl/Descriptors.h | #pragma once
#include <ATen/mkl/Exceptions.h>
#include <mkl_dfti.h>
#include <ATen/Tensor.h>
namespace at { namespace native {
struct DftiDescriptorDeleter {
void operator()(DFTI_DESCRIPTOR* desc) {
if (desc != nullptr) {
MKL_DFTI_CHECK(DftiFreeDescriptor(&desc));
}
}
};
class DftiDescriptor {
pub... | 1,122 | 23.955556 | 112 | h |
null | pytorch-main/aten/src/ATen/mkl/Exceptions.h | #pragma once
#include <string>
#include <stdexcept>
#include <sstream>
#include <mkl_dfti.h>
#include <mkl_spblas.h>
namespace at { namespace native {
static inline void MKL_DFTI_CHECK(MKL_INT status)
{
if (status && !DftiErrorClass(status, DFTI_NO_ERROR)) {
std::ostringstream ss;
ss << "MKL FFT error: " <... | 1,724 | 26.822581 | 70 | h |
null | pytorch-main/aten/src/ATen/mkl/SparseBlas.h | #pragma once
/*
Provides a subset of MKL Sparse BLAS functions as templates:
mv<scalar_t>(operation, alpha, A, descr, x, beta, y)
where scalar_t is double, float, c10::complex<double> or c10::complex<float>.
The functions are available in at::mkl::sparse namespace.
*/
#include <c10/util/Exception.h>
#incl... | 8,007 | 33.666667 | 80 | h |
null | pytorch-main/aten/src/ATen/mkl/SparseDescriptors.h | #pragma once
/*
Provides templated descriptor wrappers of MKL Sparse BLAS sparse matrices:
MklSparseCsrDescriptor<scalar_t>(sparse_csr_tensor)
where scalar_t is double, float, c10::complex<double> or c10::complex<float>.
The descriptors are available in at::mkl::sparse namespace.
*/
#include <ATen/Tensor.... | 4,268 | 27.271523 | 101 | h |
null | pytorch-main/aten/src/ATen/mps/EmptyTensor.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <ATen/core/TensorBase.h>
namespace at {
namespace detail {
C10_EXPORT TensorBase empty_mps(
IntArrayRef size,
c10::optional<ScalarType> dtype_opt,
c10::optional<Layout> layout_opt,
c10::optional<Device> device_opt,
c10::optional<bool> pin_memo... | 784 | 23.53125 | 56 | h |
null | pytorch-main/aten/src/ATen/mps/MPSAllocatorInterface.h | // Copyright © 2023 Apple Inc.
#pragma once
#include <c10/core/Allocator.h>
#include <c10/util/Registry.h>
#include <ATen/core/ATen_fwd.h>
namespace at { namespace mps {
// this is a public interface to access MPSAllocator.
// Do not declare methods that would depend on MPS or Metal frameworks.
class IMPSAllocator... | 2,297 | 40.035714 | 88 | h |
null | pytorch-main/aten/src/ATen/mps/MPSDevice.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <c10/core/Allocator.h>
#include <c10/macros/Macros.h>
#include <c10/util/Exception.h>
#ifdef __OBJC__
#include <Foundation/Foundation.h>
#include <Metal/Metal.h>
#include <MetalPerformanceShaders/MetalPerformanceShaders.h>
typedef id<MTLDevice> MTLDevice_t;
typed... | 2,124 | 23.425287 | 94 | h |
null | pytorch-main/aten/src/ATen/mps/MPSGeneratorImpl.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <ATen/core/Generator.h>
#include <ATen/core/PhiloxRNGEngine.h>
#include <c10/core/GeneratorImpl.h>
#include <c10/util/Optional.h>
namespace at {
namespace mps {
namespace detail {
static const uint32_t PHILOX_STATE_N = 7;
struct rng_data_pod {
std::array<uint3... | 1,578 | 27.709091 | 81 | h |
null | pytorch-main/aten/src/ATen/mps/MPSGuardImpl.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <c10/core/impl/DeviceGuardImplInterface.h>
#include <c10/macros/Macros.h>
#include <c10/util/Exception.h>
#include <ATen/Context.h>
#include <ATen/mps/MPSStream.h>
#ifdef __OBJC__
#include <Foundation/Foundation.h>
#include <Metal/Metal.h>
#include <MetalPerforman... | 4,912 | 27.398844 | 82 | h |
null | pytorch-main/aten/src/ATen/mps/MPSHooks.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <ATen/detail/MPSHooksInterface.h>
#include <ATen/Generator.h>
#include <c10/util/Optional.h>
namespace at { namespace mps {
// The real implementation of MPSHooksInterface
struct MPSHooks : public at::MPSHooksInterface {
MPSHooks(at::MPSHooksArgs) {}
void in... | 1,177 | 28.45 | 91 | h |
null | pytorch-main/aten/src/ATen/mps/MPSProfiler.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <ATen/Tensor.h>
#include <ATen/mps/MPSStream.h>
#include <ATen/mps/MPSAllocatorInterface.h>
#include <os/signpost.h>
#include <os/log.h>
#include <sstream>
#include <string>
#include <atomic>
#include <unordered_map>
#include <utility>
#include <ctime>
namespac... | 16,688 | 41.357868 | 121 | h |
null | pytorch-main/aten/src/ATen/mps/MPSStream.h | // Copyright © 2022 Apple Inc.
#pragma once
#include <cstdint>
#include <utility>
#include <c10/core/DeviceGuard.h>
#include <c10/util/Exception.h>
#include <c10/core/Stream.h>
#include <ATen/mps/MPSDevice.h>
#ifdef __OBJC__
#include <Foundation/Foundation.h>
#include <Metal/Metal.h>
#include <MetalPerformanceShad... | 5,349 | 30.656805 | 123 | h |
null | pytorch-main/aten/src/ATen/native/Activation.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <c10/util/Exception.h>
#include <c10/util/string_view.h>
namespace c10 {
class Scalar;
}
namespace at {
struct TensorIterator;
struct TensorIteratorBase;
class TensorBase;
}
namespace at::native {
// These constants control the approximation behavior of g... | 4,270 | 42.141414 | 120 | h |
null | pytorch-main/aten/src/ATen/native/AdaptivePooling.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/DispatchStub.h>
#include <c10/util/ArrayRef.h>
#include <c10/util/irange.h>
#include <cmath>
namespace at::native {
using adaptive_avg_pooling_fn = void(*)(Tensor& output, const Tensor& input, IntArrayRef output_size);
using adaptive_avg_pooling_backwa... | 1,645 | 40.15 | 131 | h |
null | pytorch-main/aten/src/ATen/native/BinaryOps.h | #pragma once
#include <ATen/core/TensorBase.h>
#include <ATen/native/DispatchStub.h>
#include <c10/core/Scalar.h>
#include <c10/util/TypeSafeSignMath.h>
#if defined(__CUDA_ARCH__)
#include <c10/cuda/CUDAMathCompat.h>
#define compat_copysign c10::cuda::compat::copysign
#elif defined(__HIPCC__)
#include <c10/hip/HIPMath... | 8,002 | 42.494565 | 110 | h |
null | pytorch-main/aten/src/ATen/native/BucketizationUtils.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/TypeProperties.h>
#include <ATen/ScalarOps.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/NativeFunctions.h>
#else
#include <ATen/ops/result_type.h>
#endif
namespace at::native {
// original values given by raw_*. If an original value is not contig... | 7,789 | 43.770115 | 119 | h |
null | pytorch-main/aten/src/ATen/native/CPUBlas.h | #pragma once
#include <ATen/OpMathType.h>
#include <ATen/native/DispatchStub.h>
#include <ATen/native/TransposeType.h>
#include <c10/util/complex.h>
#include <c10/core/ScalarType.h>
#include <c10/core/Scalar.h>
namespace at::native::cpublas {
namespace internal {
void normalize_last_dims(
TransposeType transa, Tra... | 5,184 | 30.809816 | 129 | h |
null | pytorch-main/aten/src/ATen/native/CPUFallback.h | #pragma once
#include <ATen/core/ivalue.h>
#include <ATen/core/stack.h>
#include <ATen/core/boxing/KernelFunction.h>
#include <ATen/core/dispatch/Dispatcher.h>
#include <c10/util/Metaprogramming.h>
#include <torch/library.h>
namespace at::native {
// This function implements a boxed fallback to CPU.
// External back... | 2,326 | 49.586957 | 130 | h |
null | pytorch-main/aten/src/ATen/native/CompositeRandomAccessor.h | #pragma once
#include <ATen/native/CompositeRandomAccessorCommon.h>
namespace at::native {
struct TupleInfoCPU {
template <typename ...Types>
using tuple = std::tuple<Types...>;
template <typename ...Types>
static constexpr auto tie(Types&... args) noexcept {
return std::tie(args...);
}
};
template <... | 876 | 24.057143 | 88 | h |
null | pytorch-main/aten/src/ATen/native/CompositeRandomAccessorCommon.h | #include <utility>
#pragma once
namespace at::native {
namespace {
// operator_brackets_proxy is used in
// CompositeRandomAccessor in place of operator[].
// For some iterators, references returned by operator[]
// could become invalid, operator_brackets_proxy tries to
// resolve that by making accessor[n] to be e... | 6,732 | 24.503788 | 86 | h |
null | pytorch-main/aten/src/ATen/native/ConvUtils.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/TensorUtils.h>
#include <ATen/detail/CUDAHooksInterface.h>
#include <ATen/native/DispatchStub.h>
#include <c10/util/env.h>
#include <c10/util/irange.h>
namespace at::native {
using conv_depthwise2d_backward_fn = std::tuple<at::Tensor,at::Tensor>(*)(
const ... | 18,194 | 43.270073 | 130 | h |
null | pytorch-main/aten/src/ATen/native/DilatedConvolutionUtils.h | #pragma once
#include <algorithm>
#include <vector>
#include <ATen/div_rtn.h>
#include <ATen/core/Tensor.h>
#include <c10/util/irange.h>
#define TORCH_CHECK_DIM_SIZE(T, DIM, DIM_SIZE, SIZE) \
TORCH_CHECK( \
T.dim() == DIM && T.size(DIM_SIZE) == SIZE, \
"Need " #... | 6,402 | 26.83913 | 79 | h |
null | pytorch-main/aten/src/ATen/native/DispatchStub.h | #pragma once
#include <c10/core/DeviceType.h>
#include <c10/macros/Macros.h>
#include <atomic>
#include <utility>
// Implements instruction set specific function dispatch.
//
// Kernels that may make use of specialized instruction sets (e.g. AVX2) are
// compiled multiple times with different compiler flags (e.g. -m... | 9,648 | 29.827476 | 87 | h |
null | pytorch-main/aten/src/ATen/native/Distance.h | #pragma once
#include <ATen/native/DispatchStub.h>
namespace at {
class Tensor;
namespace native {
using pdist_forward_fn = void(*)(Tensor&, const Tensor&, const double p);
using pdist_backward_fn = void(*)(Tensor&, const Tensor&, const Tensor&, const double p, const Tensor&);
using cdist_fn = void(*)(Tensor&, cons... | 724 | 33.52381 | 119 | h |
null | pytorch-main/aten/src/ATen/native/EmbeddingBag.h | #include <ATen/core/Tensor.h>
#include <ATen/Config.h>
#include <cstdint>
#ifdef USE_FBGEMM
#include <fbgemm/FbgemmEmbedding.h>
#endif
namespace at::native {
void check_arguments(
const Tensor& weight,
const Tensor& indices,
const Tensor& offsets,
const int64_t mode,
const c10::optional<Tensor>& ... | 4,920 | 34.15 | 105 | h |
null | pytorch-main/aten/src/ATen/native/FractionalMaxPooling.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/TensorUtils.h>
#include <c10/util/irange.h>
namespace at::native {
template<typename scalar_t>
static inline std::vector<int> generate_intervals(
scalar_t sample,
int64_t inputSize,
int64_t outputSize,
int64_t poolSize) {
std::vector<int> seq... | 2,159 | 25.666667 | 82 | h |
null | pytorch-main/aten/src/ATen/native/GridSampler.h | #pragma once
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <utility>
#include <ATen/native/GridSamplerUtils.h>
namespace at::native {
using detail::GridSamplerInterpolation;
using detail::GridSamplerPadding;
// Unnormalizes a coordinate from the -1 to +1 scale to its pixel index value,
// where... | 10,401 | 33.789298 | 103 | h |
null | pytorch-main/aten/src/ATen/native/GridSamplerUtils.h | #pragma once
// See NOTE: [Tensor vs. TensorBase]
// https://github.com/pytorch/pytorch/pull/66979
#include <ATen/core/TensorBase.h>
#include <ATen/native/TensorProperties.h>
#include <ATen/native/CanUse32BitIndexMath.h>
namespace at::native {
namespace detail {
enum class GridSamplerInterpolation {Bilinear, Neares... | 3,510 | 30.918182 | 80 | h |
null | pytorch-main/aten/src/ATen/native/IndexingUtils.h | #pragma once
#include <ATen/ExpandUtils.h>
#include <ATen/native/CanUse32BitIndexMath.h>
#include <ATen/native/TensorIterator.h>
#include <ATen/core/IListRef.h>
#include <c10/util/irange.h>
namespace at::native {
[[noreturn]]
static void invalid_mask(const Tensor & self, int64_t idx, const Tensor & mask, int64_t mask... | 5,545 | 33.447205 | 116 | h |
null | pytorch-main/aten/src/ATen/native/Lerp.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <ATen/OpMathType.h>
#include <ATen/TensorIterator.h>
#include <c10/core/Scalar.h>
namespace at::native {
template <typename scalar_t>
C10_HOST_DEVICE C10_ALWAYS_INLINE bool is_lerp_weight_small(scalar_t weight) {
return std::abs(weight) < scalar_t(0.5);
}... | 1,463 | 30.148936 | 98 | h |
null | pytorch-main/aten/src/ATen/native/LossMulti.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/AccumulateType.h>
#include <ATen/Dispatch.h>
#include <ATen/TensorUtils.h>
namespace at::native {
namespace {
static C10_UNUSED void multilabel_margin_loss_shape_check(
int64_t& nframe,
int64_t& dim,
const int64_t& ndims,
TensorArg& target_arg... | 2,372 | 29.037975 | 111 | h |
null | pytorch-main/aten/src/ATen/native/MathBitFallThroughLists.h | #pragma once
namespace at {
// views and their in-place version ops
#define TORCH_VIEW_FNS(m) \
m.impl("as_strided_", torch::CppFunction::makeFallthrough()); \
m.impl("detach", torch::CppFunction::makeFallthrough()); \
m.impl("detach_", torch::CppFunction::makeFallthrough()); \
m.impl("diagonal", torch::CppFun... | 4,136 | 56.458333 | 73 | h |
null | pytorch-main/aten/src/ATen/native/MaxPooling.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/Parallel.h>
#include <ATen/native/DispatchStub.h>
namespace at::native {
// TODO(Heitor) Template by dimension
struct PoolingParams1D {
int64_t NB; // Number of batches
int64_t NC; // Number of channels
int64_t IW; // Input width
int64_t OW; // Output... | 1,216 | 27.302326 | 76 | h |
null | pytorch-main/aten/src/ATen/native/NonEmptyUtils.h | #include <ATen/core/TensorBase.h>
#include <algorithm>
#include <vector>
namespace at::native {
inline int64_t ensure_nonempty_dim(int64_t dim) {
return std::max<int64_t>(dim, 1);
}
inline int64_t ensure_nonempty_size(const TensorBase &t, int64_t dim) {
return t.dim() == 0 ? 1 : t.size(dim);
}
inline int64_t en... | 599 | 20.428571 | 73 | h |
null | pytorch-main/aten/src/ATen/native/Padding.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/DispatchStub.h>
namespace at::native {
using padding_fn = void (*)(const Tensor&, const Tensor&, IntArrayRef);
// reflection padding
DECLARE_DISPATCH(padding_fn, reflection_pad1d_kernel);
DECLARE_DISPATCH(padding_fn, reflection_pad1d_backward_kernel);... | 2,026 | 31.174603 | 108 | h |
null | pytorch-main/aten/src/ATen/native/PointwiseOps.h | // Ternary and higher-order pointwise operations
#pragma once
#include <ATen/native/DispatchStub.h>
namespace c10 {
class Scalar;
}
namespace at {
struct TensorIterator;
struct TensorIteratorBase;
namespace native {
using pointwise_fn = void (*)(TensorIterator&, const Scalar& scalar);
using structured_pointwise_f... | 786 | 26.137931 | 84 | h |
null | pytorch-main/aten/src/ATen/native/Pool.h | #include <ATen/core/Tensor.h>
#include <ATen/div_rtn.h>
#include <ATen/TensorUtils.h>
#include <ATen/native/DispatchStub.h>
#include <c10/util/irange.h>
#include <utility>
#pragma once
namespace at::native {
using max_pool2d_fn = void(*)(const Tensor& output, const Tensor& indices, const Tensor& input,
int kW, ... | 11,881 | 34.468657 | 121 | h |
null | pytorch-main/aten/src/ATen/native/Pow.h | #pragma once
#include <ATen/native/DispatchStub.h>
namespace c10 {
class Scalar;
}
namespace at {
struct TensorIterator;
struct TensorIteratorBase;
namespace native {
#if defined(__CUDACC__) || defined(__HIPCC__)
#define HOST_DEVICE __host__ __device__
#else
#define HOST_DEVICE
#endif
// integral power in pytorc... | 1,736 | 23.814286 | 103 | h |
null | pytorch-main/aten/src/ATen/native/ReduceOps.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <c10/util/Optional.h>
namespace c10 {
class Scalar;
}
namespace at {
struct TensorIterator;
class Tensor;
}
namespace at::native {
using reduce_fn = void(*)(TensorIterator &);
DECLARE_DISPATCH(reduce_fn, sum_stub);
DECLARE_DISPATCH(reduce_fn, nansum_stub... | 1,764 | 30.517857 | 89 | h |
null | pytorch-main/aten/src/ATen/native/ReductionType.h | #pragma once
#include <c10/core/Scalar.h>
namespace at::native {
enum class ReductionType {MAX, MEAN, MIN, SUM, PROD};
static inline ReductionType get_reduction_enum(const c10::string_view& reduce) {
if (reduce == "max" || reduce == "amax") {
return ReductionType::MAX;
} else if (reduce == "mean") {
ret... | 1,153 | 27.146341 | 101 | h |
null | pytorch-main/aten/src/ATen/native/Repeat.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/TensorOperators.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/empty.h>
#include <ATen/ops/empty_like.h>
#endif
namespace at::native {
template <
typename index_t,
void compute(index_t*, int64_t*, index_t*, in... | 1,437 | 28.346939 | 79 | h |
null | pytorch-main/aten/src/ATen/native/Resize.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/ResizeCommon.h>
#include <ATen/EmptyTensor.h>
#include <ATen/TensorUtils.h>
#include <c10/core/CPUAllocator.h>
#include <utility>
namespace at::native {
// TODO: make all operations that resize given outputs use this function
// for consistency an... | 6,239 | 35.705882 | 99 | h |
null | pytorch-main/aten/src/ATen/native/ResizeCommon.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/TensorFactories.h>
#include <ATen/NamedTensorUtils.h>
#include <c10/util/irange.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/NativeFunctions.h>
#else
#include <ATen/ops/empty.h>
#endif
namespace at::native {
template <typename T>
inline T storage... | 2,491 | 31.789474 | 116 | h |
null | pytorch-main/aten/src/ATen/native/ScatterGatherChecks.h | #pragma once
#include <vector>
#include <ATen/core/Tensor.h>
#include <ATen/native/ReduceOpsUtils.h>
#include <c10/util/irange.h>
namespace at::native {
namespace {
// checks whether index.dtype == int64
// and self.dtype == src.dtype if src is a Tensor
static void scatter_gather_dtype_check(
const std::string& m... | 3,698 | 27.674419 | 74 | h |
null | pytorch-main/aten/src/ATen/native/SegmentReduce.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <ATen/native/ReductionType.h>
#include <c10/core/Scalar.h>
#include <c10/util/Optional.h>
namespace at {
class Tensor;
namespace native {
using segment_reduce_lengths_fn = Tensor (*)(
ReductionType,
const Tensor&,
const Tensor&,
int64_t,
... | 1,280 | 24.117647 | 92 | h |
null | pytorch-main/aten/src/ATen/native/SharedReduceOps.h | #pragma once
// Please note that this file is
// used across both CPU and GPU.
#include <type_traits>
#include <complex>
#include <c10/macros/Macros.h>
#include <ATen/detail/FunctionTraits.h>
#include <ATen/NumericUtils.h>
#if defined(__CUDACC__)
#include <ATen/cuda/DeviceUtils.cuh>
#include <ATen/native/cuda/DeviceSq... | 15,989 | 28.33945 | 102 | h |
null | pytorch-main/aten/src/ATen/native/SobolEngineOpsUtils.h | /// This file contains some tensor-agnostic operations to be used in the
/// core functions of the `SobolEngine`
#include <ATen/core/Tensor.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/arange.h>
#include <ATen/ops/mul.h>
#include <ATen/ops/pow.h>
#endif
namespace at::native:... | 1,835 | 31.785714 | 97 | h |
null | pytorch-main/aten/src/ATen/native/Sorting.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <cstdint>
namespace at {
class TensorBase;
}
namespace at::native {
enum class QUANTILE_INTERPOLATION_MODE : uint8_t {
LINEAR,
LOWER,
HIGHER,
MIDPOINT,
NEAREST
};
using sort_fn = void(*)(const TensorBase&, const TensorBase&, const TensorBase&, i... | 618 | 20.344828 | 111 | h |
null | pytorch-main/aten/src/ATen/native/SortingUtils.h | #pragma once
#include <ATen/NumericUtils.h>
#include <ATen/native/Resize.h>
#include <c10/util/irange.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/empty.h>
#endif
namespace at::native {
// ensure we get good values and indices for kthvalue, mode
// this will always be with... | 2,672 | 29.033708 | 80 | h |
null | pytorch-main/aten/src/ATen/native/SparseTensorUtils.h | #pragma once
#include <ATen/Parallel.h>
#include <ATen/SparseTensorImpl.h>
#include <ATen/core/Tensor.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/empty.h>
#include <ATen/ops/tensor.h>
#endif
namespace at::sparse {
// Just for documentary purposes
using SparseTensor = Tens... | 6,253 | 32.805405 | 80 | h |
null | pytorch-main/aten/src/ATen/native/StridedRandomAccessor.h | #pragma once
namespace at::native {
// (Const)StridedRandomAccessor is a
// (const) random access iterator defined over
// a strided array.
// The traits below are to introduce __restrict__
// modifier on different platforms.
template <typename T>
struct DefaultPtrTraits {
using PtrType = T*;
};
#if (defined(_WI... | 6,835 | 21.635762 | 82 | h |
null | pytorch-main/aten/src/ATen/native/TensorAdvancedIndexingUtils.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/IndexingUtils.h>
#include <ATen/native/TensorIterator.h>
namespace at::native {
namespace {
static std::string shapes_as_str(TensorList tensors) {
std::ostringstream os;
bool first = true;
for (auto& tensor : tensors) {
if (tensor.defined()) {
... | 3,072 | 31.691489 | 130 | h |
null | pytorch-main/aten/src/ATen/native/TensorCompare.h | #pragma once
#include <ATen/native/DispatchStub.h>
namespace c10 {
class Scalar;
}
namespace at {
class Tensor;
struct TensorIterator;
struct TensorIteratorBase;
}
namespace at::native {
using reduce_minmax_fn =
void (*)(Tensor&, Tensor&, const Tensor&, int64_t, bool);
using structured_reduce_minmax_fn =
v... | 1,490 | 28.82 | 108 | h |
null | pytorch-main/aten/src/ATen/native/TensorConversions.h | #pragma once
#include <c10/core/Device.h>
#include <c10/core/Layout.h>
#include <c10/core/MemoryFormat.h>
#include <c10/core/ScalarType.h>
#include <c10/util/Optional.h>
namespace at {
class Tensor;
namespace native {
bool to_will_alias(
const Tensor& self,
c10::optional<ScalarType> dtype,
c10::optional... | 652 | 24.115385 | 67 | h |
null | pytorch-main/aten/src/ATen/native/TensorDimApply.h | #pragma once
#include <ATen/core/Tensor.h>
#include <c10/util/irange.h>
namespace at::native {
//input tensors are non-zero dim and non-empty
template<typename T1, typename T2, typename Function>
void tensor_dim_apply3(const Tensor& self, Tensor& values, Tensor& indices, int64_t dim, Function func) {
int ndims = se... | 1,727 | 29.857143 | 106 | h |
null | pytorch-main/aten/src/ATen/native/TensorFactories.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/EmptyTensor.h>
#include <ATen/TensorIterator.h>
#include <ATen/Dispatch.h>
#include <ATen/native/DispatchStub.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/scalar_tensor.h>
#endif
namespace at::native {
// Different c... | 4,856 | 33.446809 | 99 | h |
null | pytorch-main/aten/src/ATen/native/TensorIteratorDynamicCasting.h | #pragma once
#include <complex>
#include <type_traits>
#include <c10/core/ScalarType.h>
#include <c10/util/C++17.h>
#include <ATen/detail/FunctionTraits.h>
#include <ATen/native/TensorIterator.h>
// This file includes utilties for dynamic_casting done by TensorIterator, see CUDALoops.cuh and Loops.h.
// dynamic_cas... | 1,828 | 32.87037 | 106 | h |
null | pytorch-main/aten/src/ATen/native/TensorTransformations.h | #include <ATen/core/Tensor.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/roll.h>
#endif
#include <c10/util/Exception.h>
namespace at::native {
static inline Tensor roll_common(const Tensor& self, IntArrayRef shifts, IntArrayRef dims) {
TORCH_CHECK(!shifts.empty(), "`shift... | 896 | 27.935484 | 92 | h |
null | pytorch-main/aten/src/ATen/native/TopKImpl.h | #pragma once
#include <ATen/core/TensorAccessor.h>
#include <ATen/NumericUtils.h>
namespace at::native {
#ifdef CPU_CAPABILITY
inline namespace CPU_CAPABILITY {
#else
inline namespace DEFAULT {
#endif
// Core topk loop, shared between CPU and QuantizedCPU
template <typename scalar_t, typename accscalar_t>
void topk_... | 3,300 | 34.117021 | 110 | h |
null | pytorch-main/aten/src/ATen/native/TransposeType.h | #pragma once
#include <c10/util/Exception.h>
namespace at::native {
// Used as an interface between the different BLAS-like libraries
enum class TransposeType {
NoTranspose,
Transpose,
ConjTranspose,
};
// Transforms TransposeType into the BLAS / LAPACK format
static inline char to_blas(TransposeType trans) {
... | 578 | 23.125 | 65 | h |
null | pytorch-main/aten/src/ATen/native/TriangularOpsUtils.h | #include <ATen/core/Tensor.h>
#include <ATen/native/LinearAlgebraUtils.h>
namespace at::native {
/*
* Given batches of matrices with arbitrary batch dim,
* computes the number of batches for Triu and Tril. This ignores stride 0 dimension
*/
static inline int64_t batchCountTrilTriu(const Tensor& batched_matrices) {... | 2,002 | 33.534483 | 115 | h |
null | pytorch-main/aten/src/ATen/native/TypeProperties.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/core/IListRef.h>
namespace at::native {
struct ResultTypeState {
c10::ScalarType dimResult = ScalarType::Undefined;
c10::ScalarType wrappedResult = ScalarType::Undefined;
c10::ScalarType zeroResult = ScalarType::Undefined;
};
TORCH_API ResultTypeState ... | 658 | 30.380952 | 106 | h |
null | pytorch-main/aten/src/ATen/native/UnaryOps.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <ATen/Generator.h>
#include <c10/core/Scalar.h>
#include <stdexcept>
namespace at {
class Tensor;
class TensorBase;
struct TensorIteratorBase;
}
namespace at::native {
using unary_fn = void(*)(TensorIteratorBase&);
using unary_fn_with_scalar = void(*)(Tens... | 5,612 | 41.847328 | 125 | h |
null | pytorch-main/aten/src/ATen/native/UnfoldBackward.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/TensorIterator.h>
#include <ATen/native/DispatchStub.h>
#include <ATen/native/NonEmptyUtils.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#else
#include <ATen/ops/arange.h>
#endif
namespace at::native {
using unfold_backward_fn = void (*)(
... | 3,075 | 26.221239 | 84 | h |
null | pytorch-main/aten/src/ATen/native/batch_norm.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/DispatchStub.h>
namespace at::native {
using batch_norm_fn = void (*)(Tensor&, const Tensor&, const Tensor&,
const Tensor&, const Tensor&, const Tensor&, const Tensor&, const Tensor&, bool, double);
using batch_norm_collect_stats_fn = void (*)(Tens... | 1,265 | 36.235294 | 112 | h |
null | pytorch-main/aten/src/ATen/native/group_norm.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <cstdint>
namespace at {
class Tensor;
namespace native {
using forward_fn = void (*)(
const Tensor& /* X */,
const Tensor& /* gamma */,
const Tensor& /* beta */,
int64_t /* N */,
int64_t /* C */,
int64_t /* HxW */,
int64_t /* g... | 907 | 20.116279 | 55 | h |
null | pytorch-main/aten/src/ATen/native/im2col.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/TensorUtils.h>
#include <ATen/Utils.h>
#include <ATen/Parallel.h>
#include <ATen/native/cpu/utils.h>
#include <c10/util/irange.h>
#include <algorithm>
namespace at::native {
template <typename T>
static void im2col(
const T* data_im,
const int64_t ch... | 5,227 | 33.853333 | 112 | h |
null | pytorch-main/aten/src/ATen/native/im2col_shape_check.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/TensorUtils.h>
#include <ATen/div_rtn.h>
namespace at::native {
static inline void col2im_shape_check(
const Tensor& input,
const Tensor& grad_output,
int64_t output_height,
int64_t output_width,
int64_t kernel_height,
int64_t kernel_wi... | 6,913 | 28.67382 | 128 | h |
null | pytorch-main/aten/src/ATen/native/layer_norm.h | #pragma once
#include <ATen/core/Tensor.h>
#include <ATen/native/DispatchStub.h>
#include <c10/util/accumulate.h>
namespace at::native {
namespace {
C10_ALWAYS_INLINE std::pair<int64_t, int64_t> _check_layer_norm_inputs(
const Tensor& input,
IntArrayRef normalized_shape,
const Tensor& weight /* optional... | 2,796 | 26.693069 | 80 | h |
null | pytorch-main/aten/src/ATen/native/vol2col.h | #pragma once
#include <cstring>
namespace at::native {
template <typename T>
static void vol2col(
const T* data_vol,
const int64_t channels,
const int64_t depth,
const int64_t height,
const int64_t width,
const int64_t depth_col,
const int64_t height_col,
const int64_t width_col,
... | 3,569 | 31.454545 | 79 | h |
null | pytorch-main/aten/src/ATen/native/ao_sparse/quantized/cpu/fbgemm_utils.h | #pragma once
#include <ATen/Tensor.h>
#include <c10/core/QScheme.h>
#ifdef USE_FBGEMM
#include <fbgemm/Fbgemm.h>
#include <fbgemm/FbgemmSparse.h>
#include <ATen/native/ao_sparse/quantized/cpu/packed_params.h>
namespace ao {
namespace sparse {
struct TORCH_API PackedLinearWeight
: public LinearPackedParamsBase {... | 2,924 | 29.154639 | 108 | h |
null | pytorch-main/aten/src/ATen/native/ao_sparse/quantized/cpu/packed_params.h | #pragma once
#include <cstdint>
#include <ATen/core/ivalue.h>
namespace ao {
namespace sparse {
// <Weight, bias, out_features_block_size, in_features_block_size>
using LinearPackedSerializationType =
std::tuple<at::Tensor, c10::optional<at::Tensor>, std::vector<int64_t>>;
#define SPARSE_LINEAR_PACKED_PARAM_SE... | 2,747 | 35.157895 | 116 | h |
null | pytorch-main/aten/src/ATen/native/cpu/AtomicAddFloat.h | #ifndef ATOMIC_ADD_FLOAT
#define ATOMIC_ADD_FLOAT
#if (defined(__x86_64__) || defined(__i386__) || defined(__aarch64__))
#include <ATen/native/cpu/Intrinsics.h>
#else
#define _mm_pause()
#endif
#include <atomic>
static inline void cpu_atomic_add_float(float* dst, float fvalue)
{
typedef union {
unsigned intV;
... | 857 | 21.578947 | 84 | h |
null | pytorch-main/aten/src/ATen/native/cpu/GridSamplerKernel.h | #pragma once
#include <ATen/native/DispatchStub.h>
#include <array>
#include <cstdint>
namespace at {
class TensorBase;
}
namespace at { namespace native {
using forward_2d_fn = void (*) (
const TensorBase &output,
const TensorBase &input,
const TensorBase &grid,
int64_t interpolation_mode,
int... | 838 | 22.971429 | 70 | h |
null | pytorch-main/aten/src/ATen/native/cpu/IndexKernelUtils.h | #pragma once
#include <ATen/native/TensorIterator.h>
#include <c10/util/irange.h>
namespace at {
namespace native {
namespace {
static bool is_constant_index(int ntensor, const int64_t* strides) {
AT_ASSERT(ntensor >= 3);
for (const auto arg : c10::irange(2, ntensor)) {
if (strides[arg] != 0) {
return f... | 2,977 | 32.460674 | 111 | h |
null | pytorch-main/aten/src/ATen/native/cpu/Intrinsics.h | #pragma once
#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
/* Clang-compatible compiler, targeting x86/x86-64 */
#include <x86intrin.h>
#elif defined(_MSC_VER)
/* Microsoft C/C++-compatible compiler */
#include <intrin.h>
#if _MSC_VER <= 1900
#define _mm256_extract_epi64(X, Y) (((uint64_t*)&X)[Y... | 1,212 | 34.676471 | 74 | h |
null | pytorch-main/aten/src/ATen/native/cpu/IsContiguous.h | #pragma once
namespace at { namespace native { inline namespace CPU_CAPABILITY {
// n: number of function arguments (arity)
// traits: function_traits (see FunctionTraits.h)
// s: index of scalar argument or -1
template <int n, int stride_index, typename traits, int s=-1>
struct IsContiguous {
static bool eval(cons... | 2,440 | 37.746032 | 97 | h |
null | pytorch-main/aten/src/ATen/native/cpu/LogAddExp.h | #pragma once
#include <c10/util/complex.h>
#include <ATen/NumericUtils.h>
namespace at { namespace native {
inline namespace CPU_CAPABILITY {
// custom min and max to be used in logcumsumexp for complex arguments
template <typename scalar_t>
std::pair<c10::complex<scalar_t>, c10::complex<scalar_t>> _logcumsumexp_min... | 2,458 | 38.66129 | 132 | h |
null | pytorch-main/aten/src/ATen/native/cpu/Loops.h | #pragma once
// This file provides two functions to help write elementwise kernels:
//
// cpu_kernel(TensorIterator iter, <lambda>)
// cpu_kernel_vec(TensorIterator iter, <lambda>, <vec_lambda>)
//
// Both functions may generate vectorized code. The cpu_kernel implementation
// relies on the compiler's auto-vector... | 14,930 | 36.8 | 125 | h |
null | pytorch-main/aten/src/ATen/native/cpu/ReduceUtils.h | #pragma once
#include <ATen/Parallel.h>
#include <ATen/NumericUtils.h>
#include <ATen/cpu/vec/vec.h>
#include <ATen/cpu/vec/functional.h>
#include <ATen/native/ReductionType.h>
#include <c10/util/irange.h>
#include <ATen/OpMathType.h>
#include <ATen/native/cpu/utils.h>
#include <ATen/OpMathType.h>
namespace at::nativ... | 8,874 | 35.825726 | 111 | h |
null | pytorch-main/aten/src/ATen/native/cpu/SerialStackImpl.h | // Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <ATen/core/Tensor.h>
#include <ATen/MemoryOverlap.h>
#include <ATen/Parallel.h>
#include <ATen/TensorIterator.h>
#include <ATen/cpu/vec/functional.h>
#include <ATen/cpu/vec/vec.h>
#include <c10/util/irange.h>
namespace at { namespace nati... | 5,447 | 36.572414 | 92 | h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.