I can run mnist.cpp example.
but, there is error in this simple code
torch::Tensor a = torch::ones({ 2, 2 }, torch::requires_grad());
torch::Tensor b = torch::randn({ 2, 2 });
auto c = a + b;
c.backward(); <— error
Also.
I checked all of tensor’s options() using this code
std::cout << a.options() << std::endl;
std::cout << b.options() << std::endl;
std::cout << c.options() << std::endl;
Result
TensorOptions(dtype=float, device=cpu, layout=Strided, requires_grad=false)
TensorOptions(dtype=float, device=cpu, layout=Strided, requires_grad=false)
TensorOptions(dtype=float, device=cpu, layout=Strided, requires_grad=false)
I don’t know why there is no “requires_grad=true”
I need help