protected override void SetUpPorts() { InPortList.Add(new InPort("condition", this)); InPortList.Add(new InPort("first", this)); InPortList.Add(new InPort("second", this)); OutPortList.Add(new OutPort("result", this)); }
public override InPort Expose(int inPortNO) { if (inPortNO == InPortCount()) { InPort inPort = new InPort($"in{inPortNO}", this); InPortList.Add(inPort); return(inPort); } else { return(base.Expose(inPortNO)); } }
public override void Initialize() { base.Initialize(); Signal inputSignal = new Signal(); if (isMatrix) { MatrixBuilder <double> m = Matrix <double> .Build; Matrix <double> matrix = m.Dense(rowNo, colNo, 0); inputSignal.Pack(matrix); } else { inputSignal.Pack(0); } InPortList.FindAll(inPort => !inPort.Visited).ForEach(inPort => inPort.Input(inputSignal)); stack.RemoveAt(0); }
public override void Check() { int rowNo = InPortList[0].RowNo; int colNo = InPortList[0].ColNo; rowNo = rowNo == 0? 1 : rowNo; colNo = colNo == 0? 1 : colNo; foreach (InPort inPort in InPortList.Skip(1)) { int nextRowNo = inPort.RowNo; int nextColNo = inPort.ColNo; nextRowNo = nextRowNo == 0? 1 : nextRowNo; nextColNo = nextColNo == 0? 1 : nextColNo; if (rowNo != nextRowNo) { int index = InPortList.IndexOf(inPort); throw logger.Error(new ModelException(this, $"The in port {index} has inconsistent row number.")); } colNo += nextColNo; } OutPortList[0].SetShape(rowNo, colNo); }
protected override void SetUpPorts() { InPortList.Add(new InPort("x", this)); OutPortList.Add(new OutPort("y", this)); }
protected override void SetUpPorts() { InPortList.Add(new InPort("input", this)); }
protected override void SetUpPorts() { InPortList.Add(new InPort("matrix", this)); base.SetUpPorts(); }
protected override void SetUpPorts() { InPortList.Add(new InPort("left", this)); InPortList.Add(new InPort("right", this)); OutPortList.Add(new OutPort("result", this)); }