returns final values (same result as tf.Session.run())
765851
def get_values(self):
		
		return [self._cache.get(i.name,None) for i in self._original_evals]
926766
public org.tensorflow.framework.StepStats getStepStats() {
    return stepStats_ == null ? org.tensorflow.framework.StepStats.getDefaultInstance() : stepStats_;
  }
676938
private static Object getFutureValue(ListenableFuture<?> future) {
    Object valueToSet;
    if (future instanceof TrustedFuture) {
      // Break encapsulation for TrustedFuture instances since we know that subclasses cannot
      // override .get() (since it is final) and therefore this is equivalent to calling .get()
      // and unpacking the exceptions like we do below (just much faster because it is a single
      // field read instead of a read, several branches and possibly creating exceptions).
      return ((AbstractFuture<?>) future).value;
    } else {
      // Otherwise calculate valueToSet by calling .get()
      try {
        Object v = getDone(future);
        valueToSet = v == null ? NULL : v;
      } catch (ExecutionException exception) {
        valueToSet = new Failure(exception.getCause());
      } catch (CancellationException cancellation) {
        valueToSet = new Cancellation(false, cancellation);
      } catch (Throwable t) {
        valueToSet = new Failure(t);
      }
    }
    return valueToSet;
  }
166535
def VariablesValues(self, variables, t):
        
        # TODO: put interpolation in variables
        if (t < self.te) | (t > 0):
            i = t//self.ts  # time step
            ti = self.ts*i
            if type(variables) == list:
                values = []
                for variable in variables:
                    # interpolation
                    values.append(
                        variables.values[i]*((ti-t)/self.ts+1)+variables.values[i+1]*(t-ti)/self.ts)
                return values

            else:
                # interpolation
                return variables.values[i]*((ti-t)/self.ts+1)+variables.values[i+1]*(t-ti)/self.ts
        else:
            raise ValueError
828523
def run_to_states(self):
        
        self.execution_engine_lock.acquire()
        return_value = self._run_to_states
        self.execution_engine_lock.release()
        return return_value
307399
def run(self, fct, input_):
    """"""
    # TF 2.0
    if tf.executing_eagerly():
      return fct(input_).numpy()
    # TF 1.0
    else:
      # Should compile the function if this is the first time encountered
      if not isinstance(input_, np.ndarray):
        input_ = np.array(input_)
      run_args = RunArgs(fct=fct, input=input_)
      signature = self._build_signature(run_args)
      if signature not in self._graph_run_cache:
        graph_run = self._build_graph_run(run_args)
        self._graph_run_cache[signature] = graph_run
      else:
        graph_run = self._graph_run_cache[signature]

      # Then execute the cached graph
      return graph_run.session.run(
          graph_run.output,
          feed_dict={graph_run.placeholder: input_},
      )
1220946
def result(self, raise_exception=True):
        
        _status = None
        _exception = None
        self._done_event.wait(MAXINT)  # first wait for session global
        if self.is_failed():  # global exception set
            _exception = self._exception
            _status = enumAsperaControllerStatus.FAILED
        else:
            for _session in self._sessions.values():
                _status_tmp, _exception_tmp = _session.wait()
                if _exception_tmp and not _exception:
                    _exception = _exception_tmp
                    _status = _status_tmp

        # Once done waiting, raise an exception if present or return the final status
        if _exception and raise_exception:
            raise _exception

        return _status
835903
def get_session_value(self, name, default=None):
        """"""
        session_name = 'list_{}_{}_{}'.format(self.kwargs.get('app'), self.kwargs.get('model'), name)
        return self.request.session.get(session_name, default)
