mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
parent
63ca402380
commit
25e1af36e0
@ -72,7 +72,7 @@ def torch_pad_and_concatenate(tensor1, tensor2, padding_index=-100):
|
||||
def numpy_pad_and_concatenate(array1, array2, padding_index=-100):
|
||||
"""Concatenates `array1` and `array2` on first axis, applying padding on the second if necessary."""
|
||||
if len(array1.shape) == 1 or array1.shape[1] == array2.shape[1]:
|
||||
return np.concatenate((array1, array2), dim=0)
|
||||
return np.concatenate((array1, array2), axis=0)
|
||||
|
||||
# Let's figure out the new shape
|
||||
new_shape = (array1.shape[0] + array2.shape[0], max(array1.shape[1], array2.shape[1])) + array1.shape[2:]
|
||||
|
Loading…
Reference in New Issue
Block a user