internal static AxisVector AsAxisVector(IList <Axis> input) { AxisVector inputVector = new AxisVector(); foreach (var element in input) { inputVector.Add(element); } return(inputVector); }
/// <summary> /// Create an 'Input' Variable denoting sparse data and specify if gradients are to be computed for this input /// </summary> /// <param name="shape"></param> /// <param name="isSparse"></param> /// <param name="dataType"></param> /// <param name="needsGradient"></param> /// <param name="name"></param> /// <param name="dynamicAxes"></param> /// <returns></returns> public static Variable InputVariable(NDShape shape, DataType dataType, string name = "", IList <Axis> dynamicAxes = null, bool isSparse = false, bool needsGradient = false) { if (dynamicAxes == null) { dynamicAxes = Axis.DefaultInputVariableDynamicAxes(); } AxisVector dynamicAxesVector = Helper.AsAxisVector(dynamicAxes); return(CNTKLib.InputVariable(shape, isSparse, dataType, needsGradient, name, dynamicAxesVector)); }
/// <summary> /// Create a Placeholder variable to be used as a temporary/placeholder input to a Function. /// All placeholder inputs of a Function must be replaced with non-placeholder Variables before Forward evaluation of the Function. /// </summary> /// <param name="shape"></param> /// <param name="dynamicAxes"></param> /// <returns></returns> public static Variable PlaceholderVariable(NDShape shape, IList <Axis> dynamicAxes) { AxisVector dynamicAxesVector = Helper.AsAxisVector(dynamicAxes); return(CNTKLib.PlaceholderVariable(shape, dynamicAxesVector)); }