mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
[1/N] Fix extra warnings brought by clang-tidy-17 (#137407)
Before we can use clang-tidy-17 Pull Request resolved: https://github.com/pytorch/pytorch/pull/137407 Approved by: https://github.com/Skylion007, https://github.com/aaronenyeshi
This commit is contained in:
@ -3658,9 +3658,7 @@ class NativeCachingAllocator : public CUDAAllocator {
|
|||||||
c10::DeviceIndex device,
|
c10::DeviceIndex device,
|
||||||
std::string& handle,
|
std::string& handle,
|
||||||
const DeviceCachingAllocator& allocator)
|
const DeviceCachingAllocator& allocator)
|
||||||
: device_(device),
|
: device_(device) {
|
||||||
expandable_segment_(nullptr),
|
|
||||||
cuda_ipc_ptr_(nullptr) {
|
|
||||||
int type = SHAREABLE_CUDA_MALLOC;
|
int type = SHAREABLE_CUDA_MALLOC;
|
||||||
std::istringstream ss(handle);
|
std::istringstream ss(handle);
|
||||||
if (handle.size() != CUDA_IPC_HANDLE_SIZE) {
|
if (handle.size() != CUDA_IPC_HANDLE_SIZE) {
|
||||||
@ -3710,8 +3708,8 @@ class NativeCachingAllocator : public CUDAAllocator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
c10::DeviceIndex device_;
|
c10::DeviceIndex device_;
|
||||||
ExpandableSegment* expandable_segment_;
|
ExpandableSegment* expandable_segment_{nullptr};
|
||||||
void* cuda_ipc_ptr_; // nullptr if expandable_segment_ is not null
|
void* cuda_ipc_ptr_{nullptr}; // nullptr if expandable_segment_ is not null
|
||||||
std::weak_ptr<void> wp_;
|
std::weak_ptr<void> wp_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@ void dummy() {}
|
|||||||
using dummy_ptr = TORCH_FN_TYPE(dummy);
|
using dummy_ptr = TORCH_FN_TYPE(dummy);
|
||||||
static_assert(c10::is_compile_time_function_pointer<dummy_ptr>::value);
|
static_assert(c10::is_compile_time_function_pointer<dummy_ptr>::value);
|
||||||
static_assert(dummy_ptr::func_ptr() == &dummy);
|
static_assert(dummy_ptr::func_ptr() == &dummy);
|
||||||
static_assert(std::is_same<void(), dummy_ptr::FuncType>::value);
|
static_assert(std::is_same_v<void(), dummy_ptr::FuncType>);
|
||||||
} // namespace test_access_through_type
|
} // namespace test_access_through_type
|
||||||
|
|
||||||
namespace test_access_through_value {
|
namespace test_access_through_value {
|
||||||
void dummy() {}
|
void dummy() {}
|
||||||
constexpr auto dummy_ptr = TORCH_FN(dummy);
|
constexpr auto dummy_ptr = TORCH_FN(dummy);
|
||||||
static_assert(dummy_ptr.func_ptr() == &dummy);
|
static_assert(dummy_ptr.func_ptr() == &dummy);
|
||||||
static_assert(std::is_same<void(), decltype(dummy_ptr)::FuncType>::value);
|
static_assert(std::is_same_v<void(), decltype(dummy_ptr)::FuncType>);
|
||||||
} // namespace test_access_through_value
|
} // namespace test_access_through_value
|
||||||
|
|
||||||
namespace test_access_through_type_also_works_if_specified_as_pointer {
|
namespace test_access_through_type_also_works_if_specified_as_pointer {
|
||||||
@ -29,14 +29,14 @@ void dummy() {}
|
|||||||
using dummy_ptr = TORCH_FN_TYPE(&dummy);
|
using dummy_ptr = TORCH_FN_TYPE(&dummy);
|
||||||
static_assert(c10::is_compile_time_function_pointer<dummy_ptr>::value);
|
static_assert(c10::is_compile_time_function_pointer<dummy_ptr>::value);
|
||||||
static_assert(dummy_ptr::func_ptr() == &dummy);
|
static_assert(dummy_ptr::func_ptr() == &dummy);
|
||||||
static_assert(std::is_same<void(), dummy_ptr::FuncType>::value);
|
static_assert(std::is_same_v<void(), dummy_ptr::FuncType>);
|
||||||
} // namespace test_access_through_type_also_works_if_specified_as_pointer
|
} // namespace test_access_through_type_also_works_if_specified_as_pointer
|
||||||
|
|
||||||
namespace test_access_through_value_also_works_if_specified_as_pointer {
|
namespace test_access_through_value_also_works_if_specified_as_pointer {
|
||||||
void dummy() {}
|
void dummy() {}
|
||||||
constexpr auto dummy_ptr = TORCH_FN(&dummy);
|
constexpr auto dummy_ptr = TORCH_FN(&dummy);
|
||||||
static_assert(dummy_ptr.func_ptr() == &dummy);
|
static_assert(dummy_ptr.func_ptr() == &dummy);
|
||||||
static_assert(std::is_same<void(), decltype(dummy_ptr)::FuncType>::value);
|
static_assert(std::is_same_v<void(), decltype(dummy_ptr)::FuncType>);
|
||||||
} // namespace test_access_through_value_also_works_if_specified_as_pointer
|
} // namespace test_access_through_value_also_works_if_specified_as_pointer
|
||||||
|
|
||||||
namespace test_run_through_type {
|
namespace test_run_through_type {
|
||||||
|
@ -34,7 +34,7 @@ TEST(LeftRightTest, givenVector_whenWritingReturnsValue_thenValueIsReturned) {
|
|||||||
LeftRight<vector<int>> obj;
|
LeftRight<vector<int>> obj;
|
||||||
|
|
||||||
auto a = obj.write([](vector<int>&) -> int { return 5; });
|
auto a = obj.write([](vector<int>&) -> int { return 5; });
|
||||||
static_assert(std::is_same<int, decltype(a)>::value);
|
static_assert(std::is_same_v<int, decltype(a)>);
|
||||||
EXPECT_EQ(5, a);
|
EXPECT_EQ(5, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ using is_my_movable_only_class =
|
|||||||
std::is_same<MovableOnly, std::remove_cv_t<std::remove_reference_t<T>>>;
|
std::is_same<MovableOnly, std::remove_cv_t<std::remove_reference_t<T>>>;
|
||||||
|
|
||||||
struct CopyCounting {
|
struct CopyCounting {
|
||||||
int move_count;
|
int move_count{0};
|
||||||
int copy_count;
|
int copy_count{0};
|
||||||
|
|
||||||
CopyCounting() : move_count(0), copy_count(0) {}
|
CopyCounting() {}
|
||||||
CopyCounting(const CopyCounting& rhs)
|
CopyCounting(const CopyCounting& rhs)
|
||||||
: move_count(rhs.move_count), copy_count(rhs.copy_count + 1) {}
|
: move_count(rhs.move_count), copy_count(rhs.copy_count + 1) {}
|
||||||
CopyCounting(CopyCounting&& rhs) noexcept
|
CopyCounting(CopyCounting&& rhs) noexcept
|
||||||
|
@ -149,7 +149,7 @@ TEST(ThreadLocalTest, TestObjectsAreReleased) {
|
|||||||
static std::atomic<int> ctors{0};
|
static std::atomic<int> ctors{0};
|
||||||
static std::atomic<int> dtors{0};
|
static std::atomic<int> dtors{0};
|
||||||
struct A {
|
struct A {
|
||||||
A() : i() {
|
A() {
|
||||||
++ctors;
|
++ctors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ TEST(ThreadLocalTest, TestObjectsAreReleased) {
|
|||||||
A(const A&) = delete;
|
A(const A&) = delete;
|
||||||
A& operator=(const A&) = delete;
|
A& operator=(const A&) = delete;
|
||||||
|
|
||||||
int i;
|
int i{};
|
||||||
};
|
};
|
||||||
|
|
||||||
C10_DEFINE_TLS_static(A, a);
|
C10_DEFINE_TLS_static(A, a);
|
||||||
@ -184,7 +184,7 @@ TEST(ThreadLocalTest, TestObjectsAreReleasedByNonstaticThreadLocal) {
|
|||||||
static std::atomic<int> ctors(0);
|
static std::atomic<int> ctors(0);
|
||||||
static std::atomic<int> dtors(0);
|
static std::atomic<int> dtors(0);
|
||||||
struct A {
|
struct A {
|
||||||
A() : i() {
|
A() {
|
||||||
++ctors;
|
++ctors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ TEST(ThreadLocalTest, TestObjectsAreReleasedByNonstaticThreadLocal) {
|
|||||||
A(const A&) = delete;
|
A(const A&) = delete;
|
||||||
A& operator=(const A&) = delete;
|
A& operator=(const A&) = delete;
|
||||||
|
|
||||||
int i;
|
int i{};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::atomic_bool b(false);
|
std::atomic_bool b(false);
|
||||||
|
@ -148,7 +148,7 @@ static_assert(
|
|||||||
static_assert(
|
static_assert(
|
||||||
string_view::npos ==
|
string_view::npos ==
|
||||||
get_fully_qualified_type_name<
|
get_fully_qualified_type_name<
|
||||||
typename std::remove_pointer<typename Type<int>::type>::type>()
|
std::remove_pointer_t<typename Type<int>::type>>()
|
||||||
.find("*"),
|
.find("*"),
|
||||||
"");
|
"");
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,79 +14,73 @@ static_assert(3 == size<typelist<int, float&, const MyClass&&>>::value, "");
|
|||||||
namespace test_from_tuple {
|
namespace test_from_tuple {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int, float&, const MyClass&&>,
|
typelist<int, float&, const MyClass&&>,
|
||||||
from_tuple_t<std::tuple<int, float&, const MyClass&&>>>::value,
|
from_tuple_t<std::tuple<int, float&, const MyClass&&>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(std::is_same<typelist<>, from_tuple_t<std::tuple<>>>::value, "");
|
static_assert(std::is_same_v<typelist<>, from_tuple_t<std::tuple<>>>, "");
|
||||||
} // namespace test_from_tuple
|
} // namespace test_from_tuple
|
||||||
|
|
||||||
namespace test_to_tuple {
|
namespace test_to_tuple {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
std::tuple<int, float&, const MyClass&&>,
|
std::tuple<int, float&, const MyClass&&>,
|
||||||
to_tuple_t<typelist<int, float&, const MyClass&&>>>::value,
|
to_tuple_t<typelist<int, float&, const MyClass&&>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(std::is_same<std::tuple<>, to_tuple_t<typelist<>>>::value, "");
|
static_assert(std::is_same_v<std::tuple<>, to_tuple_t<typelist<>>>, "");
|
||||||
} // namespace test_to_tuple
|
} // namespace test_to_tuple
|
||||||
|
|
||||||
namespace test_concat {
|
namespace test_concat {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(std::is_same<typelist<>, concat_t<>>::value, "");
|
static_assert(std::is_same_v<typelist<>, concat_t<>>, "");
|
||||||
static_assert(std::is_same<typelist<>, concat_t<typelist<>>>::value, "");
|
static_assert(std::is_same_v<typelist<>, concat_t<typelist<>>>, "");
|
||||||
|
static_assert(std::is_same_v<typelist<>, concat_t<typelist<>, typelist<>>>, "");
|
||||||
|
static_assert(std::is_same_v<typelist<int>, concat_t<typelist<int>>>, "");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, concat_t<typelist<>, typelist<>>>::value,
|
std::is_same_v<typelist<int>, concat_t<typelist<int>, typelist<>>>,
|
||||||
"");
|
|
||||||
static_assert(std::is_same<typelist<int>, concat_t<typelist<int>>>::value, "");
|
|
||||||
static_assert(
|
|
||||||
std::is_same<typelist<int>, concat_t<typelist<int>, typelist<>>>::value,
|
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<int>, concat_t<typelist<>, typelist<int>>>::value,
|
std::is_same_v<typelist<int>, concat_t<typelist<>, typelist<int>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int>,
|
typelist<int>,
|
||||||
concat_t<typelist<>, typelist<int>, typelist<>>>::value,
|
concat_t<typelist<>, typelist<int>, typelist<>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int, float&>,
|
typelist<int, float&>,
|
||||||
concat_t<typelist<int>, typelist<float&>>>::value,
|
concat_t<typelist<int>, typelist<float&>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int, float&>,
|
typelist<int, float&>,
|
||||||
concat_t<typelist<>, typelist<int, float&>, typelist<>>>::value,
|
concat_t<typelist<>, typelist<int, float&>, typelist<>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int, float&, const MyClass&&>,
|
typelist<int, float&, const MyClass&&>,
|
||||||
concat_t<
|
concat_t<typelist<>, typelist<int, float&>, typelist<const MyClass&&>>>,
|
||||||
typelist<>,
|
|
||||||
typelist<int, float&>,
|
|
||||||
typelist<const MyClass&&>>>::value,
|
|
||||||
"");
|
"");
|
||||||
} // namespace test_concat
|
} // namespace test_concat
|
||||||
|
|
||||||
namespace test_filter {
|
namespace test_filter {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, filter_t<std::is_reference, typelist<>>>::value,
|
std::is_same_v<typelist<>, filter_t<std::is_reference, typelist<>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<>,
|
typelist<>,
|
||||||
filter_t<std::is_reference, typelist<int, float, double, MyClass>>>::
|
filter_t<std::is_reference, typelist<int, float, double, MyClass>>>,
|
||||||
value,
|
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<float&, const MyClass&&>,
|
typelist<float&, const MyClass&&>,
|
||||||
filter_t<
|
filter_t<
|
||||||
std::is_reference,
|
std::is_reference,
|
||||||
typelist<int, float&, double, const MyClass&&>>>::value,
|
typelist<int, float&, double, const MyClass&&>>>,
|
||||||
"");
|
"");
|
||||||
} // namespace test_filter
|
} // namespace test_filter
|
||||||
|
|
||||||
@ -140,67 +134,63 @@ static_assert(!true_for_any_type<std::is_reference, typelist<>>::value, "");
|
|||||||
namespace test_map {
|
namespace test_map {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, map_t<std::add_lvalue_reference_t, typelist<>>>::
|
std::is_same_v<typelist<>, map_t<std::add_lvalue_reference_t, typelist<>>>,
|
||||||
value,
|
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int&>,
|
typelist<int&>,
|
||||||
map_t<std::add_lvalue_reference_t, typelist<int>>>::value,
|
map_t<std::add_lvalue_reference_t, typelist<int>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int&, double&, const MyClass&>,
|
typelist<int&, double&, const MyClass&>,
|
||||||
map_t<
|
map_t<
|
||||||
std::add_lvalue_reference_t,
|
std::add_lvalue_reference_t,
|
||||||
typelist<int, double, const MyClass>>>::value,
|
typelist<int, double, const MyClass>>>,
|
||||||
"");
|
"");
|
||||||
} // namespace test_map
|
} // namespace test_map
|
||||||
|
|
||||||
namespace test_head {
|
namespace test_head {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(std::is_same<int, head_t<typelist<int, double>>>::value, "");
|
static_assert(std::is_same_v<int, head_t<typelist<int, double>>>, "");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<const MyClass&, head_t<typelist<const MyClass&, double>>>::
|
std::is_same_v<const MyClass&, head_t<typelist<const MyClass&, double>>>,
|
||||||
value,
|
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<MyClass&&, head_t<typelist<MyClass&&, MyClass>>>::value,
|
std::is_same_v<MyClass&&, head_t<typelist<MyClass&&, MyClass>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(std::is_same<bool, head_t<typelist<bool>>>::value, "");
|
static_assert(std::is_same_v<bool, head_t<typelist<bool>>>, "");
|
||||||
} // namespace test_head
|
} // namespace test_head
|
||||||
|
|
||||||
namespace test_head_with_default {
|
namespace test_head_with_default {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<int, head_with_default_t<bool, typelist<int, double>>>::value,
|
std::is_same_v<int, head_with_default_t<bool, typelist<int, double>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
const MyClass&,
|
const MyClass&,
|
||||||
head_with_default_t<bool, typelist<const MyClass&, double>>>::value,
|
head_with_default_t<bool, typelist<const MyClass&, double>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
MyClass&&,
|
MyClass&&,
|
||||||
head_with_default_t<bool, typelist<MyClass&&, MyClass>>>::value,
|
head_with_default_t<bool, typelist<MyClass&&, MyClass>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<int, head_with_default_t<bool, typelist<int>>>::value,
|
std::is_same_v<int, head_with_default_t<bool, typelist<int>>>,
|
||||||
"");
|
|
||||||
static_assert(
|
|
||||||
std::is_same<bool, head_with_default_t<bool, typelist<>>>::value,
|
|
||||||
"");
|
"");
|
||||||
|
static_assert(std::is_same_v<bool, head_with_default_t<bool, typelist<>>>, "");
|
||||||
} // namespace test_head_with_default
|
} // namespace test_head_with_default
|
||||||
|
|
||||||
namespace test_reverse {
|
namespace test_reverse {
|
||||||
class MyClass {};
|
class MyClass {};
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int, double, MyClass*, const MyClass&&>,
|
typelist<int, double, MyClass*, const MyClass&&>,
|
||||||
reverse_t<typelist<const MyClass&&, MyClass*, double, int>>>::value,
|
reverse_t<typelist<const MyClass&&, MyClass*, double, int>>>,
|
||||||
"");
|
"");
|
||||||
static_assert(std::is_same<typelist<>, reverse_t<typelist<>>>::value, "");
|
static_assert(std::is_same_v<typelist<>, reverse_t<typelist<>>>, "");
|
||||||
} // namespace test_reverse
|
} // namespace test_reverse
|
||||||
|
|
||||||
namespace test_map_types_to_values {
|
namespace test_map_types_to_values {
|
||||||
@ -215,7 +205,7 @@ TEST(TypeListTest, MapTypesToValues_sametype) {
|
|||||||
auto sizes =
|
auto sizes =
|
||||||
map_types_to_values<typelist<int64_t, bool, uint32_t>>(map_to_size());
|
map_types_to_values<typelist<int64_t, bool, uint32_t>>(map_to_size());
|
||||||
std::tuple<size_t, size_t, size_t> expected(8, 1, 4);
|
std::tuple<size_t, size_t, size_t> expected(8, 1, 4);
|
||||||
static_assert(std::is_same<decltype(expected), decltype(sizes)>::value, "");
|
static_assert(std::is_same_v<decltype(expected), decltype(sizes)>, "");
|
||||||
EXPECT_EQ(expected, sizes);
|
EXPECT_EQ(expected, sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,9 +220,9 @@ TEST(TypeListTest, MapTypesToValues_differenttypes) {
|
|||||||
auto shared_ptrs =
|
auto shared_ptrs =
|
||||||
map_types_to_values<typelist<int, double>>(map_make_shared());
|
map_types_to_values<typelist<int, double>>(map_make_shared());
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
std::tuple<std::shared_ptr<int>, std::shared_ptr<double>>,
|
std::tuple<std::shared_ptr<int>, std::shared_ptr<double>>,
|
||||||
decltype(shared_ptrs)>::value,
|
decltype(shared_ptrs)>,
|
||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +248,7 @@ TEST(TypeListTest, MapTypesToValues_members) {
|
|||||||
auto result =
|
auto result =
|
||||||
map_types_to_values<typelist<Class1, Class2>>(mapper_call_func());
|
map_types_to_values<typelist<Class1, Class2>>(mapper_call_func());
|
||||||
std::tuple<int, double> expected(3, 2.0);
|
std::tuple<int, double> expected(3, 2.0);
|
||||||
static_assert(std::is_same<decltype(expected), decltype(result)>::value, "");
|
static_assert(std::is_same_v<decltype(expected), decltype(result)>, "");
|
||||||
EXPECT_EQ(expected, result);
|
EXPECT_EQ(expected, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +263,7 @@ TEST(TypeListTest, MapTypesToValues_empty) {
|
|||||||
auto result =
|
auto result =
|
||||||
map_types_to_values<typelist<>>(mapper_call_nonexistent_function());
|
map_types_to_values<typelist<>>(mapper_call_nonexistent_function());
|
||||||
std::tuple<> expected;
|
std::tuple<> expected;
|
||||||
static_assert(std::is_same<decltype(expected), decltype(result)>::value, "");
|
static_assert(std::is_same_v<decltype(expected), decltype(result)>, "");
|
||||||
EXPECT_EQ(expected, result);
|
EXPECT_EQ(expected, result);
|
||||||
}
|
}
|
||||||
} // namespace test_map_types_to_values
|
} // namespace test_map_types_to_values
|
||||||
@ -299,82 +289,75 @@ static_assert(!contains<typelist<>, double>::value, "");
|
|||||||
} // namespace test_contains
|
} // namespace test_contains
|
||||||
|
|
||||||
namespace test_take {
|
namespace test_take {
|
||||||
static_assert(std::is_same<typelist<>, take_t<typelist<>, 0>>::value, "");
|
static_assert(std::is_same_v<typelist<>, take_t<typelist<>, 0>>, "");
|
||||||
|
static_assert(std::is_same_v<typelist<>, take_t<typelist<int64_t>, 0>>, "");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, take_t<typelist<int64_t>, 0>>::value,
|
std::is_same_v<typelist<int64_t>, take_t<typelist<int64_t>, 1>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<int64_t>, take_t<typelist<int64_t>, 1>>::value,
|
std::is_same_v<typelist<>, take_t<typelist<int64_t, int32_t>, 0>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, take_t<typelist<int64_t, int32_t>, 0>>::value,
|
std::is_same_v<typelist<int64_t>, take_t<typelist<int64_t, int32_t>, 1>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<int64_t>, take_t<typelist<int64_t, int32_t>, 1>>::
|
std::is_same_v<
|
||||||
value,
|
|
||||||
"");
|
|
||||||
static_assert(
|
|
||||||
std::is_same<
|
|
||||||
typelist<int64_t, int32_t>,
|
typelist<int64_t, int32_t>,
|
||||||
take_t<typelist<int64_t, int32_t>, 2>>::value,
|
take_t<typelist<int64_t, int32_t>, 2>>,
|
||||||
"");
|
"");
|
||||||
} // namespace test_take
|
} // namespace test_take
|
||||||
|
|
||||||
namespace test_drop {
|
namespace test_drop {
|
||||||
static_assert(std::is_same<typelist<>, drop_t<typelist<>, 0>>::value, "");
|
static_assert(std::is_same_v<typelist<>, drop_t<typelist<>, 0>>, "");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<int64_t>, drop_t<typelist<int64_t>, 0>>::value,
|
std::is_same_v<typelist<int64_t>, drop_t<typelist<int64_t>, 0>>,
|
||||||
"");
|
"");
|
||||||
|
static_assert(std::is_same_v<typelist<>, drop_t<typelist<int64_t>, 1>>, "");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, drop_t<typelist<int64_t>, 1>>::value,
|
std::is_same_v<
|
||||||
"");
|
|
||||||
static_assert(
|
|
||||||
std::is_same<
|
|
||||||
typelist<int64_t, int32_t>,
|
typelist<int64_t, int32_t>,
|
||||||
drop_t<typelist<int64_t, int32_t>, 0>>::value,
|
drop_t<typelist<int64_t, int32_t>, 0>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<int32_t>, drop_t<typelist<int64_t, int32_t>, 1>>::
|
std::is_same_v<typelist<int32_t>, drop_t<typelist<int64_t, int32_t>, 1>>,
|
||||||
value,
|
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, drop_t<typelist<int64_t, int32_t>, 2>>::value,
|
std::is_same_v<typelist<>, drop_t<typelist<int64_t, int32_t>, 2>>,
|
||||||
"");
|
"");
|
||||||
} // namespace test_drop
|
} // namespace test_drop
|
||||||
|
|
||||||
namespace test_drop_if_nonempty {
|
namespace test_drop_if_nonempty {
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, drop_if_nonempty_t<typelist<>, 0>>::value,
|
std::is_same_v<typelist<>, drop_if_nonempty_t<typelist<>, 0>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<int64_t>, drop_if_nonempty_t<typelist<int64_t>, 0>>::
|
std::is_same_v<typelist<int64_t>, drop_if_nonempty_t<typelist<int64_t>, 0>>,
|
||||||
value,
|
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, drop_if_nonempty_t<typelist<int64_t>, 1>>::value,
|
std::is_same_v<typelist<>, drop_if_nonempty_t<typelist<int64_t>, 1>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int64_t, int32_t>,
|
typelist<int64_t, int32_t>,
|
||||||
drop_if_nonempty_t<typelist<int64_t, int32_t>, 0>>::value,
|
drop_if_nonempty_t<typelist<int64_t, int32_t>, 0>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<int32_t>,
|
typelist<int32_t>,
|
||||||
drop_if_nonempty_t<typelist<int64_t, int32_t>, 1>>::value,
|
drop_if_nonempty_t<typelist<int64_t, int32_t>, 1>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<>,
|
typelist<>,
|
||||||
drop_if_nonempty_t<typelist<int64_t, int32_t>, 2>>::value,
|
drop_if_nonempty_t<typelist<int64_t, int32_t>, 2>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<typelist<>, drop_if_nonempty_t<typelist<>, 1>>::value,
|
std::is_same_v<typelist<>, drop_if_nonempty_t<typelist<>, 1>>,
|
||||||
"");
|
"");
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<
|
std::is_same_v<
|
||||||
typelist<>,
|
typelist<>,
|
||||||
drop_if_nonempty_t<typelist<int64_t, int32_t>, 3>>::value,
|
drop_if_nonempty_t<typelist<int64_t, int32_t>, 3>>,
|
||||||
"");
|
"");
|
||||||
} // namespace test_drop_if_nonempty
|
} // namespace test_drop_if_nonempty
|
||||||
// NOLINTEND(modernize-unary-static-assert)
|
// NOLINTEND(modernize-unary-static-assert)
|
||||||
|
@ -15,8 +15,7 @@ TEST(FlagsTest, TestGflagsCorrectness) {
|
|||||||
FLAGS_c10_flags_test_only_flag = true;
|
FLAGS_c10_flags_test_only_flag = true;
|
||||||
EXPECT_EQ(FLAGS_c10_flags_test_only_flag, true);
|
EXPECT_EQ(FLAGS_c10_flags_test_only_flag, true);
|
||||||
#else // C10_USE_GFLAGS
|
#else // C10_USE_GFLAGS
|
||||||
std::cout << "Caffe2 is not built with gflags. Nothing to test here."
|
std::cout << "Caffe2 is not built with gflags. Nothing to test here." << '\n';
|
||||||
<< std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,8 +888,8 @@ TEST(SmallVectorCustomTest, NoAssignTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct MovedFrom {
|
struct MovedFrom {
|
||||||
bool hasValue;
|
bool hasValue{true};
|
||||||
MovedFrom() : hasValue(true) {}
|
MovedFrom() = default;
|
||||||
MovedFrom(MovedFrom&& m) noexcept : hasValue(m.hasValue) {
|
MovedFrom(MovedFrom&& m) noexcept : hasValue(m.hasValue) {
|
||||||
m.hasValue = false;
|
m.hasValue = false;
|
||||||
}
|
}
|
||||||
@ -1107,7 +1107,7 @@ class SmallVectorReferenceInvalidationTest : public SmallVectorTestBase {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static bool isValueType() {
|
static bool isValueType() {
|
||||||
return std::is_same<T, typename VectorT::value_type>::value;
|
return std::is_same_v<T, typename VectorT::value_type>;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
|
@ -30,7 +30,7 @@ TEST(ssizeTest, size_t) {
|
|||||||
|
|
||||||
TEST(ssizeTest, size_t_overflow) {
|
TEST(ssizeTest, size_t_overflow) {
|
||||||
#if defined(NDEBUG)
|
#if defined(NDEBUG)
|
||||||
GTEST_SKIP() << "Only valid if assert is enabled." << std::endl;
|
GTEST_SKIP() << "Only valid if assert is enabled." << '\n';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr auto ptrdiff_t_max =
|
constexpr auto ptrdiff_t_max =
|
||||||
@ -47,7 +47,7 @@ TEST(ssizeTest, small_container_promotes_to_ptrdiff_t) {
|
|||||||
|
|
||||||
TEST(ssizeTest, promotes_to_64_bit_on_32_bit_platform) {
|
TEST(ssizeTest, promotes_to_64_bit_on_32_bit_platform) {
|
||||||
if (sizeof(std::intptr_t) != 4) {
|
if (sizeof(std::intptr_t) != 4) {
|
||||||
GTEST_SKIP() << "Only valid in 64-bits." << std::endl;
|
GTEST_SKIP() << "Only valid in 64-bits." << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
auto signed_size = ssize(Container(std::uint64_t{3}));
|
auto signed_size = ssize(Container(std::uint64_t{3}));
|
||||||
|
@ -72,18 +72,18 @@ TEST(TypeMetaTest, TypeMeta) {
|
|||||||
|
|
||||||
class ClassAllowAssignment {
|
class ClassAllowAssignment {
|
||||||
public:
|
public:
|
||||||
ClassAllowAssignment() : x(42) {}
|
ClassAllowAssignment() = default;
|
||||||
ClassAllowAssignment(const ClassAllowAssignment& src) = default;
|
ClassAllowAssignment(const ClassAllowAssignment& src) = default;
|
||||||
ClassAllowAssignment& operator=(const ClassAllowAssignment& src) = default;
|
ClassAllowAssignment& operator=(const ClassAllowAssignment& src) = default;
|
||||||
int x;
|
int x{42};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClassNoAssignment {
|
class ClassNoAssignment {
|
||||||
public:
|
public:
|
||||||
ClassNoAssignment() : x(42) {}
|
ClassNoAssignment() = default;
|
||||||
ClassNoAssignment(const ClassNoAssignment& src) = delete;
|
ClassNoAssignment(const ClassNoAssignment& src) = delete;
|
||||||
ClassNoAssignment& operator=(const ClassNoAssignment& src) = delete;
|
ClassNoAssignment& operator=(const ClassNoAssignment& src) = delete;
|
||||||
int x;
|
int x{42};
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ bool IsAPIUsageDebugMode() {
|
|||||||
|
|
||||||
void APIUsageDebug(const string& event) {
|
void APIUsageDebug(const string& event) {
|
||||||
// use stderr to avoid messing with glog
|
// use stderr to avoid messing with glog
|
||||||
std::cerr << "PYTORCH_API_USAGE " << event << std::endl;
|
std::cerr << "PYTORCH_API_USAGE " << event << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
APIUsageLoggerType* GetAPIUsageLogger() {
|
APIUsageLoggerType* GetAPIUsageLogger() {
|
||||||
@ -393,12 +393,12 @@ bool InitCaffeLogging(int* argc, char** argv) {
|
|||||||
std::cerr << "InitCaffeLogging() has to be called after "
|
std::cerr << "InitCaffeLogging() has to be called after "
|
||||||
"c10::ParseCommandLineFlags. Modify your program to make sure "
|
"c10::ParseCommandLineFlags. Modify your program to make sure "
|
||||||
"of this."
|
"of this."
|
||||||
<< std::endl;
|
<< '\n';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (FLAGS_caffe2_log_level > GLOG_FATAL) {
|
if (FLAGS_caffe2_log_level > GLOG_FATAL) {
|
||||||
std::cerr << "The log level of Caffe2 has to be no larger than GLOG_FATAL("
|
std::cerr << "The log level of Caffe2 has to be no larger than GLOG_FATAL("
|
||||||
<< GLOG_FATAL << "). Capping it to GLOG_FATAL." << std::endl;
|
<< GLOG_FATAL << "). Capping it to GLOG_FATAL." << '\n';
|
||||||
FLAGS_caffe2_log_level = GLOG_FATAL;
|
FLAGS_caffe2_log_level = GLOG_FATAL;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -542,7 +542,7 @@ void setLogLevelFlagFromEnv() {
|
|||||||
<< "`TORCH_CPP_LOG_LEVEL` environment variable cannot be parsed. Valid values are "
|
<< "`TORCH_CPP_LOG_LEVEL` environment variable cannot be parsed. Valid values are "
|
||||||
"`INFO`, `WARNING`, `ERROR`, and `FATAL` or their numerical equivalents `0`, `1`, "
|
"`INFO`, `WARNING`, `ERROR`, and `FATAL` or their numerical equivalents `0`, `1`, "
|
||||||
"`2`, and `3`."
|
"`2`, and `3`."
|
||||||
<< std::endl;
|
<< '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -40,7 +40,7 @@ C10_EXPORT bool ParseCommandLineFlags(int* pargc, char*** pargv) {
|
|||||||
return true;
|
return true;
|
||||||
char** argv = *pargv;
|
char** argv = *pargv;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
GlobalInitStream() << "Parsing commandline arguments for c10." << std::endl;
|
GlobalInitStream() << "Parsing commandline arguments for c10." << '\n';
|
||||||
// write_head is the location we write the unused arguments to.
|
// write_head is the location we write the unused arguments to.
|
||||||
int write_head = 1;
|
int write_head = 1;
|
||||||
for (int i = 1; i < *pargc; ++i) {
|
for (int i = 1; i < *pargc; ++i) {
|
||||||
@ -48,11 +48,11 @@ C10_EXPORT bool ParseCommandLineFlags(int* pargc, char*** pargv) {
|
|||||||
|
|
||||||
if (arg.find("--help") != string::npos) {
|
if (arg.find("--help") != string::npos) {
|
||||||
// Print the help message, and quit.
|
// Print the help message, and quit.
|
||||||
std::cout << UsageMessage() << std::endl;
|
std::cout << UsageMessage() << '\n';
|
||||||
std::cout << "Arguments: " << std::endl;
|
std::cout << "Arguments: " << '\n';
|
||||||
for (const auto& help_msg : C10FlagsRegistry()->HelpMessage()) {
|
for (const auto& help_msg : C10FlagsRegistry()->HelpMessage()) {
|
||||||
std::cout << " " << help_msg.first << ": " << help_msg.second
|
std::cout << " " << help_msg.first << ": " << help_msg.second
|
||||||
<< std::endl;
|
<< '\n';
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ C10_EXPORT bool ParseCommandLineFlags(int* pargc, char*** pargv) {
|
|||||||
GlobalInitStream()
|
GlobalInitStream()
|
||||||
<< "C10 flag: commandline argument does not match --name=var "
|
<< "C10 flag: commandline argument does not match --name=var "
|
||||||
"or --name format: "
|
"or --name format: "
|
||||||
<< arg << ". Ignoring this argument." << std::endl;
|
<< arg << ". Ignoring this argument." << '\n';
|
||||||
argv[write_head++] = argv[i];
|
argv[write_head++] = argv[i];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -92,14 +92,14 @@ C10_EXPORT bool ParseCommandLineFlags(int* pargc, char*** pargv) {
|
|||||||
// If the flag is not registered, we will ignore it.
|
// If the flag is not registered, we will ignore it.
|
||||||
if (!C10FlagsRegistry()->Has(key)) {
|
if (!C10FlagsRegistry()->Has(key)) {
|
||||||
GlobalInitStream() << "C10 flag: unrecognized commandline argument: "
|
GlobalInitStream() << "C10 flag: unrecognized commandline argument: "
|
||||||
<< arg << std::endl;
|
<< arg << '\n';
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::unique_ptr<C10FlagParser> parser(
|
std::unique_ptr<C10FlagParser> parser(
|
||||||
C10FlagsRegistry()->Create(key, value));
|
C10FlagsRegistry()->Create(key, value));
|
||||||
if (!parser->success()) {
|
if (!parser->success()) {
|
||||||
GlobalInitStream() << "C10 flag: illegal argument: " << arg << std::endl;
|
GlobalInitStream() << "C10 flag: illegal argument: " << arg << '\n';
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ C10_EXPORT bool C10FlagParser::Parse<int>(const string& content, int* value) {
|
|||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
GlobalInitStream() << "C10 flag error: Cannot convert argument to int: "
|
GlobalInitStream() << "C10 flag error: Cannot convert argument to int: "
|
||||||
<< content << std::endl;
|
<< content << '\n';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ C10_EXPORT bool C10FlagParser::Parse<int64_t>(
|
|||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
GlobalInitStream() << "C10 flag error: Cannot convert argument to int: "
|
GlobalInitStream() << "C10 flag error: Cannot convert argument to int: "
|
||||||
<< content << std::endl;
|
<< content << '\n';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ C10_EXPORT bool C10FlagParser::Parse<double>(
|
|||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
GlobalInitStream() << "C10 flag error: Cannot convert argument to double: "
|
GlobalInitStream() << "C10 flag error: Cannot convert argument to double: "
|
||||||
<< content << std::endl;
|
<< content << '\n';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,12 +191,12 @@ C10_EXPORT bool C10FlagParser::Parse<bool>(const string& content, bool* value) {
|
|||||||
} else {
|
} else {
|
||||||
GlobalInitStream()
|
GlobalInitStream()
|
||||||
<< "C10 flag error: Cannot convert argument to bool: " << content
|
<< "C10 flag error: Cannot convert argument to bool: " << content
|
||||||
<< std::endl
|
<< '\n'
|
||||||
<< "Note that if you are passing in a bool flag, you need to "
|
<< "Note that if you are passing in a bool flag, you need to "
|
||||||
"explicitly specify it, like --arg=True or --arg True. Otherwise, "
|
"explicitly specify it, like --arg=True or --arg True. Otherwise, "
|
||||||
"the next argument may be inadvertently used as the argument, "
|
"the next argument may be inadvertently used as the argument, "
|
||||||
"causing the above error."
|
"causing the above error."
|
||||||
<< std::endl;
|
<< '\n';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ void FatalSignalHandler::stacktraceSignalHandler(bool needsLock) {
|
|||||||
::getpid(),
|
::getpid(),
|
||||||
tid,
|
tid,
|
||||||
c10::get_backtrace());
|
c10::get_backtrace());
|
||||||
std::cerr << backtrace << std::endl;
|
std::cerr << backtrace << '\n';
|
||||||
if (needsLock) {
|
if (needsLock) {
|
||||||
ul.unlock();
|
ul.unlock();
|
||||||
writingCond.notify_all();
|
writingCond.notify_all();
|
||||||
@ -229,7 +229,7 @@ void FatalSignalHandler::fatalSignalHandler(int signum) {
|
|||||||
if (std::cv_status::timeout == writingCond.wait_until(ul, now + 2s)) {
|
if (std::cv_status::timeout == writingCond.wait_until(ul, now + 2s)) {
|
||||||
if (!signalReceived) {
|
if (!signalReceived) {
|
||||||
std::cerr << "signal lost waiting for stacktrace " << pid << ":"
|
std::cerr << "signal lost waiting for stacktrace " << pid << ":"
|
||||||
<< tid << std::endl;
|
<< tid << '\n';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,8 @@ namespace detail {
|
|||||||
struct noop_gil_scoped_release {
|
struct noop_gil_scoped_release {
|
||||||
// user-defined constructor (i.e. not defaulted) to avoid
|
// user-defined constructor (i.e. not defaulted) to avoid
|
||||||
// unused-variable warnings at usage sites of this class
|
// unused-variable warnings at usage sites of this class
|
||||||
noop_gil_scoped_release() {}
|
// NOLINTNEXTLINE(modernize-use-equals-default)
|
||||||
|
noop_gil_scoped_release(){};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool release_gil>
|
template <bool release_gil>
|
||||||
|
@ -178,11 +178,11 @@ static PyObject* THPModule_initExtension(
|
|||||||
if (torch::get_symbolize_mode() == torch::unwind::Mode::addr2line) {
|
if (torch::get_symbolize_mode() == torch::unwind::Mode::addr2line) {
|
||||||
LOG(WARNING)
|
LOG(WARNING)
|
||||||
<< "symbolizing C++ stack trace for exception; if this hangs, rerun with TORCH_DISABLE_ADDR2LINE=1..."
|
<< "symbolizing C++ stack trace for exception; if this hangs, rerun with TORCH_DISABLE_ADDR2LINE=1..."
|
||||||
<< std::endl;
|
<< '\n';
|
||||||
}
|
}
|
||||||
auto s_tbs = torch::symbolize({tb.get()});
|
auto s_tbs = torch::symbolize({tb.get()});
|
||||||
std::stringstream oss;
|
std::stringstream oss;
|
||||||
oss << "C++ CapturedTraceback:" << std::endl;
|
oss << "C++ CapturedTraceback:" << '\n';
|
||||||
const auto& s_tb = s_tbs.tracebacks.at(0);
|
const auto& s_tb = s_tbs.tracebacks.at(0);
|
||||||
for (auto idx : c10::irange(s_tb.size())) {
|
for (auto idx : c10::irange(s_tb.size())) {
|
||||||
// Skip the first few frames:
|
// Skip the first few frames:
|
||||||
@ -195,7 +195,7 @@ static PyObject* THPModule_initExtension(
|
|||||||
auto frame_id = s_tb[idx];
|
auto frame_id = s_tb[idx];
|
||||||
const auto& frame = s_tbs.all_frames.at(frame_id);
|
const auto& frame = s_tbs.all_frames.at(frame_id);
|
||||||
oss << "#" << idx << " " << frame.funcname << " from " << frame.filename
|
oss << "#" << idx << " " << frame.funcname << " from " << frame.filename
|
||||||
<< ":" << frame.lineno << std::endl;
|
<< ":" << frame.lineno << '\n';
|
||||||
}
|
}
|
||||||
return oss.str();
|
return oss.str();
|
||||||
});
|
});
|
||||||
|
@ -202,7 +202,7 @@ static PyObject* THPStream_record_event(
|
|||||||
PyObject* kwargs) {
|
PyObject* kwargs) {
|
||||||
HANDLE_TH_ERRORS
|
HANDLE_TH_ERRORS
|
||||||
auto self = (THPStream*)_self;
|
auto self = (THPStream*)_self;
|
||||||
PyObject* _new_event;
|
PyObject* _new_event = nullptr;
|
||||||
PyObject* _event = Py_None;
|
PyObject* _event = Py_None;
|
||||||
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
@ -274,7 +274,7 @@ static PyObject* THPStream_richcompare(
|
|||||||
PyObject* self,
|
PyObject* self,
|
||||||
PyObject* other,
|
PyObject* other,
|
||||||
int op) {
|
int op) {
|
||||||
PyObject* result = NULL;
|
PyObject* result = nullptr;
|
||||||
if (other == Py_None) {
|
if (other == Py_None) {
|
||||||
result = Py_False;
|
result = Py_False;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <torch/csrc/python_headers.h>
|
#include <torch/csrc/python_headers.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::cpu {
|
||||||
namespace cpu {
|
|
||||||
|
|
||||||
void initModule(PyObject* module);
|
void initModule(PyObject* module);
|
||||||
|
|
||||||
} // namespace cpu
|
} // namespace torch::cpu
|
||||||
} // namespace torch
|
|
||||||
|
@ -392,13 +392,13 @@ static void _set_dynamic_layer_keys_included(bool value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void dump_dls() {
|
static void dump_dls() {
|
||||||
std::cout << getDynamicLayerStack() << std::endl;
|
std::cout << getDynamicLayerStack() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_local_tls() {
|
static void dump_local_tls() {
|
||||||
auto tls = c10::impl::tls_local_dispatch_key_set();
|
auto tls = c10::impl::tls_local_dispatch_key_set();
|
||||||
std::cout << "[Local Include] " << tls.included_ << std::endl;
|
std::cout << "[Local Include] " << tls.included_ << '\n';
|
||||||
std::cout << "[Local Exclude] " << tls.excluded_ << std::endl;
|
std::cout << "[Local Exclude] " << tls.excluded_ << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::monitor {
|
||||||
namespace monitor {
|
|
||||||
|
|
||||||
const char* aggregationName(Aggregation agg) {
|
const char* aggregationName(Aggregation agg) {
|
||||||
switch (agg) {
|
switch (agg) {
|
||||||
@ -64,5 +63,4 @@ void unregisterStat(Stat<int64_t>* stat) {
|
|||||||
}
|
}
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
} // namespace monitor
|
} // namespace torch::monitor
|
||||||
} // namespace torch
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include <torch/csrc/monitor/events.h>
|
#include <torch/csrc/monitor/events.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::monitor {
|
||||||
namespace monitor {
|
|
||||||
|
|
||||||
constexpr int NUM_AGGREGATIONS = 7;
|
constexpr int NUM_AGGREGATIONS = 7;
|
||||||
|
|
||||||
@ -275,5 +274,4 @@ class Stat {
|
|||||||
const std::chrono::milliseconds windowSize_;
|
const std::chrono::milliseconds windowSize_;
|
||||||
const int64_t maxSamples_;
|
const int64_t maxSamples_;
|
||||||
};
|
};
|
||||||
} // namespace monitor
|
} // namespace torch::monitor
|
||||||
} // namespace torch
|
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::monitor {
|
||||||
namespace monitor {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class EventHandlers {
|
class EventHandlers {
|
||||||
@ -55,5 +54,4 @@ void unregisterEventHandler(const std::shared_ptr<EventHandler>& p) {
|
|||||||
EventHandlers::get().unregisterEventHandler(p);
|
EventHandlers::get().unregisterEventHandler(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace monitor
|
} // namespace torch::monitor
|
||||||
} // namespace torch
|
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
#include <c10/macros/Macros.h>
|
#include <c10/macros/Macros.h>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::monitor {
|
||||||
namespace monitor {
|
|
||||||
|
|
||||||
// data_value_t is the type for Event data values.
|
// data_value_t is the type for Event data values.
|
||||||
using data_value_t = std::variant<std::string, double, int64_t, bool>;
|
using data_value_t = std::variant<std::string, double, int64_t, bool>;
|
||||||
@ -69,5 +68,4 @@ TORCH_API void registerEventHandler(std::shared_ptr<EventHandler> p);
|
|||||||
// shared_ptr.
|
// shared_ptr.
|
||||||
TORCH_API void unregisterEventHandler(const std::shared_ptr<EventHandler>& p);
|
TORCH_API void unregisterEventHandler(const std::shared_ptr<EventHandler>& p);
|
||||||
|
|
||||||
} // namespace monitor
|
} // namespace torch::monitor
|
||||||
} // namespace torch
|
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
#include <torch/csrc/monitor/counters.h>
|
#include <torch/csrc/monitor/counters.h>
|
||||||
#include <torch/csrc/monitor/events.h>
|
#include <torch/csrc/monitor/events.h>
|
||||||
|
|
||||||
namespace pybind11 {
|
namespace pybind11::detail {
|
||||||
namespace detail {
|
|
||||||
template <>
|
template <>
|
||||||
struct type_caster<torch::monitor::data_value_t> {
|
struct type_caster<torch::monitor::data_value_t> {
|
||||||
public:
|
public:
|
||||||
@ -61,11 +60,9 @@ struct type_caster<torch::monitor::data_value_t> {
|
|||||||
throw std::runtime_error("unknown data_value_t type");
|
throw std::runtime_error("unknown data_value_t type");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace pybind11::detail
|
||||||
} // namespace pybind11
|
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::monitor {
|
||||||
namespace monitor {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class PythonEventHandler : public EventHandler {
|
class PythonEventHandler : public EventHandler {
|
||||||
@ -341,5 +338,4 @@ void initMonitorBindings(PyObject* module) {
|
|||||||
)DOC");
|
)DOC");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace monitor
|
} // namespace torch::monitor
|
||||||
} // namespace torch
|
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
#include <torch/csrc/utils/pybind.h>
|
#include <torch/csrc/utils/pybind.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::monitor {
|
||||||
namespace monitor {
|
|
||||||
|
|
||||||
void initMonitorBindings(PyObject* module);
|
void initMonitorBindings(PyObject* module);
|
||||||
|
|
||||||
}
|
}
|
||||||
} // namespace torch
|
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::mtia {
|
||||||
namespace mtia {
|
|
||||||
|
|
||||||
static bool in_bad_fork = false; // True for children forked after mtia init
|
static bool in_bad_fork = false; // True for children forked after mtia init
|
||||||
|
|
||||||
@ -88,5 +87,4 @@ void initModule(PyObject* module) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mtia
|
} // namespace torch::mtia
|
||||||
} // namespace torch
|
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
#include <torch/csrc/python_headers.h>
|
#include <torch/csrc/python_headers.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::mtia {
|
||||||
namespace mtia {
|
|
||||||
|
|
||||||
// PyMethodDef* python_functions();
|
// PyMethodDef* python_functions();
|
||||||
void initModule(PyObject* module);
|
void initModule(PyObject* module);
|
||||||
|
|
||||||
} // namespace mtia
|
} // namespace torch::mtia
|
||||||
} // namespace torch
|
|
||||||
|
@ -218,7 +218,7 @@ void initONNXBindings(PyObject* module) {
|
|||||||
&std::cerr, [](std::ostream*) {});
|
&std::cerr, [](std::ostream*) {});
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "ERROR: only `stdout` and `stderr`"
|
std::cerr << "ERROR: only `stdout` and `stderr`"
|
||||||
<< "are supported as `stream_name`" << std::endl;
|
<< "are supported as `stream_name`" << '\n';
|
||||||
}
|
}
|
||||||
::torch::jit::onnx::set_log_output_stream(out);
|
::torch::jit::onnx::set_log_output_stream(out);
|
||||||
},
|
},
|
||||||
@ -231,7 +231,7 @@ void initONNXBindings(PyObject* module) {
|
|||||||
for (auto arg : args) {
|
for (auto arg : args) {
|
||||||
out << ::c10::str(arg);
|
out << ::c10::str(arg);
|
||||||
}
|
}
|
||||||
out << std::endl;
|
out << '\n';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Write `args` to the previously specified ONNX log stream.")
|
"Write `args` to the previously specified ONNX log stream.")
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
using GlobalManager = GlobalStateManager<ProfilerStateBase>;
|
using GlobalManager = GlobalStateManager<ProfilerStateBase>;
|
||||||
|
|
||||||
@ -182,6 +180,4 @@ torch::profiler::impl::ProfilerConfig getProfilerConfig() {
|
|||||||
return state_ptr->config();
|
return state_ptr->config();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace torch::profiler::impl
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// -- Profiler Config ---------------------------------------------------------
|
// -- Profiler Config ---------------------------------------------------------
|
||||||
@ -161,6 +159,4 @@ TORCH_API bool profilerEnabled();
|
|||||||
TORCH_API ActiveProfilerType profilerType();
|
TORCH_API ActiveProfilerType profilerType();
|
||||||
TORCH_API ProfilerConfig getProfilerConfig();
|
TORCH_API ProfilerConfig getProfilerConfig();
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace torch::profiler::impl
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#include <torch/csrc/profiler/orchestration/python_tracer.h>
|
#include <torch/csrc/profiler/orchestration/python_tracer.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl::python_tracer {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
namespace python_tracer {
|
|
||||||
namespace {
|
namespace {
|
||||||
MakeFn make_fn;
|
MakeFn make_fn;
|
||||||
|
|
||||||
@ -32,7 +29,4 @@ std::unique_ptr<PythonTracerBase> PythonTracerBase::make(RecordQueue* queue) {
|
|||||||
}
|
}
|
||||||
return make_fn(queue);
|
return make_fn(queue);
|
||||||
}
|
}
|
||||||
} // namespace python_tracer
|
} // namespace torch::profiler::impl::python_tracer
|
||||||
} // namespace impl
|
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include <torch/csrc/profiler/kineto_shim.h>
|
#include <torch/csrc/profiler/kineto_shim.h>
|
||||||
#include <torch/csrc/profiler/util.h>
|
#include <torch/csrc/profiler/util.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
class RecordQueue;
|
class RecordQueue;
|
||||||
struct Result;
|
struct Result;
|
||||||
@ -59,6 +57,4 @@ struct TORCH_API PythonTracerBase {
|
|||||||
using MakeFn = std::unique_ptr<PythonTracerBase> (*)(RecordQueue*);
|
using MakeFn = std::unique_ptr<PythonTracerBase> (*)(RecordQueue*);
|
||||||
TORCH_API void registerTracer(MakeFn make_tracer);
|
TORCH_API void registerTracer(MakeFn make_tracer);
|
||||||
} // namespace python_tracer
|
} // namespace python_tracer
|
||||||
} // namespace impl
|
} // namespace torch::profiler::impl
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl::vulkan {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
namespace vulkan {
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
GetShaderNameAndDurationNsFn get_shader_name_and_duration_ns_fn;
|
GetShaderNameAndDurationNsFn get_shader_name_and_duration_ns_fn;
|
||||||
@ -41,7 +38,4 @@ std::tuple<std::string, uint64_t> getShaderNameAndDurationNs(
|
|||||||
return get_shader_name_and_duration_ns_fn(vulkan_id.value_of());
|
return get_shader_name_and_duration_ns_fn(vulkan_id.value_of());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace vulkan
|
} // namespace torch::profiler::impl::vulkan
|
||||||
} // namespace impl
|
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
#include <torch/csrc/profiler/util.h>
|
#include <torch/csrc/profiler/util.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl::vulkan {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
namespace vulkan {
|
|
||||||
|
|
||||||
// Using function pointer i.e. [std::tuple<std::string, uint64_t> (*)(int64_t)]
|
// Using function pointer i.e. [std::tuple<std::string, uint64_t> (*)(int64_t)]
|
||||||
// doesn't work because we need to capture the QueryPool in the lambda context
|
// doesn't work because we need to capture the QueryPool in the lambda context
|
||||||
@ -22,7 +19,4 @@ TORCH_API void deregisterGetShaderNameAndDurationNs();
|
|||||||
std::tuple<std::string, uint64_t> getShaderNameAndDurationNs(
|
std::tuple<std::string, uint64_t> getShaderNameAndDurationNs(
|
||||||
const vulkan_id_t& vulkan_id);
|
const vulkan_id_t& vulkan_id);
|
||||||
|
|
||||||
} // namespace vulkan
|
} // namespace torch::profiler::impl::vulkan
|
||||||
} // namespace impl
|
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
#include <c10/util/Exception.h>
|
#include <c10/util/Exception.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
ProfilerStubs::~ProfilerStubs() = default;
|
ProfilerStubs::~ProfilerStubs() = default;
|
||||||
|
|
||||||
@ -78,6 +76,4 @@ REGISTER_DEFAULT(itt, ITT)
|
|||||||
REGISTER_DEFAULT(privateuse1, PrivateUse1)
|
REGISTER_DEFAULT(privateuse1, PrivateUse1)
|
||||||
#undef REGISTER_DEFAULT
|
#undef REGISTER_DEFAULT
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace torch::profiler::impl
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -9,9 +9,7 @@
|
|||||||
|
|
||||||
struct CUevent_st;
|
struct CUevent_st;
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// -- Annotation --------------------------------------------------------------
|
// -- Annotation --------------------------------------------------------------
|
||||||
@ -52,6 +50,4 @@ using vulkan_id_t = strong::type<
|
|||||||
strong::convertible_to<int64_t>,
|
strong::convertible_to<int64_t>,
|
||||||
strong::hashable>;
|
strong::hashable>;
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace torch::profiler::impl
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -12,9 +12,7 @@
|
|||||||
#include <torch/csrc/profiler/stubs/base.h>
|
#include <torch/csrc/profiler/stubs/base.h>
|
||||||
#include <torch/csrc/profiler/util.h>
|
#include <torch/csrc/profiler/util.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::profiler::impl {
|
||||||
namespace profiler {
|
|
||||||
namespace impl {
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static inline void cudaCheck(cudaError_t result, const char* file, int line) {
|
static inline void cudaCheck(cudaError_t result, const char* file, int line) {
|
||||||
@ -111,6 +109,4 @@ struct RegisterCUDAMethods {
|
|||||||
RegisterCUDAMethods reg;
|
RegisterCUDAMethods reg;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace impl
|
} // namespace torch::profiler::impl
|
||||||
} // namespace profiler
|
|
||||||
} // namespace torch
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace torch::unwind {
|
namespace torch::unwind {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include <torch/csrc/profiler/unwind/lexer.h>
|
#include <torch/csrc/profiler/unwind/lexer.h>
|
||||||
|
@ -9,8 +9,7 @@ namespace at {
|
|||||||
class Tensor;
|
class Tensor;
|
||||||
} // namespace at
|
} // namespace at
|
||||||
|
|
||||||
namespace torch {
|
namespace torch::tensors {
|
||||||
namespace tensors {
|
|
||||||
|
|
||||||
// Initializes the Python tensor type objects: torch.FloatTensor,
|
// Initializes the Python tensor type objects: torch.FloatTensor,
|
||||||
// torch.DoubleTensor, etc. and binds them in their containing modules.
|
// torch.DoubleTensor, etc. and binds them in their containing modules.
|
||||||
@ -32,5 +31,4 @@ at::Device get_default_device();
|
|||||||
|
|
||||||
// Gets the ScalarType for the default tensor type.
|
// Gets the ScalarType for the default tensor type.
|
||||||
at::ScalarType get_default_scalar_type();
|
at::ScalarType get_default_scalar_type();
|
||||||
} // namespace tensors
|
} // namespace torch::tensors
|
||||||
} // namespace torch
|
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int THPUtils_getCallable(PyObject* arg, PyObject** result) {
|
int THPUtils_getCallable(PyObject* arg, PyObject** result) {
|
||||||
@ -274,6 +272,7 @@ char* tensor_repr(at::Tensor tensor) {
|
|||||||
// observed that sometimes gdb passes the outer Tensor address exactly as is
|
// observed that sometimes gdb passes the outer Tensor address exactly as is
|
||||||
// into this function.
|
// into this function.
|
||||||
// See https://github.com/pytorch/pytorch/issues/134762
|
// See https://github.com/pytorch/pytorch/issues/134762
|
||||||
|
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
||||||
pytensor = THPVariable_Wrap(tensor);
|
pytensor = THPVariable_Wrap(tensor);
|
||||||
if (!pytensor)
|
if (!pytensor)
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-goto,hicpp-avoid-goto)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-goto,hicpp-avoid-goto)
|
||||||
|
Reference in New Issue
Block a user