diff --git a/mindspore/ccsrc/minddata/dataset/core/de_tensor.h b/mindspore/ccsrc/minddata/dataset/core/de_tensor.h index e9754b58f58..015dd5ac4fb 100644 --- a/mindspore/ccsrc/minddata/dataset/core/de_tensor.h +++ b/mindspore/ccsrc/minddata/dataset/core/de_tensor.h @@ -36,7 +36,7 @@ class DETensor : public mindspore::MSTensor::Impl { ~DETensor() = default; explicit DETensor(std::shared_ptr tensor_impl); #ifndef ENABLE_ANDROID - explicit DETensor(std::shared_ptr device_tensor_impl, bool is_device); + DETensor(std::shared_ptr device_tensor_impl, bool is_device); #endif const std::string &Name() const override; diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc index 3e208f98bac..4e3ae917c0b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc @@ -89,6 +89,13 @@ Status MindDataNode::ValidateParams() { RETURN_STATUS_SYNTAX_ERROR(err_msg); } + if (shuffle_mode_ != ShuffleMode::kFalse && shuffle_mode_ != ShuffleMode::kFiles && + shuffle_mode_ != ShuffleMode::kGlobal && shuffle_mode_ != ShuffleMode::kInfile) { + std::string err_msg = "TFRecordNode: Invalid ShuffleMode, check input value of enum."; + MS_LOG(ERROR) << err_msg; + RETURN_STATUS_SYNTAX_ERROR(err_msg); + } + std::vector dataset_file_vec = search_for_pattern_ ? std::vector{dataset_file_} : dataset_files_; RETURN_IF_NOT_OK(ValidateDatasetFilesParam("MindDataNode", dataset_file_vec)); diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_image_utils.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_image_utils.cc index 9fd3b27c327..b7543cef3ed 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_image_utils.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_image_utils.cc @@ -343,11 +343,6 @@ Status Normalize(const std::shared_ptr &input, std::shared_ptr * const_cast(reinterpret_cast(input->GetBuffer())), GetLiteCVDataType(input->type())); - std::shared_ptr output_tensor; - RETURN_IF_NOT_OK(Tensor::CreateEmpty(input->shape(), DataType(DataType::DE_FLOAT32), &output_tensor)); - - uint8_t *buffer = reinterpret_cast(&(*output_tensor->begin())); - if (input->type() == DataType::DE_UINT8) { LiteMat lite_mat_float; // change input to float @@ -359,6 +354,10 @@ Status Normalize(const std::shared_ptr &input, std::shared_ptr * } CHECK_FAIL_RETURN_UNEXPECTED(ret, "Normalize: normalize failed."); + std::shared_ptr output_tensor; + RETURN_IF_NOT_OK(Tensor::CreateFromMemory(input->shape(), DataType(DataType::DE_FLOAT32), + static_cast(lite_mat_norm.data_ptr_), &output_tensor)); + *output = output_tensor; } catch (std::runtime_error &e) { RETURN_STATUS_UNEXPECTED("Normalize: " + std::string(e.what()));