Layers and Models update PR
* add residual block * add test conv and residual block * modify FFN kwargs
This commit is contained in:
committed by
Nicola Demo
parent
8c16e27ae4
commit
15ecaacb7c
26
tests/test_layers/test_residual.py
Normal file
26
tests/test_layers/test_residual.py
Normal 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]
|
||||
Reference in New Issue
Block a user