INNER CODE UNIT · Python
test_batch_func_types
MITDeepLearning/introtodeeplearning · mitdeeplearning/lab1.py:71
def test_batch_func_types(func, args):
ret = func(*args)
assert len(ret) == 2, "[FAIL] get_batch must return two arguments (input and label)"
assert type(ret[0]) == np.ndarray, "[FAIL] test_batch_func_types: x is not np.array"
assert type(ret[1]) == np.ndarray, "[FAIL] test_batch_func_types: y is not np.array"
print("[PASS] test_batch_func_types")
return True
def test_batch_func_shapes(func, args):
dataset, seq_length, batch_size = args
x, y = func(*args)
correct = (batch_size, seq_length)
assert (
x.shape == correct
), "[FAIL] test_batch_func_shapes: x {} is not correct shape {}".format(
x.shape, correct
)