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
- CPU/CUDA mismatch in inpainting VAE encode — original record checked 2026-09-21.
- ComfyUI custom node troubleshooting — original record checked 2026-09-21.
- PyTorch CUDA semantics — checked 2026-09-25.
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.
Related troubleshooting and guides
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