Skip to content

Commit 5babbf7

Browse files
fix: [pre-commit.ci] auto fixes [...]
1 parent 6377756 commit 5babbf7

19 files changed

+1387
-1361
lines changed

include/adam_op/adam_op.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,51 @@ namespace py = pybind11;
2727

2828
namespace adam_op {
2929

30-
TensorArray<3> adamForwardInplace(const torch::Tensor &updates,
31-
const torch::Tensor &mu,
32-
const torch::Tensor &nu,
30+
TensorArray<3> adamForwardInplace(const torch::Tensor& updates,
31+
const torch::Tensor& mu,
32+
const torch::Tensor& nu,
3333
const pyfloat_t b1,
3434
const pyfloat_t b2,
3535
const pyfloat_t eps,
3636
const pyfloat_t eps_root,
3737
const pyuint_t count);
3838

39-
torch::Tensor adamForwardMu(const torch::Tensor &updates,
40-
const torch::Tensor &mu,
39+
torch::Tensor adamForwardMu(const torch::Tensor& updates,
40+
const torch::Tensor& mu,
4141
const pyfloat_t b1);
4242

43-
torch::Tensor adamForwardNu(const torch::Tensor &updates,
44-
const torch::Tensor &nu,
43+
torch::Tensor adamForwardNu(const torch::Tensor& updates,
44+
const torch::Tensor& nu,
4545
const pyfloat_t b2);
4646

47-
torch::Tensor adamForwardUpdates(const torch::Tensor &new_mu,
48-
const torch::Tensor &new_nu,
47+
torch::Tensor adamForwardUpdates(const torch::Tensor& new_mu,
48+
const torch::Tensor& new_nu,
4949
const pyfloat_t b1,
5050
const pyfloat_t b2,
5151
const pyfloat_t eps,
5252
const pyfloat_t eps_root,
5353
const pyuint_t count);
5454

55-
TensorArray<2> adamBackwardMu(const torch::Tensor &dmu,
56-
const torch::Tensor &updates,
57-
const torch::Tensor &mu,
55+
TensorArray<2> adamBackwardMu(const torch::Tensor& dmu,
56+
const torch::Tensor& updates,
57+
const torch::Tensor& mu,
5858
const pyfloat_t b1);
5959

60-
TensorArray<2> adamBackwardNu(const torch::Tensor &dnu,
61-
const torch::Tensor &updates,
62-
const torch::Tensor &nu,
60+
TensorArray<2> adamBackwardNu(const torch::Tensor& dnu,
61+
const torch::Tensor& updates,
62+
const torch::Tensor& nu,
6363
const pyfloat_t b2);
6464

65-
TensorArray<2> adamBackwardUpdates(const torch::Tensor &dupdates,
66-
const torch::Tensor &updates,
67-
const torch::Tensor &new_mu,
68-
const torch::Tensor &new_nu,
65+
TensorArray<2> adamBackwardUpdates(const torch::Tensor& dupdates,
66+
const torch::Tensor& updates,
67+
const torch::Tensor& new_mu,
68+
const torch::Tensor& new_nu,
6969
const pyfloat_t b1,
7070
const pyfloat_t b2,
7171
const pyfloat_t eps_root,
7272
const pyuint_t count);
7373

74-
void buildSubmodule(py::module &mod); // NOLINT[runtime/references]
74+
void buildSubmodule(py::module& mod); // NOLINT[runtime/references]
7575

7676
} // namespace adam_op
7777
} // namespace torchopt

include/adam_op/adam_op_impl_cpu.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,45 @@
2323

2424
namespace torchopt {
2525
namespace adam_op {
26-
TensorArray<3> adamForwardInplaceCPU(const torch::Tensor &updates,
27-
const torch::Tensor &mu,
28-
const torch::Tensor &nu,
26+
TensorArray<3> adamForwardInplaceCPU(const torch::Tensor& updates,
27+
const torch::Tensor& mu,
28+
const torch::Tensor& nu,
2929
const pyfloat_t b1,
3030
const pyfloat_t b2,
3131
const pyfloat_t eps,
3232
const pyfloat_t eps_root,
3333
const pyuint_t count);
3434

35-
torch::Tensor adamForwardMuCPU(const torch::Tensor &updates,
36-
const torch::Tensor &mu,
35+
torch::Tensor adamForwardMuCPU(const torch::Tensor& updates,
36+
const torch::Tensor& mu,
3737
const pyfloat_t b1);
3838

39-
torch::Tensor adamForwardNuCPU(const torch::Tensor &updates,
40-
const torch::Tensor &nu,
39+
torch::Tensor adamForwardNuCPU(const torch::Tensor& updates,
40+
const torch::Tensor& nu,
4141
const pyfloat_t b2);
4242

43-
torch::Tensor adamForwardUpdatesCPU(const torch::Tensor &new_mu,
44-
const torch::Tensor &new_nu,
43+
torch::Tensor adamForwardUpdatesCPU(const torch::Tensor& new_mu,
44+
const torch::Tensor& new_nu,
4545
const pyfloat_t b1,
4646
const pyfloat_t b2,
4747
const pyfloat_t eps,
4848
const pyfloat_t eps_root,
4949
const pyuint_t count);
5050

51-
TensorArray<2> adamBackwardMuCPU(const torch::Tensor &dmu,
52-
const torch::Tensor &updates,
53-
const torch::Tensor &mu,
51+
TensorArray<2> adamBackwardMuCPU(const torch::Tensor& dmu,
52+
const torch::Tensor& updates,
53+
const torch::Tensor& mu,
5454
const pyfloat_t b1);
5555

56-
TensorArray<2> adamBackwardNuCPU(const torch::Tensor &dnu,
57-
const torch::Tensor &updates,
58-
const torch::Tensor &nu,
56+
TensorArray<2> adamBackwardNuCPU(const torch::Tensor& dnu,
57+
const torch::Tensor& updates,
58+
const torch::Tensor& nu,
5959
const pyfloat_t b2);
6060

61-
TensorArray<2> adamBackwardUpdatesCPU(const torch::Tensor &dupdates,
62-
const torch::Tensor &updates,
63-
const torch::Tensor &new_mu,
64-
const torch::Tensor &new_nu,
61+
TensorArray<2> adamBackwardUpdatesCPU(const torch::Tensor& dupdates,
62+
const torch::Tensor& updates,
63+
const torch::Tensor& new_mu,
64+
const torch::Tensor& new_nu,
6565
const pyfloat_t b1,
6666
const pyfloat_t b2,
6767
const pyfloat_t eps_root,

include/adam_op/adam_op_impl_cuda.cuh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,45 @@
2323

2424
namespace torchopt {
2525
namespace adam_op {
26-
TensorArray<3> adamForwardInplaceCUDA(const torch::Tensor &updates,
27-
const torch::Tensor &mu,
28-
const torch::Tensor &nu,
26+
TensorArray<3> adamForwardInplaceCUDA(const torch::Tensor& updates,
27+
const torch::Tensor& mu,
28+
const torch::Tensor& nu,
2929
const pyfloat_t b1,
3030
const pyfloat_t b2,
3131
const pyfloat_t eps,
3232
const pyfloat_t eps_root,
3333
const pyuint_t count);
3434

35-
torch::Tensor adamForwardMuCUDA(const torch::Tensor &updates,
36-
const torch::Tensor &mu,
35+
torch::Tensor adamForwardMuCUDA(const torch::Tensor& updates,
36+
const torch::Tensor& mu,
3737
const pyfloat_t b1);
3838

39-
torch::Tensor adamForwardNuCUDA(const torch::Tensor &updates,
40-
const torch::Tensor &nu,
39+
torch::Tensor adamForwardNuCUDA(const torch::Tensor& updates,
40+
const torch::Tensor& nu,
4141
const pyfloat_t b2);
4242

43-
torch::Tensor adamForwardUpdatesCUDA(const torch::Tensor &new_mu,
44-
const torch::Tensor &new_nu,
43+
torch::Tensor adamForwardUpdatesCUDA(const torch::Tensor& new_mu,
44+
const torch::Tensor& new_nu,
4545
const pyfloat_t b1,
4646
const pyfloat_t b2,
4747
const pyfloat_t eps,
4848
const pyfloat_t eps_root,
4949
const pyuint_t count);
5050

51-
TensorArray<2> adamBackwardMuCUDA(const torch::Tensor &dmu,
52-
const torch::Tensor &updates,
53-
const torch::Tensor &mu,
51+
TensorArray<2> adamBackwardMuCUDA(const torch::Tensor& dmu,
52+
const torch::Tensor& updates,
53+
const torch::Tensor& mu,
5454
const pyfloat_t b1);
5555

56-
TensorArray<2> adamBackwardNuCUDA(const torch::Tensor &dnu,
57-
const torch::Tensor &updates,
58-
const torch::Tensor &nu,
56+
TensorArray<2> adamBackwardNuCUDA(const torch::Tensor& dnu,
57+
const torch::Tensor& updates,
58+
const torch::Tensor& nu,
5959
const pyfloat_t b2);
6060

61-
TensorArray<2> adamBackwardUpdatesCUDA(const torch::Tensor &dupdates,
62-
const torch::Tensor &updates,
63-
const torch::Tensor &new_mu,
64-
const torch::Tensor &new_nu,
61+
TensorArray<2> adamBackwardUpdatesCUDA(const torch::Tensor& dupdates,
62+
const torch::Tensor& updates,
63+
const torch::Tensor& new_mu,
64+
const torch::Tensor& new_nu,
6565
const pyfloat_t b1,
6666
const pyfloat_t b2,
6767
const pyfloat_t eps_root,

include/utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#endif
2525

2626
namespace torchopt {
27-
__forceinline__ size_t getTensorPlainSize(const torch::Tensor &tensor) {
27+
__forceinline__ size_t getTensorPlainSize(const torch::Tensor& tensor) {
2828
const auto dim = tensor.dim();
2929
size_t n = 1;
3030
for (std::decay_t<decltype(dim)> i = 0; i < dim; ++i) {

src/adam_op/adam_op.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ namespace py = pybind11;
2929

3030
namespace adam_op {
3131

32-
TensorArray<3> adamForwardInplace(const torch::Tensor &updates,
33-
const torch::Tensor &mu,
34-
const torch::Tensor &nu,
32+
TensorArray<3> adamForwardInplace(const torch::Tensor& updates,
33+
const torch::Tensor& mu,
34+
const torch::Tensor& nu,
3535
const pyfloat_t b1,
3636
const pyfloat_t b2,
3737
const pyfloat_t eps,
@@ -49,8 +49,8 @@ TensorArray<3> adamForwardInplace(const torch::Tensor &updates,
4949
}
5050
}
5151

52-
torch::Tensor adamForwardMu(const torch::Tensor &updates,
53-
const torch::Tensor &mu,
52+
torch::Tensor adamForwardMu(const torch::Tensor& updates,
53+
const torch::Tensor& mu,
5454
const pyfloat_t b1) {
5555
#if defined(__USE_CUDA__)
5656
if (updates.device().is_cuda()) {
@@ -64,8 +64,8 @@ torch::Tensor adamForwardMu(const torch::Tensor &updates,
6464
}
6565
}
6666

67-
torch::Tensor adamForwardNu(const torch::Tensor &updates,
68-
const torch::Tensor &nu,
67+
torch::Tensor adamForwardNu(const torch::Tensor& updates,
68+
const torch::Tensor& nu,
6969
const pyfloat_t b2) {
7070
#if defined(__USE_CUDA__)
7171
if (updates.device().is_cuda()) {
@@ -79,8 +79,8 @@ torch::Tensor adamForwardNu(const torch::Tensor &updates,
7979
}
8080
}
8181

82-
torch::Tensor adamForwardUpdates(const torch::Tensor &new_mu,
83-
const torch::Tensor &new_nu,
82+
torch::Tensor adamForwardUpdates(const torch::Tensor& new_mu,
83+
const torch::Tensor& new_nu,
8484
const pyfloat_t b1,
8585
const pyfloat_t b2,
8686
const pyfloat_t eps,
@@ -98,9 +98,9 @@ torch::Tensor adamForwardUpdates(const torch::Tensor &new_mu,
9898
}
9999
}
100100

101-
TensorArray<2> adamBackwardMu(const torch::Tensor &dmu,
102-
const torch::Tensor &updates,
103-
const torch::Tensor &mu,
101+
TensorArray<2> adamBackwardMu(const torch::Tensor& dmu,
102+
const torch::Tensor& updates,
103+
const torch::Tensor& mu,
104104
const pyfloat_t b1) {
105105
#if defined(__USE_CUDA__)
106106
if (dmu.device().is_cuda()) {
@@ -114,9 +114,9 @@ TensorArray<2> adamBackwardMu(const torch::Tensor &dmu,
114114
}
115115
}
116116

117-
TensorArray<2> adamBackwardNu(const torch::Tensor &dnu,
118-
const torch::Tensor &updates,
119-
const torch::Tensor &nu,
117+
TensorArray<2> adamBackwardNu(const torch::Tensor& dnu,
118+
const torch::Tensor& updates,
119+
const torch::Tensor& nu,
120120
const pyfloat_t b2) {
121121
#if defined(__USE_CUDA__)
122122
if (dnu.device().is_cuda()) {
@@ -130,10 +130,10 @@ TensorArray<2> adamBackwardNu(const torch::Tensor &dnu,
130130
}
131131
}
132132

133-
TensorArray<2> adamBackwardUpdates(const torch::Tensor &dupdates,
134-
const torch::Tensor &updates,
135-
const torch::Tensor &new_mu,
136-
const torch::Tensor &new_nu,
133+
TensorArray<2> adamBackwardUpdates(const torch::Tensor& dupdates,
134+
const torch::Tensor& updates,
135+
const torch::Tensor& new_mu,
136+
const torch::Tensor& new_nu,
137137
const pyfloat_t b1,
138138
const pyfloat_t b2,
139139
const pyfloat_t eps_root,
@@ -152,7 +152,7 @@ TensorArray<2> adamBackwardUpdates(const torch::Tensor &dupdates,
152152
}
153153
}
154154

155-
void buildSubmodule(py::module &mod) { // NOLINT[runtime/references]
155+
void buildSubmodule(py::module& mod) { // NOLINT[runtime/references]
156156
py::module m = mod.def_submodule("adam_op", "Adam Ops");
157157
m.def("forward_",
158158
&adamForwardInplace,

0 commit comments

Comments
 (0)