def adv_index_broadcastable_pattern(a, idx):
 def replace_slice(v):
  if isinstance(v, gof.Apply):
   if (len(v.outputs) != 1):
    raise ValueError('It is ambiguous which output of a multi-output Op has to be fetched.', v)
   else:
    v = v.outputs[0]
  if NoneConst.equals(v):
   return None
  if isinstance(v.type, SliceType):
   return slice(None, None)
  return numpy.zeros(((2,) * v.ndim), int)
 newidx = tuple(map(replace_slice, idx))
 fakeshape = [(2 - bc) for bc in a.broadcastable]
 retshape = numpy.empty(fakeshape)[newidx].shape
 return tuple([(dim == 1) for dim in retshape])

def adv_index_broadcastable_pattern ( a , idx ) : def replace_slice ( v ) : if isinstance ( v , gof . Apply ) : if ( len ( v . outputs ) != 1 ) : raise ValueError ( 'It is ambiguous which output of a multi-output Op has to be fetched.' , v ) else : v = v . outputs [ 0 ] if NoneConst . equals ( v ) : return None if isinstance ( v . type , SliceType ) : return slice ( None , None ) return numpy . zeros ( ( ( 2 , ) * v . ndim ) , int ) newidx = tuple ( map ( replace_slice , idx ) ) fakeshape = [ ( 2 - bc ) for bc in a . broadcastable ] retshape = numpy . empty ( fakeshape ) [ newidx ] . shape return tuple ( [ ( dim == 1 ) for dim in retshape ] )
this function is only used to determine the broadcast pattern for advancedsubtensor output variable .