From 1540914db949cec8e9e6c96787542fe96dca3731 Mon Sep 17 00:00:00 2001 From: Stephen von Takach Date: Mon, 8 May 2023 18:00:02 +1000 Subject: [PATCH] feat: add delegate option to client --- shard.yml | 2 +- src/tensorflow_lite/client.cr | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shard.yml b/shard.yml index 88f893c..6fbd105 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: tensorflow_lite -version: 1.1.0 +version: 1.2.0 development_dependencies: ameba: diff --git a/src/tensorflow_lite/client.cr b/src/tensorflow_lite/client.cr index ba3b979..c9dbd5f 100644 --- a/src/tensorflow_lite/client.cr +++ b/src/tensorflow_lite/client.cr @@ -3,7 +3,7 @@ require "../tensorflow_lite" class TensorflowLite::Client include Indexable(Tensor) - def initialize(model : Bytes | Path | Model | String, threads : Int? = nil, &on_error : String -> Nil) + def initialize(model : Bytes | Path | Model | String, delegate : Delegate? = nil, threads : Int? = nil, &on_error : String -> Nil) @model = case model in String Model.new(Path.new(model)) @@ -18,6 +18,9 @@ class TensorflowLite::Client if threads @options.num_threads(threads) end + if delegate + @options.add_delegate delegate + end @interpreter = Interpreter.new(@model, @options) end