title: Loading n-dimensional tensor for pytorch from text file
body: <p>I have a 3-dimensional tensor that I create outside of my python code and am able to encode in any human-readable format. I need to load the values of this tensor as a frozen layer to my <code>pytorch</code> NN. I've tried to encode the tensor as a text file in the form <code>[[[a,b],[c,d]], [[e,f], [g,h]], [[k,l],[m,n]]]</code> which seemed to be the most logical way for that. Then I tried to read its value via</p>
  <pre><code>tensor = torch.from_numpy(np.loadtxt(&quot;./arrays/tensor.txt&quot;))
  </code></pre>
  <p>but got the exception in <code>npyio.py</code></p>
  <pre><code>ValueError: could not convert string to float: '[[[-2.888356,'
  </code></pre>
  <p>Apparently, that's not how it works and the values are to be written as plain numbers separated by spaces and <code>\n</code>, but then I don't see how to easily read the data of dimension &gt;= 2 with <code>numpy</code>.</p>
  <p>What could be other simple methods to write down and read the tensor value into a <code>pytorch</code> tensor?</p>