!13264 [MD] Fix input check bug in RandomSelectSubpolicyOperation and codex issues

From: @tina_mengting_zhang
Reviewed-by: @robingrosman,@nsyca
Signed-off-by: @robingrosman
This commit is contained in:
mindspore-ci-bot 2021-03-15 20:29:56 +08:00 committed by Gitee
commit 0cf6fb5310
11 changed files with 3 additions and 16 deletions

View File

@ -60,6 +60,5 @@ Status DecodeOp::OutputType(const std::vector<DataType> &inputs, std::vector<Dat
outputs[0] = DataType(DataType::DE_UINT8);
return Status::OK();
}
} // namespace dataset
} // namespace mindspore

View File

@ -36,10 +36,8 @@
namespace mindspore {
namespace dataset {
// Transform operations for data.
namespace transforms {
/* ####################################### Derived TensorOperation classes ################################# */
// (In alphabetical order)
@ -157,7 +155,6 @@ Status UniqueOperation::ValidateParams() { return Status::OK(); }
std::shared_ptr<TensorOp> UniqueOperation::Build() { return std::make_shared<UniqueOp>(); }
#endif
} // namespace transforms
} // namespace dataset
} // namespace mindspore

View File

@ -26,7 +26,6 @@
namespace mindspore {
namespace dataset {
// Char arrays storing name of corresponding classes (in alphabetical order)
constexpr char kComposeOperation[] = "Compose";
constexpr char kDuplicateOperation[] = "Duplicate";

View File

@ -25,7 +25,6 @@
namespace mindspore {
namespace dataset {
// Abstract class to represent a dataset in the data pipeline.
class TensorOperation : public std::enable_shared_from_this<TensorOperation> {
public:

View File

@ -17,7 +17,6 @@
namespace mindspore {
namespace dataset {
/* ####################################### Validator Functions ############################################ */
Status ValidateProbability(const std::string &op_name, const float probability) {
if (probability < 0.0 || probability > 1.0) {

View File

@ -27,7 +27,6 @@
namespace mindspore {
namespace dataset {
// Helper function to validate probability
Status ValidateProbability(const std::string &op_name, const float probability);

View File

@ -1210,6 +1210,8 @@ Status RandomSelectSubpolicyOperation::ValidateParams() {
std::string err_msg = "RandomSelectSubpolicy: transform in policy" + transform_pos + " must not be null";
MS_LOG(ERROR) << err_msg;
RETURN_STATUS_SYNTAX_ERROR(err_msg);
} else {
RETURN_IF_NOT_OK(policy_[i][j].first->ValidateParams());
}
if (policy_[i][j].second < 0.0 || policy_[i][j].second > 1.0) {
std::string transform_pos = "[" + std::to_string(i) + "]" + "[" + std::to_string(j) + "]";

View File

@ -47,10 +47,8 @@
namespace mindspore {
namespace dataset {
// Transform operations for text.
namespace text {
/* ####################################### Derived TensorOperation classes ################################# */
// (In alphabetical order)
@ -421,7 +419,6 @@ std::shared_ptr<TensorOp> WhitespaceTokenizerOperation::Build() {
return tensor_op;
}
#endif
} // namespace text
} // namespace dataset
} // namespace mindspore

View File

@ -27,13 +27,11 @@
namespace mindspore {
namespace dataset {
class Vocab;
class SentencePieceVocab;
// Transform operations for text
namespace text {
// Char arrays storing name of corresponding classes (in alphabetical order)
constexpr char kBasicTokenizerOperation[] = "BasicTokenizer";
constexpr char kBertTokenizerOperation[] = "BertTokenizer";

View File

@ -24,7 +24,6 @@
namespace mindspore {
namespace dataset {
// Helper function to validate tokenizer directory parameter
Status ValidateTokenizerDirParam(const std::string &tokenizer_name, const std::string &tokenizer_file);

View File

@ -357,6 +357,5 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail4) {
// Create an iterator over the result of the above dataset
std::shared_ptr<Iterator> iter = ds->CreateIterator();
// Expect failure: Invalid RandomSelectSubpolicy input
// EXPECT_EQ(iter, nullptr);
// FIXME - Code bug; this case wrongly succeeds.
EXPECT_EQ(iter, nullptr);
}