MCPcopy Create free account
hub / github.com/dask/dask / cached_max

Function cached_max

dask/utils.py:2104–2125  ·  view source on GitHub ↗

Compute max with caching. Caching is by the identity of `seq` rather than the value. It is thus important that `seq` is a tuple of immutable objects, and this function is intended for use where `seq` is a value that will persist (generally block sizes). Parameters ---------

(seq)

Source from the content-addressed store, hash-verified

2102
2103
2104def cached_max(seq):
2105 """Compute max with caching.
2106
2107 Caching is by the identity of `seq` rather than the value. It is thus
2108 important that `seq` is a tuple of immutable objects, and this function
2109 is intended for use where `seq` is a value that will persist (generally
2110 block sizes).
2111
2112 Parameters
2113 ----------
2114 seq : tuple
2115 Values to reduce
2116
2117 Returns
2118 -------
2119 tuple
2120 """
2121 assert isinstance(seq, tuple)
2122 # Look up by identity first, to avoid a linear-time __hash__
2123 # if we've seen this tuple object before.
2124 result = _max(_HashIdWrapper(seq))
2125 return result
2126
2127
2128def cached_cumsum(seq, initial_zero=False):

Callers 2

chunksizeMethod · 0.90
einsumFunction · 0.90

Calls 2

_maxFunction · 0.85
_HashIdWrapperClass · 0.85

Tested by

no test coverage detected