def portfolio_computeKnm(X, Xbar, l, sigma, dtype=tf.float32):
    '\n    X: n x d\n    l: d\n    '
    n = tf.shape(X)[0]
    m = tf.shape(Xbar)[0]
    X = (X / l)
    Xbar = (Xbar / l)
    Q = tf.tile(tf.reduce_sum(tf.square(X), axis=1, keepdims=True), multiples=(1, m))
    Qbar = tf.tile(tf.transpose(tf.reduce_sum(tf.square(Xbar), axis=1, keepdims=True)), multiples=(n, 1))
    dist = ((Qbar + Q) - ((2 * X) @ tf.transpose(Xbar)))
    knm = (sigma * tf.exp(((- 0.5) * dist)))
    return knm
X: n x d
l: d
def portfolio_computeKnm(X, Xbar, l, sigma, dtype=tf.float32):
    '\n    X: n x d\n    l: d\n    '
    n = tf.shape(X)[0]
    m = tf.shape(Xbar)[0]
    X = (X / l)
    Xbar = (Xbar / l)
    Q = tf.tile(tf.reduce_sum(tf.square(X), axis=1, keepdims=True), multiples=(1, m))
    Qbar = tf.tile(tf.transpose(tf.reduce_sum(tf.square(Xbar), axis=1, keepdims=True)), multiples=(n, 1))
    dist = ((Qbar + Q) - ((2 * X) @ tf.transpose(Xbar)))
    knm = (sigma * tf.exp(((- 0.5) * dist)))
    return knm