Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix_uninitialized_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommliu committed Mar 17, 2020
1 parent 97dd362 commit 009e538
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/operator/numpy/np_interp_op-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,15 @@ void NumpyInterpForward(const nnvm::NodeAttrs& attrs,

TBlob x, idx;
if (x_scalar.has_value()) {
double x_value = x_scalar.value();
Tensor<cpu, 1, double> host_x(&x_value, Shape1(1), ctx.get_stream<cpu>());
double* x_value_ptr = new double;
*x_value_ptr = x_scalar.value();
Tensor<cpu, 1, double> host_x(x_value_ptr, Shape1(1), ctx.get_stream<cpu>());
Tensor<xpu, 1, double> device_x(reinterpret_cast<double*>(workspace_curr_ptr),
Shape1(1), ctx.get_stream<xpu>());
Copy(device_x, host_x, ctx.get_stream<xpu>());
x = TBlob(device_x.dptr_, TShape(0, 1), xpu::kDevMask);
workspace_curr_ptr += 8;
delete x_value_ptr;
} else {
x = inputs[2];
} // handle input x is a scalar
Expand Down

0 comments on commit 009e538

Please sign in to comment.