Do you mean return true only when false is a successor to True?
Can be done easily, i’ve written a naive implementation O(n^2)
def check(t):
  for i in range(t.shape[0]):
    flag = False
    for j in range(t.shape[1]):
      if t[i][j].item() == False:
        flag = True
      if t[i][j].item() == True:
        if flag == True:
          return False
  return True

eg use:
b = torch.tensor(((False, False, False,False),(False,False,False,False),(True,True,False,False),(True,True,True,True)))
check(b)