如何修改tensorflow python代码,以便当您将其导入到您自己的python文件中时,修改会被采纳?

发布于 2025-01-11 14:31:16 字数 681 浏览 3 评论 0原文

我正在尝试调试一个用例,而张量流给出的错误消息很神秘。因此,我想修改张量流代码库以打印一些值,以便我准确地看到出了什么问题。不幸的是,我无法简单地修改 python 文件并运行,因为更改没有被采纳。还有什么额外的步骤需要做吗?具体来说,

https://github.com/tensorflow/tensorflow/blob/98a2d7d166c6ba19539e6d1fa57c47c4170ee77b/tensorflow/python/keras/engine/data_adapter.py

我修改了第 1233 行

 "Your input ran out of data; interrupting training." with "Your input ran out of data; interrupting training. TESTING!!!!"

基本上我在这里添加了一些额外的日志只是为了看看它是如何工作的。然而,当我运行导入张量流的代码时,这些更改似乎没有被采纳。我已经在这里进行了修改

 /path_to_anaconda/anaconda3/envs/py39tf26cpu/lib/python3.9/site-packages/tensorflow/python/keras/engine

任何帮助将不胜感激:)

I am trying to debug a use-case and the error messages that are given by tensorflow are cryptic. Therefore I want to modify the tensorflow code base to print some values so I see exactly what is going wrong. Unfortunately I am not able to simply modify the python file and run, as the changes are not getting picked up. Is there any extra step to work on? To be concrete

https://github.com/tensorflow/tensorflow/blob/98a2d7d166c6ba19539e6d1fa57c47c4170ee77b/tensorflow/python/keras/engine/data_adapter.py

I have modified line 1233

 "Your input ran out of data; interrupting training." with "Your input ran out of data; interrupting training. TESTING!!!!"

Basically I added some extra log here just to see how this works. However, the changes do not seem to be getting picked up when I run my code which imports tensorflow. I have made the modifications here

 /path_to_anaconda/anaconda3/envs/py39tf26cpu/lib/python3.9/site-packages/tensorflow/python/keras/engine

Any help would be greatly appreciated :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文