parameters: (self, context_pad)
docstring: Configure crop dimensions and amount of context for cropping.
          If context is included, make the special input mean for context padding.
  
          Parameters
          ----------
          context_pad : amount of context for cropping.
docstring_summary: Configure crop dimensions and amount of context for cropping.
          If context is included, make the special input mean for context padding.
docstring_tokens: Configure crop dimensions and amount of context for cropping . If context is included make the special input mean for context padding .
function: def configure_crop(self, context_pad):
          """
          Configure crop dimensions and amount of context for cropping.
          If context is included, make the special input mean for context padding.
  
          Parameters
          ----------
          context_pad : amount of context for cropping.
          """
          # crop dimensions
          in_ = self.inputs[0]
          tpose = self.transformer.transpose[in_]
          inv_tpose = [tpose[t] for t in tpose]
          self.crop_dims = np.array(self.blobs[in_].data.shape[1:])[inv_tpose]
          #.transpose(inv_tpose)
          # context padding
          self.context_pad = context_pad
          if self.context_pad:
              in_ = self.inputs[0]
              transpose = self.transformer.transpose.get(in_)
              channel_order = self.transformer.channel_swap.get(in_)
              raw_scale = self.transformer.raw_scale.get(in_)
              # Padding context crops needs the mean in unprocessed input space.
              mean = self.transformer.mean.get(in_)
              if mean is not None:
                  inv_transpose = [transpose[t] for t in transpose]
                  crop_mean = mean.copy().transpose(inv_transpose)
                  if channel_order is not None:
                      channel_order_inverse = [channel_order.index(i)
                                               for i in range(crop_mean.shape[2])]
                      crop_mean = crop_mean[:, :, channel_order_inverse]
                  if raw_scale is not None:
                      crop_mean /= raw_scale
                  self.crop_mean = crop_mean
              else:
                  self.crop_mean = np.zeros(self.crop_dims, dtype=np.float32)
function_tokens: def configure_crop ( self , context_pad ) : # crop dimensions in_ = self . inputs [ 0 ] tpose = self . transformer . transpose [ in_ ] inv_tpose = [ tpose [ t ] for t in tpose ] self . crop_dims = np . array ( self . blobs [ in_ ] . data . shape [ 1 : ] ) [ inv_tpose ] #.transpose(inv_tpose) # context padding self . context_pad = context_pad if self . context_pad : in_ = self . inputs [ 0 ] transpose = self . transformer . transpose . get ( in_ ) channel_order = self . transformer . channel_swap . get ( in_ ) raw_scale = self . transformer . raw_scale . get ( in_ ) # Padding context crops needs the mean in unprocessed input space. mean = self . transformer . mean . get ( in_ ) if mean is not None : inv_transpose = [ transpose [ t ] for t in transpose ] crop_mean = mean . copy ( ) . transpose ( inv_transpose ) if channel_order is not None : channel_order_inverse = [ channel_order . index ( i ) for i in range ( crop_mean . shape [ 2 ] ) ] crop_mean = crop_mean [ : , : , channel_order_inverse ] if raw_scale is not None : crop_mean /= raw_scale self . crop_mean = crop_mean else : self . crop_mean = np . zeros ( self . crop_dims , dtype = np . float32 )