Skip to content

Commit e722f68

Browse files
authored
fix windows compile (#13147)
1 parent f055200 commit e722f68

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

paddle/fluid/operators/activation_op.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,8 @@ struct SwishGradFunctor : public BaseActivationFunctor<T> {
865865
void operator()(Device d, X x, Out out, dOut dout, dX dx) const {
866866
auto temp1 = static_cast<T>(1) /
867867
(static_cast<T>(1) + (static_cast<T>(-beta) * x).exp());
868-
auto temp2 = temp1 * (static_cast<T>(1) - (beta * out));
869-
dx.device(d) = dout * ((beta * out) + temp2);
868+
auto temp2 = temp1 * (static_cast<T>(1) - (static_cast<T>(beta) * out));
869+
dx.device(d) = dout * ((static_cast<T>(beta) * out) + temp2);
870870
}
871871
};
872872

paddle/fluid/operators/attention_lstm_op.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "paddle/fluid/operators/attention_lstm_op.h"
16-
#include <sys/time.h>
1716
#include <string>
1817
#include "paddle/fluid/operators/math/blas.h"
1918
#include "paddle/fluid/operators/math/cpu_vec.h"

paddle/fluid/operators/gru_unit_op.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ class GRUUnitKernel : public framework::OpKernel<T> {
9292
gate_data, frame_size * 3);
9393

9494
// calculate activited gate
95-
Eigen::array<int, 2> extents({{batch_size, frame_size}});
96-
Eigen::array<int, 2> u_offsets({{0, 0}});
95+
Eigen::array<int, 2> extents = {batch_size, frame_size};
96+
Eigen::array<int, 2> u_offsets = {0, 0};
9797
ActCompute(context.Attr<int>("gate_activation"), place,
9898
g.slice(u_offsets, extents), g.slice(u_offsets, extents));
9999
auto u = g.slice(u_offsets, extents); // update gate
100-
Eigen::array<int, 2> r_offsets({{0, frame_size}});
100+
Eigen::array<int, 2> r_offsets = {0, frame_size};
101101
ActCompute(context.Attr<int>("gate_activation"), place,
102102
g.slice(r_offsets, extents), g.slice(r_offsets, extents));
103103
auto r = g.slice(r_offsets, extents); // reset gate
@@ -107,7 +107,7 @@ class GRUUnitKernel : public framework::OpKernel<T> {
107107
weight_data + frame_size * frame_size * 2, frame_size, 1,
108108
gate_data + frame_size * 2, frame_size * 3);
109109

110-
Eigen::array<int, 2> c_offsets({{0, frame_size * 2}});
110+
Eigen::array<int, 2> c_offsets = {0, frame_size * 2};
111111
ActCompute(context.Attr<int>("activation"), place,
112112
g.slice(c_offsets, extents), g.slice(c_offsets, extents));
113113
auto c = g.slice(c_offsets, extents); // output candidate
@@ -171,12 +171,12 @@ class GRUUnitGradKernel : public framework::OpKernel<T> {
171171
int batch_size = input->dims()[0];
172172
int frame_size = hidden_prev->dims()[1];
173173

174-
Eigen::array<int, 2> extents({{batch_size, frame_size}});
175-
Eigen::array<int, 2> u_offsets({{0, 0}});
174+
Eigen::array<int, 2> extents = {batch_size, frame_size};
175+
Eigen::array<int, 2> u_offsets = {0, 0};
176176
auto u = g.slice(u_offsets, extents); // update gate
177-
Eigen::array<int, 2> r_offsets({{0, frame_size}});
177+
Eigen::array<int, 2> r_offsets = {0, frame_size};
178178
auto r = g.slice(r_offsets, extents); // reset gate
179-
Eigen::array<int, 2> c_offsets({{0, frame_size * 2}});
179+
Eigen::array<int, 2> c_offsets = {0, frame_size * 2};
180180
auto c = g.slice(c_offsets, extents); // output candidate
181181

182182
// backward for unactivated update gate

paddle/fluid/operators/label_smooth_op.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class LabelSmoothKernel : public framework::OpKernel<T> {
3838
auto dist = framework::EigenVector<T>::Flatten(*dist_t);
3939
out.device(dev) =
4040
static_cast<T>(1 - epsilon) * in +
41-
epsilon * dist.broadcast(Eigen::DSizes<int, 1>(in_t->numel()));
41+
static_cast<T>(epsilon) *
42+
dist.broadcast(Eigen::DSizes<int, 1>(in_t->numel()));
4243
} else {
4344
out.device(dev) = static_cast<T>(1 - epsilon) * in +
4445
static_cast<T>(epsilon / label_dim);

0 commit comments

Comments
 (0)