CornerNet
CornerNet copied to clipboard
Pytorch 1.0 change the interface for at::zeros, need to change the order while invoking it.
error:
src/right_pool.cpp: In function ‘std::vector<at::Tensor> pool_backward(at::Tensor, at::Tensor)’: src/right_pool.cpp:44:41: error: could not convert ‘torch::CUDA(((at::ScalarType)at::kFloat))’ from ‘at::TypeExtendedInterface’ to ‘at::IntList’ {aka ‘at::ArrayRef<long int>’} auto max_val = at::zeros(torch::CUDA(at::kFloat), {batch, channel, height}); ~~~~~~~~~~~^~~~~~~~~~~~ src/right_pool.cpp:45:41: error: could not convert ‘torch::CUDA(((at::ScalarType)at::kLong))’ from ‘at::TypeExtendedInterface’ to ‘at::IntList’ {aka ‘at::ArrayRef<long int>’} auto max_ind = at::zeros(torch::CUDA(at::kLong), {batch, channel, height}); ~~~~~~~~~~~^~~~~~~~~~~ src/right_pool.cpp:57:44: error: could not convert ‘torch::CUDA(((at::ScalarType)at::kByte))’ from ‘at::TypeExtendedInterface’ to ‘at::IntList’ {aka ‘at::ArrayRef<long int>’} auto gt_mask = at::zeros(torch::CUDA(at::kByte), {batch, channel, height}); ~~~~~~~~~~~^~~~~~~~~~~ src/right_pool.cpp:58:44: error: could not convert ‘torch::CUDA(((at::ScalarType)at::kFloat))’ from ‘at::TypeExtendedInterface’ to ‘at::IntList’ {aka ‘at::ArrayRef<long int>’} auto max_temp = at::zeros(torch::CUDA(at::kFloat), {batch, channel, height}); ~~~~~~~~~~~^~~~~~~~~~~~ error: command 'gcc' failed with exit status 1
solution:
change the invoking order for at::zeros (in bottom_pool.cpp, left_pool.cpp, right_pool.cpp, top_pool.cpp )in CornerNet/models/py_utils/_cpools/src,
For example:
change: auto max_val = at::zeros(torch::CUDA(at::kFloat), {batch, channel, height});
to : auto max_val = at::zeros( {batch, channel, height}, torch::CUDA(at::kFloat));
hey guys, that helps me a lot, thx!
@jmt330 That work, thx!
Hello, I tried auto max_val = at::zeros( {batch, channel, height}, torch::CUDA(at::kFloat));
. However, I get the following error:
Expected tensor's dynamic type to be Variable, not Tensor.
I searched on the internet and get one answer. They suggest replacing at::zeros
with torch::zeros
. I tried another error, which seem to be caused by using "#include <ATen/ATen.h>" and "#include <torch/torch.h>" in one file.
Could you please help me? @jmt330
Thx, it's work finally!
I tried to at::zeros({batch, channel, width}, torch::CUDA(at::kFloat));
but, there are also some errors, as following:
In file included from src/top_pool.cpp:1:0:
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:7:2: warning: #warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h" [-Wcpp]
#warning
^~~~~~~
src/top_pool.cpp: In function 'std::vectorat::Tensor top_pool_backward(at::Tensor, at::Tensor)':
src/top_pool.cpp:45:62: warning: 'at::TypeExtendedInterface& torch::CUDA(c10::ScalarType)' is deprecated [-Wdeprecated-declarations]
auto max_val = at::zeros({batch, channel, width}, torch::CUDA(at::kFloat));
^~~~
In file included from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Type.h:5:0,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Type.h:2,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Context.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:5,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/variable_tensor_functions.h:35:52: note: declared here
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CUDA(at::ScalarType type));
^
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Deprecated.h:9:61: note: in definition of macro 'AT_DEPRECATED'
#define AT_DEPRECATED(function) attribute((deprecated)) function
^~~~~~~~
src/top_pool.cpp:45:77: warning: 'at::TypeExtendedInterface& torch::CUDA(c10::ScalarType)' is deprecated [-Wdeprecated-declarations]
auto max_val = at::zeros({batch, channel, width}, torch::CUDA(at::kFloat));
^
In file included from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Type.h:5:0,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Type.h:2,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Context.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:5,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/variable_tensor_functions.h:35:52: note: declared here
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CUDA(at::ScalarType type));
^
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Deprecated.h:9:61: note: in definition of macro 'AT_DEPRECATED'
#define AT_DEPRECATED(function) attribute((deprecated)) function
^~~~~~~~
src/top_pool.cpp:47:62: warning: 'at::TypeExtendedInterface& torch::CUDA(c10::ScalarType)' is deprecated [-Wdeprecated-declarations]
auto max_ind = at::zeros({batch, channel, width}, torch::CUDA(at::kLong));
^~~~
In file included from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Type.h:5:0,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Type.h:2,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Context.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:5,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/variable_tensor_functions.h:35:52: note: declared here
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CUDA(at::ScalarType type));
^
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Deprecated.h:9:61: note: in definition of macro 'AT_DEPRECATED'
#define AT_DEPRECATED(function) attribute((deprecated)) function
^~~~~~~~
src/top_pool.cpp:47:76: warning: 'at::TypeExtendedInterface& torch::CUDA(c10::ScalarType)' is deprecated [-Wdeprecated-declarations]
auto max_ind = at::zeros({batch, channel, width}, torch::CUDA(at::kLong));
^
In file included from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Type.h:5:0,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Type.h:2,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Context.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:5,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/variable_tensor_functions.h:35:52: note: declared here
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CUDA(at::ScalarType type));
^
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Deprecated.h:9:61: note: in definition of macro 'AT_DEPRECATED'
#define AT_DEPRECATED(function) attribute((deprecated)) function
^~~~~~~~
src/top_pool.cpp:60:65: warning: 'at::TypeExtendedInterface& torch::CUDA(c10::ScalarType)' is deprecated [-Wdeprecated-declarations]
auto gt_mask = at::zeros({batch, channel, width}, torch::CUDA(at::kByte));
^~~~
In file included from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/core/Type.h:5:0,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Type.h:2,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/Context.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:5,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
from /opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:3,
from src/top_pool.cpp:1:
/opt/anaconda3/envs/py36/lib/python3.6/site-packages/torch/lib/include/torch/csrc/variable_tensor_functions.h:35:52: note: declared here
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CUDA(at::ScalarType type));
Can you give me some suggestions to solve it? Tkanks.
thanks a lot!!!! solve my problems!!!
Thx, solve my problems
thanks!it helps me a lot!
Thanks, solve my problems!
my environment is as follows: Win7 PyTorch=1.3.1+cpu