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)
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)
def MakeUpstreamSignature(ibn2blob_object): upstream_signature_cfg = op_node_signature_cfg.OpNodeSignature() for (ibn, blob_object) in ibn2blob_object.items(): blob_object.op_arg_blob_attr.DumpToOpNodeSignature(ibn, upstream_signature_cfg) blob_object.op_arg_parallel_attr.DumpToOpNodeSignature( ibn, upstream_signature_cfg ) return text_format.Parse( str(upstream_signature_cfg), op_node_signature_pb.OpNodeSignature() )
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 = {} builder.RawStatelessCall( op_attribute, parallel_conf, bn_in_op2blob_object=bn_in_op2blob_object ) return bn_in_op2blob_object["out"]