Compare commits

...

1 Commits

Author SHA1 Message Date
8be8f194df [Codemod][Modernize Containers] fbcode//caffe2:torch_sources [B] [A]
Reviewed By: dtolnay

Differential Revision: D78957093
2025-07-25 02:43:14 -07:00
2 changed files with 4 additions and 4 deletions

View File

@ -269,7 +269,7 @@ bool IValue::overlaps(const IValue& rhs) const {
rhs.getSubValues(rhsSubValues);
getSubValues(thisSubValues);
for (auto& sub : thisSubValues) {
if (rhsSubValues.count(sub)) {
if (rhsSubValues.contains(sub)) {
return true;
}
}
@ -889,7 +889,7 @@ IValue IValue::deepcopy(std::optional<at::Device> device) const {
IValue IValue::deepcopy(
IValue::HashIdentityIValueMap& memo,
std::optional<at::Device> device) const {
if (memo.count(*this)) {
if (memo.contains(*this)) {
return memo.at(*this);
}
IValue copy;

View File

@ -106,7 +106,7 @@ struct CUDACachingHostAllocatorImpl
// Update the statistics on the time spent on cudaHostAlloc/hostRegister
{
std::lock_guard<std::mutex> g(stats_.timing_mutex_);
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(use_host_register.count(*ptr) == 0);
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(!use_host_register.contains(*ptr));
use_host_register[*ptr] = use_register;
stats_.host_alloc_time.increase(duration.count());
}
@ -121,7 +121,7 @@ struct CUDACachingHostAllocatorImpl
bool use_register = false;
{
std::lock_guard<std::mutex> g(stats_.timing_mutex_);
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(use_host_register.count(ptr) == 1);
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(use_host_register.contains(ptr));
use_register = use_host_register[ptr];
}
if (use_register) {