Implement Dataset, Dataloader and DataModule class and fix SupervisedSolver
This commit is contained in:
committed by
Nicola Demo
parent
b9753c34b2
commit
c9304fb9bb
@@ -5,7 +5,7 @@ class ConditionInterface(metaclass=ABCMeta):
|
||||
|
||||
condition_types = ['physics', 'supervised', 'unsupervised']
|
||||
|
||||
def __init__(self, *args, **wargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._condition_type = None
|
||||
self._problem = None
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ class DataConditionInterface(ConditionInterface):
|
||||
super().__init__()
|
||||
self.input_points = input_points
|
||||
self.conditional_variables = conditional_variables
|
||||
self.condition_type = 'unsupervised'
|
||||
self._condition_type = 'unsupervised'
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if (key == 'input_points') or (key == 'conditional_variables'):
|
||||
check_consistency(value, (LabelTensor, Graph, torch.Tensor))
|
||||
DataConditionInterface.__dict__[key].__set__(self, value)
|
||||
elif key in ('problem', 'condition_type'):
|
||||
elif key in ('_problem', '_condition_type'):
|
||||
super().__setattr__(key, value)
|
||||
@@ -20,7 +20,7 @@ class DomainEquationCondition(ConditionInterface):
|
||||
super().__init__()
|
||||
self.domain = domain
|
||||
self.equation = equation
|
||||
self.condition_type = 'physics'
|
||||
self._condition_type = 'physics'
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if key == 'domain':
|
||||
@@ -29,5 +29,5 @@ class DomainEquationCondition(ConditionInterface):
|
||||
elif key == 'equation':
|
||||
check_consistency(value, (EquationInterface))
|
||||
DomainEquationCondition.__dict__[key].__set__(self, value)
|
||||
elif key in ('problem', 'condition_type'):
|
||||
elif key in ('_problem', '_condition_type'):
|
||||
super().__setattr__(key, value)
|
||||
@@ -30,5 +30,5 @@ class InputPointsEquationCondition(ConditionInterface):
|
||||
elif key == 'equation':
|
||||
check_consistency(value, (EquationInterface))
|
||||
InputPointsEquationCondition.__dict__[key].__set__(self, value)
|
||||
elif key in ('problem', 'condition_type'):
|
||||
elif key in ('_problem', '_condition_type'):
|
||||
super().__setattr__(key, value)
|
||||
@@ -21,11 +21,11 @@ class InputOutputPointsCondition(ConditionInterface):
|
||||
super().__init__()
|
||||
self.input_points = input_points
|
||||
self.output_points = output_points
|
||||
self.condition_type = ['supervised', 'physics']
|
||||
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))
|
||||
InputOutputPointsCondition.__dict__[key].__set__(self, value)
|
||||
elif key in ('problem', 'condition_type'):
|
||||
elif key in ('_problem', '_condition_type'):
|
||||
super().__setattr__(key, value)
|
||||
|
||||
Reference in New Issue
Block a user