My code keeps giving me an error in assignment of Tensorflow and I dont know why this error occurs

As Tom says, your function does not return the correct value and that’s what the failing assertion is telling you. There is also an “Expected value” shown below that cell and you can see that your answer does not match it.

The first step is to check this thread for a list of things that can go wrong on this function.