hi, Dr Hu. Recently, I have been tried to run your Topoloss.py in my own network.
The shape of input tensor is [4, 2, 512, 512], and the shape of label tensor is [4, 512, 512]. I want to traverse four images in a batch and calculate their average loss, so I wrote the following code:

At the beginning, i can successfully run the code while the speed was very slow (because it had to be calculated on the CPU).
Later, during the 14000 iteration, it suddenly reported the following error:

I guess it should be resulted by the certain image calculated homology features only have 0-dimension (points) and not have 1-dimension (loops).
Can you give me some guidance? Thanks!