forked from mindspore-Ecosystem/mindspore
Rectification error
This commit is contained in:
parent
b554413bd8
commit
c6ea60746a
|
@ -52,7 +52,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|||
set(jpeg_turbo_LIBPATH ${jpeg_turbo_LIBPATH}/../bin/)
|
||||
set(sqlite_LIBPATH ${sqlite_LIBPATH}/../bin/)
|
||||
set(tinyxml2_LIBPATH ${tinyxml2_LIBPATH}/../bin/)
|
||||
set(sentencepiece_LIBPATH ${sentencepiece_LIBPATH}/../bin/)
|
||||
else()
|
||||
set(INSTALL_LIB_DIR "lib")
|
||||
endif()
|
||||
|
@ -136,14 +135,6 @@ if(ENABLE_MINDDATA)
|
|||
DESTINATION ${INSTALL_LIB_DIR}
|
||||
COMPONENT mindspore
|
||||
)
|
||||
file(GLOB_RECURSE SENTENCEPIECE_LIB_LIST
|
||||
${sentencepiece_LIBPATH}/libsentencepiece*
|
||||
)
|
||||
install(
|
||||
FILES ${SENTENCEPIECE_LIB_LIST}
|
||||
DESTINATION ${INSTALL_LIB_DIR}
|
||||
COMPONENT mindspore
|
||||
)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
message("icu4c does not support windows system temporarily")
|
||||
else()
|
||||
|
|
|
@ -351,7 +351,7 @@ Status BatchOp::InvokeBatchSizeFunc(int32_t *batch_size, CBatchInfo info) {
|
|||
"Invalid parameter, batch_size function should return an integer greater than 0.");
|
||||
}
|
||||
}
|
||||
return Status(StatusCode::kSuccess, "batch_size function call succeedeed.");
|
||||
return Status(StatusCode::kSuccess, "batch_size function call succeeded.");
|
||||
}
|
||||
|
||||
Status BatchOp::InvokeBatchMapFunc(TensorTable *input, TensorTable *output, CBatchInfo info) {
|
||||
|
|
|
@ -44,7 +44,9 @@ Status CropOp::OutputShape(const std::vector<TensorShape> &inputs, std::vector<T
|
|||
if (inputs[0].Rank() == 2) outputs.emplace_back(out);
|
||||
if (inputs[0].Rank() == 3) outputs.emplace_back(out.AppendDim(inputs[0][2]));
|
||||
if (!outputs.empty()) return Status::OK();
|
||||
return Status(StatusCode::kMDUnexpectedError, "Crop: invalid input shape.");
|
||||
return Status(StatusCode::kMDUnexpectedError,
|
||||
"Crop: invalid input shape, expected 2D or 3D input, but got input dimension is:" +
|
||||
std::to_string(inputs[0].Rank()));
|
||||
}
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -60,7 +60,7 @@ void CutMixBatchOp::GetCropBox(int height, int width, float lam, int *x, int *y,
|
|||
|
||||
Status CutMixBatchOp::ValidateCutMixBatch(const TensorRow &input) {
|
||||
if (input.size() < 2) {
|
||||
RETURN_STATUS_UNEXPECTED("CutMixBatch: both image and label columns are required.");
|
||||
RETURN_STATUS_UNEXPECTED("CutMixBatch: invalid input, both image and label columns are required.");
|
||||
}
|
||||
std::vector<int64_t> image_shape = input.at(0)->shape().AsVector();
|
||||
std::vector<int64_t> label_shape = input.at(1)->shape().AsVector();
|
||||
|
|
|
@ -52,7 +52,9 @@ Status DecodeOp::OutputShape(const std::vector<TensorShape> &inputs, std::vector
|
|||
TensorShape out({-1, -1, 3}); // we don't know what is output image size, but we know it should be 3 channels
|
||||
if (inputs[0].Rank() == 1) outputs.emplace_back(out);
|
||||
if (!outputs.empty()) return Status::OK();
|
||||
return Status(StatusCode::kMDUnexpectedError, "Decode: invalid input shape.");
|
||||
return Status(
|
||||
StatusCode::kMDUnexpectedError,
|
||||
"Decode: invalid input shape, expected 1D input, but got input dimension is:" + std::to_string(inputs[0].Rank()));
|
||||
}
|
||||
|
||||
Status DecodeOp::OutputType(const std::vector<DataType> &inputs, std::vector<DataType> &outputs) {
|
||||
|
|
|
@ -33,7 +33,9 @@ Status HwcToChwOp::OutputShape(const std::vector<TensorShape> &inputs, std::vect
|
|||
TensorShape out = TensorShape{in[2], in[0], in[1]};
|
||||
if (inputs[0].Rank() == 3) outputs.emplace_back(out);
|
||||
if (!outputs.empty()) return Status::OK();
|
||||
return Status(StatusCode::kMDUnexpectedError, "HWC2CHW: invalid input shape.");
|
||||
return Status(
|
||||
StatusCode::kMDUnexpectedError,
|
||||
"HWC2CHW: invalid input shape, expected 3D input, but got input dimension is:" + std::to_string(inputs[0].Rank()));
|
||||
}
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -403,11 +403,15 @@ Status Crop(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *outpu
|
|||
}
|
||||
// account for integer overflow
|
||||
if (y < 0 || (y + h) > input_cv->shape()[0] || (y + h) < 0) {
|
||||
RETURN_STATUS_UNEXPECTED("Crop: invalid y coordinate value for crop");
|
||||
RETURN_STATUS_UNEXPECTED(
|
||||
"Crop: invalid y coordinate value for crop, "
|
||||
"y coordinate value exceeds the boundary of the image.");
|
||||
}
|
||||
// account for integer overflow
|
||||
if (x < 0 || (x + w) > input_cv->shape()[1] || (x + w) < 0) {
|
||||
RETURN_STATUS_UNEXPECTED("Crop: invalid x coordinate value for crop");
|
||||
RETURN_STATUS_UNEXPECTED(
|
||||
"Crop: invalid x coordinate value for crop, "
|
||||
"x coordinate value exceeds the boundary of the image.");
|
||||
}
|
||||
try {
|
||||
TensorShape shape{h, w};
|
||||
|
@ -751,7 +755,9 @@ Status Normalize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *
|
|||
Normalize<double>(input, output, mean, std);
|
||||
break;
|
||||
default:
|
||||
RETURN_STATUS_UNEXPECTED("Normalize: unsupported type.");
|
||||
RETURN_STATUS_UNEXPECTED(
|
||||
"Normalize: unsupported type, currently supported types include "
|
||||
"[bool,int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,int64_t,uint64_t,float16,float,double].");
|
||||
}
|
||||
|
||||
if (input->Rank() == MIN_IMAGE_DIMENSION) {
|
||||
|
@ -965,7 +971,7 @@ Status AdjustSaturation(const std::shared_ptr<Tensor> &input, std::shared_ptr<Te
|
|||
|
||||
Status AdjustHue(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output, const float &hue) {
|
||||
if (hue > 0.5 || hue < -0.5) {
|
||||
RETURN_STATUS_UNEXPECTED("AdjustHue: hue value is not in [-0.5, 0.5].");
|
||||
RETURN_STATUS_UNEXPECTED("AdjustHue: invalid parameter, hue is not within [-0.5, 0.5].");
|
||||
}
|
||||
try {
|
||||
std::shared_ptr<CVTensor> input_cv = CVTensor::AsCVTensor(input);
|
||||
|
|
|
@ -38,7 +38,10 @@ Status InvertOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<T
|
|||
}
|
||||
int num_channels = input_cv->shape()[2];
|
||||
if (num_channels != 3) {
|
||||
RETURN_STATUS_UNEXPECTED("Invert: image shape is incorrect: num of channels != 3");
|
||||
RETURN_STATUS_UNEXPECTED(
|
||||
"Invert: image shape is incorrect, expected num of channels is 3, "
|
||||
"but got:" +
|
||||
std::to_string(num_channels));
|
||||
}
|
||||
std::shared_ptr<CVTensor> output_cv;
|
||||
RETURN_IF_NOT_OK(CVTensor::CreateEmpty(input_cv->shape(), input_cv->type(), &output_cv));
|
||||
|
|
|
@ -244,11 +244,15 @@ Status Crop(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *outpu
|
|||
|
||||
// account for integer overflow
|
||||
if (y < 0 || (y + h) > input->shape()[0] || (y + h) < 0) {
|
||||
RETURN_STATUS_UNEXPECTED("Crop: invalid y coordinate value for crop");
|
||||
RETURN_STATUS_UNEXPECTED(
|
||||
"Crop: invalid y coordinate value for crop"
|
||||
"y coordinate value exceeds the boundary of the image.");
|
||||
}
|
||||
// account for integer overflow
|
||||
if (x < 0 || (x + w) > input->shape()[1] || (x + w) < 0) {
|
||||
RETURN_STATUS_UNEXPECTED("Crop: invalid x coordinate value for crop");
|
||||
RETURN_STATUS_UNEXPECTED(
|
||||
"Crop: invalid x coordinate value for crop"
|
||||
"x coordinate value exceeds the boundary of the image.");
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -48,7 +48,9 @@ Status PadOp::OutputShape(const std::vector<TensorShape> &inputs, std::vector<Te
|
|||
TensorShape out({-1, -1, 3}); // we don't know what is output image size, but we know it should be 3 channels
|
||||
if (inputs[0].Rank() == 1) outputs.emplace_back(out);
|
||||
if (!outputs.empty()) return Status::OK();
|
||||
return Status(StatusCode::kMDUnexpectedError, "Pad: invalid input shape");
|
||||
return Status(
|
||||
StatusCode::kMDUnexpectedError,
|
||||
"Pad: invalid input shape, expected 1D input, but got input dimension is:" + std::to_string(inputs[0].Rank()));
|
||||
}
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -69,9 +69,9 @@ Status RandomCropAndResizeOp::OutputShape(const std::vector<TensorShape> &inputs
|
|||
Status RandomCropAndResizeOp::GetCropBox(int h_in, int w_in, int *x, int *y, int *crop_height, int *crop_width) {
|
||||
*crop_width = w_in;
|
||||
*crop_height = h_in;
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(w_in != 0, "RandomCropAndResize: Width is 0");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(h_in != 0, "RandomCropAndResize: Height is 0");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(aspect_lb_ > 0, "RandomCropAndResize: aspect lower bound must be greater than zero");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(w_in != 0, "RandomCropAndResize: Width cannot be 0.");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(h_in != 0, "RandomCropAndResize: Height cannot be 0.");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(aspect_lb_ > 0, "RandomCropAndResize: aspect lower bound must be greater than zero.");
|
||||
for (int32_t i = 0; i < max_iter_; i++) {
|
||||
double const sample_scale = rnd_scale_(rnd_);
|
||||
// In case of non-symmetrical aspect ratios, use uniform distribution on a logarithmic sample_scale.
|
||||
|
|
|
@ -146,7 +146,9 @@ Status RandomCropOp::OutputShape(const std::vector<TensorShape> &inputs, std::ve
|
|||
if (inputs[0].Rank() == 2) outputs.emplace_back(out);
|
||||
if (inputs[0].Rank() == 3) outputs.emplace_back(out.AppendDim(inputs[0][2]));
|
||||
if (!outputs.empty()) return Status::OK();
|
||||
return Status(StatusCode::kMDUnexpectedError, "RandomCrop: invalid input shape.");
|
||||
return Status(StatusCode::kMDUnexpectedError,
|
||||
"RandomCrop: invalid input shape, expected 2D or 3D input, but got input dimension is:" +
|
||||
std::to_string(inputs[0].Rank()));
|
||||
}
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -76,7 +76,9 @@ Status RandomRotationOp::OutputShape(const std::vector<TensorShape> &inputs, std
|
|||
if (inputs[0].Rank() == 2) outputs.emplace_back(out);
|
||||
if (inputs[0].Rank() == 3) outputs.emplace_back(out.AppendDim(inputs[0][2]));
|
||||
if (!outputs.empty()) return Status::OK();
|
||||
return Status(StatusCode::kMDUnexpectedError, "RandomRotation: invalid input shape.");
|
||||
return Status(StatusCode::kMDUnexpectedError,
|
||||
"RandomRotation: invalid input shape, expected 2D or 3D input, but got input dimension is:" +
|
||||
std::to_string(inputs[0].Rank()));
|
||||
}
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -35,11 +35,11 @@ Status ResizeOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<T
|
|||
int32_t input_w = static_cast<int>(input->shape()[1]);
|
||||
if (size2_ == 0) {
|
||||
if (input_h < input_w) {
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(input_h != 0, "Resize: the input height is 0.");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(input_h != 0, "Resize: the input height cannot be 0.");
|
||||
output_h = size1_;
|
||||
output_w = static_cast<int>(std::lround(static_cast<float>(input_w) / input_h * output_h));
|
||||
} else {
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(input_w != 0, "Resize: the input width is 0.");
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(input_w != 0, "Resize: the input width cannot be 0.");
|
||||
output_w = size1_;
|
||||
output_h = static_cast<int>(std::lround(static_cast<float>(input_h) / input_w * output_w));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue