Hi @singleroc,
this should give you what you want
float arr[] = {-1, 0, 1};
auto data = torch::from_blob(arr, 3);
auto sizes = data.sizes();

auto sign = torch::ones(sizes).where(data.ge(torch::zeros(sizes)), torch::full(sizes, -1));

std::cout << sign << std::endl;