0
点赞
收藏
分享

微信扫一扫

python深度学习基于pytorch代码1.5批量处理

腊梅5朵 2022-03-15 阅读 70
import numpy as np
data_train = np.random.randn(10000, 2, 3)
print(data_train.shape)
np.random.shuffle(data_train)
batch_size = 100
for i in range(0, len(data_train), batch_size):
    x_batch_sum = np.sum(data_train[i:i+batch_size])
    print("第{}批次,该批次的数据之和:{}".format(i, x_batch_sum))
举报

相关推荐

0 条评论