<p dir="auto">The first line is working, the second one, on GPU, returns an error</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="torch.FloatTensor(3, 4).random_(2)
torch.FloatTensor(3, 4).cuda().random_(2)"><pre class="notranslate"><span class="pl-s1">torch</span>.<span class="pl-v">FloatTensor</span>(<span class="pl-c1">3</span>, <span class="pl-c1">4</span>).<span class="pl-en">random_</span>(<span class="pl-c1">2</span>)
<span class="pl-s1">torch</span>.<span class="pl-v">FloatTensor</span>(<span class="pl-c1">3</span>, <span class="pl-c1">4</span>).<span class="pl-en">cuda</span>().<span class="pl-en">random_</span>(<span class="pl-c1">2</span>)</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="AttributeError: 'FloatTensor' object has no attribute 'random_'"><pre class="notranslate"><code class="notranslate">AttributeError: 'FloatTensor' object has no attribute 'random_'
</code></pre></div>
<blockquote>
<p dir="auto">torch.Tensor(10).random_(0,10) #works<br>
torch.Tensor(10).random_(0,10).cuda() #works<br>
torch.Tensor(10).cuda().random_(0,10) #does not work</p>
</blockquote>