add support for operations: reduceMean, add, mul, div, sigmoid
Some checks failed
Validate Operations / validate-operations (push) Failing after 51m52s
Some checks failed
Validate Operations / validate-operations (push) Failing after 51m52s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use anyhow::{Context, Result};
|
||||
use anyhow::{Context, Result, ensure};
|
||||
use paste::paste;
|
||||
use std::{collections::HashMap, mem::offset_of, sync::LazyLock};
|
||||
|
||||
@@ -36,6 +36,7 @@ static SIMD: LazyLock<HashMap<String, FunctorType>> = LazyLock::new(|| {
|
||||
add_to_json_map!(storage, vvmax);
|
||||
add_to_json_map!(storage, vvsll);
|
||||
add_to_json_map!(storage, vvsra);
|
||||
add_to_json_map!(storage, vavg);
|
||||
add_to_json_map!(storage, vrelu);
|
||||
add_to_json_map!(storage, vtanh);
|
||||
add_to_json_map!(storage, vsigm);
|
||||
@@ -339,6 +340,7 @@ fn json_to_vavg(
|
||||
let rd = json_i64!(json, "rd") as i32;
|
||||
let rs1 = json_i64!(json, "rs1") as i32;
|
||||
let rs2 = json_i64!(json, "rs2") as i32;
|
||||
ensure!(rs2 == 1, "vavg only supports stride 1");
|
||||
let len = json_i64!(json, "len") as i32;
|
||||
let (offset_select, offset_value) = json_to_offset(json.get("offset").unwrap());
|
||||
inst_data_builder
|
||||
|
||||
@@ -55,19 +55,15 @@ pub trait HasSigm {
|
||||
|
||||
impl HasSigm for f32 {
|
||||
fn sigm(self) -> Self {
|
||||
let x = self;
|
||||
let e = std::f32::consts::E;
|
||||
let ex = x.powf(x);
|
||||
(ex) / (1.0+ex)
|
||||
let ex = self.exp();
|
||||
ex / (1.0 + ex)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasSigm for f64 {
|
||||
fn sigm(self) -> Self {
|
||||
let x = self;
|
||||
let e = std::f64::consts::E;
|
||||
let ex = x.powf(x);
|
||||
(ex) / (1.0+ex)
|
||||
let ex = self.exp();
|
||||
ex / (1.0 + ex)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user