Closed vieting closed 2 years ago
As shown in the test case in #85, there is currently some bug when we index a dim with flattened batch and time.
Code:
y = inputs.view(-1, n_in) idx = torch.arange(n_batch * n_time) idx = torch.cat([idx] * n_index).reshape(n_batch, n_time * n_index) x = y[idx.view(-1)] x = x.view(n_batch, n_time, n_index, n_in) x = x.permute(2, 0, 1, 3) out = torch.cat([inputs.unsqueeze(0), x])
Log output (via):
Then exception in:
File "/home/runner/.local/lib/python3.8/site-packages/returnn/tf/util/data.py", line 330, in Dim.get_for_batch_ctx line: dyn_size_ext = base_can_use_in_ctx.dyn_size_ext.copy_extend_batch(batch) locals: dyn_size_ext = <local> None base_can_use_in_ctx = <local> Dim{'time:var:extern_data:data'[?]} base_can_use_in_ctx.dyn_size_ext = <local> None base_can_use_in_ctx.dyn_size_ext.copy_extend_batch = <local> !AttributeError: 'NoneType' object has no attribute 'copy_extend_batch' batch = <local> BatchInfo{B, Packed{'time:var:extern_data:data'}} File "/home/runner/.local/lib/python3.8/site-packages/returnn/tf/util/data.py", line 3441, in Data.copy_extend_batch line: new_dims = ensure_list_of_type(batch.virtual_dims, BatchInfo.FixedDim) locals: new_dims = <not found> ensure_list_of_type = <local> <function ensure_list_of_type at 0x7fee81b4f820> batch = <local> BatchInfo{B, Packed{'time:var:extern_data:data'}} batch.virtual_dims = <local> [GlobalBatchDim{B}, PackedDim{Packed{'time:var:extern_data:data'}}]
'Unflatten_2': SplitDimsLayer output: ['Unflatten_2_split_dims0'(1),B,T|'time:var:extern_data:data'[B],F|F'feature:data'(7)]
'Transpose' CopyLayer output: ['Unflatten_1_split_dims0'(3),'Unflatten_1_split_dims1'(5),'Unflatten_1_split_dims2'(2),F|F'feature:data'(7)]
'Cat_1' layer dict: {'class': 'concat', 'from': [('Unflatten_2', 'static:0'), ('Transpose', 'static:2')]}
This should be fixed via #85.
As shown in the test case in #85, there is currently some bug when we index a dim with flattened batch and time.
Code:
Log output (via):
Then exception in:
'Unflatten_2': SplitDimsLayer output: ['Unflatten_2_split_dims0'(1),B,T|'time:var:extern_data:data'[B],F|F'feature:data'(7)]
'Transpose' CopyLayer output: ['Unflatten_1_split_dims0'(3),'Unflatten_1_split_dims1'(5),'Unflatten_1_split_dims2'(2),F|F'feature:data'(7)]
'Cat_1' layer dict: {'class': 'concat', 'from': [('Unflatten_2', 'static:0'), ('Transpose', 'static:2')]}