嗨,我有一个在Matlab的代码,这是生成以下序列。你知道吗
[ones(1,6*2) 2 ones(1,6*2-1) 2 ones(1,6*2) 1]
ans =
Columns 1 through 18
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1
Columns 19 through 36
1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1
Columns 37 through 38
1 1
我想在Python中生成类似的数字数组。你知道吗
我试图产生如下。你知道吗
ConvStride = [np.ones((12,),dtype=int),2,np.ones((11,),dtype=int),2,np.ones((12,),dtype=int),1]
Ans= [1 1 1 1 1... 1],2,[1 1 1 ... 1],2,[1 1 1 1....1],1
ConvStride = [np.ones((12,),dtype=int),2,np.ones((11,),dtype=int),2,np.ones((12,),dtype=int),1]
必需的
[1 1…..1 2 1 1…..1 2 111…..1 1]
你能告诉我这附近有什么工作吗。你知道吗
您可以使用类似的python语法创建一个列表,然后将其转换为numpy数组
如果您想用numpy来完成这一切,您可以使用
hstack
。你知道吗使用
np.r_
:相关问题 更多 >
编程相关推荐