meshgrid用于从数组a和b产生网格。生成的网格矩阵A和B大小是相同的。它也可以是更高维的。用法: [A,B]=Meshgrid(a,b),生成size(b)Xsize(a)大小的矩阵A和B。它相当于a从一行重复增加到size(b)行,把b转置成一列再重复增加到size(a)列
a=[0,5,10]
b=[0,5,15,20,25]
A,B=tf.meshgrid(a,b)
with tf.Session() as sess:
print (A.eval())
print (B.eval())
结果:
[[ 0 5 10]
[ 0 5 10]
[ 0 5 10]
[ 0 5 10]
[ 0 5 10]]
[[ 0 0 0]
[ 5 5 5]
[15 15 15]
[20 20 20]
[25 25 25]]
举例,含有三个参数