Skip to content

Commit 9c3a461

Browse files
Merge pull request #1289 from yueyinqiu/detach
in exportsd.py, call detach() before numpy()
2 parents 86af61e + fcdee15 commit 9c3a461

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Python/exportsd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _write_tensor(t, stream):
3737
stream.write(leb128.u.encode(len(t.shape)))
3838
for s in t.shape:
3939
stream.write(leb128.u.encode(s))
40-
stream.write(t.numpy().tobytes())
40+
stream.write(t.detach().cpu().numpy().tobytes())
4141

4242
def write_tensor(t, file_name):
4343
f = open(file_name, "wb")

0 commit comments

Comments
 (0)