(self, lhs, arr, func_name, args, array_dists)
analyze distributions of array functions (arr.func_name)
analyze distributions of array functions (arr.func_name)
analyze distributions of array functions ( arr . func_name )
def _analyze_call_array(self, lhs, arr, func_name, args, array_dists):
        """analyze distributions of array functions (arr.func_name)
        """
        if func_name == 'transpose':
            if len(args) == 0:
                raise ValueError("Transpose with no arguments is not"
                                 " supported")
            in_arr_name = arr.name
            arg0 = guard(get_constant, self.func_ir, args[0])
            if isinstance(arg0, tuple):
                arg0 = arg0[0]
            if arg0 != 0:
                raise ValueError("Transpose with non-zero first argument"
                                 " is not supported")
            self._meet_array_dists(lhs, in_arr_name, array_dists)
            return

        if func_name in ('astype', 'reshape', 'copy'):
            in_arr_name = arr.name
            self._meet_array_dists(lhs, in_arr_name, array_dists)
            # TODO: support 1D_Var reshape
            if func_name == 'reshape' and array_dists[lhs] == Distribution.OneD_Var:
                # HACK support A.reshape(n, 1) for 1D_Var
                if len(args) == 2 and guard(find_const, self.func_ir, args[1]) == 1:
                    return
                self._analyze_call_set_REP(lhs, args, array_dists, 'array.' + func_name)
            return

        # Array.tofile() is supported for all distributions
        if func_name == 'tofile':
            return

        # set REP if not found
        self._analyze_call_set_REP(lhs, args, array_dists, 'array.' + func_name)
def _analyze_call_array ( self , lhs , arr , func_name , args , array_dists ) : if func_name == 'transpose' : if len ( args ) == 0 : raise ValueError ( "Transpose with no arguments is not" " supported" ) in_arr_name = arr . name arg0 = guard ( get_constant , self . func_ir , args [ 0 ] ) if isinstance ( arg0 , tuple ) : arg0 = arg0 [ 0 ] if arg0 != 0 : raise ValueError ( "Transpose with non-zero first argument" " is not supported" ) self . _meet_array_dists ( lhs , in_arr_name , array_dists ) return if func_name in ( 'astype' , 'reshape' , 'copy' ) : in_arr_name = arr . name self . _meet_array_dists ( lhs , in_arr_name , array_dists ) # TODO: support 1D_Var reshape if func_name == 'reshape' and array_dists [ lhs ] == Distribution . OneD_Var : # HACK support A.reshape(n, 1) for 1D_Var if len ( args ) == 2 and guard ( find_const , self . func_ir , args [ 1 ] ) == 1 : return self . _analyze_call_set_REP ( lhs , args , array_dists , 'array.' + func_name ) return # Array.tofile() is supported for all distributions if func_name == 'tofile' : return # set REP if not found self . _analyze_call_set_REP ( lhs , args , array_dists , 'array.' + func_name )