Skip to content

Commit

Permalink
add plot receptive fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Warvito committed May 8, 2020
1 parent 836a207 commit f77b410
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions WIP/rascunho.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
out[0, 0, 5, 5, 5].backward()
grad = x.grad.detach().cpu().numpy()[0, 0]
grad = np.abs(grad)
grad = (grad != 0).astype('float64')
grad[5, 5, 5] = 0.5

plt.figure()
for i in range(10):
axes = plt.subplot(2,5,i+1)
plt.title(f"out[{i},:,:]")
plt.xticks(np.arange(0, 10, step=1))
plt.yticks(np.arange(0, 10, step=1))
axes.xaxis.set_minor_locator(FixedLocator(np.arange(0.5, 10.5, step=1)))
axes.yaxis.set_minor_locator(FixedLocator(np.arange(0.5, 10.5, step=1)))
plt.grid(which="minor")
plt.xlabel("out[i,:,k]")
plt.ylabel("out[i,j,:]")
plt.imshow(grad[i,:,:],vmin=0, vmax=1)

plt.show()

0 comments on commit f77b410

Please sign in to comment.