Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数组转换 #35

Open
jaxsongqd opened this issue Dec 20, 2017 · 0 comments
Open

数组转换 #35

jaxsongqd opened this issue Dec 20, 2017 · 0 comments

Comments

@jaxsongqd
Copy link

我读入一张图片,datetype:float32, shape:[95,92,1], value 是一个[][][]float32的3维数组
现在,想要调 tensorflow 的grpc,
63 request := &pb.PredictRequest{
64 ModelSpec: &pb.ModelSpec{
65 Name: "mnist",
66 SignatureName: "predict_images",
67 Version: &google_protobuf.Int64Value{
68 Value: int64(1),
69 },
70 },
71 Inputs: map[string]*tf_core_framework.TensorProto{
72 "images": &tf_core_framework.TensorProto{
73 Dtype: tf_core_framework.DataType_DT_FLOAT,
74 TensorShape: &tf_core_framework.TensorShapeProto{
75 Dim: []*tf_core_framework.TensorShapeProto_Dim{
76 &tf_core_framework.TensorShapeProto_Dim{
77 Size: tensor.Shape()[0],
78 },
79 &tf_core_framework.TensorShapeProto_Dim{
80 Size: tensor.Shape()[1],
81 },
82
83 &tf_core_framework.TensorShapeProto_Dim{
84 Size: tensor.Shape()[2],
85 },
86 },
87 },
88 FloatVal: tensor.Value().([]float32),
89 },
90 },
91 }

FloatVal: tensor.Value().([]float32), 这个地方tensor.value()是[][][]float32类型的,怎么转换?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant