c++ - 如何使用属性在 Tensorflow Lite 中添加自定义运算符

标签 c++ tensorflow tensorflow-lite

我按照以下说明在 Tensorflow 中添加了自定义运算符: https://www.tensorflow.org/extend/adding_an_op

现在我想将相同的运算符添加到 Tensorflow Lite。 我关注了this instructions to add custom operator in TF Lite,但它没有说明如何添加带有属性的自定义运算符。 像这样:

REGISTER_OP("CustomOpName")
.Attr("T: {float}")
.Attr("scale_factor: int")
.Input("x: T")
.Output("out: T")

我尝试像内置运算符一样将 TfLiteNode* 节点转换为自定义参数结构,如 TfLiteLocalResponseNormParams,但问题是 TfLiteNode* 节点等于 NULL。

最佳答案

您可以像 mfcc kernel 那样做.您在自定义 tensorflow op 中定义的属性将显示为 flexbuffer方便查询。

关于c++ - 如何使用属性在 Tensorflow Lite 中添加自定义运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47818079/

相关文章:

python - tf.keras.backend.get_session() 和 keras.backend.get_session() 返回不同的 session 对象

tensorflow - 如何在 TensorFlow 中绘制调整大小的图像?

python - TFLite 的硬刷操作

适用于 TFLite 的 Android Camera X ImageAnalyzer 图像格式

c++ - 重载数组的输出运算符

c++ - 安装 GCC : fatal error: gnu/stubs-32. h: 没有那个文件或目录

c++ - 潜在狄利克雷分配 (LDA) 实现

javascript - tfjs-converter html javascript 导入类时遇到问题

android - Tensorflow Lite GPU 加速 - 它适用于所有操作系统版本还是仅适用于 8.1?

c++ - shell 扩展:IShellExtInit::Initialize 调用了 4 次