def test_dendritic_input(): torch.manual_seed(SEED) r_in = torch.Tensor(1, 5).normal_(std=0.1) + 5.0 model = AbstractConvexCell([3, 2], 1) u_in = model.f_inv(r_in) assert model.dendritic_input(u_in, 0)[0].tolist() == pytest.approx( r_in[0, :3].tolist()) assert model.dendritic_input(u_in, 1)[0].tolist() == pytest.approx( r_in[0, 3:3 + 2].tolist())
def test_input_scale(): torch.manual_seed(SEED) scale_0 = 0.15 scale_1 = 1.05 r_in = torch.Tensor(1, 5).normal_(std=0.1) + 5.0 model = AbstractConvexCell([3, 2], 1) model.set_input_scale(0, scale_0) model.set_input_scale(1, scale_1) u_in = model.f_inv(r_in) assert model.dendritic_input(u_in, 0)[0].tolist() == pytest.approx( (scale_0 * r_in[0, :3]).tolist()) assert model.dendritic_input(u_in, 1)[0].tolist() == pytest.approx( (scale_1 * r_in[0, 3:3 + 2]).tolist())