|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 | 3 | from abc import ABC, abstractmethod
|
4 |
| -from concurrent import futures |
5 | 4 | from dataclasses import dataclass
|
6 | 5 | from math import ceil
|
7 | 6 | from typing import Generic, Iterator, Optional, Sequence, Tuple, Type, TypeVar, Union
|
@@ -169,23 +168,14 @@ def get_buffer_size_generator(
|
169 | 168 |
|
170 | 169 | x_buf_size, x_gen = get_buffer_size_generator(x_array, x_attrs)
|
171 | 170 | y_buf_size, y_gen = get_buffer_size_generator(y_array, y_attrs)
|
172 |
| - with futures.ThreadPoolExecutor(max_workers=2) as executor: |
173 |
| - for batch in iter_batches(x_buf_size, y_buf_size, start_offset, stop_offset): |
174 |
| - if batch.x_read_slice and batch.y_read_slice: |
175 |
| - futures.wait( |
176 |
| - ( |
177 |
| - executor.submit(x_gen.read_buffer, batch.x_read_slice), |
178 |
| - executor.submit(y_gen.read_buffer, batch.y_read_slice), |
179 |
| - ) |
180 |
| - ) |
181 |
| - elif batch.x_read_slice: |
182 |
| - x_gen.read_buffer(batch.x_read_slice) |
183 |
| - elif batch.y_read_slice: |
184 |
| - y_gen.read_buffer(batch.y_read_slice) |
185 |
| - |
186 |
| - x_tensors = x_gen.iter_tensors(batch.x_buffer_slice) |
187 |
| - y_tensors = y_gen.iter_tensors(batch.y_buffer_slice) |
188 |
| - yield (*x_tensors, *y_tensors) |
| 171 | + for batch in iter_batches(x_buf_size, y_buf_size, start_offset, stop_offset): |
| 172 | + if batch.x_read_slice: |
| 173 | + x_gen.read_buffer(batch.x_read_slice) |
| 174 | + if batch.y_read_slice: |
| 175 | + y_gen.read_buffer(batch.y_read_slice) |
| 176 | + x_tensors = x_gen.iter_tensors(batch.x_buffer_slice) |
| 177 | + y_tensors = y_gen.iter_tensors(batch.y_buffer_slice) |
| 178 | + yield (*x_tensors, *y_tensors) |
189 | 179 |
|
190 | 180 |
|
191 | 181 | @dataclass(frozen=True, repr=False)
|
|
0 commit comments