Skip to content

Commit

Permalink
use TileD
Browse files Browse the repository at this point in the history
  • Loading branch information
Meiyim committed Mar 16, 2021
1 parent 75c632f commit 0b44afc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions paddle/fluid/operators/expand_op_npu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,13 @@ class ExpandNPUKernel : public framework::OpKernel<T> {
"of dimensions (%d) of the input.",
expand_times.size(), static_cast<size_t>(in_dims.size())));
auto* out0 = context.Output<framework::LoDTensor>("Out");
out0->mutable_data<T>(context.device_context().GetPlace());
framework::DDim out_dims(in_dims);
for (size_t i = 0; i < expand_times.size(); ++i) {
out_dims[i] *= expand_times[i];
}
out0->Resize(out_dims);

framework::LoDTensor expand_times_t;
TensorFromVector(expand_times, context.device_context(), &expand_times_t);

auto runner = NpuOpRunner("Tile", {*in0, expand_times_t}, {*out0});
auto runner = NpuOpRunner("TileD", {*in0}, {*out0}, {{"multiples", expand_times}});
auto stream =
context.template device_context<paddle::platform::NPUDeviceContext>()
.stream();
Expand Down

0 comments on commit 0b44afc

Please sign in to comment.