Is there a Pytorch function for getting size of a tensor in GPU as if it were a PNG file without converting it to a CPU tensor?

Hello everyone,

Is there a direct way to get the size of a cuda-tensor as if it were a PNG image without converting it to cpu-tensor?

I’ve tried with encode_png but it requires to pass the tensor to cpu, but I want to know the size of a tensor as if it were a PNG file before actually saving it into disk.

Many thanks in advance