Giter Club home page Giter Club logo

Comments (8)

goldsborough avatar goldsborough commented on July 30, 2024 1

It is explained in the tutorial here: https://pytorch.org/tutorials/advanced/cpp_extension.html#building-with-setuptools

from extension-cpp.

goldsborough avatar goldsborough commented on July 30, 2024

Hi, please provide more information about your environment. What version of PyTorch are you using?

from extension-cpp.

adarsh-kr avatar adarsh-kr commented on July 30, 2024

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.

goldsborough avatar goldsborough commented on July 30, 2024

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.

adarsh-kr avatar adarsh-kr commented on July 30, 2024

@goldsborough I have added all the info in the above comment. Please let me know if you have any questions.

from extension-cpp.

goldsborough avatar goldsborough commented on July 30, 2024

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.

adarsh-kr avatar adarsh-kr commented on July 30, 2024

Can u pls tell me how build to this ?

from extension-cpp.

adarsh-kr avatar adarsh-kr commented on July 30, 2024

My bad. I skipped that.
Thanks

from extension-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.