I am probably missing something, but I am having trouble using the torch::normal function in the C++ API. Here’s the minimal example:
#include <torch/torch.h>
#include <iostream>
int main() {
torch::Tensor tensor = torch::rand({2, 3});
auto x = torch::normal(tensor,1);
std::cout << x << std::endl;
}
The compilation of this example fails with:
/Users/dfalbel/Documents/testtorch/example-app.cpp:6:12: error: too few arguments to function call, expected at least 3, have 2; did you mean 'at::normal'?
auto x = torch::normal(tensor,1);
^~~~~
at::normal
/Users/dfalbel/libtorch/include/ATen/Functions.h:13495:22: note: 'at::normal' declared here
static inline Tensor normal(const Tensor & mean, double std, Generator * generator) {
^
1 error generated.
This is can be fixed by using at
namespace instead of torch
. I could do that, but it seems to me that all signatures of at::normal
(1, 2, 3, 4) should be exported in the torch
namespace too? Does this make sense?