Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
How to get value of tensor2d in tensorflow.js model which corresponds to a numpy array

So I have h5 Keras Tensorflow Deep Learning model which accepts a NumPy array as an input and gives the desired numerical result in a form of a NumPy array (Python)

input of a numpy array in model.predict function

Now I want to do the same in tensorflow.js so I converted the model and imported it and used the model.predict function (JavaScript)

    const x = tf.tensor2d([company_name])
    const output = model.predict(x)
    console.log(output)

And I get this as the output

Tensor {
  kept: false,
  isDisposedInternal: false,
  shape: [ 1, 1 ],
  dtype: 'float32',
  size: 1,
  strides: [ 1 ],
  dataId: { id: 35 },
  id: 52,
  rankType: '2',
  scopeId: 0
}

I would like to get the actual value of the tensor2d like 38.340986 that I got in the NumPy array. I tried using

model.predict(x.get(0,0));

But it returns a type error

Help is appreciated.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You will need to download the tensors when using Tensorflow.js

const output = model.predict(x).dataSync()
about 4 years ago · Juan Pablo Isaza Denunciar

0

Tensors are the core datastructure of TensorFlow.js They are a generalization of vectors and matrices to potentially higher dimensions.

model.predict(np.array([value1], [value2])))
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda