INNER CODE UNIT · Python
test_batch_func_next_step
MITDeepLearning/introtodeeplearning · mitdeeplearning/lab1.py:98
def test_batch_func_next_step(func, args):
x, y = func(*args)
assert (
x[:, 1:] == y[:, :-1]
).all(), "[FAIL] test_batch_func_next_step: x_{t} must equal y_{t-1} for all t"
print("[PASS] test_batch_func_next_step")
return True
def test_custom_dense_layer_output(y):
# define the ground truth value for the array
true_y = np.array([[0.27064407, 0.1826951, 0.50374055]], dtype="float32")
assert tf.shape(y).numpy().tolist() == list(
true_y.shape
), "[FAIL] output is of incorrect shape. expected {} but got {}".format(
true_y.shape, y.numpy().shape
)
np.testing.assert_almost_equal(