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/c10/util/Bitset.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/Optional.h>
#if defined(_MSC_VER)
#include <intrin.h>
#endif
namespace c10 {
namespace utils {
/**
* This is a simple bitset class with sizeof(long long int) bits.
* You can set bits, unset bits, query bits by index,
* and ... | 3,435 | 27.396694 | 80 | h |
null | pytorch-main/c10/util/C++17.h | #pragma once
#ifndef C10_UTIL_CPP17_H_
#define C10_UTIL_CPP17_H_
#include <c10/macros/Macros.h>
#include <cstdlib>
#include <functional>
#include <memory>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
#if !defined(__clang__) && !defined(_MSC_VER) && defined(__GNUC__) && \
__GNUC__... | 8,287 | 28.183099 | 95 | h |
null | pytorch-main/c10/util/CallOnce.h | #pragma once
#include <atomic>
#include <mutex>
#include <thread>
#include <utility>
#include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
namespace c10 {
// custom c10 call_once implementation to avoid the deadlock in std::call_once.
// The implementation here is a simplified version from folly and likely muc... | 1,942 | 27.15942 | 79 | h |
null | pytorch-main/c10/util/ConstexprCrc.h | #pragma once
#include <c10/util/IdWrapper.h>
#include <c10/util/string_view.h>
#include <cstddef>
#include <cstdint>
namespace c10 {
namespace util {
namespace detail {
constexpr uint64_t crc64_table[] = {
0x0000000000000000, 0x7ad870c830358979, 0xf5b0e190606b12f2,
0x8f689158505e9b8b, 0xc038e5739841b68f, 0xb... | 6,633 | 49.257576 | 79 | h |
null | pytorch-main/c10/util/Deprecated.h | #pragma once
/**
* This file provides portable macros for marking declarations
* as deprecated. You should generally use C10_DEPRECATED,
* except when marking 'using' declarations as deprecated,
* in which case you should use C10_DEFINE_DEPRECATED_USING
* (due to portability concerns).
*/
// Sample usage:
//
/... | 3,579 | 33.757282 | 80 | h |
null | pytorch-main/c10/util/ExclusivelyOwned.h | #pragma once
#include <c10/util/in_place.h>
namespace c10 {
// See example implementation in TensorBase.h and TensorBody.h.
// Synopsis:
//
// repr_type -- type to use to store an owned T in ExclusivelyOwned.
//
// pointer_type -- pointer-esque type to return from
// ExclusivelyOwned's get() and operator*() methods.... | 4,494 | 30.215278 | 80 | h |
null | pytorch-main/c10/util/ExclusivelyOwnedTensorTraits.h | #pragma once
#include <c10/core/TensorImpl.h>
#include <utility>
namespace c10 {
// Shared ExclusivelyOwnedTraits implementation between caffe2::Tensor and
// at::TensorBase.
template <typename TensorType>
struct ExclusivelyOwnedTensorTraits {
using repr_type = TensorType;
using pointer_type = TensorType*;
usi... | 2,152 | 27.706667 | 80 | h |
null | pytorch-main/c10/util/FbcodeMaps.h | #ifndef C10_UTIL_FBCODEMAPS_H_
#define C10_UTIL_FBCODEMAPS_H_
// Map typedefs so that we can use folly's F14 maps in fbcode without
// taking a folly dependency.
#ifdef FBCODE_CAFFE2
#include <folly/container/F14Map.h>
#include <folly/container/F14Set.h>
#else
#include <unordered_map>
#include <unordered_set>
#endif
... | 728 | 23.3 | 69 | h |
null | pytorch-main/c10/util/Flags.h | #ifndef C10_UTIL_FLAGS_H_
#define C10_UTIL_FLAGS_H_
/* Commandline flags support for C10.
*
* This is a portable commandline flags tool for c10, so we can optionally
* choose to use gflags or a lightweight custom implementation if gflags is
* not possible on a certain platform. If you have gflags installed, set th... | 10,054 | 43.295154 | 80 | h |
null | pytorch-main/c10/util/FunctionRef.h | //===- llvm/ADT/STLExtras.h - Useful STL related functions ------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... | 2,293 | 30.424658 | 80 | h |
null | pytorch-main/c10/util/Half-inl.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/bit_cast.h>
#include <cstring>
#include <limits>
#ifdef __CUDACC__
#include <cuda_fp16.h>
#endif
#ifdef __HIPCC__
#include <hip/hip_fp16.h>
#endif
#if defined(CL_SYCL_LANGUAGE_VERSION)
#include <CL/sycl.hpp> // for SYCL 1.2.1
#elif defined(SYCL_LANGUAG... | 9,355 | 27.43769 | 80 | h |
null | pytorch-main/c10/util/Half.h | #pragma once
/// Defines the Half type (half-precision floating-point) including conversions
/// to standard C types and basic arithmetic operations. Note that arithmetic
/// operations are implemented by converting to floating point and
/// performing the operation in float32, instead of using CUDA half intrinsics.
/... | 20,342 | 36.122263 | 80 | h |
null | pytorch-main/c10/util/IdWrapper.h | #pragma once
#include <c10/macros/Macros.h>
#include <cstddef>
#include <functional>
#include <utility>
namespace c10 {
/**
* This template simplifies generation of simple classes that wrap an id
* in a typesafe way. Namely, you can use it to create a very lightweight
* type that only offers equality comparators ... | 2,367 | 28.974684 | 80 | h |
null | pytorch-main/c10/util/LeftRight.h | #include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/Synchronized.h>
#include <array>
#include <atomic>
#include <mutex>
#include <thread>
namespace c10 {
namespace detail {
struct IncrementRAII final {
public:
explicit IncrementRAII(std::atomic<int32_t>* counter) : _counter(counter) {
... | 7,157 | 31.243243 | 80 | h |
null | pytorch-main/c10/util/Load.h | #pragma once
#include <c10/macros/Macros.h>
#include <cstring>
namespace c10 {
namespace detail {
template <typename T>
struct LoadImpl {
C10_HOST_DEVICE static T apply(const void* src) {
return *reinterpret_cast<const T*>(src);
}
};
template <>
struct LoadImpl<bool> {
C10_HOST_DEVICE static bool apply(con... | 908 | 22.307692 | 66 | h |
null | pytorch-main/c10/util/Logging.h | #ifndef C10_UTIL_LOGGING_H_
#define C10_UTIL_LOGGING_H_
#include <climits>
#include <exception>
#include <functional>
#include <limits>
#include <sstream>
#include <c10/macros/Macros.h>
#include <c10/util/Exception.h>
#include <c10/util/Flags.h>
#include <c10/util/StringUtil.h>
// CAFFE2_LOG_THRESHOLD is a compile t... | 11,624 | 35.102484 | 80 | h |
null | pytorch-main/c10/util/MathConstants.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/BFloat16.h>
#include <c10/util/Half.h>
C10_CLANG_DIAGNOSTIC_PUSH()
#if C10_CLANG_HAS_WARNING("-Wimplicit-float-conversion")
C10_CLANG_DIAGNOSTIC_IGNORE("-Wimplicit-float-conversion")
#endif
namespace c10 {
// TODO: Replace me with inline constexpr variab... | 3,690 | 24.811189 | 80 | h |
null | pytorch-main/c10/util/MaybeOwned.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/Exception.h>
#include <c10/util/in_place.h>
#include <type_traits>
namespace c10 {
/// MaybeOwnedTraits<T> describes how to borrow from T. Here is how we
/// can implement borrowing from an arbitrary type T using a raw
/// pointer to const:
template <t... | 6,737 | 28.423581 | 75 | h |
null | pytorch-main/c10/util/Metaprogramming.h | #pragma once
#include <c10/util/Array.h>
#include <c10/util/TypeList.h>
#include <functional>
#include <type_traits>
namespace c10 {
namespace guts {
/**
* Access information about result type or arguments from a function type.
* Example:
* using A = function_traits<int (float, double)>::return_type // A == int
... | 7,037 | 29.868421 | 102 | h |
null | pytorch-main/c10/util/OptionalArrayRef.h | // This file defines OptionalArrayRef<T>, a class that has almost the same
// exact functionality as c10::optional<ArrayRef<T>>, except that its
// converting constructor fixes a dangling pointer issue.
//
// The implicit converting constructor of both c10::optional<ArrayRef<T>> and
// std::optional<ArrayRef<T>> can ca... | 6,834 | 28.461207 | 77 | h |
null | pytorch-main/c10/util/Registry.h | #ifndef C10_UTIL_REGISTRY_H_
#define C10_UTIL_REGISTRY_H_
/**
* Simple registry implementation that uses static variables to
* register object creators during program initialization time.
*/
// NB: This Registry works poorly when you have other namespaces.
// Make all macro invocations from inside the at namespace... | 13,166 | 39.143293 | 82 | h |
null | pytorch-main/c10/util/ScopeExit.h | #pragma once
#include <type_traits>
#include <utility>
namespace c10 {
/**
* Mostly copied from https://llvm.org/doxygen/ScopeExit_8h_source.html
*/
template <typename Callable>
class scope_exit {
Callable ExitFunction;
bool Engaged = true; // False once moved-from or release()d.
public:
template <typename... | 1,345 | 23.925926 | 79 | h |
null | pytorch-main/c10/util/StringUtil.h | #ifndef C10_UTIL_STRINGUTIL_H_
#define C10_UTIL_STRINGUTIL_H_
#include <c10/macros/Macros.h>
#include <c10/util/string_utils.h>
#include <c10/util/string_view.h>
#include <cstddef>
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
C10_CLANG_DIAGNOSTIC_PUSH()
#if C10_CLANG_HAS_WARNING("-Wshort... | 4,710 | 22.206897 | 78 | h |
null | pytorch-main/c10/util/Synchronized.h | #pragma once
#include <mutex>
#include <c10/util/C++17.h>
namespace c10 {
/**
* A very simple Synchronization class for error-free use of data
* in a multi-threaded context. See folly/docs/Synchronized.md for
* the inspiration of this class.
*
* Full URL:
* https://github.com/facebook/folly/blob/main/folly/do... | 1,946 | 29.421875 | 73 | h |
null | pytorch-main/c10/util/ThreadLocal.h | #pragma once
#include <c10/macros/Macros.h>
/**
* Android versions with libgnustl incorrectly handle thread_local C++
* qualifier with composite types. NDK up to r17 version is affected.
*
* (A fix landed on Jun 4 2018:
* https://android-review.googlesource.com/c/toolchain/gcc/+/683601)
*
* In such cases, use ... | 3,883 | 24.220779 | 80 | h |
null | pytorch-main/c10/util/ThreadLocalDebugInfo.h | #pragma once
#include <c10/macros/Export.h>
#include <memory>
#include <string>
namespace c10 {
enum class C10_API_ENUM DebugInfoKind : uint8_t {
PRODUCER_INFO = 0,
MOBILE_RUNTIME_INFO,
PROFILER_STATE,
INFERENCE_CONTEXT, // for inference usage
PARAM_COMMS_INFO,
TEST_INFO, // used only in tests
TEST_I... | 2,547 | 29.333333 | 77 | h |
null | pytorch-main/c10/util/TypeCast.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/BFloat16.h>
#include <c10/util/Half.h>
#include <type_traits>
C10_CLANG_DIAGNOSTIC_PUSH()
#if C10_CLANG_HAS_WARNING("-Wimplicit-float-conversion")
C10_CLANG_DIAGNOSTIC_IGNORE("-Wimplicit-float-conversion")
#endif
#if C10_CLANG_HAS_WARNING("-Wimplicit-int-... | 3,958 | 31.186992 | 80 | h |
null | pytorch-main/c10/util/TypeIndex.h | #pragma once
#include <c10/util/C++17.h>
#include <c10/util/ConstexprCrc.h>
#include <c10/util/IdWrapper.h>
#include <c10/util/string_view.h>
#include <cinttypes>
#include <functional>
namespace c10 {
namespace util {
// TODO Make it work for more compilers
// Intel compiler works
#if defined(__INTEL_COMPILER)
#def... | 6,033 | 29.629442 | 102 | h |
null | pytorch-main/c10/util/TypeSafeSignMath.h | #pragma once
#include <c10/macros/Macros.h>
#include <limits>
#include <type_traits>
C10_CLANG_DIAGNOSTIC_PUSH()
#if C10_CLANG_HAS_WARNING("-Wstring-conversion")
C10_CLANG_DIAGNOSTIC_IGNORE("-Wstring-conversion")
#endif
#if C10_CLANG_HAS_WARNING("-Wimplicit-int-float-conversion")
C10_CLANG_DIAGNOSTIC_IGNORE("-Wimplic... | 4,437 | 29.606897 | 80 | h |
null | pytorch-main/c10/util/TypeTraits.h | #pragma once
#include <c10/util/C++17.h>
namespace c10 {
namespace guts {
/**
* is_equality_comparable<T> is true_type iff the equality operator is defined
* for T.
*/
template <class T, class Enable = void>
struct is_equality_comparable : std::false_type {};
template <class T>
struct is_equality_comparable<
... | 5,346 | 33.947712 | 80 | h |
null | pytorch-main/c10/util/UniqueVoidPtr.h | #pragma once
#include <memory>
#include <c10/macros/Macros.h>
namespace c10 {
using DeleterFnPtr = void (*)(void*);
namespace detail {
// Does not delete anything
C10_API void deleteNothing(void*);
// A detail::UniqueVoidPtr is an owning smart pointer like unique_ptr, but
// with three major differences:
//
// ... | 4,115 | 31.928 | 80 | h |
null | pytorch-main/c10/util/Unroll.h | #pragma once
#include <c10/macros/Macros.h>
// Utility to guarantee complete unrolling of a loop where the bounds are known
// at compile time. Various pragmas achieve similar effects, but are not as
// portable across compilers.
// Example: c10::ForcedUnroll<4>{}(f); is equivalent to f(0); f(1); f(2); f(3);
namespa... | 667 | 21.266667 | 79 | h |
null | pytorch-main/c10/util/accumulate.h | // Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <c10/util/ArrayRef.h>
#include <iterator>
#include <numeric>
#include <type_traits>
namespace c10 {
/// Sum of a list of integers; accumulates into the int64_t datatype
template <
typename C,
typename std::enable_if<
std... | 4,209 | 30.185185 | 79 | h |
null | pytorch-main/c10/util/bit_cast.h | #pragma once
#include <cstring>
#include <type_traits>
namespace c10 {
// Implementations of std::bit_cast() from C++ 20.
//
// This is a less sketchy version of reinterpret_cast.
//
// See https://en.cppreference.com/w/cpp/numeric/bit_cast for more
// information as well as the source of our implementations.
templa... | 836 | 25.15625 | 76 | h |
null | pytorch-main/c10/util/bits.h | #pragma once
#include <cstdint>
#include <c10/macros/Macros.h>
namespace c10 {
/**
* bits1x8 is an uninterpreted dtype of a tensor with 1 bit (packed to byte
* boundary), without any semantics defined.
*/
struct alignas(1) bits1x8 {
using underlying = uint8_t;
uint8_t val_;
bits1x8() = default;
C10_HOST_D... | 1,449 | 22.387097 | 76 | h |
null | pytorch-main/c10/util/complex.h | #pragma once
#include <complex>
#include <c10/macros/Macros.h>
#if defined(__CUDACC__) || defined(__HIPCC__)
#include <thrust/complex.h>
#endif
C10_CLANG_DIAGNOSTIC_PUSH()
#if C10_CLANG_HAS_WARNING("-Wimplicit-float-conversion")
C10_CLANG_DIAGNOSTIC_IGNORE("-Wimplicit-float-conversion")
#endif
#if C10_CLANG_HAS_WAR... | 18,019 | 28.017713 | 80 | h |
null | pytorch-main/c10/util/complex_math.h | #if !defined(C10_INTERNAL_INCLUDE_COMPLEX_REMAINING_H)
#error \
"c10/util/complex_math.h is not meant to be individually included. Include c10/util/complex.h instead."
#endif
namespace c10_complex_math {
// Exponential functions
template <typename T>
C10_HOST_DEVICE inline c10::complex<T> exp(const c10::complex<... | 11,849 | 29.779221 | 107 | h |
null | pytorch-main/c10/util/complex_utils.h | #if !defined(C10_INTERNAL_INCLUDE_COMPLEX_REMAINING_H)
#error \
"c10/util/complex_utils.h is not meant to be individually included. Include c10/util/complex.h instead."
#endif
#include <limits>
namespace c10 {
template <typename T>
struct is_complex : public std::false_type {};
template <typename T>
struct is_c... | 1,077 | 21.93617 | 108 | h |
null | pytorch-main/c10/util/copysign.h | #pragma once
#include <c10/util/BFloat16.h>
#include <c10/util/Half.h>
#include <c10/util/math_compat.h>
namespace c10 {
// Note: Explicit implementation of copysign for Half and BFloat16
// is needed to workaround g++-7/8 crash on aarch64, but also makes
// copysign faster for the half-precision types
template <typ... | 866 | 28.896552 | 76 | h |
null | pytorch-main/c10/util/either.h | // Originally taken from
// https://github.com/cryfs/cryfs/blob/14ad22570ddacef22d5ff139cdff68a54fc8234d/src/cpp-utils/either.h
#pragma once
#include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/Optional.h>
namespace c10 {
/**
* either<A, B> is a tagged union that holds either an object of t... | 6,423 | 27.807175 | 102 | h |
null | pytorch-main/c10/util/env.h | #pragma once
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <cstring>
namespace c10 {
namespace utils {
// Reads an environment variable and returns
// - optional<true>, if set equal to "1"
// - optional<false>, if set equal to "0"
// - nullopt, otherwise
//
// NB:
... | 956 | 21.255814 | 75 | h |
null | pytorch-main/c10/util/hash.h | #pragma once
#include <functional>
#include <iomanip>
#include <sstream>
#include <vector>
#include <c10/util/ArrayRef.h>
#include <c10/util/complex.h>
namespace c10 {
// NOTE: hash_combine and SHA1 hashing is based on implementation from Boost
//
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Pe... | 10,584 | 28.07967 | 80 | h |
null | pytorch-main/c10/util/int128.h | // This file is based on the uint128 implementation of protobuf at
// https://github.com/protocolbuffers/protobuf/blob/1e88936fce10cf773cb72b44c6a7f48b38c7578b/src/google/protobuf/stubs/int128.h
//
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://deve... | 12,442 | 30.263819 | 127 | h |
null | pytorch-main/c10/util/irange.h | // Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <c10/util/Exception.h>
#include <c10/util/TypeSafeSignMath.h>
#include <algorithm>
#include <iterator>
#include <limits>
#include <type_traits>
namespace c10 {
namespace detail {
template <
typename I,
bool one_sided = false,
... | 3,465 | 26.078125 | 79 | h |
null | pytorch-main/c10/util/logging_is_google_glog.h | #ifndef C10_UTIL_LOGGING_IS_GOOGLE_GLOG_H_
#define C10_UTIL_LOGGING_IS_GOOGLE_GLOG_H_
#include <map>
#include <set>
#include <vector>
#include <iomanip> // because some of the caffe2 code uses e.g. std::setw
// Using google glog. For glog 0.3.2 versions, stl_logging.h needs to be before
// logging.h to actually use s... | 3,794 | 33.5 | 80 | h |
null | pytorch-main/c10/util/logging_is_not_google_glog.h | #ifndef C10_UTIL_LOGGING_IS_NOT_GOOGLE_GLOG_H_
#define C10_UTIL_LOGGING_IS_NOT_GOOGLE_GLOG_H_
#include <chrono>
#include <climits>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <c10/util/Flags.h>
const char CAFFE2_... | 8,664 | 32.455598 | 80 | h |
null | pytorch-main/c10/util/math_compat.h | #pragma once
#include <cmath>
// Android NDK platform < 21 with libstdc++ has spotty C++11 support.
// Various hacks in this header allow the rest of the codebase to use
// standard APIs.
#if (defined(__ANDROID__) && __ANDROID_API__ < 21 && defined(__GLIBCXX__)) || \
defined(__NEWLIB__)
#include <stdexcept>
name... | 7,552 | 28.389105 | 79 | h |
null | pytorch-main/c10/util/overloaded.h | #pragma once
namespace c10 {
namespace detail {
template <class... Ts>
struct overloaded_t {};
template <class T0>
struct overloaded_t<T0> : T0 {
using T0::operator();
overloaded_t(T0 t0) : T0(std::move(t0)) {}
};
template <class T0, class... Ts>
struct overloaded_t<T0, Ts...> : T0, overloaded_t<Ts...> {
using... | 709 | 21.903226 | 78 | h |
null | pytorch-main/c10/util/reverse_iterator.h | #pragma once
/**
* A constexpr std::reverse_iterator for C++11.
* Implementation taken from libstdc++,
* https://raw.githubusercontent.com/gcc-mirror/gcc/gcc-9_2_0-release/libstdc%2B%2B-v3/include/bits/stl_iterator.h
* adapted to our code base and constexpr'ified.
*/
// Copyright (C) 2001-2019 Free Software Foun... | 8,566 | 28.541379 | 114 | h |
null | pytorch-main/c10/util/safe_numerics.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/ArrayRef.h>
#include <iterator>
#include <numeric>
#include <type_traits>
// GCC has __builtin_mul_overflow from before it supported __has_builtin
#ifdef _MSC_VER
#define C10_HAS_BUILTIN_OVERFLOW() (0)
#include <c10/util/llvmMathExtras.h>
#include <intrin... | 2,332 | 23.819149 | 80 | h |
null | pytorch-main/c10/util/signal_handler.h | #pragma once
#include <atomic>
#include <csignal>
#include <mutex>
#include <c10/macros/Export.h>
#if defined(__APPLE__)
#define C10_SUPPORTS_SIGNAL_HANDLER
#elif defined(__linux__) && !defined(C10_DISABLE_SIGNAL_HANDLERS)
#define C10_SUPPORTS_FATAL_SIGNAL_HANDLERS
#define C10_SUPPORTS_SIGNAL_HANDLER
#endif
#if def... | 3,119 | 28.433962 | 79 | h |
null | pytorch-main/c10/util/ssize.h | #pragma once
#include <c10/util/Exception.h>
#include <c10/util/TypeSafeSignMath.h>
#include <cstddef>
#include <type_traits>
namespace c10 {
// Implementations of std::ssize() from C++ 20.
//
// This is useful in particular for avoiding -Werror=sign-compare
// issues.
//
// Use this with argument-dependent lookup,... | 1,339 | 28.130435 | 76 | h |
null | pytorch-main/c10/util/strides.h | #pragma once
#include <c10/util/ArrayRef.h>
#include <c10/util/DimVector.h>
namespace c10 {
// Computes the contiguous strides of a tensor, given its sizes.
static inline DimVector contiguous_strides(const IntArrayRef sizes) {
using Int = IntArrayRef::value_type;
const Int dims = static_cast<Int>(sizes.size());
... | 616 | 24.708333 | 69 | h |
null | pytorch-main/c10/util/string_utils.h | #pragma once
#include <sstream>
#include <stdexcept>
#include <string>
namespace c10 {
// to_string, stoi and stod implementation for Android related stuff.
// Note(jiayq): Do not use the CAFFE2_TESTONLY_FORCE_STD_STRING_TEST macro
// outside testing code that lives under common_test.cc
#if defined(__ANDROID__) || d... | 3,989 | 26.902098 | 80 | h |
null | pytorch-main/c10/util/string_view.h | #pragma once
#include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/reverse_iterator.h>
#include <algorithm>
#include <cstring>
#include <limits>
#include <stdexcept>
#include <string>
#if __cpp_lib_string_view
#include <string_view>
#define C10_HAS_STD_STRING_VIEW() 1
#define C10_HAS_STD_EXPER... | 20,018 | 27.845821 | 85 | h |
null | pytorch-main/c10/util/tempfile.h | #pragma once
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <utility>
#include <vector>
#if !defined(_WIN32)
#include <unistd.h>
#else // defined(_WIN32)
#include <Windows.h>
#include <fileapi.h>
#end... | 6,047 | 29.089552 | 80 | h |
null | pytorch-main/c10/util/typeid.h | #pragma once
#include <atomic>
#include <cstdlib>
#include <memory>
#include <mutex>
#include <type_traits>
#include <vector>
#include <c10/macros/Macros.h>
#include <c10/util/Exception.h>
#include <c10/util/IdWrapper.h>
#include <c10/util/TypeIndex.h>
#include <c10/util/TypeTraits.h>
#include <c10/core/ScalarType.h... | 23,293 | 31.716292 | 80 | h |
null | pytorch-main/caffe2/contrib/aten/aten_op_template.h | #pragma once
#include <unordered_map>
#include <string>
#include <ATen/Functions.h>
#include <c10/macros/Macros.h>
#include <c10/util/irange.h>
#include <caffe2/core/context.h>
#include <caffe2/core/operator.h>
#include <caffe2/utils/math.h>
#include <iostream>
// a map from descriptor strings (see [DESCRIPTORS])
// t... | 7,515 | 30.579832 | 97 | h |
null | pytorch-main/caffe2/contrib/fakelowp/batch_matmul_fp16_fake_op.h | #ifndef CAFFE2_OPERATORS_BATCH_MATMUL_OP_H_
#define CAFFE2_OPERATORS_BATCH_MATMUL_OP_H_
#include <ATen/Utils.h>
#include <c10/util/accumulate.h>
#include <fbgemm/FbgemmConvert.h>
#include "caffe2/contrib/fakelowp/fp16_gemm_utils.h"
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include <algorith... | 12,655 | 27.698413 | 79 | h |
null | pytorch-main/caffe2/contrib/fakelowp/fp16_fc_acc_op.h | /**
* Copyright (c) 2016-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... | 11,795 | 28.56391 | 80 | h |
null | pytorch-main/caffe2/contrib/fakelowp/fp16_gemm_utils.h | // Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include "caffe2/core/context.h"
#include "caffe2/utils/math.h"
namespace caffe2 {
void custom_fp16_gemm(
const int m,
const int k,
const int n,
const float* A_fp16,
const float* B_fp16,
const float beta,
float* C,
co... | 1,992 | 23.304878 | 61 | h |
null | pytorch-main/caffe2/contrib/fakelowp/int8_dequantize_op_nnpi.h | #ifndef CAFFE2_OPERATORS_INT8_DEQUANTIZE_OP_H_
#define CAFFE2_OPERATORS_INT8_DEQUANTIZE_OP_H_
#include <fbgemm/FbgemmConvert.h>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/tensor_int8.h"
#include "caffe2/operators/quantized/int8_utils.h"
C10_DECLARE_bool(caffe2_fbgemm_fake... | 1,343 | 22.172414 | 76 | h |
null | pytorch-main/caffe2/contrib/fakelowp/int8_quantize_op_nnpi.h | #ifndef CAFFE2_OPERATORS_INT8_QUANTIZE_OP_H_
#define CAFFE2_OPERATORS_INT8_QUANTIZE_OP_H_
#include <fbgemm/FbgemmConvert.h>
#include <cmath>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/tensor_int8.h"
#include "caffe2/operators/quantized/int8_utils.h"
#include "fp16_fma.h"
... | 2,859 | 25.238532 | 76 | h |
null | pytorch-main/caffe2/contrib/fakelowp/int8_swish_op_nnpi.h | #ifndef CAFFE2_OPERATORS_INT8_SWISH_OP_H_
#define CAFFE2_OPERATORS_INT8_SWISH_OP_H_
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/tensor_int8.h"
#include "caffe2/operators/quantized/int8_utils.h"
namespace caffe2 {
namespace int8 {
namespace {
using namespace std;
void Swi... | 2,150 | 23.443182 | 74 | h |
null | pytorch-main/caffe2/contrib/fakelowp/layernorm_fp16_fake_op.h | #pragma once
#include <algorithm>
#include <array>
#include <functional>
#include <string>
#include <vector>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include <fbgemm/FbgemmConvert.h>
#include "caffe2/utils/eigen_utils.h"
#include "caffe2/utils/math.h"
#include "fp16_fma.h"
C10_DECLARE_boo... | 6,155 | 28.596154 | 95 | h |
null | pytorch-main/caffe2/contrib/fakelowp/lengths_reducer_fused_4bit_rowwise_fp16_fake_op.h | #pragma once
#include <immintrin.h>
#include "caffe2/perfkernels/fused_8bit_rowwise_embedding_lookup.h"
#include "fp16_fma.h"
#include "lengths_reducer_ops.h"
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp);
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp_denorms);
namespace caffe2 {
template <
class Context,
... | 7,210 | 32.230415 | 80 | h |
null | pytorch-main/caffe2/contrib/fakelowp/lengths_reducer_fused_8bit_rowwise_fp16_fake_op.h | #pragma once
#include "caffe2/perfkernels/fused_8bit_rowwise_embedding_lookup.h"
#include "fp16_fma.h"
#include "lengths_reducer_ops.h"
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp);
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp_denorms);
namespace caffe2 {
template <
class Context,
bool with_weights = 0... | 10,661 | 33.063898 | 80 | h |
null | pytorch-main/caffe2/contrib/fakelowp/lengths_reducer_ops.h | #pragma once
#include <fbgemm/FbgemmConvert.h>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/perfkernels/typed_axpy.h"
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp);
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp_denorms);
namespace caffe2 {
// A templated class that implemen... | 9,405 | 33.966543 | 80 | h |
null | pytorch-main/caffe2/contrib/fakelowp/quant_lut_fp16_fake_op.h | #pragma once
#include <array>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/tensor_int8.h"
#include "caffe2/operators/quantized/int8_utils.h"
#include <immintrin.h>
#include <emmintrin.h>
namespace caffe2 {
namespace {
class TanhInt8QuantizeNNPIOp final : public Operato... | 2,539 | 26.608696 | 85 | h |
null | pytorch-main/caffe2/contrib/fakelowp/spatial_batch_norm_fp16_fake_op.h | #pragma once
#include <algorithm>
#include <array>
#include <functional>
#include <string>
#include <vector>
#include <fbgemm/FbgemmConvert.h>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/utils/eigen_utils.h"
#include "caffe2/utils/math.h"
#include "fp16_fma.h"
C10_DECLARE_bool... | 11,829 | 28.873737 | 80 | h |
null | pytorch-main/caffe2/contrib/fakelowp/sum_fp16_fake_op.h | #pragma once
#include <caffe2/core/operator.h>
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp);
namespace caffe2 {
template <class Context>
class SumFP16FP16AccOp : public Operator<Context> {
public:
USE_OPERATOR_CONTEXT_FUNCTIONS;
USE_SIMPLE_CTOR_DTOR(SumFP16FP16AccOp);
bool DoRunWithFloat() {
auto& in... | 1,861 | 25.6 | 74 | h |
null | pytorch-main/caffe2/contrib/fakelowp/unary_fp16_fake_op.h | #pragma once
#include <vector>
#include <fbgemm/FbgemmConvert.h>
#include "caffe2/operators/elementwise_ops.h"
#include "caffe2/utils/eigen_utils.h"
#include "caffe2/utils/math.h"
C10_DECLARE_bool(caffe2_fbgemm_fake_fp16_clamp);
namespace caffe2 {
using namespace std;
template <class Context>
struct ReluFakeFp16Fun... | 2,211 | 28.493333 | 79 | h |
null | pytorch-main/caffe2/contrib/gloo/allgather_ops.h | /**
* Copyright (c) 2017-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... | 3,834 | 28.274809 | 78 | h |
null | pytorch-main/caffe2/contrib/gloo/allreduce_ops.h | #pragma once
#include <algorithm>
#include "caffe2/contrib/gloo/common.h"
#include "caffe2/core/operator.h"
#include "caffe2/utils/math.h"
#include <gloo/algorithm.h>
#include <gloo/common/error.h>
#include <gloo/context.h>
namespace caffe2 {
namespace gloo {
template <class Context>
class AllreduceOp final : publ... | 3,705 | 26.451852 | 78 | h |
null | pytorch-main/caffe2/contrib/gloo/barrier_ops.h | #pragma once
#include "caffe2/contrib/gloo/common.h"
#include "caffe2/core/operator.h"
#include <gloo/algorithm.h>
#include <gloo/barrier_all_to_one.h>
#include <gloo/common/error.h>
#include <gloo/context.h>
namespace caffe2 {
namespace gloo {
template <class Context>
class BarrierOp final : public Operator<Contex... | 1,703 | 25.625 | 78 | h |
null | pytorch-main/caffe2/contrib/gloo/broadcast_ops.h | #pragma once
#include <algorithm>
#include "caffe2/contrib/gloo/common.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/types.h"
#include <gloo/algorithm.h>
#include <gloo/common/error.h>
#include <gloo/context.h>
namespace caffe2 {
namespace gloo {
template <class Context>
class BroadcastOp final : publ... | 3,185 | 27.19469 | 78 | h |
null | pytorch-main/caffe2/contrib/gloo/common.h | #pragma once
#include <exception>
#include "caffe2/core/blob.h"
#include <gloo/config.h>
#include <gloo/context.h>
#include <gloo/transport/device.h>
namespace caffe2 {
namespace gloo {
TORCH_API void signalFailure(Blob* status_blob, std::exception& exception);
struct createDeviceAttr {
// "tcp" or "ibverbs"
... | 1,685 | 21.783784 | 75 | h |
null | pytorch-main/caffe2/contrib/gloo/common_world_ops.h | #pragma once
#include "caffe2/contrib/gloo/common.h"
#include "caffe2/contrib/gloo/store_handler.h"
#include "caffe2/core/operator.h"
#include "caffe2/distributed/store_handler.h"
#include <gloo/common/error.h>
#include <gloo/config.h>
#include <gloo/rendezvous/context.h>
#include <gloo/rendezvous/prefix_store.h>
#i... | 7,206 | 27.828 | 79 | h |
null | pytorch-main/caffe2/contrib/gloo/reduce_scatter_ops.h | /**
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... | 3,977 | 29.136364 | 80 | h |
null | pytorch-main/caffe2/contrib/gloo/store_handler.h | #pragma once
#include "caffe2/core/common.h"
#include "caffe2/distributed/store_handler.h"
#include <gloo/rendezvous/store.h>
namespace caffe2 {
namespace gloo {
class TORCH_API StoreHandlerWrapper : public ::gloo::rendezvous::Store {
public:
explicit StoreHandlerWrapper(StoreHandler& handler) : handler_(handler... | 858 | 22.861111 | 76 | h |
null | pytorch-main/caffe2/contrib/nccl/cuda_nccl_gpu.h | #pragma once
#include <cstddef>
#include "caffe2/core/common_gpu.h"
#include "caffe2/core/context_gpu.h"
#include "caffe2/core/logging.h"
#include <nccl.h>
#include <unordered_map>
#define NCCL_VERSION_MIN(major, minor, patch) \
((NCCL_MAJOR > major) || \
((NCCL_MAJOR == major) && ... | 1,706 | 25.671875 | 68 | h |
null | pytorch-main/caffe2/contrib/opencl/context.h | #ifndef CAFFE2_OPENCL_CONTEXT_H_
#define CAFFE2_OPENCL_CONTEXT_H_
#include "caffe2/core/context.h"
#define CL_HPP_ENABLE_EXCEPTIONS 1
#define CL_HPP_CL_1_2_DEFAULT_BUILD 1
#define CL_HPP_TARGET_OPENCL_VERSION 120
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
//#include "libopencl.h"
#if defined(__APPLE__) || defined(__MA... | 2,892 | 26.552381 | 106 | h |
null | pytorch-main/caffe2/contrib/prof/prof_dag_stats_op.h | #ifndef CAFFE2_OPERATORS_FULLY_CONNECTED_OP_H_
#define CAFFE2_OPERATORS_FULLY_CONNECTED_OP_H_
#include "caffe2/core/context.h"
#include "caffe2/core/net_async_base.h"
#include "caffe2/core/operator.h"
#include "caffe2/utils/math.h"
namespace caffe2 {
// This operator outputs the prof_dag stats
template <typename T, ... | 2,699 | 29.337079 | 80 | h |
null | pytorch-main/caffe2/contrib/shm_mutex/shm_mutex.h | /*
* This implements a machine-wide mutex to be used
* to synchronize CUDA calls (memory allocation and frees) and
* NCCL calls. This prevents a potential deadlock that
* can occur.
*
* The implementation has a few caveats:
* - it assumes that PID are not reused
* - there is a possible race between the crea... | 10,098 | 28.357558 | 80 | h |
null | pytorch-main/caffe2/contrib/tensorrt/tensorrt_op_trt.h | #pragma once
#include "caffe2/contrib/tensorrt/trt_utils.h"
#include "caffe2/core/context_gpu.h"
#include "caffe2/core/operator.h"
#include <NvInfer.h>
#include <unordered_map>
namespace caffe2 {
class TensorRTOp final : public Operator<CUDAContext> {
public:
USE_OPERATOR_FUNCTIONS(CUDAContext);
TensorRTOp(con... | 911 | 25.823529 | 74 | h |
null | pytorch-main/caffe2/contrib/tensorrt/tensorrt_tranformer.h | #pragma once
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
#include "caffe2/core/common.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/workspace.h"
#include "caffe2/onnx/onnx_exporter.h"
#include "caffe2/proto/caffe2_pb.h"
#include "onnx/onnx_pb.h"
namespace caffe2 {
TO... | 2,944 | 30.666667 | 79 | h |
null | pytorch-main/caffe2/contrib/tensorrt/trt_utils.h | #pragma once
#include <iostream>
#include <NvInfer.h>
#include "caffe2/core/logging.h"
namespace caffe2 { namespace tensorrt {
// Logger for GIE info/warning/errors
class TrtLogger : public nvinfer1::ILogger {
using nvinfer1::ILogger::Severity;
public:
TrtLogger(Severity verbosity = Severity::kWARNING) : _v... | 1,267 | 21.642857 | 82 | h |
null | pytorch-main/caffe2/contrib/warpctc/ctc_op.h | #pragma once
#include <ctc.h>
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/utils/math.h"
#include "caffe2/core/common_cudnn.h"
#define CTC_CHECK(condition) \
do { \
ctcStatus_t status = condition; \
CAFFE_ENFORCE_EQ( ... | 3,860 | 29.164063 | 77 | h |
null | pytorch-main/caffe2/core/blob.h | #ifndef CAFFE2_CORE_BLOB_H_
#define CAFFE2_CORE_BLOB_H_
#include <cstddef>
#include <sstream>
#include <typeinfo>
#include <type_traits>
#include <vector>
#include "caffe2/core/common.h"
#include <ATen/core/blob.h>
#include <c10/util/typeid.h>
#include "caffe2/core/logging.h"
#include "caffe2/core/tensor.h"
#include ... | 4,090 | 30.229008 | 130 | h |
null | pytorch-main/caffe2/core/blob_serialization.h | #ifndef CAFFE2_CORE_BLOB_SERIALIZATION_H_
#define CAFFE2_CORE_BLOB_SERIALIZATION_H_
#include <limits>
#include <future>
#include <google/protobuf/repeated_field.h>
#include "caffe2/core/blob.h"
#include "caffe2/core/blob_serializer_base.h"
#include "caffe2/core/tensor.h"
#include <c10/util/irange.h>
#include <c10/u... | 10,832 | 34.172078 | 80 | h |
null | pytorch-main/caffe2/core/blob_serializer_base.h | #pragma once
#include <string>
#include <functional>
#include <c10/util/Registry.h>
#include <c10/util/string_view.h>
#include "caffe2/core/common.h"
#include "caffe2/proto/caffe2_pb.h"
namespace caffe2 {
class Blob;
// Constants for use in the BlobSerializationOptions chunk_size field.
// These should ideally be ... | 3,905 | 32.384615 | 80 | h |
null | pytorch-main/caffe2/core/blob_stats.h | #pragma once
#include "c10/util/Registry.h"
#include "caffe2/core/blob.h"
#include <c10/util/typeid.h>
#include <unordered_map>
namespace caffe2 {
struct BlobStatGetter {
virtual size_t sizeBytes(const Blob& blob) const = 0;
virtual ~BlobStatGetter() {}
};
struct BlobStatRegistry {
private:
std::unordered_m... | 1,127 | 23 | 75 | h |
null | pytorch-main/caffe2/core/common.h | #ifndef CAFFE2_CORE_COMMON_H_
#define CAFFE2_CORE_COMMON_H_
#include <algorithm>
#include <cmath>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
#if defined(_MSC_V... | 4,329 | 27.486842 | 80 | h |
null | pytorch-main/caffe2/core/common_cudnn.h | #ifndef CAFFE2_CORE_COMMON_CUDNN_H_
#define CAFFE2_CORE_COMMON_CUDNN_H_
#include <array>
#include <mutex>
#include "caffe2/core/common.h"
#include "caffe2/core/context.h"
#include "caffe2/core/logging.h"
#include "caffe2/core/types.h"
#ifndef CAFFE2_USE_CUDNN
#error("This Caffe2 install is not built with cudnn, so y... | 9,893 | 29.726708 | 109 | h |
null | pytorch-main/caffe2/core/common_gpu.h | #ifndef CAFFE2_CORE_COMMON_GPU_H_
#define CAFFE2_CORE_COMMON_GPU_H_
#include <assert.h>
#include <cuda.h>
#include <cuda_runtime.h>
#if !defined(USE_ROCM)
#ifdef __GNUC__
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#e... | 21,462 | 43.529046 | 90 | h |
null | pytorch-main/caffe2/core/context.h | #ifndef CAFFE2_CORE_CONTEXT_H_
#define CAFFE2_CORE_CONTEXT_H_
#include <cstdlib>
#include <ctime>
#include <random>
#include <unordered_map>
#include <c10/util/typeid.h>
#include "caffe2/core/allocator.h"
#include "caffe2/core/context_base.h"
#include "caffe2/core/event.h"
#include "caffe2/core/logging.h"
#include "c... | 6,208 | 26.232456 | 80 | h |
null | pytorch-main/caffe2/core/context_base.h | #pragma once
#include <array>
#include <cstdlib>
#include <ctime>
#include <memory>
#include <unordered_map>
#include <c10/macros/Macros.h>
#include <c10/core/Allocator.h>
#include <c10/util/typeid.h>
#include <c10/util/Exception.h>
#include <c10/util/Registry.h>
#include <c10/core/CopyBytes.h>
#include "caffe2/core... | 4,382 | 24.934911 | 85 | h |
null | pytorch-main/caffe2/core/context_gpu.h | #ifndef CAFFE2_CORE_CONTEXT_GPU_H_
#define CAFFE2_CORE_CONTEXT_GPU_H_
#include <ctime>
#include <mutex>
#include "caffe2/core/common.h"
#include "caffe2/core/common_gpu.h"
#include "caffe2/core/context.h"
#include "caffe2/core/context_base.h"
#include "caffe2/core/logging.h"
#include "caffe2/core/numa.h"
#include "ca... | 11,432 | 31.205634 | 93 | h |
null | pytorch-main/caffe2/core/cudnn_wrappers.h | // Copyright 2004-present Facebook. All Rights Reserved.
#ifndef CAFFE2_CORE_CUDNN_WRAPPERS_H_
#define CAFFE2_CORE_CUDNN_WRAPPERS_H_
#include "caffe2/core/common_cudnn.h"
#include "caffe2/core/context_gpu.h"
// Note [What is CuDNNWrapper good for?]
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Suppose you are writing ... | 6,962 | 33.815 | 85 | h |
null | pytorch-main/caffe2/core/db.h | #ifndef CAFFE2_CORE_DB_H_
#define CAFFE2_CORE_DB_H_
#include <mutex>
#include <c10/util/Registry.h>
#include <c10/util/irange.h>
#include <c10/util/string_view.h>
#include "caffe2/core/blob_serialization.h"
#include "caffe2/proto/caffe2_pb.h"
namespace caffe2 {
namespace db {
/**
* The mode of the database, whethe... | 9,473 | 27.029586 | 80 | h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.