Browse Source

Add decodeOp validate

tags/v0.7.0-beta
xiefangqi 5 years ago
parent
commit
a8cc48c6b8
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.cc

+ 4
- 0
mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.cc View File

@@ -32,6 +32,10 @@ DecodeOp::DecodeOp(bool is_rgb_format) : is_rgb_format_(is_rgb_format) {

Status DecodeOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output) {
IO_CHECK(input, output);
// check the input tensor shape
if (input->Rank() != 1) {
RETURN_STATUS_UNEXPECTED("DecodeOp error: invalid input shape, only support 1D input.");
}
if (is_rgb_format_) { // RGB colour mode
return Decode(input, output);
} else { // BGR colour mode


Loading…
Cancel
Save