Operator `right_shift` obtains different results in different devices

The different results were produced when executing the following computational graphs on CPU and GPU respectively!

The computational graph

def @main(%var_0: Tensor[(1, 1, 10, 1), uint64], %var_1: Tensor[(1, 1), uint64]) -> (Tensor[(1, 1, 10, 1), uint64],) {
  %0 = right_shift(%var_0, %var_1, Tensor[(1, 1, 10, 1), uint64], Tensor[(1, 1), uint64]) /* ty=Tensor[(1, 1, 10, 1), uint64] */;
  (%0,)
}

The reproduced script

import tvm
from tvm import relay
from tvm.ir.transform import Sequential
from tvm.contrib import graph_runtime
import numpy as np

var_0 = relay.var("var_0", dtype = "uint64", shape = (1, 1, 10, 1))
var_1 = relay.var("var_1", dtype = "uint64", shape = (1, 1))
var_2 = relay.right_shift(var_0, var_1) # shape=(1, 1, 10, 1)
tuple = relay.Tuple([var_2])
F = relay.Function([var_0,var_1], tuple)
mod = tvm.IRModule()
mod['main'] = F
mod = relay.transform.InferType()(mod)

#~~~~~~~ build on llvm ~~~~~~~
graph, lib, params = relay.build(mod, target='llvm')
module = graph_runtime.create(graph, lib,tvm.device('llvm',0))

input_0= np.array([[[[963],[970],[903],[170],[621],[635],[226],[419],[699],[480]]]], dtype='uint64')
input_1= np.array([[966]], dtype='uint64')

module.set_input('var_0', input_0)
module.set_input('var_1', input_1)
module.set_input(**params)
module.run()
res0 = module.get_output(0).asnumpy()  # result on cpu

#~~~~~~~ build on cuda ~~~~~~~
graph, lib, params = relay.build(mod, target='cuda')
module = graph_runtime.create(graph, lib,tvm.device('cuda',0))

module.set_input('var_0', input_0)
module.set_input('var_1', input_1)
module.set_input(**params)
module.run()
res1 = module.get_output(0).asnumpy()   # result on gpu

print(res0)
print(res1)

The output of the above script:

image

Why does running on different devices have different results? Wish your comments!

There is not a full specification for right_shift intrin in TVM. Since cpu/gpu codegen will create llvm lshr instruction for unsigned right_shift, the documentation LLVM Language Reference Manual — LLVM 13 documentation says

If op2 is (statically or dynamically) equal to or larger than the number of bits in op1 , this instruction returns a poison value

Since the behavior to use poison value in oprands or ret is undefined, I think this is as expected that different target create different results (though weird).

1 Like

The previous response is correct that this is an undefined behavior, but in this specific case, the x86 instruction that does the shift will implicitly take the shift amount modulo 64. This will end up doing 963 >> (966 % 64), which is 963 >> 6, i.e. 15.

1 Like

Thanks for your reply @kparzysz @wrongtest

I come across another similar behavior in cosh.

The reproduced script

import tvm
from tvm import relay
from tvm.ir.transform import Sequential
from tvm.contrib import graph_runtime
import numpy as np

