Compute cost week 3 course 2

I am facing below issue. Please have a look.

{moderator edit - solution code removed}

def compute_cost_test(target, Y):
pred = tf.constant([[ 2.4048107, 5.0334096 ],
[-0.7921977, -4.1523376 ],
[ 0.9447198, -0.46802214],
[ 1.158121, 3.9810789 ],
[ 4.768706, 2.3220146 ],
[ 6.1481323, 3.909829 ]])
minibatches = Y.batch(2)
for minibatch in minibatches:
result = target(pred, tf.transpose(minibatch))
break

print(result)
assert(type(result) == EagerTensor), "Use the TensorFlow API"
assert (np.abs(result - (0.25361037 + 0.5566767) / 2.0) < 1e-7), "Test does not match. Did you get the mean of your cost functions?"

print("\033[92mAll test passed")

compute_cost_test(compute_cost, new_y_train )

Getting name error like below:
NameError Traceback (most recent call last)
in
17 print(“\033[92mAll test passed”)
18
—> 19 compute_cost_test(compute_cost, new_y_train )

NameError: name ‘new_y_train’ is not defined

This is the same to another your post. You are using an old notebook, or copied old implementation from somewhere, which does not work. Please refresh a notebook, and implement again.

I received below error in this function - appears to be a test case issue.

AssertionError Traceback (most recent call last)
Cell In[47], line 5
2 cost = compute_cost(A2, t_Y)
3 print("cost = " + str(compute_cost(A2, t_Y)))
----> 5 compute_cost_test(compute_cost)

File ~/Library/CloudStorage/OneDrive-Personal/Env/FSD/cloud/aws/ML/coursera/deeplearning/workspace/W3A1/public_tests.py:133, in compute_cost_test(target)
130 output_2 = target(A3, a3_Y)
132 assert type(output_1) == float, “Wrong type. Float expected”
→ 133 assert np.isclose(output_1, expected_output_1), f"Wrong value. Expected: {expected_output_1} got: {output_1}"
135 assert type(output_2) == float, “Wrong type. Float expected”
136 assert np.isclose(output_2, expected_output_2), f"Wrong value. Expected: {expected_output_2} got: {output_2}"

AssertionError: Wrong value. Expected: 0.5447066599017815 got: 1.0493608309109266