我正在学习 Tensor Flow Coursera 课程,但我不明白为什么我会遇到类型不匹配的问题。
这是我定义的函数:
def one_hot_matrix(labels, C):
"""
Creates a matrix where the i-th row corresponds to the ith class number and the jth column
corresponds to the jth training example. So if example j had a label i. Then entry (i,j)
will be 1.
Arguments:
labels -- vector containing the labels
C -- number of classes, the depth of the one hot dimension
Returns:
one_hot -- one hot matrix
"""
### START CODE HERE ###
# Create …Run Code Online (Sandbox Code Playgroud) tensorflow ×1