Views
No views yet
1import torch
2
3checkpoint = torch.load('dyadic_v_archi.pth')
4v = checkpoint['v']
5
6# Reconstruct strands
7class StrandYang(torch.nn.Module):
8 def __init__(self):
9 super().__init__()
10 self.fc = torch.nn.Linear(1, 1)
11 def forward(self, x):
12 return torch.sin(x) + torch.randn_like(x) * 0.2
13
14class StrandYin(torch.nn.Module):
15 def __init__(self):
16 super().__init__()
17 self.fc = torch.nn.Linear(1, 1)
18 def forward(self, x, v):
19 return -v * torch.cos(x)
20
21strand_yang = StrandYang()
22strand_yang.load_state_dict(checkpoint['yang_state'])
23strand_yin = StrandYin()
24strand_yin.load_state_dict(checkpoint['yin_state'])
25
26# Example: Compute flow on friction timeline
27t = torch.linspace(0, 10, 1000).unsqueeze(1)
28output_yang = strand_yang(t)
29output_yin = strand_yin(t, v)
30flow = output_yang * output_yin + (1 - v) * (output_yang + output_yin)
31
32print("Flow variance:", torch.var(flow).item()) # Should be ≠1