Fill

public final class Fill

Creates a tensor filled with a scalar value.

This operation creates a tensor of shape `dims` and fills it with `value`.

For example:

# Output tensor has shape [2, 3].
 fill([2, 3], 9) ==> [[9, 9, 9]
                      [9, 9, 9]]
 
`tf.fill` differs from `tf.constant` in a few ways:
  • `tf.fill` only supports scalar contents, whereas `tf.constant` supports Tensor values.
  • `tf.fill` creates an Op in the computation graph that constructs the actual Tensor value at runtime. This is in contrast to `tf.constant` which embeds the entire Tensor into the graph with a `Const` node.
  • Because `tf.fill` evaluates at graph runtime, it supports dynamic shapes based on other runtime Tensors, unlike `tf.constant`.

Public Methods

Output <U>
asOutput ()
Returns the symbolic handle of a tensor.
static <U, T extends Number> Fill <U>
create ( Scope scope, Operand <T> dims, Operand <U> value)
Factory method to create a class wrapping a new Fill operation.
Output <U>

Inherited Methods

Public Methods

public Output <U> asOutput ()

Returns the symbolic handle of a tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static Fill <U> create ( Scope scope, Operand <T> dims, Operand <U> value)

Factory method to create a class wrapping a new Fill operation.

Parameters
scope current scope
dims 1-D. Represents the shape of the output tensor.
value 0-D (scalar). Value to fill the returned tensor.

Returns
  • a new instance of Fill

public Output <U> output ()