15import torch.nn as nn\n\
17model = nn.Sequential(\n\
24criterion = nn.MSELoss()\n\
25optimizer = torch.optim.SGD(model.parameters(),lr=0.01)\n\
30for i in range(500):\n\
32 loss = criterion(y_pred,y)\n\
33 optimizer.zero_grad()\n\
38m = torch.jit.script(model)\n\
39torch.jit.save(m,'PyTorchModel.pt')\n";
49 m.SaveSource(
"make_pytorch_model.py");
79 std::cout<<
"Shape of tensor \"0weight\": ";
83 std::cout<<
"\n\nData type of tensor \"0weight\": ";
85 std::cout<<SOFIE::ConvertTypeToString(
tensorType);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TSystem * gSystem
void PrintIntermediateTensors()
bool CheckIfTensorAlreadyExist(std::string tensor_name)
void OutputGenerated(std::string filename="", bool append=false)
const ETensorType & GetTensorType(std::string name) const
const std::vector< size_t > & GetTensorShape(std::string name) const
void PrintInitializedTensors()
void Generate(std::underlying_type_t< Options > options, int batchSize=-1, long pos=0, bool verbose=false)
void PrintRequiredInputTensors()
static void PyInitialize()
Initialize Python interpreter.
Class supporting a collection of lines with C++ code.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
TString Python_Executable()
Function to find current Python executable used by ROOT If "Python3" is installed,...