Exemplo n.º 1
0
        public static _VariableScopeStore get_variable_scope_store()
        {
            _VariableScopeStore ret = null;
            var scope_store         = ops.get_collection(_VARSCOPESTORE_KEY);

            if (scope_store == null)
            {
                ret = new _VariableScopeStore();
                ops.add_to_collection(_VARSCOPESTORE_KEY, ret);
            }
            else
            {
                switch (scope_store)
                {
                case List <RefVariable> values:
                    ret = values[0];
                    break;

                case List <_VariableScopeStore> values:
                    ret = values[0];
                    break;

                default:
                    throw new InvalidOperationException("get_variable_scope_store");
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
 public PureVariableScope(string name,
                          string old_name_scope = null,
                          TF_DataType dtype     = TF_DataType.DtInvalid)
 {
     _name            = name;
     _old_name_scope  = old_name_scope;
     _var_store       = variable_scope._get_default_variable_store();
     _var_scope_store = variable_scope.get_variable_scope_store();
 }
Exemplo n.º 3
0
        public static _VariableScopeStore get_variable_scope_store()
        {
            var scope_store = ops.get_collection <_VariableScopeStore>(_VARSCOPESTORE_KEY).FirstOrDefault();

            if (scope_store == null)
            {
                scope_store = ops.get_collection <RefVariable>(_VARSCOPESTORE_KEY).FirstOrDefault();
            }
            if (scope_store == null)
            {
                scope_store = new _VariableScopeStore();
                ops.add_to_collection(_VARSCOPESTORE_KEY, scope_store);
            }
            return(scope_store);
        }
Exemplo n.º 4
0
        public PureVariableScope(VariableScope scope,
                                 string old_name_scope = null,
                                 TF_DataType dtype     = TF_DataType.DtInvalid)
        {
            _scope           = scope;
            _old_name_scope  = old_name_scope;
            _var_store       = variable_scope._get_default_variable_store();
            _var_scope_store = variable_scope.get_variable_scope_store();
            _new_name        = _scope.name;

            string name_scope = _scope._name_scope;

            variable_scope_object = new VariableScope(_reuse,
                                                      name: _new_name,
                                                      name_scope: name_scope);

            _cached_variable_scope_object = variable_scope_object;
        }