Returns the input tensor for the given `horizon`.
515926
def timesteps(self, horizon: int) -> tf.Tensor:
        ''''''
        start, limit, delta = horizon - 1, -1, -1
        timesteps_range = tf.range(start, limit, delta, dtype=tf.float32)
        timesteps_range = tf.expand_dims(timesteps_range, -1)
        batch_timesteps = tf.stack([timesteps_range] * self.batch_size)
        return batch_timesteps
1238132
def use_to_ned(tensor):
    '''
    
    '''
    return np.array(ROT_NED_USE.T * np.matrix(tensor) * ROT_NED_USE)
210279
def conv2d(x_input, w_matrix):
    """"""
    return tf.nn.conv2d(x_input, w_matrix, strides=[1, 1, 1, 1], padding='SAME')
1063894
def conv2d(self, x_in: Connection, w_in: Connection, receptive_field_size, filters_number, stride=1, padding=1,
               name=""):
        
        x_cols = self.tensor_3d_to_cols(x_in, receptive_field_size, stride=stride, padding=padding)
        mul = self.transpose(self.matrix_multiply(x_cols, w_in), 0, 2, 1)

        #output_width = self.sum(self.div(self.sum(self.sum(self.shape(x_in, 2), self.constant(-1 * receptive_field_size)),
        #                        self.constant(2 * padding)), self.constant(stride)), self.constant(1))
        # output_height = (h - f + 2 * p) / s + 1

        output = self.reshape(mul, (-1, filters_number, receptive_field_size, receptive_field_size))

        output.name = name
        return output
180932
public org.tensorflow.framework.OpDef.ArgDefOrBuilder getInputArgOrBuilder(
      int index) {
    return inputArg_.get(index);
  }
99798
def L1(layer="input", constant=0, batch=None):
  """"""
  if batch is None:
    return lambda T: tf.reduce_sum(tf.abs(T(layer) - constant))
  else:
    return lambda T: tf.reduce_sum(tf.abs(T(layer)[batch] - constant))
910319
def _build_prior(self, unconstrained_tensor, constrained_tensor):
        
        if not misc.is_tensor(unconstrained_tensor):
            raise GPflowError("Unconstrained input must be a tensor.")

        if not misc.is_tensor(constrained_tensor):
            raise GPflowError("Constrained input must be a tensor.")

        prior_name = 'prior'

        if self.prior is None:
            return tf.constant(0.0, settings.float_type, name=prior_name)

        log_jacobian = self.transform.log_jacobian_tensor(unconstrained_tensor)
        logp_var = self.prior.logp(constrained_tensor)
        return tf.squeeze(tf.add(logp_var, log_jacobian, name=prior_name))
1281677
def _tensors(cls, fluents: Sequence[FluentPair]) -> Iterable[tf.Tensor]:
        ''''''
        for _, fluent in fluents:
            tensor = cls._output_size(fluent.tensor)
            yield tensor
1099891
def _embedding_metric_mds(matrix, dimensions=3):
    
    mds = sklearn.manifold.MDS(n_components=dimensions,
                               dissimilarity='precomputed',
                               metric=True)
    mds.fit(matrix)
    return mds.embedding_
557716
def _decode_input_tensor_to_features_dict(feature_map, hparams):
  
  inputs = tf.convert_to_tensor(feature_map["inputs"])
  input_is_image = False

  x = inputs
  p_hparams = hparams.problem_hparams
  # Add a third empty dimension
  x = tf.expand_dims(x, axis=[2])
  x = tf.to_int32(x)
  input_space_id = tf.constant(p_hparams.input_space_id)
  target_space_id = tf.constant(p_hparams.target_space_id)

  features = {}
  features["input_space_id"] = input_space_id
  features["target_space_id"] = target_space_id
  features["decode_length"] = (
      IMAGE_DECODE_LENGTH if input_is_image else tf.shape(x)[1] + 50)
  features["inputs"] = x
  return features
160565
def _eta_from_phi(self):
        """"""
        self.eta = scipy.ndarray(N_NT - 1, dtype='float')
        etaprod = 1.0
        for w in range(N_NT - 1):
            self.eta[w] = 1.0 - self.phi[w] / etaprod
            etaprod *= self.eta[w]
        _checkParam('eta', self.eta, self.PARAMLIMITS, self.PARAMTYPES)
1013558
def _inner(self, x1, x2):
        """"""
        return self.tspace._inner(x1.tensor, x2.tensor)
426018
def inverse_prediction(self, s_g):
        
        return self.infer(self.conf.s_dims, self.conf.m_dims, s_g)
1282444
def state_size(self):
    """"""
    hidden_size = tf.TensorShape(
        self._input_shape[:-1] + (self._output_channels,))
    return (hidden_size, hidden_size)
1220601
def ned_to_use(tensor):
    '''
    
    '''
    return np.array(ROT_NED_USE * np.matrix(tensor) * ROT_NED_USE.T)
1302046
def L2(layer="input", constant=0, epsilon=1e-6, batch=None):
  """"""
  if batch is None:
    return lambda T: tf.sqrt(epsilon + tf.reduce_sum((T(layer) - constant) ** 2))
  else:
    return lambda T: tf.sqrt(epsilon + tf.reduce_sum((T(layer)[batch] - constant) ** 2))
839155
def getcoef(self):
        """"""

        global mp_Z_Y
        return np.swapaxes(mp_Z_Y, 0, self.xstep.cri.axisK+1)[0]