Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 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));
     }
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
 protected override void SetUpPorts()
 {
     InPortList.Add(new InPort("x", this));
     OutPortList.Add(new OutPort("y", this));
 }
Esempio n. 6
0
 protected override void SetUpPorts()
 {
     InPortList.Add(new InPort("input", this));
 }
Esempio n. 7
0
 protected override void SetUpPorts()
 {
     InPortList.Add(new InPort("matrix", this));
     base.SetUpPorts();
 }
Esempio n. 8
0
 protected override void SetUpPorts()
 {
     InPortList.Add(new InPort("left", this));
     InPortList.Add(new InPort("right", this));
     OutPortList.Add(new OutPort("result", this));
 }