在Python 3.X + TensorFlow中,如果我有兩個TF矢量,point_x和point_y(相同的形狀),它們表示一些指針的X和Y座標,我如何找到所有獨特點?在Tensorflow中找到唯一的值對
我能夠一起Theano使用複雜的向量在現實和Y虛部分破解此,與X:
complex_points = point_x + point_y * 1j
unique_points, idxs, groups = T.extra_ops.Unique(True, True, False)(complex_points)
的TF相當於我想的是:
complex_points = tf.complex(point_x, point_y)
unique_points, groups = tf.unique(complex_points)
TensorFlow失敗的東西,如:
InvalidArgumentError: No OpKernel was registered to support Op 'Unique' with these attrs.
... # supported types include the float/int/string types, no complex types
[[Node: Unique_1 = Unique[T=DT_COMPLEX64, out_idx=DT_INT32](Complex_1)]]
顯然,沒有一個人的執行/註冊複雜版本的「獨特」操作。任何想法如何完成這項任務?
.bitcast需要「type =」而不是「dtype =」,但否則這種破解似乎工作 – scnerd
@scnerd一個很好的結果。我在回答中修改了它。 – soloice