What does the c10::NotImplementedError from the C++ frontend mean?

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;

int main(void)
torch::Device device = (torch::cuda::is_available()) ? torch::kCUDA : torch::kCPU;
valnet v;
//error: c10::NotImplementedError

I would be grateful for your help as to why this happens.

Your code runs fine in my environment, is there any reason why forward method is not implemented ?

torch::Tensor forward(torch::Tensor x)
	x = fc1->forward(x);
	x = fc2->forward(x);
	x = fc3->forward(x);
	return x;
1 Like

Thank you for your reply. It turned out that something during the installation had gone wrong.