var_1 = relay.var("var_1", dtype = "float64", shape = (7, 6, 8, 9)) 
var_2 = relay.cosh(var_1) 
tuple = relay.Tuple([var_2,])
F = relay.Function([var_1,], tuple)
mod = tvm.IRModule()
mod['main'] = F
mod = relay.transform.InferType()(mod)
print(mod.astext(show_meta_data=False))
graph, lib, params = relay.build(mod, target='cuda')
module = graph_runtime.create(graph, lib, tvm.device('cuda',0))
intrp1 = relay.build_module.create_executor('graph', mod, tvm.cpu(0), 'llvm')
input_1= np.array([[[[117.001080,566.403452,568.944873,835.315367,956.011370,894.872004,424.443890,856.647660,66.689804],[310.799036,930.381998,274.853009,149.686340,871.261209,619.991540,25.724559,951.892194,81.342189],[919.726448,290.069936,433.147796,997.977819,118.934898,658.895366,226.106424,679.640845,363.968694],[381.778363,719.729590,644.098137,450.645701,619.440761,22.534889,466.297730,173.411898,873.845519],[86.052824,49.265436,582.887415,827.269183,544.521830,709.655812,591.550109,549.032869,451.128456],[763.784212,451.002971,570.152476,822.105345,891.510906,534.527046,163.423888,353.271306,11.373662],[998.990697,574.388554,942.161682,912.052238,16.093790,723.024148,574.049480,947.593903,790.487032],[49.980677,412.197459,656.422114,404.765955,684.103014,369.967632,592.159466,103.373172,791.678922]],[[558.942273,907.487974,829.862516,209.542607,171.627823,618.739029,618.682213,673.245079,836.420728],[954.725511,190.441533,649.390482,515.214095,172.866736,616.560719,273.949216,449.200545,566.994910],[109.303257,355.758776,645.654308,287.717191,614.920081,87.027263,372.930357,695.086255,146.383590],[525.090184,857.226792,491.503341,320.143757,966.005446,580.750898,491.184839,907.500761,623.597852],[702.712348,197.080295,457.654540,472.989573,257.801275,988.016111,239.078254,136.056622,178.954089],[885.292630,653.012113,269.167977,341.125383,927.932867,196.285622,73.301172,586.408127,116.485961],[138.809593,728.401134,469.192712,872.183900,491.700590,394.493877,869.203070,358.973541,303.047159],[929.994882,588.902355,584.040837,643.990761,15.419792,905.473203,668.824945,857.056773,902.469098]],[[326.139716,942.373273,582.787861,644.707698,239.345216,148.164814,435.132326,924.066173,127.564701],[944.487065,677.570390,172.733001,533.142382,829.201102,725.747948,412.564525,365.482298,581.439345],[31.514634,602.136093,343.030485,152.922691,221.597368,566.935264,380.353245,262.130104,123.336545],[441.784676,676.635222,489.586857,947.645298,917.888112,607.924998,731.559982,698.656815,486.266172],[837.045236,547.286025,695.934402,425.073035,825.891659,783.320013,269.935107,999.705830,185.112666],[303.802504,542.670697,187.125028,603.124432,860.933082,51.528344,113.529624,628.624858,847.697085],[349.622467,251.154442,479.880011,716.806332,62.317915,16.948647,611.249465,210.344037,300.142606],[379.372434,197.236493,995.170016,344.729369,332.519697,861.691191,999.713076,568.200486,849.075732]],[[792.802996,40.650909,754.877501,318.712670,470.039809,334.666222,880.459843,419.419070,623.087369],[271.883502,808.372653,876.426827,75.171031,683.246719,91.702323,183.572685,634.477923,663.859047],[654.117458,630.897926,910.865613,937.071208,276.624012,725.823807,877.600682,832.688409,470.716571],[583.413055,276.979637,480.019559,959.154106,393.720227,645.669170,951.339731,732.193817,17.423119],[877.528595,478.072372,601.030981,659.028516,448.984620,386.992103,334.390982,272.984031,353.676962],[252.273760,559.706967,285.268912,134.869257,362.934717,893.735976,412.143594,565.284920,312.370946],[497.364653,404.606945,896.883223,588.166205,578.539303,801.343646,140.511402,12.501926,54.520441],[880.349978,951.412458,583.061707,166.941837,38.187247,586.956405,169.274361,417.205598,922.097575]],[[741.940953,460.083433,700.421184,2.909482,781.050583,448.633344,82.310838,237.158148,261.610872],[332.534540,686.109783,79.406007,529.512750,733.434310,216.286354,668.426742,992.688877,511.294017],[349.951590,678.652297,105.613357,61.759375,978.990532,28.318829,223.460426,130.350244,907.736064],[913.222507,516.010908,61.856090,736.432830,451.061232,275.766965,534.734125,335.808618,495.400162],[986.273181,822.799629,641.405464,321.686607,737.189441,571.856207,225.838863,459.958280,889.408033],[188.324137,807.659187,174.809569,261.511159,662.361219,549.221670,379.295598,621.213532,79.668775],[570.951071,36.445573,849.494421,627.668320,35.678539,904.718396,658.519854,396.033067,228.697834],[916.499401,368.366512,774.090230,268.993736,430.219876,782.377529,162.290149,731.790860,649.906596]],[[322.031297,395.463216,696.652700,464.455158,616.943175,12.539735,303.618025,135.091219,904.899583],[308.916792,883.378141,461.367974,143.153893,134.548721,284.986735,255.149938,241.095354,937.270532],[424.231101,442.236314,183.749087,43.011424,104.426361,814.558198,942.502661,669.076857,435.753771],[666.123246,160.777280,43.768398,722.492474,739.268727,977.197145,478.451242,574.610550,330.568359],[202.442112,251.158221,385.491566,230.112950,131.172641,3.099219,677.151798,892.935413,301.302585],[690.458378,384.961084,322.691542,517.870019,459.834103,569.051580,128.732139,800.223002,366.890295],[160.446798,837.907217,797.577537,393.156024,298.578729,684.044669,581.429012,209.267774,799.044615],[228.264197,191.596771,798.112018,633.435886,38.134539,579.170599,439.357046,637.451943,973.223595]]],[[[37.712757,347.971908,426.048986,200.642344,105.746498,180.327842,449.694435,493.669614,560.218667],[561.176364,433.566043,835.469094,367.815333,489.987731,738.268178,800.261942,214.430246,51.867192],[833.812892,295.459897,881.836801,778.163501,983.064367,492.155013,870.614061,528.153538,593.084080],[168.652190,22.054154,69.801365,914.377121,40.519654,751.675370,258.261690,598.304380,776.680381],[77.992855,945.405942,939.278696,135.650783,738.621144,992.084369,72.544256,774.190204,634.719064],[292.169396,749.011778,469.892616,530.659401,249.617155,297.543418,404.904000,754.468177,479.897887],[9.930959,160.607199,470.686071,376.522401,666.692831,13.864331,826.153550,797.237004,662.160051],[662.486574,861.082871,244.753668,229.680176,44.683376,557.692902,40.235318,928.236341,170.579124]],[[247.797449,540.168955,793.969113,428.337621,369.370354,211.037974,991.505323,901.606363,475.193900],[544.158451,329.924300,916.029607,545.529085,462.709542,912.873023,193.508346,180.838177,913.386816],[417.110138,440.757156,827.727513,256.608707,662.689592,669.030044,437.814841,109.149488,384.529882],[532.614087,332.702909,592.111351,987.765918,28.735338,322.567567,889.339093,404.666657,553.818201],[282.901373,409.150289,606.461039,4.718723,960.308264,905.600581,425.782141,993.367205,442.985978],[83.895803,303.204261,912.494533,725.237116,469.576788,144.321367,697.571192,909.896784,297.313671],[404.157245,868.784255,74.159976,923.573237,588.232137,948.133936,582.396742,916.295230,966.048635],[636.188555,810.153386,588.836731,916.514024,259.048319,840.999655,91.038386,124.848675,226.825794]],[[520.190611,469.084891,542.018803,839.139191,439.139202,754.542287,769.633703,746.229039,281.874690],[448.405235,174.415729,418.004103,682.984222,899.832549,981.234313,153.726826,657.725017,577.322795],[588.125320,555.672975,572.602278,671.091879,341.701143,326.577507,996.835103,312.232748,295.496163],[908.151732,624.060577,318.668158,90.220448,357.708882,460.523831,240.452175,834.977757,201.150207],[228.428919,900.049474,87.096398,261.374636,197.471324,761.973932,41.868072,765.413469,141.149402],[391.378416,778.998559,305.538363,840.646247,261.493123,534.576274,825.849063,41.657538,418.530568],[528.651798,92.556017,168.829918,792.212581,630.148753,383.328881,901.093227,565.940341,697.763981],[646.164122,566.327750,417.379702,599.161515,378.883666,973.517458,935.692283,124.926232,543.943891]],[[142.704446,496.676103,238.825024,257.872414,369.208558,101.968330,554.139319,977.670866,822.455796],[7.062283,97.259997,400.008929,699.282667,662.759638,22.246813,457.362831,837.244905,223.778004],[863.709779,20.750912,901.862703,517.908404,711.135924,264.946241,5.479122,603.425868,943.249198],[222.587676,394.356745,950.878214,294.472963,301.390879,382.891749,925.522263,19.098820,185.053332],[473.083872,840.209858,352.552094,260.429842,669.460265,986.505581,65.899059,392.521146,998.215319],[677.871445,205.529192,682.329810,985.738493,32.216875,886.850131,308.633692,566.353028,265.359073],[251.531221,263.955843,245.276222,153.879987,430.473739,539.327022,459.548210,885.922760,764.810557],[294.520811,503.761467,682.560871,808.779464,188.171575,16.718810,109.235122,233.335766,349.802220]],[[343.102295,621.687511,579.357642,445.028201,653.301111,269.063171,972.528923,686.974363,656.492306],[467.449952,457.904109,697.883932,595.271452,269.328387,333.604661,261.305183,209.225926,552.964160],[31.628578,893.951831,642.784069,560.141910,118.889881,245.649336,217.173875,195.771063,549.630512],[660.567545,747.090385,527.040005,191.001966,810.504096,782.707200,890.701307,248.606888,183.248346],[902.110209,297.765800,667.015711,519.164447,926.346190,153.018739,566.569546,683.900004,601.329829],[302.590084,129.312752,264.209635,756.514937,39.737133,320.916984,411.135126,17.220953,668.443446],[839.231033,274.468244,905.579711,376.007142,308.385247,888.224661,73.688229,622.578876,314.840230],[439.155541,594.817837,145.629927,498.310956,845.575856,894.615114,352.742780,559.017010,150.031237]],[[409.824604,161.036402,777.422027,501.376254,908.711029,63.085010,832.198428,485.827048,983.048579],[430.924972,439.969390,861.747514,334.048268,373.136823,28.919315,795.085386,862.414606,211.932645],[549.335631,806.644970,844.129412,164.619238,472.989807,13.636301,491.205861,116.626527,261.567569],[94.828829,794.189642,495.111885,669.432434,414.939834,292.012246,146.255477,679.571931,599.028786],[60.287448,755.683187,544.714267,647.609134,854.136654,104.971882,321.272174,653.221544,347.659804],[881.596945,495.995169,172.505212,539.048544,371.252501,697.293845,536.182972,384.515280,453.809987],[277.523138,830.719785,489.937305,803.052228,969.364824,929.303816,76.301139,680.181524,477.446419],[765.350337,552.542179,39.640838,744.451755,679.964000,641.317188,835.594818,835.812130,601.259324]]],[[[265.531877,265.925780,322.514781,627.018987,937.802712,6.375199,766.803873,532.757667,711.383013],[716.348911,444.055622,577.774933,991.934675,425.432309,990.922538,232.928730,200.552822,886.225821],[801.910177,953.118662,268.995991,816.854209,659.998527,251.189948,511.557254,347.898455,397.694425],[291.099132,266.498484,989.373451,74.585841,679.829356,828.851024,397.299810,973.343050,412.015372],[682.770343,636.274964,658.329892,796.720359,361.221815,760.724036,233.956180,537.151954,51.709181],[326.499813,100.508620,235.095203,21.796915,52.471231,220.989582,939.219264,497.304534,335.833127],[489.625829,437.319501,989.853906,729.531911,973.535131,825.422713,580.008254,273.764293,756.996800],[465.635071,952.562732,313.002344,184.880484,556.675507,543.824942,187.918860,919.136302,573.649661]],[[975.217449,388.485887,721.684863,577.098130,419.046055,781.323698,813.853696,564.695244,900.071411],[868.074652,775.664236,554.409893,398.327522,843.449549,38.277428,480.738276,920.418497,320.895222],[403.737625,292.850519,710.633643,387.498861,478.778878,794.690765,840.009958,104.955014,611.210365],[416.676289,60.083142,19.676914,620.815398,997.453419,736.081428,702.688420,100.457616,592.391396],[105.384607,626.496980,303.771046,443.569402,985.302218,183.405021,759.559818,407.757351,996.524311],[582.436579,881.749621,106.246496,825.772396,231.244610,113.658511,734.460639,905.122993,939.292415],[604.573330,392.080533,25.426212,170.972477,929.669320,979.280010,623.294496,453.891307,328.981830],[88.484047,812.044206,699.573364,60.681051,868.220438,563.048707,124.482322,6.640813,271.991832]],[[209.821721,165.262565,380.868336,299.796228,678.404188,175.704569,471.715822,548.413831,435.897743],[131.118756,654.109706,734.080923,293.338210,742.342984,703.612345,591.962351,826.134304,296.950574],[724.183438,897.928587,421.366091,167.308122,106.206143,785.013427,689.884237,700.514497,161.907100],[112.004728,963.819240,547.000761,391.343993,746.489171,159.179193,115.785800,116.414997,86.827995],[331.366691,600.933820,479.969601,354.165360,249.083945,819.492015,524.501949,795.919455,101.953734],[477.560646,582.720696,876.177236,483.191475,481.622108,843.777107,292.975698,970.767918,991.122947],[794.990193,650.581330,579.168167,180.970610,187.663532,751.415296,901.118709,223.234172,654.096205],[76.336292,252.365876,8.364449,891.571926,692.940192,184.835590,547.018795,482.084841,656.821708]],[[791.251443,463.055498,582.214154,9.719492,200.065566,914.146532,277.220187,747.156666,234.117478],[219.571406,613.413921,450.872502,469.013253,589.470315,583.587178,320.028740,182.331209,621.021438],[986.097925,569.501135,480.777452,478.491574,530.139881,257.423786,494.256478,245.196329,846.304787],[407.483407,84.908571,802.990493,424.486449,206.182690,761.485372,310.025286,703.113103,518.636157],[926.051713,800.596676,248.927695,316.062720,59.209846,968.785291,565.013138,15.389577,184.912873],[892.911996,678.010223,647.262709,817.680022,302.987489,234.272537,154.740602,622.644321,191.639765],[461.132595,476.596670,44.727130,2.977420,916.386302,930.180864,340.365088,548.725527,304.469818],[782.567515,626.529330,249.476459,352.659150,435.658664,138.457238,144.232481,599.145599,589.819900]],[[881.981314,90.740106,259.438975,398.681821,547.616925,249.740402,138.721306,864.104100,562.827340],[547.227948,540.845709,64.867975,993.954874,821.582261,120.778626,350.306982,249.951835,223.671013],[489.739605,669.282583,663.741376,791.310356,320.956061,162.053121,887.858893,238.540022,654.439109],[51.924873,152.476922,635.704098,946.161959,376.617590,625.813819,509.347815,379.974833,211.729200],[148.058589,466.878851,941.190135,974.150685,469.145620,258.702174,272.348054,752.336141,138.876802],[335.467837,303.468244,282.579863,112.215253,890.340051,109.594708,526.924369,258.691200,532.165844],[179.024198,367.177842,48.611700,66.740042,236.942930,148.443866,370.144393,321.627289,744.436462],[48.674763,614.439083,111.962137,160.719337,518.713566,262.034150,717.296890,526.430858,911.254646]],[[567.058714,943.178164,921.732129,288.643091,551.613993,398.778092,167.286455,536.161627,855.829462],[220.636239,909.573494,116.878354,72.592103,58.085106,429.310500,343.171023,148.998772,107.531153],[104.004857,104.327138,858.774889,567.250327,152.296040,716.637287,308.017801,589.453833,432.944522],[781.412467,495.747630,298.696313,369.790712,833.588126,499.454068,906.435079,926.645186,590.097326],[797.166368,567.418494,784.299857,168.182039,952.703813,26.323999,11.601656,793.315416,86.554798],[860.736948,248.419476,293.542690,132.552699,992.688498,972.472290,358.588442,659.055921,304.909199],[609.981301,837.168903,171.564650,287.780871,790.326587,217.009127,561.531963,406.524118,184.636593],[765.454688,674.965244,451.884680,567.541023,915.924961,922.431973,513.649528,615.268105,84.856576]]],[[[81.918226,234.607082,70.923296,673.484411,60.748084,802.665525,136.709429,749.005666,228.909346],[621.498087,909.527493,592.116736,119.599544,55.775187,64.183131,227.603320,754.227607,926.792731],[230.684195,990.150074,860.411917,381.009586,931.657381,863.480784,172.996349,717.181643,598.869523],[269.625155,355.970957,221.808663,284.327791,838.257587,684.110116,769.560291,840.758616,386.351016],[170.824884,87.810902,963.617151,374.571606,968.356080,476.429166,21.461109,323.425088,434.894516],[673.442105,955.596198,248.475408,535.537872,708.710148,189.757768,672.365494,760.772868,198.312684],[876.447793,117.326403,85.721214,809.262552,370.800774,703.490829,426.214057,354.117350,450.939433],[477.109610,441.541296,694.975770,146.928667,840.815956,995.970475,880.129135,762.410859,698.804529]],[[277.188879,655.949116,860.478904,446.127972,298.472293,66.612851,636.731806,682.153158,384.219457],[952.835708,0.687453,555.565521,86.967452,655.033790,967.241452,998.271201,722.802839,265.305624],[363.589694,382.153388,155.025984,88.810539,504.041963,909.742043,465.981925,814.814913,347.469321],[960.746882,716.019794,791.805336,924.882904,165.268906,905.636179,614.741685,864.418173,590.333441],[70.294220,974.954867,401.916417,223.254575,417.743631,67.230489,637.533020,765.333158,273.232596],[395.019372,426.927872,355.151799,203.264952,472.728547,116.271404,804.969917,0.424039,263.885492],[32.154194,491.773355,333.991707,638.413663,379.124497,560.881603,421.476944,129.963734,591.479442],[637.177625,428.277951,985.780393,498.056219,372.086093,9.443341,840.290368,791.524601,778.272728]],[[8.870184,14.908625,329.861292,496.577804,351.019113,760.848446,936.473084,380.546481,774.949091],[84.461685,845.475988,617.950359,100.753052,362.832355,641.717297,20.335974,608.717753,518.461408],[124.969819,218.834333,353.800050,849.352482,763.700833,142.228514,972.467325,504.909505,245.754747],[544.946996,559.876404,792.251560,669.271983,808.920114,270.981270,925.165360,954.142058,352.467184],[15.237885,421.339029,46.379762,69.497778,225.416613,992.329852,656.642857,19.861251,841.884156],[551.517420,153.046582,741.339008,527.698370,177.460975,806.765084,356.400606,997.974077,926.285967],[632.604517,591.109595,770.652066,794.780347,798.911588,539.498274,639.339657,164.552969,11.826757],[262.028341,890.535104,226.464668,808.060202,49.093025,928.528726,502.171347,167.460975,86.686892]],[[375.320081,749.705933,921.756267,805.008116,630.458904,620.950011,156.472788,867.701379,67.256555],[970.446210,865.065278,161.273727,820.134892,241.007330,714.022572,417.589413,160.701317,318.853352],[19.954808,430.907031,663.141603,710.363365,631.442184,161.643967,26.336008,210.842172,818.752296],[618.920531,964.491741,512.817532,178.940490,370.912816,289.637582,922.363687,68.558587,88.057530],[483.187524,645.155711,446.527542,51.223978,629.975165,862.872617,928.939901,324.452061,798.460032],[634.017230,201.024280,270.059706,958.817203,594.484448,137.448997,388.788445,624.006895,727.544023],[72.803405,964.423496,774.023628,922.715807,690.441697,333.790344,998.719296,344.742323,169.839764],[864.577626,886.426998,134.461155,332.963906,636.567555,4.039224,275.091446,11.692921,809.672073]],[[123.632571,871.163461,77.536915,11.624888,614.769234,124.019706,356.721789,650.548470,732.377039],[229.795155,903.100644,748.334491,848.645370,518.747095,324.151276,715.689703,3.132638,774.001005],[550.427674,591.152480,490.957056,528.664632,631.021664,44.448506,71.326995,434.515643,304.441993],[639.744131,115.576202,668.803259,629.990936,899.953074,370.401057,964.251937,662.354163,695.396533],[96.263228,123.038449,31.898054,533.337017,183.193619,319.095134,399.958955,956.633749,769.540604],[731.993068,971.199473,676.481863,409.373235,235.723610,736.876229,385.000059,954.059751,86.844616],[457.889230,842.251354,568.209183,897.855396,562.801182,860.909201,531.047961,46.568812,416.884748],[31.733844,568.559572,163.177656,681.093788,936.141792,11.711285,61.624526,357.981242,293.461424]],[[889.690166,353.435143,466.333407,309.183727,114.032474,541.706738,370.991001,459.621501,951.694527],[712.515840,211.719573,97.805636,500.216732,948.442393,955.764356,199.989994,796.964835,491.008590],[771.144475,154.223145,703.957222,121.452464,486.490621,89.528795,68.069788,755.571516,872.996753],[945.363443,812.124018,525.384434,901.765752,269.691118,964.619905,738.506129,863.739975,153.453234],[784.340917,648.244870,104.572836,438.186126,922.464987,930.615573,161.764672,758.825653,39.517805],[548.519066,120.836748,536.833074,159.898380,879.815065,804.823868,330.059892,560.778185,25.690591],[21.522347,359.584601,937.443583,954.266373,10.876900,475.598712,174.417955,460.027024,256.310003],[795.649498,132.750594,56.140746,699.817616,85.392167,52.916096,169.681455,471.281826,704.585193]]],[[[394.746885,784.548953,947.685832,499.238842,634.593874,407.053759,662.439315,307.777415,876.161368],[871.238143,944.512656,125.375280,454.739773,978.490475,947.579982,622.471356,6.732232,922.450023],[70.021407,41.140876,681.210877,790.506048,783.337736,867.421522,482.987468,527.182260,848.737665],[28.482780,685.074723,974.243024,912.896566,822.452665,369.569871,475.472681,587.503844,565.740436],[166.883509,983.779232,980.502802,221.360553,411.016149,412.388671,584.107193,917.101338,681.651261],[531.653523,438.559150,386.946664,722.312651,750.143209,769.159131,449.652225,891.134971,65.250342],[10.653634,569.456370,686.716184,603.025879,985.123522,995.212447,579.097053,452.017648,390.162173],[11.802717,768.759078,218.428444,274.495812,542.436224,721.209933,271.464217,334.249196,909.756853]],[[122.207553,833.631195,125.104059,767.495379,6.307976,377.580155,694.503209,426.469095,538.372332],[658.676731,945.738409,852.543789,459.623470,210.478913,588.460103,14.471514,324.732852,566.312797],[686.806315,53.657248,181.112450,573.277733,64.205480,533.209978,77.634421,593.961734,210.907250],[497.167884,380.142407,79.809765,915.509401,81.032128,144.543497,650.117266,544.313820,764.726527],[468.356540,332.403132,67.647723,179.074893,476.103684,446.443417,840.989710,122.157939,97.004442],[445.342434,630.781706,614.265239,437.644341,849.225952,527.740618,225.449437,979.444533,275.917927],[364.236759,309.941911,208.905498,511.738397,722.192974,317.184807,332.470775,423.086631,461.747700],[696.869871,955.006987,728.123428,312.196263,125.793640,977.424631,834.039739,721.377590,298.096333]],[[706.840238,542.518857,631.057527,401.174348,795.888896,956.491569,396.482895,758.889421,238.592757],[200.244053,825.069586,191.703493,768.614543,485.423666,880.409339,414.469364,334.614746,480.641922],[910.226648,114.198739,880.601438,891.475537,629.395652,649.203333,496.464646,22.885008,75.180994],[746.954215,280.806537,589.718205,630.262810,859.130587,498.866301,691.921055,125.373256,430.996439],[662.830158,101.454425,522.809821,241.267533,582.999506,577.301212,490.413136,368.278559,978.420468],[615.462491,646.180787,455.117328,992.423451,501.306115,996.119926,364.605071,399.004620,127.224131],[370.969222,41.893145,511.100672,179.424801,651.184969,871.027137,399.606812,478.065770,612.041248],[615.664420,991.690603,360.021383,294.708307,949.159439,771.963108,898.834874,287.945734,754.408531]],[[37.361177,512.317238,419.839285,795.938952,745.390152,583.323799,203.461332,768.678288,717.964115],[709.608799,523.862870,71.293525,102.889925,979.907222,550.737071,808.515607,470.315046,203.411443],[275.206407,30.847254,219.173210,835.036258,54.053066,127.382741,695.852881,170.717760,947.395539],[822.415269,553.509906,851.359565,905.273957,38.336590,578.483100,163.147867,755.257439,477.522019],[194.254303,361.919138,159.194661,4.718859,864.044796,573.055133,15.963558,120.766262,724.068647],[777.873170,80.302822,819.142558,4.075523,359.563324,521.539317,747.000306,413.126929,857.995448],[568.651019,928.188405,93.566131,511.545537,916.569105,334.079334,758.240662,965.491369,346.779490],[339.647538,916.535139,553.098382,420.801772,607.876852,195.363108,655.421551,63.889089,465.317331]],[[331.893723,402.324935,972.163048,846.082175,977.035889,690.805871,807.670397,853.614966,333.868620],[28.544262,391.136806,989.026440,600.930584,394.962591,346.985531,916.535216,506.631302,396.431098],[711.786665,597.015394,954.669336,275.162629,297.094562,586.785453,84.427630,827.495940,864.604931],[174.179456,297.650948,570.469244,650.070822,858.290241,912.530142,625.635398,771.310887,424.101717],[243.455323,633.319993,496.466395,54.211772,966.110521,837.488247,908.071455,315.424628,211.825457],[519.967316,607.179389,860.109030,218.031067,143.593826,833.512976,907.535192,374.339800,348.491472],[53.323580,901.322340,309.988305,220.641412,563.514871,332.401938,584.840400,887.438698,635.923206],[673.259204,214.454490,630.608548,182.064594,997.994591,131.813620,494.384157,129.955976,94.540707]],[[258.324579,628.708871,58.082398,825.275726,604.524265,330.074238,353.920531,667.017501,668.282506],[836.187528,307.268218,784.490399,385.497963,846.905494,748.520531,879.305233,285.011022,89.341483],[707.450284,875.354718,784.246626,787.762858,987.887729,271.340698,486.083332,841.730932,521.678209],[436.826573,417.115717,522.300373,960.012193,900.202930,8.307663,659.750660,831.543747,583.689754],[50.871336,716.711224,521.028243,851.142071,955.223296,712.977728,933.143771,235.420533,136.444536],[8.643100,301.255722,819.176586,284.976360,41.753542,973.623178,769.495594,625.283901,686.002284],[923.824493,473.608090,611.214755,936.065063,75.446626,55.857415,484.944919,198.221565,447.092665],[610.480150,144.298629,725.821538,168.064003,447.604663,334.608964,790.124777,341.325554,230.436309]]],[[[415.634962,273.375026,682.184802,760.730920,811.798306,854.063428,880.449306,632.237301,794.270294],[319.444115,814.435484,218.120627,877.814913,989.899785,18.875794,962.146549,775.646017,779.651070],[239.115664,753.061241,385.242566,569.584616,953.455395,228.143736,617.724846,777.255383,176.107190],[636.870096,649.112889,497.247849,8.345625,40.980182,798.015954,753.343292,226.434528,364.873857],[987.765953,70.280730,569.340185,256.200659,34.885763,909.155380,790.980461,762.591578,482.817779],[277.501147,322.524777,796.431524,537.471627,679.491518,228.649050,186.986942,244.031630,312.040594],[253.082818,380.001740,528.090596,226.980594,200.029541,361.631618,536.165291,719.673092,424.411223],[859.764595,566.860583,804.797964,411.420870,46.812185,711.264283,396.520490,929.621685,34.799687]],[[231.128612,275.957741,75.401034,192.311830,491.042240,238.358506,667.701663,556.016933,828.197383],[988.686195,444.778598,784.810091,495.497813,383.834658,812.450811,664.399893,6.826633,669.565106],[153.737728,100.334730,445.147781,798.536251,110.956683,569.628124,689.133397,636.203662,182.948029],[288.445157,286.812830,510.068921,212.069593,541.326680,437.000856,28.215835,687.221455,251.674842],[714.661647,176.568710,114.336943,884.755757,833.613039,738.467953,990.152957,394.125748,502.265299],[687.144972,485.439247,420.717861,436.736142,808.983037,876.298610,683.634113,114.453218,920.160374],[216.182409,262.562775,989.277345,643.139610,171.777435,926.715724,791.975206,758.073260,505.281380],[183.585327,5.541055,639.657620,201.214548,109.993782,427.555899,637.403812,275.022692,606.579616]],[[513.515076,626.416926,423.790066,627.851021,577.024401,925.595628,629.456254,77.901067,416.962174],[358.492813,247.669546,255.431420,833.075836,735.700146,962.543403,661.304972,988.271728,492.541043],[840.777492,495.109486,493.157853,259.211728,90.997468,720.082276,622.005390,972.624727,469.918953],[161.386555,198.279561,645.935752,416.274303,970.284394,213.084987,458.765926,381.539805,340.063455],[736.083920,872.513311,779.511766,343.947205,310.674779,95.473213,371.381146,321.999786,393.329308],[489.415137,339.470713,650.294249,742.528186,529.042296,578.391409,139.041905,879.498418,700.090004],[425.897665,322.911173,203.588811,906.263463,0.256963,535.823745,57.000499,120.259651,468.382501],[446.244558,215.166741,70.214352,768.299070,301.541087,453.944700,767.603414,509.079503,515.166921]],[[204.838978,773.784454,696.289596,119.015948,856.445837,706.756965,715.583875,16.636361,992.347428],[874.701428,545.694825,141.638939,288.787175,299.968695,907.810758,191.109343,361.467444,326.589533],[566.842389,404.877443,696.229823,905.417151,787.060236,384.581678,703.544375,126.063231,899.587647],[934.280761,714.836074,462.304371,392.804029,966.717359,510.989570,960.015551,96.988820,244.576434],[857.565371,781.567112,841.242578,801.154806,199.578861,60.040367,334.044208,999.161936,774.490014],[687.248138,782.426574,744.651292,20.419461,202.324983,770.939966,753.547500,555.191016,450.352810],[801.455302,114.388977,280.258986,928.332304,871.694456,561.057799,566.107410,796.850510,357.739030],[369.446758,674.563305,459.220240,296.065347,399.930127,71.573273,976.499226,413.338744,756.030364]],[[265.980135,38.844632,809.406420,403.412562,60.547591,78.716116,879.937982,630.008268,191.433409],[720.440222,86.594128,280.527853,664.549859,804.332295,171.513251,634.147320,551.093426,241.478408],[794.362599,169.998104,453.548765,45.665696,265.123433,902.039146,650.969157,843.366991,811.128487],[435.223686,804.437593,314.931250,927.096977,599.968104,144.390321,889.650614,257.434210,92.934209],[563.086785,474.578234,594.129562,362.265217,974.876548,41.017924,929.444701,2.471018,399.169470],[373.646902,598.719943,583.297692,340.738239,13.837460,523.912291,875.993179,39.440127,690.313820],[532.318700,210.571622,868.264328,206.518906,193.813792,167.857005,14.578440,799.839257,990.953675],[969.689391,728.406982,651.667061,701.650613,41.757297,223.848206,613.449161,720.206844,350.151555]],[[198.430601,810.839145,391.583334,254.614430,165.998443,190.387371,903.170280,621.039039,146.027478],[210.575888,548.997240,34.560578,292.832353,64.786970,967.153226,89.295805,353.310652,905.276540],[544.379477,881.600173,677.550021,968.497227,971.883822,273.443459,936.633006,612.838507,871.001646],[241.310042,620.278215,633.378475,984.236603,76.051774,774.727200,835.502705,444.610646,773.820325],[866.819788,478.327451,510.156176,51.715073,128.664110,818.925170,313.552993,717.109477,14.741825],[208.485032,782.803709,223.408948,713.773854,120.869103,67.262231,886.015807,836.102234,690.141607],[356.491370,887.726896,50.680213,731.734846,547.442886,708.085762,73.027274,951.184983,803.233980],[90.874142,550.853195,676.997492,873.366513,594.155518,192.536725,818.027848,630.004675,463.312667]]],[[[670.649375,525.675195,451.789976,398.469382,384.462607,503.547103,400.907075,66.798343,514.301889],[360.748822,907.747819,423.313737,236.133216,274.358564,942.296646,564.431192,997.690408,269.747589],[897.869245,854.043368,123.301346,870.050532,447.843989,415.570249,556.984935,806.738698,316.563410],[567.589265,767.473366,296.198025,426.672423,339.648842,448.209765,864.744290,614.908483,45.975880],[783.545995,802.206352,857.361283,587.521687,938.025642,666.588035,520.464863,512.221316,161.377130],[627.781937,907.743206,972.873931,701.929639,636.625324,138.151147,565.935783,465.671487,110.682373],[932.637440,573.258195,367.113807,578.492014,627.733024,788.471080,833.861823,293.921544,224.242897],[645.600292,346.334255,216.645080,850.264323,499.113095,917.806225,478.019197,192.260563,645.860252]],[[768.182658,34.713453,99.886483,510.085192,6.541594,792.207484,273.067697,136.598490,733.857321],[504.904376,729.117589,11.316152,685.632780,410.909378,66.849285,868.011422,536.570161,585.512756],[789.702267,40.957899,428.097330,981.601016,75.059945,13.689197,964.078636,536.186124,684.292896],[849.615699,588.384562,898.487335,23.268860,625.743620,78.816429,62.952698,710.509849,845.832397],[162.960381,744.151739,848.725424,548.558074,166.940292,705.998782,290.867729,86.073082,611.476554],[707.477648,911.350612,819.447564,985.929001,843.754394,167.001789,356.900512,798.911043,505.814902],[28.860015,522.783721,967.890713,775.922459,659.439888,259.736387,279.533090,131.650176,823.786162],[319.777352,123.115181,58.430926,146.896118,551.962794,384.953148,9.247995,93.403834,425.291842]],[[398.379275,127.891716,681.743129,31.858166,697.778331,37.503877,976.798613,220.590899,35.978548],[576.848132,172.090659,705.782147,75.801405,778.655768,917.593440,907.413396,206.991134,54.594355],[451.759942,640.908509,302.288174,579.180780,695.852374,482.944676,430.174072,923.119762,665.229261],[794.543347,729.306214,416.922055,840.579469,315.982670,663.654337,169.460726,146.501876,805.445928],[864.565008,801.934510,944.411928,100.373183,289.461308,507.768584,27.827173,663.651398,620.189758],[674.580221,781.787179,669.720127,898.850669,116.982822,941.017065,689.120446,185.452680,85.544102],[686.475493,110.856125,962.447573,386.582195,408.392455,995.899565,123.560476,941.468918,939.512200],[327.361209,427.488844,101.469745,219.911965,799.872216,796.056958,940.952717,200.241393,814.271854]],[[54.188017,661.253786,215.265036,264.448140,843.328273,348.415198,863.825257,629.765791,676.473649],[133.868636,236.370683,605.847746,785.749985,413.284420,438.447983,142.789142,886.343319,9.126915],[175.906452,178.695721,983.409388,693.065076,899.974597,591.851095,864.771069,985.893100,103.438379],[138.600964,710.650641,123.482433,947.573456,71.265385,771.880815,814.969632,150.764068,411.298403],[532.329429,359.808315,813.912573,2.426518,441.077918,874.747768,965.365100,823.195352,705.888698],[452.983113,714.378567,303.530623,523.152614,795.162120,498.133287,789.139338,909.539759,814.804216],[943.416339,188.551448,126.758796,541.106006,688.377984,968.704398,15.536087,831.606630,656.302685],[1.250343,442.583198,587.487713,51.699279,985.815382,732.631905,156.251350,245.784389,649.479230]],[[966.422356,796.628628,170.040809,769.516149,366.726258,790.247328,68.611114,695.908811,593.139608],[302.136904,103.710286,516.496581,405.936668,407.051393,744.642508,315.355638,295.747777,910.812896],[244.679629,104.548816,210.306381,424.062720,169.613706,711.823788,569.925278,395.792415,403.717282],[751.053710,393.179261,17.360658,431.114781,815.520861,988.420419,258.607805,869.974966,252.709554],[21.502535,934.671394,459.896986,171.884160,292.160051,83.919723,287.800888,110.461984,100.898364],[514.470669,113.370891,7.582558,109.538896,621.312600,879.510228,690.019561,371.320231,435.176856],[390.198136,255.519213,964.630548,567.560154,692.782736,828.412898,86.853362,572.122137,580.624955],[469.775657,694.959344,196.318961,354.712455,680.007847,638.394180,214.821486,175.503305,545.525372]],[[725.362826,724.643910,627.815020,662.313100,668.705439,307.638206,89.008557,751.849083,528.466669],[505.300296,474.402710,911.090419,205.368621,758.108839,328.189883,396.651343,183.787033,60.011617],[232.117876,887.209095,386.663690,937.185050,437.212997,899.796787,421.829185,115.988779,601.003009],[648.593692,917.529352,487.892262,900.318314,786.866281,553.450652,446.200189,27.071063,940.254673],[263.152025,433.157620,125.148587,10.295767,2.187049,741.219866,578.414419,345.990838,339.482642],[526.072321,949.563681,762.733848,107.711019,455.439382,983.742761,491.076011,350.773355,37.618455],[925.882751,217.509967,649.130619,901.177050,457.253945,851.982199,937.175440,434.790378,587.926551],[240.710269,95.955770,317.592721,72.983107,589.264963,412.664768,708.812423,545.435994,343.772415]]]], dtype='float64')

module.set_input('var_1', input_1)
module.set_input(**params)
module.run()
res1 = intrp1.evaluate()(input_1 )
res0_1 = module.get_output(0).asnumpy()
res1_1 = res1[0].asnumpy()
np.testing.assert_allclose(res0_1 ,res1_1, atol=1e-3, rtol=1e-3)

The output of the above script:

image

is it the same root causes that lead to this difference?

It seems like the problem is similar in nature—cosh is mostly exp, which for large arguments will be a huge value. Depending on how it’s calculated it may be infinity, or a number with a large loss of precision.