package org.algorithm.test;

import org.tensorflow.Tensor;

import java.nio.FloatBuffer;

/**
 * 测试tensorflow Tensor方法
 *
 * @Author: bijl
 * @Date: 2019/6/12 16:44
 * @Decription:
 */
public class TensorMethodTest {

    public static void main(String[] args) {
        float[] inputValues = {1, 2, 3, 4, 5, 6};
        long[] shape = {2, 3};  // 老模型
        Tensor<Float> tensor = Tensor.create(
                shape,
                FloatBuffer.wrap(inputValues)
        );
        float[][] xx = tensor.copyTo(new float[2][3]);
        for (int i = 0; i < xx.length; i++)
            for (int j = 0; j < xx[0].length; j++)
                System.out.println(i + "," + j + " --> " + xx[i][j]);

    }
}
