The actual function is rather complex but for the sake of this example we might assume it to be something like
def f(x,y):
    return torch.sum(x) + torch.sum(y)

where x in en element of t1 and y is an element of t2