I am running a prediction on a tensorflow-serving model, and I get back this PredictResponse object as output:
Result:
You generally want to recover a tensor, with a shape (not just a long list of floats). Here's how:
outputs_tensor_proto = result.outputs["outputs"]
shape = tf.TensorShape(outputs_tensor_proto.tensor_shape)
outputs = tf.constant(outputs_tensor_proto.float_val, shape=shape)
If you prefer to get a NumPy array, then just replace the last line:
outputs = np.array(outputs_tensor_proto.float_val).reshape(shape.as_list())
If you don't want to depend on the TensorFlow library at all, for some reason:
outputs_tensor_proto = result.outputs["outputs"]
shape = [dim.size for dim in outputs_tensor_proto.tensor_shape.dim]
outputs = np.array(outputs_tensor_proto.float_val).reshape(shape)