fix resize issues of reshape and conv2d lite ops

pull/8440/head
liuwenhao4 4 years ago
parent eb5ae1a0fc
commit b1a868744c

@ -390,8 +390,8 @@ int Conv2D::InferShape(std::vector<Tensor *> inputs_, std::vector<Tensor *> outp
this->ConvInferShape(input_h, input_w, &output_h, &output_w); this->ConvInferShape(input_h, input_w, &output_h, &output_w);
std::vector<int> out_shape{input_tensor->shape()}; std::vector<int> out_shape{input_tensor->shape()};
out_shape.at(1) = output_h; out_shape.at(1) = output_h > 0 ? output_h : 1;
out_shape.at(2) = output_w; out_shape.at(2) = output_w > 0 ? output_w : 1;
out_shape.at(3) = weight_tensor->shape()[0]; out_shape.at(3) = weight_tensor->shape()[0];
out_tensor->set_shape(out_shape); out_tensor->set_shape(out_shape);

@ -51,7 +51,7 @@ int ReshapeInt8CPUKernel::Init() {
int ReshapeInt8CPUKernel::ReSize() { return 0; } int ReshapeInt8CPUKernel::ReSize() { return 0; }
int ReshapeInt8CPUKernel::Run() { int ReshapeInt8CPUKernel::Run() {
MS_ASSERT(in_tensors_.size() == 1); MS_ASSERT(in_tensors_.size() == 1 || in_tensors_.size() == 2);
MS_ASSERT(out_tensors_.size() == 1); MS_ASSERT(out_tensors_.size() == 1);
input_data_ = static_cast<int8_t *>(in_tensors_.at(kInputIndex)->MutableData()); input_data_ = static_cast<int8_t *>(in_tensors_.at(kInputIndex)->MutableData());
output_data_ = static_cast<int8_t *>(out_tensors_.at(kOutputIndex)->MutableData()); output_data_ = static_cast<int8_t *>(out_tensors_.at(kOutputIndex)->MutableData());

Loading…
Cancel
Save