Exemple #1
0
 def BuildModeInitInstruction(builder):
     upstream_signature = op_attribute_pb.OpNodeSignature()
     parallel_conf = oneflow.placement.current_scope().default_parallel_conf
     op_conf.scope_symbol_id = oneflow.current_scope().symbol_id
     op_attribute = c_api_util.InferOpConf(op_conf, upstream_signature)
     builder.StatelessCall(op_attribute,
                           parallel_conf,
                           bn_in_op2blob_object=bn_in_op2blob_object)
Exemple #2
0
 def BuildModelInitInstruction(builder):
     upstream_signature = op_node_signature_pb.OpNodeSignature()
     op_conf.scope_symbol_id = oneflow.current_scope().symbol_id
     op_attribute = c_api_util.InferOpConf(op_conf, upstream_signature)
     parallel_conf = (
         oneflow.current_scope().device_parallel_desc_symbol.parallel_conf)
     builder.StatelessCall(op_attribute,
                           parallel_conf,
                           bn_in_op2blob_object=bn_in_op2blob_object)
Exemple #3
0
 def BuildModelInitInstruction(builder):
     upstream_signature = op_node_signature_pb.OpNodeSignature()
     op_conf.scope_symbol_id = oneflow.current_scope().symbol_id
     op_attribute = c_api_util.InferOpConf(op_conf, upstream_signature)
     parallel_conf = (
         oneflow.current_scope().device_parallel_desc_symbol.parallel_conf)
     cfg_op_attribute = oneflow_api.deprecated.MakeOpAttributeByString(
         str(op_attribute))
     builder.StatelessCall(cfg_op_attribute, parallel_conf,
                           bn_in_op2blob_object, boxing_util.BoxingTo)
Exemple #4
0
def _MakeNewBlobObjectLike(builder, blob_object, new_parallel_desc_symbol):
    op_conf = op_conf_pb.OperatorConf()
    op_conf.name = id_util.UniqueStr("Input")
    op_conf.device_tag = new_parallel_desc_symbol.device_tag
    op_conf.input_conf.out = "out"
    blob_object.op_arg_parallel_attr.DumpToToInterfaceBlobConf(
        op_conf.input_conf.blob_conf)
    blob_object.op_arg_blob_attr.DumpToToInterfaceBlobConf(
        op_conf.input_conf.blob_conf)
    op_conf.scope_symbol_id = oneflow.current_scope().symbol_id
    upstream_signature = op_attribute_pb.OpNodeSignature()
    op_attribute = c_api_util.InferOpConf(op_conf, upstream_signature)
    parallel_conf = new_parallel_desc_symbol.parallel_conf
    bn_in_op2blob_object = {}
    builder.BoxingStatelessCall(op_attribute,
                                parallel_conf,
                                bn_in_op2blob_object=bn_in_op2blob_object)
    return bn_in_op2blob_object["out"]
Exemple #5
0
def _MakeNewBlobObjectLike(builder, blob_object, new_parallel_desc_symbol):
    op_conf = op_conf_pb.OperatorConf()
    op_conf.name = id_util.UniqueStr("Input")
    op_conf.device_tag = new_parallel_desc_symbol.device_tag
    op_conf.input_conf.out = "out"
    cfg_interface_blob_conf = (
        oneflow_api.oneflow.core.operator.interface_blob_conf.InterfaceBlobConf()
    )
    blob_object.op_arg_parallel_attr.DumpToInterfaceBlobConf(cfg_interface_blob_conf)
    blob_object.op_arg_blob_attr.DumpToInterfaceBlobConf(cfg_interface_blob_conf)
    text_format.Parse(str(cfg_interface_blob_conf), op_conf.input_conf.blob_conf)
    op_conf.scope_symbol_id = oneflow.current_scope().symbol_id
    upstream_signature = op_node_signature_pb.OpNodeSignature()
    op_attribute = c_api_util.InferOpConf(op_conf, upstream_signature)
    parallel_conf = new_parallel_desc_symbol.parallel_conf
    bn_in_op2blob_object = oneflow_api.deprecated.BnInOp2BlobObject()
    builder.RawStatelessCall(
        op_attribute, parallel_conf, bn_in_op2blob_object=bn_in_op2blob_object
    )
    return bn_in_op2blob_object["out"]
Exemple #6
0
def Infer(op_conf, ibn2blob_object, scope_symbol_id=None):
    if scope_symbol_id is None:
        scope_symbol_id = oneflow.current_scope().symbol_id
    op_conf.scope_symbol_id = scope_symbol_id
    upstream_signature = MakeUpstreamSignature(ibn2blob_object)
    return c_api_util.InferOpConf(op_conf, upstream_signature)