tensorflow之tf.meshgrid()

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]]

举例,含有三个参数

 

参考文献:https://blog.csdn.net/mou_it/article/details/82083984

posted @ 2019-06-28 14:56  是大高呀  阅读(7339)  评论(0编辑  收藏  举报