forked from mindspore-Ecosystem/mindspore
fix deser python operation error
This commit is contained in:
parent
d2df9652ca
commit
a0c203df23
|
@ -234,7 +234,7 @@ Status Serdes::ConstructTensorOps(nlohmann::json json_obj, std::vector<std::shar
|
|||
std::vector<std::shared_ptr<TensorOperation>> output;
|
||||
for (nlohmann::json item : json_obj) {
|
||||
if (item.find("python_module") != item.end()) {
|
||||
if (Py_IsInitialized()) {
|
||||
if (Py_IsInitialized() != 0) {
|
||||
RETURN_IF_NOT_OK(PyFuncOp::from_json(item, result));
|
||||
} else {
|
||||
RETURN_STATUS_SYNTAX_ERROR("Python module is not initialized or Pyfunction is not supported on this platform.");
|
||||
|
|
|
@ -530,7 +530,9 @@ TEST_F(MindDataTestDeserialize, TestDeserializeConcatAlbumFlickr) {
|
|||
|
||||
TEST_F(MindDataTestDeserialize, TestDeserializePyFunc) {
|
||||
MS_LOG(INFO) << "Doing MindDataTestDeserialize-PyFunc.";
|
||||
std::shared_ptr<DatasetNode> ds1;
|
||||
ASSERT_OK(Serdes::Deserialize("./data/dataset/tf_file_dataset/pyvision_dataset_pipeline.json", &ds1));
|
||||
EXPECT_NE(ds1, nullptr);
|
||||
if (Py_IsInitialized() != 0) {
|
||||
std::shared_ptr<DatasetNode> ds1;
|
||||
ASSERT_OK(Serdes::Deserialize("./data/dataset/tf_file_dataset/pyvision_dataset_pipeline.json", &ds1));
|
||||
EXPECT_NE(ds1, nullptr);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue