# Convert DType.uint256 to UInt256?

**URL:** <https://forum.modular.com/t/convert-dtype-uint256-to-uint256/2697>\
**Category:** Mojo\
**Created:** [February 6, 2026, 1:38pm UTC](https://forum.modular.com/t/convert-dtype-uint256-to-uint256/2697 "2026-02-06T13:38:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![notooth](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@notooth](https://forum.modular.com/u/notooth)\
**Post date:** [February 6, 2026, 1:38pm UTC](https://forum.modular.com/t/convert-dtype-uint256-to-uint256/2697/1 "2026-02-06T13:38:03Z")

</div>

Can anyone guide me convert a `DType.uint256` number to `UInt256`?  
I failed to convert `DType.uint256` to `UInt256` with this code:

```auto
comptime layout = Layout.row_major(5)
tensor = LayoutTensor[DType.uint256, layout, MutAnyOrigin].stack_allocation()
tensor[0] = Scalar[DType.uint256](10)
var host_scalar: Scalar[DType.uint256] = tensor[0]
print("host_scalar =", host_scalar)

```

Error:

```auto
error: cannot implicitly convert 'LayoutTensor[DType.uint256, layout, MutAnyOrigin].element_type' value to 'UInt256'
    var host_scalar: Scalar[DType.uint256] = tensor[0]
                                             ~~~~~~^~~

```

---

<div class="post-metadata">

**Author:** ![lukas](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/lukas/32/47_2.png) [@lukas](https://forum.modular.com/u/lukas)\
**Post date:** [February 9, 2026, 3:51pm UTC](https://forum.modular.com/t/convert-dtype-uint256-to-uint256/2697/2 "2026-02-09T15:51:08Z")

</div>

The issue is that `LayoutTensor. __getitem__ ` returns `SIMD[Self.dtype, Self.element_size]` (in order to handle vectorization). You can get `tensor[0][0]` (the first element of the parametric SIMD type). Due to the way that `element_size` is defined, the compiler will not be able to deduce that `element_size=1` in the near future. There is also `LayoutTensor.load_scalar()` as another option.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [August 8, 2026, 3:51pm UTC](https://forum.modular.com/t/convert-dtype-uint256-to-uint256/2697/3 "2026-08-08T15:51:51Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
