Repository: stable-diffusion-webui
Issue: [Bug]: TypeError: Operation 'neg_out_mps()' does not support input type 'int64' in MPS backend
Labels: bug-report,platform:mac

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

When I generated an image, this error came out which is pretty strange...as it's not a common issue and had no previous example. The only thing I know is that it is mainly related to the WebUI pytorch.

*I posted on discussions however I will post about this also in issues as this is the first case this was reported in WebUI
*If there are other information required or if an information should be fixed, please inform me

### Steps to reproduce the problem

Generate an image

### What should have happened?

Should be able to generate normally

### Commit where the problem happens

22bcc7be

### What platforms do you use to access the UI ?

MacOS

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
No
```


### List of extensions

Config-Presets
a1111-sd-webui-lycoris
a1111-sd-webui-tagcomplete
a1111-sd-webui-tome
cutoff
dynamic prompt
latent couple
openpose-editor
posex
sd-webui-3d-open-pose-editor
sd-webui-additional-networks
sd-webui-controlnet
sd-webui-depth-lib
sd-webui-enable-checker
stable-diffusion-webui-images-browser
LDSR
Lora
ScuNET
SwinIR
prompt-bracket-checker

### Console logs

```Shell
Traceback (most recent call last):
  File "/Users/yuya/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/Users/yuya/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/Users/yuya/stable-diffusion-webui/modules/processing.py", line 503, in process_images
    res = process_images_inner(p)
  File "/Users/yuya/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/modules/processing.py", line 653, in process_images_inner
    samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength, prompts=prompts)
  File "/Users/yuya/stable-diffusion-webui/modules/processing.py", line 869, in sample
    samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
  File "/Users/yuya/stable-diffusion-webui/modules/sd_samplers_compvis.py", line 218, in sample
    samples_ddim = self.launch_sampling(steps, lambda: self.sampler.sample(S=steps, conditioning=conditioning, batch_size=int(x.shape[0]), shape=x[0].shape, verbose=False, unconditional_guidance_scale=p.cfg_scale, unconditional_conditioning=unconditional_conditioning, x_T=x, eta=self.eta)[0])
  File "/Users/yuya/stable-diffusion-webui/modules/sd_samplers_compvis.py", line 51, in launch_sampling
    return func()
  File "/Users/yuya/stable-diffusion-webui/modules/sd_samplers_compvis.py", line 218, in <lambda>
    samples_ddim = self.launch_sampling(steps, lambda: self.sampler.sample(S=steps, conditioning=conditioning, batch_size=int(x.shape[0]), shape=x[0].shape, verbose=False, unconditional_guidance_scale=p.cfg_scale, unconditional_conditioning=unconditional_conditioning, x_T=x, eta=self.eta)[0])
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddim.py", line 104, in sample
    samples, intermediates = self.ddim_sampling(conditioning, size,
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddim.py", line 164, in ddim_sampling
    outs = self.p_sample_ddim(img, cond, ts, index=index, use_original_steps=ddim_use_original_steps,
  File "/Users/yuya/stable-diffusion-webui/modules/sd_samplers_compvis.py", line 58, in p_sample_ddim_hook
    res = self.orig_p_sample_ddim(x_dec, cond, ts, unconditional_conditioning=unconditional_conditioning, *args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddim.py", line 212, in p_sample_ddim
    model_uncond, model_t = self.model.apply_model(x_in, t_in, c_in).chunk(2)
  File "/Users/yuya/stable-diffusion-webui/modules/sd_hijack_utils.py", line 17, in <lambda>
    setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
  File "/Users/yuya/stable-diffusion-webui/modules/sd_hijack_utils.py", line 26, in __call__
    return self.__sub_func(self.__orig_func, *args, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/modules/sd_hijack_unet.py", line 45, in apply_model
    return orig_func(self, x_noisy.to(devices.dtype_unet), t.to(devices.dtype_unet), cond, **kwargs).float()
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 858, in apply_model
    x_recon = self.model(x_noisy, t, **cond)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 1335, in forward
    out = self.diffusion_model(x, t, context=cc)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1148, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py", line 797, in forward
    h = module(h, emb, context)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py", line 84, in forward
    x = layer(x, context)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/attention.py", line 334, in forward
    x = block(x, context=context[i])
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/attention.py", line 269, in forward
    return checkpoint(self._forward, (x, context), self.parameters(), self.checkpoint)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/util.py", line 121, in checkpoint
    return CheckpointFunction.apply(func, len(inputs), *args)
  File "/Users/yuya/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/util.py", line 136, in forward
    output_tensors = ctx.run_function(*ctx.input_tensors)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/tomesd/patch.py", line 51, in _forward
    m_a, m_c, m_m, u_a, u_c, u_m = compute_merge(x, self._tome_info)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/tomesd/patch.py", line 24, in compute_merge
    m, u = merge.bipartite_soft_matching_random2d(x, w, h, args["sx"], args["sy"], r, not use_rand)
  File "/Users/yuya/stable-diffusion-webui/venv/lib/python3.10/site-packages/tomesd/merge.py", line 55, in bipartite_soft_matching_random2d
    idx_buffer_view.scatter_(dim=2, index=rand_idx, src=-torch.ones_like(rand_idx, dtype=rand_idx.dtype))
TypeError: Operation 'neg_out_mps()' does not support input type 'int64' in MPS backend.
```


### Additional information

Here is the generation data (prompts and negative prompts are hidden):
(PROMPT)
(NEGATIVE PROMPT)
Steps: 20, Sampler: DDIM, CFG scale: 8, Seed: 43956545, Size: 640x768, Model hash: 973cb455d0, Model: hassakuHentaiModel_v11, Denoising strength: 0.5, Clip skip: 2, Hires upscale: 1.3, Hires upscaler: Latent (nearest-exact), AddNet Enabled: True, AddNet Module 2: LoRA, AddNet Model 2: keqingGenshinImpact3in1_v10(62893a579db7), AddNet Weight A 2: 0.7, AddNet Weight B 2: 0.7

Here is the raw text at the bottom of UI:
python: 3.10.10  •  torch: 1.12.1  •  xformers: N/A  •  gradio: 3.23.0  •  commit: [22bcc7be]•  checkpoint: [973cb455d0]