示例#1
0
 def _GetOpNodeSignatureSymbol(self, op_attribute):
     new_op_node_signature = op_attribute_pb.OpNodeSignature()
     new_op_node_signature.sbp_signature.CopyFrom(op_attribute.sbp_signature)
     new_op_node_signature.mirrored_signature.CopyFrom(
         op_attribute.mirrored_signature
     )
     new_op_node_signature.logical_blob_desc_signature.CopyFrom(
         op_attribute.logical_blob_desc_signature
     )
     new_op_node_signature.batch_axis_signature.CopyFrom(
         op_attribute.batch_axis_signature
     )
     new_op_node_signature.parallel_signature.CopyFrom(
         op_attribute.parallel_signature
     )
     serialized_op_node_signature = new_op_node_signature.SerializeToString()
     if symbol_storage.HasSymbol4SerializedOpNodeSignature(
         serialized_op_node_signature
     ):
         return symbol_storage.GetSymbol4SerializedOpNodeSignature(
             serialized_op_node_signature
         )
     symbol_id = self._NewSymbolId4OpNodeSignature(new_op_node_signature)
     symbol = symbol_util.Symbol(symbol_id, new_op_node_signature)
     symbol_storage.SetSymbol4Id(symbol_id, symbol)
     symbol_storage.SetSymbol4SerializedOpNodeSignature(
         serialized_op_node_signature, symbol
     )
     return symbol
示例#2
0
def MakeUpstreamSignature(ibn2blob_object):
    upstream_signature = op_attribute_pb.OpNodeSignature()
    for ibn, blob_object in ibn2blob_object.items():
        blob_object.op_arg_blob_attr.DumpToOpNodeSignature(
            ibn, upstream_signature)
        blob_object.op_arg_parallel_attr.DumpToOpNodeSignature(
            ibn, upstream_signature)
    return upstream_signature
示例#3
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)
示例#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"]