Beispiel #1
0
        internal static VariableVector AsVariableVector(IList <Variable> input)
        {
            VariableVector inputVector = new VariableVector();

            foreach (var element in input)
            {
                inputVector.Add(element);
            }
            return(inputVector);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new Function from specified operands.
        /// </summary>
        /// <param name="operands"></param>
        /// <returns></returns>
        public static Function Combine(System.Collections.Generic.IEnumerable <Variable> operands)
        {
            var varVect = new VariableVector();

            foreach (var v in operands)
            {
                varVect.Add(v);
            }
            return(CNTKLib.Combine(varVect));
        }
        /// <summary>
        /// Create a new Function instance which just combines the outputs of the specified list of 'operands' Functions such that the 'Outputs' of the
        /// new 'Function' are union of the 'Outputs' of each of the specified 'operands' Functions.
        /// E.g. When creating a classification model, typically the CrossEntropy loss Function and the ClassificationError Function comprise the two roots
        /// of the computation graph which can be "Combine"d to create a single Function with 2 outputs; viz. CrossEntropy loss and ClassificationError output.
        /// </summary>
        /// <param name="operands">variables whose function are to be combined</param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static Function Combine(IList <Variable> operands, string name = "")
        {
            VariableVector operandVector = Helper.AsVariableVector(operands);

            return(CNTKLib.Combine(operandVector, name));
        }