Tensorflow byteBuffer

Viewed 100

I am working with TensorFlow and android studio to generate a model that when the user gives input from 1 to 4 then the model will return a number ranging from 60 to 150.

I am a little lost regarding this code that was generated when I inserted the model into my android studio project as I have an error on the byteByffer variable. Anyone that could explain to me what this does? I tried to find an answer to that but have not got anything... I suspect this is the input I need to give to the model however I need to convert it to a byteByffer somehow? Many thanks for the help!

try {
        BPMmodel model = BPMmodel.newInstance(this);

        // Creates inputs for reference.
        TensorBuffer inputFeature0 = TensorBuffer.createFixedSize(new int[]{1, 1}, DataType.FLOAT32);
        inputFeature0.loadBuffer(byteBuffer);

        // Runs model inference and gets result.
        BPMmodel.Outputs outputs = model.process(inputFeature0);
        TensorBuffer outputFeature0 = outputs.getOutputFeature0AsTensorBuffer();
        BPMfromModel = outputFeature0.getFloatValue();

        // Releases model resources if no longer used.
        model.close();
    } catch (IOException e) {
        // TODO Handle the exception
    }
0 Answers
Related