From 0ba6398d6b6a9b5cf07fcbce692fd092c6d420e4 Mon Sep 17 00:00:00 2001 From: stakach Date: Wed, 8 May 2024 03:49:28 +0000 Subject: [PATCH] deploy: fb30953c98ef71e55ca83aa135705ffb16824d1c --- TensorflowLite.html | 6 +-- TensorflowLite/Client.html | 54 ++++++++++----------- TensorflowLite/Delegate.html | 4 +- TensorflowLite/EdgeTPU.html | 6 +-- TensorflowLite/EdgeTPU/Delegate.html | 4 +- TensorflowLite/EdgeTPU/Device.html | 10 ++-- TensorflowLite/EdgeTPU/Device/Type.html | 2 +- TensorflowLite/Interpreter.html | 22 ++++----- TensorflowLite/Interpreter/InvokeError.html | 2 +- TensorflowLite/Interpreter/Status.html | 2 +- TensorflowLite/InterpreterOptions.html | 10 ++-- TensorflowLite/Model.html | 6 +-- TensorflowLite/Tensor.html | 52 ++++++++++---------- TensorflowLite/Tensor/Type.html | 2 +- TensorflowLite/Utilities.html | 2 +- TensorflowLite/Utilities/ExtractLabels.html | 4 +- index.json | 2 +- search-index.js | 2 +- 18 files changed, 96 insertions(+), 96 deletions(-) diff --git a/TensorflowLite.html b/TensorflowLite.html index b01e76d..c65c04a 100644 --- a/TensorflowLite.html +++ b/TensorflowLite.html @@ -219,7 +219,7 @@

- + tensorflow_lite.cr @@ -308,7 +308,7 @@


- [View source] + [View source]
@@ -329,7 +329,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/Client.html b/TensorflowLite/Client.html index 2b02e42..7bc6567 100644 --- a/TensorflowLite/Client.html +++ b/TensorflowLite/Client.html @@ -235,7 +235,7 @@

- + tensorflow_lite/client.cr @@ -545,7 +545,7 @@


- [View source] + [View source]
@@ -566,7 +566,7 @@


- [View source] + [View source]
@@ -603,7 +603,7 @@


- [View source] + [View source]
@@ -624,7 +624,7 @@


- [View source] + [View source]
@@ -645,7 +645,7 @@


- [View source] + [View source]
@@ -666,7 +666,7 @@


- [View source] + [View source]
@@ -682,7 +682,7 @@


- [View source] + [View source]
@@ -703,7 +703,7 @@


- [View source] + [View source]
@@ -724,7 +724,7 @@


- [View source] + [View source]
@@ -745,7 +745,7 @@


- [View source] + [View source]
@@ -766,7 +766,7 @@


- [View source] + [View source]
@@ -787,7 +787,7 @@


- [View source] + [View source]
@@ -803,7 +803,7 @@


- [View source] + [View source]
@@ -819,7 +819,7 @@


- [View source] + [View source]
@@ -835,7 +835,7 @@


- [View source] + [View source]
@@ -856,7 +856,7 @@


- [View source] + [View source]
@@ -877,7 +877,7 @@


- [View source] + [View source]
@@ -898,7 +898,7 @@


- [View source] + [View source]
@@ -914,7 +914,7 @@


- [View source] + [View source]
@@ -935,7 +935,7 @@


- [View source] + [View source]
@@ -956,7 +956,7 @@


- [View source] + [View source]
@@ -977,7 +977,7 @@


- [View source] + [View source]
@@ -998,7 +998,7 @@


- [View source] + [View source]
@@ -1019,7 +1019,7 @@


- [View source] + [View source]
@@ -1040,7 +1040,7 @@


- [View source] + [View source]
@@ -1061,7 +1061,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/Delegate.html b/TensorflowLite/Delegate.html index 0f8d09a..293744a 100644 --- a/TensorflowLite/Delegate.html +++ b/TensorflowLite/Delegate.html @@ -235,7 +235,7 @@

- + tensorflow_lite/delegate.cr @@ -328,7 +328,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/EdgeTPU.html b/TensorflowLite/EdgeTPU.html index 557d963..8296505 100644 --- a/TensorflowLite/EdgeTPU.html +++ b/TensorflowLite/EdgeTPU.html @@ -219,7 +219,7 @@

- + tensorflow_lite/edge_tpu.cr @@ -296,7 +296,7 @@


- [View source] + [View source]
@@ -317,7 +317,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/EdgeTPU/Delegate.html b/TensorflowLite/EdgeTPU/Delegate.html index 0d06353..33b5d51 100644 --- a/TensorflowLite/EdgeTPU/Delegate.html +++ b/TensorflowLite/EdgeTPU/Delegate.html @@ -220,7 +220,7 @@

- + tensorflow_lite/edge_tpu/delegate.cr @@ -329,7 +329,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/EdgeTPU/Device.html b/TensorflowLite/EdgeTPU/Device.html index 27b6be1..d38616d 100644 --- a/TensorflowLite/EdgeTPU/Device.html +++ b/TensorflowLite/EdgeTPU/Device.html @@ -220,7 +220,7 @@

- + tensorflow_lite/edge_tpu/device.cr @@ -353,7 +353,7 @@


- [View source] + [View source]
@@ -390,7 +390,7 @@


- [View source] + [View source]
@@ -411,7 +411,7 @@


- [View source] + [View source]
@@ -432,7 +432,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/EdgeTPU/Device/Type.html b/TensorflowLite/EdgeTPU/Device/Type.html index c8e7e72..dbf38e8 100644 --- a/TensorflowLite/EdgeTPU/Device/Type.html +++ b/TensorflowLite/EdgeTPU/Device/Type.html @@ -217,7 +217,7 @@

- + tensorflow_lite/edge_tpu/device.cr diff --git a/TensorflowLite/Interpreter.html b/TensorflowLite/Interpreter.html index 89cab1a..55086d6 100644 --- a/TensorflowLite/Interpreter.html +++ b/TensorflowLite/Interpreter.html @@ -220,7 +220,7 @@

- + tensorflow_lite/interpreter.cr @@ -389,7 +389,7 @@


- [View source] + [View source]
@@ -426,7 +426,7 @@


- [View source] + [View source]
@@ -447,7 +447,7 @@


- [View source] + [View source]
@@ -480,7 +480,7 @@


- [View source] + [View source]
@@ -502,7 +502,7 @@


- [View source] + [View source]
@@ -523,7 +523,7 @@


- [View source] + [View source]
@@ -544,7 +544,7 @@


- [View source] + [View source]
@@ -565,7 +565,7 @@


- [View source] + [View source]
@@ -586,7 +586,7 @@


- [View source] + [View source]
@@ -607,7 +607,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/Interpreter/InvokeError.html b/TensorflowLite/Interpreter/InvokeError.html index 691263f..8d9f73f 100644 --- a/TensorflowLite/Interpreter/InvokeError.html +++ b/TensorflowLite/Interpreter/InvokeError.html @@ -220,7 +220,7 @@

- + tensorflow_lite/interpreter.cr diff --git a/TensorflowLite/Interpreter/Status.html b/TensorflowLite/Interpreter/Status.html index 439162f..54f499e 100644 --- a/TensorflowLite/Interpreter/Status.html +++ b/TensorflowLite/Interpreter/Status.html @@ -217,7 +217,7 @@

- + tensorflow_lite/interpreter.cr diff --git a/TensorflowLite/InterpreterOptions.html b/TensorflowLite/InterpreterOptions.html index 74fec91..97a5b30 100644 --- a/TensorflowLite/InterpreterOptions.html +++ b/TensorflowLite/InterpreterOptions.html @@ -220,7 +220,7 @@

- + tensorflow_lite/interpreter_options.cr @@ -340,7 +340,7 @@


- [View source] + [View source]
@@ -377,7 +377,7 @@


- [View source] + [View source]
@@ -399,7 +399,7 @@


- [View source] + [View source]
@@ -420,7 +420,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/Model.html b/TensorflowLite/Model.html index e32b33a..4ab52cb 100644 --- a/TensorflowLite/Model.html +++ b/TensorflowLite/Model.html @@ -222,7 +222,7 @@

- + tensorflow_lite/model.cr @@ -323,7 +323,7 @@


- [View source] + [View source]
@@ -344,7 +344,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/Tensor.html b/TensorflowLite/Tensor.html index 5a753ca..bf641b7 100644 --- a/TensorflowLite/Tensor.html +++ b/TensorflowLite/Tensor.html @@ -245,7 +245,7 @@

- + tensorflow_lite/tensor.cr @@ -576,7 +576,7 @@


- [View source] + [View source]
@@ -612,7 +612,7 @@


- [View source] + [View source]
@@ -645,7 +645,7 @@


- [View source] + [View source]
@@ -666,7 +666,7 @@


- [View source] + [View source]
@@ -687,7 +687,7 @@


- [View source] + [View source]
@@ -708,7 +708,7 @@


- [View source] + [View source]
@@ -729,7 +729,7 @@


- [View source] + [View source]
@@ -750,7 +750,7 @@


- [View source] + [View source]
@@ -771,7 +771,7 @@


- [View source] + [View source]
@@ -792,7 +792,7 @@


- [View source] + [View source]
@@ -813,7 +813,7 @@


- [View source] + [View source]
@@ -834,7 +834,7 @@


- [View source] + [View source]
@@ -855,7 +855,7 @@


- [View source] + [View source]
@@ -876,7 +876,7 @@


- [View source] + [View source]
@@ -897,7 +897,7 @@


- [View source] + [View source]
@@ -918,7 +918,7 @@


- [View source] + [View source]
@@ -939,7 +939,7 @@


- [View source] + [View source]
@@ -961,7 +961,7 @@


- [View source] + [View source]
@@ -982,7 +982,7 @@


- [View source] + [View source]
@@ -1003,7 +1003,7 @@


- [View source] + [View source]
@@ -1025,7 +1025,7 @@


- [View source] + [View source]
@@ -1046,7 +1046,7 @@


- [View source] + [View source]
@@ -1068,7 +1068,7 @@


- [View source] + [View source]
@@ -1089,7 +1089,7 @@


- [View source] + [View source]
@@ -1111,7 +1111,7 @@


- [View source] + [View source]
diff --git a/TensorflowLite/Tensor/Type.html b/TensorflowLite/Tensor/Type.html index 8b90cec..601829d 100644 --- a/TensorflowLite/Tensor/Type.html +++ b/TensorflowLite/Tensor/Type.html @@ -228,7 +228,7 @@

- + tensorflow_lite/tensor.cr diff --git a/TensorflowLite/Utilities.html b/TensorflowLite/Utilities.html index c109cea..17f4011 100644 --- a/TensorflowLite/Utilities.html +++ b/TensorflowLite/Utilities.html @@ -207,7 +207,7 @@

- + tensorflow_lite/utilities/extract_labels.cr diff --git a/TensorflowLite/Utilities/ExtractLabels.html b/TensorflowLite/Utilities/ExtractLabels.html index df76dbf..cba221a 100644 --- a/TensorflowLite/Utilities/ExtractLabels.html +++ b/TensorflowLite/Utilities/ExtractLabels.html @@ -207,7 +207,7 @@

- + tensorflow_lite/utilities/extract_labels.cr @@ -302,7 +302,7 @@


- [View source] + [View source]
diff --git a/index.json b/index.json index 7ac46dc..647852d 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -{"repository_name":"tensorflow_lite","body":"# tensorflow_lite\n\n[![CI](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml/badge.svg)](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml) A library for running TF Lite models\n\n* once you've trained a model in TensorFlow you can convert it to [TF Lite](https://www.tensorflow.org/lite/models/convert/convert_models#command_line_tool_) for production use\n* inspect the TF Lite model using [netron.app](https://netron.app/)\n* some [good TF models](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md) for object detection (need conversion)\n\nAlso see the [project documentation](https://spider-gazelle.github.io/tensorflow_lite/TensorflowLite/Client.html)\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n tensorflow_lite:\n github: spider-gazelle/tensorflow_lite\n ```\n\n2. Run `shards install`\n\n## Usage\n\nSee the specs for basic usage or have a look at [imagine](https://github.com/stakach/imagine/blob/master/src/imagine/models/example_object_detection.cr)\n\n```crystal\nrequire \"tensorflow_lite\"\n```\n\nyou can use the example metadata extractor to obtain the metadata for TF Lite models downloaded from [tfhub.dev](https://tfhub.dev/s?deployment-format=lite)\n\n### With and EdgeTPU\n\nSuch as a Coral USB device\n\n```crystal\nrequire \"tensorflow_lite/edge_tpu\"\n```\n\nTo install the edge tpu delegate:\n\n```bash\n# Add Google Cloud public key\nRUN wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/coral-edgetpu.gpg\n\n# Add Coral packages repository\nRUN echo \"deb [signed-by=/etc/apt/trusted.gpg.d/coral-edgetpu.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main\" | tee /etc/apt/sources.list.d/coral-edgetpu.list\n\n# install the lib\nsudo apt update\nsudo apt install libedgetpu-dev\n```\n\nTo install the [Coral USB drivers](https://coral.ai/docs/accelerator/get-started/#requirements)\n\n```bash\nsudo apt install libedgetpu1-std\n# OR for max frequency\nsudo apt install libedgetpu1-max\n\n# unplug and re-plug the coral or run this\nsudo systemctl restart udev\n```\n\nNOTE:: when using a coral and running `lsusb` you need to look for either:\n\n* Global Unichip Corp.\n* Google Inc.\n\nafter running something on the chip it will [change identity to Google Inc.](https://www.reddit.com/r/Proxmox/comments/nmsknx/proxmox_vm_ubuntu_2004_connect_google_coral_usb/)\n\nAnd you need to include the Google identity version in any docker files.\n\n## Development\n\nTo update tensorflow lite bindings `./generate_bindings.sh`\n\n### lib installation\n\nRequires [libtensorflow](https://www.tensorflow.org/install/lang_c) to be installed, this is handled automatically by `./build_tensorflowlite.sh`\n\n* there is a [guide to building it](https://www.tensorflow.org/lite/guide/build_cmake)\n* you can use `./build_tensorflowlite.sh` to automate this\n* then requires `export LD_LIBRARY_PATH=/usr/local/lib` to run\n* test if installed successfully `crystal ./src/tensorflow_lite.cr`\n * this will output `Launching with tensorflow lite vx.x.x`\n\nNOTE:: the lib is installed for local use via a postinstall script.\nMake sure to distribute `libtensorflowlite_c.so` with your production app\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n* [Stephen von Takach](https://github.com/stakach) - creator and maintainer\n","program":{"html_id":"tensorflow_lite/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"tensorflow_lite","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"tensorflow_lite/TensorflowLite","path":"TensorflowLite.html","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite","abstract":false,"locations":[{"filename":"src/tensorflow_lite.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"2.1.3\""}],"doc":"TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.\n\nIt enables on-device machine learning inference with low latency and a small binary size, which are crucial requirements for these types of devices.","summary":"

TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.

","class_methods":[{"html_id":"schema_version-class-method","name":"schema_version","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite.cr#L20"},"def":{"name":"schema_version","visibility":"Public","body":"LibTensorflowLite.schema_version"}},{"html_id":"version-class-method","name":"version","doc":"the version of the tensorflow lite library in use","summary":"

the version of the tensorflow lite library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite.cr#L16"},"def":{"name":"version","visibility":"Public","body":"String.new(LibTensorflowLite.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Client","path":"TensorflowLite/Client.html","kind":"class","full_name":"TensorflowLite::Client","name":"Client","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/client.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"provides a simplified way to load and manipulate the tensorflow interpreter\n\nthe indexable module provides simplified access to the input tensors","summary":"

provides a simplified way to load and manipulate the tensorflow interpreter

","constructors":[{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"visibility":"Public","body":"Client.new(model, delegate, threads, labels) do |error_message|\n Log.error do\n error_message\n end\nend"}},{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil,&on_error:String->Nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L16"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"on_error","external_name":"on_error","restriction":"(String -> Nil)"},"visibility":"Public","body":"_ = allocate\n_.initialize(model, delegate, threads, labels, &on_error) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(*args,**options)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options)"}},{"html_id":"input_tensor(*args,**options,&)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"input_tensor_count(*args,**options)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options)"}},{"html_id":"input_tensor_count(*args,**options,&)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"interpreter:Interpreter-instance-method","name":"interpreter","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":59,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L59"},"def":{"name":"interpreter","return_type":"Interpreter","visibility":"Public","body":"@interpreter"}},{"html_id":"invoke(*args,**options)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke(*args, **options)"}},{"html_id":"invoke(*args,**options,&)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"invoke!(*args,**options)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke!(*args, **options)"}},{"html_id":"invoke!(*args,**options,&)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke!(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"labels-instance-method","name":"labels","doc":"attempt to extract any labels in the model","summary":"

attempt to extract any labels in the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":103,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L103"},"def":{"name":"labels","visibility":"Public","body":"if (labels = @labels) || @labels_fetched\n labels\nelse\n if path = @model_path\n @labels_fetched = true\n @labels = Utilities::ExtractLabels.from(path)\n else\n if bytes = @model_bytes\n @labels_fetched = true\n @model_bytes = nil\n @labels = Utilities::ExtractLabels.from(bytes)\n end\n end\nend"}},{"html_id":"labels_fetched:Bool-instance-method","name":"labels_fetched","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":98,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L98"},"def":{"name":"labels_fetched","return_type":"Bool","visibility":"Public","body":"@labels_fetched"}},{"html_id":"model:Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":56,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L56"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"model_path:Path|Nil-instance-method","name":"model_path","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":57,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L57"},"def":{"name":"model_path","return_type":"Path | ::Nil","visibility":"Public","body":"@model_path"}},{"html_id":"num_threads(*args,**options)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@options.num_threads(*args, **options)"}},{"html_id":"num_threads(*args,**options,&)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@options.num_threads(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"provide a callback to receive any error messages","summary":"

provide a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L65"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"options.on_error(&callback)"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L58"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output(index:Int=0)-instance-method","name":"output","doc":"returns the output tensor at the provided index","summary":"

returns the output tensor at the provided index

","abstract":false,"args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"args_string":"(index : Int = 0)","args_html":"(index : Int = 0)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":89,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L89"},"def":{"name":"output","args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"visibility":"Public","body":"output_tensor(index)"}},{"html_id":"output_tensor(*args,**options)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options)"}},{"html_id":"output_tensor(*args,**options,&)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"output_tensor_count(*args,**options)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options)"}},{"html_id":"output_tensor_count(*args,**options,&)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"outputs-instance-method","name":"outputs","doc":"returns an array of output tensors","summary":"

