Browse Source

fix to_number

tags/v1.1.0
luoyang 5 years ago
parent
commit
7587db9eaa
2 changed files with 4 additions and 3 deletions
  1. +2
    -3
      mindspore/ccsrc/minddata/dataset/api/text.cc
  2. +2
    -0
      mindspore/ccsrc/minddata/dataset/text/kernels/to_number_op.cc

+ 2
- 3
mindspore/ccsrc/minddata/dataset/api/text.cc View File

@@ -485,9 +485,8 @@ std::shared_ptr<TensorOp> SlidingWindowOperation::Build() {
ToNumberOperation::ToNumberOperation(DataType data_type) : data_type_(data_type) {}

Status ToNumberOperation::ValidateParams() {
if (!data_type_.IsNumeric()) {
std::string err_msg =
"ToNumber : The parameter data_type must be a numeric type: " + std::to_string(data_type_.value());
if (!data_type_.IsNumeric() || data_type_.IsBool()) {
std::string err_msg = "ToNumber : The parameter data_type must be a numeric type, got: " + data_type_.ToString();
MS_LOG(ERROR) << err_msg;
RETURN_STATUS_SYNTAX_ERROR(err_msg);
}


+ 2
- 0
mindspore/ccsrc/minddata/dataset/text/kernels/to_number_op.cc View File

@@ -73,6 +73,8 @@ Status ToNumberOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr
case DataType::DE_FLOAT64:
RETURN_IF_NOT_OK(ToDouble(input, output));
break;
default:
RETURN_STATUS_UNEXPECTED("Unsupported cast type: " + cast_to_type_.ToString());
}

return Status::OK();


Loading…
Cancel
Save