Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

How can I feed batch of data to the model when predicting? #490

@zhimakaimenxa

Description

@zhimakaimenxa

My code looks like follows,,

            var runner = session.GetRunner();
            //var tensor = Utils.ImageToTensorGrayScale(file);
            var tensor = dataTransfer.OutputTensor(symbol, beginIndex, endIndex);
            runner.AddInput(graph["input_1"][0], tensor);
            runner.Fetch(graph["dense_2/Softmax"][0]);

            var output = runner.Run();
            var vecResults = output[0].GetValue();

The batch size dimension of the tensor can only be 1, when I give tensor with multi samples, the result are same. How can I predict a batch of samples in a time without using loop?

Best Regards

zhimakaimenxa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions