Conv3d not implemented for CUDA in libtorch?

a_d: <p>Hello all,<br>
I was trying to include conv3D layers in my models but upon running  it, it said</p>
<pre><code class="lang-auto">terminate called after throwing an instance of 'c10::Error'
  what():  Could not run 'aten::slow_conv3d_forward' with arguments from the 'CUDA' backend. 'aten::slow_conv3d_forward' is only available for these backends: [CPU, BackendSelect, Named, Autograd, Tracer, Autocast, Batched].
</code></pre>
<p>The code is as follows -</p>
<pre><code class="lang-auto">#include &lt;iostream&gt;
#include &lt;torch/torch.h&gt;
#include "PredictFrame.h"
using namespace torch;
using namespace std;

int main() {
    /*
    PredictFrame predictFrame;
    predictFrame.to(torch::kCUDA);
    auto input = torch::rand({1, 3, 5, 900, 900});
    input.to(torch::kCUDA);
    auto out = predictFrame.forward(input);
    cout&lt;&lt;out.sizes();
     */
    cout&lt;&lt;"starting";
    cout&lt;&lt;std::boolalpha&lt;&lt;torch::cuda::is_available();

    auto conv1 = torch::nn::Conv3d(torch::nn::Conv3dOptions(3, 64, {3, 1,1})
            .stride({1 ,1, 1}).padding({1, 0, 0}));
    conv1-&gt;to(torch::kCUDA);
    auto input = torch::rand({1, 3 ,5, 10, 10});
    input.to(torch::kCUDA);
    auto output = conv1-&gt;forward(input);
    cout&lt;&lt;output;
}
</code></pre>
<p>and the complete error encountered upon running it is as follows -</p>
<pre><code class="lang-auto">/home/atharva/CLionProjects/SuperTux_RL/SuperTux_RL
terminate called after throwing an instance of 'c10::Error'
  what():  Could not run 'aten::slow_conv3d_forward' with arguments from the 'CUDA' backend. 'aten::slow_conv3d_forward' is only available for these backends: [CPU, BackendSelect, Named, Autograd, Tracer, Autocast, Batched].

CPU: registered at aten/src/ATen/CPUType.cpp:1596 [kernel]
BackendSelect: fallthrough registered at ../aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Named: registered at ../aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
Autograd: registered at ../torch/csrc/autograd/generated/VariableType_4.cpp:7155 [kernel]
Tracer: registered at ../torch/csrc/autograd/generated/TraceType_4.cpp:8208 [kernel]
Autocast: fallthrough registered at ../aten/src/ATen/autocast_mode.cpp:371 [backend fallback]
Batched: registered at ../aten/src/ATen/BatchingRegistrations.cpp:229 [backend fallback]

