class_docstr: This class defines math overloads so that CNTK nodes can be written in math
  expressions.
class_docstr_tok: ["This","class","defines","math","overloads","so","that","CNTK","nodes","can","be","written","in","math","expressions","."]
docstr: Slicing of a Variable. E.g. var[2:3] will translate into slice(var, axis=0, begin_index=2, end_index=3)
docstr_tok: ["Slicing","of","a","Variable",".","E.g",".","var","[","2:3","]","will","translate","into","slice","(","var",",","axis=0",",","begin_index=2",",","end_index=3",")"]
code: def __getitem__(self, arg):
      """
      Slicing of a Variable. E.g. var[2:3] will translate into slice(var, axis=0, begin_index=2, end_index=3)
      """
      from . import ops
  
      if hasattr(self, "outputs") and len(self.outputs) > 1:
          try:
              return self.outputs[arg]
          except Exception as e:
              msg = (
                  "Slice for multioutput functions is not supported, "
                  "the fallback to select to output requires "
                  "that only one index is provided. arg: {}, self: {}".format(
                      arg, self
                  )
              )
              raise KeyError(msg)
  
      # int or slice: normalize into a tuple of int or tuple of slice
      if not isinstance(arg, tuple):
          arg = (arg,)
      r = self
      axis0 = 0
  
      from cntk.default_options import (
          get_global_option,
          get_default_override,
          default_override_or,
      )
  
      keras_mode_flag = get_global_option("align_axis", 0)
      if keras_mode_flag == 1:
          if (
              getattr(self, "dynamic_axes") is not None
              and len(self.dynamic_axes) > 0
          ):
              axis0 = -get_default_override(
                  None,
                  axis_offset=default_override_or(
                      len(self.dynamic_axes)
                  ),
              )
  
      for axis, s in enumerate(arg):
          if (
              s is Ellipsis
          ):  # ellipsis means index relative to end after this point
              axis0 = -len(arg)
              continue
          if isinstance(s, int):  # int: normalize into a slice
              s = slice(s, s + 1)
  
          if isinstance(s, slice):
              begin = s.start or 0
              end = s.stop or 0
              if begin != 0 or end != 0:
                  r = ops.slice(
                      r,
                      axis=axis + axis0,
                      begin_index=begin,
                      end_index=end,
                      strides=s.step,
                  )
          elif isinstance(s, (tuple, list)):
              # Select multiple elements from the same dimension. This is
              # different from NumPy's advanced indexing, since we just go
              # axis by axis from left to right and don't do any
              # broadcasting.
  
              slice_accum = []
              for idx in s:
                  if not isinstance(idx, int):
                      raise IndexError(
                          'indices have to be of type int and not "%s"'
                          % type(idx)
                      )
                  slice_accum.append(
                      ops.slice(
                          r,
                          axis=axis,
                          begin_index=idx,
                          end_index=idx + 1,
                      )
                  )
              if len(slice_accum) > 1:
                  r = ops.splice(*slice_accum, axis=axis)
              else:
                  r = slice_accum[0]
          else:
              raise IndexError(
                  'type "%s" is not supported as index' % type(s)
              )
  
      return r
  
imports: import warnings
  from scipy import sparse
label_desc: Use image node_id 13 for calling the TensorOpsMixin obj's underlying member method code with example usage: obj.__getitem__(arg) and returns: r, self