Skip to content

Commit

Permalink
Add --no-validate flag to the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep committed Nov 21, 2024
1 parent f7ed2a9 commit fdcac1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/floretta-cli/src/bin/floretta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ use std::{

use anyhow::bail;
use clap::Parser;
use floretta::Autodiff;

/// Apply reverse-mode automatic differentiation to a WebAssembly module.
#[derive(Debug, Parser)]
struct Cli {
/// Input file path; if not provided, will read from stdin.
input: Option<PathBuf>,

/// Do not validate the input WebAssembly module.
#[clap(long)]
no_validate: bool,

/// Export the backward pass of a function that is already exported.
#[clap(long = "export", num_args = 2)]
name: Vec<String>,
Expand All @@ -36,7 +41,11 @@ pub fn main() -> anyhow::Result<()> {
wat::parse_bytes(&stdin)?.into_owned()
}
};
let mut ad = floretta::Autodiff::new();
let mut ad = if args.no_validate {
Autodiff::no_validate()
} else {
Autodiff::new()
};
for pair in args.name.chunks(2) {
ad.export(&pair[0], &pair[1]);
}
Expand Down

0 comments on commit fdcac1a

Please sign in to comment.