Skip to content

Commit

Permalink
conditional build for tflite in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kali committed Sep 8, 2023
1 parent 1f418eb commit 6ba9f4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ pub fn handle(
}
}

#[cfg(feature = "tflite")]
if let Some(path) = sub_matches.value_of("tflite") {
let tflite = tract_tflite::tflite();
if let Some(mut typed) = model.downcast_ref::<TypedModel>().cloned() {
Expand All @@ -232,6 +233,11 @@ pub fn handle(
}
}

#[cfg(not(feature = "tflite"))]
if sub_matches.value_of("tflite").is_some() {
bail!("This is a tract build without support for tflite.")
}

if options.cost {
let total = annotations.tags.values().sum::<NodeTags>();
let assert =
Expand Down
5 changes: 5 additions & 0 deletions cli/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ impl Parameters {
});
stage!("nnef-declutter", typed_model -> typed_model, |m:TypedModel| m.into_decluttered());
}
#[cfg(feature = "tflite")]
if matches.is_present("tflite-cycle") {
stage!("tflite-cycle", typed_model -> typed_model, |m:TypedModel| {
let tflite = tract_tflite::tflite();
Expand All @@ -743,6 +744,10 @@ impl Parameters {
});
stage!("tflite-declutter", typed_model -> typed_model, |m:TypedModel| m.into_decluttered());
}
#[cfg(not(feature = "tflite"))]
if matches.is_present("tflite-cycle") {
bail!("This tract build did not include tflite features.");
}
if let Some(sub) = matches.value_of("extract-decluttered-sub") {
stage!("extract", typed_model -> typed_model, |m:TypedModel| {
let node = m.node_id_by_name(sub)?;
Expand Down

0 comments on commit 6ba9f4f

Please sign in to comment.