golang tensorflow client类型问题

f, err := ioutil.ReadFile("2.npy")
    if err != nil {
        fmt.Println(err)
        return
    }

    tensor, err := tf.NewTensor(f)
    if err != nil {
        fmt.Println("Cannot read image file")
        return
    }

    tensorByte, ok := tensor.Value().([]byte)
    if !ok {
        fmt.Println("Cannot type assert tensor value to ")
        return
    }

    request := &pb.PredictRequest{
        ModelSpec: &pb.ModelSpec{
            Name:          "wav",
            SignatureName: "voice_check",
            Version: &google_protobuf.Int64Value{
                Value: int64(1),
            },
        },
        Inputs: map[string]*tf_core_framework.TensorProto{
            "voice": &tf_core_framework.TensorProto{
                Dtype: tf_core_framework.DataType_DT_FLOAT,
                TensorShape: &tf_core_framework.TensorShapeProto{
                    Dim: []*tf_core_framework.TensorShapeProto_Dim{
                        &tf_core_framework.TensorShapeProto_Dim{
                            Size: 1,
                        },
                        &tf_core_framework.TensorShapeProto_Dim{
                            Size: 1,
                        },
                        &tf_core_framework.TensorShapeProto_Dim{
                            Size: 96,
                        },
                        &tf_core_framework.TensorShapeProto_Dim{
                            Size: 89,
                        },
                    },
                },
                //TensorContent: f,
                StringVal: [][]byte{tensorByte},
            },
        },
    }

我使用python起了一个tensorflow的grpc服务端,想使用golang调用,但是需要传的类型是[][][][]float32,查了很多资料,没有找到相关,有大佬帮我解答一下吗。。。

已邀请:

legendlzy

赞同来自:

自己顶一下,有大牛知道吗、、、

要回复问题请先登录注册