diff --git a/python/tvm/relay/frontend/tflite.py b/python/tvm/relay/frontend/tflite.py index b696bd6d056b..b41c947fc833 100644 --- a/python/tvm/relay/frontend/tflite.py +++ b/python/tvm/relay/frontend/tflite.py @@ -1959,9 +1959,8 @@ def convert_fully_connected(self, op): # Change the output shape calculation based on keep_dim option if keep_num_dims: input_shape = _infer_shape(self.get_tensor_expr(input_tensor)) - output_shape = list(input_shape) - output_shape[-1] = weight_tensor_shape[0] - out = _op.reshape(out, tuple(output_shape)) + output_shape = input_shape[:-1] + tuple([weight_tensor_shape[0]]) + out = _op.reshape(out, output_shape) return out