9
9
10
10
import pytest
11
11
import torch
12
- from tensordict import SavedTensorDict , TensorDict
12
+ from tensordict import TensorDict
13
13
from torch import multiprocessing as mp
14
14
15
15
@@ -145,10 +145,10 @@ def test_shared(self, shared):
145
145
)
146
146
147
147
148
- @pytest .mark .skipif (
149
- sys .platform == "win32" ,
150
- reason = "RuntimeError from Torch serialization.py when creating td_saved on Windows" ,
151
- )
148
+ # @pytest.mark.skipif(
149
+ # sys.platform == "win32",
150
+ # reason="RuntimeError from Torch serialization.py when creating td_saved on Windows",
151
+ # )
152
152
@pytest .mark .parametrize (
153
153
"idx" ,
154
154
[
@@ -180,7 +180,6 @@ def test_memmap(idx, dtype, large_scale=False):
180
180
181
181
td_sm = td .clone ().share_memory_ ()
182
182
td_memmap = td .clone ().memmap_ ()
183
- td_saved = td .to (SavedTensorDict )
184
183
185
184
print ("\n Testing reading from TD" )
186
185
for i in range (2 ):
@@ -194,11 +193,6 @@ def test_memmap(idx, dtype, large_scale=False):
194
193
if i == 1 :
195
194
print (f"memmap: { time .time () - t0 :4.4f} sec" )
196
195
197
- t0 = time .time ()
198
- td_saved [idx ].clone ()
199
- if i == 1 :
200
- print (f"saved td: { time .time () - t0 :4.4f} sec" )
201
-
202
196
td_to_copy = td [idx ].contiguous ()
203
197
for k in td_to_copy .keys ():
204
198
td_to_copy .set_ (k , torch .ones_like (td_to_copy .get (k )))
@@ -219,13 +213,6 @@ def test_memmap(idx, dtype, large_scale=False):
219
213
print (f"memmap td: { time .time () - t0 :4.4f} sec" )
220
214
torch .testing .assert_close (sub_td_sm .get ("a" )._tensor , td_to_copy .get ("a" ))
221
215
222
- t0 = time .time ()
223
- sub_td_sm = td_saved .get_sub_tensordict (idx )
224
- sub_td_sm .update_ (td_to_copy )
225
- if i == 1 :
226
- print (f"saved td: { time .time () - t0 :4.4f} sec" )
227
- torch .testing .assert_close (sub_td_sm .get ("a" ), td_to_copy .get ("a" ))
228
-
229
216
230
217
if __name__ == "__main__" :
231
218
args , unknown = argparse .ArgumentParser ().parse_known_args ()
0 commit comments