Documentation for v0.1 version (#199)
* Adding Equations, solving typos * improve _code.rst * the team rst and restuctore index.rst * fixing errors --------- Co-authored-by: Dario Coscia <dariocoscia@dhcp-015.eduroam.sissa.it>
This commit is contained in:
committed by
Nicola Demo
parent
3f9305d475
commit
8b7b61b3bd
@@ -2,21 +2,25 @@ import torch
|
||||
import pytest
|
||||
from pina.model import ResidualFeedForward
|
||||
|
||||
|
||||
def test_constructor():
|
||||
# simple constructor
|
||||
ResidualFeedForward(input_dimensions=2, output_dimensions=1)
|
||||
|
||||
# wrong transformer nets (not 2)
|
||||
with pytest.raises(ValueError):
|
||||
ResidualFeedForward(input_dimensions=2, output_dimensions=1, transformer_nets=[torch.nn.Linear(2, 20)])
|
||||
ResidualFeedForward(input_dimensions=2,
|
||||
output_dimensions=1,
|
||||
transformer_nets=[torch.nn.Linear(2, 20)])
|
||||
|
||||
# wrong transformer nets (not nn.Module)
|
||||
with pytest.raises(ValueError):
|
||||
ResidualFeedForward(input_dimensions=2, output_dimensions=1, transformer_nets=[2, 2])
|
||||
ResidualFeedForward(input_dimensions=2,
|
||||
output_dimensions=1,
|
||||
transformer_nets=[2, 2])
|
||||
|
||||
|
||||
def test_forward():
|
||||
x = torch.rand(10, 2)
|
||||
model = ResidualFeedForward(input_dimensions=2, output_dimensions=1)
|
||||
model(x)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user