I want to get the output of a layer which is a tensor of images, convert it to numpy arrays and apply a custom function on them, and return the output to the model. So it would be something like this:
def sum(args):
    # convert args to numpy arrays
    ???
    #calculating sum of all the elements
    s=np.sum(args)
    return s

This would be in the middle of the model, which means some other layers will be added to this functions output.
Thank you very much for your help.