code: def build_tensor_serving_input_receiver_fn(shape, dtype=tf.float32,
                                             batch_size=1):
    
    def serving_input_receiver_fn():
      # Prep a placeholder where the input example will be fed in
      features = tf.placeholder(
          dtype=dtype, shape=[batch_size] + shape, name='input_tensor')
  
      return tf.estimator.export.TensorServingInputReceiver(
          features=features, receiver_tensors=features)
  
    return serving_input_receiver_fn
docs: Returns a input_receiver_fn that can be used during serving.
  
    This expects examples to come through as float tensors, and simply
    wraps them as TensorServingInputReceivers.
  
    Arguably, this should live in tf.estimator.export. Testing here first.
  
    Args:
      shape: list representing target size of a single example.
      dtype: the expected datatype for the input example
      batch_size: number of input tensors that will be passed for prediction
  
    Returns:
      A function that itself returns a TensorServingInputReceiver.