Skip to content

Commit 61f5a08

Browse files
committed
Fix the dtype size
1 parent 142f903 commit 61f5a08

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

bench/pack_tensor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
ctoc = time.time()
5050
tc = (ctoc - ctic) / NREP
5151
print(
52-
f" Time for tensorflow (tf.io.serialize):\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ",
52+
f" Time for tensorflow (tf.io.serialize):\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ",
5353
end="",
5454
)
5555
print(f"\tcr: {in_.size * in_.dtype.itemsize * 1.0 / len(c):5.1f}x")
@@ -66,7 +66,7 @@
6666
ctoc = time.time()
6767
tc = (ctoc - ctic) / NREP
6868
print(
69-
f" Time for torch (torch.save):\t\t\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ",
69+
f" Time for torch (torch.save):\t\t\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ",
7070
end="",
7171
)
7272
buff.seek(0)
@@ -87,7 +87,7 @@
8787
ctoc = time.time()
8888
tc = (ctoc - ctic) / NREP
8989
print(
90-
f" Time for tensorflow (blosc2.pack_tensor):\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ",
90+
f" Time for tensorflow (blosc2.pack_tensor):\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ",
9191
end="",
9292
)
9393
print(f"\tcr: {in_.size * in_.dtype.itemsize * 1.0 / len(c):5.1f}x")
@@ -103,7 +103,7 @@
103103
ctoc = time.time()
104104
tc = (ctoc - ctic) / NREP
105105
print(
106-
f" Time for torch (blosc2.pack_tensor):\t\t{tc:.3f} s ({(N * 8 / tc) / 2**30:.2f} GB/s)) ",
106+
f" Time for torch (blosc2.pack_tensor):\t\t{tc:.3f} s ({(N * 4 / tc) / 2**30:.2f} GB/s)) ",
107107
end="",
108108
)
109109
print(f"\tcr: {in_.size * in_.dtype.itemsize * 1.0 / len(c):5.1f}x")
@@ -122,7 +122,7 @@
122122
dtoc = time.time()
123123
td = (dtoc - dtic) / NREP
124124
print(
125-
f" Time for tensorflow (tf.io.parse_tensor):\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ",
125+
f" Time for tensorflow (tf.io.parse_tensor):\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ",
126126
)
127127

128128
with open("serialize_torch.bin", "rb") as f:
@@ -136,7 +136,7 @@
136136
dtoc = time.time()
137137
td = (dtoc - dtic) / NREP
138138
print(
139-
f" Time for torch (torch.load):\t\t\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ",
139+
f" Time for torch (torch.load):\t\t\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ",
140140
)
141141

142142
with open("pack_tensorflow.bl2", "rb") as f:
@@ -149,7 +149,7 @@
149149
dtoc = time.time()
150150
td = (dtoc - dtic) / NREP
151151
print(
152-
f" Time for tensorflow (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ",
152+
f" Time for tensorflow (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ",
153153
)
154154
assert np.array_equal(in_, out)
155155

@@ -165,6 +165,6 @@
165165

166166
td = (dtoc - dtic) / NREP
167167
print(
168-
f" Time for torch (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 8 / td) / 2**30:.2f} GB/s)) ",
168+
f" Time for torch (blosc2.unpack_tensor):\t{td:.3f} s ({(N * 4 / td) / 2**30:.2f} GB/s)) ",
169169
)
170170
assert np.array_equal(in_, out)

0 commit comments

Comments
 (0)