mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE][clang-format] make macro PyObject_HEAD
have its own line (#136945)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/136945 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
54f50f19eb
commit
89c37be6b7
@ -44,7 +44,9 @@ ContinuationIndentWidth: 4
|
|||||||
Cpp11BracedListStyle: true
|
Cpp11BracedListStyle: true
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
DisableFormat: false
|
DisableFormat: false
|
||||||
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
|
ForEachMacros:
|
||||||
|
- FOR_EACH_RANGE
|
||||||
|
- FOR_EACH
|
||||||
IncludeCategories:
|
IncludeCategories:
|
||||||
- Regex: '^<.*\.h(pp)?>'
|
- Regex: '^<.*\.h(pp)?>'
|
||||||
Priority: 1
|
Priority: 1
|
||||||
@ -79,7 +81,11 @@ SpacesInContainerLiterals: true
|
|||||||
SpacesInCStyleCastParentheses: false
|
SpacesInCStyleCastParentheses: false
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
Standard: Cpp11
|
Standard: c++17
|
||||||
|
StatementMacros:
|
||||||
|
- PyObject_HEAD
|
||||||
|
- PyObject_VAR_HEAD
|
||||||
|
- PyException_HEAD
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
---
|
---
|
||||||
|
@ -43,7 +43,9 @@ ContinuationIndentWidth: 4
|
|||||||
Cpp11BracedListStyle: true
|
Cpp11BracedListStyle: true
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
DisableFormat: false
|
DisableFormat: false
|
||||||
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
|
ForEachMacros:
|
||||||
|
- FOR_EACH_RANGE
|
||||||
|
- FOR_EACH
|
||||||
IncludeCategories:
|
IncludeCategories:
|
||||||
- Regex: '^<.*\.h(pp)?>'
|
- Regex: '^<.*\.h(pp)?>'
|
||||||
Priority: 1
|
Priority: 1
|
||||||
@ -81,7 +83,11 @@ SpacesInContainerLiterals: true
|
|||||||
SpacesInCStyleCastParentheses: false
|
SpacesInCStyleCastParentheses: false
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
Standard: Cpp11
|
Standard: c++17
|
||||||
|
StatementMacros:
|
||||||
|
- PyObject_HEAD
|
||||||
|
- PyObject_VAR_HEAD
|
||||||
|
- PyException_HEAD
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
...
|
...
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
struct TORCH_API THPDevice {
|
struct TORCH_API THPDevice {
|
||||||
PyObject_HEAD at::Device device;
|
PyObject_HEAD
|
||||||
|
at::Device device;
|
||||||
};
|
};
|
||||||
|
|
||||||
TORCH_API extern PyTypeObject THPDeviceType;
|
TORCH_API extern PyTypeObject THPDeviceType;
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
constexpr int DTYPE_NAME_LEN = 64;
|
constexpr int DTYPE_NAME_LEN = 64;
|
||||||
|
|
||||||
struct TORCH_API THPDtype {
|
struct TORCH_API THPDtype {
|
||||||
PyObject_HEAD at::ScalarType scalar_type;
|
PyObject_HEAD
|
||||||
|
at::ScalarType scalar_type;
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
char name[DTYPE_NAME_LEN + 1];
|
char name[DTYPE_NAME_LEN + 1];
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <torch/csrc/python_headers.h>
|
#include <torch/csrc/python_headers.h>
|
||||||
|
|
||||||
struct TORCH_API THPEvent {
|
struct TORCH_API THPEvent {
|
||||||
PyObject_HEAD c10::Event event;
|
PyObject_HEAD
|
||||||
|
c10::Event event;
|
||||||
};
|
};
|
||||||
TORCH_API extern PyTypeObject* THPEventClass;
|
TORCH_API extern PyTypeObject* THPEventClass;
|
||||||
TORCH_API extern PyTypeObject THPEventType;
|
TORCH_API extern PyTypeObject THPEventType;
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
struct THPGenerator {
|
struct THPGenerator {
|
||||||
PyObject_HEAD at::Generator cdata;
|
PyObject_HEAD
|
||||||
|
at::Generator cdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a new Python object wrapping the default at::Generator. The reference
|
// Creates a new Python object wrapping the default at::Generator. The reference
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
const int LAYOUT_NAME_LEN = 64;
|
const int LAYOUT_NAME_LEN = 64;
|
||||||
|
|
||||||
struct THPLayout {
|
struct THPLayout {
|
||||||
PyObject_HEAD at::Layout layout;
|
PyObject_HEAD
|
||||||
|
at::Layout layout;
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
char name[LAYOUT_NAME_LEN + 1];
|
char name[LAYOUT_NAME_LEN + 1];
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
const int MEMORY_FORMAT_NAME_LEN = 64;
|
const int MEMORY_FORMAT_NAME_LEN = 64;
|
||||||
|
|
||||||
struct THPMemoryFormat {
|
struct THPMemoryFormat {
|
||||||
PyObject_HEAD at::MemoryFormat memory_format;
|
PyObject_HEAD
|
||||||
|
at::MemoryFormat memory_format;
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
char name[MEMORY_FORMAT_NAME_LEN + 1];
|
char name[MEMORY_FORMAT_NAME_LEN + 1];
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
constexpr int QSCHEME_NAME_LEN = 64;
|
constexpr int QSCHEME_NAME_LEN = 64;
|
||||||
|
|
||||||
struct THPQScheme {
|
struct THPQScheme {
|
||||||
PyObject_HEAD at::QScheme qscheme;
|
PyObject_HEAD
|
||||||
|
at::QScheme qscheme;
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
char name[QSCHEME_NAME_LEN + 1];
|
char name[QSCHEME_NAME_LEN + 1];
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
#include <torch/csrc/python_headers.h>
|
#include <torch/csrc/python_headers.h>
|
||||||
|
|
||||||
struct THPStream {
|
struct THPStream {
|
||||||
PyObject_HEAD int64_t stream_id;
|
PyObject_HEAD
|
||||||
|
int64_t stream_id;
|
||||||
int64_t device_type;
|
int64_t device_type;
|
||||||
int64_t device_index;
|
int64_t device_index;
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <ATen/ATen.h>
|
#include <ATen/ATen.h>
|
||||||
|
|
||||||
struct THPDTypeInfo {
|
struct THPDTypeInfo {
|
||||||
PyObject_HEAD at::ScalarType type;
|
PyObject_HEAD
|
||||||
|
at::ScalarType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct THPFInfo : THPDTypeInfo {};
|
struct THPFInfo : THPDTypeInfo {};
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
namespace torch::autograd {
|
namespace torch::autograd {
|
||||||
|
|
||||||
struct THPCppFunction {
|
struct THPCppFunction {
|
||||||
PyObject_HEAD std::shared_ptr<Node> cdata;
|
PyObject_HEAD
|
||||||
|
std::shared_ptr<Node> cdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Ctor>
|
template <typename Ctor>
|
||||||
|
@ -95,7 +95,7 @@ inline bool ensure_tuple(THPObjectPtr& obj) {
|
|||||||
struct THPFunction {
|
struct THPFunction {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
|
|
||||||
PyObject* needs_input_grad;
|
PyObject* needs_input_grad;
|
||||||
|
|
||||||
// Python tuple of tensors whose variables we should save. Set
|
// Python tuple of tensors whose variables we should save. Set
|
||||||
// by Python with 'save_for_backward'. If nullptr, no tensors were
|
// by Python with 'save_for_backward'. If nullptr, no tensors were
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
|
|
||||||
// Manually create _PyTupleIterObject struct
|
// Manually create _PyTupleIterObject struct
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD Py_ssize_t it_index;
|
PyObject_HEAD
|
||||||
|
Py_ssize_t it_index;
|
||||||
PyTupleObject* it_seq; /* Set to NULL when iterator is exhausted */
|
PyTupleObject* it_seq; /* Set to NULL when iterator is exhausted */
|
||||||
} _PyTupleIterObject;
|
} _PyTupleIterObject;
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
struct NodeBase {
|
struct NodeBase {
|
||||||
PyObject_HEAD bool _erased;
|
PyObject_HEAD
|
||||||
|
bool _erased;
|
||||||
NodeBase* _prev;
|
NodeBase* _prev;
|
||||||
NodeBase* _next;
|
NodeBase* _next;
|
||||||
};
|
};
|
||||||
@ -111,7 +112,8 @@ bool NodeBase_init(PyObject* module) {
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
struct NodeIter {
|
struct NodeIter {
|
||||||
PyObject_HEAD bool _reversed;
|
PyObject_HEAD
|
||||||
|
bool _reversed;
|
||||||
NodeBase* _root;
|
NodeBase* _root;
|
||||||
NodeBase* _cur;
|
NodeBase* _cur;
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
#include <torch/csrc/utils/pybind.h>
|
#include <torch/csrc/utils/pybind.h>
|
||||||
|
|
||||||
struct THPCapturedTraceback {
|
struct THPCapturedTraceback {
|
||||||
PyObject_HEAD std::shared_ptr<torch::CapturedTraceback> data;
|
PyObject_HEAD
|
||||||
|
std::shared_ptr<torch::CapturedTraceback> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int THPCapturedTraceback_traverse(
|
static int THPCapturedTraceback_traverse(
|
||||||
@ -136,7 +137,8 @@ namespace torch::profiler {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct RecordFunctionFast {
|
struct RecordFunctionFast {
|
||||||
PyObject_HEAD PyObject* name;
|
PyObject_HEAD
|
||||||
|
PyObject* name;
|
||||||
PyObject* input_values;
|
PyObject* input_values;
|
||||||
PyObject* keyword_values;
|
PyObject* keyword_values;
|
||||||
std::unique_ptr<at::RecordFunction> guard;
|
std::unique_ptr<at::RecordFunction> guard;
|
||||||
|
@ -34,8 +34,8 @@ void set_disabled_torch_dispatch_impl(PyObject* value) {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
/* Type-specific fields go here. */
|
/* Type-specific fields go here. */
|
||||||
at::impl::TorchFunctionDisabledState old_state;
|
at::impl::TorchFunctionDisabledState old_state;
|
||||||
} DisableTorchFunctionSubclass;
|
} DisableTorchFunctionSubclass;
|
||||||
|
|
||||||
PyObject* DisableTorchFunctionSubclass__enter(
|
PyObject* DisableTorchFunctionSubclass__enter(
|
||||||
@ -131,8 +131,8 @@ PyObject* THPModule_DisableTorchFunctionSubclassType() {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
/* Type-specific fields go here. */
|
/* Type-specific fields go here. */
|
||||||
at::impl::TorchFunctionDisabledState old_state;
|
at::impl::TorchFunctionDisabledState old_state;
|
||||||
} DisableTorchFunction;
|
} DisableTorchFunction;
|
||||||
|
|
||||||
PyObject* DisableTorchFunction__enter(PyObject* self, PyObject* unused) {
|
PyObject* DisableTorchFunction__enter(PyObject* self, PyObject* unused) {
|
||||||
|
Reference in New Issue
Block a user