change size

This commit is contained in:
panfengfeng 2020-07-21 12:02:58 +08:00
parent 25e587e483
commit 5aad4bdfbf
2 changed files with 3 additions and 3 deletions

View File

@ -37,8 +37,8 @@ Status CenterCropOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_p
int32_t left = crop_wid_ - input->shape()[1];
std::shared_ptr<Tensor> pad_image;
CHECK_FAIL_RETURN_UNEXPECTED((top < input->shape()[0] * 10 && left < input->shape()[1] * 10),
"CenterCropOp padding size is too big, it's more than 10 times the original size.");
CHECK_FAIL_RETURN_UNEXPECTED((top < input->shape()[0] * 3 && left < input->shape()[1] * 3),
"CenterCropOp padding size is too big, it's more than 3 times the original size.");
if (top > 0 && left > 0) { // padding only
return Pad(input, output, top / 2 + top % 2, top / 2, left / 2 + left % 2, left / 2, BorderType::kConstant);

View File

@ -145,7 +145,7 @@ def test_center_crop_errors():
try:
test_center_crop_op(16777216, 16777216)
except RuntimeError as e:
assert "Unexpected error. CenterCropOp padding size is too big, it's more than 10 times the original size." in \
assert "Unexpected error. CenterCropOp padding size is too big, it's more than 3 times the original size." in \
str(e)