public virtual bool Register <T>(T module) { if (module is IInit) { IInit v = (IInit)module; v.Init(); } if (module is IUpdate) { IUpdate v = (IUpdate)module; if (!m_UpdateList.Contains(v)) { m_UpdateList.Add(v); } } if (module is IDestroy) { IDestroy v = (IDestroy)module; if (!m_DestroyList.Contains(v)) { m_DestroyList.Add(v); } } return(true); }
public static void UnRegisteIInit(IInit single) { if (listInit.Contains(single)) { single.OnRelease(); listInit.Remove(single); } }
private Bootstrap(IInit init, IMain main, IGame game) { init.Done() .Select(_ => main.Run()) .Switch() .Do(_ => main.Hide()) .Select(game.Run) .Switch() .Do(_ => main.Show()) .Subscribe(); }
// the object for operations in Flow // has weights, (always initialized) // gradients, (initialize by default; can be told to not to initialize) // and gradient histories (not initialized; optimizers should do it) // for param init // using given initializer public Tensor(int rowDimension, int columnDimension, IInit init, bool needGrad = true) { Row = rowDimension; Col = columnDimension; Capacity = rowDimension * columnDimension; W = init != null ? new Matrix(rowDimension, columnDimension, init.Next) : new Matrix(rowDimension, columnDimension); DW = needGrad ? new Matrix(rowDimension, columnDimension) : null; HW = null; HW2 = null; }
/// <summary> /// TBD /// </summary> /// <param name="n">TBD</param> /// <param name="init">TBD</param> public FanInShapeN(int n, IInit init) : base(init) { N = n; In0 = NewInlet <T0>("in0"); var builder = ImmutableArray.CreateBuilder <Inlet <T1> >(n); for (int i = 0; i < n; i++) { builder.Add(new Inlet <T1>("in" + i)); } In1s = builder.ToImmutable(); }
public static void RegisteIInit(IInit single) { if (single == null) { return; } if (!listInit.Contains(single)) { listInit.Add(single); single.OnInit(); } }
// for param init // using given initializer public Tensor(int rowDimension, int columnDimension, IInit init) { Row = rowDimension; Col = columnDimension; Capacity = rowDimension * columnDimension; W = init != null ? new Matrix(rowDimension, columnDimension, init.Next) : new Matrix(rowDimension, columnDimension); DW = new Matrix(rowDimension, columnDimension); HW = new Matrix(rowDimension, columnDimension); HW2 = new Matrix(rowDimension, columnDimension); }
// Start is called before the first frame update void Start() { //DataMgr.Instance.ClearAll(); // 数据修改的时候,作为清空重新加载使用 GameStateModel.Instance.CurrentScene = SceneName.Main; IInit lifeCycle = LifeCycleMgr.Instance; lifeCycle.Init(); AudioMgr.Instance.Init(); UIMgr.Instance.Show(Paths.START_VIEW); }
private IEnumerator Init() { yield return(TestMgr.Single.Init()); //DataMgr.Single.ClearAll(); GameStateModel.Single.CurrentScene = SceneName.Main; IInit lifeCycle = LifeCycleMgr.Single; lifeCycle.Init(); UIManager.Single.Show(Paths.PREFAB_START_VIEW); DontDestroyOnLoad(gameObject); }
public static Control GetControl(this Requirement requirement, Dictionary <string, object> meta) { RequirementType r = (RequirementType)((int)requirement.RequirementType & 0xFF); IInit ctrl = null; switch (r) { case RequirementType.Bool: ctrl = new Boolean(); break; case RequirementType.String: ctrl = new String(); break; case RequirementType.Integer: ctrl = new Integer(); break; case RequirementType.Password: ctrl = new Password(); break; case RequirementType.FilePath: ctrl = new FilePath(); break; case RequirementType.FolderPath: ctrl = new FolderPath(); break; case RequirementType.DropDownList: ctrl = new DropDownList(); break; case RequirementType.Link: ctrl = new Link(); break; } if (ctrl != null) { ctrl.Init(requirement, meta); } return((Control)ctrl); }
public static void Register(IInit init) { try { var name = init.GetType().FullName; if (Ran.Where(t => t == name).Any()) { return; } k.Diagnostic.Debug(LOG, null, "Starting {0} dependencies", name); init.Init10_Dependencies(); k.Diagnostic.Debug(LOG, null, "Starting {0} configs", name); init.Init20_Config(); k.Diagnostic.Debug(LOG, null, "Starting {0} threads ", name); init.Init50_Threads(); k.Diagnostic.Debug(LOG, null, "Registred the {0} library", name); Ran.Add(name); }catch (Exception ex) { k.Diagnostic.Error(init, ex); throw ex; } }
private Page GetView <TVM, TParameter>(TParameter param) { Type viewType; if (!_viewModelPageMapping.TryGetValue(typeof(TVM), out viewType)) { throw new ArgumentException($"could not find view for {typeof(TVM)}"); } var viewModel = _container.Resolve <TVM>(); // get view ctor with no parameters var ctors = viewType.GetTypeInfo().DeclaredConstructors; var viewCtor = viewType.GetTypeInfo().DeclaredConstructors.FirstOrDefault(ct => ct.GetParameters().Length == 0); var view = viewCtor.Invoke(null) as Page; view.BindingContext = viewModel; IInit <TParameter> init = viewModel as IInit <TParameter>; if (init != null) { init.Init(param); } return(view); }
protected override FanInShape <T> Construct(IInit init) { return(new MergePreferredShape(_secondaryPorts, init)); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> /// <returns>TBD</returns> protected override FanInShape <TOut> Construct(IInit init) { return(new FanInShape <T0, T1, TOut>(init)); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> public FanInShape(IInit init) : base(init) { In0 = NewInlet <T0>("in0"); In1 = NewInlet <T1>("in1"); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> public FanOutShape(IInit init) : base(init) { Out0 = NewOutlet <T0>("out0"); Out1 = NewOutlet <T1>("out1"); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> /// <returns>TBD</returns> protected override FanOutShape <TIn> Construct(IInit init) { return(new FanOutShape <TIn, T0, T1>(init)); }
/// <summary> /// TBD /// </summary> /// <param name="n">TBD</param> /// <param name="init">TBD</param> public UniformFanOutShape(int n, IInit init) : base(init) { _n = n; Outs = Enumerable.Range(0, n).Select(i => NewOutlet <TOut>($"out{i}")).ToImmutableList(); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> /// <returns>TBD</returns> protected override FanOutShape <TIn> Construct(IInit init) => new UniformFanOutShape <TIn, TOut>(_n, init);
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> protected FanOutShape(IInit init) : this(init.Inlet, init.Outlets, init.Name) { }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> /// <returns>TBD</returns> protected abstract FanOutShape <TIn> Construct(IInit init);
public static void Starting(IInit init) { }
public MergePreferredShape(int secondaryPorts, IInit init) : base(secondaryPorts, init) { _secondaryPorts = secondaryPorts; Preferred = NewInlet <T>("preferred"); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> /// <returns>TBD</returns> protected abstract FanInShape <TOut> Construct(IInit init);
/// <summary> /// TBD /// </summary> /// <param name="n">TBD</param> /// <param name="init">TBD</param> public UniformFanInShape(int n, IInit init) : base(init) { N = n; Ins = Enumerable.Range(0, n).Select(i => NewInlet <TIn>($"in{i}")).ToImmutableList(); }
/// <summary> /// TBD /// </summary> /// <param name="init">TBD</param> /// <returns>TBD</returns> protected override FanInShape <TOut> Construct(IInit init) => new UniformFanInShape <TIn, TOut>(N, init);