code: def _get_tensor_halfwords(
      dimensions, offset, num_outputs, in_stride
  ) -> Iterator[Optional[Tuple]]:
      """Gets the logical indices of the data that will be stored in memory at the tensor pointer.
  
      Returns an Iterator of Optional[Tuple], while skipping over word-aligned pairs of unrelated
      halfwords. The returned iterator is as short as possible while having even length and containing
      all relevant tensor data. Tuples in the returned Iterator represent an (y, x) offset from the
      top-left tensor position being used in this convolution. We need to be aware of the None values
      so our code is correctly word-aligned.
  
      One consequence of these requirements - each row in the tensor is broken into word-aligned pairs
      of halfwords (which are later combined into full words). See the test cases (located in
      tests/python/topi/python/test_topi_conv2d_tensordot_opts.py) for usage examples.
      """
  
      tensor_w, kernel_h, kernel_w = dimensions
      max_x_val = (num_outputs - 1) * in_stride + kernel_w
      halfwords = []
  
      for y in range(kernel_h):
          # If needed, pad so the beginning of the row is word-aligned
          if (y * tensor_w + offset) % 2 == 1:
              halfwords.append(None)
  
          for x in range(max_x_val):
              halfwords.append((y, x))
  
          # If needed, pad so the row length is word aligned
          if (y * tensor_w + offset + max_x_val) % 2 == 1:
              halfwords.append(None)
      return halfwords
  
file_path: tvm/python/tvm/topi/arm_cpu/mprofile/dsp/micro_kernel/tensordot.py
imports: from dataclasses import dataclass
  from itertools import chain
  import textwrap
  from typing import Iterator, Optional, Tuple
label_desc: Use image node_id 3 for calling a global function with example usage: _get_tensor_halfwords(dimensions, offset, num_outputs, in_stride) and returns: halfwords