File size: 1,266 Bytes
34fb220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from abc import ABC, abstractmethod
from collections import OrderedDict

class abs_model(ABC):
    """ Training Related Interface
    """
    @abstractmethod
    def setup_input(self, x):
        pass


    @abstractmethod
    def forward(self, x):
        pass


    @abstractmethod
    def supervise(self, input_x, y, is_training:bool)->float:
        pass


    @abstractmethod
    def get_visualize(self) -> OrderedDict:
        return {}


    """ Inference Related Interface
    """
    @abstractmethod
    def inference(self, x):
        pass


    @abstractmethod
    def batch_inference(self, x):
        pass


    """ Logging/Visualization Related Interface
    """
    @abstractmethod
    def get_logs(self):
        pass


    """ Getter & Setter
    """
    @abstractmethod
    def get_models(self) -> dict:
        """ GAN may have two models
        """
        pass


    @abstractmethod
    def get_optimizers(self) -> dict:
        """ GAN may have two optimizer
        """
        pass


    @abstractmethod
    def set_models(self, models) -> dict:
        """ GAN may have two models
        """
        pass


    @abstractmethod
    def set_optimizers(self, optimizers: dict):
        """ GAN may have two optimizer
        """
        pass