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

Function _make_blockwise_graph

dask/blockwise.py:914–996  ·  view source on GitHub ↗
(
    task,
    output,
    out_indices,
    *arrind_pairs,
    numblocks=None,
    concatenate=None,
    new_axes=None,
    output_blocks=None,
    dims=None,
    io_deps=None,
    keys=None,
)

Source from the content-addressed store, hash-verified

912
913
914def _make_blockwise_graph(
915 task,
916 output,
917 out_indices,
918 *arrind_pairs,
919 numblocks=None,
920 concatenate=None,
921 new_axes=None,
922 output_blocks=None,
923 dims=None,
924 io_deps=None,
925 keys=None,
926):
927 if numblocks is None:
928 raise ValueError("Missing required numblocks argument.")
929 new_axes = new_axes or {}
930 io_deps = io_deps or {}
931 argpairs = list(toolz.partition(2, arrind_pairs))
932
933 if concatenate is True:
934 from dask.array.core import concatenate_axes as concatenate
935
936 # Dictionary mapping {i: 3, j: 4, ...} for i, j, ... the dimensions
937 dims = dims or _make_dims(argpairs, numblocks, new_axes)
938
939 # Generate the abstract "plan" before constructing
940 # the actual graph
941 coord_maps, concat_axes, dummies = _get_coord_mapping(
942 dims,
943 out_indices,
944 numblocks,
945 argpairs,
946 concatenate,
947 )
948
949 # Apply Culling.
950 # Only need to construct the specified set of output blocks.
951 # Note that we must convert itertools.product to list,
952 # because we may need to loop through output_blocks more than
953 # once below (itertools.product already uses an internal list,
954 # so this is not a memory regression)
955 output_blocks = output_blocks or list(
956 itertools.product(*[range(dims[i]) for i in out_indices])
957 )
958 from dask._task_spec import DataNode
959
960 dsk = {}
961 for out_coords in output_blocks:
962 this_task = task
963 coords = out_coords + dummies
964 args = []
965 for cmap, axes, (arg, ind), key in zip(
966 coord_maps, concat_axes, argpairs, keys, strict=True
967 ):
968 if key not in task.dependencies:
969 # FIXME: This feels like a bug
970 continue
971 if ind is None:

Callers 6

test_topFunction · 0.90
test_top_literalsFunction · 0.90
test_chunked_dot_productFunction · 0.90
_dictMethod · 0.85

Calls 10

DataNodeClass · 0.90
parse_inputFunction · 0.90
TaskClass · 0.90
_make_dimsFunction · 0.85
_get_coord_mappingFunction · 0.85
_lol_productFunction · 0.85
productMethod · 0.80
substituteMethod · 0.45
getMethod · 0.45
fuseMethod · 0.45

Tested by 5

test_topFunction · 0.72
test_top_literalsFunction · 0.72
test_chunked_dot_productFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…