Layers and Models update PR

* add residual block
* add test conv and residual block
* modify FFN kwargs
This commit is contained in:
Dario Coscia
2023-08-01 19:13:36 +02:00
committed by Nicola Demo
parent 8c16e27ae4
commit 15ecaacb7c
9 changed files with 191 additions and 33 deletions

View File

@@ -0,0 +1,26 @@
from pina.model.layers import ResidualBlock
import torch
def test_constructor():
res_block = ResidualBlock(input_dim=10,
output_dim=3,
hidden_dim=4)
res_block = ResidualBlock(input_dim=10,
output_dim=3,
hidden_dim=4,
spectral_norm=True)
def test_forward():
res_block = ResidualBlock(input_dim=10,
output_dim=3,
hidden_dim=4)
x = torch.rand(size=(80, 10))
y = res_block(x)
assert y.shape[1]==3
assert y.shape[0]==x.shape[0]