Skip to content

Conversation

@laggui
Copy link
Member

@laggui laggui commented Jan 23, 2026

Checklist

  • Confirmed that cargo run-checks command has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

Fixes #3642

Changes

Step towards moving away from backend default element type generics (e.g., Cuda<f32, i32>).

This PR introduces a new API to set per-device default element type(s), e.g.

let device = B::Device::default();

// Update the device policy
set_default_float_dtype(&device, DType::F16);

// All float tensors created after this will use F16 by default
let tensor = Tensor::<B, 2>::zeros([2, 3], &device);

This is currently set as a public function, but once the multi backend lands it will be a method on a new general device type.

Testing

Describe how these changes have been tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default tensor dtype can be configured on the device instead of by a type.

2 participants