class_docstr: A Keras Layer implementing BiFPN Node.
docstr: Fuse features from different resolutions and return a weighted sum.
  
  Args:
    nodes: a list of tensorflow features at different levels
  
  Returns:
    A tensor denoting the fused feature.
docstr_tok: ["Fuse","features","from","different","resolutions","and","return","a","weighted","sum",".","Args",":","nodes",":","a","list","of","tensorflow","features","at","different","levels","Returns",":","A","tensor","denoting","the","fused","feature","."]
code: def fuse_features(self, nodes):
      """Fuse features from different resolutions and return a weighted sum.
  
      Args:
        nodes: a list of tensorflow features at different levels
  
      Returns:
        A tensor denoting the fused feature.
      """
      dtype = nodes[0].dtype
  
      if self.weight_method == "attn":
          edge_weights = []
          for var in self.vars:
              var = tf.cast(var, dtype=dtype)
              edge_weights.append(var)
          normalized_weights = tf.nn.softmax(tf.stack(edge_weights))
          nodes = tf.stack(nodes, axis=-1)
          new_node = tf.reduce_sum(nodes * normalized_weights, -1)
      elif self.weight_method == "fastattn":
          edge_weights = []
          for var in self.vars:
              var = tf.cast(var, dtype=dtype)
              edge_weights.append(var)
          weights_sum = tf.add_n(edge_weights)
          nodes = [
              nodes[i] * edge_weights[i] / (weights_sum + 0.0001)
              for i in range(len(nodes))
          ]
          new_node = tf.add_n(nodes)
      elif self.weight_method == "channel_attn":
          edge_weights = []
          for var in self.vars:
              var = tf.cast(var, dtype=dtype)
              edge_weights.append(var)
          normalized_weights = tf.nn.softmax(
              tf.stack(edge_weights, -1), axis=-1
          )
          nodes = tf.stack(nodes, axis=-1)
          new_node = tf.reduce_sum(nodes * normalized_weights, -1)
      elif self.weight_method == "channel_fastattn":
          edge_weights = []
          for var in self.vars:
              var = tf.cast(var, dtype=dtype)
              edge_weights.append(var)
  
          weights_sum = tf.add_n(edge_weights)
          nodes = [
              nodes[i] * edge_weights[i] / (weights_sum + 0.0001)
              for i in range(len(nodes))
          ]
          new_node = tf.add_n(nodes)
      elif self.weight_method == "sum":
          new_node = tf.reduce_sum(nodes, axis=0)
      else:
          raise ValueError(
              "unknown weight_method %s" % self.weight_method
          )
  
      return new_node
  
imports: import functools
  from absl import logging
  import numpy
  import tensorflow
  import utils
  from .None import fpn_configs
label_desc: Use image node_id 2 for calling the FNode obj's underlying member method code with example usage: obj.fuse_features(nodes) and returns: new_node