public static void UnregisterTextInput()
 {
     _variable = null;
     KeyGrabber.InboundCharEvent -= ProcessInput;
     KeyGrabber.UnregisterMessageFilter();
     _recievingRawInput = false;
 }
示例#2
0
 public MyVariable(Data.Variable var, Type type) : base(var.Type, var.Name, var.Relation)
 {
     this.type       = type;
     this.objectName = var.Type;
     this.alias      = string.Empty;
     this.isList     = false;
 }
 public static void UnregisterTextInput()
 {
     _variable = null;
     KeyGrabber.InboundCharEvent -= ProcessInput;
     KeyGrabber.UnregisterMessageFilter();
     _recievingRawInput = false;
 }
 public static void RegisterTextInput(Data.Variable variable)
 {
     _variable = variable;
     KeyGrabber.InboundCharEvent += ProcessInput;
     KeyGrabber.RegisterMessageFilter();
     _recievingRawInput = true;
 }
 public static void RegisterTextInput(Data.Variable variable)
 {
     _variable = variable;
     KeyGrabber.InboundCharEvent += ProcessInput;
     KeyGrabber.RegisterMessageFilter();
     _recievingRawInput = true;
 }
        private static void ProcessInput(char input)
        {
            //Only append characters that exist in the spritefont.
            if (input == 13)
            {
                try
                {
                    var method = 
                        EngineGlobals.GenerateMethodFromString(
                        _variable.AsString.Replace(' ',';'));
                    method.ExecuteMethod(null);
                    ConsoleWindow.WriteLine("Executing...");
                }
                catch(EngineException ex)
                {
                    ConsoleWindow.WriteLine("Warning: {0}", ex.Message);
                }
                _variable.AsString = "";
                return;
            }

            if (input < 32 && input > 9)
                return;

            if (input > 126)
                return;

            if (input == 8)
            {
                if (_variable.AsString.Length > 0)
                    _variable.AsString = _variable.AsString.Substring(0, _variable.AsString.Length - 1);
            }
            else
                _variable += input;
        }
 /// <summary>
 /// Connectionist Temporal Classification is a loss function useful for performing supervised learning on sequence data, without needing an alignment between input data and labels. For example, CTC can be used to train end-to-end systems for speech recognition
 /// </summary>
 protected static Data.Function ConnectionistTemporalClassificationFunction(Data.Variable labels, Data.Variable predictions)
 {
     return(CNTKLib.EditDistanceError(predictions, labels, 0, 1, 1, true,
                                      new SizeTVector(1)
     {
         (uint)labels.Shape.TotalSize
     }));
 }
 /// <summary>
 ///     Tops the k accuracy.
 /// </summary>
 private static Function TopKAccuracyFunction(Data.Variable labels, Data.Variable predictions, uint k)
 {
     return((Data.Constant) 1f - (Data.Function)CNTKLib.ClassificationError(predictions, labels, k));
 }
 public static void UnregisterTextInput()
 {
     _variable = null;
     _recievingRawInput = false;
 }
 public static void RegisterTextInput(Data.Variable variable)
 {
     _variable = variable;
     _recievingRawInput = true;
 }
示例#11
0
 /// <summary>
 /// Binaries the cross entropy.
 /// </summary>
 protected static Data.Function BinaryCrossEntropyFunction(Data.Variable labels, Data.Variable predictions)
 {
     return(CNTKLib.BinaryCrossEntropy(predictions, labels));
 }
示例#12
0
 /// <summary>
 /// Crosses the entropy.
 /// </summary>
 protected static Data.Function CrossEntropyFunction(Data.Variable labels, Data.Variable predictions)
 {
     return(CNTKLib.CrossEntropyWithSoftmax(predictions, labels));
 }
示例#13
0
 public static void UnregisterTextInput()
 {
     _variable          = null;
     _recievingRawInput = false;
 }
示例#14
0
 public static void RegisterTextInput(Data.Variable variable)
 {
     _variable          = variable;
     _recievingRawInput = true;
 }
 /// <summary>
 /// Sparses the cross entropy.
 /// </summary>
 protected static Data.Function SparseCrossEntropyFunction(Data.Variable labels, Data.Variable predictions)
 {
     return(CNTKLib.CrossEntropyWithSoftmax(predictions,
                                            CNTKLib.Reshape(labels, new[] { labels.Shape.TotalSize })));
 }