TensorFlow函数:tf.variable_axis_size_partitioner

2018-04-16 10:08 更新

tf.variable_axis_size_partitioner函数

tf.variable_axis_size_partitioner(
    max_shard_bytes,
    axis=0,
    bytes_per_string_element=16,
    max_shards=None
)

定义在:tensorflow/python/ops/partitioned_variables.py.

请参阅指南:变量>切分变量分区

获取 VariableScope 的分区以将分片保留在 max_shard_bytes.

此分区程序将沿着一个轴对 Variable 进行分片,尝试将最大分片大小保持在 max_shard_bytes.实际上,当仅沿着一个轴进行分片时,这并非总是可行的.发生这种情况时,该轴尽可能切分更多(即,每个维度都成为一个单独的分片).

如果分区程序达到 max_shards 限制,则每个分片最终可能大于 max_shard_bytes.默认情况下,max_shards 等于 None,并且不限制碎片的数量.

一个 max_shard_bytes 合理的值是 (64 << 20) - 1,或大约 64MB,保持低于 protobuf 字节限制.

函数参数:

  • max_shard_bytes:允许任何给定分片的最大大小.
  • axis:沿着该轴进行分区,默认为最外面的轴.
  • bytes_per_string_element:如果 Variable 是字符串类型,这提供了一个估计 Variable 中每个标量的大小.
  • max_shards:创建优先于 max_shard_bytes 的 int 中的最大分片数量.

函数返回值:

分区函数可用作 variable_scope、get_variable 和 get_partitioned_variable_list 的 partitioner 参数.

可能引发的异常:

  • ValueError:如果有任何字节数是非正数.
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy