But it necessarily has to be implemented using PyTorch functions, right?
Say I have functions like this:
def count_title_case(text):
    return len([word for word in text.split() if word.istitle()])

def loss(output, target):
    output_count = count_title_case(text)
    loss = torch.mean((output_count - target)**2)
    return loss


Would they work considering I’m using another library to extract information from the output?