modules/dataset.py
def xy_mgrid(H, W):
    '''
        Generate a flattened meshgrid for heterogenous sizes
        
        Inputs:
            H, W: Input dimensions
        
        Outputs:
            mgrid: H*W x 2 meshgrid
    '''
    Y, X = torch.meshgrid(torch.linspace(-1, 1, H),
                          torch.linspace(-1, 1, W))
    mgrid = torch.stack((X, Y), dim=-1).reshape(-1, 2)
    
    return mgrid

        Generate a flattened meshgrid for heterogenous sizes
        
        Inputs:
            H, W: Input dimensions
        
        Outputs:
            mgrid: H*W x 2 meshgrid
    
Generate a flattened meshgrid for heterogenous sizes
Inputs:
H, W: Input dimensions

H*W x 2 meshgrid
Generate a flattened meshgrid for heterogenous sizes Inputs : H W : Input dimensions H * W x 2 meshgrid
def xy_mgrid(H, W):
    Y, X = torch.meshgrid(torch.linspace(-1, 1, H),
                          torch.linspace(-1, 1, W))
    mgrid = torch.stack((X, Y), dim=-1).reshape(-1, 2)
    return mgrid
def xy_mgrid ( H , W ) : Y , X = torch . meshgrid ( torch . linspace ( - 1 , 1 , H ) , torch . linspace ( - 1 , 1 , W ) ) mgrid = torch . stack ( ( X , Y ) , dim = - 1 ) . reshape ( - 1 , 2 ) return mgrid
Generate a flattened meshgrid for heterogenous sizes
Inputs:
H, W: Input dimensions
Generate a flattened meshgrid for heterogenous sizes Inputs : H W : Input dimensions
'''
        Generate a flattened meshgrid for heterogenous sizes
        
        Inputs:
            H, W: Input dimensions
        
        Outputs:
            mgrid: H*W x 2 meshgrid
    '''
H
W