#NEWLINE# def memoize( for_each_device = False ) : #NEWLINE# #INDENT# 'Makes a function memoizing the result for each argument and device.\n\n    This is a similar version of :func:`cupy.memoize`. The difference is that\n    this function can be used in the global scope even if CUDA is not\n    available. In such case, this function does nothing.\n\n    .. note::\n       This decorator acts as a dummy if CUDA is not available. It cannot be\n       used for general purpose memoization even if ``for_each_device`` is set\n       to False.\n\n    ' #NEWLINE# if available : #NEWLINE# #INDENT# return cupy . memoize ( for_each_device ) #NEWLINE# #UNINDENT# def dummy_decorator( f ) : #NEWLINE# #INDENT# @ functools . wraps ( f ) #NEWLINE# def ret( * args , **kwargs ) : #NEWLINE# #INDENT# return f ( * args , ** kwargs ) #NEWLINE# #UNINDENT# return ret #NEWLINE# #UNINDENT# return dummy_decorator