Created
February 4, 2021 09:04
-
-
Save mariokostelac/35b23fe68507b19214aa346df1bb6df4 to your computer and use it in GitHub Desktop.
Debug layer for trax, prints out the shape of the data it works with
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trax.layers import base | |
class Debug(base.Layer): | |
def __init__(self, msg=""): | |
super().__init__(name=f'Debug') | |
self.msg = msg | |
self.debug = False | |
def forward(self, x): | |
if self.debug: | |
print(f"{self.msg} {x.shape}") | |
return x | |
def init_weights_and_state(self, input_signature): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After training, turn on the debug mode with
(or whatever is appropriate for your model).