import tensorflow as tf

        for i in range(new_w):
            weights[i:i + h, i] = 1.0
        weights_list += [weights]
    weights_tensors = tf.stack([tf.convert_to_tensor(weights, dtype=tf.float32) for weights in weights_list])

    rand_horizon = tf.random_uniform((), 0, horizon, dtype=tf.int32)
    new_w = epi_len - rand_horizon
    cur_weights = tf.slice(weights_tensors[tf.cast(rand_horizon, tf.int32)], [0, 0], [epi_len, new_w])
    # cur_weights = tf.slice(weights_tensors, [tf.cast(rand_horizon, tf.int32), 0, 0], [1, epi_len, new_w])
    horizon_pred = tf.matmul(pred, cur_weights)
    horizon_tgt = tf.matmul(tgt, cur_weights)
    return horizon_pred, horizon_tgt


