def encode_base64_dict(array):
 return {'__ndarray__': base64.b64encode(array.data).decode('utf-8'), 'shape': array.shape, 'dtype': array.dtype.name}

def encode_base64_dict ( array ) : return { '__ndarray__' : base64 . b64encode ( array . data ) . decode ( 'utf-8' ) , 'shape' : array . shape , 'dtype' : array . dtype . name }
encode a numpy array using base64: the encoded format is a dict with the following structure: .