I’m a bit new to the C++ API, and I haven’t seen documentation for this behavior anywhere. Here is a minimal example to reproduce.
float data[] = { 1, 2, 3,
                       4, 5, 6 };
torch::Tensor f = torch::from_blob(data, {2, 3});
std::cout << f.mean(0) << std::endl;
// yields a 1-d tensor as expected.
// 2.5000
// 3.5000
// 4.5000
// [ CPUFloatType{3} ]
std::cout << f.std(0) << std::endl;
// yields a scalar, unexpected.
// 1.70783
// [ CPUFloatType{} ]