[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding median proc-block adding more hints #65

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more metadata
  • Loading branch information
f0rodo committed Apr 28, 2022
commit 24b759ee7ffd8c0f5313f750c8d1b090d82922da
2 changes: 2 additions & 0 deletions median/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name = "median"
version = "0.0.0"
edition = "2021"
repository = "https://github.com/hotg-ai/proc-blocks"
description = "Calculate the median value of an array of f64."

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
14 changes: 9 additions & 5 deletions median/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,27 @@ struct ProcBlockV1;

impl proc_block_v1::ProcBlockV1 for ProcBlockV1 {
fn register_metadata() {
let meta = Metadata::new("Median", env!("CARGO_PKG_VERSION"));

let metadata = Metadata::new("Median", env!("CARGO_PKG_VERSION"));
metadata.set_description(env!("CARGO_PKG_DESCRIPTION"));
metadata.set_repository(env!("CARGO_PKG_REPOSITORY"));
metadata.set_homepage(env!("CARGO_PKG_HOMEPAGE"));
metadata.add_tag("numeric");
metadata.add_tag("stats");
let samples = TensorMetadata::new("samples");
samples.set_description("All samples to perform an average on");
let hint = supported_shapes(&[ElementType::F64], Dimensions::Dynamic);
samples.add_hint(&hint);
meta.add_input(&samples);
metadata.add_input(&samples);


let median = TensorMetadata::new("median");
median.set_description("The median");
let hint = supported_shapes(&[ElementType::F64], Dimensions::Dynamic);
median.add_hint(&hint);
meta.add_output(&median);
metadata.add_output(&median);


runtime_v1::register_node(&meta);
runtime_v1::register_node(&metadata);
}

fn graph(id: String) -> Result<(), GraphError> {
Expand Down
2 changes: 2 additions & 0 deletions stats/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name = "stats"
version = "0.0.0"
edition = "2021"
repository = "https://github.com/hotg-ai/proc-blocks"
description = "Calculate the mean and population std deviation of a vector of f64."

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
17 changes: 11 additions & 6 deletions stats/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,32 @@ struct ProcBlockV1;

impl proc_block_v1::ProcBlockV1 for ProcBlockV1 {
fn register_metadata() {
let meta = Metadata::new("Statistics", env!("CARGO_PKG_VERSION"));

let metadata = Metadata::new("Statistics", env!("CARGO_PKG_VERSION"));
metadata.set_description(env!("CARGO_PKG_DESCRIPTION"));
metadata.set_repository(env!("CARGO_PKG_REPOSITORY"));
metadata.set_homepage(env!("CARGO_PKG_HOMEPAGE"));
metadata.add_tag("numeric");
metadata.add_tag("stats");
metadata.add_tag("stdev");
let samples = TensorMetadata::new("samples");
samples.set_description("All samples to perform an average on");
let hint = supported_shapes(&[ElementType::F64], Dimensions::Dynamic);
samples.add_hint(&hint);
meta.add_input(&samples);
metadata.add_input(&samples);

let mean = TensorMetadata::new("mean");
mean.set_description("The mean");
let hint = supported_shapes(&[ElementType::F64], Dimensions::Dynamic);
mean.add_hint(&hint);
meta.add_output(&mean);
metadata.add_output(&mean);

let std_dev = TensorMetadata::new("std_dev");
std_dev.set_description("The standard deviation.");
let hint = supported_shapes(&[ElementType::F64], Dimensions::Dynamic);
std_dev.add_hint(&hint);
meta.add_output(&std_dev);
metadata.add_output(&std_dev);

runtime_v1::register_node(&meta);
runtime_v1::register_node(&metadata);
}

fn graph(id: String) -> Result<(), GraphError> {
Expand Down