0

Resuelve los errores

import org.tensorflow.Graph; import org.tensorflow.Session; import org.tensorflow.Tensor; public class EjemploIA { public static void main(String[] args) throws Exception { try (Graph graph = new Graph()) { // Cargar el modelo previamente entrenado byte[] model = Files.readAllBytes(Paths.get("ruta/al/modelo.pb")); graph.importGraphDef(model); try (Session session = new Session(graph)) { // Crear los datos de entrada para la predicción float[][] inputData = {{1.0f, 2.0f, 3.0f}, {4.0f, 5.0f, 6.0f}}; long[] inputShape = {2, 3}; Tensor inputTensor = Tensor.create(inputShape, FloatBuffer.wrap(inputData)); // Realizar la predicción utilizando el modelo cargado Tensor outputTensor = session.runner() .feed("input", inputTensor) .fetch("output") .run() .get(0); // Imprimir el resultado de la predicción float[][] outputData = new float[2][1]; outputTensor.copyTo(outpu

2nd Jun 2023, 5:23 PM
Daniel Agustín Hurtado
Daniel Agustín Hurtado - avatar
1 ответ
+ 5
Your code looks incomplete – it got cut off. Put your code in a script on sololearn playground.
2nd Jun 2023, 5:24 PM
Lisa
Lisa - avatar