Skip to content

Commit 008888f

Browse files
authored
fix readme examples (#599)
1 parent 2cb0ead commit 008888f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,21 @@ Do you want to learn more about it? Look at our [Tutorials](https://github.com/m
9090
### Solve Data Driven Problems
9191
Data driven modelling aims to learn a function that given some input data gives an output (e.g. regression, classification, ...). In PINA you can easily do this by:
9292
```python
93+
import torch
9394
from pina import Trainer
9495
from pina.model import FeedForward
9596
from pina.solver import SupervisedSolver
9697
from pina.problem.zoo import SupervisedProblem
9798

9899
input_tensor = torch.rand((10, 1))
99-
output_tensor = input_tensor.pow(3)
100+
target_tensor = input_tensor.pow(3)
100101

101102
# Step 1. Define problem
102103
problem = SupervisedProblem(input_tensor, target_tensor)
103104
# Step 2. Design model (you can use your favourite torch.nn.Module in here)
104105
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
105106
# Step 3. Define Solver
106-
solver = SupervisedSolver(problem, model)
107+
solver = SupervisedSolver(problem, model, use_lt=False)
107108
# Step 4. Train
108109
trainer = Trainer(solver, max_epochs=1000, accelerator='gpu')
109110
trainer.train()
@@ -149,6 +150,7 @@ class SimpleODE(SpatialProblem):
149150

150151
# Step 1. Define problem
151152
problem = SimpleODE()
153+
problem.discretise_domain(n=100, mode="grid", domains=["D", "x0"])
152154
# Step 2. Design model (you can use your favourite torch.nn.Module in here)
153155
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])
154156
# Step 3. Define Solver

0 commit comments

Comments
 (0)