Skip to content

Commit b13a5ec

Browse files
committed
tweaks; remove a field and make it a temporary variable. the three-dimensional text should be on the right side of the box overdrawn on the edges; shifting it back.
1 parent 6b4e7c7 commit b13a5ec

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

testing/test2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
h = torch.tensor([1,2])
99

1010
with tsensor.explain(legend=True, savefig="/Users/parrt/Desktop/t2.pdf"):
11-
W @ torch.eye(2, 2)
11+
torch.rand(size=(2,20,2000,10))
1212

13-
with tsensor.explain(legend=True, savefig="/Users/parrt/Desktop/t.pdf") as e:
14-
W @ torch.dot(b, b) + torch.eye(2, 2) @ x
13+
# with tsensor.explain(legend=True, savefig="/Users/parrt/Desktop/t.pdf") as e:
14+
# W @ torch.dot(b, b) + torch.eye(2, 2) @ x

tsensor/viz.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def set_locations(self, maxh):
150150
That is why this is a separate function not part of the constructor.
151151
"""
152152
line2text = self.hchar / 1.7
153-
self.box2line = line2text*2.6
154-
self.texty = self.bottomedge + maxh + self.box2line + line2text
155-
self.liney = self.bottomedge + maxh + self.box2line
153+
box2line = line2text*2.6
154+
self.texty = self.bottomedge + maxh + box2line + line2text
155+
self.liney = self.bottomedge + maxh + box2line
156156
self.box_topy = self.bottomedge + maxh
157157
self.maxy = self.texty + 1.4 * self.fontsize
158158

@@ -294,7 +294,6 @@ def draw_matrix(self,ax,sub, sh, ty):
294294
fontname=self.dimfontname, fontsize=self.dimfontsize, rotation=90)
295295

296296
# Note: this was always true since matrix...
297-
# if len(sh) > 1:
298297
textx = mid
299298
texty = self.box_topy + self.dim_ypadding
300299
if len(sh) > 2:
@@ -308,7 +307,7 @@ def draw_matrix(self,ax,sub, sh, ty):
308307
if len(sh) > 2:
309308
# Text to the right
310309
ax.text(box_left+w, self.box_topy - h/2, self.nabbrev(sh[2]),
311-
verticalalignment='center', horizontalalignment='right',
310+
verticalalignment='center', horizontalalignment='center',
312311
fontname=self.dimfontname, fontsize=self.dimfontsize,
313312
rotation=45)
314313

0 commit comments

Comments
 (0)