# 假设您的一维 NumPy 数组为 data_array
data_array = fc1_weight
# COE 文件路径
coe_file_path = "AAAfc1_weight.coe"
# 将数据转换为 COE 格式(带逗号)
coe_data = ",\n".join(str(int(x)) for x in data_array)
# 写入 COE 文件
with open(coe_file_path, "w") as coe_file:
coe_file.write("memory_initialization_radix=10;\n")
coe_file.write("memory_initialization_vector=\n")
coe_file.write(coe_data)
coe_file.write(";\n")
print("COE file created:", coe_file_path)
一维np写入coe
最新推荐文章于 2024-08-18 02:05:51 发布