Beispiel #1
0
def join(axis, *tensors_list):
    """Convenience function to concatenate along the given axis.

    Parameters
    ----------
    axis : int
        The axis to concatenate.
    tensor_list : list of Tensor
        The inputs to concatenate.

    Returns
    -------
    Tensor
        The output tensor.

    """
    return ops.Concat(list(tensors_list), axis=axis)
Beispiel #2
0
def concat(values, axis, name=None):
    """
    Concatenates tensors along one dimension.

      Concatenates the list of tensors `values` along dimension `axis`.  If
      `values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated
      result has shape

          [D0, D1, ... Raxis, ...Dn]

      where

          Raxis = sum(Daxis(i))

      That is, the data from the input tensors is joined along the `axis`
      dimension.

      The number of dimensions of the input tensors must match, and all dimensions
      except `axis` must be equal.

      For example:

      ```python
      t1 = [[1, 2, 3], [4, 5, 6]]
      t2 = [[7, 8, 9], [10, 11, 12]]
      tf.concat([t1, t2], 0) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
      tf.concat([t1, t2], 1) ==> [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]

      # tensor t3 with shape [2, 3]
      # tensor t4 with shape [2, 3]
      tf.shape(tf.concat([t3, t4], 0)) ==> [4, 3]
      tf.shape(tf.concat([t3, t4], 1)) ==> [2, 6]
      ```

      Args:
        values: A list of `Tensor` objects or a single `Tensor`.
        axis: 0-D `int32` `Tensor`.  Dimension along which to concatenate.
        name: A name for the operation (optional).

      Returns:
        A `Tensor` resulting from concatenation of the input tensors.

    """

    return ops.Concat(values, axis=axis, name=name)
Beispiel #3
0
def concatenate(tensor_list, axis=0):
    """Concatenate the inputs along the given axis.

    All dimensions except specific ``axis`` should be same.

    Parameters
    ----------
    tensor_list : list of Tensor
        The inputs to concatenate.
    axis : int
        The axis to concatenate.

    Returns
    -------
    Tensor
        The output tensor.

    """
    return ops.Concat(tensor_list, axis=axis)
Beispiel #4
0
def concat(values, axis, name=None):

    return ops.Concat(values, axis=axis, name=name)
Beispiel #5
0
 def LayerSetup(self, bottom):
     return _ops.Concat(bottom, **self.arguments)
Beispiel #6
0
 def Setup(self, bottom):
     super(ConcatLayer, self).Setup(bottom)
     return ops.Concat(bottom, **self._param)