Pytorch predict memeory issue

I found when do inference process using GPU, sometimes cpu memory usage is more than gpu memory
I use below code to collect cpu memory
import gc
import resource
del input, output
max_mem_used = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
print("{:.2f} MB".format(max_mem_used / 1024))

found that, in inference process, input is 1920x1080, nvidia-smi: GPU memory cost is about 7G,
print("{:.2f} MB".format(max_mem_used / 1024)) also output about 3G

as I think most computing in GPU memory. why there is so many CPU memory usage, how to decrease cpu memory?

does anybody know about it? Plz help me