| 1554 | |
| 1555 | template <typename SType> |
| 1556 | void Uniform(const SType low, const SType high, Tensor *out) { |
| 1557 | TYPE_LANG_SWITCH(out->data_type(), DType, out->device()->lang(), Lang, { |
| 1558 | auto l = TypeCast<SType, DType>(low); |
| 1559 | auto h = TypeCast<SType, DType>(high); |
| 1560 | Tensor &outRef = *out; |
| 1561 | out->device()->Exec( |
| 1562 | [l, h, outRef](Context *ctx) mutable { |
| 1563 | Uniform<DType, Lang>(l, h, &outRef, ctx); |
| 1564 | }, |
| 1565 | {}, {out->block()}, "Uniform", true); |
| 1566 | }); |
| 1567 | } |
| 1568 | |
| 1569 | template void Uniform<float>(const float low, const float high, Tensor *out); |
| 1570 | |