-
Notifications
You must be signed in to change notification settings - Fork 3
/
MultiIdentityOp.py
48 lines (36 loc) · 997 Bytes
/
MultiIdentityOp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Identity Operator with arbitrary number of inputs."""
import torch
from typing_extensions import Self
from mrpro.operators.EndomorphOperator import EndomorphOperator, endomorph
class MultiIdentityOp(EndomorphOperator):
r"""The Identity Operator.
An endomorph Operator that returns multiple inputs unchanged.
"""
@endomorph
def forward(self, *x: torch.Tensor) -> tuple[torch.Tensor, ...]:
"""Identity of input.
Parameters
----------
x
input tensor
Returns
-------
the input tensor
"""
return x
@endomorph
def adjoint(self, *x: torch.Tensor) -> tuple[torch.Tensor, ...]:
"""Adjoint Identity.
Parameters
----------
x
input tensor
Returns
-------
the input tensor
"""
return x
@property
def H(self) -> Self: # noqa: N802
"""Adjoint Identity."""
return self