Esempio n. 1
0
    def compile(self, op_list):
        self._check_status(self.SessionStatus.OPEN)
        scope = flow.current_scope()
        device_tag = scope.device_parallel_desc_symbol.device_tag
        for op_conf in op_list:
            if _need_check_device_tag(
                    op_conf) and op_conf.device_tag != device_tag:
                print(
                    "WARNING: the device_tag of op {} is not equal to the device_tag of seesion's current scope"
                    " ({} vs. {})"
                    ", which may cause the op graph to be incompatible".format(
                        op_conf.name, op_conf.device_tag, device_tag))

            compile_ctx.CurJobAddOp(op_conf)

        oneflow_api.CurJobBuildAndInferCtx_Complete()
        oneflow_api.CurJobBuildAndInferCtx_Rebuild()
Esempio n. 2
0
def EagerRun(session, function_desc, config_proto, args):
    with InterpretScope(session, function_desc, config_proto):
        ret = _InterpretGlobalFunction(function_desc, args)
        oneflow_api.CurJobBuildAndInferCtx_Complete()
        session_ctx.GetDefaultSession().UpdateInfo4InterfaceOp()
    return ret
Esempio n. 3
0
def Compile(session, function_desc, config_proto):
    with InterpretScope(session, function_desc, config_proto):
        _CompileJob(function_desc)
        oneflow_api.CurJobBuildAndInferCtx_Complete()