returns an array of output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":94,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L94"},"def":{"name":"outputs","visibility":"Public","body":"(0...output_tensor_count).map do |index|\n output_tensor(index)\nend"}},{"html_id":"size-instance-method","name":"size","doc":"the number of input tensors","summary":"

the number of input tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":84,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L84"},"def":{"name":"size","visibility":"Public","body":"input_tensor_count"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Delegate","path":"TensorflowLite/Delegate.html","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate","abstract":true,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/delegate.cr","line_number":6,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/delegate.cr#L6"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).\n\nThis base class allows us to track any delegates added when configuring interpreter options","summary":"

Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).

","instance_methods":[{"html_id":"to_unsafe:Pointer(LibTensorflowLite::OpaqueDelegate)-instance-method","name":"to_unsafe","abstract":true,"location":{"filename":"src/tensorflow_lite/delegate.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/delegate.cr#L7"},"def":{"name":"to_unsafe","return_type":"Pointer(LibTensorflowLite::OpaqueDelegate)","visibility":"Public","body":""}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","path":"TensorflowLite/EdgeTPU.html","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.\n\nGoogle's Coral product line includes various devices that incorporate the Edge TPU, such as the Coral Dev Board, the Coral USB Accelerator, and various system-on-modules (SoMs) and PCI-E cards.","summary":"

An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.

","class_methods":[{"html_id":"devices:Array(Device)-class-method","name":"devices","doc":"the list of Edge TPU devices available on the system","summary":"

the list of Edge TPU devices available on the system

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu.cr#L17"},"def":{"name":"devices","return_type":"Array(Device)","visibility":"Public","body":"if (value = @@devices).nil?\n @@devices = (device_obj.list)\nelse\n value\nend"}},{"html_id":"version:String-class-method","name":"version","doc":"the version of the edge tpu library in use","summary":"

the version of the edge tpu library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu.cr#L9"},"def":{"name":"version","return_type":"String","visibility":"Public","body":"String.new(LibEdgeTPU.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","path":"TensorflowLite/EdgeTPU/Delegate.html","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate","abstract":false,"superclass":{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},"ancestors":[{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/delegate.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"a delegate that can be used with InterpreterOptions#add_delegate","summary":"

a delegate that can be used with InterpreterOptions#add_delegate

","constructors":[{"html_id":"new(type:EdgeTPU::Device::Type,path:String)-class-method","name":"new","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"args_string":"(type : EdgeTPU::Device::Type, path : String)","args_html":"(type : EdgeTPU::Device::Type, path : String)","location":{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/delegate.cr#L5"},"def":{"name":"new","args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(type, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","path":"TensorflowLite/EdgeTPU/Device.html","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"the file path to and type of Edge TPU device","summary":"

the file path to and type of Edge TPU device

","constructors":[{"html_id":"new(device:LibEdgeTPU::Device)-class-method","name":"new","abstract":false,"args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"args_string":"(device : LibEdgeTPU::Device)","args_html":"(device : LibEdgeTPU::Device)","location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L5"},"def":{"name":"new","args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"visibility":"Public","body":"_ = allocate\n_.initialize(device)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"path:String-instance-method","name":"path","doc":"the path to the device","summary":"

the path to the device

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L17"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"to_delegate-instance-method","name":"to_delegate","doc":"creates a delegate object that can be added to with InterpreterOptions#add_delegate","summary":"

creates a delegate object that can be added to with InterpreterOptions#add_delegate

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":23,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L23"},"def":{"name":"to_delegate","visibility":"Public","body":"EdgeTPU::Delegate.new(@type, @path)"}},{"html_id":"type:Type-instance-method","name":"type","doc":"the type of device at the path listed","summary":"

the type of device at the path listed

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L14"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"@type"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device/Type","path":"TensorflowLite/EdgeTPU/Device/Type.html","kind":"alias","full_name":"TensorflowLite::EdgeTPU::Device::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L11"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibEdgeTPU::DeviceType","aliased_html":"LibEdgeTPU::DeviceType","const":false,"constants":[{"id":"EdgetpuApexPci","name":"EdgetpuApexPci","value":"0"},{"id":"EdgetpuApexUsb","name":"EdgetpuApexUsb","value":"1"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device"}}]}]},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","path":"TensorflowLite/Interpreter.html","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L5"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"The Interpreter takes a model, loads it, and allows you to run (or \"interpret\") the model, i.e., to use it to make predictions based on input data.","summary":"

The Interpreter takes a model, loads it, and allows you to run (or "interpret") the model, i.e., to use it to make predictions based on input data.

","constructors":[{"html_id":"new(model:Model,options:InterpreterOptions)-class-method","name":"new","doc":"provide the model and options required for inference","summary":"

provide the model and options required for inference

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"args_string":"(model : Model, options : InterpreterOptions)","args_html":"(model : Model, options : InterpreterOptions)","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model, options)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(index:Int):Tensor-instance-method","name":"input_tensor","doc":"returns the requested input tensor for manipulation and loading of input data","summary":"

returns the requested input tensor for manipulation and loading of input data

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":49,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L49"},"def":{"name":"input_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= input_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_input_tensor(self, index.to_i32))\n"}},{"html_id":"input_tensor_count:Int32-instance-method","name":"input_tensor_count","doc":"the number of input tensors that are used to feed data into the model","summary":"

the number of input tensors that are used to feed data into the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":44,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L44"},"def":{"name":"input_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @input_tensor_count).nil?\n @input_tensor_count = ((LibTensorflowLite.interpreter_get_input_tensor_count(self)).to_i)\nelse\n value\nend"}},{"html_id":"inspect(io:IO):Nil-instance-method","name":"inspect","doc":"Appends a String representation of this object\nwhich includes its class name, its object address\nand the values of all instance variables.\n\n```\nclass Person\n def initialize(@name : String, @age : Int32)\n end\nend\n\nPerson.new(\"John\", 32).inspect # => #\n```","summary":"

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":91,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L91"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << ({{ @type.name.id.stringify }})\nnum_inputs = input_tensor_count\n(io << \"(\\n input count: \") << num_inputs\n(0...num_inputs).each do |index|\n tensor = input_tensor(index)\n (io << \"\\n input - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n inputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nnum_outputs = output_tensor_count\n(io << \"\\n output count: \") << num_outputs\n(0...num_outputs).each do |index|\n tensor = output_tensor(index)\n (io << \"\\n output - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n outputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nio << \"\\n)\"\n"}},{"html_id":"invoke:Status-instance-method","name":"invoke","doc":"runs the model and returns the result status\n\nNOTE: the results are stored in the output tensors","summary":"

runs the model and returns the result status

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":80,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L80"},"def":{"name":"invoke","return_type":"Status","visibility":"Public","body":"LibTensorflowLite.interpreter_invoke(self)"}},{"html_id":"invoke!-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":85,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L85"},"def":{"name":"invoke!","visibility":"Public","body":"result = invoke\nif result.ok?\nelse\n raise(InvokeError.new(\"invoke failed with #{result}\"))\nend\nself\n"}},{"html_id":"model:Model-instance-method","name":"model","doc":"the model this interpreter is running","summary":"

the model this interpreter is running

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L29"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","doc":"the options used to initialize this interpreter","summary":"

the options used to initialize this interpreter

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L32"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output_tensor(index:Int):Tensor-instance-method","name":"output_tensor","doc":"returns the requested output tensor for results extraction","summary":"

returns the requested output tensor for results extraction

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":60,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L60"},"def":{"name":"output_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= output_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_output_tensor(self, index.to_i32))\n"}},{"html_id":"output_tensor_count:Int32-instance-method","name":"output_tensor_count","doc":"the number of output tensors, used to obtain the results of an invokation","summary":"

the number of output tensors, used to obtain the results of an invokation

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":55,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L55"},"def":{"name":"output_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @output_tensor_count).nil?\n @output_tensor_count = ((LibTensorflowLite.interpreter_get_output_tensor_count(self)).to_i)\nelse\n value\nend"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/InvokeError","path":"TensorflowLite/Interpreter/InvokeError.html","kind":"class","full_name":"TensorflowLite::Interpreter::InvokeError","name":"InvokeError","abstract":false,"superclass":{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"tensorflow_lite/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"tensorflow_lite/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"},"doc":"raised if an invokation of a model fails","summary":"

raised if an invokation of a model fails

"},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/Status","path":"TensorflowLite/Interpreter/Status.html","kind":"alias","full_name":"TensorflowLite::Interpreter::Status","name":"Status","abstract":false,"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L65"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Status","aliased_html":"LibTensorflowLite::Status","const":false,"constants":[{"id":"ApplicationError","name":"ApplicationError","value":"3"},{"id":"Cancelled","name":"Cancelled","value":"8"},{"id":"DelegateDataNotFound","name":"DelegateDataNotFound","value":"4"},{"id":"DelegateDataReadError","name":"DelegateDataReadError","value":"6"},{"id":"DelegateDataWriteError","name":"DelegateDataWriteError","value":"5"},{"id":"DelegateError","name":"DelegateError","value":"2"},{"id":"Error","name":"Error","value":"1"},{"id":"Ok","name":"Ok","value":"0"},{"id":"UnresolvedOps","name":"UnresolvedOps","value":"7"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"}}]},{"html_id":"tensorflow_lite/TensorflowLite/InterpreterOptions","path":"TensorflowLite/InterpreterOptions.html","kind":"class","full_name":"TensorflowLite::InterpreterOptions","name":"InterpreterOptions","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L14"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime","summary":"

Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":15,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L15"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"add_delegate(delegate:Delegate)-instance-method","name":"add_delegate","doc":"Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).","summary":"

Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).

