(k, xyz1, xyz2)
return val, idx
Input:
        k: int32, number of k in k-nn search
        xyz1: (batch_size, ndataset, c) float32 array, input points
        xyz2: (batch_size, npoint, c) float32 array, query points
    Output:
        val: (batch_size, npoint, k) float32 array, L2 distances
        idx: (batch_size, npoint, k) int32 array, indices to input points
Input:
        k: int32, number of k in k-nn search
        xyz1: (batch_size, ndataset, c) float32 array, input points
        xyz2: (batch_size, npoint, c) float32 array, query points
    Output:
        val: (batch_size, npoint, k) float32 array, L2 distances
        idx: (batch_size, npoint, k) int32 array, indices to input points
Input : k : int32 number of k in k - nn search xyz1 : ( batch_size ndataset c ) float32 array input points xyz2 : ( batch_size npoint c ) float32 array query points Output : val : ( batch_size npoint k ) float32 array L2 distances idx : ( batch_size npoint k ) int32 array indices to input points
def knn_point(k, xyz1, xyz2):
    """
    Input:
        k: int32, number of k in k-nn search
        xyz1: (batch_size, ndataset, c) float32 array, input points
        xyz2: (batch_size, npoint, c) float32 array, query points
    Output:
        val: (batch_size, npoint, k) float32 array, L2 distances
        idx: (batch_size, npoint, k) int32 array, indices to input points
    """
    b = xyz1.get_shape()[0].value
    n = xyz1.get_shape()[1].value
    c = xyz1.get_shape()[2].value
    m = xyz2.get_shape()[1].value
    print((b, n, c, m))
    print((xyz1, (b, 1, n, c)))
    #    xyz1 = tf.tile(tf.reshape(xyz1, (b,1,n,c)), [1,m,1,1])  # this does not work when the batch size is unknown (None)
    #    xyz2 = tf.tile(tf.reshape(xyz2, (b,m,1,c)), [1,1,n,1])  # this does not work when the batch size is unknown (None)
    xyz1 = tf.tile(tf.expand_dims(xyz1, axis=1), [1, m, 1, 1])
    xyz2 = tf.tile(tf.expand_dims(xyz2, axis=2), [1, 1, n, 1])
    dist = tf.reduce_sum((xyz1 - xyz2) ** 2, -1)
    print((dist, k))
    outi, out = select_top_k(k, dist)
    idx = tf.slice(outi, [0, 0, 0], [-1, -1, k])
    val = tf.slice(out, [0, 0, 0], [-1, -1, k])
    print((idx, val))
    # val, idx = tf.nn.top_k(-dist, k=k) # ONLY SUPPORT CPU
    return val, idx
def knn_point ( k , xyz1 , xyz2 ) : b = xyz1 . get_shape ( ) [ 0 ] . value n = xyz1 . get_shape ( ) [ 1 ] . value c = xyz1 . get_shape ( ) [ 2 ] . value m = xyz2 . get_shape ( ) [ 1 ] . value print ( ( b , n , c , m ) ) print ( ( xyz1 , ( b , 1 , n , c ) ) ) #    xyz1 = tf.tile(tf.reshape(xyz1, (b,1,n,c)), [1,m,1,1])  # this does not work when the batch size is unknown (None) #    xyz2 = tf.tile(tf.reshape(xyz2, (b,m,1,c)), [1,1,n,1])  # this does not work when the batch size is unknown (None) xyz1 = tf . tile ( tf . expand_dims ( xyz1 , axis = 1 ) , [ 1 , m , 1 , 1 ] ) xyz2 = tf . tile ( tf . expand_dims ( xyz2 , axis = 2 ) , [ 1 , 1 , n , 1 ] ) dist = tf . reduce_sum ( ( xyz1 - xyz2 ) ** 2 , - 1 ) print ( ( dist , k ) ) outi , out = select_top_k ( k , dist ) idx = tf . slice ( outi , [ 0 , 0 , 0 ] , [ - 1 , - 1 , k ] ) val = tf . slice ( out , [ 0 , 0 , 0 ] , [ - 1 , - 1 , k ] ) print ( ( idx , val ) ) # val, idx = tf.nn.top_k(-dist, k=k) # ONLY SUPPORT CPU return val , idx