Esempio n. 1
0
        public static MatMul MatMul(Layer left, Layer right)
        {
            var leftOutput  = left.Outputs.First().Value;
            var rightOutput = right.Outputs.First().Value;
            var node        = new MatMul(leftOutput.Dimensions, rightOutput.Dimensions);

            leftOutput.Connect(node.A);
            rightOutput.Connect(node.B);
            return(node);
        }
Esempio n. 2
0
        private static Layer ParseMatMulNode(NodeProto node, Dictionary <string, TensorType> types, Dictionary <string, OutputConnector> outputConns)
        {
            var aType = types[node.Input[0]];
            var bType = types[node.Input[1]];
            var layer = new MatMul(aType.Dimensions, bType.Dimensions)
            {
                Name = node.Name
            };

            outputConns[node.Input[0]].Connect(layer.A);
            outputConns[node.Input[1]].Connect(layer.B);

            types.Add(node.Output[0], new TensorType {
                ElementType = typeof(double), Dimensions = layer.Y.Dimensions.ToArray()
            });
            outputConns.Add(node.Output[0], layer.Y);
            return(layer);
        }
    public override void VisitMatAssignOperationElement(MatMul element)
    {
        //String s=element.getLhs();

        VisitElement(element.getRhs());
    }
    public override void VisitMatAssignOperationElement(MatMul element)
    {
        VisitElement(element.getRhs());
        VisitElement(element.getLhs());
        resultMessage += "Processing Matrix Assignment Operation"+"\n";
        Thread[] threads=new Thread[resrows];
        if (operation.CompareTo("*") == 0)
        {
            for (int i = 0; i < resrows; i++)
            {
                ParameterizedThreadStart pts = new ParameterizedThreadStart(threadMul);
                threads[i] = new Thread(pts);
                threads[i].Start(new ThrInd(i));
            }
        }
        else if (operation.CompareTo("+") == 0)
        {
            for (int i = 0; i < resrows; i++)
            {
                ParameterizedThreadStart pts = new ParameterizedThreadStart(threadAdd);
                threads[i] = new Thread(pts);
                threads[i].Start(new ThrInd(i));
            }

        }

        foreach (Thread t in threads)
        {
            while (t.IsAlive)
                continue;
        }

        for (int i = 0; i < resrows ; i++)
        {
            arrvalue += "[";
            Console.WriteLine("Arrvalue is{0}",arrvalue);
            for (int j = 0; j < rescolumns ; j++)
            {
                Console.Write("{0} \t",res[i,j]);
                resultMessage += string.Format("{0} \t", res[i, j]);
                arrvalue += string.Format("{0}",res[i,j]);
                if (j + 1 == rescolumns)
                { }
                else
                    arrvalue += ",";

            }
            arrvalue += "]";
            Console.Write("\n");
            resultMessage += "\n";
        }

        Console.WriteLine("Printing value of s in MatAssignOperation: {0} which is {1}",s,arrvalue); // to be removed
        arrVariableMap[s] = arrvalue;
        arrvalue = "";
    }
Esempio n. 5
0
 public abstract void VisitMatAssignOperationElement(MatMul element);