From 8a7c85bcfea684e4529046c4182d2bac9eab9d0c Mon Sep 17 00:00:00 2001 From: xulei2020 <“xulei83@huawei.com”> Date: Mon, 16 Nov 2020 21:48:08 +0800 Subject: [PATCH] fix same colum name check in buildSentenceVocabNode --- .../engine/ir/datasetops/build_sentence_piece_vocab_node.cc | 4 ++++ .../minddata/dataset/kernels/image/lite_cv/lite_mat.cc | 6 ++---- mindspore/dataset/text/transforms.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc index 9d3a17b559..eaf8378639 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc @@ -74,6 +74,10 @@ Status BuildSentenceVocabNode::ValidateParams() { RETURN_STATUS_SYNTAX_ERROR(err_msg); } + if (!col_names_.empty()) { + RETURN_IF_NOT_OK(ValidateDatasetColumnParam("BuildVocabNode", "columns", col_names_)); + } + return Status::OK(); } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc index 7d247eeddb..d77084ad7f 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc @@ -198,8 +198,7 @@ void LiteMat::Init(int width, int height, void *p_data, LDataType data_type) { c_step_ = height_ * width_; size_ = c_step_ * channel_ * elem_size_; data_ptr_ = p_data; - ref_count_ = new int[1]; - *ref_count_ = 0; + ref_count_ = nullptr; } void LiteMat::Init(int width, int height, int channel, LDataType data_type) { @@ -227,8 +226,7 @@ void LiteMat::Init(int width, int height, int channel, void *p_data, LDataType d c_step_ = height_ * width_; size_ = c_step_ * channel_ * elem_size_; data_ptr_ = p_data; - ref_count_ = new int[1]; - *ref_count_ = 0; + ref_count_ = nullptr; } bool LiteMat::IsEmpty() const { return data_ptr_ == 0 || data_ptr_ == nullptr || c_step_ * channel_ == 0; } diff --git a/mindspore/dataset/text/transforms.py b/mindspore/dataset/text/transforms.py index 56ceb736b0..aeb7ba504d 100644 --- a/mindspore/dataset/text/transforms.py +++ b/mindspore/dataset/text/transforms.py @@ -76,7 +76,7 @@ class Lookup(cde.LookupOp): >>> # Load vocabulary from list >>> vocab = text.Vocab.from_list(['深', '圳', '欢', '迎', '您']) >>> # Use Lookup operator to map tokens to ids - >>> lookup = text.Lookup(vocab, "") + >>> lookup = text.Lookup(vocab) >>> data1 = data1.map(operations=[lookup]) """