Reference only

Expected all tensors to be on the same device: inspect branch boundaries

One operation may receive an image on CUDA and a mask on CPU, or branches on different GPUs. This does not mean the whole application failed to recognize the GPU.

Symptoms and scope

One operation may receive an image on CUDA and a mask on CPU, or branches on different GPUs. This does not mean the whole application failed to recognize the GPU.

Error fragments for search; IDs, values and filenames may vary:

Expected all tensors to be on the same device
cpu and cuda
cuda:0 and cuda:1

Source-supported context

Historical issue #2556 reports a CPU/CUDA mismatch in VAE Encode for Inpaint. It shows one possible image/mask boundary, not a universal device-error fix. PyTorch documents that cross-GPU operations are not allowed by default, so the devices named in a traceback matter. Source 1 Source 2 Source 3

Cases to distinguish

1. A custom node creates a tensor without moving it as required by the next operation.

2. Forced-device, offload or multi-GPU settings place branches on incompatible devices.

3. Core and node updates change device-management assumptions at different times.

Diagnostic sequence

The sequence below is an editorial procedure based on the cited context, not a diagnosis already confirmed for your environment.

Step 1. Record both named devices, the failing node and the specific operation in the traceback.

Step 2. In a workflow copy, remove nonessential device-forcing and multi-GPU settings and return to the author's default device management.

Step 3. Test image, mask, conditioning and model branches in a minimal single-device flow before restoring offload or multi-GPU features.

Step 4. If an extension alone triggers it, report its version and minimal graph. Do not send every input to cuda:0 in source code, which breaks other backends and can defeat memory management.

Completion check

Objects participating in the operation are handled by compatible devices and the task completes without relying on accidental cache state.

Limitations and cautions

Moving tensors can add copies and memory pressure. OOM after disabling offload needs capacity troubleshooting rather than conflation with the device error.

Original sources

Localization prepared: 2026-09-22. The older source-check dates were inherited; the PyTorch CUDA semantics page was checked 2026-09-25. No GPU run, minimum-memory measurement or runtime guarantee is supplied.

Didn't solve it?

Check the next possible cause

The same symptom can come from a different cause. Work through these related entries in order.

  1. Float, Half and BFloat16 mismatch: trace the failing operationmat1 and mat2 must have the same dtypeA dtype failure differs from a shape or device failure. Start with the traceback and incompatible operand types; a KSampler error alone does not identify the component that caused them.
  2. CUDA out of memory: separate model loading, sampling and VAE decodingCUDA out of memoryIdentify the stage that requested GPU memory before reducing the workload. Advertised VRAM, weight-file size and the memory available to this particular task are different quantities.
Paste your full log into the error finder

Was this page helpful?

Anonymous. Only a yes/no counter is stored; no account, IP address or device details.

Sources & references

Localized from the existing Chinese research draft. Original source-check dates are retained; this translation is not new technical verification or a runtime test.

01CPU/CUDA mismatch in inpainting VAE encodeSource checked: 2026-09-2102ComfyUI custom node troubleshootingSource checked: 2026-09-2103PyTorch CUDA semanticsSource checked: 2026-09-25

Report an issue · 2f03b38d-866b-5058-b5b7-b6524d218d30