Comments (8)
It is explained in the tutorial here: https://pytorch.org/tutorials/advanced/cpp_extension.html#building-with-setuptools
from extension-cpp.
Hi, please provide more information about your environment. What version of PyTorch are you using?
from extension-cpp.
I am using torch==0.4.1.
I was initially running g++ compressionLayer.cc
which gave me the above mentioned error.
I located the torch.h file and added the path during compilation.
g++ -I /home/adarsh/.local/lib/python3.6/site-packages/torch/lib/include/ compressionLayer.cc
, which compiled but then I am getting following error :
/tmp/ccIqciqg.o: In function `at::infer_type(at::Tensor const&)':
compressionLayer.cc:(.text+0x241): undefined reference to `at::Error::Error(at::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccIqciqg.o: In function `at::UndefinedTensor::singleton()':
compressionLayer.cc:(.text._ZN2at15UndefinedTensor9singletonEv[_ZN2at15UndefinedTensor9singletonEv]+0x7): undefined reference to `at::UndefinedTensor::_singleton'
collect2: error: ld returned 1 exit status
Makefile:6: recipe for target 'compressionLayer.o' failed
make: *** [compressionLayer.o] Error 1
CompressionLayer.cc is this :
#include<torch/torch.h>
#include<iostream>
at::Tensor d_sigmoid(at::Tensor z) {
at::Tensor s = at::sigmoid(z);
return (1 - s) * s;
}
int main()
{}
from extension-cpp.
What commands did you run to arrive at this compiler error? Please provide as much context as possible for me to help.
from extension-cpp.
@goldsborough I have added all the info in the above comment. Please let me know if you have any questions.
from extension-cpp.
You are not supposed to compile this code manually like this. Have you seen the setup.py and torch.utils.cpp_extensions.load instructions in the tutorial? I think it is explained quite well how to build an extension using the means we provide.
from extension-cpp.
Can u pls tell me how build to this ?
from extension-cpp.
My bad. I skipped that.
Thanks
from extension-cpp.
Related Issues (20)
- www.facebook.com/rozi.khatun.961
- This repo can not compile using Pytorch 1.6.0 HOT 1
- This repo can not compile using Pytorch 1.6.0 HOT 1
- A question about backward propagation speed in cpp extension in tutorial
- Error when building cpp extension HOT 1
- AttributeError: module 'depthwise' has no attribute 'forward'
- cuda does not install HOT 17
- How does the layer of C++ extensions translate to TorchScript or onnx? HOT 1
- Cannot Unpack, Too Many Items
- How to debug in cuda-pytorch env?
- Writing a custom C++ extension with variants for both CPU and GPU? HOT 2
- Custom CUDA operator only work well on cuda:0 HOT 3
- How can I access data in cuda kernel like in pytorch?
- error LNK2001 undefined reference to `__cudaRegisterLinkedBinary
- Relation between at::Half and __half
- Deprecation warning
- Scikit-build-core / scikit-build support for binding
- `TORCH_LIBRARY` and `m.def` Not Working as Documented
- [feature request] Instruction on how to setup compile-env for Windows
- JIT-compiling the extension results in non-functional Python module.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-cpp.