Created
September 13, 2019 15:12
-
-
Save benjaminkaplanphd/17d0161fd2da1ded8f12d8df64cbc971 to your computer and use it in GitHub Desktop.
Print Theano Tensor Shape
This file contains 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
import numpy as np | |
from theano import function, printing, shared, tensor as T | |
PRINT = printing.Print('Theano shape: ', attrs=['shape']) | |
def example(): | |
array = np.ones((3, 4)) | |
print(f'Numpy shape: {array.shape}') | |
x = T.dmatrix() | |
printed_x = PRINT(x) | |
f = function([x], printed_x) | |
f(array) | |
example() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment