I am having some issues while getting output in TensorFlow Model(tflite).
This is my input:
let inputInfo:[Float32] : [-1.0291401 , 1.6121695 , 0.58366895, -0.25974554, 2.6633718 ,
0.39398468, 1.2648116 , -1.0617405 , 1.0997621 , -0.01813432,
-0.02543107, 1.9113901 , 0.30188444, 0.3199759 , 0.07759953,
0.23082322, 2.0959156 , -0.42658705, 0.08775132, 3.4258583 ,
-1.0573974 , 0.7249298 , -1.1119401 , -0.72663903, -0.74873704,
-0.387724 , -0.14288527, -0.39554232, -0.10774904, -0.0911286 ,
0.40389383, -0.169619 , -1.1736624 ]
let inputData = Data(bytes: &inputInfo, count: inputInfo.count * MemoryLayout<Float32>.stride)
print(inputData)
try interpreter?.copy(inputData, toInputAt: 0)
After passing this array of Float32 type as input I am getting below result in output:
Output:
TensorFlowLite.Tensor(name: “Identity”, dataType: TensorFlowLite.Tensor.DataType.float32, shape: TensorFlowLite.Tensor.Shape(rank: 2, dimensions: [1, 1]), data: 4 bytes, quantizationParameters: nil)
For getting the expexcted output result I am using this code:
let outputTensor = try self.interpreter?.output(at: 0)
let finalOutput = [Float32](unsafeData: outputTensor!.data)
print(finalOutput)
4.6533377e+33
Here expected output should be some numbers between 0 & 1(like 0.8,0.9) but my final output is beyond that expected output. I am stuck here,please help.