Returns the value of given variables at time t. 
        Linear interpolation is performed between two time steps.

        :param variables: one variable or a list of variables
        :param t: time of evaluation
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
436210
def _broadcast_compat_variables(*variables):
    
    dims = tuple(_unified_dims(variables))
    return tuple(var.set_dims(dims) if var.dims != dims else var
                 for var in variables)
1041914
def _get_other_var(self, X_feat, X_seq, variable="y_pred"):
        
        if self.is_trained() is False:
            print("Model not fitted yet. Use object.fit() to fit the model.")
            return

        # input check:
        assert X_seq.shape[0] == X_feat.shape[0]

        # TODO - check this
        # sequence can be wider or thinner?
        # assert self._param["seq_length"] == X_seq.shape[2]
        assert self._param["n_add_features"] == X_feat.shape[1]

        # setup graph and variables
        graph = tf.Graph()
        var = self._convert_to_var(graph, self._var_res)
        other_var = self._build_graph(graph, var)
        with tf.Session(graph=graph) as sess:
            sess.run(other_var["init"])
            # predict
            y = self._predict_in_session(sess, other_var, X_feat, X_seq, variable)

        return y
669629
def _scoped_variables(self, nodes_list, **kwargs):
        

        tmp_vars = []
        for node in nodes_list:

            is_assign_node = isinstance(node, nodes.Assign)
            name = node.target.name if is_assign_node else node.name

            # create a temp variable name
            tmp_var = next(self.temp_var_names)

            # save previous context value
            with self._execution():

                # save the current value of this name
                self.output.write('var %s = %s.%s;' % (tmp_var, self.context_name, name))

                # add new value to context
                self.output.write('%s.%s = ' % (self.context_name, name))

                if is_assign_node:
                    self._process_node(node.node, **kwargs)
                else:
                    self.output.write(node.name)

                self.output.write(';')

            tmp_vars.append((tmp_var, name))

        yield

        # restore context
        for tmp_var, name in tmp_vars:
            with self._execution():
                self.output.write('%s.%s = %s;' % (self.context_name, name, tmp_var))
13027
def value(self):
        
        if self.kind == 'variable':
            return self.target.variables[self.block.args[0]]
        elif self.kind == 'list':
            return self.target.lists[self.block.args[0]]
696276
def scalar(self, value, step, name):
        
        # Spaces not allowed for scalar variable name
        assert len(name.split(" ")) < 2, "Ensure that you don't have spaces in your variable name, use '_' instead."
        name = "scalar_" + name
        self.previous.append(name)
        if self.previous[-1] not in self.previous[:-1]:
            self.c.execute("""INSERT INTO {time_stamp_table} (
                              variable_name, variable_type
                              ) VALUES ('{variable}', '{type}')"""
                           .format(time_stamp_table=self.time_stamp, variable=name, type="scalar"))
        else:
            self.previous.pop()

        self.c.execute("""CREATE TABLE IF NOT EXISTS {variable_table_name} (
                          X_value FLOAT, Y_value FLOAT, time VARCHAR
                          )""".format(variable_table_name=self.time_stamp + '_' + name))

        self.c.execute("""INSERT INTO {variable_table_name} (
                          X_value, Y_value, time) VALUES ('{x}', '{y}', '{time}'
                          )""".format(variable_table_name=self.time_stamp + '_' + name,
                                      x=step, y=value, time=datetime.datetime.now()))
        self.conn.commit()
527711
def _get_value(self, var):
        """"""
        return self._problem._cp.solution.get_values(
            self._problem._variables[var])
108863
def _get_value(self, var):
        """"""
        return self._problem._p.get_value(self._problem._variables[var])
313787
def get_vars(self):
    

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

    done = False
    tried_to_make_params = False
    while not done:
      # Most models in cleverhans use only trainable variables and do not
      # make sure the other collections are updated correctly.
      trainable_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
                                         self.scope + "/")
      # When wrapping other code, such as the CIFAR 10 challenge models,
      # we need to make sure we get the batch norm running averages as well
      # as the trainable variables.
      model_vars = tf.get_collection(tf.GraphKeys.MODEL_VARIABLES,
                                     self.scope + "/")
      scope_vars = ordered_union(trainable_vars, model_vars)

      if len(scope_vars) > 0:
        done = True
      else:
        assert not tried_to_make_params
        tried_to_make_params = True
        self.make_params()

    # Make sure no variables have been added or removed
    if hasattr(self, "num_vars"):
      assert self.num_vars == len(scope_vars)
    else:
      self.num_vars = len(scope_vars)

    return scope_vars
843727
def get_var(self, name):
        
        if name not in self._vars:
            raise VarNotDefinedError

        return self._vars[name]
