(self, lhs, func_name, args, array_dists)
analyze distributions of numpy functions (np.func_name)
analyze distributions of numpy functions (np.func_name)
analyze distributions of numpy functions ( np . func_name )
def _analyze_call_np(self, lhs, func_name, args, array_dists):
        """analyze distributions of numpy functions (np.func_name)
        """

        if func_name == 'ascontiguousarray':
            self._meet_array_dists(lhs, args[0].name, array_dists)
            return

        if func_name == 'ravel':
            self._meet_array_dists(lhs, args[0].name, array_dists)
            return

        if func_name == 'concatenate':
            self._analyze_call_np_concatenate(lhs, args, array_dists)
            return

        if func_name == 'array' and is_array(self.typemap, args[0].name):
            self._meet_array_dists(lhs, args[0].name, array_dists)
            return

        # sum over the first axis is distributed, A.sum(0)
        if func_name == 'sum' and len(args) == 2:
            axis_def = guard(get_definition, self.func_ir, args[1])
            if isinstance(axis_def, ir.Const) and axis_def.value == 0:
                array_dists[lhs] = Distribution.REP
                return

        if func_name == 'dot':
            self._analyze_call_np_dot(lhs, args, array_dists)
            return

        # used in df.values
        if func_name == 'stack':
            seq_info = guard(find_build_sequence, self.func_ir, args[0])
            if seq_info is None:
                self._analyze_call_set_REP(lhs, args, array_dists, 'np.' + func_name)
                return
            in_arrs, _ = seq_info

            axis = 0
            # TODO: support kws
            # if 'axis' in kws:
            #     axis = find_const(self.func_ir, kws['axis'])
            if len(args) > 1:
                axis = find_const(self.func_ir, args[1])

            # parallel if args are 1D and output is 2D and axis == 1
            if axis is not None and axis == 1 and self.typemap[lhs].ndim == 2:
                for v in in_arrs:
                    self._meet_array_dists(lhs, v.name, array_dists)
                return

        if (func_name in ['cumsum', 'cumprod', 'empty_like',
                          'zeros_like', 'ones_like', 'full_like', 'copy']):
            in_arr = args[0].name
            self._meet_array_dists(lhs, in_arr, array_dists)
            return

        # set REP if not found
        self._analyze_call_set_REP(lhs, args, array_dists, 'np.' + func_name)
def _analyze_call_np ( self , lhs , func_name , args , array_dists ) : if func_name == 'ascontiguousarray' : self . _meet_array_dists ( lhs , args [ 0 ] . name , array_dists ) return if func_name == 'ravel' : self . _meet_array_dists ( lhs , args [ 0 ] . name , array_dists ) return if func_name == 'concatenate' : self . _analyze_call_np_concatenate ( lhs , args , array_dists ) return if func_name == 'array' and is_array ( self . typemap , args [ 0 ] . name ) : self . _meet_array_dists ( lhs , args [ 0 ] . name , array_dists ) return # sum over the first axis is distributed, A.sum(0) if func_name == 'sum' and len ( args ) == 2 : axis_def = guard ( get_definition , self . func_ir , args [ 1 ] ) if isinstance ( axis_def , ir . Const ) and axis_def . value == 0 : array_dists [ lhs ] = Distribution . REP return if func_name == 'dot' : self . _analyze_call_np_dot ( lhs , args , array_dists ) return # used in df.values if func_name == 'stack' : seq_info = guard ( find_build_sequence , self . func_ir , args [ 0 ] ) if seq_info is None : self . _analyze_call_set_REP ( lhs , args , array_dists , 'np.' + func_name ) return in_arrs , _ = seq_info axis = 0 # TODO: support kws # if 'axis' in kws: #     axis = find_const(self.func_ir, kws['axis']) if len ( args ) > 1 : axis = find_const ( self . func_ir , args [ 1 ] ) # parallel if args are 1D and output is 2D and axis == 1 if axis is not None and axis == 1 and self . typemap [ lhs ] . ndim == 2 : for v in in_arrs : self . _meet_array_dists ( lhs , v . name , array_dists ) return if ( func_name in [ 'cumsum' , 'cumprod' , 'empty_like' , 'zeros_like' , 'ones_like' , 'full_like' , 'copy' ] ) : in_arr = args [ 0 ] . name self . _meet_array_dists ( lhs , in_arr , array_dists ) return # set REP if not found self . _analyze_call_set_REP ( lhs , args , array_dists , 'np.' + func_name )