The following program was generated by googles AI:
#include <torch/torch.h>
#include <iostream>
int main() {
// Create a dummy tensor
torch::Tensor a = torch::randn({1, 3});
// Hash the elements of the tensor
torch::Tensor hashed = torch::hash_tensor(a);
// Extract the hash value as a 64-bit unsigned integer
uint64_t hash_value = hashed.item<uint64_t>();
std::cout << "Tensor Hash: " << hash_value << std::endl;
}
When I try to compile and link it I get
undefined reference to `unsigned long at::Tensor::item<unsigned long>() const'
If I change uint64_t to int64_t in the program above it compiles and links fine but I get the error
terminate called after throwing an instance of 'std::runtime_error'
what(): value cannot be converted to type int64_t without overflow