Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

296
Visualizações
Array of Tensors you are passing to your model is not the size the model expected. Expected to see 1 Tensor(s), but instead got 0 Tensors(s)

I'm trying to pass in an array of strings and integers as training data, with a single boolean (0 or 1) as the label. However, after creating the training array and passing it to Tensorflow's fitDataset function, it complains that there are 0 tensors found.

csvTransform2 =
  ((val: any) => {
    const {xs, ys} = val
  
    console.log(xs)
    const values = Object.values(xs) as any[]
    return {xs: values, ys: ys.winner};
  })

async predict () {
    // Train a simple model:
    let trainingData = tf.data.csv('file://file.csv', {columnConfigs: {winner: {isLabel: true}}})
    const numOfColumns =  (await trainingData.columnNames()).length - 1;

    let newTrainingData = trainingData.map(this.csvTransform2);

    const model = tf.sequential();
    model.add(tf.layers.dense({units: 64, activation: 'relu', inputShape: [numOfColumns]}));
    model.add(tf.layers.dense({units: 32, activation: 'relu'}));
    model.add(tf.layers.dense({units: 8, activation: 'relu'}));
    model.add(tf.layers.dense({units: 1, activation: 'softmax'}));
    model.compile({
      optimizer: 'sgd', 
      loss: 'sparseCategoricalCrossentropy',
      metrics: ['accuracy']
    });

    model.fitDataset(newTrainingData, {
      epochs: 10,
      callbacks: {
        onEpochEnd: async (epoch, logs) => {
          console.log(epoch + ':' + logs.loss);
        }
      }
    });
  }

The full error is

ValueError: Error when checking model : the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see 1 Tensor(s), but instead got 0 Tensors(s).

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda