本文整理汇总了Java中org.nd4j.linalg.ops.transforms.Transforms.sigmoid方法的典型用法代码示例。如果您正苦于以下问题:Java Transforms.sigmoid方法的具体用法?Java Transforms.sigmoid怎么用?Java Transforms.sigmoid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nd4j.linalg.ops.transforms.Transforms
的用法示例。
在下文中一共展示了Transforms.sigmoid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSigmoid
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testSigmoid() {
INDArray n = Nd4j.create(new float[]{1, 2, 3, 4});
INDArray assertion = Nd4j.create(new float[]{0.73105858f, 0.88079708f, 0.95257413f, 0.98201379f});
INDArray sigmoid = Transforms.sigmoid(n);
assertEquals(assertion,sigmoid);
}
示例2: testSum
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testSum() {
SameDiff sameDiff = SameDiff.create();
INDArray arr = Transforms.sigmoid(Nd4j.linspace(1, 4, 4));
SDVariable x = sameDiff.var("x", arr);
SDVariable result = sameDiff.sum(x, 1); //[1,4].sum(1) == [1,1]
assertArrayEquals(new int[]{1,1}, result.getShape());
}
示例3: testTranspose
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testTranspose() {
SameDiff sameDiff = SameDiff.create();
INDArray arr = Transforms.sigmoid(Nd4j.linspace(1, 4, 4));
SDVariable x = sameDiff.var("x", arr);
SDVariable result = sameDiff.transpose(x);
sameDiff.exec();
assertArrayEquals(new int[]{4, 1}, result.getArr().shape());
}
示例4: testEval
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testEval() {
SameDiff sameDiff = SameDiff.create();
INDArray arr = Nd4j.linspace(1, 4, 4);
SDVariable x = sameDiff.var("x", arr);
SDVariable sigmoid = sameDiff.sigmoid(x);
INDArray assertion = Transforms.sigmoid(arr);
INDArray[] eval = sameDiff.eval(Collections.singletonMap("x", arr));
assertEquals(assertion, eval[0]);
}
示例5: testDenseLayerForwardPass
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testDenseLayerForwardPass() {
Nd4j.getRandom().setSeed(12345);
SameDiff sd = SameDiff.create();
INDArray iInput = Nd4j.rand(3,4);
INDArray iWeights = Nd4j.rand(4,5);
INDArray iBias = Nd4j.rand(1,5);
SDVariable input = sd.var("input", iInput);
SDVariable weights = sd.var("weights", iWeights);
SDVariable bias = sd.var("bias", iBias);
SDVariable mmul = sd.mmul("mmul", input, weights);
SDVariable z = mmul.add("z", bias);
SDVariable out = sd.sigmoid("out", z);
INDArray expMmul = iInput.mmul(iWeights);
INDArray expZ = expMmul.addRowVector(iBias);
INDArray expOut = Transforms.sigmoid(expZ, true);
sd.exec();
assertEquals(expMmul, mmul.getArr());
assertEquals(expZ, z.getArr());
assertEquals(expOut, out.getArr());
}
示例6: testSigmoid
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testSigmoid() {
INDArray n = Nd4j.create(new float[] {1, 2, 3, 4});
INDArray assertion = Nd4j.create(new float[] {0.73105858f, 0.88079708f, 0.95257413f, 0.98201379f});
INDArray sigmoid = Transforms.sigmoid(n, false);
assertEquals(assertion, sigmoid);
}
示例7: testSigmoid
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Test
public void testSigmoid() {
INDArray n = Nd4j.create(new float[] {1, 2, 3, 4});
INDArray assertion = Nd4j.create(new float[] {0.73105858f, 0.88079708f, 0.95257413f, 0.98201379f});
INDArray sigmoid = Transforms.sigmoid(n, false);
assertEquals(getFailureMessage(), assertion, sigmoid);
}
示例8: runOp
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Override
public void runOp() {
Transforms.sigmoid(arr);
}
示例9: runOp
import org.nd4j.linalg.ops.transforms.Transforms; //导入方法依赖的package包/类
@Override
public void runOp() {
Transforms.sigmoid(arr, false);
}