Create an array of N elements and then reshape it into the form you wanted.
np.arange(0,16)
#output = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
# reshape it
output.reshape(4,2,2) # (number of batches, number of row , number of columns)
# array([[[ 0, 1],
[ 2, 3]],
[[ 4, 5],
[ 6, 7]],
[[ 8, 9],
[10, 11]],
[[12, 13],
[14, 15]]])
1条答案
按热度按时间igetnqfo1#
正如Mark Reed提到的,提供一点上下文会很有帮助,但如果你只是想知道如何创建数组序列,一个答案可能是: