何时使用 tensorflow 的内部 API(例如 tf.python.ops.*)? [英] When to use tensorflow's internal API (e.g. tf.python.ops.*)?

查看:28
本文介绍了何时使用 tensorflow 的内部 API(例如 tf.python.ops.*)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些情况下,有些人会通过内部 API(例如 tf.python.ops.* 中的运算符)而不是它们的公共 API 对应物(例如在 tf.*),如这个问题.

In certain circumstances, some would access tensorflow's python operators via the internal API (e.g. operators in tf.python.ops.*) rather than their public API counterpart (e.g. in tf.*), as in this question.

如果可以在公共 API 中访问函数,那么通过 tf.python.ops 访问函数有什么好处?

What is the benefit of accessing functions via tf.python.ops if they are made accessible in the public API?

推荐答案

我相信一般来说,最好只使用公共 API(如果有加载时间差异可能无关紧要).

I believe generally, it is better to just use the public API (loading time differences if any are probably irrelevant).

首先,它更具可读性.其次,内部导入可能会更频繁地更改(尤其是在从不向后兼容的 Tensorflow 中).

First, It is more readable. Second, internal imports might change more often (especially in Tensorflow which is never backward compatible).

也就是说,内部 API 本身正在使用内部 API,因此为其编写的任何内容都使用这些导入.

Saying that, the inner API itself is using the inner API, so anything that is written for it is using those imports.

我等着看其他人对这个问题的回答,也许有更深刻的原因.

I wait to see other responses to this question, perhaps with more insightful reasons.

这篇关于何时使用 tensorflow 的内部 API(例如 tf.python.ops.*)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