Source code

Revision control

Copy as Markdown

Other Tools

{ // softsign: The calculation follows the expression x / (1 + |x|).
"tests": [
{
"name": "softsign positive float32 1D constant tensor",
"inputs": {
"x": {
"shape": [24],
"data": [
1.5834133593790956,
4.0787189411490115,
8.883356617490337,
8.070860233252166,
8.211773633019915,
2.4554003891197818,
0.653374178120758,
7.866281154604682,
3.1239552336192666,
8.013792390668268,
3.9409862749371283,
1.8131727337833081,
2.390676102273188,
1.3359680092645565,
9.416410839467265,
0.44325690899325254,
5.236662013213598,
9.424242359034539,
7.816190418459348,
5.849185795081855,
8.780370640491928,
5.1205157788312246,
7.1172223514005095,
4.59910661262345
],
"type": "float32",
"constant": true
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
0.6129152178764343,
0.8030999898910522,
0.8988198041915894,
0.8897568583488464,
0.8914432525634766,
0.7105979323387146,
0.3951762318611145,
0.8872131109237671,
0.7575143575668335,
0.8890588879585266,
0.7976112365722656,
0.6445294618606567,
0.7050735354423523,
0.5719119310379028,
0.9039976596832275,
0.30712267756462097,
0.8396578431129456,
0.9040697813034058,
0.8865723013877869,
0.8539972305297852,
0.8977543711662292,
0.8366150856018066,
0.8768051266670227,
0.8214001059532166
],
"type": "float32"
}
},
{
"name": "softsign positive float32 1D tensor",
"inputs": {
"x": {
"shape": [24],
"data": [
1.5834133593790956,
4.0787189411490115,
8.883356617490337,
8.070860233252166,
8.211773633019915,
2.4554003891197818,
0.653374178120758,
7.866281154604682,
3.1239552336192666,
8.013792390668268,
3.9409862749371283,
1.8131727337833081,
2.390676102273188,
1.3359680092645565,
9.416410839467265,
0.44325690899325254,
5.236662013213598,
9.424242359034539,
7.816190418459348,
5.849185795081855,
8.780370640491928,
5.1205157788312246,
7.1172223514005095,
4.59910661262345
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
0.6129152178764343,
0.8030999898910522,
0.8988198041915894,
0.8897568583488464,
0.8914432525634766,
0.7105979323387146,
0.3951762318611145,
0.8872131109237671,
0.7575143575668335,
0.8890588879585266,
0.7976112365722656,
0.6445294618606567,
0.7050735354423523,
0.5719119310379028,
0.9039976596832275,
0.30712267756462097,
0.8396578431129456,
0.9040697813034058,
0.8865723013877869,
0.8539972305297852,
0.8977543711662292,
0.8366150856018066,
0.8768051266670227,
0.8214001059532166
],
"type": "float32"
}
},
{
"name": "softsign negative float32 1D tensor",
"inputs": {
"x": {
"shape": [24],
"data": [
-2.5978440095516913,
-0.4449555447737712,
-9.095475232407683,
-3.7480076975512873,
-1.3867289790255697,
-8.220328902868987,
-3.538342320320556,
-9.364588742025619,
-6.283252341501335,
-5.0020120266550006,
-8.245729151019969,
-3.775470497728266,
-4.087254829132392,
-7.3816760861585795,
-5.882921529710956,
-8.338910337100263,
-6.6015492897072185,
-4.491942000901396,
-3.524778486355298,
-4.439912258765581,
-5.2342625634221225,
-1.5911732471016933,
-9.106277545690418,
-8.523774275382141
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
-0.7220557928085327,
-0.3079372048377991,
-0.9009457230567932,
-0.7893853783607483,
-0.5810165405273438,
-0.891543984413147,
-0.7796552181243896,
-0.9035176634788513,
-0.8626986742019653,
-0.8333892226219177,
-0.8918419480323792,
-0.7905965447425842,
-0.8034303188323975,
-0.8806921243667603,
-0.8547128438949585,
-0.8929211497306824,
-0.8684478402137756,
-0.8179150223731995,
-0.7789947390556335,
-0.8161734938621521,
-0.8395960927009583,
-0.6140744686126709,
-0.9010515809059143,
-0.894999623298645
],
"type": "float32"
}
},
{
"name": "softsign float32 2D tensor",
"inputs": {
"x": {
"shape": [4, 6],
"data": [
-8.343496173533422,
-6.92015211612679,
2.699638761922575,
-8.663104577031863,
-3.190534368785616,
7.657887080586452,
6.650215091182602,
6.058011004380681,
0.6634320403254037,
5.805803683155526,
-0.32821124531446344,
1.270430403469046,
-9.946119978610852,
6.905375202832072,
-0.031071535439890496,
-3.9696409293645862,
6.270823207970878,
-2.6392608577007914,
3.051350503137261,
7.42647683445869,
-8.454667518154086,
7.135868292466057,
-4.9860941550065885,
-7.859615086397076
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [4, 6],
"data": [
-0.8929736614227295,
-0.8737397789955139,
0.7297033667564392,
-0.8965135812759399,
-0.7613669633865356,
0.8844983577728271,
0.8692847490310669,
0.8583170175552368,
0.3988332748413086,
0.8530665636062622,
-0.24710771441459656,
0.5595548748970032,
-0.9086434245109558,
0.8735038042068481,
-0.03013519011437893,
-0.798778235912323,
0.8624640107154846,
-0.7252188920974731,
0.7531687617301941,
0.88132643699646,
-0.8942321538925171,
0.8770874738693237,
-0.8329461812973022,
-0.8871282935142517
],
"type": "float32"
}
},
{
"name": "softsign float32 3D tensor",
"inputs": {
"x": {
"shape": [2, 3, 4],
"data": [
-8.343496173533422,
-6.92015211612679,
2.699638761922575,
-8.663104577031863,
-3.190534368785616,
7.657887080586452,
6.650215091182602,
6.058011004380681,
0.6634320403254037,
5.805803683155526,
-0.32821124531446344,
1.270430403469046,
-9.946119978610852,
6.905375202832072,
-0.031071535439890496,
-3.9696409293645862,
6.270823207970878,
-2.6392608577007914,
3.051350503137261,
7.42647683445869,
-8.454667518154086,
7.135868292466057,
-4.9860941550065885,
-7.859615086397076
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [2, 3, 4],
"data": [
-0.8929736614227295,
-0.8737397789955139,
0.7297033667564392,
-0.8965135812759399,
-0.7613669633865356,
0.8844983577728271,
0.8692847490310669,
0.8583170175552368,
0.3988332748413086,
0.8530665636062622,
-0.24710771441459656,
0.5595548748970032,
-0.9086434245109558,
0.8735038042068481,
-0.03013519011437893,
-0.798778235912323,
0.8624640107154846,
-0.7252188920974731,
0.7531687617301941,
0.88132643699646,
-0.8942321538925171,
0.8770874738693237,
-0.8329461812973022,
-0.8871282935142517
],
"type": "float32"
}
},
{
"name": "softsign float32 4D tensor",
"inputs": {
"x": {
"shape": [1, 2, 3, 4],
"data": [
-8.343496173533422,
-6.92015211612679,
2.699638761922575,
-8.663104577031863,
-3.190534368785616,
7.657887080586452,
6.650215091182602,
6.058011004380681,
0.6634320403254037,
5.805803683155526,
-0.32821124531446344,
1.270430403469046,
-9.946119978610852,
6.905375202832072,
-0.031071535439890496,
-3.9696409293645862,
6.270823207970878,
-2.6392608577007914,
3.051350503137261,
7.42647683445869,
-8.454667518154086,
7.135868292466057,
-4.9860941550065885,
-7.859615086397076
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [1, 2, 3, 4],
"data": [
-0.8929736614227295,
-0.8737397789955139,
0.7297033667564392,
-0.8965135812759399,
-0.7613669633865356,
0.8844983577728271,
0.8692847490310669,
0.8583170175552368,
0.3988332748413086,
0.8530665636062622,
-0.24710771441459656,
0.5595548748970032,
-0.9086434245109558,
0.8735038042068481,
-0.03013519011437893,
-0.798778235912323,
0.8624640107154846,
-0.7252188920974731,
0.7531687617301941,
0.88132643699646,
-0.8942321538925171,
0.8770874738693237,
-0.8329461812973022,
-0.8871282935142517
],
"type": "float32"
}
},
{
"name": "softsign float32 5D tensor",
"inputs": {
"x": {
"shape": [1, 2, 1, 3, 4],
"data": [
-8.343496173533422,
-6.92015211612679,
2.699638761922575,
-8.663104577031863,
-3.190534368785616,
7.657887080586452,
6.650215091182602,
6.058011004380681,
0.6634320403254037,
5.805803683155526,
-0.32821124531446344,
1.270430403469046,
-9.946119978610852,
6.905375202832072,
-0.031071535439890496,
-3.9696409293645862,
6.270823207970878,
-2.6392608577007914,
3.051350503137261,
7.42647683445869,
-8.454667518154086,
7.135868292466057,
-4.9860941550065885,
-7.859615086397076
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [1, 2, 1, 3, 4],
"data": [
-0.8929736614227295,
-0.8737397789955139,
0.7297033667564392,
-0.8965135812759399,
-0.7613669633865356,
0.8844983577728271,
0.8692847490310669,
0.8583170175552368,
0.3988332748413086,
0.8530665636062622,
-0.24710771441459656,
0.5595548748970032,
-0.9086434245109558,
0.8735038042068481,
-0.03013519011437893,
-0.798778235912323,
0.8624640107154846,
-0.7252188920974731,
0.7531687617301941,
0.88132643699646,
-0.8942321538925171,
0.8770874738693237,
-0.8329461812973022,
-0.8871282935142517
],
"type": "float32"
}
}
]
}