var trainer = m_Trainers.Find(x => x.BehaviorName == behaviorName);
if (trainer == null)
{
trainer = new Trainer(behaviorName, actionSpec);
trainer = new Trainer(behaviorName, actionSpec, model);
m_Trainers.Add(trainer);
}
return trainer;
return new BarracudaPolicy(actionSpec, actuatorManager, m_Model, m_InferenceDevice, m_BehaviorName);
case BehaviorType.InEditorTraining:
return new TrainingPolicy(actionSpec, m_BehaviorName);
return new TrainingPolicy(actionSpec, m_BehaviorName, m_Model);
case BehaviorType.Default:
if (Academy.Instance.IsCommunicatorOn)
/// </exception>
public TrainingModelRunner(
ActionSpec actionSpec,
NNModel model,
int seed = 0)
Model barracudaModel;
barracudaModel = ModelLoader.Load(new NNModel());
// barracudaModel = ModelLoader.Load(new NNModel());
barracudaModel = ModelLoader.Load(model);
m_Model = barracudaModel;
m_InferenceInputs = barracudaModel.GetInputTensors();
m_OutputNames = barracudaModel.GetOutputNames();
/// <inheritdoc />
public TrainingPolicy(
string behaviorName
string behaviorName,
NNModel model
)
var trainer = Academy.Instance.GetOrCreateTrainer(behaviorName, actionSpec, model);
int batchSize = 64;
float GAMMA;
public Trainer(string behaviorName, ActionSpec actionSpec, int seed=0)
public Trainer(string behaviorName, ActionSpec actionSpec, NNModel model, int seed=0)
m_ModelRunner = new TrainingModelRunner(actionSpec, seed);
m_ModelRunner = new TrainingModelRunner(actionSpec, model, seed);
Academy.Instance.TrainerUpdate += Update;