@@ -141,24 +141,24 @@ def get_2d_sincos_pos_embed(
141141    embed_dim , grid_size , cls_token = False , extra_tokens = 0 , interpolation_scale = 1.0 , base_size = 16 
142142):
143143    """ 
144-     This matches the implementation in Denoising Diffusion Probabilistic Models: Create  sinusoidal positional embeddings. 
144+     Creates 2D  sinusoidal positional embeddings. 
145145
146146    Args: 
147-     embed_dim:  int 
148-         The embedding dimension. 
149-     grid_size:  int 
150-         The size of the grid height and width. 
151-     cls_token:  bool 
152-         Whether or not to add a classification token. 
153-     extra_tokens:  int 
154-         The number of extra tokens to add. 
155-     interpolation_scale:  float 
156-         The scale of the interpolation. 
147+          embed_dim (` int`):  
148+              The embedding dimension. 
149+          grid_size (` int`):  
150+              The size of the grid height and width. 
151+          cls_token (` bool`, defaults to `False`):  
152+              Whether or not to add a classification token. 
153+          extra_tokens (` int`, defaults to `0`):  
154+              The number of extra tokens to add. 
155+          interpolation_scale (` float`, defaults to `1.0`):  
156+              The scale of the interpolation. 
157157
158158    Returns: 
159-         pos_embed:  np.ndarray 
160-             Shape is [grid_size* grid_size, embed_dim] or 
161-             [1+ grid_size*grid_size, embed_dim] (w/ or w/o  cls_token)  
159+         pos_embed (` np.ndarray`):  
160+             Shape is either ` [grid_size *  grid_size, embed_dim]` if not using cls_token,  or 
161+             `[1 +  grid_size*grid_size, embed_dim]` if using  cls_token 
162162    """ 
163163    if  isinstance (grid_size , int ):
164164        grid_size  =  (grid_size , grid_size )
0 commit comments