tf.contrib.kfac.loss_functions.insert_slice_in_zeros

tf.contrib.kfac.loss_functions.insert_slice_in_zeros(
    slice_to_insert,
    dim,
    dim_size,
    position
)

Defined in tensorflow/contrib/kfac/python/ops/loss_functions.py.

Inserts slice into a larger tensor of zeros.

Forms a new tensor which is the same shape as slice_to_insert, except that the dimension given by 'dim' is expanded to the size given by 'dim_size'. 'position' determines the position (index) at which to insert the slice within that dimension.

Assumes slice_to_insert.shape[dim] = 1.

Args:

  • slice_to_insert: The slice to insert.
  • dim: The dimension which to expand with zeros.
  • dim_size: The new size of the 'dim' dimension.
  • position: The position of 'slice_to_insert' in the new tensor.

Returns:

The new tensor.

Raises:

  • ValueError: If the slice's shape at the given dim is not 1.