The following C++ pytorch code throws a “c10:NotImplementedError”
#include <torch/torch.h>
struct valnetImpl : torch::nn::Module
{
valnetImpl::valnetImpl() :
fc1(register_module(“fc1”, torch::nn::Linear(384, 64))),
fc2(register_module(“fc2”, torch::nn::Linear(64, 64))),
fc3(register_module(“fc3”, torch::nn::Linear(64, 1)))
{}
torch::Tensor forward(const torch::Tensor& x);torch::nn::Linear fc1, fc2, fc3;
};
TORCH_MODULE(valnet);int main(void)
{
torch::Device device = (torch::cuda::is_available()) ? torch::kCUDA : torch::kCPU;
valnet v;
v->to(device);
//error: c10::NotImplementedError
}
I would be grateful for your help as to why this happens.