|
| 1 | +/* |
| 2 | + * Encog(tm) Core v3.4 - Java Version |
| 3 | + * http://www.heatonresearch.com/encog/ |
| 4 | + * https://github.com/encog/encog-java-core |
| 5 | +
|
| 6 | + * Copyright 2008-2017 Heaton Research, Inc. |
| 7 | + * |
| 8 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | + * you may not use this file except in compliance with the License. |
| 10 | + * You may obtain a copy of the License at |
| 11 | + * |
| 12 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | + * |
| 14 | + * Unless required by applicable law or agreed to in writing, software |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | + * See the License for the specific language governing permissions and |
| 18 | + * limitations under the License. |
| 19 | + * |
| 20 | + * For more information on Heaton Research copyrights, licenses |
| 21 | + * and trademarks visit: |
| 22 | + * http://www.heatonresearch.com/copyright |
| 23 | + */ |
| 24 | +package org.encog.neural.activation; |
| 25 | + |
| 26 | +import junit.framework.TestCase; |
| 27 | +import org.encog.Encog; |
| 28 | +import org.encog.engine.network.activation.ActivationReLU; |
| 29 | +import org.junit.Assert; |
| 30 | + |
| 31 | +public class TestActivationReLU extends TestCase { |
| 32 | + public void testActivationWithParams() { |
| 33 | + double v = -0.066669475510992; |
| 34 | + double[] vx = {v}; |
| 35 | + |
| 36 | + new ActivationReLU().activationFunction(vx, 0, 1); |
| 37 | + Assert.assertEquals(0.0, vx[0], Encog.DEFAULT_DOUBLE_EQUAL); |
| 38 | + |
| 39 | + vx[0] = v; |
| 40 | + new ActivationReLU(-0.1, 0.0).activationFunction(vx, 0, 1); |
| 41 | + Assert.assertEquals(v, vx[0], Encog.DEFAULT_DOUBLE_EQUAL); |
| 42 | + } |
| 43 | +} |
0 commit comments