Other Functions and Classes

tf.scalar_mul(scalar, x)

Multiplies a scalar times a Tensor or IndexedSlices object.

Intended for use in gradient code which might deal with IndexedSlices objects, which are easy to multiply by a scalar but more expensive to multiply with arbitrary tensors.

Args:
  • scalar: A 0-D scalar Tensor. Must have known shape.
  • x: A Tensor or IndexedSlices to be scaled.
Returns:

scalar * x of the same type (Tensor or IndexedSlices) as x.

Raises:
  • ValueError: if scalar is not a 0-D scalar.

tf.sparse_segment_sqrt_n_grad(grad, indices, segment_ids, output_dim0, name=None)

Computes gradients for SparseSegmentSqrtN.

Returns tensor "output" with same shape as grad, except for dimension 0 whose value is output_dim0.

Args:
  • grad: A Tensor. Must be one of the following types: float32, float64. gradient propagated to the SparseSegmentSqrtN op.
  • indices: A Tensor of type int32. indices passed to the corresponding SparseSegmentSqrtN op.
  • segment_ids: A Tensor of type int32. segment_ids passed to the corresponding SparseSegmentSqrtN op.
  • output_dim0: A Tensor of type int32. dimension 0 of "data" passed to SparseSegmentSqrtN op.
  • name: A name for the operation (optional).
Returns:

A Tensor. Has the same type as grad.