code: def define_residual(tf_input, tf_index, weights, prefix):
      """
      This function defines the residual network using the tensorflow nn api.
  
      Parameters
      ----------
      tf_input: tensorflow.Tensor
          The input tensor to the residual network.
      tf_index: tensorflow.Tensor
          The index tensor to the residual 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()
      # TODO: Refactor Instance Norm
  
      conv_1_paddings = _tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
      conv_1_pad = _tf.pad(tf_input, conv_1_paddings, "REFLECT")
      conv_1_filter = weights[prefix + "conv_1_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 + "inst_1_"
      )
      relu_1 = _tf.nn.relu(inst_1)
  
      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 + "conv_2_weight"]
      conv_2 = _tf.nn.conv2d(
          conv_2_pad,
          conv_2_filter,
          strides=[1, 1, 1, 1],
          padding="VALID",
      )
      inst_2 = define_instance_norm(
          conv_2, tf_index, weights, prefix + "inst_2_"
      )
  
      return _tf.add(tf_input, inst_2)
  
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 4 for calling a global function with example usage: define_residual(tf_input, tf_index, weights, prefix) and returns: _tf