iOS Metal delegate: support no biases in fully_connected
PiperOrigin-RevId: 273573424
diff --git a/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.cc b/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.cc
index 01b5d0c..25c7440 100644
--- a/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.cc
+++ b/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.cc
@@ -162,12 +162,11 @@
auto filters = options.storage_precision == RuntimeOptions::Precision::FP32
? GetByteBuffer(filters_reordered)
: VectorFloatToHalf(filters_reordered);
- auto biases = options.storage_precision == RuntimeOptions::Precision::FP32
- ? GetByteBuffer(attr.bias.data)
- : VectorFloatToHalf(attr.bias.data);
desc->immutable_buffers = {
{"device FLT4* const matrix", filters},
- {"device FLT4* const biases", biases},
+ {"device FLT4* const biases",
+ GetByteBufferConvertedResized(attr.bias.data, options.storage_precision,
+ attr.weights.shape.o)},
};
desc->uniform_buffers = {