def test_variable_length_stack_zerosize(is_right_pad): arrays = [np.zeros(shape=(0, 2)) for _ in range(5)] stacked = stack( arrays, variable_length=True, is_right_pad=is_right_pad, ) assert stacked.shape[0] == 5 assert stacked.shape[1] == 1 assert stacked.shape[2] == 2
def test_variable_length_stack(is_right_pad): arrays = [d["target"].T for d in list(iter(get_dataset()))] stacked = stack( arrays, variable_length=True, is_right_pad=is_right_pad, ) assert stacked.shape[0] == 3 assert stacked.shape[1] > 0 assert stacked.shape[2] == 2
def test_variable_length_stack(pp_dataset, array_type, multi_processing): arrays = [ d["target"].T if array_type == "np" else mx.nd.array(d["target"].T) for d in list(iter(pp_dataset())) ] assert isinstance(multi_processing, bool) stacked = stack( arrays, variable_length=True, ) assert stacked.shape[0] == 3 assert stacked.shape[1] > 0 assert stacked.shape[2] == 2
def test_variable_length_stack_zerosize(pp_dataset, array_type, multi_processing): arrays = [ np.zeros(shape=(0, 2)) if array_type == "np" else mx.nd.array( np.zeros(shape=(0, 2))) for _ in range(5) ] assert isinstance(multi_processing, bool) stacked = stack( arrays, variable_length=True, ) assert stacked.shape[0] == 5 assert stacked.shape[1] == 1 assert stacked.shape[2] == 2