sbi icon indicating copy to clipboard operation
sbi copied to clipboard

feat: add a to.(device) method for the BoxUniform prior

Open janfb opened this issue 10 months ago • 1 comments

janfb avatar Feb 20 '25 09:02 janfb

This branch attempts to add a to(device) to BoxUniform

https://github.com/jorobledo/sbi/tree/device

This is the relevant commit

I thought of two solutions and added a test in the tests folder tests/device_test.py.

There is an inplace replacemente method .to(device and also another option which is ._to(device), which is not inplace, but needs to be assigned to a new variable. Something like

prior = prior._to(device)

instead of

prior.to(device)

The thing is that in the tests, the assignment method samples way faster than the inplace option (both show a speedup in comparison to "cpu"). Tested it on mps device and gpu.

What do you think?

jorobledo avatar Mar 17 '25 09:03 jorobledo

fixed with #1505

janfb avatar Aug 15 '25 08:08 janfb