These are chat archives for arita37/tensorflow

24th
Nov 2016
Paweł Biernat
@pwl
Nov 24 2016 15:25
Hi, I'm just starting with the tensorflow and I have a question. Say I have a vector x=[1,2,3] with a shape [3], how do I produce a matrix with columns coming from x, something like [x,x,x,x], with a shape [3,4]? Mathematically it could be described as the outer product of [1,2,3] and [1,1,1,1].
Paweł Biernat
@pwl
Nov 24 2016 15:35
If that helps, I'm trying to run Edward with w = Normal(mu=tf.zeros([D, K]), sigma=sigma0 * tf.ones([D, K])), and I would like to change tf.ones([D,K]) into the outer product matrix that I described.
Paweł Biernat
@pwl
Nov 24 2016 15:49

answering my own question

x1,y1=tf.meshgrid(tf.constant([1,2,3,4]),tf.ones(2),indexing='ij')

seems to do the job.