tensorflow - 如何获得经过训练的 Keras 模型的图形表示?
问题描述
我想找到图形表示中使用的运算符来构建另一个遵循 ONNX 标准的模型。我使用以下代码以某种方式获取图形表示,但这样做会使 dropout 层充当图形中的标识运算符。
full_model=tf.function(lambda x:model(x))
full_model=full_model.get_concrete_function(tf.TensorSpec(model.inputs[0].shape,model.inputs[0].dtype))
for layer in [op.name for op in
full_model.graph.get_operations()]:
print(layer)
我们如何实现这一点,或者我们如何获得模型中使用了哪些所有 ONNX 图运算符?
解决方案
推荐阅读
- c# - AspnetBoilerplate IdentityServer - 配置存储
- javascript - Javascript。代码无需指定其 this 值即可工作
- flutter - 颤动中appbar的高程属性中的streambuilder
- mongodb - Mongo DB 中的自动化函数
- python-3.x - Discord.py 经济命令
- statistics - 使用预测变量组合的回归预测
- google-cloud-platform - 不想用服务帐号登录谷歌云
- python - 如何提取电子邮件地址字符串
- db2 - 连接到 DB2 HammerDB
- java - 不应该被保护只能由Java中的子类访问吗?