# tensorflow::ops::Fill Class Reference

# tensorflow::
ops::
Fill

`
#include <array_ops.h>
`


Creates a tensor filled with a scalar value.

## Summary


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]]
```

<br />


`
tf.fill
`
differs from
`
tf.constant
`
in a few ways:


- `
  tf.fill
  ` only supports scalar contents, whereas `
  tf.constant
  ` supports [Tensor](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) values.
- `
  tf.fill
  ` creates an Op in the computation graph that constructs the actual [Tensor](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) value at runtime. This is in contrast to `
  tf.constant
  ` which embeds the entire [Tensor](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_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
  ` .

<br />


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- dims: 1-D. Represents the shape of the output tensor.
- value: 0-D (scalar). Value to fill the returned tensor.

<br />


(numpy) Equivalent to np.full


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : The output tensor.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fill#classtensorflow_1_1ops_1_1_fill_1a01c1c041aa66636af36c215a28cad8f8 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input dims, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input value) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fill#classtensorflow_1_1ops_1_1_fill_1ab58dad131aa0ced03a7b508cb5f17ee8 ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fill#classtensorflow_1_1ops_1_1_fill_1af59efc826ad951c4bb994ccf186b0e3c ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fill#classtensorflow_1_1ops_1_1_fill_1a470a2e887eb44734252766d0f4759b04 () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fill#classtensorflow_1_1ops_1_1_fill_1a7eb9e821e29fbfa81a25dd5ae382ce1f () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fill#classtensorflow_1_1ops_1_1_fill_1a952032189c0e55332094cc69e197ae06 () const ` | ` ` |

## Public attributes

### operation

```
Operation operation
```

### output

```
::tensorflow::Output output
```

## Public functions

### Fill

```
 Fill(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input dims,
  ::tensorflow::Input value
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```