tensorflow_template_application icon indicating copy to clipboard operation
tensorflow_template_application copied to clipboard

数组转换

Open jaxsongqd opened this issue 7 years ago • 0 comments

我读入一张图片,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类型的,怎么转换?

jaxsongqd avatar Dec 20 '17 03:12 jaxsongqd