这是我用来生成随机偏差并将其存储为数组列表的代码。我试过回读存储的CSV文件,但格式不再是数组列表。有人能告诉我如何以相同的格式取回baizes吗?我不是要对列表进行排序,我只是想回读CSV文件并保留原始格式。提前谢谢!
import csv
import numpy as np
sizes = [784, 30, 10]
biases = [np.random.randn(y, 1) for y in sizes[1:]]
#weights = [np.random.randn(y, x) for x, y in zip(sizes[:-1], sizes[1:])]
biasfile0 = open('C:/Users/Sharath Talikatte/Desktop/Neural
Networks/bias0.csv', 'w', encoding='utf-8')
with biasfile0:
writerb0 = csv.writer(biasfile0)
writerb0.writerow(biases[0])
biasfile1 = open('C:/Users/Sharath Talikatte/Desktop/Neural
Networks/bias1.csv', 'w', encoding='utf- 8')
with biasfile1:
writerb1 = csv.writer(biasfile1)
writerb1.writerow(biases[1])