Adding new problems to problem.zoo (#484)
* adding problems * add tests * update doc + formatting --------- Co-authored-by: Dario Coscia <dariocos99@gmail.com>
This commit is contained in:
committed by
Nicola Demo
parent
2ae4a94e49
commit
f67467e5bd
@@ -28,12 +28,16 @@ class DummyTimeProblem(TimeDependentProblem):
|
||||
conditions = {}
|
||||
|
||||
|
||||
# define problems and model
|
||||
# define problems
|
||||
problem = Poisson()
|
||||
problem.discretise_domain(50)
|
||||
inverse_problem = InversePoisson()
|
||||
inverse_problem.discretise_domain(50)
|
||||
model = FeedForward(len(problem.input_variables), len(problem.output_variables))
|
||||
|
||||
# reduce the number of data points to speed up testing
|
||||
data_condition = inverse_problem.conditions["data"]
|
||||
data_condition.input = data_condition.input[:10]
|
||||
data_condition.target = data_condition.target[:10]
|
||||
|
||||
# add input-output condition to test supervised learning
|
||||
input_pts = torch.rand(50, len(problem.input_variables))
|
||||
@@ -42,6 +46,9 @@ output_pts = torch.rand(50, len(problem.output_variables))
|
||||
output_pts = LabelTensor(output_pts, problem.output_variables)
|
||||
problem.conditions["data"] = Condition(input=input_pts, target=output_pts)
|
||||
|
||||
# define model
|
||||
model = FeedForward(len(problem.input_variables), len(problem.output_variables))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("problem", [problem, inverse_problem])
|
||||
def test_constructor(problem):
|
||||
|
||||
Reference in New Issue
Block a user