From 399c72fc0eb23177d2a98c900b6352f9acb44315 Mon Sep 17 00:00:00 2001 From: Francesco Andreuzzi Date: Mon, 5 Dec 2022 10:50:28 +0100 Subject: [PATCH] remove inner_size (#44) --- pina/model/deeponet.py | 4 +--- tests/test_deeponet.py | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pina/model/deeponet.py b/pina/model/deeponet.py index 980fd4a..ca78898 100644 --- a/pina/model/deeponet.py +++ b/pina/model/deeponet.py @@ -18,7 +18,7 @@ class DeepONet(torch.nn.Module): `_ """ - def __init__(self, branch_net, trunk_net, output_variables, inner_size=10): + def __init__(self, branch_net, trunk_net, output_variables): """ :param torch.nn.Module branch_net: the neural network to use as branch model. It has to take as input a :class:`LabelTensor`. The number @@ -29,8 +29,6 @@ class DeepONet(torch.nn.Module): :param list(str) output_variables: the list containing the labels corresponding to the components of the output computed by the model. - :param int inner_size: the output dimension of the branch and trunk - networks. Default is 10. :Example: >>> branch = FFN(input_variables=['a', 'c'], output_variables=20) diff --git a/tests/test_deeponet.py b/tests/test_deeponet.py index 517f045..86ac518 100644 --- a/tests/test_deeponet.py +++ b/tests/test_deeponet.py @@ -17,6 +17,12 @@ def test_constructor(): onet = DeepONet(trunk_net=trunk, branch_net=branch, output_variables=output_vars) +def test_constructor_fails_when_invalid_inner_layer_size(): + branch = FFN(input_variables=['a', 'c'], output_variables=20) + trunk = FFN(input_variables=['b'], output_variables=19) + with pytest.raises(ValueError): + DeepONet(trunk_net=trunk, branch_net=branch, output_variables=output_vars) + def test_forward(): branch = FFN(input_variables=['a', 'c'], output_variables=10) trunk = FFN(input_variables=['b'], output_variables=10)