operator.py 773 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
%pythoncode {

__owner_graph = None

@property
def owner_graph(self):
    """get the owner graph; note that a reference would be kept in this var"""
    if self.__owner_graph is None:
        self.__owner_graph = self._get_owner_graph()
    return self.__owner_graph

@property
def id(self):
    """an integer identifier for this opr that is unique in the computing
    graph"""
    return int(self._get_id())

@property
def name(self):
    return self._get_name()

22 23 24 25 26
@property
def params(self):
    import json
    return json.loads(self._get_params())

27 28 29 30 31 32 33 34 35 36 37
@property
def inputs(self):
    return tuple(self._get_inputs())

@property
def outputs(self):
    return tuple(self._get_outputs())

def __repr__(self):
    return 'Operator(id={},name={})'.format(self.id, self.name)
}