model.py 825 字节
Newer Older
T
tangwei 已提交
1
import abc
T
tangwei 已提交
2
from fleet_rec.core.utils import envs
T
tangwei 已提交
3 4 5 6 7 8 9 10 11 12 13 14

class Model(object):
    """R
    """
    __metaclass__ = abc.ABCMeta

    def __init__(self, config):
        """R
        """
        self._cost = None
        self._metrics = {}
        self._data_var = []
T
tangwei 已提交
15
        self._data_loader = None
T
tangwei 已提交
16
        self._fetch_interval = 20
T
tangwei 已提交
17
        self._namespace = "train.model"
T
tangwei 已提交
18
        self._platform = envs.get_platform()
T
tangwei 已提交
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

    def get_inputs(self):
        return self._data_var

    def get_cost_op(self):
        """R
        """
        return self._cost

    def get_metrics(self):
        """R
        """
        return self._metrics

    def get_fetch_period(self):
        return self._fetch_interval

    @abc.abstractmethod
    def train_net(self):
        """R
        """
        pass

    def infer_net(self):
        pass