コード例 #1
0
ファイル: Layer.cs プロジェクト: zredb/TensorFlow.NET
        public Layer(LayerArgs args)
        {
            this.args = args;
            // A stateful layer is a layer whose updates are run during inference too,
            // for instance stateful RNNs.
            stateful = false;
            // Indicates whether `build` needs to be called upon layer call, to create
            // the layer's weights.
            built           = false;
            SupportsMasking = false;

            _init_set_name(args.Name);
            trainable_weights     = new List <IVariableV1>();
            non_trainable_weights = new List <IVariableV1>();
            computePreviousMask   = false;
            updates = new List <Operation>();

            inboundNodes  = new List <Node>();
            outboundNodes = new List <Node>();

            // Manage input shape information if passed.
            if (args.BatchInputShape == null && args.InputShape != null)
            {
                args.BatchInputShape = new int[] { args.BatchSize }.Concat(args.InputShape.dims).ToArray();
            }
        }
コード例 #2
0
        static Layer GetLayer <T>(LayerArgs args)
        {
            Layer layer    = default;
            var   assemble = Assembly.Load("TensorFlow.Keras.Layers");

            foreach (var type in assemble.GetTypes().Where(x => x.GetInterface(typeof(T).Name) != null))
            {
                layer = (Layer)Activator.CreateInstance(type, new object[] { args });
            }

            if (layer == null)
            {
                throw new NotImplementedException($"Can't find implementation for type {args.GetType().Name}");
            }
            return(layer);
        }
コード例 #3
0
        public Layer(LayerArgs args)
        {
            _args = args;
            // A stateful layer is a layer whose updates are run during inference too,
            // for instance stateful RNNs.
            stateful = false;
            // Indicates whether `build` needs to be called upon layer call, to create
            // the layer's weights.
            built = false;
            this.supports_masking = false;

            _init_set_name(name);
            _trainable_weights     = new List <IVariableV1>();
            _non_trainable_weights = new List <IVariableV1>();
            _compute_previous_mask = false;
            _updates = new List <Operation>();

            // Manage input shape information if passed.

            _inbound_nodes = new List <Node>();
        }
コード例 #4
0
 public static Dense from_config(LayerArgs args)
 {
     return(new Dense(args as DenseArgs));
 }
コード例 #5
0
ファイル: Swish.cs プロジェクト: SciSharp/TensorFlow.NET
 public Swish(LayerArgs args) : base(args)
 {
     // Swish has no arguments
 }
コード例 #6
0
 public Softsign(LayerArgs args) : base(args)
 {
     // Softsign has no arguments
 }
コード例 #7
0
 public Softplus(LayerArgs args) : base(args)
 {
     // Softplus has no arguments
 }
コード例 #8
0
        /// <summary>
        /// 数据检查
        /// </summary>
        /// <param name="fileList">文件列表</param>
        /// <returns>转换信息</returns>
        public DataCheckResult DataCheck(List <string> fileList, bool IsExcel)
        {
            List <LayerArgs> _lyrArgsList = new List <LayerArgs>();

            if (fileList.Count <= 0)
            {
                return(null);
            }

            List <DataChackLog> _checkLogs = new List <DataChackLog>();

            foreach (string s in fileList)
            {
                if (ExtCheck(s, "DataCheckExtension") == false)
                {
                    _checkLogs.Add(new DataChackLog(s, new List <string> {
                        UtilityMessageConvert.Get("属性检查:文件类型错误")
                    }));
                    continue;
                }


                string Lyr = GetlyrTypeByFile(s);

                //if (Lyr == "")
                //{
                //    Lyr = GetlyrTypeByFolder(s);
                //}


                if (Lyr == "")
                {
                    _checkLogs.Add(new DataChackLog(s, new List <string> {
                        UtilityMessageConvert.Get("属性检查:不在检查范围内")
                    }));
                    continue;
                }

                string[]  arr  = Lyr.Split('/');
                LayerArgs args = new LayerArgs()
                {
                    TxName    = arr[0],
                    TjName    = arr[1],
                    LayerName = arr[2],
                    LayerPath = s,
                    DataLayer = arr[3]
                };

                _lyrArgsList.Add(args);
            }

            DicInfoReader _dicReader = new DicInfoReader();

            List <string> errorInfo = new List <string>();

            for (int i = 0; i < _lyrArgsList.Count; i++)
            {
                try
                {
                    List <string> rlts = LayerAttChecker.CheckLayer(_lyrArgsList[i], _dicReader);
                    if (rlts != null && rlts.Count > 0)
                    {
                        _checkLogs.Add(new DataChackLog(_lyrArgsList[i].LayerPath, rlts));
                    }
                }
                catch (Exception ex)
                {
                    _checkLogs.Add(new DataChackLog(_lyrArgsList[i].LayerPath, new List <string> {
                        "属性检查:" + ex.Message
                    }));
                }
            }

            DataCheckResult ret = new DataCheckResult();

            ret.CheckInfoList = _checkLogs;

            if (IsExcel == true)
            {
                string ExcelFile = ExprotCheck(_checkLogs, _lyrArgsList);
                ret.ExcelFile = ExcelFile;
            }
            else
            {
                ret.ExcelFile = "";
            }

            return(ret);
        }
コード例 #9
0
ファイル: InputLayer.cs プロジェクト: samuelcaldas/PPO.NETv2
 public static InputLayer from_config(LayerArgs args)
 {
     return(new InputLayer(args as InputLayerArgs));
 }
コード例 #10
0
ファイル: SELU.cs プロジェクト: SciSharp/TensorFlow.NET
 public SELU(LayerArgs args) : base(args)
 {
     // SELU has no arguments
 }
コード例 #11
0
 public Exponential(LayerArgs args) : base(args)
 {
     // Exponential has no args
 }
コード例 #12
0
 public HardSigmoid(LayerArgs args) : base(args)
 {
     // hard sigmoid has no arguments
 }
コード例 #13
0
 public Tanh(LayerArgs args) : base(args)
 {
     // Tanh has no arguments
 }