pytorch c++扩展 python setup install 错误
解决方法
将/home/zyc/miniconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch 下cloneable。h 文件 中 改为下图所示
TORCH_CHECK(
copy->parameters_.size() == this->parameters_.size(),
"The cloned module does not have the same number of "
"parameters as the original module after calling reset(). "
"Are you sure you called register_parameter() inside reset() "
"and not the constructor?");
for (const auto& parameter : named_parameters(/*recurse=*/false)) {
auto& tensor = *parameter;
auto data = device && tensor.device() != *device ?
tensor.to(*device) : autograd::Variable(tensor).clone();
copy->parameters_[parameter.key()].set_data(data);
}
TORCH_CHECK(
copy->buffers_.size() == this->buffers_.size(),
"The cloned module does not have the same number of "
"buffers as the original module after calling reset(). "
"Are you sure you called register_buffer() inside reset() "
"and not the constructor?");
for (const auto& buffer : named_buffers(/*recurse=*/false)) {
auto& tensor = *buffer;
auto data = device && tensor.device() != *device ?
tensor.to(*device) : autograd::Variable(tensor).clone();
copy->buffers_[buffer.key()].set_data(data);
}
TORCH_CHECK(
copy->children_.size() == this->children_.size(),
"The cloned module does not have the same number of "
"child modules as the original module after calling reset(). "
"Are you sure you called register_module() inside reset() "
"and not the constructor?");
可解决此问题
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing chamfer-0.0.0-py3.7-linux-x86_64.egg
removing '/home/zyc/miniconda3/lib/python3.7/site-packages/chamfer-0.0.0-py3.7-linux-x86_64.egg' (and everything under it)
creating /home/zyc/miniconda3/lib/python3.7/site-packages/chamfer-0.0.0-py3.7-linux-x86_64.egg
Extracting chamfer-0.0.0-py3.7-linux-x86_64.egg to /home/zyc/miniconda3/lib/python3.7/site-packages
chamfer 0.0.0 is already the active version in easy-install.pth
Installed /home/zyc/miniconda3/lib/python3.7/site-packages/chamfer-0.0.0-py3.7-linux-x86_64.egg
Processing dependencies for chamfer==0.0.0
Finished processing dependencies for chamfer==0.0.0
出现此信息提示表示成功
|