code: def define_resnet(tf_input, tf_index, weights, prefix="transformer_"):
      """
      This function defines the resnet network using the tensorflow nn api.
  
      Parameters
      ----------
      tf_input: tensorflow.Tensor
          The input tensor to the network. The image is expected to be in RGB
          format.
      tf_index: tensorflow.Tensor
          The index tensor to the network.
      weights: dictionary
          The dictionary of weights to the network. The naming convention
          used is that from the CoreML export of the Style Transfer Network.
  
      prefix: string
          The prefix column is used to prefix the variables of the network for
          weight export.
      Returns
      -------
      out: tensorflow.Tensor
          The sigmoid output tensor to the network.
      """
      _tf = _lazy_import_tensorflow()
  
      # encoding 1
      conv_1_paddings = _tf.constant([[0, 0], [4, 4], [4, 4], [0, 0]])
      conv_1_pad = _tf.pad(tf_input, conv_1_paddings, "REFLECT")
      conv_1_filter = weights[prefix + "encode_1_conv_weight"]
      conv_1 = _tf.nn.conv2d(
          conv_1_pad,
          conv_1_filter,
          strides=[1, 1, 1, 1],
          padding="VALID",
      )
      inst_1 = define_instance_norm(
          conv_1, tf_index, weights, prefix + "encode_1_inst_"
      )
      relu_1 = _tf.nn.relu(inst_1)
  
      # encoding 2
      conv_2_paddings = _tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
      conv_2_pad = _tf.pad(relu_1, conv_2_paddings, "REFLECT")
      conv_2_filter = weights[prefix + "encode_2_conv_weight"]
      conv_2 = _tf.nn.conv2d(
          conv_2_pad,
          conv_2_filter,
          strides=[1, 2, 2, 1],
          padding="VALID",
      )
      inst_2 = define_instance_norm(
          conv_2, tf_index, weights, prefix + "encode_2_inst_"
      )
      relu_2 = _tf.nn.relu(inst_2)
  
      # encoding 3
      conv_3_paddings = _tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
      conv_3_pad = _tf.pad(relu_2, conv_3_paddings, "REFLECT")
      conv_3_filter = weights[prefix + "encode_3_conv_weight"]
      conv_3 = _tf.nn.conv2d(
          conv_3_pad,
          conv_3_filter,
          strides=[1, 2, 2, 1],
          padding="VALID",
      )
      inst_3 = define_instance_norm(
          conv_3, tf_index, weights, prefix + "encode_3_inst_"
      )
      relu_3 = _tf.nn.relu(inst_3)
  
      # Residual Blocks
      residual_1 = define_residual(
          relu_3, tf_index, weights, prefix + "residual_1_"
      )
      residual_2 = define_residual(
          residual_1, tf_index, weights, prefix + "residual_2_"
      )
      residual_3 = define_residual(
          residual_2, tf_index, weights, prefix + "residual_3_"
      )
      residual_4 = define_residual(
          residual_3, tf_index, weights, prefix + "residual_4_"
      )
      residual_5 = define_residual(
          residual_4, tf_index, weights, prefix + "residual_5_"
      )
  
      # decode 1
      decode_1_image_shape = _tf.shape(residual_5)
      decode_1_new_height = decode_1_image_shape[1] * 2
      decode_1_new_width = decode_1_image_shape[2] * 2
  
      decoding_1_upsample_1 = _tf.image.resize_images(
          residual_5,
          [decode_1_new_height, decode_1_new_width],
          method=_tf.image.ResizeMethod.NEAREST_NEIGHBOR,
      )
  
      decode_1_conv_1_paddings = _tf.constant(
          [[0, 0], [1, 1], [1, 1], [0, 0]]
      )
  
      decode_1_conv_1_pad = _tf.pad(
          decoding_1_upsample_1, decode_1_conv_1_paddings, "REFLECT"
      )
  
      decode_1_conv_1_filter = weights[
          prefix + "decoding_1_conv_weight"
      ]
  
      decode_1_conv_1 = _tf.nn.conv2d(
          decode_1_conv_1_pad,
          decode_1_conv_1_filter,
          strides=[1, 1, 1, 1],
          padding="VALID",
      )
  
      decode_1_inst_1 = define_instance_norm(
          decode_1_conv_1,
          tf_index,
          weights,
          prefix + "decoding_1_inst_",
      )
  
      decode_1_relu_1 = _tf.nn.relu(decode_1_inst_1)
  
      # decode 2
      decode_2_image_shape = _tf.shape(decode_1_relu_1)
      decode_2_new_height = decode_2_image_shape[1] * 2
      decode_2_new_width = decode_2_image_shape[2] * 2
  
      decoding_2_upsample_1 = _tf.image.resize_images(
          decode_1_relu_1,
          [decode_2_new_height, decode_2_new_width],
          method=_tf.image.ResizeMethod.NEAREST_NEIGHBOR,
      )
  
      decode_2_conv_1_paddings = _tf.constant(
          [[0, 0], [1, 1], [1, 1], [0, 0]]
      )
  
      decode_2_conv_1_pad = _tf.pad(
          decoding_2_upsample_1, decode_2_conv_1_paddings, "REFLECT"
      )
  
      decode_2_conv_1_filter = weights[
          prefix + "decoding_2_conv_weight"
      ]
  
      decode_2_conv_1 = _tf.nn.conv2d(
          decode_2_conv_1_pad,
          decode_2_conv_1_filter,
          strides=[1, 1, 1, 1],
          padding="VALID",
      )
  
      decode_2_inst_1 = define_instance_norm(
          decode_2_conv_1,
          tf_index,
          weights,
          prefix + "decoding_2_inst_",
      )
  
      decode_2_relu_1 = _tf.nn.relu(decode_2_inst_1)
  
      # decode 3
      decode_3_conv_1_paddings = _tf.constant(
          [[0, 0], [4, 4], [4, 4], [0, 0]]
      )
  
      decode_3_conv_1_pad = _tf.pad(
          decode_2_relu_1, decode_3_conv_1_paddings, "REFLECT"
      )
  
      decode_3_conv_1_filter = weights[prefix + "conv5_weight"]
  
      decode_3_conv_1 = _tf.nn.conv2d(
          decode_3_conv_1_pad,
          decode_3_conv_1_filter,
          strides=[1, 1, 1, 1],
          padding="VALID",
      )
  
      decode_3_inst_1 = define_instance_norm(
          decode_3_conv_1, tf_index, weights, prefix + "instancenorm5_"
      )
  
      decode_3_relu_1 = _tf.nn.sigmoid(decode_3_inst_1)
  
      return decode_3_relu_1
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from turicreate.toolkits._tf_model import TensorFlowModel
  import numpy
  import turicreate.toolkits._tf_utils
  from turicreate._deps.minimal_package import _minimal_package_import_check
label_desc: Use image node_id 5 for calling a global function with example usage: define_resnet(tf_input, tf_index, weights, prefix) and returns: decode_3_relu_1