Skip to content
Merged
1 change: 1 addition & 0 deletions docs/frontend/tensorflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Supported Ops

- Abs
- Add
- AddN
- All
- Any
- ArgMax
Expand Down
13 changes: 13 additions & 0 deletions python/tvm/relay/frontend/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,18 @@ def _impl(inputs, attr, params):
return AttrCvt('ndarray_size', transforms={'out_type' : 'dtype'})(inputs, new_attr)
return _impl

def _add_n():
def _impl(inputs, attr, params):
if not isinstance(inputs, tuple):
inputs = list(inputs)
assert len(inputs) > 0, "add_n take >=1 inputs, but 0 given."
_res = inputs[0]
for each in inputs[1:]:
_res = _op.add(_res, each)
return _res
return _impl


# compatible operators that do NOT require any conversion.
_identity_list = []

Expand All @@ -1329,6 +1341,7 @@ def _impl(inputs, attr, params):
_convert_map = {
'Abs' : AttrCvt('abs'),
'Add' : _elemwise('add'),
'AddN' : _add_n(),
'All' : _reduce('all'),
'Any' : _reduce('any'),
'ArgMax' : _argx(_op.argmax, 'argmax'),
Expand Down
Loading