예제 #1
0
        public RefVariable get_variable(_VariableStore var_store,
                                        string name,
                                        TensorShape shape         = null,
                                        TF_DataType dtype         = TF_DataType.DtInvalid,
                                        object initializer        = null, // IInitializer or Tensor
                                        bool?trainable            = null,
                                        List <string> collections = null,
                                        bool?use_resource         = null,
                                        bool validate_shape       = true,
                                        VariableSynchronization synchronization = VariableSynchronization.Auto,
                                        VariableAggregation aggregation         = VariableAggregation.None)
        {
            string full_name = !string.IsNullOrEmpty(this.name) ? this.name + "/" + name : name;

            return(tf_with(ops.name_scope(null), scope =>
            {
                if (dtype == TF_DataType.DtInvalid)
                {
                    dtype = _dtype;
                }

                return var_store.get_variable(full_name,
                                              shape: shape,
                                              dtype: dtype,
                                              initializer: initializer,
                                              reuse: resue,
                                              trainable: trainable,
                                              collections: collections,
                                              synchronization: synchronization,
                                              aggregation: aggregation) as RefVariable;
            }));
        }
        public RefVariable get_variable(_VariableStore var_store,
                                        string name,
                                        TensorShape shape        = null,
                                        TF_DataType dtype        = TF_DataType.DtInvalid,
                                        IInitializer initializer = null,
                                        bool?trainable           = null,
                                        VariableSynchronization synchronization = VariableSynchronization.AUTO,
                                        VariableAggregation aggregation         = VariableAggregation.NONE)
        {
            string full_name = !string.IsNullOrEmpty(this._name) ? this._name + "/" + name : name;

            return(with(new ops.name_scope(null), scope =>
            {
                if (dtype == TF_DataType.DtInvalid)
                {
                    dtype = _dtype;
                }

                return var_store.get_variable(full_name,
                                              shape: shape,
                                              dtype: dtype,
                                              initializer: initializer,
                                              trainable: trainable,
                                              synchronization: synchronization,
                                              aggregation: aggregation);
            }));
        }