","abstract":false,"args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"args_string":"(delegate : Delegate)","args_html":"(delegate : Delegate)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":61,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L61"},"def":{"name":"add_delegate","args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"visibility":"Public","body":"@delegates << delegate\nLibTensorflowLite.interpreter_options_add_delegate(self, delegate)\nself\n"}},{"html_id":"num_threads(count:Int)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.\nThis can be useful for improving performance on devices with multiple CPU cores.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"count","external_name":"count","restriction":"Int"}],"args_string":"(count : Int)","args_html":"(count : Int)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L32"},"def":{"name":"num_threads","args":[{"name":"count","external_name":"count","restriction":"Int"}],"visibility":"Public","body":"LibTensorflowLite.interpreter_options_set_num_threads(self, count.to_i32)"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"define a callback to receive any error messages","summary":"

define a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":37,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L37"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"callback_ptr = Box.box(callback)\n@callback_ref = callback_ptr\nLibTensorflowLite.interpreter_options_set_error_reporter(self, ->(boxed_callback, raw_message, _raw_args) do\n formatted_msg = String.new(raw_message)\n unboxed_callback = Box(typeof(callback)).unbox(boxed_callback)\n unboxed_callback.call(formatted_msg)\n nil\nend, callback_ptr)\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Model","path":"TensorflowLite/Model.html","kind":"class","full_name":"TensorflowLite::Model","name":"Model","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/model.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/model.cr#L9"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.\n\nA TensorFlow Lite model typically has the file extension .tflite.\nThe process of converting a regular TensorFlow model to this format often involves a few steps, such as \"freezing\" the model (converting all its variables to constants), and then applying optimizations like quantization to reduce the size of the model and improve its execution speed.","summary":"

Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.

","constructors":[{"html_id":"new(bytes:Bytes)-class-method","name":"new","doc":"use this to if the tflite model is already loaded into memory","summary":"

use this to if the tflite model is already loaded into memory

","abstract":false,"args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"args_string":"(bytes : Bytes)","args_html":"(bytes : Bytes)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/model.cr#L11"},"def":{"name":"new","args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"visibility":"Public","body":"_ = allocate\n_.initialize(bytes)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(path:Path)-class-method","name":"new","doc":"specify a path to load the tflite model from a file","summary":"

specify a path to load the tflite model from a file

","abstract":false,"args":[{"name":"path","external_name":"path","restriction":"Path"}],"args_string":"(path : Path)","args_html":"(path : Path)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":18,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/model.cr#L18"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Tensor","path":"TensorflowLite/Tensor.html","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L17"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"A tensor is a multi-dimensional array used as the basic data structure.\nThis array can have any number of dimensions, and is used to represent data of various types, such as numeric, boolean, or string values.\n\nThe dimensions of a tensor are often referred to as \"ranks\". For instance:\n\n* A rank 0 tensor is a scalar (a single number).\n* A rank 1 tensor is a vector (a 1D array).\n* A rank 2 tensor is a matrix (a 2D array).\n* A rank 3 tensor is a 3D array, and so on for higher dimensions.\n\nEach tensor in TensorFlow is also associated with a data type (such as float32, int32, or string) and a shape.\nThe shape of a tensor is the number of elements in each dimension.\n\nFor example, a 3x3 matrix has a shape of [3, 3].","summary":"

A tensor is a multi-dimensional array used as the basic data structure.

","constructors":[{"html_id":"new(tf_tensor_ptr:LibTensorflowLite::Tensor)-class-method","name":"new","abstract":false,"args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"args_string":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","args_html":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L20"},"def":{"name":"new","args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"visibility":"Public","body":"_ = allocate\n_.initialize(tf_tensor_ptr)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"as_f-instance-method","name":"as_f","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":138,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L138"},"def":{"name":"as_f","visibility":"Public","body":"as_f64"}},{"html_id":"as_f32-instance-method","name":"as_f32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":128,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L128"},"def":{"name":"as_f32","visibility":"Public","body":"to_type(Float32)"}},{"html_id":"as_f64-instance-method","name":"as_f64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":133,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L133"},"def":{"name":"as_f64","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_i-instance-method","name":"as_i","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":173,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L173"},"def":{"name":"as_i","visibility":"Public","body":"as_i32"}},{"html_id":"as_i16-instance-method","name":"as_i16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":158,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L158"},"def":{"name":"as_i16","visibility":"Public","body":"to_type(Int16)"}},{"html_id":"as_i32-instance-method","name":"as_i32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":168,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L168"},"def":{"name":"as_i32","visibility":"Public","body":"to_type(Int32)"}},{"html_id":"as_i64-instance-method","name":"as_i64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":183,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L183"},"def":{"name":"as_i64","visibility":"Public","body":"to_type(Int64)"}},{"html_id":"as_i8-instance-method","name":"as_i8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":148,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L148"},"def":{"name":"as_i8","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_type-instance-method","name":"as_type","doc":"returns a slice of the data in the correct type","summary":"

returns a slice of the data in the correct type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":188,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L188"},"def":{"name":"as_type","visibility":"Public","body":"case type\nwhen .float32?\n as_f32\nwhen .float64?\n as_f64\nwhen .u_int8?\n as_u8\nwhen .int8?\n as_i8\nwhen .u_int16?\n as_u16\nwhen .int16?\n as_i16\nwhen .u_int32?\n as_u32\nwhen .int32?\n as_i32\nwhen .u_int64?\n as_u64\nwhen .int64?\n as_i64\nelse\n raise(NotImplementedError.new(\"no method for casting to type: #{type}\"))\nend"}},{"html_id":"as_u16-instance-method","name":"as_u16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":153,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L153"},"def":{"name":"as_u16","visibility":"Public","body":"to_type(UInt16)"}},{"html_id":"as_u32-instance-method","name":"as_u32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":163,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L163"},"def":{"name":"as_u32","visibility":"Public","body":"to_type(UInt32)"}},{"html_id":"as_u64-instance-method","name":"as_u64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":178,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L178"},"def":{"name":"as_u64","visibility":"Public","body":"to_type(UInt64)"}},{"html_id":"as_u8-instance-method","name":"as_u8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":143,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L143"},"def":{"name":"as_u8","visibility":"Public","body":"to_type(UInt8)"}},{"html_id":"bytesize:Int32-instance-method","name":"bytesize","doc":"the size of the buffer backing this tensor","summary":"

the size of the buffer backing this tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":42,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L42"},"def":{"name":"bytesize","return_type":"Int32","visibility":"Public","body":"if (value = @bytesize).nil?\n @bytesize = ((LibTensorflowLite.tensor_byte_size(self)).to_i)\nelse\n value\nend"}},{"html_id":"dimension_size(index:Int):Int32-instance-method","name":"dimension_size","doc":"returns the number elements in this dimension or rank index","summary":"

returns the number elements in this dimension or rank index

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Int32","args_html":"(index : Int) : Int32","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":63,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L63"},"def":{"name":"dimension_size","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Int32","visibility":"Public","body":"if index >= dimensions || index < 0\n raise(IndexError.new)\nend\nunsafe_fetch(index)\n"}},{"html_id":"dimensions:Int32-instance-method","name":"dimensions","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":48,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L48"},"def":{"name":"dimensions","return_type":"Int32","visibility":"Public","body":"if (value = @dimensions).nil?\n @dimensions = ((LibTensorflowLite.tensor_num_dims(self)).to_i)\nelse\n value\nend"}},{"html_id":"io_count-instance-method","name":"io_count","doc":"attempts to calculate the number on inputs/outputs based on the type","summary":"

attempts to calculate the number on inputs/outputs based on the type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":86,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L86"},"def":{"name":"io_count","visibility":"Public","body":"klass_size = case type\nwhen .float32?\n sizeof(Float32)\nwhen .float64?\n sizeof(Float64)\nwhen .u_int8?\n sizeof(UInt8)\nwhen .int8?\n sizeof(Int8)\nwhen .u_int16?\n sizeof(UInt16)\nwhen .int16?\n sizeof(Int16)\nwhen .u_int32?\n sizeof(UInt32)\nwhen .int32?\n sizeof(Int32)\nwhen .u_int64?\n sizeof(UInt64)\nwhen .int64?\n sizeof(Int64)\nelse\n return self.reduce do |acc, i|\n acc * i\n end\nend\nbytesize // klass_size\n"}},{"html_id":"name:String-instance-method","name":"name","doc":"The friendly name of the tensor","summary":"

The friendly name of the tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":39,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L39"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"if (value = @name).nil?\n @name = (String.new(LibTensorflowLite.tensor_name(self)))\nelse\n value\nend"}},{"html_id":"rank-instance-method","name":"rank","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":53,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L53"},"def":{"name":"rank","visibility":"Public","body":"dimensions"}},{"html_id":"raw_data:Bytes-instance-method","name":"raw_data","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":74,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L74"},"def":{"name":"raw_data","return_type":"Bytes","visibility":"Public","body":"data_ptr = LibTensorflowLite.tensor_data(self)\nif data_ptr.null?\n raise(\"no tensor data allocated\")\nend\nSlice.new(data_ptr.as(Pointer(UInt8)), bytesize)\n"}},{"html_id":"size-instance-method","name":"size","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L58"},"def":{"name":"size","visibility":"Public","body":"dimensions"}},{"html_id":"to_slice-instance-method","name":"to_slice","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":81,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L81"},"def":{"name":"to_slice","visibility":"Public","body":"raw_data"}},{"html_id":"type:Type-instance-method","name":"type","doc":"The datatype this tensor holds\n\nthe type of data it expects as input or provides as output","summary":"

The datatype this tensor holds

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":34,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L34"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"if (value = @type).nil?\n @type = (LibTensorflowLite.tensor_type(self))\nelse\n value\nend"}}],"macros":[{"html_id":"to_type(klass)-macro","name":"to_type","doc":"type casts the tensor buffer into the appropriate crystal lang type.\n\nreturns a Slice of the provided klass against the buffer for manipulation","summary":"

type casts the tensor buffer into the appropriate crystal lang type.

","abstract":false,"args":[{"name":"klass","external_name":"klass","restriction":""}],"args_string":"(klass)","args_html":"(klass)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":118,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L118"},"def":{"name":"to_type","args":[{"name":"klass","external_name":"klass","restriction":""}],"visibility":"Public","body":" the_type = type\n raise TypeCastError.new(\"can't convert #{the_type} to #{ \n{{ klass }}\n }\") unless the_type == Type::\n{{ klass }}\n\n data_ptr = LibTensorflowLite.tensor_data(self)\n raise \"no tensor data allocated\" if data_ptr.null?\n count = bytesize // sizeof(\n{{ klass }}\n)\n Slice.new(data_ptr.as(Pointer(\n{{ klass }}\n)), count)\n \n"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Tensor/Type","path":"TensorflowLite/Tensor/Type.html","kind":"alias","full_name":"TensorflowLite::Tensor::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L29"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Type","aliased_html":"LibTensorflowLite::Type","const":false,"constants":[{"id":"Bool","name":"Bool","value":"6"},{"id":"Complex128","name":"Complex128","value":"12"},{"id":"Complex64","name":"Complex64","value":"8"},{"id":"Float16","name":"Float16","value":"10"},{"id":"Float32","name":"Float32","value":"1"},{"id":"Float64","name":"Float64","value":"11"},{"id":"Int16","name":"Int16","value":"7"},{"id":"Int32","name":"Int32","value":"2"},{"id":"Int4","name":"Int4","value":"18"},{"id":"Int64","name":"Int64","value":"4"},{"id":"Int8","name":"Int8","value":"9"},{"id":"NoType","name":"NoType","value":"0"},{"id":"Resource","name":"Resource","value":"14"},{"id":"String","name":"String","value":"5"},{"id":"UInt16","name":"UInt16","value":"17"},{"id":"UInt32","name":"UInt32","value":"16"},{"id":"UInt64","name":"UInt64","value":"13"},{"id":"UInt8","name":"UInt8","value":"3"},{"id":"Variant","name":"Variant","value":"15"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Tensor","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor"},"doc":"the type of tensor, i.e. Float32 or Int8 etc","summary":"

the type of tensor, i.e.

"}]},{"html_id":"tensorflow_lite/TensorflowLite/Utilities","path":"TensorflowLite/Utilities.html","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"types":[{"html_id":"tensorflow_lite/TensorflowLite/Utilities/ExtractLabels","path":"TensorflowLite/Utilities/ExtractLabels.html","kind":"module","full_name":"TensorflowLite::Utilities::ExtractLabels","name":"ExtractLabels","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MAGIC_ZIP","name":"MAGIC_ZIP","value":"Bytes[80, 75, 3, 4]","doc":"File type detection\nhttps://github.com/sindresorhus/file-type/blob/main/core.js\nhttps://en.wikipedia.org/wiki/ZIP_(file_format)","summary":"

File type detection https://github.com/sindresorhus/file-type/blob/main/core.js https://en.wikipedia.org/wiki/ZIP_(file_format)

"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Utilities","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities"},"class_methods":[{"html_id":"from(input:Path|Bytes,metadata_file:String=\".txt\"):Array(String)|Nil-class-method","name":"from","doc":"extracts the label names from tensorflow lite model at the path specified","summary":"

extracts the label names from tensorflow lite model at the path specified

","abstract":false,"args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"args_string":"(input : Path | Bytes, metadata_file : String = \".txt\") : Array(String) | Nil","args_html":"(input : Path | Bytes, metadata_file : String = ".txt") : Array(String) | Nil","location":{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/utilities/extract_labels.cr#L11"},"def":{"name":"from","args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"return_type":"Array(String) | ::Nil","visibility":"Public","body":"bytes = case input\nin Path\n File.open(input, &.getb_to_end)\nin Bytes\n input\nend\nio = IO::Memory.new(bytes)\nfound = 0\nfiles = [] of String\nread_buffer = Bytes.new(MAGIC_ZIP.bytesize)\nremaining = bytes.size\nwhile remaining >= MAGIC_ZIP.bytesize\n read_pos = io.pos\n io.read_fully(read_buffer)\n if read_buffer == MAGIC_ZIP\n begin\n zip_data = IO::Memory.new(bytes[read_pos..-1])\n Compress::Zip::Reader.open(zip_data) do |zip|\n zip.each_entry do |entry|\n if entry.file?\n found = found + 1\n Log.debug do\n \"found file -> #{entry.filename}\"\n end\n if entry.filename.ends_with?(metadata_file)\n return entry.io.each_line.to_a\n else\n files << entry.filename\n end\n end\n end\n end\n break\n rescue Compress::Zip::Error\n end\n end\n io.pos = read_pos + 1\n remaining = bytes.size - io.pos\nend\nLog.info do\n \"found #{found} files, no matches: #{files.join(\", \")}\"\nend\nnil\n"}}]}]}]}]}} \ No newline at end of file +{"repository_name":"tensorflow_lite","body":"# tensorflow_lite\n\n[![CI](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml/badge.svg)](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml) A library for running TF Lite models\n\n* once you've trained a model in TensorFlow you can convert it to [TF Lite](https://www.tensorflow.org/lite/models/convert/convert_models#command_line_tool_) for production use\n* inspect the TF Lite model using [netron.app](https://netron.app/)\n* some [good TF models](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md) for object detection (need conversion)\n\nAlso see the [project documentation](https://spider-gazelle.github.io/tensorflow_lite/TensorflowLite/Client.html)\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n tensorflow_lite:\n github: spider-gazelle/tensorflow_lite\n ```\n\n2. Run `shards install`\n\n## Usage\n\nSee the specs for basic usage or have a look at [imagine](https://github.com/stakach/imagine/blob/master/src/imagine/models/example_object_detection.cr)\n\n```crystal\nrequire \"tensorflow_lite\"\n```\n\nyou can use the example metadata extractor to obtain the metadata for TF Lite models downloaded from [tfhub.dev](https://tfhub.dev/s?deployment-format=lite)\n\n### With and EdgeTPU\n\nSuch as a Coral USB device\n\n```crystal\nrequire \"tensorflow_lite/edge_tpu\"\n```\n\nTo install the edge tpu delegate:\n\n```bash\n# Add Google Cloud public key\nRUN wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/coral-edgetpu.gpg\n\n# Add Coral packages repository\nRUN echo \"deb [signed-by=/etc/apt/trusted.gpg.d/coral-edgetpu.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main\" | tee /etc/apt/sources.list.d/coral-edgetpu.list\n\n# install the lib\nsudo apt update\nsudo apt install libedgetpu-dev\n```\n\nTo install the [Coral USB drivers](https://coral.ai/docs/accelerator/get-started/#requirements)\n\n```bash\nsudo apt install libedgetpu1-std\n# OR for max frequency\nsudo apt install libedgetpu1-max\n\n# unplug and re-plug the coral or run this\nsudo systemctl restart udev\n```\n\nNOTE:: when using a coral and running `lsusb` you need to look for either:\n\n* Global Unichip Corp.\n* Google Inc.\n\nafter running something on the chip it will [change identity to Google Inc.](https://www.reddit.com/r/Proxmox/comments/nmsknx/proxmox_vm_ubuntu_2004_connect_google_coral_usb/)\n\nAnd you need to include the Google identity version in any docker files.\n\n## Development\n\nTo update tensorflow lite bindings `./generate_bindings.sh`\n\n### lib installation\n\nRequires [libtensorflow](https://www.tensorflow.org/install/lang_c) to be installed, this is handled automatically by `./build_tensorflowlite.sh`\n\n* there is a [guide to building it](https://www.tensorflow.org/lite/guide/build_cmake)\n* you can use `./build_tensorflowlite.sh` to automate this\n* then requires `export LD_LIBRARY_PATH=/usr/local/lib` to run\n* test if installed successfully `crystal ./src/tensorflow_lite.cr`\n * this will output `Launching with tensorflow lite vx.x.x`\n\nNOTE:: the lib is installed for local use via a postinstall script.\nMake sure to distribute `libtensorflowlite_c.so` with your production app\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n* [Stephen von Takach](https://github.com/stakach) - creator and maintainer\n","program":{"html_id":"tensorflow_lite/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"tensorflow_lite","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"tensorflow_lite/TensorflowLite","path":"TensorflowLite.html","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite","abstract":false,"locations":[{"filename":"src/tensorflow_lite.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"2.1.3\""}],"doc":"TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.\n\nIt enables on-device machine learning inference with low latency and a small binary size, which are crucial requirements for these types of devices.","summary":"

TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.

","class_methods":[{"html_id":"schema_version-class-method","name":"schema_version","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite.cr#L20"},"def":{"name":"schema_version","visibility":"Public","body":"LibTensorflowLite.schema_version"}},{"html_id":"version-class-method","name":"version","doc":"the version of the tensorflow lite library in use","summary":"

the version of the tensorflow lite library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite.cr#L16"},"def":{"name":"version","visibility":"Public","body":"String.new(LibTensorflowLite.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Client","path":"TensorflowLite/Client.html","kind":"class","full_name":"TensorflowLite::Client","name":"Client","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/client.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"provides a simplified way to load and manipulate the tensorflow interpreter\n\nthe indexable module provides simplified access to the input tensors","summary":"

provides a simplified way to load and manipulate the tensorflow interpreter

","constructors":[{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"visibility":"Public","body":"Client.new(model, delegate, threads, labels) do |error_message|\n Log.error do\n error_message\n end\nend"}},{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil,&on_error:String->Nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L16"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"on_error","external_name":"on_error","restriction":"(String -> Nil)"},"visibility":"Public","body":"_ = allocate\n_.initialize(model, delegate, threads, labels, &on_error) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(*args,**options)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options)"}},{"html_id":"input_tensor(*args,**options,&)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"input_tensor_count(*args,**options)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options)"}},{"html_id":"input_tensor_count(*args,**options,&)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"interpreter:Interpreter-instance-method","name":"interpreter","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":59,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L59"},"def":{"name":"interpreter","return_type":"Interpreter","visibility":"Public","body":"@interpreter"}},{"html_id":"invoke(*args,**options)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke(*args, **options)"}},{"html_id":"invoke(*args,**options,&)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"invoke!(*args,**options)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke!(*args, **options)"}},{"html_id":"invoke!(*args,**options,&)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke!(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"labels-instance-method","name":"labels","doc":"attempt to extract any labels in the model","summary":"

attempt to extract any labels in the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":103,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L103"},"def":{"name":"labels","visibility":"Public","body":"if (labels = @labels) || @labels_fetched\n labels\nelse\n if path = @model_path\n @labels_fetched = true\n @labels = Utilities::ExtractLabels.from(path)\n else\n if bytes = @model_bytes\n @labels_fetched = true\n @model_bytes = nil\n @labels = Utilities::ExtractLabels.from(bytes)\n end\n end\nend"}},{"html_id":"labels_fetched:Bool-instance-method","name":"labels_fetched","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":98,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L98"},"def":{"name":"labels_fetched","return_type":"Bool","visibility":"Public","body":"@labels_fetched"}},{"html_id":"model:Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":56,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L56"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"model_path:Path|Nil-instance-method","name":"model_path","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":57,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L57"},"def":{"name":"model_path","return_type":"Path | ::Nil","visibility":"Public","body":"@model_path"}},{"html_id":"num_threads(*args,**options)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@options.num_threads(*args, **options)"}},{"html_id":"num_threads(*args,**options,&)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@options.num_threads(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"provide a callback to receive any error messages","summary":"

provide a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L65"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"options.on_error(&callback)"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L58"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output(index:Int=0)-instance-method","name":"output","doc":"returns the output tensor at the provided index","summary":"

returns the output tensor at the provided index

","abstract":false,"args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"args_string":"(index : Int = 0)","args_html":"(index : Int = 0)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":89,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L89"},"def":{"name":"output","args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"visibility":"Public","body":"output_tensor(index)"}},{"html_id":"output_tensor(*args,**options)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options)"}},{"html_id":"output_tensor(*args,**options,&)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"output_tensor_count(*args,**options)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options)"}},{"html_id":"output_tensor_count(*args,**options,&)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"outputs-instance-method","name":"outputs","doc":"returns an array of output tensors","summary":"

returns an array of output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":94,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L94"},"def":{"name":"outputs","visibility":"Public","body":"(0...output_tensor_count).map do |index|\n output_tensor(index)\nend"}},{"html_id":"size-instance-method","name":"size","doc":"the number of input tensors","summary":"

the number of input tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":84,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L84"},"def":{"name":"size","visibility":"Public","body":"input_tensor_count"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Delegate","path":"TensorflowLite/Delegate.html","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate","abstract":true,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/delegate.cr","line_number":6,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/delegate.cr#L6"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).\n\nThis base class allows us to track any delegates added when configuring interpreter options","summary":"

Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).

","instance_methods":[{"html_id":"to_unsafe:Pointer(LibTensorflowLite::OpaqueDelegate)-instance-method","name":"to_unsafe","abstract":true,"location":{"filename":"src/tensorflow_lite/delegate.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/delegate.cr#L7"},"def":{"name":"to_unsafe","return_type":"Pointer(LibTensorflowLite::OpaqueDelegate)","visibility":"Public","body":""}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","path":"TensorflowLite/EdgeTPU.html","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.\n\nGoogle's Coral product line includes various devices that incorporate the Edge TPU, such as the Coral Dev Board, the Coral USB Accelerator, and various system-on-modules (SoMs) and PCI-E cards.","summary":"

An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.

","class_methods":[{"html_id":"devices:Array(Device)-class-method","name":"devices","doc":"the list of Edge TPU devices available on the system","summary":"

the list of Edge TPU devices available on the system

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu.cr#L17"},"def":{"name":"devices","return_type":"Array(Device)","visibility":"Public","body":"if (value = @@devices).nil?\n @@devices = (device_obj.list)\nelse\n value\nend"}},{"html_id":"version:String-class-method","name":"version","doc":"the version of the edge tpu library in use","summary":"

the version of the edge tpu library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu.cr#L9"},"def":{"name":"version","return_type":"String","visibility":"Public","body":"String.new(LibEdgeTPU.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","path":"TensorflowLite/EdgeTPU/Delegate.html","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate","abstract":false,"superclass":{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},"ancestors":[{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/delegate.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"a delegate that can be used with InterpreterOptions#add_delegate","summary":"

a delegate that can be used with InterpreterOptions#add_delegate

