Fix an error message.

This commit is contained in:
laurent
2023-06-27 09:45:38 +01:00
parent bb262ecc99
commit 18707891b7
2 changed files with 5 additions and 7 deletions

View File

@ -3,12 +3,10 @@ use candle::{Device, Tensor};
fn main() -> Result<()> {
let device = Device::new_cuda(0)?;
let x = Tensor::new(&[[11f32, 22.], [33., 44.], [55., 66.], [77., 78.]], &device)?;
println!("> {:?}", x.sum(&[0])?.to_vec2::<f32>()?);
println!("> {:?}", x.sum(&[1])?.to_vec2::<f32>()?);
println!("> {:?}", x.sum(&[0, 1])?.to_vec2::<f32>()?);
let x = x.to_dtype(candle::DType::F16)?;
println!("> {:?}", x.sum(&[0])?.to_vec2::<half::f16>()?);
let ids = Tensor::new(&[0u32, 3u32, 1u32], &device)?;
let t = Tensor::new(&[[0f32, 1f32], [1f32, 2f32], [2f32, 3f32]], &device)?;
let hs = Tensor::embedding(&ids, &t)?;
println!("> {:?}", hs.to_vec2::<f32>());
let x = Tensor::new(&[3f32, 1., 4., 1., 5.], &device)?;
println!("{:?}", x.to_vec1::<f32>()?);

View File

@ -700,7 +700,7 @@ impl CudaStorage {
let ids = match &self.slice {
CudaStorageSlice::U32(slice) => slice,
_ => Err(CudaError::UnexpectedDType {
msg: "embedding ids should be u32",
msg: "where conditions should be u32",
expected: DType::U32,
got: self.dtype(),
})?,