Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
dee52466
Commit
dee52466
authored
Sep 01, 2019
by
Neo Chien
Committed by
Jared Roesch
Aug 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation of tile for TFLite (#3814)
parent
eef35a57
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletions
+47
-1
python/tvm/relay/frontend/tflite.py
+24
-1
tests/python/frontend/tflite/test_forward.py
+23
-0
No files found.
python/tvm/relay/frontend/tflite.py
View file @
dee52466
...
...
@@ -82,7 +82,8 @@ class OperatorConverter(object):
'PACK'
:
self
.
convert_pack
,
'LOGISTIC'
:
self
.
convert_logistic
,
'SPLIT'
:
self
.
convert_split
,
'TRANSPOSE'
:
self
.
convert_transpose
'TRANSPOSE'
:
self
.
convert_transpose
,
'TILE'
:
self
.
convert_tile
}
def
check_unsupported_ops
(
self
):
...
...
@@ -769,6 +770,28 @@ class OperatorConverter(object):
return
out
def
convert_tile
(
self
,
op
):
"""tile implementation."""
try
:
from
tflite.Operator
import
Operator
except
ImportError
:
raise
ImportError
(
"The tflite package must be installed"
)
assert
isinstance
(
op
,
Operator
)
input_tensors
=
self
.
get_input_tensors
(
op
)
assert
len
(
input_tensors
)
==
2
,
"input tensors length should be 2"
input_tensor
=
input_tensors
[
0
]
input_tensor_idx
=
input_tensor
.
tensor_idx
in_expr
=
self
.
get_expr
(
input_tensor_idx
)
# reps (tuple of int) – The number of times repeating the tensor data.
reps
=
tuple
(
self
.
get_tensor_value
(
input_tensors
[
1
]))
out
=
_op
.
tile
(
in_expr
,
reps
)
return
out
def
convert_pool2d
(
self
,
op
,
pool_type
):
"""pool2d implementation."""
try
:
...
...
tests/python/frontend/tflite/test_forward.py
View file @
dee52466
...
...
@@ -229,6 +229,26 @@ def test_forward_transpose():
_test_forward_transpose
((
2
,
3
,
4
,
5
),
(
3
,
0
,
1
,
2
))
_test_forward_transpose
((
2
,
3
,
4
,
5
),
())
#######################################################################
# tile
# ---------
def
_test_forward_tile
(
in_shape
,
reps
,
dtype
):
data
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
in_shape
)
.
astype
(
dtype
)
with
tf
.
Graph
()
.
as_default
():
in_data
=
array_ops
.
placeholder
(
shape
=
data
.
shape
,
dtype
=
data
.
dtype
)
out
=
array_ops
.
tile
(
in_data
,
reps
)
compare_tflite_with_tvm
(
data
,
'Placeholder:0'
,
[
in_data
],
[
out
])
def
test_forward_tile
():
_test_forward_tile
((
2
,
),
(
3
,
),
"int32"
)
_test_forward_tile
((
2
,
2
),
(
2
,
3
),
"float32"
)
#######################################################################
# Pooling
...
...
@@ -856,6 +876,9 @@ if __name__ == '__main__':
# Transpose
test_forward_transpose
()
# Tile
test_forward_tile
()
# Transforms
test_forward_concatenation
()
test_forward_pad
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment