def create_pair_wise_distances(x, y):
x_shape = x.get_shape().as_list();
y_shape = y.get_shape().as_list();
#expand matrices
xx = tf.reshape(x, [x_shape[0], x_shape[1], 1]);
yy = tf.reshape(y, [y_shape[0], y_shape[1], 1]);
yy = tf.transpose(yy, perm = [2,1,0]);
xx = tf.tile(xx, [1, 1, y_shape[0]]);
yy = tf.tile(yy, [x_shape[0], 1, 1]);
#cc = tf.transpose(cc, perm = [2,1,0]);
#cc = tf.tile(cc, [s_shape[0], 1, 1]);
#ss = tf.tile(ss, [1, 1, c_shape[0]]);
#pairwise distances
dist = tf.sqrt(tf.reduce_sum(tf.squared_difference(xx,yy), reduction_indices = 1));
return dist;
machine_vision_c.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录