Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

C extension API #13

Open
JDwangmo opened this issue Jul 25, 2017 · 5 comments
Open

C extension API #13

JDwangmo opened this issue Jul 25, 2017 · 5 comments

Comments

@JDwangmo
Copy link

hello,where can i get the APIs of pytorch C extension function,such as THFloatTensor_resizeAs, THFloatTensor_add. Except those,has any function else? Thx.

@taineleau-zz
Copy link

#include <TH/TH.h>

@lxtGH
Copy link

lxtGH commented Mar 2, 2018

Thanks you , but where can I find that file? @taineleau

@lxtGH
Copy link

lxtGH commented Mar 2, 2018

@chenjun2hao
Copy link

When I compile in c++, the error: THFloatTensor_cadd is undefined
`#include <TH/TH.h>

int my_lib_add_forward(THFloatTensor *input1, THFloatTensor *input2,
THFloatTensor *output)
{
if (!THFloatTensor_isSameSizeAs(input1, input2))
return 0;
THFloatTensor_resizeAs(output, input1);
THFloatTensor_cadd(output, input1, 1.0, input2);
return 1;
}

int my_lib_add_backward(THFloatTensor *grad_output, THFloatTensor *grad_input)
{
THFloatTensor_resizeAs(grad_input, grad_output);
THFloatTensor_fill(grad_input, 1);
return 1;
}`
i use pytorch0.4.1

@chenjun2hao
Copy link

@lxtGH ,HI
When I compile in c++, print the error: THFloatTensor_cadd is undefined.
could give me some adavice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants