/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
ATen
/
core
/
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/core
mkdir
upload
Name
Size
Mode
Actions
boxing/
-
0755
rm
dispatch/
-
0755
rm
op_registration/
-
0755
rm
alias_info.h
2986
0644
edit
dl
rm
Array.h
768
0644
edit
dl
rm
ATenGeneral.h
45
0644
edit
dl
rm
ATenOpList.h
246
0644
edit
dl
rm
aten_interned_strings.h
25389
0644
edit
dl
rm
Backtrace.h
59
0644
edit
dl
rm
blob.h
5422
0644
edit
dl
rm
builtin_function.h
3649
0644
edit
dl
rm
DeprecatedTypeProperties.h
3773
0644
edit
dl
rm
DeprecatedTypePropertiesRegistry.h
795
0644
edit
dl
rm
Dict.h
13195
0644
edit
dl
rm
Dict_inl.h
7996
0644
edit
dl
rm
Dimname.h
1188
0644
edit
dl
rm
DimVector.h
247
0644
edit
dl
rm
DistributionsHelper.h
12594
0644
edit
dl
rm
Formatting.h
959
0644
edit
dl
rm
function.h
2145
0644
edit
dl
rm
functional.h
1460
0644
edit
dl
rm
function_schema.h
13577
0644
edit
dl
rm
function_schema_inl.h
9319
0644
edit
dl
rm
Generator.h
4935
0644
edit
dl
rm
grad_mode.h
210
0644
edit
dl
rm
interned_strings.h
25332
0644
edit
dl
rm
interned_strings_class.h
770
0644
edit
dl
rm
ivalue.h
38823
0644
edit
dl
rm
ivalue_inl.h
59963
0644
edit
dl
rm
ivalue_to.h
756
0644
edit
dl
rm
jit_type.h
75971
0644
edit
dl
rm
jit_type_base.h
6508
0644
edit
dl
rm
LegacyTypeDispatch.h
4626
0644
edit
dl
rm
List.h
15667
0644
edit
dl
rm
List_inl.h
11012
0644
edit
dl
rm
Macros.h
44
0644
edit
dl
rm
MT19937RNGEngine.h
6410
0644
edit
dl
rm
NamedTensor.h
5050
0644
edit
dl
rm
operator_name.h
3018
0644
edit
dl
rm
PhiloxRNGEngine.h
6496
0644
edit
dl
rm
PythonModeTLS.h
403
0644
edit
dl
rm
qualified_name.h
4358
0644
edit
dl
rm
QuantizerBase.h
2443
0644
edit
dl
rm
Range.h
418
0644
edit
dl
rm
Reduction.h
461
0644
edit
dl
rm
rref_interface.h
1144
0644
edit
dl
rm
Scalar.h
29
0644
edit
dl
rm
ScalarType.h
33
0644
edit
dl
rm
stack.h
6034
0644
edit
dl
rm
Tensor.h
1756
0644
edit
dl
rm
TensorAccessor.h
10296
0644
edit
dl
rm
TensorBase.h
32767
0644
edit
dl
rm
TensorBody.h
247555
0644
edit
dl
rm
TransformationHelper.h
6911
0644
edit
dl
rm
typeid.h
29
0644
edit
dl
rm
UndefinedTensorImpl.h
42
0644
edit
dl
rm
UnsafeFromTH.h
708
0644
edit
dl
rm
VariableHooksInterface.h
3312
0644
edit
dl
rm
Variadic.h
2257
0644
edit
dl
rm
Vitals.h
2305
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/core/Dict_inl.h
(7996B)
#pragma once #include <ATen/core/ivalue.h> #include <c10/util/hash.h> namespace c10 { namespace detail { inline bool DictKeyEqualTo::operator()(const IValue& lhs, const IValue& rhs) const { if (lhs.isTensor() && rhs.isTensor()) { // for tensors, we compare only by identity (following how it's done in Python). return lhs.is(rhs); } // Otherwise, we first compare by identity for efficiency, then by value (see: // [container equality]) return _fastEqualsForContainer(lhs, rhs); } } template<class T> TypePtr getTypePtr(); std::string toString(TypePtr typePtr); namespace impl { template<class Key, class Value> Dict<Key, Value> toTypedDict(GenericDict dict) { TORCH_INTERNAL_ASSERT(*getTypePtr<Key>() == *dict.impl_->elementTypes.keyType, "Tried to cast a Dict<", toString(dict.impl_->elementTypes.keyType), ", ", toString(dict.impl_->elementTypes.valueType) ,"> to a Dict<", toString(getTypePtr<Key>()), ", ", toString(getTypePtr<Value>()), ">. Key types mismatch."); TORCH_INTERNAL_ASSERT(*getTypePtr<Value>() == *dict.impl_->elementTypes.valueType, "Tried to cast a Dict<", toString(dict.impl_->elementTypes.keyType), ", ", toString(dict.impl_->elementTypes.valueType) ,"> to a Dict<", toString(getTypePtr<Key>()), ", ", toString(getTypePtr<Value>()), ">. Value types mismatch."); return Dict<Key, Value>(std::move(dict.impl_)); } template<class Key, class Value> GenericDict toGenericDict(Dict<Key, Value> dict) { return GenericDict(std::move(dict.impl_)); } } namespace detail { inline size_t DictKeyHash::operator()(const IValue& ivalue) const { if (ivalue.isInt()) { return std::hash<int64_t>()(ivalue.toInt()); } else if (ivalue.isString()) { return std::hash<c10::string_view>()(ivalue.toStringView()); } else if (ivalue.isDouble()) { return std::hash<double>()(ivalue.toDouble()); } else if (ivalue.isComplexDouble()) { return c10::hash<c10::complex<double>>()(ivalue.toComplexDouble()); } else if (ivalue.isBool()) { return std::hash<bool>()(ivalue.toBool()); } else if (ivalue.isTensor()) { return std::hash<TensorImpl*>()(ivalue.toTensor().unsafeGetTensorImpl()); } else if (ivalue.isDevice()) { return std::hash<Device>()(ivalue.toDevice()); } else { throw std::runtime_error( "Can't hash IValues with tag '" + ivalue.tagKind() + "'"); } } inline intrusive_ptr<DictImpl> DictImpl::copy() const { return make_intrusive<DictImpl>(dict, elementTypes); } } template<class Key, class Value> Dict<Key, Value>::Dict() :Dict(make_intrusive<detail::DictImpl>( detail::DictImpl::dict_map_type(), detail::DictImpl::DictElementTypes{getTypePtr<Key>(), getTypePtr<Value>()})) { static_assert(!std::is_same<Key, IValue>::value, "This constructor is not valid for Dict<IValue, _>. Please use c10::impl::GenericDict(keyType, valueType) instead."); static_assert(!std::is_same<Value, IValue>::value, "This constructor is not valid for Dict<_, IValue>. Please use c10::impl::GenericDict(keyType, valueType) instead."); } template<class Key, class Value> Dict<Key, Value>::Dict(TypePtr keyType, TypePtr valueType) : Dict(make_intrusive<detail::DictImpl>( detail::DictImpl::dict_map_type(), detail::DictImpl::DictElementTypes {std::move(keyType), std::move(valueType)})) { static_assert(std::is_same<Key, IValue>::value, "This constructor is only valid for c10::impl::GenericDict."); static_assert(std::is_same<Value, IValue>::value, "This constructor is only valid for c10::impl::GenericDict."); } template<class Key, class Value> Dict<Key, Value>::Dict(Dict&& rhs) noexcept: impl_(std::move(rhs.impl_)) { rhs.impl_ = make_intrusive<detail::DictImpl>(detail::DictImpl::dict_map_type(), impl_->elementTypes); } template<class Key, class Value> Dict<Key, Value>::Dict(c10::intrusive_ptr<detail::DictImpl>&& impl): impl_(std::move(impl)) {} template<class Key, class Value> Dict<Key, Value>& Dict<Key, Value>::operator=(Dict&& rhs) noexcept { impl_ = std::move(rhs.impl_); rhs.impl_ = make_intrusive<detail::DictImpl>(detail::DictImpl::dict_map_type(), impl_->elementTypes); return *this; } template<class Key, class Value> Dict<Key, Value> Dict<Key, Value>::copy() const { return Dict<Key, Value>(impl_->copy()); } template<class Key, class Value> typename Dict<Key, Value>::iterator Dict<Key, Value>::begin() const { return iterator{impl_->dict.begin()}; } template<class Key, class Value> typename Dict<Key, Value>::iterator Dict<Key, Value>::end() const { return iterator{impl_->dict.end()}; } template<class Key, class Value> bool Dict<Key, Value>::empty() const { return impl_->dict.empty(); } template<class Key, class Value> typename Dict<Key, Value>::size_type Dict<Key, Value>::size() const { return impl_->dict.size(); } template<class Key, class Value> void Dict<Key, Value>::clear() const { impl_->dict.clear(); } template<class Key, class Value> template<class Key_, class Value_> std::pair<typename Dict<Key, Value>::iterator, bool> Dict<Key, Value>::insert(Key_&& key, Value_&& value) const { static_assert(std::is_constructible<Key, Key_>::value, "Wrong type for the key argument of Dict::insert"); static_assert(std::is_constructible<Value, Value_>::value, "Wrong type for the value argument of Dict::insert"); auto inserted = impl_->dict.insert(std::pair<IValue, IValue>{ Key(std::forward<Key_>(key)), Value(std::forward<Value_>(value))}); return {iterator{inserted.first}, inserted.second}; } template<class Key, class Value> template<class Key_, class Value_> std::pair<typename Dict<Key, Value>::iterator, bool> Dict<Key, Value>::insert_or_assign(Key_&& key, Value_&& value) const { static_assert(std::is_constructible<Key, Key_>::value, "Wrong type for the key argument of Dict::insert_or_assign"); static_assert(std::is_constructible<Value, Value_>::value, "Wrong type for the value argument of Dict::insert_or_assign"); auto inserted = impl_->dict.insert_or_assign( Key(std::forward<Key_>(key)), Value(std::forward<Value_>(value))); return {iterator{inserted.first}, inserted.second}; } template<class Key, class Value> void Dict<Key, Value>::erase(iterator iter) const { impl_->dict.erase(iter.entryRef_.iterator_); } template<class Key, class Value> C10_NODISCARD size_t Dict<Key, Value>::erase(const Key& key) const { return impl_->dict.erase(key); } template<class Key, class Value> Value Dict<Key, Value>::at(const Key& key) const { return impl_->dict.at(key).template to<Value>(); } template<class Key, class Value> typename Dict<Key, Value>::iterator Dict<Key, Value>::find(const Key& key) const { return iterator{impl_->dict.find(key)}; } template<class Key, class Value> bool Dict<Key, Value>::contains(const Key& key) const { return end() != find(key); } template<class Key, class Value> void Dict<Key, Value>::reserve(size_type count) const { impl_->dict.reserve(count); } template<class Key, class Value> TypePtr Dict<Key, Value>::keyType() const { return impl_->elementTypes.keyType; } template<class Key, class Value> TypePtr Dict<Key, Value>::valueType() const { return impl_->elementTypes.valueType; } template <class Key, class Value> void Dict<Key, Value>::unsafeSetKeyType(TypePtr t) { impl_->elementTypes.keyType = std::move(t); } template <class Key, class Value> void Dict<Key, Value>::unsafeSetValueType(TypePtr t) { impl_->elementTypes.valueType = std::move(t); } template <class Key_, class Value_> bool operator==(const Dict<Key_, Value_>& lhs, const Dict<Key_, Value_>& rhs) { // Dicts with the same identity trivially compare equal. if (lhs.impl_ == rhs.impl_) { return true; } // Otherwise compare the values return *lhs.impl_ == *rhs.impl_; } template <class Key_, class Value_> bool operator!=(const Dict<Key_, Value_>& lhs, const Dict<Key_, Value_>& rhs) { return !(lhs == rhs); } template <class Key, class Value> bool Dict<Key, Value>::is(const Dict& rhs) const { return this->impl_ == rhs.impl_; } }
Save
cmd:
run