1218739
def update_variables(X, Z, U, prox_f, step_f, prox_g, step_g, L):
    
    if not hasattr(prox_g, '__iter__'):
        if prox_g is not None:
            dX = step_f/step_g * L.T.dot(L.dot(X) - Z + U)
            X[:] = prox_f(X - dX, step_f)
            LX, R, S = do_the_mm(X, step_f, Z, U, prox_g, step_g, L)
        else:
            # fall back to simple fixed-point method for f
            # see do_the_mm for normal definitions of LX,Z,R,S
            S = -X.copy()
            X[:] = prox_f(X, step_f)
            LX = X
            Z[:] = X[:]
            R = np.zeros(X.shape, dtype=X.dtype)
            S += X

    else:
        M = len(prox_g)
        dX = np.sum([step_f/step_g[i] * L[i].T.dot(L[i].dot(X) - Z[i] + U[i]) for i in range(M)], axis=0)
        X[:] = prox_f(X - dX, step_f)
        LX = [None] * M
        R = [None] * M
        S = [None] * M
        for i in range(M):
            LX[i], R[i], S[i] = do_the_mm(X, step_f, Z[i], U[i], prox_g[i], step_g[i], L[i])
    return LX, R, S
491777
def _pre_var(self, value):
        

        def sub_(m):
            return self._pre_variables.get(m.group()[2:-1].strip(), '')

        return r_pre_var.sub(sub_, value)
672197
def describe_trainable_vars():
    
    train_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
    if len(train_vars) == 0:
        logger.warn("No trainable variables in the graph!")
        return
    total = 0
    total_bytes = 0
    data = []
    for v in train_vars:
        if v.name.startswith('tower'):
            continue
        shape = v.get_shape()
        ele = shape.num_elements()
        if ele is None:
            logger.warn("Shape of variable {} is not fully defined but {}.".format(v.name, shape))
            ele = 0
        try:
            shape = shape.as_list()
        except ValueError:
            shape = '<unknown>'

        total += ele
        total_bytes += ele * v.dtype.size
        data.append([v.name, shape, ele, v.device, v.dtype.base_dtype.name])
    headers = ['name', 'shape', '#elements', 'device', 'dtype']

    dtypes = list(set([x[4] for x in data]))
    if len(dtypes) == 1 and dtypes[0] == "float32":
        # don't log the dtype if all vars are float32 (default dtype)
        for x in data:
            del x[4]
        del headers[4]

    devices = set([x[3] for x in data])
    if len(devices) == 1:
        # don't log the device if all vars on the same device
        for x in data:
            del x[3]
        del headers[3]

    table = tabulate(data, headers=headers)

    size_mb = total_bytes / 1024.0**2
    summary_msg = colored(
        "\nNumber of trainable variables: {}".format(len(data)) +
        "\nNumber of parameters (elements): {}".format(total) +
        "\nStorage space needed for all trainable variables: {:.02f}MB".format(size_mb),
        'cyan')
    logger.info(colored("List of Trainable Variables: \n", 'cyan') + table + summary_msg)
1032388
def get_variables(self) -> Set[str]:
        
        variables = set()
        for cmd in self._cmd:
            for var in self.__formatter.parse(cmd):
                logger.debug("Checking variable: %s", var)
                # creates and requires are special class values
                if var[1] is not None and var[1] not in ["creates", "requires"]:
                    variables.add(var[1])
        return variables
217319
def iter_values(self):
        
        yVal = self._element.yVal
        if yVal is None:
            return

        for idx in range(yVal.ptCount_val):
            yield yVal.pt_v(idx)
400956
def get(self, varname, idx=0, units=None):
        ''''''
        if not varname in self.mapping.vars:
            raise fgFDMError('Unknown variable %s' % varname)
        if idx >= self.mapping.vars[varname].arraylength:
            raise fgFDMError('index of %s beyond end of array idx=%u arraylength=%u' % (
                varname, idx, self.mapping.vars[varname].arraylength))
        value = self.values[self.mapping.vars[varname].index + idx]
        if units:
            value = self.convert(value, self.mapping.vars[varname].units, units)
        return value
1314310
def _prepare_variables(self):
    
    self._moving_averager = tf.train.ExponentialMovingAverage(
        decay=self._beta, zero_debias=self._zero_debias)
    # assert self._grad is not None and len(self._grad) > 0
    # List for the returned Operations
    prepare_variables_op = []

    # Get per var g**2 and norm**2
    self._grad_squared = []
    self._grad_norm_squared = []

    # Gradient squared
    for v, g in zip(self._vars, self._grad):
      if g is None: continue
      with tf.colocate_with(v):
        self._grad_squared.append(tf.square(g))

    # Norm squared.
    self._grad_norm_squared = [tf.reduce_sum(g_sq)
                               for g_sq in self._grad_squared]

    if self._sparsity_debias:
      avg_op_sparsity = self._grad_sparsity()
      prepare_variables_op.append(avg_op_sparsity)

    # The following running average on squared norm of gradient
    # is shared by grad_var and dist_to_opt
    avg_op = self._moving_averager.apply(self._grad_norm_squared)

    with tf.control_dependencies([avg_op]):
      self._grad_norm_squared_avg = [self._moving_averager.average(val)
                                     for val in self._grad_norm_squared]
      self._grad_norm_squared = tf.add_n(self._grad_norm_squared)
      self._grad_norm_squared_avg = tf.add_n(self._grad_norm_squared_avg)

    prepare_variables_op.append(avg_op)
    return tf.group(*prepare_variables_op)