assertall(s%patch_size==0forsinlatents_size),f"Latent size(last {ndim} dimensions) should be divisible by patch size({patch_size}), but got {latents_size}."
rope_sizes=[s//patch_sizeforsinlatents_size]
elifisinstance(patch_size,list):
assertall(s%patch_size[idx]==0foridx,sinenumerate(latents_size)),f"Latent size(last {ndim} dimensions) should be divisible by patch size({patch_size}), but got {latents_size}."