How can I call pytorch in CPP?

Hi, guys, I want to write a network using pytorch, (e.g. a resnet), then I want to read and process data using CPP and feed data to pytorch, and pytorch can return the network loss to CPP. And in other case, I can send
a loss variable written in CPP to a pytorch network, and pytorch network can do backward propagation automatically. Is there any solutions ?? Thanks in advance

Can somebody help me please?