.cubin.cu(16): error: identifier "tensor" is undefined

Duong_Pham_Anh: <p><strong>When i use torch.jit.trace to convert Pytorch model sang TorchScript model i get error with cupy</strong><br>
My code get Error</p>
<pre><code class="lang-auto">@cupy.util.memoize(for_each_device=True)
def cupy_launch(strFunction, strKernel):
	return cupy.cuda.compile_with_cache(strKernel).get_function(strFunction)
</code></pre>
<pre><code class="lang-auto">Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\cupy\cuda\compiler.py", line 449, in compile
nvrtc.compileProgram(self.ptr, options)
File "cupy\cuda\nvrtc.pyx", line 101, in cupy.cuda.nvrtc.compileProgram
File "cupy\cuda\nvrtc.pyx", line 111, in cupy.cuda.nvrtc.compileProgram
File "cupy\cuda\nvrtc.pyx", line 56, in cupy.cuda.nvrtc.check_status
**cupy.cuda.nvrtc.NVRTCError: NVRTC_ERROR_COMPILATION (6)**
</code></pre>
<pre><code class="lang-auto">File "D:\project\test_1.0.0.pytorch\DIFRINT\models\correlation\correlation.py", line 143, in cupy_launch
return cupy.cuda.compile_with_cache(strKernel).get_function(strFunction)
File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\cupy\cuda\compiler.py", line 297, in compile_with_cache
return _compile_with_cache_cuda(source, options, arch, cache_dir,
File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\cupy\cuda\compiler.py", line 350, in _compile_with_cache_cuda
ptx = compile_using_nvrtc(source, options, arch, name + '.cu')
File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\cupy\cuda\compiler.py", line 158, in compile_using_nvrtc
ptx = prog.compile(options)
File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\cupy\cuda\compiler.py", line 453, in compile
raise CompileException(log, self.src, self.name, options, 'nvrtc')
**cupy.cuda.compiler.CompileException: C:\Users\Admin\AppData\Local\Temp\tmpg65_9di1\8f8f5ff490d72ae331cc951d3896a60d_2.cubin.cu(16): error: identifier "tensor" is undefined**

1 error detected in the compilation of "C:\Users\Admin\AppData\Local\Temp\tmpg65_9di1\8f8f5ff490d72ae331cc951d3896a60d_2.cubin.cu".
</code></pre>
<p><strong>I use Conda on Window 10</strong><br>
<strong>torch==1.6.0</strong><br>
<strong>torchvision==0.7.0</strong><br>
<strong>cupy-cuda102</strong></p>
<p>I dont know why? get error<br>
May be cause i have 2 cuda in Conda environment and Cuda in Window</p>

ptrblck: <p>I’m not deeply familiar with <code>cupy</code>, but would assume you need to create <code>cupy</code> arrays via Dlpack, while it seems you are trying to use tensors directly?</p>

Duong_Pham_Anh: <p>thank you i was fixed about tensor but i get error</p>
<pre><code class="lang-auto">Iter: 1
Traceback (most recent call last):
  File "run_seq2.py", line 100, in &lt;module&gt;
    trace = torch.jit.trace(DIFNet,(fr_g1, fr_g3, fr_o2, fr_g3, fr_g1))
  File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\torch\jit\__init__.py", line 953, in trace
    return trace_module(func, {'forward': example_inputs}, None,
  File "C:\ProgramData\Anaconda3\envs\DIFRINT-v4\lib\site-packages\torch\jit\__init__.py", line 1109, in trace_module
    module._c._create_method_from_trace(method_name, func, example_inputs, var_lookup_fn, strict, _force_outplace)
RuntimeError: 0 INTERNAL ASSERT FAILED at "..\\torch\\csrc\\jit\\ir\\alias_analysis.cpp":465, please report a bug to PyTorch. We don't have an op for aten::to but it isn't a 
special case.  Argument types: Tensor, None, int, Device, bool, bool, bool, int,
</code></pre>
<p>it not return any infor to fix<br>
link suorce code: <a href="https://github.com/duongpaKikai/Video-Stabilaztion" rel="nofollow noopener">Video Stabilization</a></p>

ptrblck: <p>Could you create an issue on <a href="https://github.com/pytorch/pytorch/issues">GitHub</a> ideally with a code snippet to reproduce this issue, please?</p>

Duong_Pham_Anh: <p>I did create an issue on GitHub and source</p>
<p><a href="https://discuss.pytorch.org/t/runtimeerror-0-internal-assert-failed-at/96478">96478</a></p>