Avoid some redundant clone. (#731)

This commit is contained in:
Laurent Mazare
2023-09-04 09:18:32 +02:00
committed by GitHub
parent d0cdea95a5
commit e2f9f60ac2
2 changed files with 3 additions and 3 deletions

View File

@ -59,8 +59,8 @@ fn batch_norm() -> Result<()> {
); );
let bn2 = BatchNorm::new( let bn2 = BatchNorm::new(
5, 5,
running_mean.clone(), running_mean,
running_var.clone(), running_var,
Tensor::new(&[0.5f32], &Device::Cpu)?.broadcast_as(5)?, Tensor::new(&[0.5f32], &Device::Cpu)?.broadcast_as(5)?,
Tensor::new(&[-1.5f32], &Device::Cpu)?.broadcast_as(5)?, Tensor::new(&[-1.5f32], &Device::Cpu)?.broadcast_as(5)?,
1e-8, 1e-8,

View File

@ -80,7 +80,7 @@ impl Model {
let tokens = self let tokens = self
.inner .inner
.tokenizer .tokenizer
.encode(prompt.to_string(), true) .encode(prompt, true)
.map_err(|m| JsError::new(&m.to_string()))? .map_err(|m| JsError::new(&m.to_string()))?
.get_ids() .get_ids()
.to_vec(); .to_vec();