Empty Sana Latent Image AttributeError: 'EmptySanaLatentImage' object has no attribute 'device'
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
## Expected Behavior
The `Empty Sana Latent Image` node should correctly create a latent tensor on the active device (CUDA/XPU/CPU) without throwing errors.
Expected behavior:
* The node should initialize the latent tensor successfully.
* It should work with Intel XPU devices and other supported backends.
* Workflow execution should continue normally.
## Current Issue
Running the node causes:
```python
AttributeError: 'EmptySanaLatentImage' object has no attribute 'device'
```
The issue occurs in:
```python
latent = torch.zeros([batch_size, 32, height // 32, width // 32], device=self.device)
```
because `self.device` is never initialized inside `EmptySanaLatentImage`.
## Suggested Fix
Replace:
```python
device=self.device
```
with proper device detection such as:
```python
device = torch.device("xpu" if torch.xpu.is_available() else "cuda" if torch.cuda.is_available() else "cpu")
```
or use ComfyUI device management utilities.
### Actual Behavior
When executing the workflow with the Empty Sana Latent Image node, ComfyUI crashes with the following error:
AttributeError: 'EmptySanaLatentImage' object has no attribute 'device'
The error occurs during latent tensor creation inside nodes.py:
latent = torch.zeros([batch_size, 32, height // 32, width // 32], device=self.device)
Since self.device is never defined or initialized in EmptySanaLatentImage, the node fails immediately during execution.
Environment
ComfyUI Version: 0.22.1
Python: 3.13.12
PyTorch: 2.12.0+xpu
GPU: Intel Arc 130V
Backend: XPU
OS: Windows
### Steps to Reproduce
>
### Debug Logs
```powershell
>
```
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.