示例#1
0
        public IEnumerable <int> steps()
        {
            _current_step = 0;
            while (_current_step < _inferred_steps)
            {
                if (_insufficient_data)
                {
                    break;
                }

                bool can_run_full_execution = _steps_per_execution_value == 1 ||
                                              _inferred_steps < 0 ||
                                              _inferred_steps - _current_step >= _steps_per_execution_value;

                if (can_run_full_execution)
                {
                    _step_increment = _steps_per_execution_value - 1;
                    yield return(_current_step);

                    _current_step += _steps_per_execution_value;
                }
                else
                {
                    var steps_remaining = _inferred_steps - _current_step;
                    _steps_per_execution.assign(steps_remaining);
                    _step_increment = steps_remaining - 1;
                    yield return(_current_step);

                    _current_step += steps_remaining;
                    _steps_per_execution.assign(_steps_per_execution_value);
                }
            }
        }
示例#2
0
 public static Tensor assign(IVariableV1 @ref, object value,
                             bool validate_shape = true,
                             bool use_locking    = true,
                             string name         = null)
 {
     if (@ref.dtype.is_ref_dtype())
     {
         return(gen_state_ops.assign(@ref,
                                     value,
                                     validate_shape: validate_shape,
                                     use_locking: use_locking,
                                     name: name));
     }
     else
     {
         return(@ref.assign(value, name: name));
     }
 }
示例#3
0
 void AssignVariable(IVariableV1 v)
 {
     using var tensor = tf.constant(1984f);
     v.assign(tensor);
 }