title: Pytorch AttributeError: module 'torch' has no attribute 'as_tensor'
body: <pre><code>$ python main.py --hetero
  Created directory results/ACMRaw_2020-01-13_01-20-26
  Traceback (most recent call last):
    File "main.py", line 101, in &lt;module&gt;
      main(args)
    File "main.py", line 30, in main
      val_mask, test_mask = load_data(args['dataset'])
    File "/home/cnudi1/wook/dgl/examples/pytorch/han/utils.py", line 225, in load_data
      return load_acm_raw(remove_self_loop)
    File "/home/cnudi1/wook/dgl/examples/pytorch/han/utils.py", line 189, in load_acm_raw
      pa = dgl.bipartite(p_vs_a, 'paper', 'pa', 'author')
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/convert.py", line 260, in bipartite
      return create_from_scipy(data, utype, etype, vtype)
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/convert.py", line 823, in create_from_scipy
      indptr = utils.toindex(spmat.indptr)
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 242, in toindex
      return data if isinstance(data, Index) else Index(data)
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 15, in __init__
      self._initialize_data(data)
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 22, in _initialize_data
      self._dispatch(data)
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 75, in _dispatch
      self._user_tensor_data[F.cpu()] = F.zerocopy_from_numpy(self._pydata)
    File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/backend/pytorch/tensor.py", line 276, in zerocopy_from_numpy
      return th.as_tensor(np_array)
  AttributeError: module 'torch' has no attribute 'as_tensor'
  </code></pre>
  
  <p>I got an error when I try to run the code (<a href="https://github.com/dmlc/dgl/blob/master/examples/pytorch/han/main.py" rel="nofollow noreferrer">https://github.com/dmlc/dgl/blob/master/examples/pytorch/han/main.py</a>)</p>
  
  <p>from the DGL 
  (<a href="https://github.com/dmlc/dgl" rel="nofollow noreferrer">https://github.com/dmlc/dgl</a>)</p>
  
  <p>It requires CUDA and Pytorch so I managed to install it.</p>
  
  <p>But I got an error and couldn't find the solution with Google/Stackoverflow search</p>
  
  <p>My environment is </p>
  
  <ul>
  <li>Linux minsky 3.10.0-957.5.1.el7.ppc64le</li>
  <li>CentOS</li>
  <li>Python 3.6.9</li>
  <li>Conda 4.5.11</li>
  <li>CUDA 10.1</li>
  <li>NVCC 10.1</li>
  <li>Pytorch 0.4.0</li>
  <li>Torchvision 0.2.1</li>
  </ul>
  
  <p>Pytorch works fine in Python</p>
  
  <pre><code>&gt;&gt;&gt; import torch
  &gt;&gt;&gt; print (torch.__version__)
  0.4.0
  &gt;&gt;&gt; import torchvision
  &gt;&gt;&gt; print (torchvision.__version__)
  0.2.1
  </code></pre>
  
  <p>Please could you help me out?</p>
  
  <p>* DGL is installed from the source code</p>
  
  <p>** Pytorch is installed with conda from channel:engility(<a href="https://stackoverflow.com/questions/52750622/how-to-install-pytorch-on-power-8-or-ppc64-machine">How to install pytorch on Power 8 or PPC64 machine?</a>)</p>
  
  <pre><code>conda install -c engility pytorch
  </code></pre>
  
  <p>because other ways(default conda, pip, install from the source code) never works for ppc64le</p>