Tensor vs list in week 2 assignemn masked accuracy function

hello
the function definition states that the variable passed are tensors.
however when testing, lists are used. do we need to convert the lists to tensors for the execution. why are you not testing with tensors?

Parameters:
y_true (tensor): True labels.
y_pred (tensor): Predicted logits.

When creating a post, please add:

  • Week # must be added in the tags option of the post.
  • Link to the classroom item you are referring to:
  • Description (include relevant info but please do not post solution code or your entire notebook)

Part of your solution is to use tf.cast and this function can convert arrays into tensorflow tensors, thats why they are inputing lists there.

that what i did. but too be honest it is misleading when the documentation states that it is tf.
I appreciate to quick response. Thank you.

Misleading, maybe, but tensors is also another name for matrices, lists arrays…

either way i really appreciate your fast response. Thank u again.

1 Like