MCPcopy Create free account
hub / github.com/NVIDIA/DALI / test_decorator_recursive

Method test_decorator_recursive

dali/test/python/autograph/impl/test_api.py:145–160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

143 self.assertIsNotNone(self.evaluate(x), 3)
144
145 def test_decorator_recursive(self):
146 class TestClass(object):
147 def called_member(self, a):
148 if a < 0:
149 a = -a
150 return a
151
152 @api.convert(recursive=True)
153 def test_method(self, x, s, a):
154 while reduce(add, x) > s:
155 x //= self.called_member(a)
156 return x
157
158 tc = TestClass()
159 x = tc.test_method(custom_constant([2, 4]), custom_constant(1), custom_constant(-2))
160 self.assertListEqual([0, 1], self.evaluate(x).tolist())
161
162 def test_decorator_not_recursive(self):
163 class TestClass(object):

Callers

nothing calls this directly

Calls 5

test_methodMethod · 0.95
evaluateMethod · 0.95
tolistMethod · 0.80
TestClassClass · 0.70
custom_constantFunction · 0.70

Tested by

no test coverage detected