parameters: (arr, diff=None)
return_statement: return blob
docstring: Converts a 4-dimensional array to blob proto. If diff is given, also
    convert the diff. You need to make sure that arr and diff have the same
    shape, and this function does not do sanity check.
docstring_summary: Converts a 4-dimensional array to blob proto. If diff is given, also
    convert the diff. You need to make sure that arr and diff have the same
    shape, and this function does not do sanity check.
docstring_tokens: Converts a 4 - dimensional array to blob proto . If diff is given also convert the diff . You need to make sure that arr and diff have the same shape and this function does not do sanity check .
function: def array_to_blobproto(arr, diff=None):
    """Converts a 4-dimensional array to blob proto. If diff is given, also
    convert the diff. You need to make sure that arr and diff have the same
    shape, and this function does not do sanity check.
    """
    if arr.ndim != 4:
      raise ValueError('Incorrect array shape.')
    blob = caffe_pb2.BlobProto()
    blob.num, blob.channels, blob.height, blob.width = arr.shape;
    blob.data.extend(arr.astype(float).flat)
    if diff is not None:
      blob.diff.extend(diff.astype(float).flat)
    return blob
function_tokens: def array_to_blobproto ( arr , diff = None ) : if arr . ndim != 4 : raise ValueError ( 'Incorrect array shape.' ) blob = caffe_pb2 . BlobProto ( ) blob . num , blob . channels , blob . height , blob . width = arr . shape blob . data . extend ( arr . astype ( float ) . flat ) if diff is not None : blob . diff . extend ( diff . astype ( float ) . flat ) return blob