Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd56e9d6 authored by Cody Heiner's avatar Cody Heiner Committed by Automerger Merge Worker
Browse files

Merge "Add outputLength method" into udc-dev am: d379634a

parents cbba687a d379634a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ public:
    // Returns the length of the model's input buffers.
    size_t inputLength() const;

    // Returns the length of the model's output buffers.
    size_t outputLength() const;

    // Executes the model.
    // Returns true if the model successfully executed and the output tensors can be read.
    bool invoke();
+4 −0
Original line number Diff line number Diff line
@@ -346,6 +346,10 @@ size_t TfLiteMotionPredictorModel::inputLength() const {
    return getTensorBuffer<const float>(mInputR).size();
}

size_t TfLiteMotionPredictorModel::outputLength() const {
    return getTensorBuffer<const float>(mOutputR).size();
}

std::span<float> TfLiteMotionPredictorModel::inputR() {
    return getTensorBuffer<float>(mInputR);
}
+4 −2
Original line number Diff line number Diff line
@@ -139,8 +139,10 @@ TEST(TfLiteMotionPredictorTest, ModelInputOutputLength) {

    ASSERT_TRUE(model->invoke());

    ASSERT_EQ(model->outputR().size(), model->outputPhi().size());
    ASSERT_EQ(model->outputR().size(), model->outputPressure().size());
    const int outputLength = model->outputLength();
    ASSERT_EQ(outputLength, model->outputR().size());
    ASSERT_EQ(outputLength, model->outputPhi().size());
    ASSERT_EQ(outputLength, model->outputPressure().size());
}

TEST(TfLiteMotionPredictorTest, ModelOutput) {