Source code

Revision control

Copy as Markdown

Other Tools

{ // elu: The calculation follows the expression max(0, x) + alpha * (exp(min(0, x)) - 1).
"tests": [
{
"name": "elu float32 1D constant tensor default options", // default options: {alpha: 1}
"inputs": {
"x": {
"shape": [24],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32",
"constant": true
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.9790657162666321,
1.3590080738067627,
-0.9790199995040894,
7.839725494384766,
-0.9987577199935913,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.999400794506073,
5.665064334869385,
-0.9987848997116089,
-0.9643816947937012,
-0.7019122838973999,
7.255547046661377,
8.903468132019043,
-0.982044517993927,
7.114678382873535,
-0.10607059299945831,
-0.9749990105628967,
6.135150909423828,
-0.99994957447052
],
"type": "float32"
}
},
{
"name": "elu float32 1D tensor default options", // default options: {alpha: 1}
"inputs": {
"x": {
"shape": [24],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.9790657162666321,
1.3590080738067627,
-0.9790199995040894,
7.839725494384766,
-0.9987577199935913,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.999400794506073,
5.665064334869385,
-0.9987848997116089,
-0.9643816947937012,
-0.7019122838973999,
7.255547046661377,
8.903468132019043,
-0.982044517993927,
7.114678382873535,
-0.10607059299945831,
-0.9749990105628967,
6.135150909423828,
-0.99994957447052
],
"type": "float32"
}
},
{
"name": "elu float32 2D tensor default options",
"inputs": {
"x": {
"shape": [4, 6],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [4, 6],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.9790657162666321,
1.3590080738067627,
-0.9790199995040894,
7.839725494384766,
-0.9987577199935913,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.999400794506073,
5.665064334869385,
-0.9987848997116089,
-0.9643816947937012,
-0.7019122838973999,
7.255547046661377,
8.903468132019043,
-0.982044517993927,
7.114678382873535,
-0.10607059299945831,
-0.9749990105628967,
6.135150909423828,
-0.99994957447052
],
"type": "float32"
}
},
{
"name": "elu float32 3D tensor default options",
"inputs": {
"x": {
"shape": [2, 3, 4],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [2, 3, 4],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.9790657162666321,
1.3590080738067627,
-0.9790199995040894,
7.839725494384766,
-0.9987577199935913,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.999400794506073,
5.665064334869385,
-0.9987848997116089,
-0.9643816947937012,
-0.7019122838973999,
7.255547046661377,
8.903468132019043,
-0.982044517993927,
7.114678382873535,
-0.10607059299945831,
-0.9749990105628967,
6.135150909423828,
-0.99994957447052
],
"type": "float32"
}
},
{
"name": "elu float32 4D tensor default options",
"inputs": {
"x": {
"shape": [1, 2, 3, 4],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [1, 2, 3, 4],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.9790657162666321,
1.3590080738067627,
-0.9790199995040894,
7.839725494384766,
-0.9987577199935913,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.999400794506073,
5.665064334869385,
-0.9987848997116089,
-0.9643816947937012,
-0.7019122838973999,
7.255547046661377,
8.903468132019043,
-0.982044517993927,
7.114678382873535,
-0.10607059299945831,
-0.9749990105628967,
6.135150909423828,
-0.99994957447052
],
"type": "float32"
}
},
{
"name": "elu float32 5D tensor default options",
"inputs": {
"x": {
"shape": [1, 2, 1, 3, 4],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [1, 2, 1, 3, 4],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.9790657162666321,
1.3590080738067627,
-0.9790199995040894,
7.839725494384766,
-0.9987577199935913,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.999400794506073,
5.665064334869385,
-0.9987848997116089,
-0.9643816947937012,
-0.7019122838973999,
7.255547046661377,
8.903468132019043,
-0.982044517993927,
7.114678382873535,
-0.10607059299945831,
-0.9749990105628967,
6.135150909423828,
-0.99994957447052
],
"type": "float32"
}
},
{
"name": "elu float32 4D tensor positive options.alpha",
"inputs": {
"x": {
"shape": [1, 2, 3, 4],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"options": {
"alpha": 0.3607245505146506
},
"expected": {
"name": "output",
"shape": [1, 2, 3, 4],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
-0.35317301750183105,
1.3590080738067627,
-0.35315653681755066,
7.839725494384766,
-0.36027640104293823,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
-0.36050841212272644,
5.665064334869385,
-0.3602862060070038,
-0.3478761315345764,
-0.25319698452949524,
7.255547046661377,
8.903468132019043,
-0.3542475700378418,
7.114678382873535,
-0.0382622666656971,
-0.3517060875892639,
6.135150909423828,
-0.3607063591480255
],
"type": "float32"
}
},
{
"name": "elu float32 4D tensor negative options.alpha",
"inputs": {
"x": {
"shape": [1, 2, 3, 4],
"data": [
4.721739616402454,
0.37687805459885837,
1.4189998297338988,
-3.866366516102673,
1.3590080831697868,
-3.8641844556612392,
7.839725573639406,
-6.690801377003339,
0.545640671378024,
5.776711453839759,
7.263273186498619,
-7.419948093040434,
5.665064356187175,
-6.712906923265587,
-3.3348948531721945,
-1.2103675328053143,
7.255546982014842,
8.903468527480992,
-4.019860311974934,
7.114678383091487,
-0.11212847159184136,
-3.688840965850466,
6.135151096361078,
-9.895182558358613
],
"type": "float32"
}
},
"options": {
"alpha": -3.468180406374035
},
"expected": {
"name": "output",
"shape": [1, 2, 3, 4],
"data": [
4.721739768981934,
0.3768780529499054,
1.4189997911453247,
3.3955764770507812,
1.3590080738067627,
3.3954179286956787,
7.839725494384766,
3.463871955871582,
0.5456406474113464,
5.776711463928223,
7.263273239135742,
3.466102361679077,
5.665064334869385,
3.463966131210327,
3.34464955329895,
2.434358596801758,
7.255547046661377,
8.903468132019043,
3.40590763092041,
7.114678382873535,
0.3678719699382782,
3.381472587585449,
6.135150909423828,
3.468005657196045
],
"type": "float32"
}
}
]
}