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

C++ testing and validation #21

Open
chenjun2hao opened this issue Apr 4, 2019 · 1 comment
Open

C++ testing and validation #21

chenjun2hao opened this issue Apr 4, 2019 · 1 comment

Comments

@chenjun2hao
Copy link

How can I be in c + + compiler environment, testing and validation. there the ‘THFloatTensor_data’ is not defined, when i use the code as follow:

int my_lib_add_forward(THFloatTensor *input1, THFloatTensor *input2,
		       THFloatTensor *output)
{
  float * data_flat = THFloatTensor_data(input1);
}
@ztianlin
Copy link

Hi, you can try to write something like

include<torch/torch.h>

int my_lib_add_forward(at::Tensor *input1, at::Tensor *input2, at::Tensor *output){
auto tmp = input1->contiguous();
float *data_flat = tmp.data();
}

good luck

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

2 participants