merge_operation

Description

Base classes and helper functions for defining logical operations. Main base classes are:

  • Merge: Base class for operating on arrays/tensors and booleans, and for building computational trees of such operations

  • TorchOrNumpyOperation: Base Merge class for operating on numpy or pytorch tensors

  • MergeBuilder: A convenience builder class that allows to define custom constructors for a merge class; of interest for easily setting defaults

The logical merging operations derived from Merge allow for concatenation of operations. Using them, any operation involving intersection (AND), union (OR), and inversion (NOT) of masks can be modelled. Scalar values in this case are treated as all-same-valued masks when mixed with mask tensors. For further information have a look at the Merge documentation.

Classes

Merge

Base class for operations and operation trees on dictionary inputs.

MergeBuilder

Return a Merge operation of specified class with additional settings upon call.

TorchOperation

Generic merge operation on torch tensors.

TorchOrNumpyOperation

Generic merge operation allowing to define both a torch and a numpy operation.

Functions

stack_tensors(*inputs)

Broadcast and stack the inputs in dim 0 to enable pixel-wise operations.