Skip to content

Input Type and weight type not match #46

@Chenchao-is-CC

Description

@Chenchao-is-CC

Hello,

First, thank you for developing such a useful tool!

Recently, I have been using this package to detect smFISH spots from a 3D dataset (dtype: uint16). My data is stored as an OME-Zarr file because it is a large 3D tissue dataset. I see that your package already supports Zarr files, which is great.

However, I encountered the following error:
RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same

I am not sure what causes this issue. I asked ChatGPT for advice, and here is the recommendation it provided:
In 'spotiflow.py'
In the tiled loop case)

# the origin code  (in line 1028)
tile = torch.from_numpy(tile)
# revised code
tile = torch.from_numpy(tile).float()

As for non-tiled case

# the origin code (in line 867)
img_t = torch.from_numpy(x).to(device).unsqueeze(0)
# revised code
img_t = torch.from_numpy(x).float().to(device).unsqueeze(0)

Finally, after modifying the code, it works correctly. I hope this information can provide a useful hint to help fix this bug. Please double-check the code, as sometimes ChatGPT’s suggestions may not be entirely accurate.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions