<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/checkpoint/sharding/sharding_policies.py#L37-L68) |

Policy that splits tensors into shards based on their device spec task.

Inherits From: [`ShardingCallback`](https://www.tensorflow.org/api_docs/python/tf/train/experimental/ShardingCallback)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.train.experimental.ShardByTaskPolicy`](https://www.tensorflow.org/api_docs/python/tf/train/experimental/ShardByTaskPolicy)

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `description` | Returns a text description of the sharding policy. |

<br />

## Methods

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/checkpoint/sharding/sharding_policies.py#L45-L68)

    __call__(
        shardable_tensors: Sequence[https://www.tensorflow.org/api_docs/python/tf/train/experimental/ShardableTensor]
    ) -> Sequence[sharding_util.Shard]

Callback to split tensors into shards based on their device spec task.

<br />

<br />

<br />

| Args ||
|---|---|
| `shardable_tensors` | A list of ShardableTensors. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| List of shard dicts containing tensors. \[ {checkpoint key: {slice_spec: tensor} } \] ||

<br />