MCPcopy Create free account
hub / github.com/dangf15/THLNet / forward

Method forward

complexnn.py:46–61  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

44 self.projection_dim = None
45
46 def forward(self, inputs):
47 if isinstance(inputs,list):
48 real, imag = inputs
49 elif isinstance(inputs, torch.Tensor):
50 real, imag = torch.chunk(inputs,-1)
51 r2r_out = self.real_lstm(real)[0]
52 r2i_out = self.imag_lstm(real)[0]
53 i2r_out = self.real_lstm(imag)[0]
54 i2i_out = self.imag_lstm(imag)[0]
55 real_out = r2r_out - i2i_out
56 imag_out = i2r_out + r2i_out
57 if self.projection_dim is not None:
58 real_out = self.r_trans(real_out)
59 imag_out = self.i_trans(imag_out)
60 #print(real_out.shape,imag_out.shape)
61 return [real_out, imag_out]
62
63 def flatten_parameters(self):
64 self.imag_lstm.flatten_parameters()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected