def divide_by_n_tensors_or_indexed_slices(value, n): if isinstance(value, ops.IndexedSlices): value = gradients_impl._HandleNestedIndexedSlices(value) # pylint: disable=protected-access return ops.IndexedSlices(value.values / n, value.indices, value.dense_shape) else: return value / n
def divide_by_n_tensors_or_indexed_slices(value, n): if isinstance(value, ops.IndexedSlices): value = gradients_impl._HandleNestedIndexedSlices(value) # pylint: disable=protected-access return ops.IndexedSlices( value.values / n, value.indices, value.dense_shape) else: return value / n