mirror of
https://github.com/huggingface/candle.git
synced 2025-06-22 12:28:06 +00:00
Rename the candle crate to candle-core (#301)
* Rename to candle-core. * More candle-core renaming.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use candle::backend::BackendStorage;
|
||||
use candle::cpu_backend;
|
||||
use candle::{CpuStorage, CustomOp1, DType, Device, Error, Layout, Result, Shape, Tensor};
|
||||
use candle_core::backend::BackendStorage;
|
||||
use candle_core::cpu_backend;
|
||||
use candle_core::{CpuStorage, CustomOp1, DType, Device, Error, Layout, Result, Shape, Tensor};
|
||||
|
||||
mod test_utils;
|
||||
use test_utils::to_vec1_round;
|
||||
@ -24,7 +24,7 @@ impl CustomOp1 for Elu {
|
||||
}
|
||||
|
||||
fn cpu_fwd(&self, s: &CpuStorage, l: &Layout) -> Result<(CpuStorage, Shape)> {
|
||||
let storage = candle::map_dtype!(
|
||||
let storage = candle_core::map_dtype!(
|
||||
"elu",
|
||||
s,
|
||||
|s| cpu_backend::unary_map(s, l, |v| fwd(v, self.alpha)),
|
||||
@ -67,7 +67,7 @@ impl CustomOp1 for EluBackward {
|
||||
}
|
||||
|
||||
fn cpu_fwd(&self, s: &CpuStorage, l: &Layout) -> Result<(CpuStorage, Shape)> {
|
||||
let storage = candle::map_dtype!(
|
||||
let storage = candle_core::map_dtype!(
|
||||
"elu-bwd",
|
||||
s,
|
||||
|s| cpu_backend::unary_map(s, l, |v| bwd(v, self.alpha)),
|
||||
@ -104,7 +104,7 @@ impl CustomOp1 for EluWithBackward {
|
||||
#[test]
|
||||
fn custom_op1_with_backward() -> Result<()> {
|
||||
let cpu = &Device::Cpu;
|
||||
let t = candle::Var::new(&[-2f32, 0f32, 2f32], cpu)?;
|
||||
let t = candle_core::Var::new(&[-2f32, 0f32, 2f32], cpu)?;
|
||||
let elu_t = t.custom_op1(EluWithBackward::new(2.))?;
|
||||
assert_eq!(to_vec1_round(&elu_t, 4)?, &[-1.7293, 0.0, 2.0]);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use candle::{DType, Device::Cpu, Tensor};
|
||||
use candle_core::{DType, Device::Cpu, Tensor};
|
||||
|
||||
#[test]
|
||||
fn display_scalar() -> Result<()> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use anyhow::{Context, Result};
|
||||
use candle::{Device, Shape, Tensor, Var};
|
||||
use candle_core::{Device, Shape, Tensor, Var};
|
||||
mod test_utils;
|
||||
|
||||
fn simple_grad(device: &Device) -> Result<()> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use candle::{Device, IndexOp, Tensor};
|
||||
use candle_core::{Device, IndexOp, Tensor};
|
||||
|
||||
mod test_utils;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
mod test_utils;
|
||||
use candle::{Device, IndexOp, Result, Tensor};
|
||||
use candle_core as candle;
|
||||
|
||||
fn contiguous(device: &Device) -> Result<()> {
|
||||
let tensor = Tensor::arange(0u32, 24u32, device)?.reshape((2, 3, 4))?;
|
||||
|
@ -1,5 +1,5 @@
|
||||
mod test_utils;
|
||||
use candle::{DType, Device, IndexOp, Result, Tensor};
|
||||
use candle_core::{DType, Device, IndexOp, Result, Tensor};
|
||||
|
||||
fn zeros(device: &Device) -> Result<()> {
|
||||
let tensor = Tensor::zeros((5, 2), DType::F32, device)?;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use candle::{Result, Tensor};
|
||||
use candle_core::{Result, Tensor};
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! test_device {
|
||||
|
Reference in New Issue
Block a user