Source code

Revision control

Copy as Markdown

Other Tools

{
"tests": [
{
"name": "batchNormalization float32 2D tensor (mean and variance are non-constant) default options",
"inputs": {
"input": {
"shape": [4, 6],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [6],
"data": [
-7.814267643537363,
-95.6412954353084,
38.154405424391285,
-55.9520351570133,
-87.8650062484926,
-41.636455304505525
],
"type": "float32"
},
"variance": {
"shape": [6],
"data": [
60.311864286118144,
26.432604504927436,
53.275636661772396,
40.146120500534074,
59.41098289103077,
35.99981828466932
],
"type": "float32"
}
},
"expected": {
"shape": [4, 6],
"data": [
-4.312741756439209,
31.068212509155273,
-13.910240173339844,
1.4459478855133057,
22.170541763305664,
-6.407354354858398,
-6.995829105377197,
18.583200454711914,
-10.831125259399414,
17.820920944213867,
16.2480411529541,
16.447195053100586,
11.57226848602295,
1.8526301383972168,
5.306026458740234,
24.145092010498047,
8.629376411437988,
-9.216986656188965,
-0.1989477425813675,
34.203548431396484,
-16.923160552978516,
18.671411514282227,
2.5159497261047363,
4.921559810638428
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 2D constant tensor default options",
"inputs": {
"input": {
"shape": [4, 6],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32",
"constant": true
},
"mean": {
"shape": [6],
"data": [
-7.814267643537363,
-95.6412954353084,
38.154405424391285,
-55.9520351570133,
-87.8650062484926,
-41.636455304505525
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [6],
"data": [
60.311864286118144,
26.432604504927436,
53.275636661772396,
40.146120500534074,
59.41098289103077,
35.99981828466932
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [4, 6],
"data": [
-4.312741756439209,
31.068212509155273,
-13.910240173339844,
1.4459478855133057,
22.170541763305664,
-6.407354354858398,
-6.995829105377197,
18.583200454711914,
-10.831125259399414,
17.820920944213867,
16.2480411529541,
16.447195053100586,
11.57226848602295,
1.8526301383972168,
5.306026458740234,
24.145092010498047,
8.629376411437988,
-9.216986656188965,
-0.1989477425813675,
34.203548431396484,
-16.923160552978516,
18.671411514282227,
2.5159497261047363,
4.921559810638428
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 2D tensor default options",
"inputs": {
"input": {
"shape": [4, 6],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [6],
"data": [
-7.814267643537363,
-95.6412954353084,
38.154405424391285,
-55.9520351570133,
-87.8650062484926,
-41.636455304505525
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [6],
"data": [
60.311864286118144,
26.432604504927436,
53.275636661772396,
40.146120500534074,
59.41098289103077,
35.99981828466932
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [4, 6],
"data": [
-4.312741756439209,
31.068212509155273,
-13.910240173339844,
1.4459478855133057,
22.170541763305664,
-6.407354354858398,
-6.995829105377197,
18.583200454711914,
-10.831125259399414,
17.820920944213867,
16.2480411529541,
16.447195053100586,
11.57226848602295,
1.8526301383972168,
5.306026458740234,
24.145092010498047,
8.629376411437988,
-9.216986656188965,
-0.1989477425813675,
34.203548431396484,
-16.923160552978516,
18.671411514282227,
2.5159497261047363,
4.921559810638428
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 3D tensor default options",
"inputs": {
"input": {
"shape": [2, 3, 4],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
12.810381162337634,
63.13715247590298,
-61.6298331266107
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
18.35824023925998,
41.847234441124506,
16.128282835364406
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [2, 3, 4],
"data": [
-12.630594253540039,
11.967890739440918,
-17.781383514404297,
-13.910285949707031,
3.0739352703094482,
-22.139259338378906,
-19.36661148071289,
-9.775517463684082,
5.161267280578613,
29.53006935119629,
24.651947021484375,
29.550840377807617,
16.161500930786133,
-23.088642120361328,
14.954023361206055,
19.656957626342773,
-13.06058406829834,
-24.745210647583008,
-11.206846237182617,
2.638929843902588,
-5.910898208618164,
30.871898651123047,
-1.7038332223892212,
12.331327438354492
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D tensor default options",
"inputs": {
"input": {
"shape": [2, 3, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [2, 3, 2, 2],
"data": [
-16.842504501342773,
2.2579827308654785,
-20.842041015625,
-17.836172103881836,
-1.7581257820129395,
-19.30902862548828,
-17.37898826599121,
-10.702629089355469,
6.4271392822265625,
17.812623977661133,
15.533489227294922,
17.822328567504883,
5.514280319213867,
-24.963077545166016,
4.576685905456543,
8.228469848632812,
-12.989363670349121,
-21.123029708862305,
-11.698976516723633,
-2.0609331130981445,
1.2540507316589355,
18.43954849243164,
3.2196571826934814,
9.777103424072266
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 5D tensor default options",
"inputs": {
"input": {
"shape": [6, 1, 1, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [1],
"data": [
35.407824570198215
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [1],
"data": [
40.931099315280846
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [6, 1, 1, 2, 2],
"data": [
-11.990972518920898,
4.4829583168029785,
-15.440524101257324,
-12.847999572753906,
7.442382335662842,
-18.051416397094727,
-15.247910499572754,
-5.550075531005859,
-11.927642822265625,
3.369194269180298,
0.30708834528923035,
3.382232427597046,
7.291474342346191,
-18.99486541748047,
6.4828104972839355,
9.632428169250488,
-8.871702194213867,
-20.686368942260742,
-6.99733304977417,
7.002535343170166,
-18.877885818481445,
4.211489677429199,
-16.237018585205078,
-7.42683744430542
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NCHW tensor options.axis=1",
"inputs": {
"input": {
"shape": [2, 3, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"axis": 1
},
"expected": {
"shape": [2, 3, 2, 2],
"data": [
-16.842504501342773,
2.2579827308654785,
-20.842041015625,
-17.836172103881836,
-1.7581257820129395,
-19.30902862548828,
-17.37898826599121,
-10.702629089355469,
6.4271392822265625,
17.812623977661133,
15.533489227294922,
17.822328567504883,
5.514280319213867,
-24.963077545166016,
4.576685905456543,
8.228469848632812,
-12.989363670349121,
-21.123029708862305,
-11.698976516723633,
-2.0609331130981445,
1.2540507316589355,
18.43954849243164,
3.2196571826934814,
9.777103424072266
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NHWC tensor options.axis=3",
"inputs": {
"input": {
"shape": [2, 2, 2, 3],
"data": [
-41.30732967168238,
83.0222726565018,
-40.902161220312074,
64.08864045143429,
-80.08049213079853,
56.963061967558474,
-63.376671841233104,
-62.144380499565784,
37.37249789808206,
-46.7903680211994,
-0.10012771650340824,
57.04647733193906,
82.05679802728304,
-21.35103988063949,
-85.36802529512583,
-86.11642850667623,
-96.93823797160586,
62.35185227095363,
76.88317547014259,
-9.359310262561493,
-68.4724340974042,
97.03362133579051,
80.2082435478892,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"axis": 3
},
"expected": {
"shape": [2, 2, 2, 3],
"data": [
-16.842504501342773,
-1.7581257820129395,
6.4271392822265625,
2.2579827308654785,
-19.30902862548828,
17.812623977661133,
-20.842041015625,
-17.37898826599121,
15.533489227294922,
-17.836172103881836,
-10.702629089355469,
17.822328567504883,
5.514280319213867,
-12.989363670349121,
1.2540507316589355,
-24.963077545166016,
-21.123029708862305,
18.43954849243164,
4.576685905456543,
-11.698976516723633,
3.2196571826934814,
8.228469848632812,
-2.0609331130981445,
9.777103424072266
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NCHW tensor options.scale",
"inputs": {
"input": {
"shape": [2, 3, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"scale": {
"shape": [3],
"data": [
65.50171582968795,
-71.00757080938772,
-5.569730877611249
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [2, 3, 2, 2],
"data": [
-1103.212890625,
147.90174865722656,
-1365.189453125,
-1168.2999267578125,
124.84024047851562,
1371.087158203125,
1234.0396728515625,
759.9676513671875,
-35.79743576049805,
-99.2115249633789,
-86.51734924316406,
-99.26557159423828,
361.19482421875,
-1635.1243896484375,
299.78076171875,
538.9788818359375,
922.3430786132812,
1499.89501953125,
830.7158813476562,
146.3418426513672,
-6.984724998474121,
-102.70331573486328,
-17.9326229095459,
-54.455833435058594
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NCHW tensor options.bias",
"inputs": {
"input": {
"shape": [2, 3, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"bias": {
"shape": [3],
"data": [
64.20446782594775,
75.28591851497856,
-84.57243127763437
],
"type": "float32",
"constant": true
}
},
"expected": {
"shape": [2, 3, 2, 2],
"data": [
47.36196517944336,
66.46244812011719,
43.3624267578125,
46.36829376220703,
73.52779388427734,
55.976890563964844,
57.90693283081055,
64.58329010009766,
-78.14529418945312,
-66.75981140136719,
-69.03894805908203,
-66.75010681152344,
69.71875,
39.241390228271484,
68.7811508178711,
72.43293762207031,
62.29655456542969,
54.16288757324219,
63.586944580078125,
73.22498321533203,
-83.3183822631836,
-66.13288879394531,
-81.35277557373047,
-74.79533386230469
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NCHW tensor options.epsilon",
"inputs": {
"input": {
"shape": [2, 3, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"epsilon": 1e-6 // A small value to prevent computational error due to divide-by-zero.
},
"expected": {
"shape": [2, 3, 2, 2],
"data": [
-16.842506408691406,
2.2579832077026367,
-20.842044830322266,
-17.8361759185791,
-1.758125901222229,
-19.309030532836914,
-17.37898826599121,
-10.702629089355469,
6.427139759063721,
17.812625885009766,
15.533490180969238,
17.822330474853516,
5.514281272888184,
-24.96308135986328,
4.576686382293701,
8.228470802307129,
-12.989363670349121,
-21.123031616210938,
-11.698976516723633,
-2.0609331130981445,
1.254050850868225,
18.43954849243164,
3.2196574211120605,
9.777103424072266
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NCHW tensor options.activation relu",
"inputs": {
"input": {
"shape": [2, 3, 2, 2],
"data": [
-41.30732967168238,
64.08864045143429,
-63.376671841233104,
-46.7903680211994,
83.0222726565018,
-80.08049213079853,
-62.144380499565784,
-0.10012771650340824,
-40.902161220312074,
56.963061967558474,
37.37249789808206,
57.04647733193906,
82.05679802728304,
-86.11642850667623,
76.88317547014259,
97.03362133579051,
-21.35103988063949,
-96.93823797160586,
-9.359310262561493,
80.2082435478892,
-85.36802529512583,
62.35185227095363,
-68.4724340974042,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"activation": "relu"
},
"expected": {
"shape": [2, 3, 2, 2],
"data": [
0,
2.2579827308654785,
0,
0,
0,
0,
0,
0,
6.4271392822265625,
17.812623977661133,
15.533489227294922,
17.822328567504883,
5.514280319213867,
0,
4.576685905456543,
8.228469848632812,
0,
0,
0,
0,
1.2540507316589355,
18.43954849243164,
3.2196571826934814,
9.777103424072266
],
"type": "float32"
}
},
{
"name": "batchNormalization float32 4D NHWC tensor all options",
"inputs": {
"input": {
"shape": [2, 2, 2, 3],
"data": [
-41.30732967168238,
83.0222726565018,
-40.902161220312074,
64.08864045143429,
-80.08049213079853,
56.963061967558474,
-63.376671841233104,
-62.144380499565784,
37.37249789808206,
-46.7903680211994,
-0.10012771650340824,
57.04647733193906,
82.05679802728304,
-21.35103988063949,
-85.36802529512583,
-86.11642850667623,
-96.93823797160586,
62.35185227095363,
76.88317547014259,
-9.359310262561493,
-68.4724340974042,
97.03362133579051,
80.2082435478892,
-12.107167478351585
],
"type": "float32"
},
"mean": {
"shape": [3],
"data": [
51.62914995931095,
99.36075401019252,
-96.14736495234415
],
"type": "float32",
"constant": true
},
"variance": {
"shape": [3],
"data": [
30.448016067921067,
86.36218998771075,
73.88454888724165
],
"type": "float32",
"constant": true
}
},
"options": {
"scale": {
"shape": [3],
"data": [
65.50171582968795,
-71.00757080938772,
-5.569730877611249
],
"type": "float32"
},
"bias": {
"shape": [3],
"data": [
64.20446782594775,
75.28591851497856,
-84.57243127763437
],
"type": "float32"
},
"axis": 3,
"epsilon": 1e-6,
"activation": "relu"
},
"expected": {
"shape": [2, 2, 2, 3],
"data": [
0,
200.12615966796875,
0,
212.10623168945312,
1446.3731689453125,
0,
0,
1309.32568359375,
0,
0,
835.2536010742188,
0,
425.39935302734375,
997.6290893554688,
0,
0,
1575.1810302734375,
0,
363.98529052734375,
906.0018310546875,
0,
603.1834106445312,
221.62777709960938,
0
],
"type": "float32"
}
}
]
}