Implementation of DataLoader and DataModule (#383)
Refactoring for 0.2 * Data module, data loader and dataset * Refactor LabelTensor * Refactor solvers Co-authored-by: dario-coscia <dariocos99@gmail.com>
This commit is contained in:
committed by
Nicola Demo
parent
dd43c8304c
commit
a27bd35443
@@ -18,12 +18,11 @@ class DataConditionInterface(ConditionInterface):
|
||||
|
||||
def __init__(self, input_points, conditional_variables=None):
|
||||
"""
|
||||
TODO
|
||||
TODO : add docstring
|
||||
"""
|
||||
super().__init__()
|
||||
self.input_points = input_points
|
||||
self.conditional_variables = conditional_variables
|
||||
self._condition_type = 'unsupervised'
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if (key == 'input_points') or (key == 'conditional_variables'):
|
||||
|
||||
@@ -16,16 +16,15 @@ class DomainEquationCondition(ConditionInterface):
|
||||
|
||||
def __init__(self, domain, equation):
|
||||
"""
|
||||
TODO
|
||||
TODO : add docstring
|
||||
"""
|
||||
super().__init__()
|
||||
self.domain = domain
|
||||
self.equation = equation
|
||||
self._condition_type = 'physics'
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if key == 'domain':
|
||||
check_consistency(value, (DomainInterface))
|
||||
check_consistency(value, (DomainInterface, str))
|
||||
DomainEquationCondition.__dict__[key].__set__(self, value)
|
||||
elif key == 'equation':
|
||||
check_consistency(value, (EquationInterface))
|
||||
|
||||
@@ -17,12 +17,11 @@ class InputPointsEquationCondition(ConditionInterface):
|
||||
|
||||
def __init__(self, input_points, equation):
|
||||
"""
|
||||
TODO
|
||||
TODO : add docstring
|
||||
"""
|
||||
super().__init__()
|
||||
self.input_points = input_points
|
||||
self.equation = equation
|
||||
self._condition_type = 'physics'
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if key == 'input_points':
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import torch
|
||||
import torch_geometric
|
||||
|
||||
from .condition_interface import ConditionInterface
|
||||
from ..label_tensor import LabelTensor
|
||||
@@ -16,16 +17,15 @@ class InputOutputPointsCondition(ConditionInterface):
|
||||
|
||||
def __init__(self, input_points, output_points):
|
||||
"""
|
||||
TODO
|
||||
TODO : add docstring
|
||||
"""
|
||||
super().__init__()
|
||||
self.input_points = input_points
|
||||
self.output_points = output_points
|
||||
self._condition_type = ['supervised', 'physics']
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if (key == 'input_points') or (key == 'output_points'):
|
||||
check_consistency(value, (LabelTensor, Graph, torch.Tensor))
|
||||
check_consistency(value, (LabelTensor, Graph, torch.Tensor, torch_geometric.data.Data))
|
||||
InputOutputPointsCondition.__dict__[key].__set__(self, value)
|
||||
elif key in ('_problem', '_condition_type'):
|
||||
super().__setattr__(key, value)
|
||||
|
||||
Reference in New Issue
Block a user