1#undef NDEBUG 2#include <cassert> 3 4#include <iostream> 5 6#include <torch/torch.h> 7 8int main() { 9 torch::Tensor tensor = torch::eye(3); 10 11 float checkData[] = { 12 1, 0, 0, 13 0, 1, 0, 14 0, 0, 1 15 }; 16 17 torch::Tensor check = torch::from_blob(checkData, {3, 3}); 18 19 assert(tensor.allclose(check)); 20}