public virtual void Dispose() { m_Vars?.Dispose(); m_Ops?.ResetAllocator(false); // clear allocator's memory m_InputShapes?.Clear(); m_Vars = null; m_Ops = null; m_InputShapes = null; }
public void TakeMemorySnapshot(IOps ops, IVars vars, string context, Layer layer) { var varsWithStatistics = vars as IVarsStatistics; if (varsWithStatistics == null) { return; } MemorySnapshotsReports.Add(new MemorySnapshotReport(ops, varsWithStatistics, context, layer)); }
public GenericWorker(Model model, IOps ops, IVars vars, bool verbose = false) { m_Model = model; m_DefaultInputName = ModelAnalyzer.GetDefaultInputName(model); m_DefaultOutputName = ModelAnalyzer.GetDefaultOutputName(model); m_Ops = ops; m_Vars = vars; m_ModelCompiler = ops as IModelCompiler; m_Verbose = verbose; m_RequestResetAllocator = true; }
public IVars Create(IVars argParent, IVars argVars) { if (argParent == null && argVars != null) { return(argVars); } if (argVars == null && argParent != null) { return(argParent); } var pVars = NewVars(); pVars.Parent = argParent; pVars.Vars = argVars; return(pVars); }
/// <inheritdoc/> public virtual void PrepareModel(Model model, IDictionary<string, TensorShape> inputShapes, IVars vars) { if (m_Ops is IModelCompiler) ((IModelCompiler)m_Ops).PrepareModel(model, inputShapes, vars); }
public void TakeMemorySnapshot(IVars vars, string context, Layer layer) { MemorySnapshotsReport.TakeMemorySnapshot(vars, context, layer); }
public abstract Task <NodeExpr> Eval(NodeExpr e, CancellationToken t, IVars v = null);
public IVars CreateAmbito(IVars argVars) => new Ambito(this, argVars);
public Ambito(IVars argVars, IVars argAmbito) { mVars = argVars; mAmbito = argAmbito; }
public static async Task <NodeExpr> Eval(NodeExpr e, IAlgebra <N> a, CancellationToken t, IVars v = null) { var vv = (v != null) ? a.Session.Vars.CreateAmbito(v) : a.Session.Vars; var visit = new EvaluateVisitor <N>(a, vv); var r = await visit.Visit(e, t); t.ThrowIfCancellationRequested(); return(r); }
public EvaluateVisitor(IAlgebra <N> a, IVars v) { mAlg = a; mVars = v; }
public Exprs.Expr Eval(Exprs.Expr e, IVars argVars, CancellationToken argCancelToken) => e;