Skip to content

Instantly share code, notes, and snippets.

@mgnisia
Created October 6, 2020 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgnisia/b1bc47fe797df6b4310746953a70d059 to your computer and use it in GitHub Desktop.
Save mgnisia/b1bc47fe797df6b4310746953a70d059 to your computer and use it in GitHub Desktop.
Printing of three dimensional tensor
# Assumption tensor == np.array
def print_tensor(tensor):
for i3 in range(0, tensor.shape[0]):
for i1 in range(0, tensor.shape[2]):
string_line = ""
for i2 in range(0, tensor.shape[1]):
string_line += " {:3.2f} ".format(tensor[i3][i2][i1])
print(string_line)
print("------------------------------------")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment