in src/sagemaker_mxnet_serving_container/utils.py [0:0]
def read_data_shapes(path, preferred_batch_size=1):
"""Read the data name and data shape required by the MXNet module.
Args:
path (str): an MXNet NDArray that is the result of a prediction
preferred_batch_size (int): the accept content type expected by the client
Returns:
tuple: A list of names for data required by the module along with
a list of (name, shape) pairs specifying the data inputs to this module.
"""
with open(path, 'r') as f:
signatures = json.load(f)
data_names = []
data_shapes = []
for s in signatures:
name = s['name']
data_names.append(name)
shape = s['shape']
if preferred_batch_size:
shape[0] = preferred_batch_size
data_shapes.append((name, shape))
return data_names, data_shapes