Hi. I am trying to build a network and do inference on network with random weights. But I get this Error while tying to run the code:
terminate called after throwing an instance of 'c10::IndexError'
  what():  select(): index 0 out of range for tensor of size [0, 0, 1, 1] at dimension 0 (select at ../aten/src/ATen/native/TensorShape.cpp:765)

I don’t know what causes this error.  Can anyone give me some idea about how to solve this?
Complete error message is as follows:
terminate called after throwing an instance of 'c10::IndexError'
  what():  select(): index 0 out of range for tensor of size [0, 0, 1, 1] at dimension 0 (select at ../aten/src/ATen/native/TensorShape.cpp:765)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x6a (0x7f74560bdaaa in /home/fugurcal/libtorch/lib/libc10.so)
frame #1: at::native::select(at::Tensor const&, long, long) + 0x3fc (0x7f7447d6afcc in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #2: <unknown function> + 0x12269dd (0x7f74480979dd in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #3: <unknown function> + 0x120ddb7 (0x7f744807edb7 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #4: <unknown function> + 0x2beb918 (0x7f7449a5c918 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #5: <unknown function> + 0x120ddb7 (0x7f744807edb7 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #6: at::Tensor::select(long, long) const + 0xf2 (0x7f74479d7642 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #7: <unknown function> + 0x3373c3d (0x7f744a1e4c3d in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #8: <unknown function> + 0x3373fe4 (0x7f744a1e4fe4 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #9: torch::nn::init::kaiming_uniform_(at::Tensor, double, c10::variant<torch::enumtype::kFanIn, torch::enumtype::kFanOut>, c10::variant<torch::enumtype::kLinear, torch::enumtype::kConv1D, torch::enumtype::kConv2D, torch::enumtype::kConv3D, torch::enumtype::kConvTranspose1D, torch::enumtype::kConvTranspose2D, torch::enumtype::kConvTranspose3D, torch::enumtype::kSigmoid, torch::enumtype::kTanh, torch::enumtype::kReLU, torch::enumtype::kLeakyReLU>) + 0x71 (0x7f744a1e50e1 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #10: <unknown function> + 0x34007c1 (0x7f744a2717c1 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #11: <unknown function> + 0x34063c8 (0x7f744a2773c8 in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #12: torch::nn::Conv2dImpl::Conv2dImpl(torch::nn::ConvOptions<2ul>) + 0x28d (0x7f744a26c7bd in /home/fugurcal/libtorch/lib/libtorch_cpu.so)
frame #13: torch::nn::ModuleHolder<torch::nn::Conv2dImpl>::ModuleHolder<torch::nn::ConvOptions<2ul>&, , void>(torch::nn::ConvOptions<2ul>&) + 0xef (0x55dfbc7fdc41 in ./freespace_torch)
frame #14: torch::nn::Conv2d::ModuleHolder<torch::nn::ConvOptions<2ul>&, , void>(torch::nn::ConvOptions<2ul>&) + 0x23 (0x55dfbc7fb6fb in ./freespace_torch)
frame #15: VggImpl::VggImpl(int, int) + 0x457 (0x55dfbc7f3ddb in ./freespace_torch)
frame #16: torch::nn::ModuleHolder<VggImpl>::ModuleHolder<int, int, void>(int&&, int&&) + 0x57 (0x55dfbc7e840f in ./freespace_torch)
frame #17: Vgg::ModuleHolder<int, int, void>(int&&, int&&) + 0x2b (0x55dfbc7e48ab in ./freespace_torch)
frame #18: main + 0x205 (0x55dfbc7de593 in ./freespace_torch)
frame #19: __libc_start_main + 0xe7 (0x7f740436db97 in /lib/x86_64-linux-gnu/libc.so.6)
frame #20: _start + 0x2a (0x55dfbc7dda6a in ./freespace_torch)