368058
def run():
  """"""
  step = tf.compat.v1.placeholder(tf.float32, shape=[])

  with tf.name_scope('loss'):
    # Specify 2 different loss values, each tagged differently.
    summary_lib.scalar('foo', tf.pow(0.9, step))
    summary_lib.scalar('bar', tf.pow(0.85, step + 2))

    # Log metric baz as well as upper and lower bounds for a margin chart.
    middle_baz_value = step + 4 * tf.random.uniform([]) - 2
    summary_lib.scalar('baz', middle_baz_value)
    summary_lib.scalar('baz_lower',
                       middle_baz_value - 6.42 - tf.random.uniform([]))
    summary_lib.scalar('baz_upper',
                       middle_baz_value + 6.42 + tf.random.uniform([]))

  with tf.name_scope('trigFunctions'):
    summary_lib.scalar('cosine', tf.cos(step))
    summary_lib.scalar('sine', tf.sin(step))
    summary_lib.scalar('tangent', tf.tan(step))

  merged_summary = tf.compat.v1.summary.merge_all()

  with tf.compat.v1.Session() as sess, tf.summary.FileWriter(LOGDIR) as writer:
    # We only need to specify the layout once (instead of per step).
    layout_summary = summary_lib.custom_scalar_pb(
        layout_pb2.Layout(category=[
            layout_pb2.Category(
                title='losses',
                chart=[
                    layout_pb2.Chart(
                        title='losses',
                        multiline=layout_pb2.MultilineChartContent(
                            tag=[r'loss(?!.*margin.*)'],)),
                    layout_pb2.Chart(
                        title='baz',
                        margin=layout_pb2.MarginChartContent(
                            series=[
                                layout_pb2.MarginChartContent.Series(
                                    value='loss/baz/scalar_summary',
                                    lower='loss/baz_lower/scalar_summary',
                                    upper='loss/baz_upper/scalar_summary'
                                ),
                            ],)),
                ]),
            layout_pb2.Category(
                title='trig functions',
                chart=[
                    layout_pb2.Chart(
                        title='wave trig functions',
                        multiline=layout_pb2.MultilineChartContent(
                            tag=[
                                r'trigFunctions/cosine', r'trigFunctions/sine'
                            ],)),
                    # The range of tangent is different. Give it its own chart.
                    layout_pb2.Chart(
                        title='tan',
                        multiline=layout_pb2.MultilineChartContent(
                            tag=[r'trigFunctions/tangent'],)),
                ],
                # This category we care less about. Make it initially closed.
                closed=True),
        ]))
    writer.add_summary(layout_summary)

    for i in xrange(42):
      summary = sess.run(merged_summary, feed_dict={step: i})
      writer.add_summary(summary, global_step=i)
817616
def get_params(self):
    

    if hasattr(self, 'params'):
      return list(self.params)

    # Catch eager execution and assert function overload.
    try:
      if tf.executing_eagerly():
        raise NotImplementedError("For Eager execution - get_params "
                                  "must be overridden.")
    except AttributeError:
      pass

    # For graph-based execution
    scope_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
                                   self.scope + "/")

    if len(scope_vars) == 0:
      self.make_params()
      scope_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
                                     self.scope + "/")
      assert len(scope_vars) > 0

    # Make sure no parameters have been added or removed
    if hasattr(self, "num_params"):
      if self.num_params != len(scope_vars):
        print("Scope: ", self.scope)
        print("Expected " + str(self.num_params) + " variables")
        print("Got " + str(len(scope_vars)))
        for var in scope_vars:
          print("\t" + str(var))
        assert False
    else:
      self.num_params = len(scope_vars)

    return scope_vars
902791
Object[] getNewRowData(Session session) {

        Object[] data = new Object[getColumnCount()];
        int      i;

        if (hasDefaultValues) {
            for (i = 0; i < getColumnCount(); i++) {
                Expression def = colDefaults[i];

                if (def != null) {
                    data[i] = def.getValue(session, colTypes[i]);
                }
            }
        }

        return data;
    }
