发现saved_model.go导入路径出错

-1 go tensorflow

问题:

在github中:

import (
    "runtime"
    "unsafe"

    "github.com/golang/protobuf/proto"

    tfpb "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core"
)
Run Code Online (Sandbox Code Playgroud)

这是什么(tfpb“github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core”)?我在任何地方都找不到它,我的程序也找不到我该如何解决这个问题

有详细信息:今天我尝试为 Go 安装 tensorflow 并执行它,我使用这个 cmd:

go get github.com/tensorflow/tensorflow/tensorflow/go

然后我测试 tf 去:

go test github.com/tensorflow/tensorflow/tensorflow/go

(根据本网站:tensorflow

但我收到了这条消息:

在以下任何一个中找不到包“github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core”:/home/go/src/github.com /tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core(来自$GOROOT)

/home/go_work/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core(来自$GOPATH)

然后我访问github然后我找不到这个路径,我该如何解决这个问题?谢谢你们。!

p9s*_*9sh 6

你可以在 Github 上查看类似的问题:23257

因此,没有记录在案的适当修复程序,在那之前您可以尝试一下。我使用以下方式解决了我的错误:

  1. go get github.com/tensorflow/tensorflow/tensorflow/go
package github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core" in any of:
    /usr/local/Cellar/go/1.13.5/libexec/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOROOT)
    /Users/subhamsarkar/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOPATH)
Run Code Online (Sandbox Code Playgroud)
  1. 以上 get 肯定找不到所说的包,但 repo 已经克隆到你的 GOPATH
  2. cd $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go
  3. git checkout r1.11

现在再次运行,

  1. go get github.com/tensorflow/tensorflow/tensorflow/go

原因:讨论

另外,我相信您已经安装TensorFlow C libraryTensorFlow Go package.

注意:我测试过

操作系统:MacOSX 10.15.2
Go 版本:go1.13.5 darwin/amd64