MCPcopy Index your code
hub / github.com/dask/dask / load_store_chunk

Function load_store_chunk

dask/array/core.py:4762–4830  ·  view source on GitHub ↗

A function inserted in a Dask graph for storing a chunk. Parameters ---------- x: array-like An array (potentially a NumPy one) out: array-like Where to store results. index: slice-like Where to store result from ``x`` in ``out``. lock: Lock-like

(
    x: Any,
    out: Any,
    index: slice | None,
    region: slice | None,
    lock: Any,
    return_stored: bool,
    load_stored: bool,
)

Source from the content-addressed store, hash-verified

4760
4761
4762def load_store_chunk(
4763 x: Any,
4764 out: Any,
4765 index: slice | None,
4766 region: slice | None,
4767 lock: Any,
4768 return_stored: bool,
4769 load_stored: bool,
4770) -> Any:
4771 """
4772 A function inserted in a Dask graph for storing a chunk.
4773
4774 Parameters
4775 ----------
4776 x: array-like
4777 An array (potentially a NumPy one)
4778 out: array-like
4779 Where to store results.
4780 index: slice-like
4781 Where to store result from ``x`` in ``out``.
4782 lock: Lock-like or False
4783 Lock to use before writing to ``out``.
4784 return_stored: bool
4785 Whether to return ``out``.
4786 load_stored: bool
4787 Whether to return the array stored in ``out``.
4788 Ignored if ``return_stored`` is not ``True``.
4789
4790 Returns
4791 -------
4792
4793 If return_stored=True and load_stored=False
4794 out
4795 If return_stored=True and load_stored=True
4796 out[index]
4797 If return_stored=False and compute=False
4798 None
4799
4800 Examples
4801 --------
4802
4803 >>> a = np.ones((5, 6))
4804 >>> b = np.empty(a.shape)
4805 >>> load_store_chunk(a, b, (slice(None), slice(None)), None, False, False, False)
4806 """
4807 if region:
4808 # Equivalent to `out[region][index]`
4809 if index:
4810 index = fuse_slice(region, index)
4811 else:
4812 index = region
4813 if lock:
4814 lock.acquire()
4815 try:
4816 if x is not None and x.size != 0:
4817 if is_arraylike(x):
4818 out[index] = x
4819 else:

Callers 2

test_load_store_chunkFunction · 0.90
load_chunkFunction · 0.85

Calls 4

fuse_sliceFunction · 0.90
is_arraylikeFunction · 0.90
acquireMethod · 0.45
releaseMethod · 0.45

Tested by 1

test_load_store_chunkFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…