You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could someone be so kind to have a look if I make my net wrong or something?
I should say that my network DOES learn, but LSTM part does not!
Could really use a second pair of eyes, thanks!
my input are sequences of actions of the shape: [sequenceLength, obsSize]
publicclassPPOCriticNet1D:PPOCriticNet{privatereadonlyModuleList<Module<Tensor,Tensor>>fcModules=new();privatereadonlyModule<Tensor,Tensor>head;privatereadonlyLSTMlstmLayer;privatereadonlyinthiddenSize;privatereadonlybooluseRnn;publicPPOCriticNet1D(stringname,longinputs,intwidth,intdepth=3,booluseRNN=false):base(name){// Ensure depth is at least 1.if(depth<1)thrownewArgumentOutOfRangeException("Depth must be 1 or greater.");this.useRnn=useRNN;this.hiddenSize=width;// Modify as per your architecture choicefcModules.Add(Linear(inputs,width));for(inti=1;i<depth;i++){fcModules.Add(Linear(width,width));}if(useRnn){lstmLayer=nn.LSTM(width,hiddenSize,2,batchFirst:true);width=hiddenSize;}// Final layer to produce the value estimate.head=Linear(width,1);RegisterComponents();}publicoverrideTensorforward(Tensorx){// Adjust for a single input.if(x.dim()==1){x=x.unsqueeze(0);}x=functional.tanh(fcModules.First().forward(x));if(useRnn){x=x.unsqueeze(0);x=lstmLayer.forward(x).Item1;x=x.squeeze(0);}foreach(varmoduleinfcModules.Skip(1)){x=functional.tanh(module.forward(x));}varresult=head.forward(x);returnresult;}protectedoverridevoidDispose(booldisposing){if(disposing){foreach(varmoduleinfcModules){module.Dispose();}lstmLayer?.Dispose();head.Dispose();}base.Dispose(disposing);}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Could someone be so kind to have a look if I make my net wrong or something?
I should say that my network DOES learn, but LSTM part does not!
Could really use a second pair of eyes, thanks!
my input are sequences of actions of the shape: [sequenceLength, obsSize]
Beta Was this translation helpful? Give feedback.
All reactions