import torch


def remove_empty_boxes(output):
    """In processed output prediction, if a box is emtpy (height
    or width is zero), then it is removed from the final output array"""
    ary = []
    output_ = output.clone()
    for i in range(output_.size(0)):
        inner_ary = output_[i].numpy()
        if inner_ary[0] == inner_ary[2] and inner_ary[1] == inner_ary[3]:
            continue
        else:
            ary.append(inner_ary)
    return torch.tensor(ary, dtype=torch.int32).view(-1, 7)