tensorflow-serving

tensorflow serving enable batch, { "error": "The second input must be a scalar, but it has shape [1] }


i'm newer to tensorflow and tensorflow-serving, thank you

this is my url: http://localhost:8901/v1/models/zgj_test1/versions/1:predict

{
    "instances": [
        {
            "input": [12,2,3222,0.743950009,0.600002468,0.039736807,-0.160350278,-0.402428091,-0.177840948,0.062821679,1.011099219,-0.18287012,0.436762691,0.194460571,-0.076804399,0.08139427,0.325670183,-0.205593884,-0.411226541,-0.310780406,0.289301097,-0.010411382,0.063801706,-0.450665295,-0.488244206,0.359257728,-0.0240109,0.314161509,-0.710374773,0.115225419,0.372776002,-0.013011273,0.073687986,1.125230551,-0.500062227,0.359281898,0.481886864,-0.460099697,-0.027731827,-0.608729839,0.172593072,0.673309386,0.299848616,-0.207812548,0.307663828,-0.23908256,0.592604935,0.059589956,1.029458523,-0.311197042,-1.575143576,-0.570408762,-1.228805661,0.12882936,-0.039804082,-0.755486548,-0.743633449,-0.047640484,-1.378378153,-0.58983916,-0.406444877,0.152384788,-0.472544551,-0.850546062,-0.999881744,0.406674027,0.103902146,-0.282515287,0.016565725,0.177262247,-0.106254168,-0.087014116,-0.016591934,0.910826325,-0.534453928,-0.223030195,-0.350985676,0.13449119,0.359252393,-0.787550688,0.444518983,0.272129864,-0.132343963,-0.20161441,-0.896554828,0.078628302,0.056702003,-0.174576581,-0.612865448,0.392634392,-0.36945048,0.911786914,0.75207746,0.905525982,0.128028587,-0.465028346,0.064782642,-0.555553257,-0.675767303,0.290103167,-0.262463093,-0.527234137,-0.891856492,0.743950009,0.600002468,0.039736807,-0.160350278,-0.402428091,-0.177840948,0.062821679,1.011099219,-0.18287012,0.436762691,0.194460571,-0.076804399,0.08139427,0.325670183,-0.205593884,-0.411226541,-0.310780406,0.289301097,-0.010411382,0.063801706,-0.450665295,-0.488244206,0.359257728,-0.0240109,0.314161509,-0.710374773,0.115225419,0.372776002,-0.013011273,0.073687986,1.125230551,-0.500062227,0.359281898,0.481886864,-0.460099697,-0.027731827,-0.608729839,0.172593072,0.673309386,0.299848616,-0.207812548,0.307663828,-0.23908256,0.592604935,0.059589956,1.029458523,-0.311197042,-1.575143576,-0.570408762,-1.228805661,0.12882936,-0.039804082,-0.755486548,-0.743633449,-0.047640484,-1.378378153,-0.58983916,-0.406444877,0.152384788,-0.472544551,-0.850546062,-0.999881744,0.406674027,0.103902146,-0.282515287,0.016565725,0.177262247,-0.106254168,-0.087014116,-0.016591934,0.910826325,-0.534453928,-0.223030195,-0.350985676,0.13449119,0.359252393,-0.787550688,0.444518983,0.272129864,-0.132343963,-0.20161441,-0.896554828,0.078628302,0.056702003,-0.174576581,-0.612865448,0.392634392,-0.36945048,0.911786914,0.75207746,0.905525982,0.128028587,-0.465028346,0.064782642,-0.555553257,-0.675767303,0.290103167,-0.262463093,-0.527234137,-0.891856492,1,0,0,0,1,1,0],
            "training": false

        }
    ]
}

response: { "error": "The second input must be a scalar, but it has shape [1]\n\t [[{{node ranking/dense_block/dropout/cond/Switch}}]]" }

and i try another column format

{
    "inputs": {
        "input": [12,2,3222,0.743950009,0.600002468,0.039736807,-0.160350278,-0.402428091,-0.177840948,0.062821679,1.011099219,-0.18287012,0.436762691,0.194460571,-0.076804399,0.08139427,0.325670183,-0.205593884,-0.411226541,-0.310780406,0.289301097,-0.010411382,0.063801706,-0.450665295,-0.488244206,0.359257728,-0.0240109,0.314161509,-0.710374773,0.115225419,0.372776002,-0.013011273,0.073687986,1.125230551,-0.500062227,0.359281898,0.481886864,-0.460099697,-0.027731827,-0.608729839,0.172593072,0.673309386,0.299848616,-0.207812548,0.307663828,-0.23908256,0.592604935,0.059589956,1.029458523,-0.311197042,-1.575143576,-0.570408762,-1.228805661,0.12882936,-0.039804082,-0.755486548,-0.743633449,-0.047640484,-1.378378153,-0.58983916,-0.406444877,0.152384788,-0.472544551,-0.850546062,-0.999881744,0.406674027,0.103902146,-0.282515287,0.016565725,0.177262247,-0.106254168,-0.087014116,-0.016591934,0.910826325,-0.534453928,-0.223030195,-0.350985676,0.13449119,0.359252393,-0.787550688,0.444518983,0.272129864,-0.132343963,-0.20161441,-0.896554828,0.078628302,0.056702003,-0.174576581,-0.612865448,0.392634392,-0.36945048,0.911786914,0.75207746,0.905525982,0.128028587,-0.465028346,0.064782642,-0.555553257,-0.675767303,0.290103167,-0.262463093,-0.527234137,-0.891856492,0.743950009,0.600002468,0.039736807,-0.160350278,-0.402428091,-0.177840948,0.062821679,1.011099219,-0.18287012,0.436762691,0.194460571,-0.076804399,0.08139427,0.325670183,-0.205593884,-0.411226541,-0.310780406,0.289301097,-0.010411382,0.063801706,-0.450665295,-0.488244206,0.359257728,-0.0240109,0.314161509,-0.710374773,0.115225419,0.372776002,-0.013011273,0.073687986,1.125230551,-0.500062227,0.359281898,0.481886864,-0.460099697,-0.027731827,-0.608729839,0.172593072,0.673309386,0.299848616,-0.207812548,0.307663828,-0.23908256,0.592604935,0.059589956,1.029458523,-0.311197042,-1.575143576,-0.570408762,-1.228805661,0.12882936,-0.039804082,-0.755486548,-0.743633449,-0.047640484,-1.378378153,-0.58983916,-0.406444877,0.152384788,-0.472544551,-0.850546062,-0.999881744,0.406674027,0.103902146,-0.282515287,0.016565725,0.177262247,-0.106254168,-0.087014116,-0.016591934,0.910826325,-0.534453928,-0.223030195,-0.350985676,0.13449119,0.359252393,-0.787550688,0.444518983,0.272129864,-0.132343963,-0.20161441,-0.896554828,0.078628302,0.056702003,-0.174576581,-0.612865448,0.392634392,-0.36945048,0.911786914,0.75207746,0.905525982,0.128028587,-0.465028346,0.064782642,-0.555553257,-0.675767303,0.290103167,-0.262463093,-0.527234137,-0.891856492,1,0,0,0,1,1,0],
        "training": false
    }
}

response: { "error": "Batching session Run() input tensors must have at least one dimension" }

i don't known how to resolve this problem


Solution

  • Change your input like this, and have another try

    {
        "instances": [
            {
                "input": [12,2,3222, ... 1,0],
                "training": [false]
    
            }
        ]
    }