Skip to content

Commit

Permalink
remove MaxFunctor
Browse files Browse the repository at this point in the history
  • Loading branch information
joey12300 committed Sep 19, 2021
1 parent 36f371b commit 9525039
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions paddle/fluid/operators/viterbi_decode_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ using EigenVector = framework::EigenVector<T, MajorType, IndexType>;
dev_ctx); \
cast_functor.template apply<dtype>()

struct MaxFunctor {
template <typename DeviceContext, typename X, typename Y, typename Dim>
void operator()(const DeviceContext& place, X* x, Y* y, const Dim& dim) {
y->device(place) = x->maximum(dim);
}
};

template <typename DeviceContext, typename T, size_t D, size_t R_D>
inline void MAX_FUNC(const framework::ExecutionContext& ctx,
const Tensor* input, Tensor* output,
Expand All @@ -97,13 +90,12 @@ inline void MAX_FUNC(const framework::ExecutionContext& ctx,
}
DDim out_dims = output->dims();
auto& place = *dev_ctx.eigen_device();
MaxFunctor functor;
if (D == 1) {
auto out = EigenScalar<T>::From(*output);
functor(place, &x, &out, reduce_dim);
out.device(place) = x.maximum(reduce_dim);
} else {
auto out = EigenTensor<T, (D - R_D)>::From(*output, out_dims);
functor(place, &x, &out, reduce_dim);
out.device(place) = x.maximum(reduce_dim);
}
}

Expand Down

0 comments on commit 9525039

Please sign in to comment.