","constructors":[{"html_id":"new(type:EdgeTPU::Device::Type,path:String)-class-method","name":"new","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"args_string":"(type : EdgeTPU::Device::Type, path : String)","args_html":"(type : EdgeTPU::Device::Type, path : String)","location":{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/delegate.cr#L5"},"def":{"name":"new","args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(type, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","path":"TensorflowLite/EdgeTPU/Device.html","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"the file path to and type of Edge TPU device","summary":"

the file path to and type of Edge TPU device

","constructors":[{"html_id":"new(device:LibEdgeTPU::Device)-class-method","name":"new","abstract":false,"args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"args_string":"(device : LibEdgeTPU::Device)","args_html":"(device : LibEdgeTPU::Device)","location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L5"},"def":{"name":"new","args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"visibility":"Public","body":"_ = allocate\n_.initialize(device)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"path:String-instance-method","name":"path","doc":"the path to the device","summary":"

the path to the device

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L17"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"to_delegate-instance-method","name":"to_delegate","doc":"creates a delegate object that can be added to with InterpreterOptions#add_delegate","summary":"

creates a delegate object that can be added to with InterpreterOptions#add_delegate

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":23,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L23"},"def":{"name":"to_delegate","visibility":"Public","body":"EdgeTPU::Delegate.new(@type, @path)"}},{"html_id":"type:Type-instance-method","name":"type","doc":"the type of device at the path listed","summary":"

the type of device at the path listed

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L14"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"@type"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device/Type","path":"TensorflowLite/EdgeTPU/Device/Type.html","kind":"alias","full_name":"TensorflowLite::EdgeTPU::Device::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L11"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibEdgeTPU::DeviceType","aliased_html":"LibEdgeTPU::DeviceType","const":false,"constants":[{"id":"EdgetpuApexPci","name":"EdgetpuApexPci","value":"0"},{"id":"EdgetpuApexUsb","name":"EdgetpuApexUsb","value":"1"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device"}}]}]},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","path":"TensorflowLite/Interpreter.html","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L5"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"The Interpreter takes a model, loads it, and allows you to run (or \"interpret\") the model, i.e., to use it to make predictions based on input data.","summary":"

The Interpreter takes a model, loads it, and allows you to run (or "interpret") the model, i.e., to use it to make predictions based on input data.

","constructors":[{"html_id":"new(model:Model,options:InterpreterOptions)-class-method","name":"new","doc":"provide the model and options required for inference","summary":"

provide the model and options required for inference

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"args_string":"(model : Model, options : InterpreterOptions)","args_html":"(model : Model, options : InterpreterOptions)","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model, options)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(index:Int):Tensor-instance-method","name":"input_tensor","doc":"returns the requested input tensor for manipulation and loading of input data","summary":"

returns the requested input tensor for manipulation and loading of input data

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":49,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L49"},"def":{"name":"input_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= input_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_input_tensor(self, index.to_i32))\n"}},{"html_id":"input_tensor_count:Int32-instance-method","name":"input_tensor_count","doc":"the number of input tensors that are used to feed data into the model","summary":"

the number of input tensors that are used to feed data into the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":44,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L44"},"def":{"name":"input_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @input_tensor_count).nil?\n @input_tensor_count = ((LibTensorflowLite.interpreter_get_input_tensor_count(self)).to_i)\nelse\n value\nend"}},{"html_id":"inspect(io:IO):Nil-instance-method","name":"inspect","doc":"Appends a String representation of this object\nwhich includes its class name, its object address\nand the values of all instance variables.\n\n```\nclass Person\n def initialize(@name : String, @age : Int32)\n end\nend\n\nPerson.new(\"John\", 32).inspect # => #\n```","summary":"

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":91,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L91"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << ({{ @type.name.id.stringify }})\nnum_inputs = input_tensor_count\n(io << \"(\\n input count: \") << num_inputs\n(0...num_inputs).each do |index|\n tensor = input_tensor(index)\n (io << \"\\n input - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n inputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nnum_outputs = output_tensor_count\n(io << \"\\n output count: \") << num_outputs\n(0...num_outputs).each do |index|\n tensor = output_tensor(index)\n (io << \"\\n output - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n outputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nio << \"\\n)\"\n"}},{"html_id":"invoke:Status-instance-method","name":"invoke","doc":"runs the model and returns the result status\n\nNOTE: the results are stored in the output tensors","summary":"

runs the model and returns the result status

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":80,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L80"},"def":{"name":"invoke","return_type":"Status","visibility":"Public","body":"LibTensorflowLite.interpreter_invoke(self)"}},{"html_id":"invoke!-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":85,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L85"},"def":{"name":"invoke!","visibility":"Public","body":"result = invoke\nif result.ok?\nelse\n raise(InvokeError.new(\"invoke failed with #{result}\"))\nend\nself\n"}},{"html_id":"model:Model-instance-method","name":"model","doc":"the model this interpreter is running","summary":"

the model this interpreter is running

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L29"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","doc":"the options used to initialize this interpreter","summary":"

the options used to initialize this interpreter

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L32"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output_tensor(index:Int):Tensor-instance-method","name":"output_tensor","doc":"returns the requested output tensor for results extraction","summary":"

returns the requested output tensor for results extraction

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":60,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L60"},"def":{"name":"output_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= output_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_output_tensor(self, index.to_i32))\n"}},{"html_id":"output_tensor_count:Int32-instance-method","name":"output_tensor_count","doc":"the number of output tensors, used to obtain the results of an invokation","summary":"

the number of output tensors, used to obtain the results of an invokation

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":55,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L55"},"def":{"name":"output_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @output_tensor_count).nil?\n @output_tensor_count = ((LibTensorflowLite.interpreter_get_output_tensor_count(self)).to_i)\nelse\n value\nend"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/InvokeError","path":"TensorflowLite/Interpreter/InvokeError.html","kind":"class","full_name":"TensorflowLite::Interpreter::InvokeError","name":"InvokeError","abstract":false,"superclass":{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"tensorflow_lite/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"tensorflow_lite/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"},"doc":"raised if an invokation of a model fails","summary":"

raised if an invokation of a model fails

"},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/Status","path":"TensorflowLite/Interpreter/Status.html","kind":"alias","full_name":"TensorflowLite::Interpreter::Status","name":"Status","abstract":false,"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L65"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Status","aliased_html":"LibTensorflowLite::Status","const":false,"constants":[{"id":"ApplicationError","name":"ApplicationError","value":"3"},{"id":"Cancelled","name":"Cancelled","value":"8"},{"id":"DelegateDataNotFound","name":"DelegateDataNotFound","value":"4"},{"id":"DelegateDataReadError","name":"DelegateDataReadError","value":"6"},{"id":"DelegateDataWriteError","name":"DelegateDataWriteError","value":"5"},{"id":"DelegateError","name":"DelegateError","value":"2"},{"id":"Error","name":"Error","value":"1"},{"id":"Ok","name":"Ok","value":"0"},{"id":"UnresolvedOps","name":"UnresolvedOps","value":"7"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"}}]},{"html_id":"tensorflow_lite/TensorflowLite/InterpreterOptions","path":"TensorflowLite/InterpreterOptions.html","kind":"class","full_name":"TensorflowLite::InterpreterOptions","name":"InterpreterOptions","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L14"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime","summary":"

Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":15,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L15"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"add_delegate(delegate:Delegate)-instance-method","name":"add_delegate","doc":"Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).","summary":"

Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).

","abstract":false,"args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"args_string":"(delegate : Delegate)","args_html":"(delegate : Delegate)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":61,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L61"},"def":{"name":"add_delegate","args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"visibility":"Public","body":"@delegates << delegate\nLibTensorflowLite.interpreter_options_add_delegate(self, delegate)\nself\n"}},{"html_id":"num_threads(count:Int)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.\nThis can be useful for improving performance on devices with multiple CPU cores.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"count","external_name":"count","restriction":"Int"}],"args_string":"(count : Int)","args_html":"(count : Int)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L32"},"def":{"name":"num_threads","args":[{"name":"count","external_name":"count","restriction":"Int"}],"visibility":"Public","body":"LibTensorflowLite.interpreter_options_set_num_threads(self, count.to_i32)"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"define a callback to receive any error messages","summary":"

define a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":37,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L37"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"callback_ptr = Box.box(callback)\n@callback_ref = callback_ptr\nLibTensorflowLite.interpreter_options_set_error_reporter(self, ->(boxed_callback, raw_message, _raw_args) do\n formatted_msg = String.new(raw_message)\n unboxed_callback = Box(typeof(callback)).unbox(boxed_callback)\n unboxed_callback.call(formatted_msg)\n nil\nend, callback_ptr)\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Model","path":"TensorflowLite/Model.html","kind":"class","full_name":"TensorflowLite::Model","name":"Model","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/model.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/model.cr#L9"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.\n\nA TensorFlow Lite model typically has the file extension .tflite.\nThe process of converting a regular TensorFlow model to this format often involves a few steps, such as \"freezing\" the model (converting all its variables to constants), and then applying optimizations like quantization to reduce the size of the model and improve its execution speed.","summary":"

Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.

","constructors":[{"html_id":"new(bytes:Bytes)-class-method","name":"new","doc":"use this to if the tflite model is already loaded into memory","summary":"

use this to if the tflite model is already loaded into memory

","abstract":false,"args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"args_string":"(bytes : Bytes)","args_html":"(bytes : Bytes)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/model.cr#L11"},"def":{"name":"new","args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"visibility":"Public","body":"_ = allocate\n_.initialize(bytes)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(path:Path)-class-method","name":"new","doc":"specify a path to load the tflite model from a file","summary":"

specify a path to load the tflite model from a file

","abstract":false,"args":[{"name":"path","external_name":"path","restriction":"Path"}],"args_string":"(path : Path)","args_html":"(path : Path)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":18,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/model.cr#L18"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Tensor","path":"TensorflowLite/Tensor.html","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L17"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"A tensor is a multi-dimensional array used as the basic data structure.\nThis array can have any number of dimensions, and is used to represent data of various types, such as numeric, boolean, or string values.\n\nThe dimensions of a tensor are often referred to as \"ranks\". For instance:\n\n* A rank 0 tensor is a scalar (a single number).\n* A rank 1 tensor is a vector (a 1D array).\n* A rank 2 tensor is a matrix (a 2D array).\n* A rank 3 tensor is a 3D array, and so on for higher dimensions.\n\nEach tensor in TensorFlow is also associated with a data type (such as float32, int32, or string) and a shape.\nThe shape of a tensor is the number of elements in each dimension.\n\nFor example, a 3x3 matrix has a shape of [3, 3].","summary":"

A tensor is a multi-dimensional array used as the basic data structure.

","constructors":[{"html_id":"new(tf_tensor_ptr:LibTensorflowLite::Tensor)-class-method","name":"new","abstract":false,"args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"args_string":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","args_html":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L20"},"def":{"name":"new","args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"visibility":"Public","body":"_ = allocate\n_.initialize(tf_tensor_ptr)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"as_f-instance-method","name":"as_f","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":138,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L138"},"def":{"name":"as_f","visibility":"Public","body":"as_f64"}},{"html_id":"as_f32-instance-method","name":"as_f32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":128,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L128"},"def":{"name":"as_f32","visibility":"Public","body":"to_type(Float32)"}},{"html_id":"as_f64-instance-method","name":"as_f64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":133,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L133"},"def":{"name":"as_f64","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_i-instance-method","name":"as_i","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":173,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L173"},"def":{"name":"as_i","visibility":"Public","body":"as_i32"}},{"html_id":"as_i16-instance-method","name":"as_i16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":158,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L158"},"def":{"name":"as_i16","visibility":"Public","body":"to_type(Int16)"}},{"html_id":"as_i32-instance-method","name":"as_i32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":168,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L168"},"def":{"name":"as_i32","visibility":"Public","body":"to_type(Int32)"}},{"html_id":"as_i64-instance-method","name":"as_i64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":183,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L183"},"def":{"name":"as_i64","visibility":"Public","body":"to_type(Int64)"}},{"html_id":"as_i8-instance-method","name":"as_i8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":148,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L148"},"def":{"name":"as_i8","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_type-instance-method","name":"as_type","doc":"returns a slice of the data in the correct type","summary":"

returns a slice of the data in the correct type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":188,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L188"},"def":{"name":"as_type","visibility":"Public","body":"case type\nwhen .float32?\n as_f32\nwhen .float64?\n as_f64\nwhen .u_int8?\n as_u8\nwhen .int8?\n as_i8\nwhen .u_int16?\n as_u16\nwhen .int16?\n as_i16\nwhen .u_int32?\n as_u32\nwhen .int32?\n as_i32\nwhen .u_int64?\n as_u64\nwhen .int64?\n as_i64\nelse\n raise(NotImplementedError.new(\"no method for casting to type: #{type}\"))\nend"}},{"html_id":"as_u16-instance-method","name":"as_u16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":153,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L153"},"def":{"name":"as_u16","visibility":"Public","body":"to_type(UInt16)"}},{"html_id":"as_u32-instance-method","name":"as_u32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":163,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L163"},"def":{"name":"as_u32","visibility":"Public","body":"to_type(UInt32)"}},{"html_id":"as_u64-instance-method","name":"as_u64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":178,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L178"},"def":{"name":"as_u64","visibility":"Public","body":"to_type(UInt64)"}},{"html_id":"as_u8-instance-method","name":"as_u8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":143,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L143"},"def":{"name":"as_u8","visibility":"Public","body":"to_type(UInt8)"}},{"html_id":"bytesize:Int32-instance-method","name":"bytesize","doc":"the size of the buffer backing this tensor","summary":"

the size of the buffer backing this tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":42,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L42"},"def":{"name":"bytesize","return_type":"Int32","visibility":"Public","body":"if (value = @bytesize).nil?\n @bytesize = ((LibTensorflowLite.tensor_byte_size(self)).to_i)\nelse\n value\nend"}},{"html_id":"dimension_size(index:Int):Int32-instance-method","name":"dimension_size","doc":"returns the number elements in this dimension or rank index","summary":"

returns the number elements in this dimension or rank index

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Int32","args_html":"(index : Int) : Int32","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":63,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L63"},"def":{"name":"dimension_size","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Int32","visibility":"Public","body":"if index >= dimensions || index < 0\n raise(IndexError.new)\nend\nunsafe_fetch(index)\n"}},{"html_id":"dimensions:Int32-instance-method","name":"dimensions","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":48,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L48"},"def":{"name":"dimensions","return_type":"Int32","visibility":"Public","body":"if (value = @dimensions).nil?\n @dimensions = ((LibTensorflowLite.tensor_num_dims(self)).to_i)\nelse\n value\nend"}},{"html_id":"io_count-instance-method","name":"io_count","doc":"attempts to calculate the number on inputs/outputs based on the type","summary":"

attempts to calculate the number on inputs/outputs based on the type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":86,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L86"},"def":{"name":"io_count","visibility":"Public","body":"klass_size = case type\nwhen .float32?\n sizeof(Float32)\nwhen .float64?\n sizeof(Float64)\nwhen .u_int8?\n sizeof(UInt8)\nwhen .int8?\n sizeof(Int8)\nwhen .u_int16?\n sizeof(UInt16)\nwhen .int16?\n sizeof(Int16)\nwhen .u_int32?\n sizeof(UInt32)\nwhen .int32?\n sizeof(Int32)\nwhen .u_int64?\n sizeof(UInt64)\nwhen .int64?\n sizeof(Int64)\nelse\n return self.reduce do |acc, i|\n acc * i\n end\nend\nbytesize // klass_size\n"}},{"html_id":"name:String-instance-method","name":"name","doc":"The friendly name of the tensor","summary":"

The friendly name of the tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":39,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L39"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"if (value = @name).nil?\n @name = (String.new(LibTensorflowLite.tensor_name(self)))\nelse\n value\nend"}},{"html_id":"rank-instance-method","name":"rank","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":53,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L53"},"def":{"name":"rank","visibility":"Public","body":"dimensions"}},{"html_id":"raw_data:Bytes-instance-method","name":"raw_data","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":74,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L74"},"def":{"name":"raw_data","return_type":"Bytes","visibility":"Public","body":"data_ptr = LibTensorflowLite.tensor_data(self)\nif data_ptr.null?\n raise(\"no tensor data allocated\")\nend\nSlice.new(data_ptr.as(Pointer(UInt8)), bytesize)\n"}},{"html_id":"size-instance-method","name":"size","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L58"},"def":{"name":"size","visibility":"Public","body":"dimensions"}},{"html_id":"to_slice-instance-method","name":"to_slice","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":81,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L81"},"def":{"name":"to_slice","visibility":"Public","body":"raw_data"}},{"html_id":"type:Type-instance-method","name":"type","doc":"The datatype this tensor holds\n\nthe type of data it expects as input or provides as output","summary":"

The datatype this tensor holds

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":34,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L34"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"if (value = @type).nil?\n @type = (LibTensorflowLite.tensor_type(self))\nelse\n value\nend"}}],"macros":[{"html_id":"to_type(klass)-macro","name":"to_type","doc":"type casts the tensor buffer into the appropriate crystal lang type.\n\nreturns a Slice of the provided klass against the buffer for manipulation","summary":"

type casts the tensor buffer into the appropriate crystal lang type.

","abstract":false,"args":[{"name":"klass","external_name":"klass","restriction":""}],"args_string":"(klass)","args_html":"(klass)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":118,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L118"},"def":{"name":"to_type","args":[{"name":"klass","external_name":"klass","restriction":""}],"visibility":"Public","body":" the_type = type\n raise TypeCastError.new(\"can't convert #{the_type} to #{ \n{{ klass }}\n }\") unless the_type == Type::\n{{ klass }}\n\n data_ptr = LibTensorflowLite.tensor_data(self)\n raise \"no tensor data allocated\" if data_ptr.null?\n count = bytesize // sizeof(\n{{ klass }}\n)\n Slice.new(data_ptr.as(Pointer(\n{{ klass }}\n)), count)\n \n"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Tensor/Type","path":"TensorflowLite/Tensor/Type.html","kind":"alias","full_name":"TensorflowLite::Tensor::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L29"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Type","aliased_html":"LibTensorflowLite::Type","const":false,"constants":[{"id":"Bool","name":"Bool","value":"6"},{"id":"Complex128","name":"Complex128","value":"12"},{"id":"Complex64","name":"Complex64","value":"8"},{"id":"Float16","name":"Float16","value":"10"},{"id":"Float32","name":"Float32","value":"1"},{"id":"Float64","name":"Float64","value":"11"},{"id":"Int16","name":"Int16","value":"7"},{"id":"Int32","name":"Int32","value":"2"},{"id":"Int4","name":"Int4","value":"18"},{"id":"Int64","name":"Int64","value":"4"},{"id":"Int8","name":"Int8","value":"9"},{"id":"NoType","name":"NoType","value":"0"},{"id":"Resource","name":"Resource","value":"14"},{"id":"String","name":"String","value":"5"},{"id":"UInt16","name":"UInt16","value":"17"},{"id":"UInt32","name":"UInt32","value":"16"},{"id":"UInt64","name":"UInt64","value":"13"},{"id":"UInt8","name":"UInt8","value":"3"},{"id":"Variant","name":"Variant","value":"15"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Tensor","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor"},"doc":"the type of tensor, i.e. Float32 or Int8 etc","summary":"

the type of tensor, i.e.

"}]},{"html_id":"tensorflow_lite/TensorflowLite/Utilities","path":"TensorflowLite/Utilities.html","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"types":[{"html_id":"tensorflow_lite/TensorflowLite/Utilities/ExtractLabels","path":"TensorflowLite/Utilities/ExtractLabels.html","kind":"module","full_name":"TensorflowLite::Utilities::ExtractLabels","name":"ExtractLabels","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MAGIC_ZIP","name":"MAGIC_ZIP","value":"Bytes[80, 75, 3, 4]","doc":"File type detection\nhttps://github.com/sindresorhus/file-type/blob/main/core.js\nhttps://en.wikipedia.org/wiki/ZIP_(file_format)","summary":"

File type detection https://github.com/sindresorhus/file-type/blob/main/core.js https://en.wikipedia.org/wiki/ZIP_(file_format)

"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Utilities","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities"},"class_methods":[{"html_id":"from(input:Path|Bytes,metadata_file:String=\".txt\"):Array(String)|Nil-class-method","name":"from","doc":"extracts the label names from tensorflow lite model at the path specified","summary":"

extracts the label names from tensorflow lite model at the path specified

","abstract":false,"args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"args_string":"(input : Path | Bytes, metadata_file : String = \".txt\") : Array(String) | Nil","args_html":"(input : Path | Bytes, metadata_file : String = ".txt") : Array(String) | Nil","location":{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/utilities/extract_labels.cr#L11"},"def":{"name":"from","args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"return_type":"Array(String) | ::Nil","visibility":"Public","body":"bytes = case input\nin Path\n File.open(input, &.getb_to_end)\nin Bytes\n input\nend\nio = IO::Memory.new(bytes)\nfound = 0\nfiles = [] of String\nread_buffer = Bytes.new(MAGIC_ZIP.bytesize)\nremaining = bytes.size\nwhile remaining >= MAGIC_ZIP.bytesize\n read_pos = io.pos\n io.read_fully(read_buffer)\n if read_buffer == MAGIC_ZIP\n begin\n zip_data = IO::Memory.new(bytes[read_pos..-1])\n Compress::Zip::Reader.open(zip_data) do |zip|\n zip.each_entry do |entry|\n if entry.file?\n found = found + 1\n Log.debug do\n \"found file -> #{entry.filename}\"\n end\n if entry.filename.ends_with?(metadata_file)\n return entry.io.each_line.to_a\n else\n files << entry.filename\n end\n end\n end\n end\n break\n rescue Compress::Zip::Error\n end\n end\n io.pos = read_pos + 1\n remaining = bytes.size - io.pos\nend\nLog.info do\n \"found #{found} files, no matches: #{files.join(\", \")}\"\nend\nnil\n"}}]}]}]}]}} \ No newline at end of file diff --git a/search-index.js b/search-index.js index 2c07bef..9b1a11f 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"tensorflow_lite","body":"# tensorflow_lite\n\n[![CI](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml/badge.svg)](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml) A library for running TF Lite models\n\n* once you've trained a model in TensorFlow you can convert it to [TF Lite](https://www.tensorflow.org/lite/models/convert/convert_models#command_line_tool_) for production use\n* inspect the TF Lite model using [netron.app](https://netron.app/)\n* some [good TF models](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md) for object detection (need conversion)\n\nAlso see the [project documentation](https://spider-gazelle.github.io/tensorflow_lite/TensorflowLite/Client.html)\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n tensorflow_lite:\n github: spider-gazelle/tensorflow_lite\n ```\n\n2. Run `shards install`\n\n## Usage\n\nSee the specs for basic usage or have a look at [imagine](https://github.com/stakach/imagine/blob/master/src/imagine/models/example_object_detection.cr)\n\n```crystal\nrequire \"tensorflow_lite\"\n```\n\nyou can use the example metadata extractor to obtain the metadata for TF Lite models downloaded from [tfhub.dev](https://tfhub.dev/s?deployment-format=lite)\n\n### With and EdgeTPU\n\nSuch as a Coral USB device\n\n```crystal\nrequire \"tensorflow_lite/edge_tpu\"\n```\n\nTo install the edge tpu delegate:\n\n```bash\n# Add Google Cloud public key\nRUN wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/coral-edgetpu.gpg\n\n# Add Coral packages repository\nRUN echo \"deb [signed-by=/etc/apt/trusted.gpg.d/coral-edgetpu.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main\" | tee /etc/apt/sources.list.d/coral-edgetpu.list\n\n# install the lib\nsudo apt update\nsudo apt install libedgetpu-dev\n```\n\nTo install the [Coral USB drivers](https://coral.ai/docs/accelerator/get-started/#requirements)\n\n```bash\nsudo apt install libedgetpu1-std\n# OR for max frequency\nsudo apt install libedgetpu1-max\n\n# unplug and re-plug the coral or run this\nsudo systemctl restart udev\n```\n\nNOTE:: when using a coral and running `lsusb` you need to look for either:\n\n* Global Unichip Corp.\n* Google Inc.\n\nafter running something on the chip it will [change identity to Google Inc.](https://www.reddit.com/r/Proxmox/comments/nmsknx/proxmox_vm_ubuntu_2004_connect_google_coral_usb/)\n\nAnd you need to include the Google identity version in any docker files.\n\n## Development\n\nTo update tensorflow lite bindings `./generate_bindings.sh`\n\n### lib installation\n\nRequires [libtensorflow](https://www.tensorflow.org/install/lang_c) to be installed, this is handled automatically by `./build_tensorflowlite.sh`\n\n* there is a [guide to building it](https://www.tensorflow.org/lite/guide/build_cmake)\n* you can use `./build_tensorflowlite.sh` to automate this\n* then requires `export LD_LIBRARY_PATH=/usr/local/lib` to run\n* test if installed successfully `crystal ./src/tensorflow_lite.cr`\n * this will output `Launching with tensorflow lite vx.x.x`\n\nNOTE:: the lib is installed for local use via a postinstall script.\nMake sure to distribute `libtensorflowlite_c.so` with your production app\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n* [Stephen von Takach](https://github.com/stakach) - creator and maintainer\n","program":{"html_id":"tensorflow_lite/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"tensorflow_lite","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"tensorflow_lite/TensorflowLite","path":"TensorflowLite.html","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite","abstract":false,"locations":[{"filename":"src/tensorflow_lite.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"2.1.3\""}],"doc":"TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.\n\nIt enables on-device machine learning inference with low latency and a small binary size, which are crucial requirements for these types of devices.","summary":"

TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.

","class_methods":[{"html_id":"schema_version-class-method","name":"schema_version","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite.cr#L20"},"def":{"name":"schema_version","visibility":"Public","body":"LibTensorflowLite.schema_version"}},{"html_id":"version-class-method","name":"version","doc":"the version of the tensorflow lite library in use","summary":"

the version of the tensorflow lite library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite.cr#L16"},"def":{"name":"version","visibility":"Public","body":"String.new(LibTensorflowLite.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Client","path":"TensorflowLite/Client.html","kind":"class","full_name":"TensorflowLite::Client","name":"Client","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/client.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"provides a simplified way to load and manipulate the tensorflow interpreter\n\nthe indexable module provides simplified access to the input tensors","summary":"

provides a simplified way to load and manipulate the tensorflow interpreter

","constructors":[{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"visibility":"Public","body":"Client.new(model, delegate, threads, labels) do |error_message|\n Log.error do\n error_message\n end\nend"}},{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil,&on_error:String->Nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L16"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"on_error","external_name":"on_error","restriction":"(String -> Nil)"},"visibility":"Public","body":"_ = allocate\n_.initialize(model, delegate, threads, labels, &on_error) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(*args,**options)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options)"}},{"html_id":"input_tensor(*args,**options,&)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"input_tensor_count(*args,**options)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options)"}},{"html_id":"input_tensor_count(*args,**options,&)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"interpreter:Interpreter-instance-method","name":"interpreter","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":59,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L59"},"def":{"name":"interpreter","return_type":"Interpreter","visibility":"Public","body":"@interpreter"}},{"html_id":"invoke(*args,**options)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke(*args, **options)"}},{"html_id":"invoke(*args,**options,&)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"invoke!(*args,**options)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke!(*args, **options)"}},{"html_id":"invoke!(*args,**options,&)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke!(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"labels-instance-method","name":"labels","doc":"attempt to extract any labels in the model","summary":"

attempt to extract any labels in the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":103,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L103"},"def":{"name":"labels","visibility":"Public","body":"if (labels = @labels) || @labels_fetched\n labels\nelse\n if path = @model_path\n @labels_fetched = true\n @labels = Utilities::ExtractLabels.from(path)\n else\n if bytes = @model_bytes\n @labels_fetched = true\n @model_bytes = nil\n @labels = Utilities::ExtractLabels.from(bytes)\n end\n end\nend"}},{"html_id":"labels_fetched:Bool-instance-method","name":"labels_fetched","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":98,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L98"},"def":{"name":"labels_fetched","return_type":"Bool","visibility":"Public","body":"@labels_fetched"}},{"html_id":"model:Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":56,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L56"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"model_path:Path|Nil-instance-method","name":"model_path","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":57,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L57"},"def":{"name":"model_path","return_type":"Path | ::Nil","visibility":"Public","body":"@model_path"}},{"html_id":"num_threads(*args,**options)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@options.num_threads(*args, **options)"}},{"html_id":"num_threads(*args,**options,&)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@options.num_threads(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"provide a callback to receive any error messages","summary":"

provide a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L65"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"options.on_error(&callback)"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L58"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output(index:Int=0)-instance-method","name":"output","doc":"returns the output tensor at the provided index","summary":"

returns the output tensor at the provided index

","abstract":false,"args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"args_string":"(index : Int = 0)","args_html":"(index : Int = 0)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":89,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L89"},"def":{"name":"output","args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"visibility":"Public","body":"output_tensor(index)"}},{"html_id":"output_tensor(*args,**options)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options)"}},{"html_id":"output_tensor(*args,**options,&)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"output_tensor_count(*args,**options)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options)"}},{"html_id":"output_tensor_count(*args,**options,&)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"outputs-instance-method","name":"outputs","doc":"returns an array of output tensors","summary":"

returns an array of output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":94,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L94"},"def":{"name":"outputs","visibility":"Public","body":"(0...output_tensor_count).map do |index|\n output_tensor(index)\nend"}},{"html_id":"size-instance-method","name":"size","doc":"the number of input tensors","summary":"

the number of input tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":84,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/client.cr#L84"},"def":{"name":"size","visibility":"Public","body":"input_tensor_count"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Delegate","path":"TensorflowLite/Delegate.html","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate","abstract":true,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/delegate.cr","line_number":6,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/delegate.cr#L6"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).\n\nThis base class allows us to track any delegates added when configuring interpreter options","summary":"

Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).

","instance_methods":[{"html_id":"to_unsafe:Pointer(LibTensorflowLite::OpaqueDelegate)-instance-method","name":"to_unsafe","abstract":true,"location":{"filename":"src/tensorflow_lite/delegate.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/delegate.cr#L7"},"def":{"name":"to_unsafe","return_type":"Pointer(LibTensorflowLite::OpaqueDelegate)","visibility":"Public","body":""}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","path":"TensorflowLite/EdgeTPU.html","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.\n\nGoogle's Coral product line includes various devices that incorporate the Edge TPU, such as the Coral Dev Board, the Coral USB Accelerator, and various system-on-modules (SoMs) and PCI-E cards.","summary":"

An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.

","class_methods":[{"html_id":"devices:Array(Device)-class-method","name":"devices","doc":"the list of Edge TPU devices available on the system","summary":"

the list of Edge TPU devices available on the system

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu.cr#L17"},"def":{"name":"devices","return_type":"Array(Device)","visibility":"Public","body":"if (value = @@devices).nil?\n @@devices = (device_obj.list)\nelse\n value\nend"}},{"html_id":"version:String-class-method","name":"version","doc":"the version of the edge tpu library in use","summary":"

the version of the edge tpu library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu.cr#L9"},"def":{"name":"version","return_type":"String","visibility":"Public","body":"String.new(LibEdgeTPU.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","path":"TensorflowLite/EdgeTPU/Delegate.html","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate","abstract":false,"superclass":{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},"ancestors":[{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/delegate.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"a delegate that can be used with InterpreterOptions#add_delegate","summary":"

a delegate that can be used with InterpreterOptions#add_delegate

","constructors":[{"html_id":"new(type:EdgeTPU::Device::Type,path:String)-class-method","name":"new","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"args_string":"(type : EdgeTPU::Device::Type, path : String)","args_html":"(type : EdgeTPU::Device::Type, path : String)","location":{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/delegate.cr#L5"},"def":{"name":"new","args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(type, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","path":"TensorflowLite/EdgeTPU/Device.html","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"the file path to and type of Edge TPU device","summary":"

the file path to and type of Edge TPU device

","constructors":[{"html_id":"new(device:LibEdgeTPU::Device)-class-method","name":"new","abstract":false,"args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"args_string":"(device : LibEdgeTPU::Device)","args_html":"(device : LibEdgeTPU::Device)","location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L5"},"def":{"name":"new","args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"visibility":"Public","body":"_ = allocate\n_.initialize(device)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"path:String-instance-method","name":"path","doc":"the path to the device","summary":"

the path to the device

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L17"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"to_delegate-instance-method","name":"to_delegate","doc":"creates a delegate object that can be added to with InterpreterOptions#add_delegate","summary":"

creates a delegate object that can be added to with InterpreterOptions#add_delegate

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":23,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L23"},"def":{"name":"to_delegate","visibility":"Public","body":"EdgeTPU::Delegate.new(@type, @path)"}},{"html_id":"type:Type-instance-method","name":"type","doc":"the type of device at the path listed","summary":"

the type of device at the path listed

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L14"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"@type"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device/Type","path":"TensorflowLite/EdgeTPU/Device/Type.html","kind":"alias","full_name":"TensorflowLite::EdgeTPU::Device::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/edge_tpu/device.cr#L11"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibEdgeTPU::DeviceType","aliased_html":"LibEdgeTPU::DeviceType","const":false,"constants":[{"id":"EdgetpuApexPci","name":"EdgetpuApexPci","value":"0"},{"id":"EdgetpuApexUsb","name":"EdgetpuApexUsb","value":"1"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device"}}]}]},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","path":"TensorflowLite/Interpreter.html","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L5"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"The Interpreter takes a model, loads it, and allows you to run (or \"interpret\") the model, i.e., to use it to make predictions based on input data.","summary":"

The Interpreter takes a model, loads it, and allows you to run (or "interpret") the model, i.e., to use it to make predictions based on input data.

","constructors":[{"html_id":"new(model:Model,options:InterpreterOptions)-class-method","name":"new","doc":"provide the model and options required for inference","summary":"

provide the model and options required for inference

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"args_string":"(model : Model, options : InterpreterOptions)","args_html":"(model : Model, options : InterpreterOptions)","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model, options)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(index:Int):Tensor-instance-method","name":"input_tensor","doc":"returns the requested input tensor for manipulation and loading of input data","summary":"

returns the requested input tensor for manipulation and loading of input data

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":49,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L49"},"def":{"name":"input_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= input_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_input_tensor(self, index.to_i32))\n"}},{"html_id":"input_tensor_count:Int32-instance-method","name":"input_tensor_count","doc":"the number of input tensors that are used to feed data into the model","summary":"

the number of input tensors that are used to feed data into the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":44,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L44"},"def":{"name":"input_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @input_tensor_count).nil?\n @input_tensor_count = ((LibTensorflowLite.interpreter_get_input_tensor_count(self)).to_i)\nelse\n value\nend"}},{"html_id":"inspect(io:IO):Nil-instance-method","name":"inspect","doc":"Appends a String representation of this object\nwhich includes its class name, its object address\nand the values of all instance variables.\n\n```\nclass Person\n def initialize(@name : String, @age : Int32)\n end\nend\n\nPerson.new(\"John\", 32).inspect # => #\n```","summary":"

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":91,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L91"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << ({{ @type.name.id.stringify }})\nnum_inputs = input_tensor_count\n(io << \"(\\n input count: \") << num_inputs\n(0...num_inputs).each do |index|\n tensor = input_tensor(index)\n (io << \"\\n input - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n inputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nnum_outputs = output_tensor_count\n(io << \"\\n output count: \") << num_outputs\n(0...num_outputs).each do |index|\n tensor = output_tensor(index)\n (io << \"\\n output - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n outputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nio << \"\\n)\"\n"}},{"html_id":"invoke:Status-instance-method","name":"invoke","doc":"runs the model and returns the result status\n\nNOTE: the results are stored in the output tensors","summary":"

runs the model and returns the result status

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":80,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L80"},"def":{"name":"invoke","return_type":"Status","visibility":"Public","body":"LibTensorflowLite.interpreter_invoke(self)"}},{"html_id":"invoke!-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":85,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L85"},"def":{"name":"invoke!","visibility":"Public","body":"result = invoke\nif result.ok?\nelse\n raise(InvokeError.new(\"invoke failed with #{result}\"))\nend\nself\n"}},{"html_id":"model:Model-instance-method","name":"model","doc":"the model this interpreter is running","summary":"

the model this interpreter is running

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L29"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","doc":"the options used to initialize this interpreter","summary":"

the options used to initialize this interpreter

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L32"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output_tensor(index:Int):Tensor-instance-method","name":"output_tensor","doc":"returns the requested output tensor for results extraction","summary":"

returns the requested output tensor for results extraction

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":60,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L60"},"def":{"name":"output_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= output_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_output_tensor(self, index.to_i32))\n"}},{"html_id":"output_tensor_count:Int32-instance-method","name":"output_tensor_count","doc":"the number of output tensors, used to obtain the results of an invokation","summary":"

the number of output tensors, used to obtain the results of an invokation

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":55,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L55"},"def":{"name":"output_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @output_tensor_count).nil?\n @output_tensor_count = ((LibTensorflowLite.interpreter_get_output_tensor_count(self)).to_i)\nelse\n value\nend"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/InvokeError","path":"TensorflowLite/Interpreter/InvokeError.html","kind":"class","full_name":"TensorflowLite::Interpreter::InvokeError","name":"InvokeError","abstract":false,"superclass":{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"tensorflow_lite/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"tensorflow_lite/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"},"doc":"raised if an invokation of a model fails","summary":"

raised if an invokation of a model fails

"},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/Status","path":"TensorflowLite/Interpreter/Status.html","kind":"alias","full_name":"TensorflowLite::Interpreter::Status","name":"Status","abstract":false,"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter.cr#L65"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Status","aliased_html":"LibTensorflowLite::Status","const":false,"constants":[{"id":"ApplicationError","name":"ApplicationError","value":"3"},{"id":"Cancelled","name":"Cancelled","value":"8"},{"id":"DelegateDataNotFound","name":"DelegateDataNotFound","value":"4"},{"id":"DelegateDataReadError","name":"DelegateDataReadError","value":"6"},{"id":"DelegateDataWriteError","name":"DelegateDataWriteError","value":"5"},{"id":"DelegateError","name":"DelegateError","value":"2"},{"id":"Error","name":"Error","value":"1"},{"id":"Ok","name":"Ok","value":"0"},{"id":"UnresolvedOps","name":"UnresolvedOps","value":"7"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"}}]},{"html_id":"tensorflow_lite/TensorflowLite/InterpreterOptions","path":"TensorflowLite/InterpreterOptions.html","kind":"class","full_name":"TensorflowLite::InterpreterOptions","name":"InterpreterOptions","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L14"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime","summary":"

Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":15,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L15"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"add_delegate(delegate:Delegate)-instance-method","name":"add_delegate","doc":"Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).","summary":"

Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).

