<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#L74-L353) |

Policy that splits tensors into shards with a max shard size.

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.MaxShardSizePolicy`](https://www.tensorflow.org/api_docs/python/tf/train/experimental/MaxShardSizePolicy)

<br />

    tf.train.experimental.MaxShardSizePolicy(
        max_shard_size: int
    )

Shards may exceed the max shard size if they contain 1. a single scalar/string
tensor that could not be sliced and exceeds the max shard size or 2. the
checkpoint object graph, whose size cannot be calculated when saving.

<br />

<br />

<br />

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

<br />

## Child Classes

[`class MaxShardSizePartitioner`](https://www.tensorflow.org/api_docs/python/tf/train/experimental/MaxShardSizePolicy/MaxShardSizePartitioner)

## Methods

### `__call__`

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

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

Returns a list of shards for the given shardable tensors.