Skip to content

Commit a501c2f

Browse files
Merge pull request #82 from juesato/nan_ex
Add to docs for NaN.lua
2 parents 718a231 + 665096d commit a501c2f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@ We get a nice error message:
313313
nn.NaN(2) @ nn.Linear(3 -> 4)
314314
```
315315

316+
For a quick one-liner to catch NaNs anywhere inside a model (for example, a `nn.Sequential` or any other `nn.Container`), we can use this with the `nn.Module.replace` function:
317+
```lua
318+
model:replace(function(module) return nn.NaN(module) end)
319+
```
320+
316321
<a name='nn.Inception'></a>
317322
## Inception ##
318323
References :

0 commit comments

Comments
 (0)