1069642
def cmd_full_return(
            self,
            tgt,
            fun,
            arg=(),
            timeout=None,
            tgt_type='glob',
            ret='',
            verbose=False,
            kwarg=None,
            **kwargs):
        '''
        
        '''
        was_listening = self.event.cpub

        try:
            pub_data = self.run_job(
                tgt,
                fun,
                arg,
                tgt_type,
                ret,
                timeout,
                kwarg=kwarg,
                listen=True,
                **kwargs)

            if not pub_data:
                return pub_data

            return (self.get_cli_static_event_returns(pub_data['jid'],
                                                      pub_data['minions'],
                                                      timeout,
                                                      tgt,
                                                      tgt_type,
                                                      verbose))
        finally:
            if not was_listening:
                self.event.close_pub()
1358012
def simulate(self, action):
    
    with tf.name_scope("environment/simulate"):
      if action.dtype in (tf.float16, tf.float32, tf.float64):
        action = tf.check_numerics(action, "action")
      def step(action):
        step_response = self._batch_env.step(action)
        # Current env doesn't return `info`, but EnvProblem does.
        # TODO(afrozm): The proper way to do this is to make T2TGymEnv return
        # an empty info return value.
        if len(step_response) == 3:
          (observ, reward, done) = step_response
        else:
          (observ, reward, done, _) = step_response
        return (observ, reward.astype(np.float32), done)
      observ, reward, done = tf.py_func(
          step, [action],
          [self.observ_dtype, tf.float32, tf.bool], name="step")
      reward = tf.check_numerics(reward, "reward")
      reward.set_shape((len(self),))
      done.set_shape((len(self),))
      with tf.control_dependencies([self._observ.assign(observ)]):
        return tf.identity(reward), tf.identity(done)
643540
def _last_values(self):
        
        if not self.session.get('last_request_uri'):
            self.session.last_request_uri = None
        self.session.last_request_at = self.session.get('last_request_at', 0)
427011
def get_proc_outputs(self):
        

        self._session.complete_rpc()
        results = [None] * len(self._session.output_params.items())
        for key, param in self._session.output_params.items():
            results[key] = param.value
        return results
933916
Map<WorkflowInstance, RunState> readActiveStates() throws IOException {
    var timeout = CompletableFuture.runAsync(() -> {}, delayedExecutor(30, SECONDS));

    var instances = listActiveInstances0(timeout);

    // Strongly consistently read values for the instances in parallel
    var states = gatherIO(Lists.partition(List.copyOf(instances), MAX_NUMBER_OF_ENTITIES_IN_ONE_BATCH_READ).stream()
        .map(batch -> asyncIO(() -> readRunStateBatch(batch)))
        .collect(toList()), timeout)
        .stream()
        .flatMap(Collection::stream)
        .collect(toMap(RunState::workflowInstance, Function.identity()));

    timeout.cancel(true);

    return states;
  }
482899
def run_all(logdir, verbose=False):
  
  data = prepare_data()
  rng = random.Random(0)

  base_writer = tf.summary.create_file_writer(logdir)
  with base_writer.as_default():
    experiment = hp.Experiment(hparams=HPARAMS, metrics=METRICS)
    experiment_string = experiment.summary_pb().SerializeToString()
    tf.summary.experimental.write_raw_pb(experiment_string, step=0)
    base_writer.flush()
  base_writer.close()

  sessions_per_group = 2
  num_sessions = flags.FLAGS.num_session_groups * sessions_per_group
  session_index = 0  # across all session groups
  for group_index in xrange(flags.FLAGS.num_session_groups):
    hparams = {h: sample_uniform(h.domain, rng) for h in HPARAMS}
    hparams_string = str(hparams)
    group_id = hashlib.sha256(hparams_string.encode("utf-8")).hexdigest()
    for repeat_index in xrange(sessions_per_group):
      session_id = str(session_index)
      session_index += 1
      if verbose:
        print(
            "--- Running training session %d/%d"
            % (session_index, num_sessions)
        )
        print(hparams_string)
        print("--- repeat #: %d" % (repeat_index + 1))
      run(
          data=data,
          base_logdir=logdir,
          session_id=session_id,
          group_id=group_id,
          hparams=hparams,
      )