code: def calc_dotproduct_begin_idx(
      ts, dp, beginidx, idx, idx_diff, m, idx_nn
  ):
      indices = list(range(idx - 1, beginidx - 1, -1))
  
      if not indices:
          return dp
  
      tmp_a = ts[indices]
      indices_b = list(range(idx_nn - 1, beginidx + idx_diff - 1, -1))
      tmp_b = ts[indices_b]
      indices_c = list(range(idx + m - 1, beginidx + m - 1, -1))
      tmp_c = ts[indices_c]
      indices_d = list(
          range(idx_nn - 1 + m, beginidx + idx_diff + m - 1, -1)
      )
      tmp_d = ts[indices_d]
  
      dp[indices] = dp[idx] + np.cumsum(
          (tmp_a * tmp_b) - (tmp_c * tmp_d)
      )
  
      return dp
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import math
  import time
  import warnings
  import numpy
label_desc: Use image node_id 17 for calling a global function with example usage: calc_dotproduct_begin_idx(ts, dp, beginidx, idx, idx_diff, m, idx_nn) and returns: dp, dp