title: How to get torch::Tensor shape
body: <p>If we <code>&lt;&lt;</code> a <code>torch::Tensor</code></p>
  <pre><code>#include &lt;torch/script.h&gt;
  int main()
  {
      torch::Tensor input_torch = torch::zeros({2, 3, 4});
      std::cout &lt;&lt; input_torch &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  <p>we see</p>
  <pre><code>(1,.,.) = 
    0  0  0  0
    0  0  0  0
    0  0  0  0
  
  (2,.,.) = 
    0  0  0  0
    0  0  0  0
    0  0  0  0
  [ CPUFloatType{2,3,4} ]
  </code></pre>
  <p>How to get the tensor shape (that <code>2,3,4</code>)? I searched <a href="https://pytorch.org/cppdocs/api/classat_1_1_tensor.html?highlight=tensor" rel="nofollow noreferrer">https://pytorch.org/cppdocs/api/classat_1_1_tensor.html?highlight=tensor</a> for an API call but couldn't find one. And I searched for the <code>operator&lt;&lt;</code> overload code, and also couldn't find it.</p>