我使用以下步骤为Go安装了tensorflow,没有显示错误消息。
TF_TYPE="cpu" # Change to "gpu" for GPU support
TARGET_DIRECTORY='/usr/local'
curl -L \
"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.4.0.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
sudo ldconfig
go get github.com/tensorflow/tensorflow/tensorflow/go
但是go test github.com/tensorflow/tensorflow/tensorflow/go
的测试失败了,有错误信息。
2017-11-18 06:25:59.874418: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
2017-11-18 06:25:59.877032: F tensorflow/core/framework/tensor.cc:822] Unexpected type: 23
SIGABRT: abort
PC=0x7f6c4afd70bb m=7 sigcode=18446744073709551610
signal arrived during cgo execution
goroutine 24 [syscall, locked to thread]:
runtime.cgocall(0x656610, 0xc4200439c8, 0xc4200439f0)
/home/qcg/share/go/src/runtime/cgocall.go:132 +0xe4 fp=0xc420043998 sp=0xc420043958 pc=0x405434
github.com/tensorflow/tensorflow/tensorflow/go._Cfunc_TF_SetAttrTensor(0x7f6c24003c10, 0x7f6c2400e060, 0x7f6c2400e250, 0x7f6c2400e1f0)
github.com/tensorflow/tensorflow/tensorflow/go/_test/_obj_test/_cgo_gotypes.go:890 +0x45 fp=0xc4200439c8 sp=0xc420043998 pc=0x52cb25
github.com/tensorflow/tensorflow/tensorflow/go.setAttr.func18(0x7f6c24003c10, 0x7f6c2400e060, 0x7f6c2400e250, 0x7f6c2400e1f0)
/home/qcg/share/g/src/github.com/tensorflow/tensorflow/tensorflow/go/graph.go:273 +0xec fp=0xc420043a00 sp=0xc4200439c8 pc=0x538d0c
github.com/tensorflow/tensorflow/tensorflow/go.setAttr(0x7f6c24003c10, 0xc42000e0c0, 0x6ef103, 0x5, 0x6b60c0, 0xc4200e2440, 0x0, 0x0)
/home/qcg/share/g/src/github.com/tensorflow/tensorflow/tensorflow/go/graph.go:273 +0x11b9 fp=0xc420043c00 sp=0xc420043a00 pc=0x52f759
github.com/tensorflow/tensorflow/tensorflow/go.(*Graph).AddOperation(0xc42000e080, 0x6eef64, 0x5, 0xc42001a8d0, 0x6, 0x0, 0x0, 0x0, 0xc42007af00, 0x4b36cb, ...)
/home/qcg/share/g/src/github.com/tensorflow/tensorflow/tensorflow/go/graph.go:176 +0x4a0 fp=0xc420043d60 sp=0xc420043c00 pc=0x52e3a0
github.com/tensorflow/tensorflow/tensorflow/go.Const(0xc42000e080, 0xc42001a8d0, 0x6, 0x6827a0, 0xc4200e22c0, 0xc42001a8d0, 0x6, 0x4d463d, 0x7aaad0)
/home/qcg/share/g/src/github.com/tensorflow/tensorflow/tensorflow/go/util_test.go:38 +0x221 fp=0xc420043e38 sp=0xc420043d60 pc=0x529d41
github.com/tensorflow/tensorflow/tensorflow/go.TestOutputDataTypeAndShape.func1(0xc4200fa780)
/home/qcg/share/g/src/github.com/tensorflow/tensorflow/tensorflow/go/operation_test.go:137 +0x11e fp=0xc420043fa8 sp=0xc420043e38 pc=0x53619e
testing.tRunner(0xc4200fa780, 0xc4200e2400)
/home/qcg/share/go/src/testing/testing.go:746 +0xd0 fp=0xc420043fd0 sp=0xc420043fa8 pc=0x4d46e0
runtime.goexit()
/home/qcg/share/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420043fd8 sp=0xc420043fd0 pc=0x45f831
created by testing.(*T).Run
/home/qcg/share/go/src/testing/testing.go:789 +0x2de
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200fa000, 0x6f51c9, 0x1a, 0x702600, 0x47b201)
/home/qcg/share/go/src/testing/testing.go:790 +0x2fc
testing.runTests.func1(0xc4200fa000)
/home/qcg/share/go/src/testing/testing.go:1004 +0x64
testing.tRunner(0xc4200fa000, 0xc420053de0)
/home/qcg/share/go/src/testing/testing.go:746 +0xd0
testing.runTests(0xc4200e2220, 0xa413c0, 0x11, 0x11, 0xc420053e78)
/home/qcg/share/go/src/testing/testing.go:1002 +0x2d8
testing.(*M).Run(0xc420053f18, 0xc420053f70)
/home/qcg/share/go/src/testing/testing.go:921 +0x111
main.main()
github.com/tensorflow/tensorflow/tensorflow/go/_test/_testmain.go:82 +0xdb
goroutine 20 [chan receive]:
testing.(*T).Run(0xc4200fa3c0, 0xc420014860, 0x13, 0xc4200e2400, 0x2)
/home/qcg/share/go/src/testing/testing.go:790 +0x2fc
github.com/tensorflow/tensorflow/tensorflow/go.TestOutputDataTypeAndShape(0xc4200fa3c0)
/home/qcg/share/g/src/github.com/tensorflow/tensorflow/tensorflow/go/operation_test.go:136 +0x56e
testing.tRunner(0xc4200fa3c0, 0x702600)
/home/qcg/share/go/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
/home/qcg/share/go/src/testing/testing.go:789 +0x2de
rax 0x0
rbx 0x7f6c37ffeaa0
rcx 0x7f6c4afd70bb
rdx 0x0
rdi 0x2
rsi 0x7f6c37ffe840
rbp 0x7f6c37ffea90
rsp 0x7f6c37ffe840
r8 0x0
r9 0x7f6c37ffe840
r10 0x8
r11 0x246
r12 0x7f6c37ffecc0
r13 0x17
r14 0x5
r15 0x7f6c37ffecc0
rip 0x7f6c4afd70bb
rflags 0x246
cs 0x33
fs 0x0
gs 0x0
FAIL github.com/tensorflow/tensorflow/tensorflow/go 0.052s
有什么想法吗?谢谢。需要更多细节吗?需要更多细节吗?需要更多细节吗?需要更多细节吗?需要更多细节吗?
环境:
OS: Ubuntu 17.10 64bit
go version go1.9 linux/amd64
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)