本文整理汇总了Java中org.nd4j.linalg.ops.transforms.Transforms.reverse方法的典型用法代码示例。如果您正苦于以下问题:Java Transforms.reverse方法的具体用法?Java Transforms.reverse怎么用?Java Transforms.reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nd4j.linalg.ops.transforms.Transforms
的用法示例。
在下文中一共展示了Transforms.reverse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTadPercentile1
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testTadPercentile1() throws Exception {
INDArray array = Nd4j.linspace(1, 10, 10);
Transforms.reverse(array, false);
Percentile percentile = new Percentile(75);
double exp = percentile.evaluate(array.data().asDouble());
INDArray matrix = Nd4j.create(10, 10);
for (int i = 0; i < matrix.rows(); i++)
matrix.getRow(i).assign(array);
INDArray res = matrix.percentile(75, 1);
for (int i = 0; i < matrix.rows(); i++)
assertEquals(exp, res.getDouble(i), 1e-5);
}
示例2: testReverse5
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testReverse5() throws Exception {
INDArray array = Nd4j.create(new double[] {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0});
INDArray exp = Nd4j.create(new double[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
INDArray rev = Transforms.reverse(array, true);
assertEquals(exp, rev);
assertFalse(rev == array);
}
示例3: testReverse6
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testReverse6() throws Exception {
INDArray array = Nd4j.create(new double[] {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0});
INDArray exp = Nd4j.create(new double[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
INDArray rev = Transforms.reverse(array, false);
assertEquals(exp, rev);
assertTrue(rev == array);
}
示例4: testNativeSort3_1
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testNativeSort3_1() throws Exception {
INDArray array = Nd4j.linspace(1, 2017152, 2017152);
INDArray exp = array.dup();
Transforms.reverse(array, false);
long time1 = System.currentTimeMillis();
INDArray res = Nd4j.sort(array, true);
long time2 = System.currentTimeMillis();
log.info("Time spent: {} ms", time2 - time1);
assertEquals(exp, res);
}