示例#1
0
import config  # isort:skip

# ----- general setup -----
mpl.use("agg")
device = torch.device("cuda:0")

# ----- operators -----
OpA = config.meas_op(config.m, config.n, device=device, **config.meas_params)
OpTV = TVAnalysis(config.n, device=device)

# ----- build linear inverter  ------
reg_fac = 2e-2

inverter = torch.nn.Linear(OpA.m, OpA.n, bias=False)
inverter.weight.requires_grad = False
inverter.weight.data = get_tikhonov_matrix(OpA, OpTV, reg_fac)

# ----- network configuration -----
subnet_params = {
    "in_channels": 1,
    "out_channels": 1,
    "drop_factor": 0.0,
    "down_blocks": (5, 7, 9, 12, 15),
    "up_blocks": (15, 12, 9, 7, 5),
    "pool_factors": (2, 2, 2, 2, 2),
    "bottleneck_layers": 25,
    "growth_rate": 16,
    "out_chans_first_conv": 16,
}
subnet = Tiramisu
示例#2
0
def _get_inverter_tikh(reg_fac=2e-2):
    inverter_tikh = torch.nn.Linear(OpA.m, OpA.n, bias=False)
    inverter_tikh.weight.requires_grad = False
    inverter_tikh.weight.data = get_tikhonov_matrix(OpA, OpTV, reg_fac)
    return inverter_tikh