在 Tensorflow 中保存或加载图形时设置 clear_devices=true 的缺点



Tensorflow中有许多方法可以clear_devices设备。例如session_bundle.exporter.Exporter:initimport_meta_graphexport_meta_graph和python.training.saver.Saver.export_meta_graph'。文档指出:

 clear_devices: Whether or not to clear the device field for an `Operation`
    or `Tensor` during export.

但不要真正澄清剥离这些信息的含义。

从图形中剥离设备信息意味着,如果不添加新的设备放置指令,操作将按默认值放置。如果导出/导入的图形将在不同的设置中执行,或者馈送到它的数据将不同(例如,在 GPU 上训练后在 CPU 上以小批量大小提供服务(,这可能很有用。

最新更新