nujo/autodiff/_functions/_transform.py
def _im2col_indices(self) -> Tuple[ndarray, ndarray, ndarray]:
        ''' Calculate the indices where the dot products are
        to be applied between the weights and the image.

        '''

        # Obtain needed information
        channels = self.children[0].shape[1]
        kernel_height, kernel_width = self.kernel_size
        stride_height, stride_width = self.stride
        dilation_height, dilation_width = self.dilation
        out_height, out_width = self._output_shape

        # Calculate sections' rows
        step = dilation_height + 1
        section_rows = repeat(arange(0, kernel_height * step, step),
                              kernel_width)
        section_rows = tile(section_rows, channels)

        # Slide rows by stride
        slide_rows = stride_width * repeat(arange(out_height), out_width)
        section_rows = section_rows.reshape(-1, 1) + slide_rows.reshape(1, -1)

        # Calculate sections' columns
        step = dilation_width + 1
        section_cols = tile(arange(0, kernel_width * step, step),
                            kernel_height * channels)

        # Slide cols by stride
        slide_cols = stride_height * tile(arange(out_width), out_height)
        section_cols = section_cols.reshape(-1, 1) + slide_cols.reshape(1, -1)

        # Calculate sections' channels
        section_channels = repeat(arange(channels),
                                  kernel_height * kernel_width).reshape(-1, 1)

        # Return indices
        return section_channels, section_rows, section_cols
 Calculate the indices where the dot products are
        to be applied between the weights and the image.

        
Calculate the indices where the dot products are
to be applied between the weights and the image.
Calculate the indices where the dot products are to be applied between the weights and the image .
def _im2col_indices(self) -> Tuple[ndarray, ndarray, ndarray]:
        channels = self.children[0].shape[1]
        kernel_height, kernel_width = self.kernel_size
        stride_height, stride_width = self.stride
        dilation_height, dilation_width = self.dilation
        out_height, out_width = self._output_shape
        step = dilation_height + 1
        section_rows = repeat(arange(0, kernel_height * step, step),
                              kernel_width)
        section_rows = tile(section_rows, channels)
        slide_rows = stride_width * repeat(arange(out_height), out_width)
        section_rows = section_rows.reshape(-1, 1) + slide_rows.reshape(1, -1)
        step = dilation_width + 1
        section_cols = tile(arange(0, kernel_width * step, step),
                            kernel_height * channels)
        slide_cols = stride_height * tile(arange(out_width), out_height)
        section_cols = section_cols.reshape(-1, 1) + slide_cols.reshape(1, -1)
        section_channels = repeat(arange(channels),
                                  kernel_height * kernel_width).reshape(-1, 1)
        return section_channels, section_rows, section_cols
def _im2col_indices ( self ) -> Tuple [ ndarray , ndarray , ndarray ] : channels = self . children [ 0 ] . shape [ 1 ] kernel_height , kernel_width = self . kernel_size stride_height , stride_width = self . stride dilation_height , dilation_width = self . dilation out_height , out_width = self . _output_shape step = dilation_height + 1 section_rows = repeat ( arange ( 0 , kernel_height * step , step ) , kernel_width ) section_rows = tile ( section_rows , channels ) slide_rows = stride_width * repeat ( arange ( out_height ) , out_width ) section_rows = section_rows . reshape ( - 1 , 1 ) + slide_rows . reshape ( 1 , - 1 ) step = dilation_width + 1 section_cols = tile ( arange ( 0 , kernel_width * step , step ) , kernel_height * channels ) slide_cols = stride_height * tile ( arange ( out_width ) , out_height ) section_cols = section_cols . reshape ( - 1 , 1 ) + slide_cols . reshape ( 1 , - 1 ) section_channels = repeat ( arange ( channels ) , kernel_height * kernel_width ) . reshape ( - 1 , 1 ) return section_channels , section_rows , section_cols
Calculate the indices where the dot products are
to be applied between the weights and the image.
Calculate the indices where the dot products are to be applied between the weights and the image .
''' Calculate the indices where the dot products are
        to be applied between the weights and the image.

        ''' # Obtain needed information # Calculate sections' rows # Slide rows by stride # Calculate sections' columns # Slide cols by stride # Calculate sections' channels # Return indices
self