title: How To fix "must be numeric tensor, but got string tensor" error
body: <p>hey there I am having a problem with this code that I am trying from the tutorial. I have been trying to create a simple machine learning code with number prediction. </p>
  
  <pre><code>  &lt;div v-for="(item, index) in xValues" v-bind:key="index"&gt;
          &lt;div&gt;
  
            &lt;div class="col-sm-1"&gt;
              &lt;input class="field field-x" v-model="xValues[index]" type="number"&gt;
              &lt;input class="field field-y" v-model="yValues[index]" type="number"&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;/div&gt;
  
        &lt;button class="button-add-example button--green" v-on:click="addItem"&gt;Add Value&lt;/button&gt;
        &lt;button class="button-train button--green" v-on:click="train"&gt;Train&lt;/button&gt;
      &lt;/div&gt;
  
      &lt;div class="predict-controls"&gt;
        &lt;h2 class="section col-sm-1"&gt;Predicting&lt;/h2&gt;
        &lt;input class="field element" v-model="valueToPredict" type="number" placeholder="Enter a number"&gt;&lt;br&gt;
        &lt;div class="element" {{predictedValue}}&gt;&lt;/div&gt;
        &lt;button class="element button--green" v-on:click="predict" :disabled="!trained"&gt;Predict&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  import * as tf from '@tensorflow/tfjs';
  export default {
    data() {
      return {
        trained: false,
        xValues: [1,2,3,4,5,6],
        yValues: [1,3,5,7,9,11],
        predictedValue:'Click on train',
        valueToPredict: ''
      }
    },
    methods: {
      addItem() {
        this.xValues.push(0);
        this.yValues.push(0);
      },
      train() {
        // Define a model for linear regression.
        const model = this.model = tf.sequential();
        model.add(tf.layers.dense({units: 1, inputShape: [1]}));
        // Prepare the model for training: Specify the loss and the optimizer.
        model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});
        const xs = tf.tensor2d(this.xValues, [this.xValues.length, 1]);
        const ys = tf.tensor2d(this.yValues, [this.yValues.length, 1]);
        // Train the model using the data.
        model.fit(xs, ys, {epochs: 50}).then(() =&gt; {
          this.trained = true;
          this.predictedValue = 'Ready for making predictions';
        });
      },
      predict() {
        // Use the model to do inference on a data point the model hasn't seen before:
        this.predictedValue = this.model.predict(tf.tensor2d([this.valueToPredict], [1, 1])).get(0, 0);
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I got this error message but everyting seems fine in visual studio</p>
  
  <p>Argument 'x' passed to 'slice2d' must be numeric tensor, but got string tensor
  An error occurred while rendering the page. Check developer tools console for details</p>