code: def get_hypothetical_contribs_func_onehot(multipliers_function):
      """
      Meant for models with one-hot encoded sequence input.
      Inputs:
          multipliers_function: a function (usually produced by
              model.get_target_multipliers_func) that takes task_idx,
              input_data_list, input_references_list, batch_size
              and progress_update as inputs and returns the multipliers
              on one-hot encoded sequence input. The first
              entry of input_data_list is assumed to be a 3-dimensional
              array where the first dimension is the example index,
              the second dimension is length and the
              last dimension is the one-hot encoded channel axis.
      Returns:
          a function that takes the same arguments as multipliers_func
              and returns an estimate of what the contributions would
              be for each of the one-hot encoding possibilities.
              The calculation is as follows: At each
              position, we iterate over the one-hot encoding
              possibilities (eg: for genomic sequence, this is ACGT i.e.
              1000, 0100, 0010 and 0001) and compute the hypothetical
              difference-from-reference in each case.
              We then multiply the hypothetical
              differences-from-reference with the
              multipliers to get the hypothetical contributions.
              For each of the one-hot encoding possibilities,
              the hypothetical contributions are summed across the
              channel axis to estimate the total hypothetical
              contribution at each position.
              The reason this is only an estimate
              is that the multipliers were computed
              using the actual input and not the hypothetical inputs.
      """
  
      def hypothetical_contribs_func(
          task_idx,
          input_data_list,
          input_references_list,
          batch_size,
          progress_update,
      ):
          assert len(input_data_list[0].shape) == 3, input_data_list[
              0
          ].shape
          assert len(input_data_list[0].shape) == 3, input_data_list[
              0
          ].shape
          multipliers = multipliers_function(
              task_idx=task_idx,
              input_data_list=input_data_list,
              input_references_list=input_references_list,
              batch_size=batch_size,
              progress_update=progress_update,
          )
          to_return = np.zeros_like(input_data_list[0]).astype("float")
          for i in range(input_data_list[0].shape[-1]):
              hypothetical_input = np.zeros_like(
                  input_data_list[0]
              ).astype("float")
              hypothetical_input[:, :, i] = 1.0
              difference_from_reference = hypothetical_input - np.array(
                  input_references_list[0]
              )
              hypothetical_contribs = (
                  difference_from_reference * multipliers
              )
              to_return[:, :, i] = np.sum(
                  hypothetical_contribs, axis=-1
              )
          return to_return
  
      return hypothetical_contribs_func
  
imports: from __future__ import division
  from __future__ import print_function
  from __future__ import absolute_import
  import sys
  import os
  import os.path
  import numpy
  from collections import namedtuple
  from collections import OrderedDict
  import json
  import deeplift
  import tensorflow
label_desc: Use image node_id 16 for calling a global function with example usage: get_hypothetical_contribs_func_onehot(multipliers_function) and returns: hypothetical_contribs_func, to_return