Skip to content

Commit

Permalink
Fix prev
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielsimard committed Nov 28, 2024
1 parent 5e840ba commit 3800c8e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/cubecl-core/src/frontend/element/float/tensor_float.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#![allow(clippy::transmute_int_to_float)] // Not yet stable in previous version. To be removed when
// prev=1.83.

use bytemuck::{Pod, Zeroable};
use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use half::f16;
use num_traits::{NumCast, ToPrimitive};
use serde::Serialize;
use std::num::NonZero;
use std::{mem::transmute, num::NonZero};

use crate::{
ir::{Elem, FloatKind, Item},
Expand Down Expand Up @@ -34,7 +37,7 @@ impl tf32 {
#[inline]
#[must_use]
pub const fn from_bits(bits: u32) -> tf32 {
tf32(f32::from_bits(bits))
tf32(unsafe { transmute::<u32, f32>(bits) })
}

/// Constructs a [`tf32`] value from a 32-bit floating point value.
Expand Down Expand Up @@ -64,7 +67,7 @@ impl tf32 {
#[inline]
#[must_use]
pub const fn to_bits(self) -> u32 {
self.0.to_bits()
unsafe { transmute(self.0) }
}

/// Converts a [`tf32`] value into an [`f32`] value.
Expand Down

0 comments on commit 3800c8e

Please sign in to comment.