common.cuh 557 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
#ifndef THC_GENERIC_FILE
rusty1s's avatar
rusty1s committed
2
#define THC_GENERIC_FILE "generic/common.cuh"
rusty1s's avatar
rusty1s committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#else

TensorInfo<real> THCTensor_(getTensorInfo)(THCState *state, THCTensor *tensor) {
  TensorInfo<real> tensorInfo = TensorInfo<real>();
  tensorInfo.data = THCTensor_(data)(state, tensor);
  tensorInfo.dims = THCTensor_(nDimension)(state, tensor);
  for (ptrdiff_t d = 0; d < tensorInfo.dims; d++) {
    tensorInfo.size[d] = THCTensor_(size)(state, tensor, d);
    tensorInfo.stride[d] = THCTensor_(stride)(state, tensor, d);
  }
  return tensorInfo;
}

#endif  // THC_GENERIC_FILE