You can use std::copy_n as below:
const float array[] = {1.23, 2.34, 3.45, 4.56, 5.67};
auto options = torch::TensorOptions().dtype(torch::kFloat32);
torch::Tensor t1 = torch::empty({5}, options);
std::copy_n(array, 5, t1.contiguous().data_ptr<float>());