Updates to tutorial and run post codacy changes
This commit is contained in:
committed by
Nicola Demo
parent
9e55746546
commit
b38b0894b1
8
tutorials/tutorial4/tutorial.py
vendored
8
tutorials/tutorial4/tutorial.py
vendored
@@ -24,6 +24,7 @@ if IN_COLAB:
|
||||
import torch
|
||||
import matplotlib.pyplot as plt
|
||||
import torchvision # for MNIST dataset
|
||||
import warnings
|
||||
|
||||
from pina.problem import AbstractProblem
|
||||
from pina.solver import SupervisedSolver
|
||||
@@ -32,6 +33,8 @@ from pina import Condition, LabelTensor
|
||||
from pina.model.block import ContinuousConvBlock
|
||||
from pina.model import FeedForward # for building AE and MNIST classification
|
||||
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
|
||||
# The tutorial is structured as follow:
|
||||
# * [Continuous filter background](#continuous-filter-background): understand how the convolutional filter works and how to use it.
|
||||
@@ -514,7 +517,10 @@ class CircleProblem(AbstractProblem):
|
||||
solver = SupervisedSolver(problem=CircleProblem(), model=net, loss=torch.nn.MSELoss(), use_lt=True)
|
||||
|
||||
# train
|
||||
trainer = Trainer(solver, max_epochs=150, accelerator='cpu', enable_model_summary=False) # we train on CPU and avoid model summary at beginning of training (optional)
|
||||
trainer = Trainer(solver, max_epochs=150, accelerator='cpu', enable_model_summary=False, # we train on CPU and avoid model summary at beginning of training (optional)
|
||||
train_size=1.0,
|
||||
val_size=0.0,
|
||||
test_size=0.0)
|
||||
trainer.train()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user