title: tensor extension of one-dimensional index into multi-dimensional index
body: <p>I wanna make a function of a multi-dimensional array from one-dimensional index array with any dimension.
  For example, I have</p>
  
  <pre><code>x=np.array([1,2,3])
  def extend_array(x,d)
  </code></pre>
  
  <p>If I put d=2, then the resulting array is</p>
  
  <pre><code>[[1,1],
   [1,2],
   [1,3],
   [2,1],
   [2,2],
   [2,3],
   [3,1],
   [3,2],
   [3,3]]
  </code></pre>
  
  <p>or input can be (n,d) instead of (x,d) so that n refers </p>
  
  <pre><code>np.array(range(1,n+1))
  </code></pre>
  
  <p>I think there is a function for this, but I cannot find one. 
  Would you please help me with this problem?</p>