张量转为数组

#train_features是三维张量
 #1. 首先将张量转为list类型
 #2. 然后将list转为array数组类型
print('类型:前',type(train_features))
print('形状:前 ',train_features.shape)

train_features = [vec for vec in train_features]
train_feature=np.array(train_features)

print('类型: 后',type(train_feature))
print('形状:后shape ',train_feature.shape)

你可能感兴趣的:(代码调试,python,array,张量)