mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Fix an error message.
This commit is contained in:
@ -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>()?);
|
||||
|
@ -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(),
|
||||
})?,
|
||||
|
Reference in New Issue
Block a user