Beispiel #1
0
        public bool ProcessVariable(Function holder, Variable va, int depth, bool visited)
        {
            if (visited)
            {
                return(true);
            }

            IDataSource <float>[] values = null;

            if (va.Kind == VariableKind.Parameter || va.Kind == VariableKind.Constant)
            {
                values = new IDataSource <float>[] { DataSourceFactory.FromVariable(va) }
            }
            ;
            else if (va.Kind == VariableKind.Output)
            {
                values = GetValues(va.Owner);
            }

            var nodeInfo = new NodeInfo()
            {
                Node     = (WrappedVariable)va,
                Uid      = va.Uid,
                Name     = va.Name,
                Type     = Utils.VariableKindName(va.Kind),
                Path     = GetPath(va.Uid, holder.Uid),
                Parent   = holder.Uid,
                Children = va.Owner != null ? new string[] { va.Owner.Uid } : null,
                Shape    = va.Shape,
                Values   = values
            };

            _history.Add(va.Uid, nodeInfo);
            _queue.Add(nodeInfo);

            return(true);
        }
Beispiel #2
0
 public static IDataSource <float> VariableToDataSource(CNTK.Variable variable)
 {
     return(DataSourceFactory.FromVariable(variable));
 }