Skip to content

Commit 801a9e0

Browse files
committed
Add explicit template variable to map
1 parent af0cff8 commit 801a9e0

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

kernels/optimized/cpu/op_add.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Tensor& opt_add_out(
6767
CTYPE b_val = *b.const_data_ptr<CTYPE>();
6868

6969
using Vec = at::vec::Vectorized<CTYPE>;
70-
at::vec::map(
70+
at::vec::map<CTYPE>(
7171
[alpha_val, b_val](Vec x) { return x + Vec(alpha_val * b_val); },
7272
out.mutable_data_ptr<CTYPE>(),
7373
a.const_data_ptr<CTYPE>(),
@@ -86,7 +86,7 @@ Tensor& opt_add_out(
8686
CTYPE b_casted = static_cast<CTYPE>(b_val);
8787

8888
using Vec = at::vec::Vectorized<CTYPE>;
89-
at::vec::map(
89+
at::vec::map<CTYPE>(
9090
[alpha_val, b_casted](Vec x) {
9191
return x + Vec(alpha_val * b_casted);
9292
},
@@ -140,7 +140,7 @@ Tensor& opt_add_scalar_out(
140140
ctx, utils::extract_scalar(alpha, &alpha_val), InvalidArgument, );
141141

142142
using Vec = at::vec::Vectorized<CTYPE>;
143-
at::vec::map(
143+
at::vec::map<CTYPE>(
144144
[alpha_val, b_casted](Vec x) {
145145
return x + Vec(alpha_val * b_casted);
146146
},

kernels/optimized/cpu/op_div.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ Tensor& opt_div_out(
8686

8787
using Vec = at::vec::Vectorized<CTYPE>;
8888
if (a.numel() == 1) {
89-
at::vec::map(
89+
at::vec::map<CTYPE>(
9090
[scalar_casted](Vec x) { return Vec(scalar_casted) / x; },
9191
out.mutable_data_ptr<CTYPE>(),
9292
tensor->const_data_ptr<CTYPE>(),
9393
out.numel());
9494
} else {
9595
Vec inv_scalar_casted_vec(CTYPE(1) / scalar_casted);
96-
at::vec::map(
96+
at::vec::map<CTYPE>(
9797
[inv_scalar_casted_vec](Vec x) {
9898
return x * inv_scalar_casted_vec;
9999
},
@@ -193,7 +193,7 @@ Tensor& opt_div_scalar_out(
193193

194194
using Vec = at::vec::Vectorized<CTYPE>;
195195
Vec inv_b_casted_vec(CTYPE(1) / b_casted);
196-
at::vec::map(
196+
at::vec::map<CTYPE>(
197197
[inv_b_casted_vec](Vec x) { return x * inv_b_casted_vec; },
198198
out.mutable_data_ptr<CTYPE>(),
199199
a.const_data_ptr<CTYPE>(),

kernels/optimized/cpu/op_exp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ void exp_data(
3535
const size_t numel,
3636
CTYPE_OUT* out_data) {
3737
using Vec = at::vec::Vectorized<CTYPE_IN>;
38-
at::vec::map([](Vec x) { return x.exp(); }, out_data, in_data, numel);
38+
at::vec::map<CTYPE_IN>(
39+
[](Vec x) { return x.exp(); }, out_data, in_data, numel);
3940
}
4041

4142
/**

kernels/optimized/cpu/op_le.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Tensor& opt_le_scalar_out(
9595
ET_EXTRACT_SCALAR(b, b_val);
9696
CTYPE b_casted = static_cast<CTYPE>(b_val);
9797
using Vec = at::vec::Vectorized<CTYPE>;
98-
at::vec::map(
98+
at::vec::map<CTYPE>(
9999
[b_casted](Vec x) { return x.le(Vec(b_casted)); },
100100
out.mutable_data_ptr<CTYPE>(),
101101
a.const_data_ptr<CTYPE>(),

kernels/optimized/cpu/op_mul.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Tensor& opt_mul_out(
5555
CTYPE b_casted = static_cast<CTYPE>(b_val);
5656

5757
using Vec = at::vec::Vectorized<CTYPE>;
58-
at::vec::map(
58+
at::vec::map<CTYPE>(
5959
[b_casted](Vec x) { return x * Vec(b_casted); },
6060
out.mutable_data_ptr<CTYPE>(),
6161
a.const_data_ptr<CTYPE>(),
@@ -173,7 +173,7 @@ Tensor& opt_mul_scalar_out(
173173
CTYPE b_casted = utils::scalar_to<CTYPE>(b);
174174

175175
using Vec = at::vec::Vectorized<CTYPE>;
176-
at::vec::map(
176+
at::vec::map<CTYPE>(
177177
[b_casted](Vec x) { return x * Vec(b_casted); },
178178
out.mutable_data_ptr<CTYPE>(),
179179
a.const_data_ptr<CTYPE>(),

kernels/optimized/cpu/op_sub.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ Tensor& opt_sub_out(
8585

8686
using Vec = at::vec::Vectorized<CTYPE>;
8787
if (a.numel() == 1) {
88-
at::vec::map(
88+
at::vec::map<CTYPE>(
8989
[alpha_val, scalar_casted](Vec x) {
9090
return Vec(scalar_casted) - Vec(alpha_val) * x;
9191
},
9292
out.mutable_data_ptr<CTYPE>(),
9393
tensor->const_data_ptr<CTYPE>(),
9494
out.numel());
9595
} else {
96-
at::vec::map(
96+
at::vec::map<CTYPE>(
9797
[alpha_val, scalar_casted](Vec x) {
9898
return x - Vec(alpha_val * scalar_casted);
9999
},
@@ -148,7 +148,7 @@ Tensor& opt_sub_scalar_out(
148148
ctx, utils::extract_scalar(alpha, &alpha_val), InvalidArgument, );
149149

150150
using Vec = at::vec::Vectorized<CTYPE>;
151-
at::vec::map(
151+
at::vec::map<CTYPE>(
152152
[alpha_val, b_casted](Vec x) {
153153
return x - Vec(alpha_val * b_casted);
154154
},

0 commit comments

Comments
 (0)