【发布时间】:2016-12-01 21:39:42
【问题描述】:
我不明白我们是否正在迭代 y,因为看起来对 y 中的值做了什么?它们是 T.log 的一部分吗?它们是否以某种方式与 p_y_given_x 相结合?
result = -T.mean(T.log(p_y_given_x)[T.arange(y1.shape[0]), y1])
print ("result1", result.eval())
print("_________________________")
print("y ", y2)
print("y.shape[0] ", y2.shape[0])
temp = (y2.shape[0], y2)
print("y.shape[0], y", temp)
temp2 = [T.arange(2), y2]
print("T.arange(y rows)", T.arange(2).eval())
print("[t.arange(2), y] [[0, 1], [1, 2]]")
print("T.log(p_y_given_x) ", (T.log(p_y_given_x)).eval())
print(-T.mean(T.log(p_y_given_x)).eval())
print("#########################")
result1 1.022485096286888
_________________________
y <TensorType(int64, matrix)>
y.shape[0] Subtensor{int64}.0
y.shape[0], y (Subtensor{int64}.0, <TensorType(int64, matrix)>)
T.arange(y rows) [0 1]
[t.arange(2), y] [[0, 1], [1, 2]]
T.log(p_y_given_x) [[-1.11190143 -0.91190143 -1.31190143]
[-1.13306876 -1.03306876 -1.13306876]]
1.10581842962
#########################
【问题讨论】:
标签: python neural-network theano