评测执行文件

This commit is contained in:
夏军 2020-07-21 22:36:20 +08:00
parent 0dfb6cd7f6
commit d52df50055
1 changed files with 19 additions and 0 deletions

19
test_file.py Normal file
View File

@ -0,0 +1,19 @@
from student_task import data_pre_handle
import numpy as np
import mindspore.dataset as ds
# 数据生成函数
def generator_func():
for i in range(5):
yield (np.array([i, i+1, i+2]),)
if __name__ == '__main__':
index = int(input())
# 创建数据集
ds1 = ds.GeneratorDataset(generator_func, ["data"])
func = lambda x: x * index
# 执行映射
data = ds1.map(operations=func)
res = data_pre_handle(data)
for data in res.create_dict_iterator():
print(data["data"])