Skip to content

Commit

Permalink
fix: fix item issue for mobile cases
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 9, 2023
1 parent 72e60e0 commit 401f55c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ class STSemantic(

val floatArray = outputTensor.floatBuffer.array()
// floatArray is an inputIds.size * 384 array, we need to mean it to 384 * 1
val meanArray = FloatArray(384)
for (i in 0 until 384) {
// 1, shape, shape.length
val shapeSize = outputTensor.info.shape[2].toInt()
val meanArray = FloatArray(shapeSzie)
for (i in 0 until shapeSzie) {
var sum = 0f
for (j in inputIds.indices) {
sum += floatArray[j * 384 + i]
sum += floatArray[j * shapeSzie + i]
}

meanArray[i] = sum / inputIds.size
Expand Down

0 comments on commit 401f55c

Please sign in to comment.