mercredi 19 août 2020

Saving previous values of a Tensorflow.js tensor

I have an function which stores all of the values of the tensor and then concatonates it into one matrix. The function looks like this:

    if (i == 1) {
        var y_pred1 = y_pred
    } else if (i == 2) {
        var y_pred2 = y_pred
    } else if (i == 3) {
        var y_pred3 = y_pred
    } else if (i == 4) {
        var y_pred4 = y_pred
    }
tf.concat([y_pred1, y_pred2, y_pred3, y_pred4])

This function stores every value of y_pred across every iteration of an for loop. Is there a way to make this more efficient so that I do not need to have an obscure amount of if statements inside of model. For your information y_pred is an tensor.

Aucun commentaire:

Enregistrer un commentaire