pytorch / extension-ffi

Examples of C extensions for PyTorch
258 stars 70 forks source link

C extension API #13

Open JDwangmo opened 7 years ago

JDwangmo commented 7 years ago

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 commented 6 years ago
#include <TH/TH.h>
lxtGH commented 6 years ago

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

lxtGH commented 6 years ago

in pytorch source code https://github.com/pytorch/pytorch/tree/502aaf39cf4a878f9e4f849e5f409573aa598aa9/aten/src

chenjun2hao commented 5 years ago

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 commented 5 years ago

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