简体   繁体   English

如何在 tensorflow 中创建 _Arg、_Retval、_If 操作?

[英]How to create an _Arg, _Retval, _If operation in tensorflow?

I'm trying to test all the operations available in tensorflow.我正在尝试测试 tensorflow 中可用的所有操作。 For example, we can find 'Conv2d' in tf.nn module.例如,我们可以在 tf.nn 模块中找到“Conv2d”。 There are some operations started with an '_', eg, '_Arg', '_ArrayToList', '_Retval'.有一些以“_”开头的操作,例如,“_Arg”、“_ArrayToList”、“_Retval”。 I looked into the tensorflow source code, but still can't find how to create an operation '_Arg'.我查看了 tensorflow 源代码,但仍然找不到如何创建操作“_Arg”。 Please give me some instructions of how to find these operations, or what does these operations do?请给我一些关于如何找到这些操作的说明,或者这些操作有什么作用?

Those operations are for an internal purpose, they are implemented in c++ so you'll need to download the source code, code (in c++) your own tests, compile and run them, since most of those operations do not have a Python wrapper.这些操作是出于内部目的,它们在 c++ 中实现,因此您需要下载源代码、代码(在 c++ 中)您自己的测试、编译和运行它们,因为大多数这些操作没有 Python 包装器。

Here you can find the c++ api .在这里您可以找到c++ api

This tutorial may help you if you are starting with tf operation.如果您从 tf 操作开始,本教程可能会对您有所帮助。 It does not do what you want, as it works with custom public operations.它不会做你想做的事,因为它适用于自定义公共操作。

You may have a look to the tests already implemented in tf code, fore example this test file.你可以看看已经在 tf 代码中实现的测试,例如这个测试文件。

However, I will strongly recommend that you reconsider if you really need to test those functions.但是,我强烈建议您重新考虑是否真的需要测试这些功能。 Testing every single function from TensorFlow, even the internal ones, is going to be a hard job.测试来自 TensorFlow 的每一个 function,甚至是内部的,都将是一项艰巨的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM