1
1
defmodule Tensorflex do
2
2
@ moduledoc """
3
3
A simple and fast library for running Tensorflow graph models in Elixir.
4
- Tensorflex is written around the [Tensorflow C
5
- API](https://www.tensorflow.org/install/install_c), and allows Elixir
6
- developers to leverage Machine Learning and Deep Learning solutions in their
7
- projects.
4
+ Tensorflex is written around the [Tensorflow C
5
+ API](https://www.tensorflow.org/install/install_c), and allows Elixir
6
+ developers to leverage Machine Learning and Deep Learning solutions in their
7
+ projects.
8
8
9
9
__NOTE__:
10
10
@@ -24,7 +24,7 @@ projects.
24
24
different tensor datatypes than the ones required by the graph can all lead to
25
25
failure. While these are not easy errors to make, do ensure that you test your
26
26
solution well before deployment.
27
- """
27
+ """
28
28
29
29
alias Tensorflex . { NIFs , Graph , Tensor , Matrix }
30
30
@@ -41,7 +41,7 @@ projects.
41
41
Returns a tuple `{:ok, %Graph}`.
42
42
43
43
`%Graph` is an internal Tensorflex struct which holds the name of the graph
44
- file and the binary definition data that is read in via the `.pb` file.
44
+ file and the binary definition data that is read in via the `.pb` file.
45
45
46
46
## Examples:
47
47
@@ -217,7 +217,7 @@ file and the binary definition data that is read in via the `.pb` file.
217
217
```
218
218
"""
219
219
220
- def get_graph_ops ( % Graph { def: ref , name: filepath } ) do
220
+ def get_graph_ops ( % Graph { def: ref , name: _filepath } ) do
221
221
NIFs . get_graph_ops ( ref )
222
222
end
223
223
@@ -343,7 +343,7 @@ file and the binary definition data that is read in via the `.pb` file.
343
343
```
344
344
"""
345
345
346
- def matrix_pos ( % Matrix { nrows: nrows , ncols: ncols , data: ref } , row , col ) when row > 0 and col > 0 do
346
+ def matrix_pos ( % Matrix { nrows: _nrows , ncols: _ncols , data: ref } , row , col ) when row > 0 and col > 0 do
347
347
NIFs . matrix_pos ( ref , row , col )
348
348
end
349
349
@@ -370,7 +370,7 @@ file and the binary definition data that is read in via the `.pb` file.
370
370
```
371
371
"""
372
372
373
- def size_of_matrix ( % Matrix { nrows: nrows , ncols: ncols , data: ref } ) do
373
+ def size_of_matrix ( % Matrix { nrows: nrows , ncols: ncols , data: _ref } ) do
374
374
{ nrows , ncols }
375
375
end
376
376
@@ -453,7 +453,7 @@ file and the binary definition data that is read in via the `.pb` file.
453
453
```
454
454
"""
455
455
456
- def matrix_to_lists ( % Matrix { nrows: nrows , ncols: ncols , data: ref } ) do
456
+ def matrix_to_lists ( % Matrix { nrows: _nrows , ncols: _ncols , data: ref } ) do
457
457
NIFs . matrix_to_lists ( ref )
458
458
end
459
459
@@ -495,7 +495,7 @@ file and the binary definition data that is read in via the `.pb` file.
495
495
```
496
496
"""
497
497
498
- def float64_tensor ( % Matrix { nrows: val_rows , ncols: val_cols , data: val_ref } , % Matrix { nrows: dim_rows , ncols: dim_cols , data: dim_ref } ) do
498
+ def float64_tensor ( % Matrix { nrows: _val_rows , ncols: _val_cols , data: val_ref } , % Matrix { nrows: _dim_rows , ncols: _dim_cols , data: dim_ref } ) do
499
499
{ :ok , ref } = NIFs . float64_tensor ( val_ref , dim_ref )
500
500
{ :ok , % Tensor { datatype: :tf_double , tensor: ref } }
501
501
end
@@ -575,7 +575,7 @@ file and the binary definition data that is read in via the `.pb` file.
575
575
```
576
576
"""
577
577
578
- def float32_tensor ( % Matrix { nrows: val_rows , ncols: val_cols , data: val_ref } , % Matrix { nrows: dim_rows , ncols: dim_cols , data: dim_ref } ) do
578
+ def float32_tensor ( % Matrix { nrows: _val_rows , ncols: _val_cols , data: val_ref } , % Matrix { nrows: _dim_rows , ncols: _dim_cols , data: dim_ref } ) do
579
579
{ :ok , ref } = NIFs . float32_tensor ( val_ref , dim_ref )
580
580
{ :ok , % Tensor { datatype: :tf_float , tensor: ref } }
581
581
end
@@ -659,7 +659,7 @@ file and the binary definition data that is read in via the `.pb` file.
659
659
```
660
660
"""
661
661
662
- def int32_tensor ( % Matrix { nrows: val_rows , ncols: val_cols , data: val_ref } , % Matrix { nrows: dim_rows , ncols: dim_cols , data: dim_ref } ) do
662
+ def int32_tensor ( % Matrix { nrows: _val_rows , ncols: _val_cols , data: val_ref } , % Matrix { nrows: _dim_rows , ncols: _dim_cols , data: dim_ref } ) do
663
663
{ :ok , ref } = NIFs . int32_tensor ( val_ref , dim_ref )
664
664
{ :ok , % Tensor { datatype: :tf_int32 , tensor: ref } }
665
665
end
@@ -769,7 +769,7 @@ file and the binary definition data that is read in via the `.pb` file.
769
769
```
770
770
"""
771
771
772
- def int32_tensor_alloc ( % Matrix { nrows: dim_rows , ncols: dim_cols , data: dim_ref } ) do
772
+ def int32_tensor_alloc ( % Matrix { nrows: _dim_rows , ncols: _dim_cols , data: dim_ref } ) do
773
773
{ :ok , ref } = NIFs . int32_tensor_alloc ( dim_ref )
774
774
{ :ok , % Tensor { datatype: :tf_int32 , tensor: ref } }
775
775
end
@@ -805,7 +805,7 @@ file and the binary definition data that is read in via the `.pb` file.
805
805
```
806
806
"""
807
807
808
- def float32_tensor_alloc ( % Matrix { nrows: dim_rows , ncols: dim_cols , data: dim_ref } ) do
808
+ def float32_tensor_alloc ( % Matrix { nrows: _dim_rows , ncols: _dim_cols , data: dim_ref } ) do
809
809
{ :ok , ref } = NIFs . float32_tensor_alloc ( dim_ref )
810
810
{ :ok , % Tensor { datatype: :tf_float , tensor: ref } }
811
811
end
@@ -841,7 +841,7 @@ file and the binary definition data that is read in via the `.pb` file.
841
841
```
842
842
"""
843
843
844
- def float64_tensor_alloc ( % Matrix { nrows: dim_rows , ncols: dim_cols , data: dim_ref } ) do
844
+ def float64_tensor_alloc ( % Matrix { nrows: _dim_rows , ncols: _dim_cols , data: dim_ref } ) do
845
845
{ :ok , ref } = NIFs . float64_tensor_alloc ( dim_ref )
846
846
{ :ok , % Tensor { datatype: :tf_double , tensor: ref } }
847
847
end
@@ -871,7 +871,7 @@ file and the binary definition data that is read in via the `.pb` file.
871
871
```
872
872
"""
873
873
874
- def tensor_datatype ( % Tensor { datatype: datatype , tensor: ref } ) do
874
+ def tensor_datatype ( % Tensor { datatype: datatype , tensor: _ref } ) do
875
875
{ :ok , datatype }
876
876
end
877
877
@@ -898,7 +898,7 @@ file and the binary definition data that is read in via the `.pb` file.
898
898
arguments. Support for grayscale images and other image formats such as `PNG`
899
899
will be added in the future.
900
900
901
- ## Examples
901
+ ## Examples
902
902
903
903
To exemplify the working of the `load_image_as_tensor/1` function we will
904
904
cover the entire prediction pipeline for the Inception model. However, this
@@ -992,7 +992,7 @@ file and the binary definition data that is read in via the `.pb` file.
992
992
panda, panda, panda bear, coon bear, Ailuropoda melanoleuca` (Line 3691 in the
993
993
file). Thus, we have correctly identified the animal in the image as a panda
994
994
using Tensorflex.
995
- """
995
+ """
996
996
997
997
def load_image_as_tensor ( imagepath ) do
998
998
unless File . exists? ( imagepath ) do
@@ -1182,9 +1182,9 @@ file and the binary definition data that is read in via the `.pb` file.
1182
1182
1183
1183
* Working with an RNN-LSTM example for sentiment analysis is covered
1184
1184
[here](https://github.com/anshuman23/tensorflex/pull/25).
1185
- """
1185
+ """
1186
1186
1187
- def run_session ( % Graph { def: graphdef , name: filepath } , % Tensor { datatype: input_datatype , tensor: input_ref } , % Tensor { datatype: output_datatype , tensor: output_ref } , input_opname , output_opname ) do
1187
+ def run_session ( % Graph { def: graphdef , name: _filepath } , % Tensor { datatype: _input_datatype , tensor: input_ref } , % Tensor { datatype: _output_datatype , tensor: output_ref } , input_opname , output_opname ) do
1188
1188
NIFs . run_session ( graphdef , input_ref , output_ref , input_opname , output_opname )
1189
1189
end
1190
1190
0 commit comments