簡體   English   中英

Nvidia Triton tensorflow 字符串參數

[英]Nvidia Triton tensorflow string parameter

我有一個 tensorflow model 輸入字符串參數。 Triton Java api 中的字符串使用什么類型?

例如。 Model定義

    {
        "name":"test_model", "platform":"tensorflow_savedmodel", "backend":"tensorflow",
            "version_policy":{
        "latest":{
            "num_versions":1
        }
    },
        "max_batch_size":8,
            "input":[{
        "name":"input_text", "data_type":"TYPE_STRING", "format":"FORMAT_NONE", "dims":[1],"reshape":{
            "shape":[]},"is_shape_tensor":false, "allow_ragged_batch":false
    }]

客戶端代碼

String text = "the text";

    InferTensorContents.Builder input0_data = InferTensorContents.newBuilder();
    input0_data ... how to set

Triton 使用 google protobufs,所以這是他們使用 ByteString 的方式

    String text = "textstring";
    InferTensorContents.Builder input0input_text = InferTensorContents.newBuilder();
    final ByteString input = ByteString.copyFrom(text, Charset.forName("UTF8"));
    System.out.println(input.size());
    input0input_text.addByteContents(input);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM