def FetchBlob(name): """Fetches a blob from the workspace. Inputs: name: the name of the blob - a string or a BlobReference Returns: Fetched blob (numpy array or string) if successful """ return C.fetch_blob(StringifyBlobName(name))
def FetchBlob(name): """Fetches a blob from the workspace. Inputs: name: the name of the blob - a string or a BlobReference Returns: Fetched blob (numpy array or string) if successful """ result = C.fetch_blob(StringifyBlobName(name)) if isinstance(result, tuple): raise TypeError("Use FetchInt8Blob to fetch Int8 Blob {}".format( StringifyBlobName(name))) return result
def FetchInt8BlobRealVal(name): """Fetches an Int8 blob from the workspace and return its real value representation. Inputs: name: the name of the Int8 blob - a string or a BlobReference Returns: real value representation of int8 numpy array """ result = C.fetch_blob(StringifyBlobName(name)) assert isinstance(result, tuple), \ 'You are not fetching an Int8Blob {}. Please use FetchBlob'.format( StringifyBlobName(name)) int8_blob = Int8Tensor(*result) return (int8_blob.data.astype(np.int32) - int(int8_blob.zero_point)).astype( np.float32) * int8_blob.scale
def FetchInt8Blob(name): """Fetches an Int8 blob from the workspace. It shared backend implementation with FetchBlob but it is recommened when fetching Int8 Blobs Inputs: name: the name of the Int8 blob - a string or a BlobReference Returns: data: int8 numpy array, data scale: float, fake quantization scale zero_point: int, fake quantization offset """ result = C.fetch_blob(StringifyBlobName(name)) assert isinstance(result, tuple), \ 'You are not fetching an Int8Blob {}. Please use FetchBlob'.format( StringifyBlobName(name)) return Int8Tensor(*result)
def FetchBlob(name): """Fetches a blob from the workspace. Inputs: name: the name of the blob - a string or a BlobReference Returns: Fetched blob (numpy array or string) if successful """ result = C.fetch_blob(StringifyBlobName(name)) if isinstance(result, tuple): raise TypeError( "Use FetchInt8Blob to fetch Int8 Blob {}".format( StringifyBlobName(name) ) ) return result