MCPcopy
hub / github.com/dask/dask / Blockwise

Class Blockwise

dask/blockwise.py:465–820  ·  view source on GitHub ↗

Tensor Operation This is a lazily constructed mapping for tensor operation graphs. This defines a dictionary using an operation and an indexing pattern. It is built for many operations like elementwise, transpose, tensordot, and so on. We choose to keep these as symbolic mappings r

Source from the content-addressed store, hash-verified

463
464
465class Blockwise(Layer):
466 """Tensor Operation
467
468 This is a lazily constructed mapping for tensor operation graphs.
469 This defines a dictionary using an operation and an indexing pattern.
470 It is built for many operations like elementwise, transpose, tensordot, and
471 so on. We choose to keep these as symbolic mappings rather than raw
472 dictionaries because we are able to fuse them during optimization,
473 sometimes resulting in much lower overhead.
474
475 Parameters
476 ----------
477 output: str
478 The name of the output collection. Used in keynames
479 output_indices: tuple
480 The output indices, like ``('i', 'j', 'k')`` used to determine the
481 structure of the block computations
482 dsk: dict
483 A small graph to apply per-output-block. May include keys from the
484 input indices.
485 indices: tuple[tuple[str, tuple[str, ...] | None], ...]
486 An ordered mapping from input key name, like ``'x'``
487 to input indices, like ``('i', 'j')``
488 Or includes literals, which have ``None`` for an index value.
489 In place of input-key names, the first tuple element may also be a
490 ``BlockwiseDep`` object.
491 numblocks: Mapping[key, Sequence[int]]
492 Number of blocks along each dimension for each input
493 concatenate: bool
494 Whether or not to pass contracted dimensions as a list of inputs or a
495 single input to the block function
496 new_axes: Mapping
497 New index dimensions that may have been created and their size,
498 e.g. ``{'j': 2, 'k': 3}``
499 output_blocks: set[tuple[int, ...]]
500 Specify a specific set of required output blocks. Since the graph
501 will only contain the necessary tasks to generate these outputs,
502 this kwarg can be used to "cull" the abstract layer (without needing
503 to materialize the low-level graph).
504 annotations: dict (optional)
505 Layer annotations
506 io_deps: dict[str, BlockwiseDep] (optional)
507 Dictionary containing the mapping between "place-holder" collection
508 keys and ``BlockwiseDep``-based objects.
509 **WARNING**: This argument should only be used internally (for culling,
510 fusion and cloning of existing Blockwise layers). Explicit use of this
511 argument will be deprecated in the future.
512
513 See Also
514 --------
515 dask.blockwise.blockwise
516 dask.array.blockwise
517 """
518
519 output: str
520 output_indices: tuple[str, ...]
521 task: Task
522 indices: tuple[tuple[str | TaskRef, tuple[str, ...] | None], ...]

Callers 4

blockwiseFunction · 0.70
_cullMethod · 0.70
cloneMethod · 0.70
rewrite_blockwiseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…