thanks for the answer it worked , but yeah image.unsqueeze(0) is still needed in ResNet otherwise you might get this error  RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0