/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
c10
/
util
/
/usr/local/lib64/python3.6/site-packages/torch/include/c10/util
mkdir
upload
Name
Size
Mode
Actions
accumulate.h
4205
0644
edit
dl
rm
AlignOf.h
4835
0644
edit
dl
rm
Array.h
11354
0644
edit
dl
rm
ArrayRef.h
9058
0644
edit
dl
rm
Backtrace.h
364
0644
edit
dl
rm
BFloat16-inl.h
9222
0644
edit
dl
rm
BFloat16-math.h
5217
0644
edit
dl
rm
BFloat16.h
2372
0644
edit
dl
rm
Bitset.h
3414
0644
edit
dl
rm
C++17.h
13329
0644
edit
dl
rm
complex.h
17542
0644
edit
dl
rm
complex_math.h
10902
0644
edit
dl
rm
complex_utils.h
958
0644
edit
dl
rm
ConstexprCrc.h
6633
0644
edit
dl
rm
copysign.h
866
0644
edit
dl
rm
DeadlockDetection.h
1920
0644
edit
dl
rm
Deprecated.h
3579
0644
edit
dl
rm
either.h
6423
0644
edit
dl
rm
env.h
835
0644
edit
dl
rm
Exception.h
24723
0644
edit
dl
rm
ExclusivelyOwned.h
4759
0644
edit
dl
rm
Flags.h
10056
0644
edit
dl
rm
flat_hash_map.h
61655
0644
edit
dl
rm
FunctionRef.h
2301
0644
edit
dl
rm
Half-inl.h
8674
0644
edit
dl
rm
Half.h
18965
0644
edit
dl
rm
hash.h
5084
0644
edit
dl
rm
IdWrapper.h
2348
0644
edit
dl
rm
intrusive_ptr.h
35563
0644
edit
dl
rm
in_place.h
350
0644
edit
dl
rm
irange.h
2679
0644
edit
dl
rm
LeftRight.h
6016
0644
edit
dl
rm
llvmMathExtras.h
29168
0644
edit
dl
rm
Logging.h
11256
0644
edit
dl
rm
logging_is_google_glog.h
2031
0644
edit
dl
rm
logging_is_not_google_glog.h
8271
0644
edit
dl
rm
MathConstants.h
858
0644
edit
dl
rm
math_compat.h
7296
0644
edit
dl
rm
MaybeOwned.h
6689
0644
edit
dl
rm
Metaprogramming.h
15288
0644
edit
dl
rm
numa.h
696
0644
edit
dl
rm
Optional.h
35592
0644
edit
dl
rm
order_preserving_flat_hash_map.h
65482
0644
edit
dl
rm
overloaded.h
709
0644
edit
dl
rm
python_stub.h
56
0644
edit
dl
rm
qint8.h
472
0644
edit
dl
rm
qint32.h
319
0644
edit
dl
rm
quint4x2.h
366
0644
edit
dl
rm
quint8.h
320
0644
edit
dl
rm
Registry.h
12242
0644
edit
dl
rm
reverse_iterator.h
8796
0644
edit
dl
rm
ScopeExit.h
1345
0644
edit
dl
rm
signal_handler.h
3154
0644
edit
dl
rm
SmallBuffer.h
1243
0644
edit
dl
rm
SmallVector.h
34456
0644
edit
dl
rm
sparse_bitset.h
26511
0644
edit
dl
rm
StringUtil.h
4538
0644
edit
dl
rm
string_utils.h
3989
0644
edit
dl
rm
string_view.h
20189
0644
edit
dl
rm
tempfile.h
6029
0644
edit
dl
rm
ThreadLocal.h
3883
0644
edit
dl
rm
ThreadLocalDebugInfo.h
2603
0644
edit
dl
rm
thread_name.h
148
0644
edit
dl
rm
Type.h
607
0644
edit
dl
rm
TypeCast.h
6972
0644
edit
dl
rm
typeid.h
18793
0644
edit
dl
rm
TypeIndex.h
5251
0644
edit
dl
rm
TypeList.h
16901
0644
edit
dl
rm
TypeTraits.h
5368
0644
edit
dl
rm
Unicode.h
295
0644
edit
dl
rm
UniqueVoidPtr.h
4117
0644
edit
dl
rm
Unroll.h
667
0644
edit
dl
rm
variant.h
95182
0644
edit
dl
rm
win32-headers.h
858
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/c10/util/hash.h
(5084B)
#pragma once #include <c10/util/ArrayRef.h> #include <c10/util/complex.h> #include <functional> #include <vector> namespace c10 { // NOTE: hash_combine is based on implementation from Boost // // Boost Software License - Version 1.0 - August 17th, 2003 // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. inline size_t hash_combine(size_t seed, size_t value) { return seed ^ (value + 0x9e3779b9 + (seed << 6u) + (seed >> 2u)); } //////////////////////////////////////////////////////////////////////////////// // c10::hash implementation //////////////////////////////////////////////////////////////////////////////// namespace _hash_detail { // Use template argument deduction to shorten calls to c10::hash template <typename T> size_t simple_get_hash(const T& o); template <typename T, typename V> using type_if_not_enum = typename std::enable_if<!std::is_enum<T>::value, V>::type; // Use SFINAE to dispatch to std::hash if possible, cast enum types to int // automatically, and fall back to T::hash otherwise. NOTE: C++14 added support // for hashing enum types to the standard, and some compilers implement it even // when C++14 flags aren't specified. This is why we have to disable this // overload if T is an enum type (and use the one below in this case). template <typename T> auto dispatch_hash(const T& o) -> decltype(std::hash<T>()(o), type_if_not_enum<T, size_t>()) { return std::hash<T>()(o); } template <typename T> typename std::enable_if<std::is_enum<T>::value, size_t>::type dispatch_hash( const T& o) { using R = typename std::underlying_type<T>::type; return std::hash<R>()(static_cast<R>(o)); } template <typename T> auto dispatch_hash(const T& o) -> decltype(T::hash(o), size_t()) { return T::hash(o); } } // namespace _hash_detail // Hasher struct template <typename T> struct hash { size_t operator()(const T& o) const { return _hash_detail::dispatch_hash(o); }; }; // Specialization for std::tuple template <typename... Types> struct hash<std::tuple<Types...>> { template <size_t idx, typename... Ts> struct tuple_hash { size_t operator()(const std::tuple<Ts...>& t) const { return hash_combine( _hash_detail::simple_get_hash(std::get<idx>(t)), tuple_hash<idx - 1, Ts...>()(t)); } }; template <typename... Ts> struct tuple_hash<0, Ts...> { size_t operator()(const std::tuple<Ts...>& t) const { return _hash_detail::simple_get_hash(std::get<0>(t)); } }; size_t operator()(const std::tuple<Types...>& t) const { return tuple_hash<sizeof...(Types) - 1, Types...>()(t); } }; template <typename T> struct hash<c10::ArrayRef<T>> { size_t operator()(c10::ArrayRef<T> v) const { size_t seed = 0; for (const auto& elem : v) { seed = hash_combine(seed, _hash_detail::simple_get_hash(elem)); } return seed; } }; // Specialization for std::vector template <typename T> struct hash<std::vector<T>> { size_t operator()(const std::vector<T>& v) const { return hash<c10::ArrayRef<T>>()(v); } }; namespace _hash_detail { template <typename T> size_t simple_get_hash(const T& o) { return c10::hash<T>()(o); } } // namespace _hash_detail // Use this function to actually hash multiple things in one line. // Dispatches to c10::hash, so it can hash containers. // Example: // // static size_t hash(const MyStruct& s) { // return get_hash(s.member1, s.member2, s.member3); // } template <typename... Types> size_t get_hash(const Types&... args) { return c10::hash<decltype(std::tie(args...))>()(std::tie(args...)); } // Specialization for c10::complex template <typename T> struct hash<c10::complex<T>> { size_t operator()(const c10::complex<T>& c) const { return get_hash(c.real(), c.imag()); } }; } // namespace c10
Save
cmd:
run