Exception raised from reportError at ../aten/src/ATen/core/dispatch/OperatorEntry.cpp:261 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;) + 0x69 (0x7f1fd082fe99 in /home/atharva/libtorch/libtorch/lib/libc10.so)
frame #1: c10::impl::OperatorEntry::reportError(c10::DispatchKey) const + 0x3ac (0x7f1fc0bf9f2c in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #2: &lt;unknown function&gt; + 0x1478936 (0x7f1fc1508936 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #3: at::slow_conv3d_forward(at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::optional&lt;at::Tensor&gt; const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;) + 0x139 (0x7f1fc14287e9 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #4: &lt;unknown function&gt; + 0x294fae8 (0x7f1fc29dfae8 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #5: &lt;unknown function&gt; + 0x295031d (0x7f1fc29e031d in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #6: &lt;unknown function&gt; + 0x12933c2 (0x7f1fc13233c2 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #7: &lt;unknown function&gt; + 0x14788e7 (0x7f1fc15088e7 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #8: at::slow_conv3d_forward(at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::optional&lt;at::Tensor&gt; const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;) + 0x139 (0x7f1fc14287e9 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #9: at::native::slow_conv3d(at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;) + 0x58 (0x7f1fc0d4c608 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #10: &lt;unknown function&gt; + 0x14cb6f0 (0x7f1fc155b6f0 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #11: &lt;unknown function&gt; + 0x15098b2 (0x7f1fc15998b2 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #12: &lt;unknown function&gt; + 0x14f9d02 (0x7f1fc1589d02 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #13: &lt;unknown function&gt; + 0x1477d8e (0x7f1fc1507d8e in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #14: at::slow_conv3d(at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::optional&lt;at::Tensor&gt; const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;) + 0x139 (0x7f1fc1427f89 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #15: at::native::_convolution(at::Tensor const&amp;, at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, bool, c10::ArrayRef&lt;long&gt;, long, bool, bool, bool) + 0x4505 (0x7f1fc0d3b865 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #16: &lt;unknown function&gt; + 0x14adc77 (0x7f1fc153dc77 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #17: &lt;unknown function&gt; + 0x1507f4d (0x7f1fc1597f4d in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #18: &lt;unknown function&gt; + 0xb0b08c (0x7f1fc0b9b08c in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #19: &lt;unknown function&gt; + 0x13f9a54 (0x7f1fc1489a54 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #20: at::_convolution(at::Tensor const&amp;, at::Tensor const&amp;, c10::optional&lt;at::Tensor&gt; const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, bool, c10::ArrayRef&lt;long&gt;, long, bool, bool, bool) + 0x1fe (0x7f1fc1399e9e in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #21: at::native::convolution(at::Tensor const&amp;, at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, bool, c10::ArrayRef&lt;long&gt;, long) + 0xd4 (0x7f1fc0d332a4 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #22: &lt;unknown function&gt; + 0x14ad900 (0x7f1fc153d900 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #23: &lt;unknown function&gt; + 0x1507db5 (0x7f1fc1597db5 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #24: &lt;unknown function&gt; + 0xb0b2b6 (0x7f1fc0b9b2b6 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #25: &lt;unknown function&gt; + 0x13f8cc8 (0x7f1fc1488cc8 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #26: at::convolution(at::Tensor const&amp;, at::Tensor const&amp;, c10::optional&lt;at::Tensor&gt; const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, bool, c10::ArrayRef&lt;long&gt;, long) + 0x194 (0x7f1fc1399454 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #27: at::native::conv3d(at::Tensor const&amp;, at::Tensor const&amp;, at::Tensor const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, long) + 0x78 (0x7f1fc0d32f88 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #28: &lt;unknown function&gt; + 0x14ae1ef (0x7f1fc153e1ef in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #29: &lt;unknown function&gt; + 0x15083c8 (0x7f1fc15983c8 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #30: &lt;unknown function&gt; + 0xb0b176 (0x7f1fc0b9b176 in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #31: &lt;unknown function&gt; + 0x13faeef (0x7f1fc148aeef in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #32: at::conv3d(at::Tensor const&amp;, at::Tensor const&amp;, c10::optional&lt;at::Tensor&gt; const&amp;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, long) + 0x13c (0x7f1fc139ae8c in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #33: torch::nn::Conv3dImpl::forward(at::Tensor const&amp;) + 0x10f (0x7f1fc326c4af in /home/atharva/libtorch/libtorch/lib/libtorch_cpu.so)
frame #34: &lt;unknown function&gt; + 0xc233 (0x55c86651d233 in /home/atharva/CLionProjects/SuperTux_RL/SuperTux_RL)
frame #35: __libc_start_main + 0xf3 (0x7f1f80bd40b3 in /lib/x86_64-linux-gnu/libc.so.6)
frame #36: &lt;unknown function&gt; + 0xbdee (0x55c86651cdee in /home/atharva/CLionProjects/SuperTux_RL/SuperTux_RL)


Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
</code></pre>
<p>I was wondering if there is an installation issue with my system or <code>conv3d </code> layers not support running on GPU?</p>
<p>Edit - <code>torch::cuda::is_available()</code> returns <code>true</code></p>

a_d: <p>The answer is quite simple, you have to reassign the variable in the <code>to</code> method. For example<br>
<code>input = input.to(torch::kCUDA)</code> and it will work.</p>