dongni9825 2019-01-07 11:19
浏览 516
已采纳

Golang Model sessionn上的Tensorflow运行错误:nil-Operation。 如果输出是使用Scope对象创建的,请参见Scope.Err()了解详细信息

iam use golang with tensorflow model. With this code : ```

    output, err := sessionModel.Run(
    map[tf.Output]*tf.Tensor{
        graphModel.Operation("input").Output(0): tensor,
    },
    []tf.Output{
        graphModel.Operation("output").Output(0),
    },
    nil)

```

But show error : 2019/01/07 18:07:48 http: panic serving [::1]:55262: nil-Operation. If the Output was created with a Scope object, see Scope.Err() for details.

I am already check tensor contain tensor from image file. Any recomendation ? Thanks anyway

  • 写回答

2条回答 默认 最新

  • doutan8775 2019-01-07 18:12
    关注

    The error says the Output attribute (of a certain the node) is a nil operation.

    Hence graphModel.Operation("input").Operation(0) or graphModel.Operation("output").Output(0) returns nil.

    To correct this, you have to refer to an existing node in the graph because there's no a tensor named input or a tensor named output in the graph.

    From the python code you used to export the model you can find the complete name of your input and output tensors. Just access the .name attribute of your input placeholder and of your output node, to get the correct name to use in Go.

    Also, the Go bindings are complex to use, especially if you want to run some preprocessing operations on the input image. I suggest you use galeone/tfgo instead of directly using the bindings (Note that I am the author of this repo).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题