Skip to content

Commit 1a96148

Browse files
author
Flax Authors
committed
Merge pull request #2610 from chiamp:test_returned_variable_warning
PiperOrigin-RevId: 488461724
2 parents 478cffe + f791354 commit 1a96148

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/linen/linen_transforms_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,19 @@ def _helper(self):
10261026
with self.assertRaises(errors.TransformedMethodReturnValueError):
10271027
b.apply({}, jnp.ones(2))
10281028

1029+
def test_returned_variable_warning(self):
1030+
class Bar(nn.Module):
1031+
@nn.compact
1032+
def __call__(self, x):
1033+
f = self._helper()
1034+
return f(x)
1035+
@nn.jit
1036+
def _helper(self):
1037+
return nn.Variable(None, None, None)
1038+
b = Bar()
1039+
with self.assertRaises(errors.TransformedMethodReturnValueError):
1040+
b.apply({}, jnp.ones(2))
1041+
10291042
def test_nowrap(self):
10301043
class Bar(nn.Module):
10311044
@nn.compact

0 commit comments

Comments
 (0)