未验证 提交 9504fd28 编写于 作者: O OuYang Yu 提交者: GitHub

Replace py instruction to CFG Instruction (#3773)

* Replace the py instruction with CFG Instruction

* Remove unused import

* Adjust import order
Co-authored-by: Noneflow-bot <69100618+oneflow-bot@users.noreply.github.com>
上级 6d3fa796
......@@ -22,6 +22,33 @@ include_directories(${CFG_INCLUDE_DIR})
function(GENERATE_CFG_AND_PYBIND11_CPP SRCS HDRS PYBIND_SRCS ROOT_DIR)
list(APPEND ALL_CFG_CONVERT_PROTO
oneflow/core/vm/instruction.proto
oneflow/core/eager/eager_symbol.proto
oneflow/core/job/job_conf.proto
oneflow/core/job/placement.proto
oneflow/core/operator/op_conf.proto
oneflow/core/common/shape.proto
oneflow/core/record/image.proto
oneflow/core/record/record.proto
oneflow/core/job/resource.proto
oneflow/core/register/logical_blob_id.proto
oneflow/core/register/tensor_slice_view.proto
oneflow/core/common/range.proto
oneflow/core/framework/user_op_conf.proto
oneflow/core/framework/user_op_attr.proto
oneflow/core/job/sbp_parallel.proto
oneflow/core/graph/boxing/collective_boxing.proto
oneflow/core/register/blob_desc.proto
oneflow/core/register/pod.proto
oneflow/core/job/scope.proto
oneflow/core/job/mirrored_parallel.proto
oneflow/core/operator/op_attribute.proto
oneflow/core/register/batch_axis_signature.proto
oneflow/core/operator/arg_modifier_signature.proto
oneflow/core/job/blob_lifetime_signature.proto
oneflow/core/job/parallel_signature.proto
oneflow/core/eager/eager_instruction.proto
oneflow/core/job/cluster_instruction.proto
oneflow/core/common/cfg_reflection_test.proto
oneflow/core/common/data_type.proto
oneflow/core/common/device_type.proto
......
此差异已折叠。
......@@ -574,18 +574,20 @@ def GetFunctionConfigDef():
def RunLogicalInstruction(vm_instruction_list, eager_symbol_list):
instructions = str(text_format.MessageToString(vm_instruction_list))
symbols = str(text_format.MessageToString(eager_symbol_list))
error_str = oneflow_internal.RunLogicalInstruction(instructions, symbols)
error_str = oneflow_internal.RunLogicalInstruction(
str(vm_instruction_list), symbols
)
error = text_format.Parse(error_str, error_util.ErrorProto())
if error.HasField("error_type"):
raise JobBuildAndInferError(error)
def RunPhysicalInstruction(vm_instruction_list, eager_symbol_list):
instructions = str(text_format.MessageToString(vm_instruction_list))
symbols = str(text_format.MessageToString(eager_symbol_list))
error_str = oneflow_internal.RunPhysicalInstruction(instructions, symbols)
error_str = oneflow_internal.RunPhysicalInstruction(
str(vm_instruction_list), symbols
)
error = text_format.Parse(error_str, error_util.ErrorProto())
if error.HasField("error_type"):
raise JobBuildAndInferError(error)
......
......@@ -17,7 +17,6 @@ from __future__ import absolute_import
import threading
from oneflow.core.job.job_set_pb2 import ConfigProto
import oneflow.core.vm.instruction_pb2 as instr_util
import oneflow.core.eager.eager_symbol_pb2 as eager_symbol_util
import oneflow.core.job.job_set_pb2 as job_set_util
import oneflow.core.job.job_conf_pb2 as job_conf_pb
......@@ -49,6 +48,7 @@ from typing import Callable
import inspect
import oneflow
import oneflow_api
import oneflow_api.oneflow.core.vm.instruction as instr_cfg
import traceback
......@@ -74,7 +74,7 @@ class Session(object):
self.job_name2name_scope_stack_ = {}
self.eager_global_function_desc_stack_ = []
self._UpdateFunctionFlagName2DefaultVal()
self.instruction_list_ = instr_util.InstructionListProto()
self.instruction_list_ = instr_cfg.InstructionListProto()
self.eager_symbol_list_ = eager_symbol_util.EagerSymbolList()
self.backward_blob_register_ = blob_register_util.BlobRegister()
self.snapshot_mgr_ = SnapshotManager()
......
......@@ -29,7 +29,6 @@ import oneflow
from oneflow.python.oneflow_export import oneflow_export
import oneflow.python.framework.hob as hob
import oneflow.python.experimental.name_scope as name_scope
import oneflow.core.vm.instruction_pb2 as instr_util
import oneflow.core.eager.eager_symbol_pb2 as eager_symbol_util
import oneflow.python.vm.id_util as id_util
import oneflow.python.eager.vm_util as vm_util
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册