Skip to content

Commit

Permalink
[Frontend][TFLite] PreLU alpha can be an expr (apache#11879)
Browse files Browse the repository at this point in the history
* [Frontend][TFLite] PreLU alpha can be an expr

* [Frontend][TFLite] handle both cases of PreLU alpha param
  • Loading branch information
Rafael Stahl authored Jul 11, 2022
1 parent 9ee25eb commit c4dc41a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions python/tvm/relay/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3010,11 +3010,14 @@ def convert_prelu(self, op):

input_tensor = input_tensors[0]
alpha_tensor = input_tensors[1]
alpha_tensor_type = alpha_tensor.tensor.Type()
alpha_tensor_type_str = self.get_tensor_type_str(alpha_tensor_type)
alpha_expr = self.exp_tab.new_const(
self.get_tensor_value(alpha_tensor), dtype=alpha_tensor_type_str
)
if self.has_expr(alpha_tensor.tensor_idx):
alpha_expr = self.get_expr(alpha_tensor.tensor_idx)
else:
alpha_tensor_type = alpha_tensor.tensor.Type()
alpha_tensor_type_str = self.get_tensor_type_str(alpha_tensor_type)
alpha_expr = self.exp_tab.new_const(
self.get_tensor_value(alpha_tensor), dtype=alpha_tensor_type_str
)
in_expr = self.get_expr(input_tensor.tensor_idx)
data_shape = to_int_list(self.get_tensor_shape(input_tensor))

Expand Down

0 comments on commit c4dc41a

Please sign in to comment.