Ld error while getting the data of a tensor

I want to get the data of a tensor, and ld throw an error while using ATen library:

Undefined symbols for architecture x86_64: "long* at::Tensor::data<long>() const"

However, Tensor::data<int64_t>, Tensor::data<int> and Tensor::data<long long> work well. Does anyone know why the fundamental type long failed?


  1. MacOS 10.14.2
  2. clang 4.2.1
  3. torch 0.4.0 (installed by pip3.6)
  4. c++ 17

This problem is fixed by replacing long with int64_t.

1 Like