","abstract":false,"args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"args_string":"(delegate : Delegate)","args_html":"(delegate : Delegate)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":61,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L61"},"def":{"name":"add_delegate","args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"visibility":"Public","body":"@delegates << delegate\nLibTensorflowLite.interpreter_options_add_delegate(self, delegate)\nself\n"}},{"html_id":"num_threads(count:Int)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.\nThis can be useful for improving performance on devices with multiple CPU cores.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"count","external_name":"count","restriction":"Int"}],"args_string":"(count : Int)","args_html":"(count : Int)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L32"},"def":{"name":"num_threads","args":[{"name":"count","external_name":"count","restriction":"Int"}],"visibility":"Public","body":"LibTensorflowLite.interpreter_options_set_num_threads(self, count.to_i32)"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"define a callback to receive any error messages","summary":"

define a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":37,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/interpreter_options.cr#L37"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"callback_ptr = Box.box(callback)\n@callback_ref = callback_ptr\nLibTensorflowLite.interpreter_options_set_error_reporter(self, ->(boxed_callback, raw_message, _raw_args) do\n formatted_msg = String.new(raw_message)\n unboxed_callback = Box(typeof(callback)).unbox(boxed_callback)\n unboxed_callback.call(formatted_msg)\n nil\nend, callback_ptr)\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Model","path":"TensorflowLite/Model.html","kind":"class","full_name":"TensorflowLite::Model","name":"Model","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/model.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/model.cr#L9"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.\n\nA TensorFlow Lite model typically has the file extension .tflite.\nThe process of converting a regular TensorFlow model to this format often involves a few steps, such as \"freezing\" the model (converting all its variables to constants), and then applying optimizations like quantization to reduce the size of the model and improve its execution speed.","summary":"

Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.

","constructors":[{"html_id":"new(bytes:Bytes)-class-method","name":"new","doc":"use this to if the tflite model is already loaded into memory","summary":"

use this to if the tflite model is already loaded into memory

","abstract":false,"args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"args_string":"(bytes : Bytes)","args_html":"(bytes : Bytes)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/model.cr#L11"},"def":{"name":"new","args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"visibility":"Public","body":"_ = allocate\n_.initialize(bytes)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(path:Path)-class-method","name":"new","doc":"specify a path to load the tflite model from a file","summary":"

specify a path to load the tflite model from a file

","abstract":false,"args":[{"name":"path","external_name":"path","restriction":"Path"}],"args_string":"(path : Path)","args_html":"(path : Path)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":18,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/model.cr#L18"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Tensor","path":"TensorflowLite/Tensor.html","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L17"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"A tensor is a multi-dimensional array used as the basic data structure.\nThis array can have any number of dimensions, and is used to represent data of various types, such as numeric, boolean, or string values.\n\nThe dimensions of a tensor are often referred to as \"ranks\". For instance:\n\n* A rank 0 tensor is a scalar (a single number).\n* A rank 1 tensor is a vector (a 1D array).\n* A rank 2 tensor is a matrix (a 2D array).\n* A rank 3 tensor is a 3D array, and so on for higher dimensions.\n\nEach tensor in TensorFlow is also associated with a data type (such as float32, int32, or string) and a shape.\nThe shape of a tensor is the number of elements in each dimension.\n\nFor example, a 3x3 matrix has a shape of [3, 3].","summary":"

A tensor is a multi-dimensional array used as the basic data structure.

","constructors":[{"html_id":"new(tf_tensor_ptr:LibTensorflowLite::Tensor)-class-method","name":"new","abstract":false,"args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"args_string":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","args_html":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L20"},"def":{"name":"new","args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"visibility":"Public","body":"_ = allocate\n_.initialize(tf_tensor_ptr)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"as_f-instance-method","name":"as_f","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":138,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L138"},"def":{"name":"as_f","visibility":"Public","body":"as_f64"}},{"html_id":"as_f32-instance-method","name":"as_f32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":128,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L128"},"def":{"name":"as_f32","visibility":"Public","body":"to_type(Float32)"}},{"html_id":"as_f64-instance-method","name":"as_f64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":133,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L133"},"def":{"name":"as_f64","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_i-instance-method","name":"as_i","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":173,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L173"},"def":{"name":"as_i","visibility":"Public","body":"as_i32"}},{"html_id":"as_i16-instance-method","name":"as_i16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":158,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L158"},"def":{"name":"as_i16","visibility":"Public","body":"to_type(Int16)"}},{"html_id":"as_i32-instance-method","name":"as_i32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":168,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L168"},"def":{"name":"as_i32","visibility":"Public","body":"to_type(Int32)"}},{"html_id":"as_i64-instance-method","name":"as_i64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":183,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L183"},"def":{"name":"as_i64","visibility":"Public","body":"to_type(Int64)"}},{"html_id":"as_i8-instance-method","name":"as_i8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":148,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L148"},"def":{"name":"as_i8","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_type-instance-method","name":"as_type","doc":"returns a slice of the data in the correct type","summary":"

returns a slice of the data in the correct type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":188,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L188"},"def":{"name":"as_type","visibility":"Public","body":"case type\nwhen .float32?\n as_f32\nwhen .float64?\n as_f64\nwhen .u_int8?\n as_u8\nwhen .int8?\n as_i8\nwhen .u_int16?\n as_u16\nwhen .int16?\n as_i16\nwhen .u_int32?\n as_u32\nwhen .int32?\n as_i32\nwhen .u_int64?\n as_u64\nwhen .int64?\n as_i64\nelse\n raise(NotImplementedError.new(\"no method for casting to type: #{type}\"))\nend"}},{"html_id":"as_u16-instance-method","name":"as_u16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":153,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L153"},"def":{"name":"as_u16","visibility":"Public","body":"to_type(UInt16)"}},{"html_id":"as_u32-instance-method","name":"as_u32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":163,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L163"},"def":{"name":"as_u32","visibility":"Public","body":"to_type(UInt32)"}},{"html_id":"as_u64-instance-method","name":"as_u64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":178,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L178"},"def":{"name":"as_u64","visibility":"Public","body":"to_type(UInt64)"}},{"html_id":"as_u8-instance-method","name":"as_u8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":143,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L143"},"def":{"name":"as_u8","visibility":"Public","body":"to_type(UInt8)"}},{"html_id":"bytesize:Int32-instance-method","name":"bytesize","doc":"the size of the buffer backing this tensor","summary":"

the size of the buffer backing this tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":42,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L42"},"def":{"name":"bytesize","return_type":"Int32","visibility":"Public","body":"if (value = @bytesize).nil?\n @bytesize = ((LibTensorflowLite.tensor_byte_size(self)).to_i)\nelse\n value\nend"}},{"html_id":"dimension_size(index:Int):Int32-instance-method","name":"dimension_size","doc":"returns the number elements in this dimension or rank index","summary":"

returns the number elements in this dimension or rank index

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Int32","args_html":"(index : Int) : Int32","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":63,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L63"},"def":{"name":"dimension_size","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Int32","visibility":"Public","body":"if index >= dimensions || index < 0\n raise(IndexError.new)\nend\nunsafe_fetch(index)\n"}},{"html_id":"dimensions:Int32-instance-method","name":"dimensions","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":48,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L48"},"def":{"name":"dimensions","return_type":"Int32","visibility":"Public","body":"if (value = @dimensions).nil?\n @dimensions = ((LibTensorflowLite.tensor_num_dims(self)).to_i)\nelse\n value\nend"}},{"html_id":"io_count-instance-method","name":"io_count","doc":"attempts to calculate the number on inputs/outputs based on the type","summary":"

attempts to calculate the number on inputs/outputs based on the type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":86,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L86"},"def":{"name":"io_count","visibility":"Public","body":"klass_size = case type\nwhen .float32?\n sizeof(Float32)\nwhen .float64?\n sizeof(Float64)\nwhen .u_int8?\n sizeof(UInt8)\nwhen .int8?\n sizeof(Int8)\nwhen .u_int16?\n sizeof(UInt16)\nwhen .int16?\n sizeof(Int16)\nwhen .u_int32?\n sizeof(UInt32)\nwhen .int32?\n sizeof(Int32)\nwhen .u_int64?\n sizeof(UInt64)\nwhen .int64?\n sizeof(Int64)\nelse\n return self.reduce do |acc, i|\n acc * i\n end\nend\nbytesize // klass_size\n"}},{"html_id":"name:String-instance-method","name":"name","doc":"The friendly name of the tensor","summary":"

The friendly name of the tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":39,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L39"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"if (value = @name).nil?\n @name = (String.new(LibTensorflowLite.tensor_name(self)))\nelse\n value\nend"}},{"html_id":"rank-instance-method","name":"rank","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":53,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L53"},"def":{"name":"rank","visibility":"Public","body":"dimensions"}},{"html_id":"raw_data:Bytes-instance-method","name":"raw_data","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":74,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L74"},"def":{"name":"raw_data","return_type":"Bytes","visibility":"Public","body":"data_ptr = LibTensorflowLite.tensor_data(self)\nif data_ptr.null?\n raise(\"no tensor data allocated\")\nend\nSlice.new(data_ptr.as(Pointer(UInt8)), bytesize)\n"}},{"html_id":"size-instance-method","name":"size","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L58"},"def":{"name":"size","visibility":"Public","body":"dimensions"}},{"html_id":"to_slice-instance-method","name":"to_slice","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":81,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L81"},"def":{"name":"to_slice","visibility":"Public","body":"raw_data"}},{"html_id":"type:Type-instance-method","name":"type","doc":"The datatype this tensor holds\n\nthe type of data it expects as input or provides as output","summary":"

The datatype this tensor holds

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":34,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L34"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"if (value = @type).nil?\n @type = (LibTensorflowLite.tensor_type(self))\nelse\n value\nend"}}],"macros":[{"html_id":"to_type(klass)-macro","name":"to_type","doc":"type casts the tensor buffer into the appropriate crystal lang type.\n\nreturns a Slice of the provided klass against the buffer for manipulation","summary":"

type casts the tensor buffer into the appropriate crystal lang type.

","abstract":false,"args":[{"name":"klass","external_name":"klass","restriction":""}],"args_string":"(klass)","args_html":"(klass)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":118,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L118"},"def":{"name":"to_type","args":[{"name":"klass","external_name":"klass","restriction":""}],"visibility":"Public","body":" the_type = type\n raise TypeCastError.new(\"can't convert #{the_type} to #{ \n{{ klass }}\n }\") unless the_type == Type::\n{{ klass }}\n\n data_ptr = LibTensorflowLite.tensor_data(self)\n raise \"no tensor data allocated\" if data_ptr.null?\n count = bytesize // sizeof(\n{{ klass }}\n)\n Slice.new(data_ptr.as(Pointer(\n{{ klass }}\n)), count)\n \n"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Tensor/Type","path":"TensorflowLite/Tensor/Type.html","kind":"alias","full_name":"TensorflowLite::Tensor::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/tensor.cr#L29"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Type","aliased_html":"LibTensorflowLite::Type","const":false,"constants":[{"id":"Bool","name":"Bool","value":"6"},{"id":"Complex128","name":"Complex128","value":"12"},{"id":"Complex64","name":"Complex64","value":"8"},{"id":"Float16","name":"Float16","value":"10"},{"id":"Float32","name":"Float32","value":"1"},{"id":"Float64","name":"Float64","value":"11"},{"id":"Int16","name":"Int16","value":"7"},{"id":"Int32","name":"Int32","value":"2"},{"id":"Int4","name":"Int4","value":"18"},{"id":"Int64","name":"Int64","value":"4"},{"id":"Int8","name":"Int8","value":"9"},{"id":"NoType","name":"NoType","value":"0"},{"id":"Resource","name":"Resource","value":"14"},{"id":"String","name":"String","value":"5"},{"id":"UInt16","name":"UInt16","value":"17"},{"id":"UInt32","name":"UInt32","value":"16"},{"id":"UInt64","name":"UInt64","value":"13"},{"id":"UInt8","name":"UInt8","value":"3"},{"id":"Variant","name":"Variant","value":"15"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Tensor","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor"},"doc":"the type of tensor, i.e. Float32 or Int8 etc","summary":"

the type of tensor, i.e.

"}]},{"html_id":"tensorflow_lite/TensorflowLite/Utilities","path":"TensorflowLite/Utilities.html","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"types":[{"html_id":"tensorflow_lite/TensorflowLite/Utilities/ExtractLabels","path":"TensorflowLite/Utilities/ExtractLabels.html","kind":"module","full_name":"TensorflowLite::Utilities::ExtractLabels","name":"ExtractLabels","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MAGIC_ZIP","name":"MAGIC_ZIP","value":"Bytes[80, 75, 3, 4]","doc":"File type detection\nhttps://github.com/sindresorhus/file-type/blob/main/core.js\nhttps://en.wikipedia.org/wiki/ZIP_(file_format)","summary":"

File type detection https://github.com/sindresorhus/file-type/blob/main/core.js https://en.wikipedia.org/wiki/ZIP_(file_format)

"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Utilities","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities"},"class_methods":[{"html_id":"from(input:Path|Bytes,metadata_file:String=\".txt\"):Array(String)|Nil-class-method","name":"from","doc":"extracts the label names from tensorflow lite model at the path specified","summary":"

extracts the label names from tensorflow lite model at the path specified

","abstract":false,"args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"args_string":"(input : Path | Bytes, metadata_file : String = \".txt\") : Array(String) | Nil","args_html":"(input : Path | Bytes, metadata_file : String = ".txt") : Array(String) | Nil","location":{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/b95eb9a202cde13d9142b7e1381c5180c37ec6b8/src/tensorflow_lite/utilities/extract_labels.cr#L11"},"def":{"name":"from","args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"return_type":"Array(String) | ::Nil","visibility":"Public","body":"bytes = case input\nin Path\n File.open(input, &.getb_to_end)\nin Bytes\n input\nend\nio = IO::Memory.new(bytes)\nfound = 0\nfiles = [] of String\nread_buffer = Bytes.new(MAGIC_ZIP.bytesize)\nremaining = bytes.size\nwhile remaining >= MAGIC_ZIP.bytesize\n read_pos = io.pos\n io.read_fully(read_buffer)\n if read_buffer == MAGIC_ZIP\n begin\n zip_data = IO::Memory.new(bytes[read_pos..-1])\n Compress::Zip::Reader.open(zip_data) do |zip|\n zip.each_entry do |entry|\n if entry.file?\n found = found + 1\n Log.debug do\n \"found file -> #{entry.filename}\"\n end\n if entry.filename.ends_with?(metadata_file)\n return entry.io.each_line.to_a\n else\n files << entry.filename\n end\n end\n end\n end\n break\n rescue Compress::Zip::Error\n end\n end\n io.pos = read_pos + 1\n remaining = bytes.size - io.pos\nend\nLog.info do\n \"found #{found} files, no matches: #{files.join(\", \")}\"\nend\nnil\n"}}]}]}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"tensorflow_lite","body":"# tensorflow_lite\n\n[![CI](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml/badge.svg)](https://github.com/spider-gazelle/tensorflow_lite/actions/workflows/ci.yml) A library for running TF Lite models\n\n* once you've trained a model in TensorFlow you can convert it to [TF Lite](https://www.tensorflow.org/lite/models/convert/convert_models#command_line_tool_) for production use\n* inspect the TF Lite model using [netron.app](https://netron.app/)\n* some [good TF models](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md) for object detection (need conversion)\n\nAlso see the [project documentation](https://spider-gazelle.github.io/tensorflow_lite/TensorflowLite/Client.html)\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n tensorflow_lite:\n github: spider-gazelle/tensorflow_lite\n ```\n\n2. Run `shards install`\n\n## Usage\n\nSee the specs for basic usage or have a look at [imagine](https://github.com/stakach/imagine/blob/master/src/imagine/models/example_object_detection.cr)\n\n```crystal\nrequire \"tensorflow_lite\"\n```\n\nyou can use the example metadata extractor to obtain the metadata for TF Lite models downloaded from [tfhub.dev](https://tfhub.dev/s?deployment-format=lite)\n\n### With and EdgeTPU\n\nSuch as a Coral USB device\n\n```crystal\nrequire \"tensorflow_lite/edge_tpu\"\n```\n\nTo install the edge tpu delegate:\n\n```bash\n# Add Google Cloud public key\nRUN wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/coral-edgetpu.gpg\n\n# Add Coral packages repository\nRUN echo \"deb [signed-by=/etc/apt/trusted.gpg.d/coral-edgetpu.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main\" | tee /etc/apt/sources.list.d/coral-edgetpu.list\n\n# install the lib\nsudo apt update\nsudo apt install libedgetpu-dev\n```\n\nTo install the [Coral USB drivers](https://coral.ai/docs/accelerator/get-started/#requirements)\n\n```bash\nsudo apt install libedgetpu1-std\n# OR for max frequency\nsudo apt install libedgetpu1-max\n\n# unplug and re-plug the coral or run this\nsudo systemctl restart udev\n```\n\nNOTE:: when using a coral and running `lsusb` you need to look for either:\n\n* Global Unichip Corp.\n* Google Inc.\n\nafter running something on the chip it will [change identity to Google Inc.](https://www.reddit.com/r/Proxmox/comments/nmsknx/proxmox_vm_ubuntu_2004_connect_google_coral_usb/)\n\nAnd you need to include the Google identity version in any docker files.\n\n## Development\n\nTo update tensorflow lite bindings `./generate_bindings.sh`\n\n### lib installation\n\nRequires [libtensorflow](https://www.tensorflow.org/install/lang_c) to be installed, this is handled automatically by `./build_tensorflowlite.sh`\n\n* there is a [guide to building it](https://www.tensorflow.org/lite/guide/build_cmake)\n* you can use `./build_tensorflowlite.sh` to automate this\n* then requires `export LD_LIBRARY_PATH=/usr/local/lib` to run\n* test if installed successfully `crystal ./src/tensorflow_lite.cr`\n * this will output `Launching with tensorflow lite vx.x.x`\n\nNOTE:: the lib is installed for local use via a postinstall script.\nMake sure to distribute `libtensorflowlite_c.so` with your production app\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n* [Stephen von Takach](https://github.com/stakach) - creator and maintainer\n","program":{"html_id":"tensorflow_lite/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"tensorflow_lite","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"tensorflow_lite/TensorflowLite","path":"TensorflowLite.html","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite","abstract":false,"locations":[{"filename":"src/tensorflow_lite.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"2.1.3\""}],"doc":"TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.\n\nIt enables on-device machine learning inference with low latency and a small binary size, which are crucial requirements for these types of devices.","summary":"

TensorFlow Lite is a set of tools provided by Google to run TensorFlow models on mobile, embedded, and IoT devices.

","class_methods":[{"html_id":"schema_version-class-method","name":"schema_version","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite.cr#L20"},"def":{"name":"schema_version","visibility":"Public","body":"LibTensorflowLite.schema_version"}},{"html_id":"version-class-method","name":"version","doc":"the version of the tensorflow lite library in use","summary":"

the version of the tensorflow lite library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite.cr#L16"},"def":{"name":"version","visibility":"Public","body":"String.new(LibTensorflowLite.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Client","path":"TensorflowLite/Client.html","kind":"class","full_name":"TensorflowLite::Client","name":"Client","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/client.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"provides a simplified way to load and manipulate the tensorflow interpreter\n\nthe indexable module provides simplified access to the input tensors","summary":"

provides a simplified way to load and manipulate the tensorflow interpreter

","constructors":[{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"visibility":"Public","body":"Client.new(model, delegate, threads, labels) do |error_message|\n Log.error do\n error_message\n end\nend"}},{"html_id":"new(model:URI|Bytes|Path|Model|String,delegate:Delegate|Nil=nil,threads:Int|Nil=nil,labels:URI|Array(String)|Nil=nil,&on_error:String->Nil)-class-method","name":"new","doc":"Configures the tensorflow interpreter with the options provided","summary":"

Configures the tensorflow interpreter with the options provided

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"args_string":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","args_html":"(model : URI | Bytes | Path | Model | String, delegate : Delegate | Nil = nil, threads : Int | Nil = nil, labels : URI | Array(String) | Nil = nil, &on_error : String -> Nil)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":16,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L16"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"URI | Bytes | Path | Model | String"},{"name":"delegate","default_value":"nil","external_name":"delegate","restriction":"Delegate | ::Nil"},{"name":"threads","default_value":"nil","external_name":"threads","restriction":"Int | ::Nil"},{"name":"labels","default_value":"nil","external_name":"labels","restriction":"URI | Array(String) | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"on_error","external_name":"on_error","restriction":"(String -> Nil)"},"visibility":"Public","body":"_ = allocate\n_.initialize(model, delegate, threads, labels, &on_error) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(*args,**options)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options)"}},{"html_id":"input_tensor(*args,**options,&)-instance-method","name":"input_tensor","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"input_tensor_count(*args,**options)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options)"}},{"html_id":"input_tensor_count(*args,**options,&)-instance-method","name":"input_tensor_count","doc":"input tensor details for manipulation and loading of input data","summary":"

input tensor details for manipulation and loading of input data

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":70,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L70"},"def":{"name":"input_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.input_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"interpreter:Interpreter-instance-method","name":"interpreter","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":59,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L59"},"def":{"name":"interpreter","return_type":"Interpreter","visibility":"Public","body":"@interpreter"}},{"html_id":"invoke(*args,**options)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke(*args, **options)"}},{"html_id":"invoke(*args,**options,&)-instance-method","name":"invoke","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"invoke!(*args,**options)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.invoke!(*args, **options)"}},{"html_id":"invoke!(*args,**options,&)-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":73,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L73"},"def":{"name":"invoke!","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.invoke!(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"labels-instance-method","name":"labels","doc":"attempt to extract any labels in the model","summary":"

attempt to extract any labels in the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":103,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L103"},"def":{"name":"labels","visibility":"Public","body":"if (labels = @labels) || @labels_fetched\n labels\nelse\n if path = @model_path\n @labels_fetched = true\n @labels = Utilities::ExtractLabels.from(path)\n else\n if bytes = @model_bytes\n @labels_fetched = true\n @model_bytes = nil\n @labels = Utilities::ExtractLabels.from(bytes)\n end\n end\nend"}},{"html_id":"labels_fetched:Bool-instance-method","name":"labels_fetched","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":98,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L98"},"def":{"name":"labels_fetched","return_type":"Bool","visibility":"Public","body":"@labels_fetched"}},{"html_id":"model:Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":56,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L56"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"model_path:Path|Nil-instance-method","name":"model_path","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":57,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L57"},"def":{"name":"model_path","return_type":"Path | ::Nil","visibility":"Public","body":"@model_path"}},{"html_id":"num_threads(*args,**options)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@options.num_threads(*args, **options)"}},{"html_id":"num_threads(*args,**options,&)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":62,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L62"},"def":{"name":"num_threads","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@options.num_threads(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"provide a callback to receive any error messages","summary":"

provide a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L65"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"options.on_error(&callback)"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L58"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output(index:Int=0)-instance-method","name":"output","doc":"returns the output tensor at the provided index","summary":"

returns the output tensor at the provided index

","abstract":false,"args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"args_string":"(index : Int = 0)","args_html":"(index : Int = 0)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":89,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L89"},"def":{"name":"output","args":[{"name":"index","default_value":"0","external_name":"index","restriction":"Int"}],"visibility":"Public","body":"output_tensor(index)"}},{"html_id":"output_tensor(*args,**options)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options)"}},{"html_id":"output_tensor(*args,**options,&)-instance-method","name":"output_tensor","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"output_tensor_count(*args,**options)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options)"}},{"html_id":"output_tensor_count(*args,**options,&)-instance-method","name":"output_tensor_count","doc":"output tensors details, used to obtain the results of an invokation","summary":"

output tensors details, used to obtain the results of an invokation

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/tensorflow_lite/client.cr","line_number":76,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L76"},"def":{"name":"output_tensor_count","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@interpreter.output_tensor_count(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"outputs-instance-method","name":"outputs","doc":"returns an array of output tensors","summary":"

returns an array of output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":94,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L94"},"def":{"name":"outputs","visibility":"Public","body":"(0...output_tensor_count).map do |index|\n output_tensor(index)\nend"}},{"html_id":"size-instance-method","name":"size","doc":"the number of input tensors","summary":"

the number of input tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/client.cr","line_number":84,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/client.cr#L84"},"def":{"name":"size","visibility":"Public","body":"input_tensor_count"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Delegate","path":"TensorflowLite/Delegate.html","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate","abstract":true,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/delegate.cr","line_number":6,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/delegate.cr#L6"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).\n\nThis base class allows us to track any delegates added when configuring interpreter options","summary":"

Delegates enable hardware acceleration of TensorFlow Lite models by leveraging on-device accelerators such as the GPU and Digital Signal Processor (DSP).

","instance_methods":[{"html_id":"to_unsafe:Pointer(LibTensorflowLite::OpaqueDelegate)-instance-method","name":"to_unsafe","abstract":true,"location":{"filename":"src/tensorflow_lite/delegate.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/delegate.cr#L7"},"def":{"name":"to_unsafe","return_type":"Pointer(LibTensorflowLite::OpaqueDelegate)","visibility":"Public","body":""}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","path":"TensorflowLite/EdgeTPU.html","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.\n\nGoogle's Coral product line includes various devices that incorporate the Edge TPU, such as the Coral Dev Board, the Coral USB Accelerator, and various system-on-modules (SoMs) and PCI-E cards.","summary":"

An Edge TPU (Tensor Processing Unit) is a small ASIC (Application-Specific Integrated Circuit) designed for accelerating machine learning workloads at the edge, that is, on devices like smartphones, IoT devices, and embedded systems.

","class_methods":[{"html_id":"devices:Array(Device)-class-method","name":"devices","doc":"the list of Edge TPU devices available on the system","summary":"

the list of Edge TPU devices available on the system

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu.cr#L17"},"def":{"name":"devices","return_type":"Array(Device)","visibility":"Public","body":"if (value = @@devices).nil?\n @@devices = (device_obj.list)\nelse\n value\nend"}},{"html_id":"version:String-class-method","name":"version","doc":"the version of the edge tpu library in use","summary":"

the version of the edge tpu library in use

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu.cr#L9"},"def":{"name":"version","return_type":"String","visibility":"Public","body":"String.new(LibEdgeTPU.version)"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Delegate","path":"TensorflowLite/EdgeTPU/Delegate.html","kind":"class","full_name":"TensorflowLite::EdgeTPU::Delegate","name":"Delegate","abstract":false,"superclass":{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},"ancestors":[{"html_id":"tensorflow_lite/TensorflowLite/Delegate","kind":"class","full_name":"TensorflowLite::Delegate","name":"Delegate"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/delegate.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"a delegate that can be used with InterpreterOptions#add_delegate","summary":"

a delegate that can be used with InterpreterOptions#add_delegate

","constructors":[{"html_id":"new(type:EdgeTPU::Device::Type,path:String)-class-method","name":"new","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"args_string":"(type : EdgeTPU::Device::Type, path : String)","args_html":"(type : EdgeTPU::Device::Type, path : String)","location":{"filename":"src/tensorflow_lite/edge_tpu/delegate.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/delegate.cr#L5"},"def":{"name":"new","args":[{"name":"type","external_name":"type","restriction":"EdgeTPU::Device::Type"},{"name":"path","external_name":"path","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(type, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","path":"TensorflowLite/EdgeTPU/Device.html","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU","kind":"module","full_name":"TensorflowLite::EdgeTPU","name":"EdgeTPU"},"doc":"the file path to and type of Edge TPU device","summary":"

the file path to and type of Edge TPU device

","constructors":[{"html_id":"new(device:LibEdgeTPU::Device)-class-method","name":"new","abstract":false,"args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"args_string":"(device : LibEdgeTPU::Device)","args_html":"(device : LibEdgeTPU::Device)","location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L5"},"def":{"name":"new","args":[{"name":"device","external_name":"device","restriction":"LibEdgeTPU::Device"}],"visibility":"Public","body":"_ = allocate\n_.initialize(device)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"path:String-instance-method","name":"path","doc":"the path to the device","summary":"

the path to the device

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L17"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"to_delegate-instance-method","name":"to_delegate","doc":"creates a delegate object that can be added to with InterpreterOptions#add_delegate","summary":"

creates a delegate object that can be added to with InterpreterOptions#add_delegate

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":23,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L23"},"def":{"name":"to_delegate","visibility":"Public","body":"EdgeTPU::Delegate.new(@type, @path)"}},{"html_id":"type:Type-instance-method","name":"type","doc":"the type of device at the path listed","summary":"

the type of device at the path listed

","abstract":false,"location":{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L14"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"@type"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device/Type","path":"TensorflowLite/EdgeTPU/Device/Type.html","kind":"alias","full_name":"TensorflowLite::EdgeTPU::Device::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/edge_tpu/device.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/edge_tpu/device.cr#L11"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibEdgeTPU::DeviceType","aliased_html":"LibEdgeTPU::DeviceType","const":false,"constants":[{"id":"EdgetpuApexPci","name":"EdgetpuApexPci","value":"0"},{"id":"EdgetpuApexUsb","name":"EdgetpuApexUsb","value":"1"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/EdgeTPU/Device","kind":"struct","full_name":"TensorflowLite::EdgeTPU::Device","name":"Device"}}]}]},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","path":"TensorflowLite/Interpreter.html","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":5,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L5"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"The Interpreter takes a model, loads it, and allows you to run (or \"interpret\") the model, i.e., to use it to make predictions based on input data.","summary":"

The Interpreter takes a model, loads it, and allows you to run (or "interpret") the model, i.e., to use it to make predictions based on input data.

","constructors":[{"html_id":"new(model:Model,options:InterpreterOptions)-class-method","name":"new","doc":"provide the model and options required for inference","summary":"

provide the model and options required for inference

","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"args_string":"(model : Model, options : InterpreterOptions)","args_html":"(model : Model, options : InterpreterOptions)","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L11"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Model"},{"name":"options","external_name":"options","restriction":"InterpreterOptions"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model, options)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"input_tensor(index:Int):Tensor-instance-method","name":"input_tensor","doc":"returns the requested input tensor for manipulation and loading of input data","summary":"

returns the requested input tensor for manipulation and loading of input data

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":49,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L49"},"def":{"name":"input_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= input_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_input_tensor(self, index.to_i32))\n"}},{"html_id":"input_tensor_count:Int32-instance-method","name":"input_tensor_count","doc":"the number of input tensors that are used to feed data into the model","summary":"

the number of input tensors that are used to feed data into the model

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":44,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L44"},"def":{"name":"input_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @input_tensor_count).nil?\n @input_tensor_count = ((LibTensorflowLite.interpreter_get_input_tensor_count(self)).to_i)\nelse\n value\nend"}},{"html_id":"inspect(io:IO):Nil-instance-method","name":"inspect","doc":"Appends a String representation of this object\nwhich includes its class name, its object address\nand the values of all instance variables.\n\n```\nclass Person\n def initialize(@name : String, @age : Int32)\n end\nend\n\nPerson.new(\"John\", 32).inspect # => #\n```","summary":"

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":91,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L91"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"io << ({{ @type.name.id.stringify }})\nnum_inputs = input_tensor_count\n(io << \"(\\n input count: \") << num_inputs\n(0...num_inputs).each do |index|\n tensor = input_tensor(index)\n (io << \"\\n input - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n inputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nnum_outputs = output_tensor_count\n(io << \"\\n output count: \") << num_outputs\n(0...num_outputs).each do |index|\n tensor = output_tensor(index)\n (io << \"\\n output - \") << tensor.name\n (io << \"\\n type: \") << tensor.type\n begin\n (io << \"\\n outputs: \") << tensor.io_count\n rescue\n (io << \"\\n bytesize: \") << tensor.bytesize\n end\n (io << \"\\n dimensions: \") << (tensor.map(&.to_s).join(\"x\"))\nend\nio << \"\\n)\"\n"}},{"html_id":"invoke:Status-instance-method","name":"invoke","doc":"runs the model and returns the result status\n\nNOTE: the results are stored in the output tensors","summary":"

runs the model and returns the result status

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":80,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L80"},"def":{"name":"invoke","return_type":"Status","visibility":"Public","body":"LibTensorflowLite.interpreter_invoke(self)"}},{"html_id":"invoke!-instance-method","name":"invoke!","doc":"run the model, processing the input tensors and updating the output tensors","summary":"

run the model, processing the input tensors and updating the output tensors

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":85,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L85"},"def":{"name":"invoke!","visibility":"Public","body":"result = invoke\nif result.ok?\nelse\n raise(InvokeError.new(\"invoke failed with #{result}\"))\nend\nself\n"}},{"html_id":"model:Model-instance-method","name":"model","doc":"the model this interpreter is running","summary":"

the model this interpreter is running

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L29"},"def":{"name":"model","return_type":"Model","visibility":"Public","body":"@model"}},{"html_id":"options:InterpreterOptions-instance-method","name":"options","doc":"the options used to initialize this interpreter","summary":"

the options used to initialize this interpreter

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L32"},"def":{"name":"options","return_type":"InterpreterOptions","visibility":"Public","body":"@options"}},{"html_id":"output_tensor(index:Int):Tensor-instance-method","name":"output_tensor","doc":"returns the requested output tensor for results extraction","summary":"

returns the requested output tensor for results extraction

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Tensor","args_html":"(index : Int) : Tensor","location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":60,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L60"},"def":{"name":"output_tensor","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Tensor","visibility":"Public","body":"if index >= output_tensor_count || index < 0\n raise(IndexError.new)\nend\nTensor.new(LibTensorflowLite.interpreter_get_output_tensor(self, index.to_i32))\n"}},{"html_id":"output_tensor_count:Int32-instance-method","name":"output_tensor_count","doc":"the number of output tensors, used to obtain the results of an invokation","summary":"

the number of output tensors, used to obtain the results of an invokation

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter.cr","line_number":55,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L55"},"def":{"name":"output_tensor_count","return_type":"Int32","visibility":"Public","body":"if (value = @output_tensor_count).nil?\n @output_tensor_count = ((LibTensorflowLite.interpreter_get_output_tensor_count(self)).to_i)\nelse\n value\nend"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/InvokeError","path":"TensorflowLite/Interpreter/InvokeError.html","kind":"class","full_name":"TensorflowLite::Interpreter::InvokeError","name":"InvokeError","abstract":false,"superclass":{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"tensorflow_lite/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"tensorflow_lite/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"tensorflow_lite/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":7,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L7"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"},"doc":"raised if an invokation of a model fails","summary":"

raised if an invokation of a model fails

"},{"html_id":"tensorflow_lite/TensorflowLite/Interpreter/Status","path":"TensorflowLite/Interpreter/Status.html","kind":"alias","full_name":"TensorflowLite::Interpreter::Status","name":"Status","abstract":false,"locations":[{"filename":"src/tensorflow_lite/interpreter.cr","line_number":65,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter.cr#L65"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Status","aliased_html":"LibTensorflowLite::Status","const":false,"constants":[{"id":"ApplicationError","name":"ApplicationError","value":"3"},{"id":"Cancelled","name":"Cancelled","value":"8"},{"id":"DelegateDataNotFound","name":"DelegateDataNotFound","value":"4"},{"id":"DelegateDataReadError","name":"DelegateDataReadError","value":"6"},{"id":"DelegateDataWriteError","name":"DelegateDataWriteError","value":"5"},{"id":"DelegateError","name":"DelegateError","value":"2"},{"id":"Error","name":"Error","value":"1"},{"id":"Ok","name":"Ok","value":"0"},{"id":"UnresolvedOps","name":"UnresolvedOps","value":"7"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Interpreter","kind":"class","full_name":"TensorflowLite::Interpreter","name":"Interpreter"}}]},{"html_id":"tensorflow_lite/TensorflowLite/InterpreterOptions","path":"TensorflowLite/InterpreterOptions.html","kind":"class","full_name":"TensorflowLite::InterpreterOptions","name":"InterpreterOptions","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":14,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L14"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime","summary":"

Interpreter options provide a way to configure various aspects of the TensorFlow Lite runtime

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":15,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L15"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"add_delegate(delegate:Delegate)-instance-method","name":"add_delegate","doc":"Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).","summary":"

Delegates are mechanisms that allow the interpreter to offload some or all of the model execution to hardware accelerators, like the GPU, DSP, or specialized Neural Processing Units (NPUs).

","abstract":false,"args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"args_string":"(delegate : Delegate)","args_html":"(delegate : Delegate)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":61,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L61"},"def":{"name":"add_delegate","args":[{"name":"delegate","external_name":"delegate","restriction":"Delegate"}],"visibility":"Public","body":"@delegates << delegate\nLibTensorflowLite.interpreter_options_add_delegate(self, delegate)\nself\n"}},{"html_id":"num_threads(count:Int)-instance-method","name":"num_threads","doc":"This controls the number of CPU threads that the interpreter will use for its computations.\nThis can be useful for improving performance on devices with multiple CPU cores.","summary":"

This controls the number of CPU threads that the interpreter will use for its computations.

","abstract":false,"args":[{"name":"count","external_name":"count","restriction":"Int"}],"args_string":"(count : Int)","args_html":"(count : Int)","location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":32,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L32"},"def":{"name":"num_threads","args":[{"name":"count","external_name":"count","restriction":"Int"}],"visibility":"Public","body":"LibTensorflowLite.interpreter_options_set_num_threads(self, count.to_i32)"}},{"html_id":"on_error(&callback:String->Nil)-instance-method","name":"on_error","doc":"define a callback to receive any error messages","summary":"

define a callback to receive any error messages

","abstract":false,"location":{"filename":"src/tensorflow_lite/interpreter_options.cr","line_number":37,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/interpreter_options.cr#L37"},"def":{"name":"on_error","yields":1,"block_arity":1,"block_arg":{"name":"callback","external_name":"callback","restriction":"(String -> Nil)"},"visibility":"Public","body":"callback_ptr = Box.box(callback)\n@callback_ref = callback_ptr\nLibTensorflowLite.interpreter_options_set_error_reporter(self, ->(boxed_callback, raw_message, _raw_args) do\n formatted_msg = String.new(raw_message)\n unboxed_callback = Box(typeof(callback)).unbox(boxed_callback)\n unboxed_callback.call(formatted_msg)\n nil\nend, callback_ptr)\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Model","path":"TensorflowLite/Model.html","kind":"class","full_name":"TensorflowLite::Model","name":"Model","abstract":false,"superclass":{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"tensorflow_lite/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/model.cr","line_number":9,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/model.cr#L9"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.\n\nA TensorFlow Lite model typically has the file extension .tflite.\nThe process of converting a regular TensorFlow model to this format often involves a few steps, such as \"freezing\" the model (converting all its variables to constants), and then applying optimizations like quantization to reduce the size of the model and improve its execution speed.","summary":"

Models are a machine learning model that has been trained using TensorFlow and then converted into a format that is optimized for on-device use.

","constructors":[{"html_id":"new(bytes:Bytes)-class-method","name":"new","doc":"use this to if the tflite model is already loaded into memory","summary":"

use this to if the tflite model is already loaded into memory

","abstract":false,"args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"args_string":"(bytes : Bytes)","args_html":"(bytes : Bytes)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/model.cr#L11"},"def":{"name":"new","args":[{"name":"bytes","external_name":"bytes","restriction":"Bytes"}],"visibility":"Public","body":"_ = allocate\n_.initialize(bytes)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(path:Path)-class-method","name":"new","doc":"specify a path to load the tflite model from a file","summary":"

specify a path to load the tflite model from a file

","abstract":false,"args":[{"name":"path","external_name":"path","restriction":"Path"}],"args_string":"(path : Path)","args_html":"(path : Path)","location":{"filename":"src/tensorflow_lite/model.cr","line_number":18,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/model.cr#L18"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"html_id":"tensorflow_lite/TensorflowLite/Tensor","path":"TensorflowLite/Tensor.html","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor","abstract":false,"superclass":{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"tensorflow_lite/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"tensorflow_lite/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"tensorflow_lite/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"tensorflow_lite/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"tensorflow_lite/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":17,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L17"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"tensorflow_lite/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"doc":"A tensor is a multi-dimensional array used as the basic data structure.\nThis array can have any number of dimensions, and is used to represent data of various types, such as numeric, boolean, or string values.\n\nThe dimensions of a tensor are often referred to as \"ranks\". For instance:\n\n* A rank 0 tensor is a scalar (a single number).\n* A rank 1 tensor is a vector (a 1D array).\n* A rank 2 tensor is a matrix (a 2D array).\n* A rank 3 tensor is a 3D array, and so on for higher dimensions.\n\nEach tensor in TensorFlow is also associated with a data type (such as float32, int32, or string) and a shape.\nThe shape of a tensor is the number of elements in each dimension.\n\nFor example, a 3x3 matrix has a shape of [3, 3].","summary":"

A tensor is a multi-dimensional array used as the basic data structure.

","constructors":[{"html_id":"new(tf_tensor_ptr:LibTensorflowLite::Tensor)-class-method","name":"new","abstract":false,"args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"args_string":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","args_html":"(tf_tensor_ptr : LibTensorflowLite::Tensor)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":20,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L20"},"def":{"name":"new","args":[{"name":"tf_tensor_ptr","external_name":"tf_tensor_ptr","restriction":"LibTensorflowLite::Tensor"}],"visibility":"Public","body":"_ = allocate\n_.initialize(tf_tensor_ptr)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"as_f-instance-method","name":"as_f","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":138,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L138"},"def":{"name":"as_f","visibility":"Public","body":"as_f64"}},{"html_id":"as_f32-instance-method","name":"as_f32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":128,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L128"},"def":{"name":"as_f32","visibility":"Public","body":"to_type(Float32)"}},{"html_id":"as_f64-instance-method","name":"as_f64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":133,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L133"},"def":{"name":"as_f64","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_i-instance-method","name":"as_i","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":173,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L173"},"def":{"name":"as_i","visibility":"Public","body":"as_i32"}},{"html_id":"as_i16-instance-method","name":"as_i16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":158,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L158"},"def":{"name":"as_i16","visibility":"Public","body":"to_type(Int16)"}},{"html_id":"as_i32-instance-method","name":"as_i32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":168,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L168"},"def":{"name":"as_i32","visibility":"Public","body":"to_type(Int32)"}},{"html_id":"as_i64-instance-method","name":"as_i64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":183,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L183"},"def":{"name":"as_i64","visibility":"Public","body":"to_type(Int64)"}},{"html_id":"as_i8-instance-method","name":"as_i8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":148,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L148"},"def":{"name":"as_i8","visibility":"Public","body":"to_type(Int8)"}},{"html_id":"as_type-instance-method","name":"as_type","doc":"returns a slice of the data in the correct type","summary":"

returns a slice of the data in the correct type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":188,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L188"},"def":{"name":"as_type","visibility":"Public","body":"case type\nwhen .float32?\n as_f32\nwhen .float64?\n as_f64\nwhen .u_int8?\n as_u8\nwhen .int8?\n as_i8\nwhen .u_int16?\n as_u16\nwhen .int16?\n as_i16\nwhen .u_int32?\n as_u32\nwhen .int32?\n as_i32\nwhen .u_int64?\n as_u64\nwhen .int64?\n as_i64\nelse\n raise(NotImplementedError.new(\"no method for casting to type: #{type}\"))\nend"}},{"html_id":"as_u16-instance-method","name":"as_u16","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":153,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L153"},"def":{"name":"as_u16","visibility":"Public","body":"to_type(UInt16)"}},{"html_id":"as_u32-instance-method","name":"as_u32","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":163,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L163"},"def":{"name":"as_u32","visibility":"Public","body":"to_type(UInt32)"}},{"html_id":"as_u64-instance-method","name":"as_u64","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":178,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L178"},"def":{"name":"as_u64","visibility":"Public","body":"to_type(UInt64)"}},{"html_id":"as_u8-instance-method","name":"as_u8","doc":"provides a view into the tensor buffer as the requested type","summary":"

provides a view into the tensor buffer as the requested type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":143,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L143"},"def":{"name":"as_u8","visibility":"Public","body":"to_type(UInt8)"}},{"html_id":"bytesize:Int32-instance-method","name":"bytesize","doc":"the size of the buffer backing this tensor","summary":"

the size of the buffer backing this tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":42,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L42"},"def":{"name":"bytesize","return_type":"Int32","visibility":"Public","body":"if (value = @bytesize).nil?\n @bytesize = ((LibTensorflowLite.tensor_byte_size(self)).to_i)\nelse\n value\nend"}},{"html_id":"dimension_size(index:Int):Int32-instance-method","name":"dimension_size","doc":"returns the number elements in this dimension or rank index","summary":"

returns the number elements in this dimension or rank index

","abstract":false,"args":[{"name":"index","external_name":"index","restriction":"Int"}],"args_string":"(index : Int) : Int32","args_html":"(index : Int) : Int32","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":63,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L63"},"def":{"name":"dimension_size","args":[{"name":"index","external_name":"index","restriction":"Int"}],"return_type":"Int32","visibility":"Public","body":"if index >= dimensions || index < 0\n raise(IndexError.new)\nend\nunsafe_fetch(index)\n"}},{"html_id":"dimensions:Int32-instance-method","name":"dimensions","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":48,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L48"},"def":{"name":"dimensions","return_type":"Int32","visibility":"Public","body":"if (value = @dimensions).nil?\n @dimensions = ((LibTensorflowLite.tensor_num_dims(self)).to_i)\nelse\n value\nend"}},{"html_id":"io_count-instance-method","name":"io_count","doc":"attempts to calculate the number on inputs/outputs based on the type","summary":"

attempts to calculate the number on inputs/outputs based on the type

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":86,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L86"},"def":{"name":"io_count","visibility":"Public","body":"klass_size = case type\nwhen .float32?\n sizeof(Float32)\nwhen .float64?\n sizeof(Float64)\nwhen .u_int8?\n sizeof(UInt8)\nwhen .int8?\n sizeof(Int8)\nwhen .u_int16?\n sizeof(UInt16)\nwhen .int16?\n sizeof(Int16)\nwhen .u_int32?\n sizeof(UInt32)\nwhen .int32?\n sizeof(Int32)\nwhen .u_int64?\n sizeof(UInt64)\nwhen .int64?\n sizeof(Int64)\nelse\n return self.reduce do |acc, i|\n acc * i\n end\nend\nbytesize // klass_size\n"}},{"html_id":"name:String-instance-method","name":"name","doc":"The friendly name of the tensor","summary":"

The friendly name of the tensor

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":39,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L39"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"if (value = @name).nil?\n @name = (String.new(LibTensorflowLite.tensor_name(self)))\nelse\n value\nend"}},{"html_id":"rank-instance-method","name":"rank","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":53,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L53"},"def":{"name":"rank","visibility":"Public","body":"dimensions"}},{"html_id":"raw_data:Bytes-instance-method","name":"raw_data","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":74,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L74"},"def":{"name":"raw_data","return_type":"Bytes","visibility":"Public","body":"data_ptr = LibTensorflowLite.tensor_data(self)\nif data_ptr.null?\n raise(\"no tensor data allocated\")\nend\nSlice.new(data_ptr.as(Pointer(UInt8)), bytesize)\n"}},{"html_id":"size-instance-method","name":"size","doc":"Returns the number of dimensions (sometimes referred to as rank) of the Tensor.\nWill be 0 for a scalar, 1 for a vector, 2 for a matrix, 3 for a 3-dimensional tensor etc.","summary":"

Returns the number of dimensions (sometimes referred to as rank) of the Tensor.

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":58,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L58"},"def":{"name":"size","visibility":"Public","body":"dimensions"}},{"html_id":"to_slice-instance-method","name":"to_slice","doc":"buffer that makes up the tensor input","summary":"

buffer that makes up the tensor input

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":81,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L81"},"def":{"name":"to_slice","visibility":"Public","body":"raw_data"}},{"html_id":"type:Type-instance-method","name":"type","doc":"The datatype this tensor holds\n\nthe type of data it expects as input or provides as output","summary":"

The datatype this tensor holds

","abstract":false,"location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":34,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L34"},"def":{"name":"type","return_type":"Type","visibility":"Public","body":"if (value = @type).nil?\n @type = (LibTensorflowLite.tensor_type(self))\nelse\n value\nend"}}],"macros":[{"html_id":"to_type(klass)-macro","name":"to_type","doc":"type casts the tensor buffer into the appropriate crystal lang type.\n\nreturns a Slice of the provided klass against the buffer for manipulation","summary":"

type casts the tensor buffer into the appropriate crystal lang type.

","abstract":false,"args":[{"name":"klass","external_name":"klass","restriction":""}],"args_string":"(klass)","args_html":"(klass)","location":{"filename":"src/tensorflow_lite/tensor.cr","line_number":118,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L118"},"def":{"name":"to_type","args":[{"name":"klass","external_name":"klass","restriction":""}],"visibility":"Public","body":" the_type = type\n raise TypeCastError.new(\"can't convert #{the_type} to #{ \n{{ klass }}\n }\") unless the_type == Type::\n{{ klass }}\n\n data_ptr = LibTensorflowLite.tensor_data(self)\n raise \"no tensor data allocated\" if data_ptr.null?\n count = bytesize // sizeof(\n{{ klass }}\n)\n Slice.new(data_ptr.as(Pointer(\n{{ klass }}\n)), count)\n \n"}}],"types":[{"html_id":"tensorflow_lite/TensorflowLite/Tensor/Type","path":"TensorflowLite/Tensor/Type.html","kind":"alias","full_name":"TensorflowLite::Tensor::Type","name":"Type","abstract":false,"locations":[{"filename":"src/tensorflow_lite/tensor.cr","line_number":29,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/tensor.cr#L29"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":true,"aliased":"LibTensorflowLite::Type","aliased_html":"LibTensorflowLite::Type","const":false,"constants":[{"id":"Bool","name":"Bool","value":"6"},{"id":"Complex128","name":"Complex128","value":"12"},{"id":"Complex64","name":"Complex64","value":"8"},{"id":"Float16","name":"Float16","value":"10"},{"id":"Float32","name":"Float32","value":"1"},{"id":"Float64","name":"Float64","value":"11"},{"id":"Int16","name":"Int16","value":"7"},{"id":"Int32","name":"Int32","value":"2"},{"id":"Int4","name":"Int4","value":"18"},{"id":"Int64","name":"Int64","value":"4"},{"id":"Int8","name":"Int8","value":"9"},{"id":"NoType","name":"NoType","value":"0"},{"id":"Resource","name":"Resource","value":"14"},{"id":"String","name":"String","value":"5"},{"id":"UInt16","name":"UInt16","value":"17"},{"id":"UInt32","name":"UInt32","value":"16"},{"id":"UInt64","name":"UInt64","value":"13"},{"id":"UInt8","name":"UInt8","value":"3"},{"id":"Variant","name":"Variant","value":"15"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Tensor","kind":"struct","full_name":"TensorflowLite::Tensor","name":"Tensor"},"doc":"the type of tensor, i.e. Float32 or Int8 etc","summary":"

the type of tensor, i.e.

"}]},{"html_id":"tensorflow_lite/TensorflowLite/Utilities","path":"TensorflowLite/Utilities.html","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"tensorflow_lite/TensorflowLite","kind":"module","full_name":"TensorflowLite","name":"TensorflowLite"},"types":[{"html_id":"tensorflow_lite/TensorflowLite/Utilities/ExtractLabels","path":"TensorflowLite/Utilities/ExtractLabels.html","kind":"module","full_name":"TensorflowLite::Utilities::ExtractLabels","name":"ExtractLabels","abstract":false,"locations":[{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":4,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/utilities/extract_labels.cr#L4"}],"repository_name":"tensorflow_lite","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MAGIC_ZIP","name":"MAGIC_ZIP","value":"Bytes[80, 75, 3, 4]","doc":"File type detection\nhttps://github.com/sindresorhus/file-type/blob/main/core.js\nhttps://en.wikipedia.org/wiki/ZIP_(file_format)","summary":"

File type detection https://github.com/sindresorhus/file-type/blob/main/core.js https://en.wikipedia.org/wiki/ZIP_(file_format)

"}],"namespace":{"html_id":"tensorflow_lite/TensorflowLite/Utilities","kind":"module","full_name":"TensorflowLite::Utilities","name":"Utilities"},"class_methods":[{"html_id":"from(input:Path|Bytes,metadata_file:String=\".txt\"):Array(String)|Nil-class-method","name":"from","doc":"extracts the label names from tensorflow lite model at the path specified","summary":"

extracts the label names from tensorflow lite model at the path specified

","abstract":false,"args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"args_string":"(input : Path | Bytes, metadata_file : String = \".txt\") : Array(String) | Nil","args_html":"(input : Path | Bytes, metadata_file : String = ".txt") : Array(String) | Nil","location":{"filename":"src/tensorflow_lite/utilities/extract_labels.cr","line_number":11,"url":"https://github.com/spider-gazelle/tensorflow_lite/blob/fb30953c98ef71e55ca83aa135705ffb16824d1c/src/tensorflow_lite/utilities/extract_labels.cr#L11"},"def":{"name":"from","args":[{"name":"input","external_name":"input","restriction":"Path | Bytes"},{"name":"metadata_file","default_value":"\".txt\"","external_name":"metadata_file","restriction":"String"}],"return_type":"Array(String) | ::Nil","visibility":"Public","body":"bytes = case input\nin Path\n File.open(input, &.getb_to_end)\nin Bytes\n input\nend\nio = IO::Memory.new(bytes)\nfound = 0\nfiles = [] of String\nread_buffer = Bytes.new(MAGIC_ZIP.bytesize)\nremaining = bytes.size\nwhile remaining >= MAGIC_ZIP.bytesize\n read_pos = io.pos\n io.read_fully(read_buffer)\n if read_buffer == MAGIC_ZIP\n begin\n zip_data = IO::Memory.new(bytes[read_pos..-1])\n Compress::Zip::Reader.open(zip_data) do |zip|\n zip.each_entry do |entry|\n if entry.file?\n found = found + 1\n Log.debug do\n \"found file -> #{entry.filename}\"\n end\n if entry.filename.ends_with?(metadata_file)\n return entry.io.each_line.to_a\n else\n files << entry.filename\n end\n end\n end\n end\n break\n rescue Compress::Zip::Error\n end\n end\n io.pos = read_pos + 1\n remaining = bytes.size - io.pos\nend\nLog.info do\n \"found #{found} files, no matches: #{files.join(\", \")}\"\nend\nnil\n"}}]}]}]}]}}) \ No newline at end of file