mrpro.operators.MagnitudeOp
- class mrpro.operators.MagnitudeOp[source]
Bases:
EndomorphOperator
Magnitude of input tensors.
- __call__(*x: Tensor) tuple[Tensor, ...] [source]
Calculate the element-wise magnitude (absolute value) of input tensors.
- Parameters:
*x (
Tensor
) – One or more input tensors.- Returns:
A tuple of tensors, where each tensor contains the element-wise magnitude of the corresponding input tensor.
- forward(*x: Tensor) tuple[Tensor, ...] [source]
Apply forward of MagnitudeOp.
Note
Prefer calling the instance of the MagnitudeOp operator as
operator(x)
over directly calling this method. See this PyTorch discussion.
- __add__(other: Operator[Unpack[Tin], Tout]) Operator[Unpack[Tin], Tout] [source]
- __add__(other: Tensor | complex) Operator[Unpack[Tin], tuple[Unpack[Tin]]]
Operator addition.
Returns
lambda x: self(x) + other(x)
if other is a operator,lambda x: self(x) + other*x
if other is a tensor
- __matmul__(other: EndomorphOperator) EndomorphOperator [source]
- __matmul__(other: Operator[Unpack[Tin], Tout]) Operator[Unpack[Tin], Tout]
Operator composition.
- __mul__(other: Tensor | complex) Operator[Unpack[Tin], Tout] [source]
Operator multiplication with tensor.
Returns
lambda x: self(x*other)
- __radd__(other: Tensor | complex) Operator[Unpack[Tin], tuple[Unpack[Tin]]] [source]
Operator right addition.
Returns
lambda x: other*x + self(x)