(self, data, lengths, indices=None)
| 170 | |
| 171 | class LengthsTester(TesterBase): |
| 172 | def split(self, data, lengths, indices=None): |
| 173 | K = len(lengths) |
| 174 | outputs = [ |
| 175 | np.zeros((lengths[seg_id], ) + data.shape[1:], |
| 176 | dtype=data.dtype) for seg_id in range(0, K) |
| 177 | ] |
| 178 | start = 0 |
| 179 | for i in range(0, K): |
| 180 | for j in range(0, lengths[i]): |
| 181 | data_index = start + j |
| 182 | if indices is not None: |
| 183 | data_index = indices[data_index] |
| 184 | outputs[i][j] = data[data_index] |
| 185 | start += lengths[i] |
| 186 | return outputs |
| 187 | |
| 188 | def unsplit(self, extra_shape, inputs, lengths): |
| 189 | N = sum(lengths) |
no test coverage detected