Thank you for your reply. Actually Tensor were converted to numpy for python looping, but i was thinking c++ loops are much better so a custom operator is a good choice. Python loops run on numpy arrays. Here is a snippet to demonstrate both parts
    import time

    #######################
    # Calling C++ made operator here
    a = torch.from_numpy(dummy).to(torch.float)
    b = torch.from_numpy(mult1).to(torch.float)
    start = time.time()  # Torch passed to c++ operator a and b
    nani = nice.nice(
        a, b, element_per_filter, mult1.shape[0], yindex_2, mult1.shape[1])
    #######################
    end = time.time()
    print(end - start, "C++")

    start = time.time()

    for i in range(0, mult1.shape[0]+1, yindex_2):   # python looping on numpy arrays

        for j in range(0, mult1.shape[1], 1):                
            number = 0
            for k in range(iterator,   i,  1):            
                number = number +mult1[k][j]          
                temp = k
            dummy[temp][j] = number
    end = time.time()
    print(end - start, "Python Loop")