repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
update_hparams_for_vq_gating
def update_hparams_for_vq_gating(hparams): """VQ Gating hparams.""" hparams.add_hparam("z_size", 4) hparams.add_hparam("noise_dev", 0.5) # Bottleneck kinds supported: dense, vae, dvq. hparams.add_hparam("bottleneck_kind", "dvq") hparams.add_hparam("num_blocks", 1) hparams.add_hparam("num_residuals", 1) # Reshape method for DVQ: slice, project hparams.add_hparam("beta", 0.25) hparams.add_hparam("epsilon", 1e-5) hparams.add_hparam("decay", 0.999) hparams.add_hparam("ema", False) # default is false until ema is implemented hparams.add_hparam("random_top_k", 1) hparams.add_hparam("soft_em", False) hparams.add_hparam("num_samples", 10) hparams.add_hparam("gating_type", "vq") hparams.add_hparam("use_scales", int(True)) hparams.add_hparam("residual_centroids", int(False))
python
def update_hparams_for_vq_gating(hparams): """VQ Gating hparams.""" hparams.add_hparam("z_size", 4) hparams.add_hparam("noise_dev", 0.5) # Bottleneck kinds supported: dense, vae, dvq. hparams.add_hparam("bottleneck_kind", "dvq") hparams.add_hparam("num_blocks", 1) hparams.add_hparam("num_residuals", 1) # Reshape method for DVQ: slice, project hparams.add_hparam("beta", 0.25) hparams.add_hparam("epsilon", 1e-5) hparams.add_hparam("decay", 0.999) hparams.add_hparam("ema", False) # default is false until ema is implemented hparams.add_hparam("random_top_k", 1) hparams.add_hparam("soft_em", False) hparams.add_hparam("num_samples", 10) hparams.add_hparam("gating_type", "vq") hparams.add_hparam("use_scales", int(True)) hparams.add_hparam("residual_centroids", int(False))
[ "def", "update_hparams_for_vq_gating", "(", "hparams", ")", ":", "hparams", ".", "add_hparam", "(", "\"z_size\"", ",", "4", ")", "hparams", ".", "add_hparam", "(", "\"noise_dev\"", ",", "0.5", ")", "# Bottleneck kinds supported: dense, vae, dvq.", "hparams", ".", "add_hparam", "(", "\"bottleneck_kind\"", ",", "\"dvq\"", ")", "hparams", ".", "add_hparam", "(", "\"num_blocks\"", ",", "1", ")", "hparams", ".", "add_hparam", "(", "\"num_residuals\"", ",", "1", ")", "# Reshape method for DVQ: slice, project", "hparams", ".", "add_hparam", "(", "\"beta\"", ",", "0.25", ")", "hparams", ".", "add_hparam", "(", "\"epsilon\"", ",", "1e-5", ")", "hparams", ".", "add_hparam", "(", "\"decay\"", ",", "0.999", ")", "hparams", ".", "add_hparam", "(", "\"ema\"", ",", "False", ")", "# default is false until ema is implemented", "hparams", ".", "add_hparam", "(", "\"random_top_k\"", ",", "1", ")", "hparams", ".", "add_hparam", "(", "\"soft_em\"", ",", "False", ")", "hparams", ".", "add_hparam", "(", "\"num_samples\"", ",", "10", ")", "hparams", ".", "add_hparam", "(", "\"gating_type\"", ",", "\"vq\"", ")", "hparams", ".", "add_hparam", "(", "\"use_scales\"", ",", "int", "(", "True", ")", ")", "hparams", ".", "add_hparam", "(", "\"residual_centroids\"", ",", "int", "(", "False", ")", ")" ]
VQ Gating hparams.
[ "VQ", "Gating", "hparams", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L384-L402
train
Update hparams for vq gating.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4To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cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100111 + 0o13) + '\063' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\x31' + chr(0b110110) + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(5479 - 5368) + chr(153 - 103) + '\062' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(696 - 644) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + chr(637 - 586) + chr(0b111 + 0o54) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000011 + 0o54) + chr(0b110010) + chr(0b101010 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\x36' + chr(0b100010 + 0o25), 34445 - 34437), ehT0Px3KOsy9(chr(1146 - 1098) + '\x6f' + chr(0b101111 + 0o5) + chr(1299 - 1248), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1055 - 1004) + chr(110 - 62) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(0b110011) + chr(50) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b110001) + chr(1689 - 1634) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101 + 0o56) + '\061' + '\067', 1360 - 1352), ehT0Px3KOsy9(chr(1533 - 1485) + '\x6f' + chr(257 - 206) + chr(221 - 172), 0o10), ehT0Px3KOsy9(chr(1216 - 1168) + chr(0b1101111) + chr(273 - 218) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + chr(49) + chr(0b110110) + '\066', 0o10), ehT0Px3KOsy9(chr(313 - 265) + '\x6f' + chr(0b110010) + '\067' + chr(142 - 91), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(0b110010) + chr(0b110110) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(370 - 322) + '\157' + '\067' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1111 + 0o45) + '\x35', 61469 - 61461), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(51) + chr(0b110011 + 0o0) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(49) + chr(0b111 + 0o53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7527 - 7416) + '\063' + chr(0b110010) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b10000 + 0o41) + chr(0b110111), 8), ehT0Px3KOsy9('\x30' + chr(3214 - 3103) + chr(51) + chr(49) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011001 + 0o26) + '\x31' + '\066' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011011 + 0o24) + chr(0b110011) + chr(0b110010) + chr(0b100 + 0o61), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(1795 - 1747) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(689 - 641) + chr(8413 - 8302) + chr(197 - 146) + chr(0b100000 + 0o23) + chr(497 - 445), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x36' + '\061', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b10111 + 0o36) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10001 + 0o40) + '\061', 0b1000), ehT0Px3KOsy9(chr(397 - 349) + '\157' + '\x32' + chr(291 - 241) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(70 - 16) + chr(0b110110), 50836 - 50828), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + chr(0b11 + 0o57) + chr(0b110111), 8), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + chr(0b110001) + chr(0b110100) + chr(0b110101), 48678 - 48670), ehT0Px3KOsy9('\060' + chr(0b1000010 + 0o55) + chr(49) + chr(0b110 + 0o55) + chr(50), 64792 - 64784), ehT0Px3KOsy9('\x30' + '\157' + '\064' + chr(1472 - 1424), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101101 + 0o102) + chr(49) + '\x33' + chr(50), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(53) + chr(48), 27810 - 27802)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4'), chr(0b1100100) + '\x65' + chr(0b10 + 0o141) + '\x6f' + chr(0b11111 + 0o105) + '\145')(chr(117) + '\164' + chr(102) + chr(45) + chr(0b101000 + 0o20)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def oOfbkxXTO64Z(n4ljua2gi1Pr): xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b1100000 + 0o4) + chr(4353 - 4252) + chr(0b1100011) + chr(111) + chr(4555 - 4455) + '\145')('\165' + chr(4176 - 4060) + '\146' + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0/\xe0\n\xa2r'), chr(100) + '\145' + '\x63' + '\x6f' + chr(100) + chr(0b1001000 + 0o35))(chr(0b1110101) + '\x74' + chr(0b1100110) + chr(45) + chr(579 - 523)), ehT0Px3KOsy9(chr(0b110000) + chr(2906 - 2795) + '\x34', ord("\x08"))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b1100100) + chr(687 - 586) + chr(0b1100011) + chr(1142 - 1031) + '\x64' + chr(8886 - 8785))(chr(117) + '\x74' + chr(102) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\x1f\xfa\x10\xbdH\x13F\xb3'), chr(0b110000 + 0o64) + '\x65' + chr(99) + chr(0b1011100 + 0o23) + '\x64' + chr(0b1100101))(chr(117) + chr(116) + chr(1465 - 1363) + '\055' + chr(0b111000)), 0.5) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), '\x64' + '\x65' + '\x63' + chr(111) + chr(0b1100100) + '\x65')('\165' + '\x74' + chr(102) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xf8\x1f\xe7\x17\xb4r\x19F\xa6\xba'\xa4pT\xb0"), '\144' + '\145' + '\143' + '\157' + '\144' + chr(101))(chr(2366 - 2249) + '\164' + '\146' + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\xe2'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1001 + 0o134))(chr(0b1110101) + chr(116) + chr(102) + '\x2d' + '\070')) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), '\144' + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(0b1011000 + 0o14) + '\x65')('\165' + '\164' + chr(0b11111 + 0o107) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\x05\xfe<\xba{\x18@\xae\xa2'), chr(0b1100100) + '\x65' + chr(3016 - 2917) + chr(111) + '\144' + '\x65')(chr(0b101011 + 0o112) + chr(8142 - 8026) + chr(8209 - 8107) + chr(0b101101) + chr(0b111000)), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 0o10)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), '\144' + '\x65' + '\143' + '\x6f' + chr(0b10 + 0o142) + '\x65')(chr(117) + chr(0b111010 + 0o72) + '\x66' + chr(0b10100 + 0o31) + chr(257 - 201)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\x05\xfe<\xaar\x04J\xa1\xa4\x19\xa3j'), chr(0b1100100) + '\x65' + '\143' + chr(5671 - 5560) + '\x64' + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(1135 - 1090) + '\x38'), ehT0Px3KOsy9(chr(0b110000) + chr(3233 - 3122) + chr(49), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), '\144' + '\145' + '\143' + chr(111) + chr(100) + chr(1581 - 1480))('\x75' + chr(0b1110100) + chr(0b1100110) + chr(1150 - 1105) + chr(626 - 570)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\x15\xe7\x02'), chr(3396 - 3296) + '\x65' + chr(0b1100011) + chr(10901 - 10790) + '\144' + chr(0b1100101))('\x75' + chr(116) + chr(0b1010010 + 0o24) + '\055' + '\070'), 0.25) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(2601 - 2501) + chr(101) + '\143' + '\157' + '\x64' + '\145')(chr(0b111010 + 0o73) + chr(0b1110100) + chr(102) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\x00\xe0\n\xb4x\x19'), '\144' + chr(101) + chr(9406 - 9307) + '\x6f' + chr(0b101011 + 0o71) + chr(101))(chr(0b1110101) + chr(116) + chr(102) + chr(147 - 102) + chr(0b11101 + 0o33)), 1e-05) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(1725 - 1625) + chr(101) + '\x63' + chr(6135 - 6024) + chr(0b111110 + 0o46) + chr(101))('\165' + chr(3894 - 3778) + chr(0b1100110) + '\x2d' + chr(0b10101 + 0o43)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x15\xf0\x02\xa1'), chr(100) + '\x65' + '\143' + chr(0b111 + 0o150) + '\x64' + chr(101))(chr(117) + chr(0b101110 + 0o106) + chr(0b1100110) + chr(0b110 + 0o47) + '\x38'), 0.999) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b1100100) + '\x65' + chr(0b1011 + 0o130) + chr(5517 - 5406) + chr(0b1010111 + 0o15) + chr(2664 - 2563))(chr(0b1110101) + chr(2555 - 2439) + chr(102) + chr(45) + chr(200 - 144)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\x1d\xf2'), chr(100) + '\x65' + chr(3801 - 3702) + chr(9431 - 9320) + chr(100) + chr(0b1001010 + 0o33))('\165' + chr(116) + '\146' + chr(474 - 429) + chr(0b111000)), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(48), 0b1000)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b101 + 0o137) + '\x65' + chr(7654 - 7555) + '\x6f' + chr(0b100110 + 0o76) + chr(0b1100101))(chr(0b11100 + 0o131) + chr(0b101011 + 0o111) + '\x66' + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xe8\x11\xfd\x07\xb7z(W\xaa\xa1'\xa4"), chr(100) + chr(0b11001 + 0o114) + '\x63' + chr(111) + chr(0b101100 + 0o70) + '\145')('\x75' + chr(0b1111 + 0o145) + chr(9095 - 8993) + '\055' + '\070'), ehT0Px3KOsy9(chr(0b110000) + chr(2600 - 2489) + '\061', 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b1100100) + '\x65' + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(5179 - 5078))('\165' + '\164' + chr(5861 - 5759) + chr(0b11111 + 0o16) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x1f\xf5\x17\x87r\x1a'), chr(100) + '\145' + chr(0b1100011) + chr(0b1010010 + 0o35) + chr(100) + chr(101))(chr(0b1110001 + 0o4) + chr(116) + '\x66' + '\055' + chr(2287 - 2231)), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11110 + 0o22), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b101 + 0o137) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(2078 - 1978) + chr(642 - 541))(chr(0b100100 + 0o121) + chr(0b1110100) + chr(0b100 + 0o142) + chr(509 - 464) + chr(0b110000 + 0o10)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\x05\xfe<\xabv\x1aS\xa9\xb4\x0b'), chr(4930 - 4830) + chr(0b1100101) + '\143' + chr(7544 - 7433) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(1475 - 1359) + '\146' + '\055' + '\x38'), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + '\x31' + '\062', 0o10)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(100) + chr(101) + '\143' + chr(0b1101111) + '\x64' + '\x65')('\x75' + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(1848 - 1792)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\x11\xe7\n\xb6p(W\xbc\xa1\x1d'), chr(0b1100100) + chr(0b1001100 + 0o31) + chr(0b111100 + 0o47) + chr(111) + chr(5025 - 4925) + chr(101))('\165' + chr(9664 - 9548) + chr(1054 - 952) + chr(45) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xec\x01'), chr(100) + chr(0b1100101) + '\143' + chr(11540 - 11429) + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(116) + chr(4470 - 4368) + chr(0b101101) + chr(56))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(0b1010010 + 0o22) + chr(1192 - 1091) + chr(0b1100011) + chr(0b1100010 + 0o15) + chr(0b100000 + 0o104) + chr(0b110101 + 0o60))(chr(11068 - 10951) + '\x74' + '\x66' + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xef\x03\xf6<\xabt\x16O\xa0\xa2'), chr(0b1 + 0o143) + chr(9525 - 9424) + chr(99) + chr(0b10011 + 0o134) + '\144' + chr(101))(chr(0b1110101) + chr(0b110010 + 0o102) + chr(3969 - 3867) + chr(601 - 556) + chr(56)), ehT0Px3KOsy9(ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + '\061', 8))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x14\xf7<\xb0g\x16Q\xa4\xbc'), chr(100) + chr(0b1100101) + chr(0b1000110 + 0o35) + '\157' + chr(0b1100100) + chr(8395 - 8294))(chr(0b11010 + 0o133) + '\164' + chr(0b1110 + 0o130) + chr(0b100100 + 0o11) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8\x15\xe0\n\xbcb\x16O\x9a\xb2\x1d\xa1mH\xbb\x1f\xdf\xc3'), chr(7981 - 7881) + '\145' + '\x63' + '\157' + chr(0b10000 + 0o124) + chr(101))(chr(0b1100100 + 0o21) + chr(116) + chr(0b1100110) + chr(0b100011 + 0o12) + '\070'), ehT0Px3KOsy9(ehT0Px3KOsy9(chr(48) + chr(11619 - 11508) + '\060', 8)))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
_my_top_k
def _my_top_k(x, k): """GPU-compatible version of top-k that works for very small constant k. Calls argmax repeatedly. tf.nn.top_k is implemented for GPU, but the gradient, sparse_to_dense, seems not to be, so if we use tf.nn.top_k, then both the top_k and its gradient go on cpu. Once this is not an issue, this function becomes obsolete and should be replaced by tf.nn.top_k. Args: x: a 2d Tensor. k: a small integer. Returns: values: a Tensor of shape [batch_size, k] indices: a int32 Tensor of shape [batch_size, k] """ if k > 10: return tf.nn.top_k(x, k) values = [] indices = [] depth = tf.shape(x)[1] for i in range(k): values.append(tf.reduce_max(x, 1)) argmax = tf.argmax(x, 1) indices.append(argmax) if i + 1 < k: x += tf.one_hot(argmax, depth, -1e9) return tf.stack(values, axis=1), tf.to_int32(tf.stack(indices, axis=1))
python
def _my_top_k(x, k): """GPU-compatible version of top-k that works for very small constant k. Calls argmax repeatedly. tf.nn.top_k is implemented for GPU, but the gradient, sparse_to_dense, seems not to be, so if we use tf.nn.top_k, then both the top_k and its gradient go on cpu. Once this is not an issue, this function becomes obsolete and should be replaced by tf.nn.top_k. Args: x: a 2d Tensor. k: a small integer. Returns: values: a Tensor of shape [batch_size, k] indices: a int32 Tensor of shape [batch_size, k] """ if k > 10: return tf.nn.top_k(x, k) values = [] indices = [] depth = tf.shape(x)[1] for i in range(k): values.append(tf.reduce_max(x, 1)) argmax = tf.argmax(x, 1) indices.append(argmax) if i + 1 < k: x += tf.one_hot(argmax, depth, -1e9) return tf.stack(values, axis=1), tf.to_int32(tf.stack(indices, axis=1))
[ "def", "_my_top_k", "(", "x", ",", "k", ")", ":", "if", "k", ">", "10", ":", "return", "tf", ".", "nn", ".", "top_k", "(", "x", ",", "k", ")", "values", "=", "[", "]", "indices", "=", "[", "]", "depth", "=", "tf", ".", "shape", "(", "x", ")", "[", "1", "]", "for", "i", "in", "range", "(", "k", ")", ":", "values", ".", "append", "(", "tf", ".", "reduce_max", "(", "x", ",", "1", ")", ")", "argmax", "=", "tf", ".", "argmax", "(", "x", ",", "1", ")", "indices", ".", "append", "(", "argmax", ")", "if", "i", "+", "1", "<", "k", ":", "x", "+=", "tf", ".", "one_hot", "(", "argmax", ",", "depth", ",", "-", "1e9", ")", "return", "tf", ".", "stack", "(", "values", ",", "axis", "=", "1", ")", ",", "tf", ".", "to_int32", "(", "tf", ".", "stack", "(", "indices", ",", "axis", "=", "1", ")", ")" ]
GPU-compatible version of top-k that works for very small constant k. Calls argmax repeatedly. tf.nn.top_k is implemented for GPU, but the gradient, sparse_to_dense, seems not to be, so if we use tf.nn.top_k, then both the top_k and its gradient go on cpu. Once this is not an issue, this function becomes obsolete and should be replaced by tf.nn.top_k. Args: x: a 2d Tensor. k: a small integer. Returns: values: a Tensor of shape [batch_size, k] indices: a int32 Tensor of shape [batch_size, k]
[ "GPU", "-", "compatible", "version", "of", "top", "-", "k", "that", "works", "for", "very", "small", "constant", "k", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L405-L434
train
GPU - compatible version of top - k that works for very small constant k.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24V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yThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + chr(0b10111 + 0o32) + '\x33' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1736 - 1687) + chr(0b110000) + chr(150 - 102), 0o10), ehT0Px3KOsy9('\060' + chr(3277 - 3166) + chr(0b101001 + 0o12) + '\066' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110111) + chr(0b101101 + 0o6), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + chr(0b110001) + '\x37' + chr(1542 - 1493), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + chr(51) + chr(1491 - 1437) + chr(0b110111), 20470 - 20462), ehT0Px3KOsy9(chr(1857 - 1809) + chr(0b1101111) + chr(467 - 416) + chr(2282 - 2231) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(2200 - 2152) + chr(111) + chr(49) + chr(818 - 767) + chr(0b110001 + 0o5), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(413 - 362) + chr(51) + chr(319 - 269), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110001) + chr(0b10100 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + chr(1315 - 1265) + '\x33' + chr(0b100000 + 0o26), 34415 - 34407), ehT0Px3KOsy9('\060' + chr(111) + chr(1446 - 1397) + '\x37' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x35' + chr(53), 44081 - 44073), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(52) + chr(1927 - 1876), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(2772 - 2718) + chr(55), 7363 - 7355), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(2158 - 2107) + chr(0b1101 + 0o51) + '\061', 8), ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + chr(866 - 817) + chr(0b101001 + 0o7) + '\x33', 17039 - 17031), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100111 + 0o13) + chr(0b110000) + chr(0b10111 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + chr(0b110001) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(0b110101) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + chr(0b10000 + 0o41) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(215 - 167) + '\x6f' + chr(0b110001) + chr(0b110000) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(770 - 722) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(51), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\061' + '\x35' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(50) + chr(0b100 + 0o60) + chr(50), 63510 - 63502), ehT0Px3KOsy9('\060' + chr(4728 - 4617) + chr(578 - 527) + '\067' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b110001 + 0o76) + chr(1009 - 959) + chr(2053 - 1999) + chr(0b100101 + 0o22), 0o10), ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + chr(1006 - 956) + chr(0b110110) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(1485 - 1435) + '\x33' + chr(0b1111 + 0o47), 8), ehT0Px3KOsy9('\x30' + chr(8899 - 8788) + '\061' + '\x34' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b100000 + 0o117) + '\061' + chr(0b101 + 0o57) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(2186 - 2138) + chr(0b101001 + 0o106) + chr(51) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1458 - 1409) + chr(0b110100) + chr(0b11010 + 0o26), 0o10), ehT0Px3KOsy9(chr(1358 - 1310) + chr(111) + '\063' + chr(54) + chr(2238 - 2190), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(427 - 372) + chr(2673 - 2619), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\061' + chr(1070 - 1020) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111101 + 0o62) + '\x31' + chr(0b1110 + 0o43), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101110 + 0o1) + chr(0b110010) + chr(0b110001) + chr(52), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(6105 - 5994) + chr(0b10001 + 0o44) + chr(66 - 18), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'p'), chr(100) + chr(101) + chr(0b1011011 + 0o10) + chr(11228 - 11117) + chr(0b1100100) + '\x65')(chr(12244 - 12127) + chr(0b1110100) + chr(0b1001110 + 0o30) + chr(45) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def gVs6rORe05OO(OeWW0F1dBPRQ, OolUPRJhRaJd): if OolUPRJhRaJd > ehT0Px3KOsy9(chr(48) + chr(111) + chr(252 - 203) + chr(0b110010), 0b1000): return xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'*/\x81d\x12'), chr(5083 - 4983) + '\x65' + chr(0b1100011) + chr(1813 - 1702) + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + chr(0b1100110) + chr(45) + chr(0b1010 + 0o56)))(OeWW0F1dBPRQ, OolUPRJhRaJd) SPnCNu54H1db = [] pIcoaXENl5Pw = [] UEys4_lSwsID = IDJ2eXGCBCDu.nauYfLglTpcb(OeWW0F1dBPRQ)[ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 0o10)] for WVxHKyX45z_L in vQr8gNKaIaWE(OolUPRJhRaJd): xafqLlk3kkUe(SPnCNu54H1db, xafqLlk3kkUe(SXOLrMavuUCe(b'?0\x81^\x17\x93'), '\144' + chr(1814 - 1713) + '\143' + chr(2702 - 2591) + chr(0b1100100) + '\x65')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(1600 - 1555) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b',%\x95N\x1a\x92\x873\xbbq'), chr(100) + '\145' + chr(0b1001110 + 0o25) + '\x6f' + chr(8420 - 8320) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\055' + '\x38'))(OeWW0F1dBPRQ, ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110 + 0o53), 8))) ZVhyXLrjMqpt = IDJ2eXGCBCDu.argmax(OeWW0F1dBPRQ, ehT0Px3KOsy9(chr(579 - 531) + chr(111) + '\061', 8)) xafqLlk3kkUe(pIcoaXENl5Pw, xafqLlk3kkUe(SXOLrMavuUCe(b'?0\x81^\x17\x93'), chr(4461 - 4361) + chr(0b1100101) + chr(1003 - 904) + '\157' + chr(100) + '\x65')(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b100 + 0o51) + chr(0b111000)))(ZVhyXLrjMqpt) if WVxHKyX45z_L + ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8) < OolUPRJhRaJd: OeWW0F1dBPRQ += IDJ2eXGCBCDu.Hq3fv4Yp0EhD(ZVhyXLrjMqpt, UEys4_lSwsID, -1000000000.0) return (xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'-4\x90X\x12'), chr(0b1000010 + 0o42) + chr(0b1100101) + '\143' + '\x6f' + '\x64' + chr(101))(chr(3613 - 3496) + chr(116) + '\146' + '\x2d' + chr(0b110111 + 0o1)))(SPnCNu54H1db, axis=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 8)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'*/\xaeR\x17\x83\xebl'), '\144' + chr(0b1100101) + '\x63' + chr(111) + '\x64' + '\145')('\x75' + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'-4\x90X\x12'), chr(0b1010 + 0o132) + '\x65' + '\x63' + '\x6f' + chr(111 - 11) + chr(8848 - 8747))('\165' + '\x74' + chr(102) + chr(0b111 + 0o46) + chr(0b1011 + 0o55)))(pIcoaXENl5Pw, axis=ehT0Px3KOsy9(chr(1835 - 1787) + chr(0b110110 + 0o71) + chr(1431 - 1382), 8))))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
vq_gating
def vq_gating(x, num_experts, k, bneck, hparams=None, name="vq_gating"): """VQ gating. Args: x: input Tensor with shape [batch_size, input_size] num_experts: an integer k: an integer - number of experts per example bneck: a bottleneck object hparams: optional hparams name: an optional string Returns: gates: a Tensor with shape [batch_size, num_experts] load: a Tensor with shape [num_experts] """ with tf.variable_scope(name, reuse=tf.AUTO_REUSE): if hparams.use_scales: scales = tf.get_variable( "scales", [num_experts], tf.float32, initializer=tf.ones_initializer()) scales = tf.nn.softmax(scales) hparams.scales = scales input_size = x.get_shape().as_list()[-1] batch_size = common_layers.shape_list(x)[0] if k > 1: # first project into two dense layers, chop and discretize, and gate # TODO(avaswani): Maybe scale the embeddings flowing out of the experts. # We might want to do this to match the computation being done by topk x = tf.layers.dense(x, input_size * k) # x goes from [batch_size, input_size*k] to [batch_size*k, input_size] x = tf.reshape(x, [batch_size * k, input_size]) inputs = tf.expand_dims(x, axis=1) inputs = tf.expand_dims(inputs, axis=1) # VQ hparams hparams.z_size = int(math.log(num_experts, 2)) hparams.hidden_size = input_size hparams.top_k = k d = bneck.discrete_bottleneck(inputs) centroids = None exp_discrete = d["discrete"] embed_lookup = d["embed"] extra_loss = d["loss"] if hparams.residual_centroids: centroids = embed_lookup(exp_discrete) # gives the centroids top_k_indices = tf.squeeze(exp_discrete, axis=1) tf.summary.histogram("discrete_counts", top_k_indices) # if k > 1, then we need to reshape top_k_indices from [batch_size*k, 1] # to [batch_size, k] if k > 1: top_k_indices = tf.reshape(top_k_indices, [batch_size, k]) # get the top k gates top_k_gates = tf.ones([batch_size, k]) # This will be a `Tensor` of shape `[batch_size, n]`, with zeros in the # positions corresponding to all but the top k experts per example. gates = _rowwise_unsorted_segment_sum(top_k_gates, top_k_indices, num_experts) # Compute count per expert from the gates. # gates has shape [batch_size, num_experts] # count per expert has shape [num_experts, 1] count_per_expert = tf.reduce_sum(gates, axis=0) if hparams.use_scales: scale_loss = tf.reduce_mean(tf.to_float(count_per_expert) * scales) extra_loss += scale_loss if common_layers.should_generate_summaries(): tf.summary.histogram("vq_loss", extra_loss) tf.summary.historgram("scale_loss", scale_loss) return gates, extra_loss, centroids
python
def vq_gating(x, num_experts, k, bneck, hparams=None, name="vq_gating"): """VQ gating. Args: x: input Tensor with shape [batch_size, input_size] num_experts: an integer k: an integer - number of experts per example bneck: a bottleneck object hparams: optional hparams name: an optional string Returns: gates: a Tensor with shape [batch_size, num_experts] load: a Tensor with shape [num_experts] """ with tf.variable_scope(name, reuse=tf.AUTO_REUSE): if hparams.use_scales: scales = tf.get_variable( "scales", [num_experts], tf.float32, initializer=tf.ones_initializer()) scales = tf.nn.softmax(scales) hparams.scales = scales input_size = x.get_shape().as_list()[-1] batch_size = common_layers.shape_list(x)[0] if k > 1: # first project into two dense layers, chop and discretize, and gate # TODO(avaswani): Maybe scale the embeddings flowing out of the experts. # We might want to do this to match the computation being done by topk x = tf.layers.dense(x, input_size * k) # x goes from [batch_size, input_size*k] to [batch_size*k, input_size] x = tf.reshape(x, [batch_size * k, input_size]) inputs = tf.expand_dims(x, axis=1) inputs = tf.expand_dims(inputs, axis=1) # VQ hparams hparams.z_size = int(math.log(num_experts, 2)) hparams.hidden_size = input_size hparams.top_k = k d = bneck.discrete_bottleneck(inputs) centroids = None exp_discrete = d["discrete"] embed_lookup = d["embed"] extra_loss = d["loss"] if hparams.residual_centroids: centroids = embed_lookup(exp_discrete) # gives the centroids top_k_indices = tf.squeeze(exp_discrete, axis=1) tf.summary.histogram("discrete_counts", top_k_indices) # if k > 1, then we need to reshape top_k_indices from [batch_size*k, 1] # to [batch_size, k] if k > 1: top_k_indices = tf.reshape(top_k_indices, [batch_size, k]) # get the top k gates top_k_gates = tf.ones([batch_size, k]) # This will be a `Tensor` of shape `[batch_size, n]`, with zeros in the # positions corresponding to all but the top k experts per example. gates = _rowwise_unsorted_segment_sum(top_k_gates, top_k_indices, num_experts) # Compute count per expert from the gates. # gates has shape [batch_size, num_experts] # count per expert has shape [num_experts, 1] count_per_expert = tf.reduce_sum(gates, axis=0) if hparams.use_scales: scale_loss = tf.reduce_mean(tf.to_float(count_per_expert) * scales) extra_loss += scale_loss if common_layers.should_generate_summaries(): tf.summary.histogram("vq_loss", extra_loss) tf.summary.historgram("scale_loss", scale_loss) return gates, extra_loss, centroids
[ "def", "vq_gating", "(", "x", ",", "num_experts", ",", "k", ",", "bneck", ",", "hparams", "=", "None", ",", "name", "=", "\"vq_gating\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ",", "reuse", "=", "tf", ".", "AUTO_REUSE", ")", ":", "if", "hparams", ".", "use_scales", ":", "scales", "=", "tf", ".", "get_variable", "(", "\"scales\"", ",", "[", "num_experts", "]", ",", "tf", ".", "float32", ",", "initializer", "=", "tf", ".", "ones_initializer", "(", ")", ")", "scales", "=", "tf", ".", "nn", ".", "softmax", "(", "scales", ")", "hparams", ".", "scales", "=", "scales", "input_size", "=", "x", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", "-", "1", "]", "batch_size", "=", "common_layers", ".", "shape_list", "(", "x", ")", "[", "0", "]", "if", "k", ">", "1", ":", "# first project into two dense layers, chop and discretize, and gate", "# TODO(avaswani): Maybe scale the embeddings flowing out of the experts.", "# We might want to do this to match the computation being done by topk", "x", "=", "tf", ".", "layers", ".", "dense", "(", "x", ",", "input_size", "*", "k", ")", "# x goes from [batch_size, input_size*k] to [batch_size*k, input_size]", "x", "=", "tf", ".", "reshape", "(", "x", ",", "[", "batch_size", "*", "k", ",", "input_size", "]", ")", "inputs", "=", "tf", ".", "expand_dims", "(", "x", ",", "axis", "=", "1", ")", "inputs", "=", "tf", ".", "expand_dims", "(", "inputs", ",", "axis", "=", "1", ")", "# VQ hparams", "hparams", ".", "z_size", "=", "int", "(", "math", ".", "log", "(", "num_experts", ",", "2", ")", ")", "hparams", ".", "hidden_size", "=", "input_size", "hparams", ".", "top_k", "=", "k", "d", "=", "bneck", ".", "discrete_bottleneck", "(", "inputs", ")", "centroids", "=", "None", "exp_discrete", "=", "d", "[", "\"discrete\"", "]", "embed_lookup", "=", "d", "[", "\"embed\"", "]", "extra_loss", "=", "d", "[", "\"loss\"", "]", "if", "hparams", ".", "residual_centroids", ":", "centroids", "=", "embed_lookup", "(", "exp_discrete", ")", "# gives the centroids", "top_k_indices", "=", "tf", ".", "squeeze", "(", "exp_discrete", ",", "axis", "=", "1", ")", "tf", ".", "summary", ".", "histogram", "(", "\"discrete_counts\"", ",", "top_k_indices", ")", "# if k > 1, then we need to reshape top_k_indices from [batch_size*k, 1]", "# to [batch_size, k]", "if", "k", ">", "1", ":", "top_k_indices", "=", "tf", ".", "reshape", "(", "top_k_indices", ",", "[", "batch_size", ",", "k", "]", ")", "# get the top k gates", "top_k_gates", "=", "tf", ".", "ones", "(", "[", "batch_size", ",", "k", "]", ")", "# This will be a `Tensor` of shape `[batch_size, n]`, with zeros in the", "# positions corresponding to all but the top k experts per example.", "gates", "=", "_rowwise_unsorted_segment_sum", "(", "top_k_gates", ",", "top_k_indices", ",", "num_experts", ")", "# Compute count per expert from the gates.", "# gates has shape [batch_size, num_experts]", "# count per expert has shape [num_experts, 1]", "count_per_expert", "=", "tf", ".", "reduce_sum", "(", "gates", ",", "axis", "=", "0", ")", "if", "hparams", ".", "use_scales", ":", "scale_loss", "=", "tf", ".", "reduce_mean", "(", "tf", ".", "to_float", "(", "count_per_expert", ")", "*", "scales", ")", "extra_loss", "+=", "scale_loss", "if", "common_layers", ".", "should_generate_summaries", "(", ")", ":", "tf", ".", "summary", ".", "histogram", "(", "\"vq_loss\"", ",", "extra_loss", ")", "tf", ".", "summary", ".", "historgram", "(", "\"scale_loss\"", ",", "scale_loss", ")", "return", "gates", ",", "extra_loss", ",", "centroids" ]
VQ gating. Args: x: input Tensor with shape [batch_size, input_size] num_experts: an integer k: an integer - number of experts per example bneck: a bottleneck object hparams: optional hparams name: an optional string Returns: gates: a Tensor with shape [batch_size, num_experts] load: a Tensor with shape [num_experts]
[ "VQ", "gating", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2t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Rbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(49) + chr(0b101100 + 0o11) + chr(812 - 763), 0o10), ehT0Px3KOsy9(chr(1733 - 1685) + '\157' + chr(2294 - 2243) + chr(2391 - 2341) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + chr(1838 - 1789) + '\x34' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(0b110001) + chr(557 - 503) + chr(0b10111 + 0o40), 15146 - 15138), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(893 - 839), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\067' + chr(1431 - 1378), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + chr(51) + chr(0b110101) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001 + 0o2) + chr(0b110010) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(0b110001) + chr(0b110011) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(10371 - 10260) + chr(816 - 766) + chr(50) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1497 - 1449) + chr(0b101 + 0o152) + chr(406 - 356) + chr(1379 - 1330) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\064' + chr(1309 - 1254), 8), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1100110 + 0o11) + chr(0b100101 + 0o15) + chr(0b110110 + 0o1) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(53), 9385 - 9377), ehT0Px3KOsy9(chr(1809 - 1761) + '\157' + '\063' + chr(48) + chr(1116 - 1063), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(55) + chr(0b11111 + 0o26), 0o10), ehT0Px3KOsy9('\060' + chr(11729 - 11618) + chr(50) + '\x34' + chr(2333 - 2281), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\x36' + chr(2534 - 2481), 0b1000), ehT0Px3KOsy9(chr(1498 - 1450) + '\157' + chr(49) + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(4698 - 4587) + '\x31' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(3330 - 3219) + chr(0b100100 + 0o16) + chr(0b10110 + 0o32) + chr(0b10100 + 0o40), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(2286 - 2237) + chr(918 - 864) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(638 - 588) + chr(50) + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b10101 + 0o36) + chr(1635 - 1584), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5332 - 5221) + chr(0b101111 + 0o2) + '\064' + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(10036 - 9925) + '\x32' + '\067' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + '\x33' + chr(0b110011) + chr(0b11000 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1000011 + 0o54) + '\x33' + chr(0b110000), 8), ehT0Px3KOsy9(chr(1864 - 1816) + chr(111) + chr(0b110 + 0o54) + chr(48) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(536 - 488) + chr(5781 - 5670) + '\x33' + chr(1546 - 1491) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101 + 0o56) + '\x34' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(73 - 25) + chr(287 - 176) + chr(50) + chr(48) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\067' + '\x32', 4793 - 4785), ehT0Px3KOsy9(chr(0b110000) + chr(2241 - 2130) + chr(2998 - 2943) + chr(615 - 567), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\063' + '\063', 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(3261 - 3150) + '\x33' + chr(0b110100) + '\064', 836 - 828), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(605 - 557), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2215 - 2167) + chr(111) + '\x35' + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'8'), '\x64' + chr(0b1100101) + '\143' + chr(10082 - 9971) + '\144' + chr(0b1100101))('\x75' + chr(1412 - 1296) + '\x66' + '\x2d' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Z9Ys4PO9zQ93(OeWW0F1dBPRQ, et6dMbqOJH62, OolUPRJhRaJd, IiRlvGfCpKjV, n4ljua2gi1Pr=None, AIvJRzLdDfgF=xafqLlk3kkUe(SXOLrMavuUCe(b'`\x18\x8by\x06\x03\x7f\xd3\x89'), chr(5572 - 5472) + chr(0b1100101) + '\143' + chr(111) + chr(100) + '\145')(chr(0b1010 + 0o153) + chr(0b1000011 + 0o61) + chr(8073 - 7971) + '\x2d' + chr(0b111000))): with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'`\x08\xa6w\x06\x15z\xd8\xb1\xa1<\xff\xff\x02'), chr(952 - 852) + '\145' + chr(6787 - 6688) + chr(111) + chr(100) + '\x65')(chr(0b100001 + 0o124) + chr(0b11101 + 0o127) + chr(0b1100110) + chr(45) + chr(0b111000)))(AIvJRzLdDfgF, reuse=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W<\x80Q8%S\xe8\xbd\x97'), '\144' + chr(101) + chr(99) + '\157' + chr(0b1100100 + 0o0) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b1100110) + '\055' + '\070'))): if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b"{\x1a\x85S('/\x8e\xde\xbcl\xa6"), chr(100) + chr(3992 - 3891) + chr(0b1100011) + chr(111) + chr(100) + chr(6247 - 6146))(chr(0b11100 + 0o131) + chr(0b1001010 + 0o52) + chr(0b1100110) + chr(759 - 714) + chr(0b111000))): Qii5VQxBIc9l = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'e\n\xb5r\x02\x04'), chr(0b1100 + 0o130) + chr(101) + chr(0b111 + 0o134) + chr(0b111100 + 0o63) + '\144' + chr(101))('\165' + chr(0b1110100) + '\146' + '\x2d' + '\070'), [et6dMbqOJH62], IDJ2eXGCBCDu.float32, initializer=IDJ2eXGCBCDu.ones_initializer()) Qii5VQxBIc9l = IDJ2eXGCBCDu.nn.softmax(Qii5VQxBIc9l) n4ljua2gi1Pr.Qii5VQxBIc9l = Qii5VQxBIc9l uNAGRcXaNiGu = OeWW0F1dBPRQ.get_shape().as_list()[-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 0o10)] ix9dZyeAmUxY = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x30', 0b1000)] if OolUPRJhRaJd > ehT0Px3KOsy9('\060' + chr(627 - 516) + chr(56 - 7), 8): OeWW0F1dBPRQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, uNAGRcXaNiGu * OolUPRJhRaJd) OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [ix9dZyeAmUxY * OolUPRJhRaJd, uNAGRcXaNiGu]) vXoupepMtCXU = IDJ2eXGCBCDu.expand_dims(OeWW0F1dBPRQ, axis=ehT0Px3KOsy9(chr(1775 - 1727) + '\x6f' + '\x31', 8)) vXoupepMtCXU = IDJ2eXGCBCDu.expand_dims(vXoupepMtCXU, axis=ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8)) n4ljua2gi1Pr.NSd4iRY6tdp8 = ehT0Px3KOsy9(yhiZVkosCjBm.log(et6dMbqOJH62, ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10111 + 0o33), 11746 - 11738))) n4ljua2gi1Pr.qzoyXN3kdhDL = uNAGRcXaNiGu n4ljua2gi1Pr.LQLM6CJZRTKz = OolUPRJhRaJd pd3lxn9vqWxp = IiRlvGfCpKjV.discrete_bottleneck(vXoupepMtCXU) pQVlMI45ZwAY = None r0SvFp5n3GTm = pd3lxn9vqWxp[xafqLlk3kkUe(SXOLrMavuUCe(b'r\x00\xa7}\x15\x12b\xd8'), chr(4553 - 4453) + '\x65' + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))(chr(0b110000 + 0o105) + chr(7527 - 7411) + chr(10198 - 10096) + chr(0b101101) + '\x38')] _MvT5wUiAnYf = pd3lxn9vqWxp[xafqLlk3kkUe(SXOLrMavuUCe(b's\x04\xb6{\x03'), chr(0b1100100) + chr(0b110001 + 0o64) + '\143' + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(4132 - 4015) + chr(116) + chr(102) + '\x2d' + chr(56))] OyYXdGmcLv7F = pd3lxn9vqWxp[xafqLlk3kkUe(SXOLrMavuUCe(b'z\x06\xa7m'), '\144' + '\145' + chr(99) + chr(0b1010000 + 0o37) + '\144' + chr(0b1100101))('\165' + chr(0b1110100) + chr(0b1100110) + chr(1557 - 1512) + '\x38')] if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'd\x0c\xa7w\x03\x02w\xd1\xb1\xb1:\xfe\xfb\x15\xd1t\xa1\x0e'), chr(0b1100100) + chr(9123 - 9022) + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1100111 + 0o15) + chr(102) + chr(0b0 + 0o55) + '\x38')): pQVlMI45ZwAY = _MvT5wUiAnYf(r0SvFp5n3GTm) IXQnYU6qh6Zj = IDJ2eXGCBCDu.squeeze(r0SvFp5n3GTm, axis=ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1001101 + 0o42) + '\x31', 8)) xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'I-\xe0D\x10Nt\xc9\xbb\x86*\xc1'), '\x64' + chr(101) + chr(5415 - 5316) + chr(3015 - 2904) + '\x64' + '\145')(chr(0b100001 + 0o124) + '\164' + '\x66' + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'r\x00\xa7}\x15\x12b\xd8\xb1\xb10\xe5\xe1\x13\xcd'), '\x64' + chr(4381 - 4280) + chr(0b1011110 + 0o5) + '\157' + chr(0b110 + 0o136) + '\x65')('\x75' + chr(0b1110100) + chr(102) + '\055' + chr(1474 - 1418)), IXQnYU6qh6Zj) if OolUPRJhRaJd > ehT0Px3KOsy9(chr(589 - 541) + chr(0b1101111) + '\061', 8): IXQnYU6qh6Zj = IDJ2eXGCBCDu.reshape(IXQnYU6qh6Zj, [ix9dZyeAmUxY, OolUPRJhRaJd]) bNNm2WCETOQk = IDJ2eXGCBCDu.ones([ix9dZyeAmUxY, OolUPRJhRaJd]) D5FfJKnAV_lN = faKSxxZs1m9B(bNNm2WCETOQk, IXQnYU6qh6Zj, et6dMbqOJH62) tecqTWJ62Weu = IDJ2eXGCBCDu.reduce_sum(D5FfJKnAV_lN, axis=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11011 + 0o25), 8)) if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b"{\x1a\x85S('/\x8e\xde\xbcl\xa6"), chr(0b110 + 0o136) + chr(203 - 102) + chr(7683 - 7584) + '\x6f' + chr(100) + '\x65')(chr(1367 - 1250) + chr(0b1110100) + chr(0b11011 + 0o113) + '\x2d' + chr(0b100011 + 0o25))): MjTjd5jPWAG4 = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.ZUL3kHBGU8Uu(tecqTWJ62Weu) * Qii5VQxBIc9l) OyYXdGmcLv7F += MjTjd5jPWAG4 if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'e\x01\xbbk\x0b\x13I\xda\x8b\xbc:\xe2\xee\x13\xdbB\xb6\x08\xc9\x98\x0fjf\xe1\x03'), chr(0b1100100 + 0o0) + chr(0b101000 + 0o75) + '\143' + chr(10303 - 10192) + '\144' + chr(0b1100101))(chr(0b10 + 0o163) + '\x74' + '\x66' + chr(1602 - 1557) + chr(0b111000)))(): xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'I-\xe0D\x10Nt\xc9\xbb\x86*\xc1'), chr(9151 - 9051) + chr(1250 - 1149) + chr(2899 - 2800) + chr(4636 - 4525) + chr(3829 - 3729) + '\145')(chr(117) + chr(0b1100010 + 0o22) + '\x66' + chr(0b101101) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'`\x18\x8br\x08\x04e'), '\x64' + chr(0b1100101) + '\x63' + '\x6f' + chr(0b1100100) + chr(6089 - 5988))(chr(117) + chr(116) + '\x66' + chr(1432 - 1387) + chr(56)), OyYXdGmcLv7F) xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'~\x00\xa7j\x08\x05q\xcf\x8f\xbf'), '\144' + '\x65' + chr(0b1000 + 0o133) + '\x6f' + '\144' + '\x65')(chr(11745 - 11628) + '\164' + '\146' + chr(45) + chr(1623 - 1567)))(xafqLlk3kkUe(SXOLrMavuUCe(b'e\n\xb5r\x02(z\xd2\x9d\xa1'), '\x64' + chr(101) + '\x63' + chr(0b1001110 + 0o41) + chr(100) + '\145')(chr(117) + chr(1835 - 1719) + chr(0b1000100 + 0o42) + '\055' + '\070'), MjTjd5jPWAG4) return (D5FfJKnAV_lN, OyYXdGmcLv7F, pQVlMI45ZwAY)
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
noisy_top_k_gating
def noisy_top_k_gating(x, num_experts, train, k=2, initializer=tf.zeros_initializer(), noisy_gating=True, noise_epsilon=1e-2, name=None): """Noisy top-k gating. See paper: https://arxiv.org/abs/1701.06538. Args: x: input Tensor with shape [batch_size, input_size] num_experts: an integer train: a boolean - we only add noise at training time. k: an integer - number of experts per example initializer: an initializer noisy_gating: a boolean noise_epsilon: a float name: an optional string Returns: gates: a Tensor with shape [batch_size, num_experts] load: a Tensor with shape [num_experts] """ with tf.variable_scope(name, default_name="noisy_top_k_gating"): input_size = x.get_shape().as_list()[-1] w_gate = tf.get_variable( "w_gate", [input_size, num_experts], tf.float32, initializer) if noisy_gating: w_noise = tf.get_variable("w_noise", [input_size, num_experts], tf.float32, initializer) clean_logits = tf.matmul(x, w_gate) if noisy_gating: raw_noise_stddev = tf.matmul(x, w_noise) noise_stddev = ((tf.nn.softplus(raw_noise_stddev) + noise_epsilon) * (tf.to_float(train))) noisy_logits = clean_logits + ( tf.random_normal(tf.shape(clean_logits)) * noise_stddev) logits = noisy_logits if common_layers.should_generate_summaries(): tf.summary.histogram("noisy_logits", noisy_logits) tf.summary.histogram("noise_stddev", noise_stddev) else: logits = clean_logits top_logits, top_indices = _my_top_k(logits, min(k + 1, num_experts)) # top k logits has shape [batch, k] top_k_logits = tf.slice(top_logits, [0, 0], [-1, k]) top_k_indices = tf.slice(top_indices, [0, 0], [-1, k]) top_k_gates = tf.nn.softmax(top_k_logits) # This will be a `Tensor` of shape `[batch_size, n]`, with zeros in the # positions corresponding to all but the top k experts per example. gates = _rowwise_unsorted_segment_sum(top_k_gates, top_k_indices, num_experts) if noisy_gating and k < num_experts: load = tf.reduce_sum( _prob_in_top_k(clean_logits, noisy_logits, noise_stddev, top_logits, k), 0) else: load = _gates_to_load(gates) if common_layers.should_generate_summaries(): tf.summary.histogram("importance", tf.reduce_sum(gates, 0)) tf.summary.histogram("load", load) return gates, load
python
def noisy_top_k_gating(x, num_experts, train, k=2, initializer=tf.zeros_initializer(), noisy_gating=True, noise_epsilon=1e-2, name=None): """Noisy top-k gating. See paper: https://arxiv.org/abs/1701.06538. Args: x: input Tensor with shape [batch_size, input_size] num_experts: an integer train: a boolean - we only add noise at training time. k: an integer - number of experts per example initializer: an initializer noisy_gating: a boolean noise_epsilon: a float name: an optional string Returns: gates: a Tensor with shape [batch_size, num_experts] load: a Tensor with shape [num_experts] """ with tf.variable_scope(name, default_name="noisy_top_k_gating"): input_size = x.get_shape().as_list()[-1] w_gate = tf.get_variable( "w_gate", [input_size, num_experts], tf.float32, initializer) if noisy_gating: w_noise = tf.get_variable("w_noise", [input_size, num_experts], tf.float32, initializer) clean_logits = tf.matmul(x, w_gate) if noisy_gating: raw_noise_stddev = tf.matmul(x, w_noise) noise_stddev = ((tf.nn.softplus(raw_noise_stddev) + noise_epsilon) * (tf.to_float(train))) noisy_logits = clean_logits + ( tf.random_normal(tf.shape(clean_logits)) * noise_stddev) logits = noisy_logits if common_layers.should_generate_summaries(): tf.summary.histogram("noisy_logits", noisy_logits) tf.summary.histogram("noise_stddev", noise_stddev) else: logits = clean_logits top_logits, top_indices = _my_top_k(logits, min(k + 1, num_experts)) # top k logits has shape [batch, k] top_k_logits = tf.slice(top_logits, [0, 0], [-1, k]) top_k_indices = tf.slice(top_indices, [0, 0], [-1, k]) top_k_gates = tf.nn.softmax(top_k_logits) # This will be a `Tensor` of shape `[batch_size, n]`, with zeros in the # positions corresponding to all but the top k experts per example. gates = _rowwise_unsorted_segment_sum(top_k_gates, top_k_indices, num_experts) if noisy_gating and k < num_experts: load = tf.reduce_sum( _prob_in_top_k(clean_logits, noisy_logits, noise_stddev, top_logits, k), 0) else: load = _gates_to_load(gates) if common_layers.should_generate_summaries(): tf.summary.histogram("importance", tf.reduce_sum(gates, 0)) tf.summary.histogram("load", load) return gates, load
[ "def", "noisy_top_k_gating", "(", "x", ",", "num_experts", ",", "train", ",", "k", "=", "2", ",", "initializer", "=", "tf", ".", "zeros_initializer", "(", ")", ",", "noisy_gating", "=", "True", ",", "noise_epsilon", "=", "1e-2", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ",", "default_name", "=", "\"noisy_top_k_gating\"", ")", ":", "input_size", "=", "x", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", "-", "1", "]", "w_gate", "=", "tf", ".", "get_variable", "(", "\"w_gate\"", ",", "[", "input_size", ",", "num_experts", "]", ",", "tf", ".", "float32", ",", "initializer", ")", "if", "noisy_gating", ":", "w_noise", "=", "tf", ".", "get_variable", "(", "\"w_noise\"", ",", "[", "input_size", ",", "num_experts", "]", ",", "tf", ".", "float32", ",", "initializer", ")", "clean_logits", "=", "tf", ".", "matmul", "(", "x", ",", "w_gate", ")", "if", "noisy_gating", ":", "raw_noise_stddev", "=", "tf", ".", "matmul", "(", "x", ",", "w_noise", ")", "noise_stddev", "=", "(", "(", "tf", ".", "nn", ".", "softplus", "(", "raw_noise_stddev", ")", "+", "noise_epsilon", ")", "*", "(", "tf", ".", "to_float", "(", "train", ")", ")", ")", "noisy_logits", "=", "clean_logits", "+", "(", "tf", ".", "random_normal", "(", "tf", ".", "shape", "(", "clean_logits", ")", ")", "*", "noise_stddev", ")", "logits", "=", "noisy_logits", "if", "common_layers", ".", "should_generate_summaries", "(", ")", ":", "tf", ".", "summary", ".", "histogram", "(", "\"noisy_logits\"", ",", "noisy_logits", ")", "tf", ".", "summary", ".", "histogram", "(", "\"noise_stddev\"", ",", "noise_stddev", ")", "else", ":", "logits", "=", "clean_logits", "top_logits", ",", "top_indices", "=", "_my_top_k", "(", "logits", ",", "min", "(", "k", "+", "1", ",", "num_experts", ")", ")", "# top k logits has shape [batch, k]", "top_k_logits", "=", "tf", ".", "slice", "(", "top_logits", ",", "[", "0", ",", "0", "]", ",", "[", "-", "1", ",", "k", "]", ")", "top_k_indices", "=", "tf", ".", "slice", "(", "top_indices", ",", "[", "0", ",", "0", "]", ",", "[", "-", "1", ",", "k", "]", ")", "top_k_gates", "=", "tf", ".", "nn", ".", "softmax", "(", "top_k_logits", ")", "# This will be a `Tensor` of shape `[batch_size, n]`, with zeros in the", "# positions corresponding to all but the top k experts per example.", "gates", "=", "_rowwise_unsorted_segment_sum", "(", "top_k_gates", ",", "top_k_indices", ",", "num_experts", ")", "if", "noisy_gating", "and", "k", "<", "num_experts", ":", "load", "=", "tf", ".", "reduce_sum", "(", "_prob_in_top_k", "(", "clean_logits", ",", "noisy_logits", ",", "noise_stddev", ",", "top_logits", ",", "k", ")", ",", "0", ")", "else", ":", "load", "=", "_gates_to_load", "(", "gates", ")", "if", "common_layers", ".", "should_generate_summaries", "(", ")", ":", "tf", ".", "summary", ".", "histogram", "(", "\"importance\"", ",", "tf", ".", "reduce_sum", "(", "gates", ",", "0", ")", ")", "tf", ".", "summary", ".", "histogram", "(", "\"load\"", ",", "load", ")", "return", "gates", ",", "load" ]
Noisy top-k gating. See paper: https://arxiv.org/abs/1701.06538. Args: x: input Tensor with shape [batch_size, input_size] num_experts: an integer train: a boolean - we only add noise at training time. k: an integer - number of experts per example initializer: an initializer noisy_gating: a boolean noise_epsilon: a float name: an optional string Returns: gates: a Tensor with shape [batch_size, num_experts] load: a Tensor with shape [num_experts]
[ "Noisy", "top", "-", "k", "gating", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L514-L579
train
Noisy top - k gating.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU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ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1783 - 1735) + chr(0b1101111) + chr(52) + '\061', 5657 - 5649), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011000 + 0o27) + chr(51) + chr(2326 - 2276) + chr(0b10 + 0o60), 29869 - 29861), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b11110 + 0o121) + chr(1383 - 1332) + chr(0b100100 + 0o20) + chr(0b10010 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + '\063' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + chr(51) + chr(0b110100) + chr(0b101110 + 0o6), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110000) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(948 - 900) + chr(9080 - 8969) + '\x32' + '\066' + '\x31', 64098 - 64090), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(55) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(49) + chr(49) + chr(0b10001 + 0o37), 43382 - 43374), ehT0Px3KOsy9(chr(1841 - 1793) + chr(111) + '\x34' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2059 - 2005) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(51) + chr(54) + chr(0b100011 + 0o23), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\061' + chr(0b100000 + 0o26), 62441 - 62433), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + chr(2483 - 2433) + '\x35' + chr(0b111 + 0o55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\x37' + chr(0b110011), 33361 - 33353), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(794 - 742) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5639 - 5528) + chr(49) + chr(0b110101) + chr(562 - 507), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1 + 0o156) + '\062' + '\067' + '\x34', 0o10), ehT0Px3KOsy9(chr(1970 - 1922) + chr(0b1001000 + 0o47) + '\063' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1323 - 1212) + '\062' + '\063', 0b1000), ehT0Px3KOsy9(chr(1787 - 1739) + chr(111) + chr(0b1110 + 0o45) + '\067' + chr(52), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1813 - 1764) + '\065' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\x35' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(4984 - 4873) + '\062' + '\x32' + chr(2462 - 2410), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1123 - 1074), 0b1000), ehT0Px3KOsy9(chr(48) + chr(2787 - 2676) + chr(51) + '\x33' + chr(51), 6249 - 6241), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(0b110001) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b100010 + 0o20) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(961 - 910) + '\x30' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(12300 - 12189) + '\062' + chr(0b100001 + 0o17) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + '\x35' + chr(0b110111), 48542 - 48534), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(0b110001) + chr(0b110101) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(2281 - 2233) + chr(8575 - 8464) + chr(0b1001 + 0o51) + chr(0b1001 + 0o53) + chr(149 - 101), 39061 - 39053), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(4738 - 4627) + '\x33' + chr(0b1111 + 0o50) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8070 - 7959) + '\x32' + chr(49) + '\x33', 0b1000), ehT0Px3KOsy9(chr(312 - 264) + chr(0b1001 + 0o146) + chr(0b10111 + 0o34) + chr(0b110000) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(52) + chr(53), 47410 - 47402), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + chr(2030 - 1978) + '\x37', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(8393 - 8282) + chr(0b110101 + 0o0) + chr(0b101001 + 0o7), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f'), chr(5383 - 5283) + chr(0b1100101) + chr(99) + chr(111) + chr(0b1100100) + chr(9509 - 9408))(chr(117) + '\x74' + '\x66' + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def OtJBWBcsjk9N(OeWW0F1dBPRQ, et6dMbqOJH62, e80gRioCjdat, OolUPRJhRaJd=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100100 + 0o16), 0b1000), kwfuYzkY5C57=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'[\xb7\x96\xf5v\xbb.\xdf\x14<OR\x9a\xa7\xd6\x1e\x14'), chr(0b1100100) + '\145' + chr(7999 - 7900) + '\x6f' + '\144' + '\145')('\165' + chr(0b1110100) + chr(7724 - 7622) + '\x2d' + chr(501 - 445)))(), TiAuVIvKZ1dP=ehT0Px3KOsy9(chr(1711 - 1663) + '\157' + chr(49), 8), Ns_iif56kLIA=0.01, AIvJRzLdDfgF=None): with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W\xb3\x96\xf3d\x86+\xd4";E\\\x86\xab'), chr(0b111000 + 0o54) + '\x65' + chr(0b100 + 0o137) + '\157' + chr(0b111100 + 0o50) + '\145')(chr(0b0 + 0o165) + chr(116) + chr(1806 - 1704) + chr(141 - 96) + chr(0b1101 + 0o53)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'O\xbd\x8d\xe9|\xbb3\xde\r\x17Ml\x91\xaf\xd8\x12\x08\x08'), '\144' + chr(9122 - 9021) + '\143' + '\157' + '\144' + chr(8402 - 8301))(chr(10484 - 10367) + chr(1018 - 902) + chr(0b1011000 + 0o16) + '\x2d' + '\x38')): uNAGRcXaNiGu = OeWW0F1dBPRQ.get_shape().as_list()[-ehT0Px3KOsy9(chr(1857 - 1809) + '\x6f' + chr(49), 8)] Suqgieiq3E7c = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'V\x8d\x83\xfbq\x81'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b1011010 + 0o25) + chr(0b1100100) + chr(0b1100101))(chr(6580 - 6463) + chr(116) + chr(7191 - 7089) + '\x2d' + '\070'), [uNAGRcXaNiGu, et6dMbqOJH62], IDJ2eXGCBCDu.float32, kwfuYzkY5C57) if TiAuVIvKZ1dP: vTNCGxM9orUt = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'V\x8d\x8a\xf5l\x97"'), chr(100) + chr(101) + chr(7686 - 7587) + chr(111) + '\144' + '\145')('\165' + chr(3762 - 3646) + '\x66' + '\055' + '\070'), [uNAGRcXaNiGu, et6dMbqOJH62], IDJ2eXGCBCDu.float32, kwfuYzkY5C57) rF1iWmd1hRLK = IDJ2eXGCBCDu.matmul(OeWW0F1dBPRQ, Suqgieiq3E7c) if TiAuVIvKZ1dP: jWcoLo2Hefxk = IDJ2eXGCBCDu.matmul(OeWW0F1dBPRQ, vTNCGxM9orUt) HqNPvAK_K7F6 = (IDJ2eXGCBCDu.nn.softplus(jWcoLo2Hefxk) + Ns_iif56kLIA) * IDJ2eXGCBCDu.ZUL3kHBGU8Uu(e80gRioCjdat) o19s6QQ2Pz0s = rF1iWmd1hRLK + IDJ2eXGCBCDu.random_normal(IDJ2eXGCBCDu.nauYfLglTpcb(rF1iWmd1hRLK)) * HqNPvAK_K7F6 wF9nmvjsKjYM = o19s6QQ2Pz0s if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'R\xba\x8b\xefi\x80\x18\xd6\x18&CA\x97\xba\xc9$\x15\x1a\xd1sr\x8e\x03\t\xe7'), '\x64' + chr(101) + chr(0b1001111 + 0o24) + '\157' + chr(0b101100 + 0o70) + chr(6946 - 6845))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(45) + '\070'))(): xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'~\x96\xd0\xc0r\xdd%\xc5(\x1cSb'), chr(8168 - 8068) + chr(0b1110 + 0o127) + '\143' + chr(111) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1100110 + 0o16) + '\146' + '\x2d' + chr(0b101010 + 0o16)))(xafqLlk3kkUe(SXOLrMavuUCe(b'O\xbd\x8d\xe9|\xbb+\xde\x1a!R@'), chr(0b1100100) + chr(0b10111 + 0o116) + chr(99) + '\x6f' + '\144' + '\x65')(chr(11267 - 11150) + chr(0b1110100) + chr(0b11010 + 0o114) + '\x2d' + chr(64 - 8)), o19s6QQ2Pz0s) xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'~\x96\xd0\xc0r\xdd%\xc5(\x1cSb'), '\x64' + chr(101) + chr(99) + chr(0b1101111) + chr(2841 - 2741) + chr(0b1100101))(chr(0b1110101) + '\164' + '\x66' + chr(830 - 785) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'O\xbd\x8d\xe9`\xbb4\xc5\x19,CE'), '\x64' + '\145' + '\x63' + chr(111) + '\x64' + chr(9514 - 9413))(chr(0b1110101) + '\x74' + '\x66' + '\x2d' + '\x38'), HqNPvAK_K7F6) else: wF9nmvjsKjYM = rF1iWmd1hRLK (ifcz4qsYc1q6, S67tRIUZz1mK) = gVs6rORe05OO(wF9nmvjsKjYM, Dx22bkKPdt5d(OolUPRJhRaJd + ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11 + 0o56), 8), et6dMbqOJH62)) l20mEUIixIAo = IDJ2eXGCBCDu.slice(ifcz4qsYc1q6, [ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + chr(0b101011 + 0o5), 8)], [-ehT0Px3KOsy9(chr(48) + '\x6f' + '\061', 8), OolUPRJhRaJd]) IXQnYU6qh6Zj = IDJ2eXGCBCDu.slice(S67tRIUZz1mK, [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(48), 8)], [-ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\061', 8), OolUPRJhRaJd]) bNNm2WCETOQk = IDJ2eXGCBCDu.nn.softmax(l20mEUIixIAo) D5FfJKnAV_lN = faKSxxZs1m9B(bNNm2WCETOQk, IXQnYU6qh6Zj, et6dMbqOJH62) if TiAuVIvKZ1dP and OolUPRJhRaJd < et6dMbqOJH62: mxtdQMeiwJZJ = IDJ2eXGCBCDu.reduce_sum(GHc1C6bZffyn(rF1iWmd1hRLK, o19s6QQ2Pz0s, HqNPvAK_K7F6, ifcz4qsYc1q6, OolUPRJhRaJd), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1001 + 0o47), 8)) else: mxtdQMeiwJZJ = agKCuMcFYoTX(D5FfJKnAV_lN) if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'R\xba\x8b\xefi\x80\x18\xd6\x18&CA\x97\xba\xc9$\x15\x1a\xd1sr\x8e\x03\t\xe7'), chr(954 - 854) + '\x65' + chr(2216 - 2117) + chr(0b10 + 0o155) + chr(0b1100100) + chr(101))(chr(0b1101000 + 0o15) + '\x74' + chr(778 - 676) + '\055' + chr(115 - 59)))(): xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'~\x96\xd0\xc0r\xdd%\xc5(\x1cSb'), chr(0b1100100) + chr(101) + '\143' + chr(11833 - 11722) + '\144' + chr(0b111011 + 0o52))(chr(11312 - 11195) + chr(0b1001000 + 0o54) + chr(0b1010101 + 0o21) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'H\xbf\x94\xf5w\x90&\xdf\x1e-'), chr(0b1000 + 0o134) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(5386 - 5286) + chr(0b1100011 + 0o2))('\165' + chr(0b10011 + 0o141) + chr(5814 - 5712) + chr(45) + chr(0b100010 + 0o26)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'S\xb7\x80\xeff\x81\x18\xc2\x08%'), '\144' + '\x65' + '\143' + chr(111) + chr(0b1010010 + 0o22) + '\145')(chr(0b1011101 + 0o30) + '\x74' + '\x66' + chr(0b10110 + 0o27) + '\070'))(D5FfJKnAV_lN, ehT0Px3KOsy9('\x30' + '\157' + '\060', 8))) xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'~\x96\xd0\xc0r\xdd%\xc5(\x1cSb'), chr(100) + chr(5076 - 4975) + chr(99) + '\157' + '\x64' + '\145')(chr(0b1110101) + chr(116) + '\146' + chr(45) + chr(942 - 886)))(xafqLlk3kkUe(SXOLrMavuUCe(b'M\xbd\x85\xfe'), chr(100) + '\145' + chr(99) + chr(0b1101111) + chr(7323 - 7223) + chr(0b1100101))(chr(117) + '\x74' + '\146' + chr(45) + '\070'), mxtdQMeiwJZJ) return (D5FfJKnAV_lN, mxtdQMeiwJZJ)
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
map_ids
def map_ids(x, indices, map_fn): """Apply a function to each coordinate ids of a multidimensional tensor. This allows to process each sequence of a batch independently. This is similar to tf.map_fn but with tensor where the batch dim has been flatten. Warning: The indices ids have to be contiguous and ordered in memory as the output vector for each of the ids are simply concatenated after being processed. Ex: if your indices are [0,2,2,1,2,0], the output will contains the processed rows in the following order: [0,0,1,2,2,2] Args: x (Tensor): The tensor to be dispatched of shape [length,...] indices (Tensor): A int32 tensor of size [length, 1] containing the batch coordinate of x map_fn (fct): Function called for every ids of the original tensor. Take as input a tensor of same rank than x and from shape [length_id,...] with length_id <= length. Isn't called if length_id == 0 Returns: a tensor of same shape as x, where each elements has been processed """ indices = tf.reshape(indices, [-1]) t_i = tf.constant(0) # batch_coordinates start at 0 t_batch_size = tf.reduce_max(indices) + 1 # ta_stack_out will store the intermediate results for each individual id # As alternative to tf.TensorArray, scatter_update could potentially be used # but that would require an additional mutable tensor. ta_stack_out = tf.TensorArray( x.dtype, size=t_batch_size, ) # Then we iterate over each sequence individually and compute the # transformation for each id while_condition = lambda t_i, *args: tf.less(t_i, t_batch_size) def body(t_i, ta_stack_out): """Loop body.""" # Gather the ids current_ids = tf.to_int32(tf.where(tf.equal(indices, t_i))) t_row = tf.gather_nd(x, indices=current_ids) # TODO(epot): Should not call map_fn if t_row size is 0 # Apply transformation to each id # Restore batch_dim=1 as most function expect [batch_dim, length, ...] as # input t_row = tf.expand_dims(t_row, axis=0) t_row = map_fn(t_row) t_row = tf.squeeze(t_row, axis=0) # Squeeze for concatenation ta_stack_out = ta_stack_out.write(t_i, t_row) return [tf.add(t_i, 1), ta_stack_out] # ++i # Run the loop, equivalent to: # stack_out = [] # while i < batch_size: # stack_out.expand(map_fn(x[indices==i])) _, ta_stack_out = tf.while_loop(while_condition, body, [t_i, ta_stack_out]) # Merge all results return ta_stack_out.concat()
python
def map_ids(x, indices, map_fn): """Apply a function to each coordinate ids of a multidimensional tensor. This allows to process each sequence of a batch independently. This is similar to tf.map_fn but with tensor where the batch dim has been flatten. Warning: The indices ids have to be contiguous and ordered in memory as the output vector for each of the ids are simply concatenated after being processed. Ex: if your indices are [0,2,2,1,2,0], the output will contains the processed rows in the following order: [0,0,1,2,2,2] Args: x (Tensor): The tensor to be dispatched of shape [length,...] indices (Tensor): A int32 tensor of size [length, 1] containing the batch coordinate of x map_fn (fct): Function called for every ids of the original tensor. Take as input a tensor of same rank than x and from shape [length_id,...] with length_id <= length. Isn't called if length_id == 0 Returns: a tensor of same shape as x, where each elements has been processed """ indices = tf.reshape(indices, [-1]) t_i = tf.constant(0) # batch_coordinates start at 0 t_batch_size = tf.reduce_max(indices) + 1 # ta_stack_out will store the intermediate results for each individual id # As alternative to tf.TensorArray, scatter_update could potentially be used # but that would require an additional mutable tensor. ta_stack_out = tf.TensorArray( x.dtype, size=t_batch_size, ) # Then we iterate over each sequence individually and compute the # transformation for each id while_condition = lambda t_i, *args: tf.less(t_i, t_batch_size) def body(t_i, ta_stack_out): """Loop body.""" # Gather the ids current_ids = tf.to_int32(tf.where(tf.equal(indices, t_i))) t_row = tf.gather_nd(x, indices=current_ids) # TODO(epot): Should not call map_fn if t_row size is 0 # Apply transformation to each id # Restore batch_dim=1 as most function expect [batch_dim, length, ...] as # input t_row = tf.expand_dims(t_row, axis=0) t_row = map_fn(t_row) t_row = tf.squeeze(t_row, axis=0) # Squeeze for concatenation ta_stack_out = ta_stack_out.write(t_i, t_row) return [tf.add(t_i, 1), ta_stack_out] # ++i # Run the loop, equivalent to: # stack_out = [] # while i < batch_size: # stack_out.expand(map_fn(x[indices==i])) _, ta_stack_out = tf.while_loop(while_condition, body, [t_i, ta_stack_out]) # Merge all results return ta_stack_out.concat()
[ "def", "map_ids", "(", "x", ",", "indices", ",", "map_fn", ")", ":", "indices", "=", "tf", ".", "reshape", "(", "indices", ",", "[", "-", "1", "]", ")", "t_i", "=", "tf", ".", "constant", "(", "0", ")", "# batch_coordinates start at 0", "t_batch_size", "=", "tf", ".", "reduce_max", "(", "indices", ")", "+", "1", "# ta_stack_out will store the intermediate results for each individual id", "# As alternative to tf.TensorArray, scatter_update could potentially be used", "# but that would require an additional mutable tensor.", "ta_stack_out", "=", "tf", ".", "TensorArray", "(", "x", ".", "dtype", ",", "size", "=", "t_batch_size", ",", ")", "# Then we iterate over each sequence individually and compute the", "# transformation for each id", "while_condition", "=", "lambda", "t_i", ",", "*", "args", ":", "tf", ".", "less", "(", "t_i", ",", "t_batch_size", ")", "def", "body", "(", "t_i", ",", "ta_stack_out", ")", ":", "\"\"\"Loop body.\"\"\"", "# Gather the ids", "current_ids", "=", "tf", ".", "to_int32", "(", "tf", ".", "where", "(", "tf", ".", "equal", "(", "indices", ",", "t_i", ")", ")", ")", "t_row", "=", "tf", ".", "gather_nd", "(", "x", ",", "indices", "=", "current_ids", ")", "# TODO(epot): Should not call map_fn if t_row size is 0", "# Apply transformation to each id", "# Restore batch_dim=1 as most function expect [batch_dim, length, ...] as", "# input", "t_row", "=", "tf", ".", "expand_dims", "(", "t_row", ",", "axis", "=", "0", ")", "t_row", "=", "map_fn", "(", "t_row", ")", "t_row", "=", "tf", ".", "squeeze", "(", "t_row", ",", "axis", "=", "0", ")", "# Squeeze for concatenation", "ta_stack_out", "=", "ta_stack_out", ".", "write", "(", "t_i", ",", "t_row", ")", "return", "[", "tf", ".", "add", "(", "t_i", ",", "1", ")", ",", "ta_stack_out", "]", "# ++i", "# Run the loop, equivalent to:", "# stack_out = []", "# while i < batch_size:", "# stack_out.expand(map_fn(x[indices==i]))", "_", ",", "ta_stack_out", "=", "tf", ".", "while_loop", "(", "while_condition", ",", "body", ",", "[", "t_i", ",", "ta_stack_out", "]", ")", "# Merge all results", "return", "ta_stack_out", ".", "concat", "(", ")" ]
Apply a function to each coordinate ids of a multidimensional tensor. This allows to process each sequence of a batch independently. This is similar to tf.map_fn but with tensor where the batch dim has been flatten. Warning: The indices ids have to be contiguous and ordered in memory as the output vector for each of the ids are simply concatenated after being processed. Ex: if your indices are [0,2,2,1,2,0], the output will contains the processed rows in the following order: [0,0,1,2,2,2] Args: x (Tensor): The tensor to be dispatched of shape [length,...] indices (Tensor): A int32 tensor of size [length, 1] containing the batch coordinate of x map_fn (fct): Function called for every ids of the original tensor. Take as input a tensor of same rank than x and from shape [length_id,...] with length_id <= length. Isn't called if length_id == 0 Returns: a tensor of same shape as x, where each elements has been processed
[ "Apply", "a", "function", "to", "each", "coordinate", "ids", "of", "a", "multidimensional", "tensor", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L665-L730
train
Apply a function to each coordinate id of a multidimensional tensor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,e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wwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(50) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(1771 - 1723) + '\x6f' + '\061' + '\x31' + chr(2500 - 2447), 12345 - 12337), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1110 + 0o43) + chr(49) + chr(0b110100), 29923 - 29915), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b100001 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100000 + 0o117) + '\x31' + chr(50) + chr(0b1001 + 0o54), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(330 - 279) + chr(51) + chr(0b11001 + 0o32), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(11188 - 11077) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(342 - 294) + '\x6f' + '\062' + '\065' + chr(53), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(52) + chr(1986 - 1935), 8066 - 8058), ehT0Px3KOsy9(chr(48) + chr(0b1100010 + 0o15) + chr(49) + chr(0b110000) + chr(53), 12497 - 12489), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + '\061' + '\064' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(308 - 258) + chr(0b110100) + '\x37', 0o10), ehT0Px3KOsy9(chr(2005 - 1957) + '\157' + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\061' + chr(0b1110 + 0o42), 51787 - 51779), ehT0Px3KOsy9('\060' + chr(10265 - 10154) + chr(1765 - 1713), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1449 - 1399) + chr(0b1100 + 0o44) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11669 - 11558) + '\061' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(2275 - 2220), 9419 - 9411), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(3118 - 3007) + chr(2439 - 2389) + chr(55), 8), ehT0Px3KOsy9(chr(2006 - 1958) + '\157' + '\x32' + chr(0b110000 + 0o0) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1001 + 0o50) + chr(51) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(2690 - 2579) + chr(604 - 554) + chr(54) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110000 + 0o77) + '\x33' + '\062' + chr(0b1100 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100100 + 0o113) + '\061' + '\x32' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(10590 - 10479) + chr(0b10100 + 0o35) + '\063' + '\061', 0b1000), ehT0Px3KOsy9(chr(1200 - 1152) + chr(0b1000 + 0o147) + chr(0b110101) + chr(805 - 752), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110 + 0o151) + chr(51) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1110 + 0o44) + chr(50) + chr(1711 - 1661), 19829 - 19821), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1010010 + 0o35) + chr(0b0 + 0o63) + '\x32' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1374 - 1326) + '\157' + chr(1271 - 1221) + '\060' + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(262 - 151) + chr(0b10111 + 0o33) + chr(0b110110 + 0o1) + chr(0b11111 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x37' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1000110 + 0o51) + chr(0b100000 + 0o23) + chr(0b110011 + 0o0) + '\063', 8), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(52) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(1350 - 1239) + chr(323 - 268) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101000 + 0o107) + chr(0b10010 + 0o37) + '\066' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + '\062' + chr(736 - 687) + chr(1131 - 1076), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(0b110010) + chr(52) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(4113 - 4002) + chr(316 - 267) + chr(48) + '\x32', 0b1000), ehT0Px3KOsy9(chr(2055 - 2007) + chr(580 - 469) + '\x31' + '\x31', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe'), chr(0b101100 + 0o70) + chr(3690 - 3589) + '\143' + '\x6f' + chr(4266 - 4166) + '\145')(chr(117) + chr(11747 - 11631) + chr(0b1100110) + chr(0b101101) + chr(354 - 298)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def R3NNZFCnD5JE(OeWW0F1dBPRQ, pIcoaXENl5Pw, wyesm0YLHJR_): pIcoaXENl5Pw = IDJ2eXGCBCDu.reshape(pIcoaXENl5Pw, [-ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(49), 8)]) nikj1y7lg1C8 = IDJ2eXGCBCDu.constant(ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1763 - 1715), 59954 - 59946)) O1e7T1LBPUqg = IDJ2eXGCBCDu.reduce_max(pIcoaXENl5Pw) + ehT0Px3KOsy9('\060' + chr(111) + chr(49), 8) X2QePXVW0dOW = IDJ2eXGCBCDu.TensorArray(OeWW0F1dBPRQ.jSV9IKnemH7K, size=O1e7T1LBPUqg) ZHQ5Bz3YbF3h = lambda nikj1y7lg1C8, *kJDRfRhcZHjS: IDJ2eXGCBCDu.less(nikj1y7lg1C8, O1e7T1LBPUqg) def TD8C81EGml3n(nikj1y7lg1C8, X2QePXVW0dOW): iXRajIn9rTXh = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.equal(pIcoaXENl5Pw, nikj1y7lg1C8))) _4CIxisyJ3Mq = IDJ2eXGCBCDu.gather_nd(OeWW0F1dBPRQ, indices=iXRajIn9rTXh) _4CIxisyJ3Mq = IDJ2eXGCBCDu.expand_dims(_4CIxisyJ3Mq, axis=ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\060', 8)) _4CIxisyJ3Mq = wyesm0YLHJR_(_4CIxisyJ3Mq) _4CIxisyJ3Mq = IDJ2eXGCBCDu.squeeze(_4CIxisyJ3Mq, axis=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(124 - 76), 8)) X2QePXVW0dOW = X2QePXVW0dOW.write(nikj1y7lg1C8, _4CIxisyJ3Mq) return [xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb1)('), '\x64' + chr(0b1011111 + 0o6) + chr(0b1100011) + '\x6f' + chr(0b1000101 + 0o37) + chr(785 - 684))('\165' + chr(116) + '\x66' + chr(45) + chr(0b111000)))(nikj1y7lg1C8, ehT0Px3KOsy9('\x30' + chr(111) + chr(2276 - 2227), 8)), X2QePXVW0dOW] (VNGQdHSFPrso, X2QePXVW0dOW) = IDJ2eXGCBCDu.while_loop(ZHQ5Bz3YbF3h, TD8C81EGml3n, [nikj1y7lg1C8, X2QePXVW0dOW]) return xafqLlk3kkUe(X2QePXVW0dOW, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3""p4\xaf'), '\144' + chr(10065 - 9964) + chr(0b11 + 0o140) + chr(111) + chr(6245 - 6145) + '\x65')(chr(8202 - 8085) + chr(12992 - 12876) + '\x66' + '\055' + chr(3021 - 2965)))()
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
ffn_expert_fn
def ffn_expert_fn(input_size, hidden_sizes, output_size, hidden_activation=tf.nn.relu): """Returns a function that creates a feed-forward network. Use this function to create the expert_fn argument to distributed_moe. Args: input_size: an integer hidden_sizes: a list of integers output_size: an integer hidden_activation: a unary function. Returns: a unary function """ def my_fn(x): layer_sizes = [input_size] + hidden_sizes + [output_size] for i in range(1 + len(hidden_sizes)): w = tf.get_variable("w_%d" % i, layer_sizes[i:i+2], tf.float32) x = tf.matmul(x, w) if i < len(hidden_sizes): x = hidden_activation(x) if layer_sizes[i] != input_size: x *= (layer_sizes[i] / float(input_size))**-0.5 return x return my_fn
python
def ffn_expert_fn(input_size, hidden_sizes, output_size, hidden_activation=tf.nn.relu): """Returns a function that creates a feed-forward network. Use this function to create the expert_fn argument to distributed_moe. Args: input_size: an integer hidden_sizes: a list of integers output_size: an integer hidden_activation: a unary function. Returns: a unary function """ def my_fn(x): layer_sizes = [input_size] + hidden_sizes + [output_size] for i in range(1 + len(hidden_sizes)): w = tf.get_variable("w_%d" % i, layer_sizes[i:i+2], tf.float32) x = tf.matmul(x, w) if i < len(hidden_sizes): x = hidden_activation(x) if layer_sizes[i] != input_size: x *= (layer_sizes[i] / float(input_size))**-0.5 return x return my_fn
[ "def", "ffn_expert_fn", "(", "input_size", ",", "hidden_sizes", ",", "output_size", ",", "hidden_activation", "=", "tf", ".", "nn", ".", "relu", ")", ":", "def", "my_fn", "(", "x", ")", ":", "layer_sizes", "=", "[", "input_size", "]", "+", "hidden_sizes", "+", "[", "output_size", "]", "for", "i", "in", "range", "(", "1", "+", "len", "(", "hidden_sizes", ")", ")", ":", "w", "=", "tf", ".", "get_variable", "(", "\"w_%d\"", "%", "i", ",", "layer_sizes", "[", "i", ":", "i", "+", "2", "]", ",", "tf", ".", "float32", ")", "x", "=", "tf", ".", "matmul", "(", "x", ",", "w", ")", "if", "i", "<", "len", "(", "hidden_sizes", ")", ":", "x", "=", "hidden_activation", "(", "x", ")", "if", "layer_sizes", "[", "i", "]", "!=", "input_size", ":", "x", "*=", "(", "layer_sizes", "[", "i", "]", "/", "float", "(", "input_size", ")", ")", "**", "-", "0.5", "return", "x", "return", "my_fn" ]
Returns a function that creates a feed-forward network. Use this function to create the expert_fn argument to distributed_moe. Args: input_size: an integer hidden_sizes: a list of integers output_size: an integer hidden_activation: a unary function. Returns: a unary function
[ "Returns", "a", "function", "that", "creates", "a", "feed", "-", "forward", "network", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L956-L983
train
Returns a function that creates a feed - forward network.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VH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lkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(11648 - 11537) + '\061' + '\065', 21454 - 21446), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(50) + chr(301 - 253), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + '\063' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1460 - 1412) + chr(0b1010010 + 0o35) + chr(0b100110 + 0o15) + chr(0b10100 + 0o41) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(187 - 138) + '\063' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(444 - 396) + '\x6f' + chr(49) + chr(50) + chr(0b11100 + 0o25), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(52) + '\064', 0o10), ehT0Px3KOsy9(chr(965 - 917) + '\x6f' + chr(50) + '\x36' + chr(0b10100 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + '\x33' + chr(0b1011 + 0o51) + chr(359 - 304), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b1110 + 0o46) + chr(1381 - 1329), 57098 - 57090), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\067' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(721 - 610) + '\061' + chr(0b111 + 0o60) + chr(0b101010 + 0o6), 0o10), ehT0Px3KOsy9('\060' + chr(5424 - 5313) + chr(0b110001) + chr(0b1100 + 0o52) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(423 - 373) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111110 + 0o61) + '\x32' + chr(238 - 185) + '\x34', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b110010) + '\067', 11013 - 11005), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b111 + 0o52) + chr(0b110100), 61976 - 61968), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(273 - 220) + chr(0b101 + 0o62), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(9515 - 9404) + '\061' + chr(292 - 243) + chr(1995 - 1941), 0o10), ehT0Px3KOsy9(chr(407 - 359) + '\157' + chr(663 - 613) + chr(1296 - 1245) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1322 - 1271) + chr(49) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x31' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1763 - 1715) + chr(3238 - 3127) + chr(0b100001 + 0o22) + '\063' + chr(1633 - 1578), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(2116 - 2065) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(1203 - 1154) + '\x33', 0b1000), ehT0Px3KOsy9(chr(110 - 62) + chr(0b1101111) + '\x33' + '\x37' + '\x34', 4996 - 4988), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2052 - 2002) + chr(0b1 + 0o64) + chr(0b110101 + 0o1), 0o10), ehT0Px3KOsy9('\060' + chr(10075 - 9964) + chr(0b1010 + 0o55) + chr(0b110001), 19496 - 19488), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\x33' + chr(0b1100 + 0o46), 0b1000), ehT0Px3KOsy9(chr(48) + chr(6816 - 6705) + chr(1883 - 1833) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(55) + chr(49), 17442 - 17434), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(0b1010 + 0o47) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(0b10110 + 0o33) + chr(0b110010) + chr(53), 58284 - 58276), ehT0Px3KOsy9(chr(1329 - 1281) + chr(9636 - 9525) + chr(0b100111 + 0o12) + '\x35' + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101 + 0o152) + chr(0b110001) + chr(265 - 215) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(2222 - 2171) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + '\x32' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + '\x34' + '\064', 57930 - 57922), ehT0Px3KOsy9(chr(254 - 206) + chr(0b1101111) + '\062' + chr(0b110101) + '\x36', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + chr(0b10001 + 0o37), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'#'), chr(100) + chr(0b1110 + 0o127) + chr(0b1010000 + 0o23) + chr(0b1101111) + '\x64' + chr(1651 - 1550))(chr(0b10110 + 0o137) + chr(2460 - 2344) + chr(102) + '\055' + chr(0b101111 + 0o11)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ZlXAxMvXXoya(uNAGRcXaNiGu, YSTy4YpeiHUH, NOWUhJWuP8qU, _CfVX0EE31Vp=xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f57\x9e'), '\144' + chr(999 - 898) + chr(0b1000111 + 0o34) + chr(9572 - 9461) + chr(3293 - 3193) + chr(0b11000 + 0o115))('\x75' + '\x74' + chr(0b101000 + 0o76) + '\055' + chr(0b10011 + 0o45)))): def Vbv2x2o0I6xb(OeWW0F1dBPRQ): kzewOlvk6DmD = [uNAGRcXaNiGu] + YSTy4YpeiHUH + [NOWUhJWuP8qU] for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9('\060' + chr(0b1100110 + 0o11) + chr(1296 - 1247), 37277 - 37269) + c2A0yzQpDQB3(YSTy4YpeiHUH)): AOfzRywRzEXp = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'z\x0f~\x8f'), '\x64' + chr(3184 - 3083) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(101))(chr(0b1011 + 0o152) + chr(9650 - 9534) + chr(0b1100001 + 0o5) + chr(45) + '\x38') % WVxHKyX45z_L, kzewOlvk6DmD[WVxHKyX45z_L:WVxHKyX45z_L + ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(1575 - 1525), 0b1000)], IDJ2eXGCBCDu.float32) OeWW0F1dBPRQ = IDJ2eXGCBCDu.matmul(OeWW0F1dBPRQ, AOfzRywRzEXp) if WVxHKyX45z_L < c2A0yzQpDQB3(YSTy4YpeiHUH): OeWW0F1dBPRQ = _CfVX0EE31Vp(OeWW0F1dBPRQ) if kzewOlvk6DmD[WVxHKyX45z_L] != uNAGRcXaNiGu: OeWW0F1dBPRQ *= (kzewOlvk6DmD[WVxHKyX45z_L] / kkSX4ccExqw4(uNAGRcXaNiGu)) ** (-0.5) return OeWW0F1dBPRQ return Vbv2x2o0I6xb
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
flatten_all_but_last
def flatten_all_but_last(a): """Flatten all dimensions of a except the last.""" ret = tf.reshape(a, [-1, tf.shape(a)[-1]]) if not tf.executing_eagerly(): ret.set_shape([None] + a.get_shape().as_list()[-1:]) return ret
python
def flatten_all_but_last(a): """Flatten all dimensions of a except the last.""" ret = tf.reshape(a, [-1, tf.shape(a)[-1]]) if not tf.executing_eagerly(): ret.set_shape([None] + a.get_shape().as_list()[-1:]) return ret
[ "def", "flatten_all_but_last", "(", "a", ")", ":", "ret", "=", "tf", ".", "reshape", "(", "a", ",", "[", "-", "1", ",", "tf", ".", "shape", "(", "a", ")", "[", "-", "1", "]", "]", ")", "if", "not", "tf", ".", "executing_eagerly", "(", ")", ":", "ret", ".", "set_shape", "(", "[", "None", "]", "+", "a", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", "-", "1", ":", "]", ")", "return", "ret" ]
Flatten all dimensions of a except the last.
[ "Flatten", "all", "dimensions", "of", "a", "except", "the", "last", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L986-L991
train
Flatten all dimensions of a except the last.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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ionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(7367 - 7256) + chr(51) + '\060', 0b1000), ehT0Px3KOsy9(chr(1862 - 1814) + chr(111) + '\x32' + chr(2408 - 2354) + chr(0b101010 + 0o12), 23128 - 23120), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\062' + '\067', 19263 - 19255), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x37', 8), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + chr(0b101100 + 0o5) + chr(49) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1235 - 1187) + chr(750 - 639) + chr(2308 - 2258) + chr(48) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(639 - 587) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1000101 + 0o52) + chr(0b110011) + '\x37' + chr(0b100001 + 0o24), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b10100 + 0o133) + chr(1955 - 1904) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + '\062' + chr(51) + chr(49), 58564 - 58556), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(229 - 178) + '\064' + chr(0b1101 + 0o46), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b1011 + 0o47) + chr(1841 - 1792), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(54) + chr(1369 - 1315), 46406 - 46398), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x37' + chr(2661 - 2608), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1000010 + 0o55) + '\x31' + chr(0b100010 + 0o16) + '\x31', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1995 - 1944) + chr(1022 - 974), 57958 - 57950), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(436 - 383) + chr(0b110000), 62554 - 62546), ehT0Px3KOsy9(chr(2041 - 1993) + '\157' + '\x33' + chr(0b100111 + 0o13) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + '\x31', 172 - 164), ehT0Px3KOsy9(chr(436 - 388) + '\x6f' + chr(0b10011 + 0o36) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + '\x34' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(51) + chr(496 - 443), ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(8232 - 8121) + '\061' + '\x32' + chr(0b110110), 2026 - 2018), ehT0Px3KOsy9(chr(1307 - 1259) + chr(111) + '\061' + chr(0b110110) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b10 + 0o57) + chr(271 - 217), 2567 - 2559), ehT0Px3KOsy9(chr(0b110000) + chr(0b1 + 0o156) + chr(0b110001) + chr(0b101110 + 0o10) + chr(146 - 95), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(1052 - 941) + chr(0b110011) + chr(0b101010 + 0o11) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(49) + '\x33' + '\x30', 22698 - 22690), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b110010) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(648 - 600) + chr(0b1001 + 0o146) + chr(1796 - 1746) + chr(1201 - 1152) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(50) + '\062', 0b1000), ehT0Px3KOsy9(chr(2046 - 1998) + chr(111) + chr(0b110001) + '\066' + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + '\063' + '\065' + chr(1271 - 1218), 7760 - 7752), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + chr(0b1 + 0o60) + '\063', 0b1000), ehT0Px3KOsy9(chr(814 - 766) + chr(111) + chr(0b110001) + '\x35' + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b110101) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1000000 + 0o57) + chr(0b110010) + '\x36' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1487 - 1439) + chr(5925 - 5814) + chr(0b110010) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11001 + 0o33) + chr(53), 36893 - 36885), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100001 + 0o21) + chr(1947 - 1894) + chr(0b10111 + 0o37), 45631 - 45623)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(800 - 752) + chr(0b1001111 + 0o40) + chr(0b110101) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'6'), '\144' + chr(0b1100 + 0o131) + '\143' + chr(111) + '\144' + chr(8016 - 7915))(chr(117) + '\x74' + chr(0b1001100 + 0o32) + chr(45) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def jZVFEeTleDaK(XPh1qbAgrPgG): VHn4CV4Ymrei = IDJ2eXGCBCDu.reshape(XPh1qbAgrPgG, [-ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + '\x31', ord("\x08")), IDJ2eXGCBCDu.nauYfLglTpcb(XPh1qbAgrPgG)[-ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + chr(0b100010 + 0o17), 8)]]) if not xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}\xccrt=\xf5\x8a\x93}\xc6\x86\xf0\x11\xd83\xf4\xd1'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(7795 - 7695) + chr(101))(chr(2650 - 2533) + chr(0b1110100) + '\146' + chr(0b100100 + 0o11) + chr(0b11010 + 0o36)))(): xafqLlk3kkUe(VHn4CV4Ymrei, xafqLlk3kkUe(SXOLrMavuUCe(b'k\xd1cH;\xe9\x82\x8d\x7f'), '\144' + chr(0b1100101) + chr(461 - 362) + chr(0b1100001 + 0o16) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b110111 + 0o57) + chr(0b1101 + 0o40) + chr(0b1 + 0o67)))([None] + xafqLlk3kkUe(XPh1qbAgrPgG.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'y\xc7H{!\xf2\x97'), chr(100) + chr(0b1100101) + '\143' + chr(0b1011011 + 0o24) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(9271 - 9155) + chr(3212 - 3110) + chr(440 - 395) + chr(0b1100 + 0o54)))()[-ehT0Px3KOsy9(chr(0b110000) + chr(0b1000011 + 0o54) + '\061', 8):]) return VHn4CV4Ymrei
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
local_moe
def local_moe(x, train, expert_fn, num_experts, k=1, loss_coef=1e-2, hparams=None, pass_x=True, pass_gates=False, additional_dispatch_params=None, name=None): """Call a local mixture of experts. Args: x: a tensors with shape [... , input_size] train: a boolean scalar. expert_fn: a function. num_experts: an integer - number of experts k: an integer - how many experts to use for each batch element loss_coef: a scalar - multiplier on load-balancing losses hparams: optional hparams for vq gating pass_x: a boolean. If true, x will also be dispatched to the experts. pass_gates: a boolean. If true, gates will be passed to experts. Might be necessary when dealing with sparse encoder-encoder decoder attention additional_dispatch_params: The extra tensors that need to be sent to each expert. Examples include batch batch coordinates (see common_attention.local_expert_attention) name: a string Returns: y: a tensor. Has the same shape as x, except for the last dimension, which is output_size. extra_training_loss: a scalar. This should be added into the overall training loss of the model. The backpropagation of this loss encourages all experts to be approximately equally used across a batch. """ bneck = DiscreteBottleneck(hparams) with tf.variable_scope(name, default_name="local_moe"): centroids = None x_flat = flatten_all_but_last(x) if hparams.gating_type == "topk": tf.logging.info("Using noisy top_k with k = {}".format(k)) # The gates indicate which batch elements go to which tensors. # load is a measure of approximately how many examples go to each expert gates, load = noisy_top_k_gating( x_flat, num_experts, train, k, initializer=tf.zeros_initializer(), noisy_gating=True, noise_epsilon=1e-2) importance = tf.reduce_sum(gates, 0) loss = loss_coef * (cv_squared(importance) + cv_squared(load)) else: assert hparams.gating_type == "vq" tf.logging.info("Using VQ gating") gates, loss, centroids = vq_gating( x_flat, num_experts, k, bneck, hparams=hparams) loss *= loss_coef # Shuffle data between datashards and experts. dispatcher = SparseDispatcher(num_experts, gates) # Set up expert_fn arguments expert_kwargs = {} if pass_x: expert_kwargs["x"] = dispatcher.dispatch(x_flat) if pass_gates: expert_kwargs["gates"] = dispatcher.expert_to_gates() for key, val in six.iteritems(additional_dispatch_params or {}): val = flatten_all_but_last(val) expert_kwargs[key] = dispatcher.dispatch(val) ep = Parallelism([DEFAULT_DEV_STRING] * num_experts, reuse=None) expert_outputs = ep(expert_fn, **expert_kwargs) y_flat = dispatcher.combine(expert_outputs) if centroids is not None: centroids = tf.squeeze(centroids, axis=[1, 2]) y_flat += centroids y = common_layers.reshape_like(y_flat, x) return y, loss
python
def local_moe(x, train, expert_fn, num_experts, k=1, loss_coef=1e-2, hparams=None, pass_x=True, pass_gates=False, additional_dispatch_params=None, name=None): """Call a local mixture of experts. Args: x: a tensors with shape [... , input_size] train: a boolean scalar. expert_fn: a function. num_experts: an integer - number of experts k: an integer - how many experts to use for each batch element loss_coef: a scalar - multiplier on load-balancing losses hparams: optional hparams for vq gating pass_x: a boolean. If true, x will also be dispatched to the experts. pass_gates: a boolean. If true, gates will be passed to experts. Might be necessary when dealing with sparse encoder-encoder decoder attention additional_dispatch_params: The extra tensors that need to be sent to each expert. Examples include batch batch coordinates (see common_attention.local_expert_attention) name: a string Returns: y: a tensor. Has the same shape as x, except for the last dimension, which is output_size. extra_training_loss: a scalar. This should be added into the overall training loss of the model. The backpropagation of this loss encourages all experts to be approximately equally used across a batch. """ bneck = DiscreteBottleneck(hparams) with tf.variable_scope(name, default_name="local_moe"): centroids = None x_flat = flatten_all_but_last(x) if hparams.gating_type == "topk": tf.logging.info("Using noisy top_k with k = {}".format(k)) # The gates indicate which batch elements go to which tensors. # load is a measure of approximately how many examples go to each expert gates, load = noisy_top_k_gating( x_flat, num_experts, train, k, initializer=tf.zeros_initializer(), noisy_gating=True, noise_epsilon=1e-2) importance = tf.reduce_sum(gates, 0) loss = loss_coef * (cv_squared(importance) + cv_squared(load)) else: assert hparams.gating_type == "vq" tf.logging.info("Using VQ gating") gates, loss, centroids = vq_gating( x_flat, num_experts, k, bneck, hparams=hparams) loss *= loss_coef # Shuffle data between datashards and experts. dispatcher = SparseDispatcher(num_experts, gates) # Set up expert_fn arguments expert_kwargs = {} if pass_x: expert_kwargs["x"] = dispatcher.dispatch(x_flat) if pass_gates: expert_kwargs["gates"] = dispatcher.expert_to_gates() for key, val in six.iteritems(additional_dispatch_params or {}): val = flatten_all_but_last(val) expert_kwargs[key] = dispatcher.dispatch(val) ep = Parallelism([DEFAULT_DEV_STRING] * num_experts, reuse=None) expert_outputs = ep(expert_fn, **expert_kwargs) y_flat = dispatcher.combine(expert_outputs) if centroids is not None: centroids = tf.squeeze(centroids, axis=[1, 2]) y_flat += centroids y = common_layers.reshape_like(y_flat, x) return y, loss
[ "def", "local_moe", "(", "x", ",", "train", ",", "expert_fn", ",", "num_experts", ",", "k", "=", "1", ",", "loss_coef", "=", "1e-2", ",", "hparams", "=", "None", ",", "pass_x", "=", "True", ",", "pass_gates", "=", "False", ",", "additional_dispatch_params", "=", "None", ",", "name", "=", "None", ")", ":", "bneck", "=", "DiscreteBottleneck", "(", "hparams", ")", "with", "tf", ".", "variable_scope", "(", "name", ",", "default_name", "=", "\"local_moe\"", ")", ":", "centroids", "=", "None", "x_flat", "=", "flatten_all_but_last", "(", "x", ")", "if", "hparams", ".", "gating_type", "==", "\"topk\"", ":", "tf", ".", "logging", ".", "info", "(", "\"Using noisy top_k with k = {}\"", ".", "format", "(", "k", ")", ")", "# The gates indicate which batch elements go to which tensors.", "# load is a measure of approximately how many examples go to each expert", "gates", ",", "load", "=", "noisy_top_k_gating", "(", "x_flat", ",", "num_experts", ",", "train", ",", "k", ",", "initializer", "=", "tf", ".", "zeros_initializer", "(", ")", ",", "noisy_gating", "=", "True", ",", "noise_epsilon", "=", "1e-2", ")", "importance", "=", "tf", ".", "reduce_sum", "(", "gates", ",", "0", ")", "loss", "=", "loss_coef", "*", "(", "cv_squared", "(", "importance", ")", "+", "cv_squared", "(", "load", ")", ")", "else", ":", "assert", "hparams", ".", "gating_type", "==", "\"vq\"", "tf", ".", "logging", ".", "info", "(", "\"Using VQ gating\"", ")", "gates", ",", "loss", ",", "centroids", "=", "vq_gating", "(", "x_flat", ",", "num_experts", ",", "k", ",", "bneck", ",", "hparams", "=", "hparams", ")", "loss", "*=", "loss_coef", "# Shuffle data between datashards and experts.", "dispatcher", "=", "SparseDispatcher", "(", "num_experts", ",", "gates", ")", "# Set up expert_fn arguments", "expert_kwargs", "=", "{", "}", "if", "pass_x", ":", "expert_kwargs", "[", "\"x\"", "]", "=", "dispatcher", ".", "dispatch", "(", "x_flat", ")", "if", "pass_gates", ":", "expert_kwargs", "[", "\"gates\"", "]", "=", "dispatcher", ".", "expert_to_gates", "(", ")", "for", "key", ",", "val", "in", "six", ".", "iteritems", "(", "additional_dispatch_params", "or", "{", "}", ")", ":", "val", "=", "flatten_all_but_last", "(", "val", ")", "expert_kwargs", "[", "key", "]", "=", "dispatcher", ".", "dispatch", "(", "val", ")", "ep", "=", "Parallelism", "(", "[", "DEFAULT_DEV_STRING", "]", "*", "num_experts", ",", "reuse", "=", "None", ")", "expert_outputs", "=", "ep", "(", "expert_fn", ",", "*", "*", "expert_kwargs", ")", "y_flat", "=", "dispatcher", ".", "combine", "(", "expert_outputs", ")", "if", "centroids", "is", "not", "None", ":", "centroids", "=", "tf", ".", "squeeze", "(", "centroids", ",", "axis", "=", "[", "1", ",", "2", "]", ")", "y_flat", "+=", "centroids", "y", "=", "common_layers", ".", "reshape_like", "(", "y_flat", ",", "x", ")", "return", "y", ",", "loss" ]
Call a local mixture of experts. Args: x: a tensors with shape [... , input_size] train: a boolean scalar. expert_fn: a function. num_experts: an integer - number of experts k: an integer - how many experts to use for each batch element loss_coef: a scalar - multiplier on load-balancing losses hparams: optional hparams for vq gating pass_x: a boolean. If true, x will also be dispatched to the experts. pass_gates: a boolean. If true, gates will be passed to experts. Might be necessary when dealing with sparse encoder-encoder decoder attention additional_dispatch_params: The extra tensors that need to be sent to each expert. Examples include batch batch coordinates (see common_attention.local_expert_attention) name: a string Returns: y: a tensor. Has the same shape as x, except for the last dimension, which is output_size. extra_training_loss: a scalar. This should be added into the overall training loss of the model. The backpropagation of this loss encourages all experts to be approximately equally used across a batch.
[ "Call", "a", "local", "mixture", "of", "experts", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L994-L1074
train
Local mixture of experts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,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D,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(9850 - 9739) + chr(1647 - 1597) + chr(1209 - 1161) + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(6346 - 6235) + chr(0b110010) + chr(0b110101) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(653 - 605) + chr(0b10 + 0o155) + '\063' + chr(2601 - 2549) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101110 + 0o1) + chr(0b110100) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100101 + 0o112) + '\063' + chr(1958 - 1903), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100101 + 0o16) + chr(1760 - 1709) + '\x37', 63039 - 63031), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(0b110001) + chr(2481 - 2431), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(11656 - 11545) + chr(290 - 239) + chr(0b110010) + chr(0b110001), 11800 - 11792), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(459 - 406), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\065' + '\067', 0b1000), ehT0Px3KOsy9(chr(1062 - 1014) + chr(111) + '\062' + chr(1084 - 1034) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1101 + 0o45) + chr(200 - 152) + '\x36', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + '\067', 48599 - 48591), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111 + 0o0) + chr(795 - 746) + chr(1566 - 1517) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110001) + chr(49), 581 - 573), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + chr(1747 - 1697) + '\060', 33298 - 33290), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(2989 - 2934) + chr(0b110011), 11438 - 11430), ehT0Px3KOsy9(chr(2003 - 1955) + chr(0b1100011 + 0o14) + chr(0b110001) + chr(0b110 + 0o60) + '\x31', 0b1000), ehT0Px3KOsy9(chr(994 - 946) + '\x6f' + chr(0b110111) + chr(0b110010 + 0o0), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4025 - 3914) + '\061' + chr(0b110110) + chr(1274 - 1226), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2069 - 1958) + '\x31' + chr(842 - 792) + chr(2237 - 2183), 0b1000), ehT0Px3KOsy9(chr(359 - 311) + '\157' + chr(0b1001 + 0o52) + chr(0b110111), 8), ehT0Px3KOsy9(chr(48) + chr(11725 - 11614) + '\x32' + chr(2555 - 2504) + '\060', 55076 - 55068), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1250 - 1201) + '\061' + chr(1943 - 1890), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(49) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(7992 - 7881) + chr(657 - 608) + chr(50) + chr(0b110011), 50486 - 50478), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2229 - 2179) + '\x33' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1000000 + 0o57) + chr(49) + chr(48) + chr(48), 333 - 325), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + '\x31' + chr(54) + chr(50), 31972 - 31964), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x31' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110100) + '\067', 8), ehT0Px3KOsy9(chr(177 - 129) + '\x6f' + '\062' + chr(469 - 416) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x32' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + '\062' + chr(2423 - 2372) + chr(1780 - 1729), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(1230 - 1119) + '\x32' + chr(1083 - 1029) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101110 + 0o1) + '\066' + chr(0b11000 + 0o36), 18555 - 18547), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b110011) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(49) + chr(0b101111 + 0o4) + chr(0b101 + 0o54), 36552 - 36544), ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + chr(2361 - 2311) + chr(0b11111 + 0o23) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(48) + chr(1559 - 1511), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8'), chr(100) + '\145' + chr(99) + chr(111) + '\x64' + '\x65')('\x75' + chr(0b1110100) + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def WhDDGA3w3Ka3(OeWW0F1dBPRQ, e80gRioCjdat, jezniusvtdPL, et6dMbqOJH62, OolUPRJhRaJd=ehT0Px3KOsy9('\060' + chr(111) + chr(0b1001 + 0o50), 0b1000), sumjy1Ds0MCA=0.01, n4ljua2gi1Pr=None, woHtAwluBpIj=ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1000100 + 0o53) + chr(0b11110 + 0o23), 8), rYgdp1_k0adI=ehT0Px3KOsy9(chr(48) + chr(8253 - 8142) + chr(0b101101 + 0o3), ord("\x08")), sp92WoWYUlcR=None, AIvJRzLdDfgF=None): IiRlvGfCpKjV = ulaV9JlQcgpk(n4ljua2gi1Pr) with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xc9\x93J~\xbd&\xb4Z\x1c\xf3\xe9W,'), chr(0b11 + 0o141) + chr(0b110101 + 0o60) + chr(0b1100011) + chr(111) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + '\x66' + chr(0b11111 + 0o16) + chr(912 - 856)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xea\xc7\x82Bs\x80'\xbe`"), chr(0b1100100) + '\x65' + chr(0b100101 + 0o76) + chr(0b1101111) + chr(100) + '\145')(chr(117) + chr(6988 - 6872) + chr(0b1001111 + 0o27) + '\x2d' + chr(0b101100 + 0o14))): pQVlMI45ZwAY = None mstS6zVd22Jf = jZVFEeTleDaK(OeWW0F1dBPRQ) if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xc1\x8dE^\xa9\x0c\x9a_\x02\xe0\xc1'), chr(0b1100100) + chr(6831 - 6730) + chr(4962 - 4863) + chr(0b1101111) + '\144' + chr(101))(chr(0b111111 + 0o66) + chr(116) + chr(102) + '\055' + '\070')) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\xc7\x91H'), chr(7282 - 7182) + chr(0b1000 + 0o135) + chr(0b100100 + 0o77) + chr(0b111101 + 0o62) + chr(0b1100100) + chr(5717 - 5616))(chr(2909 - 2792) + chr(0b1110100) + '\x66' + chr(1083 - 1038) + chr(56)): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\x9f\xa9[j\xbc-\xe6o\x03\xca\xed'), chr(8947 - 8847) + chr(0b1100101) + chr(0b110001 + 0o62) + chr(111) + chr(100) + chr(101))(chr(0b1010010 + 0o43) + '\164' + '\146' + chr(0b101101) + '\070'))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3\xdb\x88Mx\xff$\xbel\x1c\xe9\xa6S&\xf9O\x90QM\x19"w\xb8&+n\xba;\x0f'), '\144' + chr(2149 - 2048) + '\143' + chr(111) + '\144' + chr(101))(chr(12750 - 12633) + chr(0b101011 + 0o111) + chr(0b1100110) + chr(0b101101) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\x9c\x93LW\xbe\x19\xe2U\x1f\xf5\xec'), chr(0b1000000 + 0o44) + '\x65' + '\x63' + chr(111) + chr(0b1010001 + 0o23) + chr(5513 - 5412))(chr(9742 - 9625) + '\164' + '\x66' + chr(0b101101) + '\x38'))(OolUPRJhRaJd)) (D5FfJKnAV_lN, mxtdQMeiwJZJ) = OtJBWBcsjk9N(mstS6zVd22Jf, et6dMbqOJH62, e80gRioCjdat, OolUPRJhRaJd, initializer=IDJ2eXGCBCDu.zeros_initializer(), noisy_gating=ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b110001), 8), noise_epsilon=0.01) dFLRzkDkORpe = IDJ2eXGCBCDu.reduce_sum(D5FfJKnAV_lN, ehT0Px3KOsy9(chr(48) + chr(111) + '\x30', 8)) YpO0BcZ6fMsf = sumjy1Ds0MCA * (wrwwPr_mZ8_E(dFLRzkDkORpe) + wrwwPr_mZ8_E(mxtdQMeiwJZJ)) else: assert xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xc1\x8dE^\xa9\x0c\x9a_\x02\xe0\xc1'), chr(0b11111 + 0o105) + chr(0b100101 + 0o100) + chr(2212 - 2113) + chr(0b1101111) + '\x64' + '\x65')('\165' + '\164' + '\x66' + chr(510 - 465) + '\070')) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xd9'), chr(1373 - 1273) + chr(101) + chr(0b1011101 + 0o6) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b0 + 0o146) + chr(45) + chr(2486 - 2430)) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\x9f\xa9[j\xbc-\xe6o\x03\xca\xed'), '\144' + chr(0b111000 + 0o55) + '\x63' + chr(0b1101111) + '\x64' + '\x65')(chr(0b1110101) + chr(0b111010 + 0o72) + '\x66' + chr(0b100110 + 0o7) + chr(2585 - 2529)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xd3\xdb\x88Mx\xff\x1c\x80%\x08\xf1\xf2N'\xee"), chr(100) + chr(7948 - 7847) + '\143' + '\157' + '\x64' + chr(8579 - 8478))('\x75' + '\x74' + '\x66' + '\x2d' + '\x38')) (D5FfJKnAV_lN, YpO0BcZ6fMsf, pQVlMI45ZwAY) = Z9Ys4PO9zQ93(mstS6zVd22Jf, et6dMbqOJH62, OolUPRJhRaJd, IiRlvGfCpKjV, hparams=n4ljua2gi1Pr) YpO0BcZ6fMsf *= sumjy1Ds0MCA wF7ILDoyApOb = h50pZ4FghoZ6(et6dMbqOJH62, D5FfJKnAV_lN) ePntc6aO2UEj = {} if woHtAwluBpIj: ePntc6aO2UEj[xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe'), chr(0b1100100) + '\145' + '\143' + chr(0b1011010 + 0o25) + '\x64' + chr(0b101001 + 0o74))('\x75' + chr(0b1010100 + 0o40) + chr(0b1100010 + 0o4) + chr(45) + chr(56))] = wF7ILDoyApOb.dispatch(mstS6zVd22Jf) if rYgdp1_k0adI: ePntc6aO2UEj[xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xc9\x95Fl'), chr(5626 - 5526) + chr(5016 - 4915) + chr(9281 - 9182) + chr(111) + chr(100) + chr(101))('\165' + '\x74' + chr(7378 - 7276) + chr(1931 - 1886) + '\x38')] = wF7ILDoyApOb.expert_to_gates() for (K3J4ZwSlE0sT, pQxH2D_k9sXQ) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\xef\xdc\x84Qv\xab/\xbcv'), chr(5087 - 4987) + chr(101) + '\x63' + chr(0b1101111) + chr(1951 - 1851) + chr(0b1100101))('\165' + '\x74' + chr(102) + chr(862 - 817) + '\x38'))(sp92WoWYUlcR or {}): pQxH2D_k9sXQ = jZVFEeTleDaK(pQxH2D_k9sXQ) ePntc6aO2UEj[K3J4ZwSlE0sT] = wF7ILDoyApOb.dispatch(pQxH2D_k9sXQ) IWodQpYR_65j = rYH0bbeoAhO2([bzxHtP8RoyH6] * et6dMbqOJH62, reuse=None) EHS3KTs26T_P = IWodQpYR_65j(jezniusvtdPL, **ePntc6aO2UEj) CzkIN06jX5hg = wF7ILDoyApOb.Gz4N6zeeyqgm(EHS3KTs26T_P) if pQVlMI45ZwAY is not None: pQVlMI45ZwAY = IDJ2eXGCBCDu.squeeze(pQVlMI45ZwAY, axis=[ehT0Px3KOsy9('\060' + chr(111) + chr(49), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b111 + 0o53), ord("\x08"))]) CzkIN06jX5hg += pQVlMI45ZwAY SqiSOtYOqOJH = jSKPaHwSAfVv.reshape_like(CzkIN06jX5hg, OeWW0F1dBPRQ) return (SqiSOtYOqOJH, YpO0BcZ6fMsf)
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
local_moe_tpu
def local_moe_tpu(inputs, hidden_size, output_size, num_experts, loss_coef=1e-3, overhead=1.0): """Local mixture of experts that works well on TPU. See https://arxiv.org/abs/1701.06538 There are num_experts expert networks, each containing a relu-activated hidden layer of size hidden_size, followed by an output projection. The number of parameters is thus: num_experts * (input_size * hidden_size + hidden_size * output_size) The input is 3d: [batch, length, depth], consisting of the representations of all positions in a batch of sequences. Each position of each sequence is sent to 0-2 experts. The expert choices and the combination weights are determined by a learned gating function. This function returns a small auxiliary loss that should be added to the training loss of the model. This loss helps to balance expert usage. Without the loss, it is very likely that a few experts will be trained and the rest will starve. Several hacks are necessary to get around current TPU limitations: - To ensure static shapes, we enforce (by truncation/padding) that each sequence send the same number of elements to each expert. It would make more sense to enforce this equality over the entire batch, as opposed to on individual sequences. This would allow more freedom for individual sequences to be unbalanced. Unfortunately, that would slow down our hacked-up gather-by-matmul implementation. TODO(noam): There is no real reason for a single sequence to be the unit of equal allocation. Reshaping the inputs would allow us to pick a different unit of equal allocation. TODO(noam): Factor this code better. We want to be able to substitute different code for the experts themselves. We also want to integrate this gating/dispatching logic into multi-device mixtures-of-experts. Args: inputs: a Tensor with shape [batch, length, depth] hidden_size: an integer output_size: an integer num_experts: an integer loss_coef: a float scalar overhead: multiplicative factor of how much spare capacity to assign Returns: outputs: a Tensor with shape [batch, length, output_size] loss: a scalar """ batch, length, input_size = common_layers.shape_list(inputs)[:] # Each sequence sends expert_capacity positions to each expert. if isinstance(length, int): expert_capacity = min( length, int((length * 2 * overhead) / num_experts)) else: expert_capacity = tf.minimum( length, tf.to_int32( tf.to_float(length) * 2 * overhead / num_experts)) expert_capacity_f = tf.to_float(expert_capacity) # This is the learned gating function. gates = tf.nn.softmax( tf.to_float(common_layers.dense(inputs, num_experts, name="logits"))) # Find the top expert for each position. gate_1, index_1 = common_layers.top_1_tpu(gates) # [batch, length, num_experts] mask_1 = tf.one_hot(index_1, num_experts) # [batch, length, num_experts] # This is the position within the expert's mini-batch for this sequence position_in_expert_1 = common_layers.cumsum( mask_1, axis=1, exclusive=True) * mask_1 # Remove the elements that don't fit. mask_1 *= tf.to_float(tf.less(position_in_expert_1, expert_capacity_f)) # [batch, 1, num_experts] # How many examples in this sequence go to this expert mask_1_count = tf.reduce_sum(mask_1, axis=1, keepdims=True) # [batch, length] - mostly ones, but zeros where something didn't fit mask_1_flat = tf.reduce_sum(mask_1, axis=2) position_in_expert_1 = tf.reduce_sum(position_in_expert_1, axis=2) # Weight assigned to first expert. gate_1 *= mask_1_flat # Pick a second-place expert for each position. # We first mask out the experts that we expect to be over-capacity space_remaining = expert_capacity_f - mask_1_count use_rate = (mask_1_count + 1.0) / tf.to_float(length) # At what point in the sequence do we expect the expert to be full. expected_exhaustion_pos = space_remaining / use_rate # A Tensor with shape [batch, length, num_experts] representing a boolean # - whether we expect that the expert will already be full. expected_exhausted = tf.to_float(tf.greater( tf.reshape(tf.to_float(tf.range(length)), [1, length, 1]), expected_exhaustion_pos)) masked_gates = gates - mask_1 - expected_exhausted # This section is similar to the section above. gate_2, index_2 = common_layers.top_1_tpu(masked_gates) # [batch, length, num_experts] mask_2 = tf.one_hot(index_2, num_experts) position_in_expert_2 = ( common_layers.cumsum(mask_2, axis=1, exclusive=True) + mask_1_count) position_in_expert_2 *= mask_2 mask_2 *= tf.to_float(tf.less(position_in_expert_2, expert_capacity_f)) mask_2_count = tf.reduce_sum(mask_2, axis=1, keepdims=True) mask_2_flat = tf.reduce_sum(mask_2, axis=2) position_in_expert_2 = tf.reduce_sum(position_in_expert_2, axis=2) gate_2 *= mask_2_flat # What fraction didn't fit - show summaries miss_rate_1 = 1.0 - tf.reduce_sum(mask_1_count) / tf.to_float(batch * length) miss_rate_2 = 1.0 - tf.reduce_sum(mask_2_count) / tf.to_float(batch * length) tf.summary.scalar("miss_rate_1", miss_rate_1) tf.summary.scalar("miss_rate_2", miss_rate_2) # renormalize the two gate values to add up to 1 denom = gate_1 + gate_2 + 1e-9 gate_1 /= denom gate_2 /= denom # inputs: [batch, length, input_size] # forward_assignment: [batch, length, num_experts * expert_capacity] # expert_inputs: [batch, num_experts * expert_capacity, input_size] segment_ids_forward_1 = ( (index_1 * expert_capacity) + tf.to_int32(position_in_expert_1) + tf.to_int32(1.0 - mask_1_flat) * (num_experts * expert_capacity)) segment_ids_forward_2 = ( (index_2 * expert_capacity) + tf.to_int32(position_in_expert_2) + tf.to_int32(1.0 - mask_2_flat) * (num_experts * expert_capacity)) # Gather and scatter are painfully slow on TPU. # We will use one_hot and matmul instead. # [batch, length, num_experts * expert_capacity] one_hot_1 = tf.one_hot( segment_ids_forward_1, num_experts * expert_capacity, dtype=inputs.dtype) one_hot_2 = tf.one_hot( segment_ids_forward_2, num_experts * expert_capacity, dtype=inputs.dtype) forward_assignment = (one_hot_1 + one_hot_2) # [batch, num_experts * expert_capacity, input_size] expert_inputs = tf.matmul(forward_assignment, inputs, transpose_a=True) # [batch, num_experts, expert_capacity, input_size] expert_inputs = tf.reshape( expert_inputs, [batch, num_experts, expert_capacity, input_size]) # [num_experts, batch, expert_capacity, input_size] expert_inputs = tf.transpose(expert_inputs, [1, 0, 2, 3]) # [num_experts, batch * expert_capacity, input_size] expert_inputs = tf.reshape( expert_inputs, [num_experts, batch * expert_capacity, input_size]) # Now feed the expert inputs through the experts. h = common_layers.batch_dense( expert_inputs, hidden_size, activation=tf.nn.relu, name="x0") expert_output = common_layers.batch_dense(h, output_size, name="x1") expert_output = tf.reshape( expert_output, [num_experts, batch, expert_capacity, output_size]) # [batch, num_experts, expert_capacity, output_size] expert_output = tf.transpose(expert_output, [1, 0, 2, 3]) expert_output = tf.reshape( expert_output, [batch, num_experts * expert_capacity, output_size]) # Again, use matmul instead of unsorted_segment_sum. This time, we need # to multiply by the combination weights gate_1 and gate_2. # expert_output: [batch, num_experts * expert_capacity, output_size] # backward_assigmnent: [batch, length, num_experts * expert_capacity] # output: [batch, length, output_size] backward_assigmnent = ( one_hot_1 * tf.cast(tf.expand_dims(gate_1, 2), inputs.dtype) + one_hot_2 * tf.cast(tf.expand_dims(gate_2, 2), inputs.dtype)) output = tf.matmul(backward_assigmnent, expert_output) # Compute a loss equal to the coefficient ov variation of the # total gate value per expert per sequence. # This loss causes the experts to be used about equally used per sequence. importance = tf.reduce_sum(gates * (mask_1 + mask_2), 1) loss = loss_coef * cv_squared(importance) return output, loss
python
def local_moe_tpu(inputs, hidden_size, output_size, num_experts, loss_coef=1e-3, overhead=1.0): """Local mixture of experts that works well on TPU. See https://arxiv.org/abs/1701.06538 There are num_experts expert networks, each containing a relu-activated hidden layer of size hidden_size, followed by an output projection. The number of parameters is thus: num_experts * (input_size * hidden_size + hidden_size * output_size) The input is 3d: [batch, length, depth], consisting of the representations of all positions in a batch of sequences. Each position of each sequence is sent to 0-2 experts. The expert choices and the combination weights are determined by a learned gating function. This function returns a small auxiliary loss that should be added to the training loss of the model. This loss helps to balance expert usage. Without the loss, it is very likely that a few experts will be trained and the rest will starve. Several hacks are necessary to get around current TPU limitations: - To ensure static shapes, we enforce (by truncation/padding) that each sequence send the same number of elements to each expert. It would make more sense to enforce this equality over the entire batch, as opposed to on individual sequences. This would allow more freedom for individual sequences to be unbalanced. Unfortunately, that would slow down our hacked-up gather-by-matmul implementation. TODO(noam): There is no real reason for a single sequence to be the unit of equal allocation. Reshaping the inputs would allow us to pick a different unit of equal allocation. TODO(noam): Factor this code better. We want to be able to substitute different code for the experts themselves. We also want to integrate this gating/dispatching logic into multi-device mixtures-of-experts. Args: inputs: a Tensor with shape [batch, length, depth] hidden_size: an integer output_size: an integer num_experts: an integer loss_coef: a float scalar overhead: multiplicative factor of how much spare capacity to assign Returns: outputs: a Tensor with shape [batch, length, output_size] loss: a scalar """ batch, length, input_size = common_layers.shape_list(inputs)[:] # Each sequence sends expert_capacity positions to each expert. if isinstance(length, int): expert_capacity = min( length, int((length * 2 * overhead) / num_experts)) else: expert_capacity = tf.minimum( length, tf.to_int32( tf.to_float(length) * 2 * overhead / num_experts)) expert_capacity_f = tf.to_float(expert_capacity) # This is the learned gating function. gates = tf.nn.softmax( tf.to_float(common_layers.dense(inputs, num_experts, name="logits"))) # Find the top expert for each position. gate_1, index_1 = common_layers.top_1_tpu(gates) # [batch, length, num_experts] mask_1 = tf.one_hot(index_1, num_experts) # [batch, length, num_experts] # This is the position within the expert's mini-batch for this sequence position_in_expert_1 = common_layers.cumsum( mask_1, axis=1, exclusive=True) * mask_1 # Remove the elements that don't fit. mask_1 *= tf.to_float(tf.less(position_in_expert_1, expert_capacity_f)) # [batch, 1, num_experts] # How many examples in this sequence go to this expert mask_1_count = tf.reduce_sum(mask_1, axis=1, keepdims=True) # [batch, length] - mostly ones, but zeros where something didn't fit mask_1_flat = tf.reduce_sum(mask_1, axis=2) position_in_expert_1 = tf.reduce_sum(position_in_expert_1, axis=2) # Weight assigned to first expert. gate_1 *= mask_1_flat # Pick a second-place expert for each position. # We first mask out the experts that we expect to be over-capacity space_remaining = expert_capacity_f - mask_1_count use_rate = (mask_1_count + 1.0) / tf.to_float(length) # At what point in the sequence do we expect the expert to be full. expected_exhaustion_pos = space_remaining / use_rate # A Tensor with shape [batch, length, num_experts] representing a boolean # - whether we expect that the expert will already be full. expected_exhausted = tf.to_float(tf.greater( tf.reshape(tf.to_float(tf.range(length)), [1, length, 1]), expected_exhaustion_pos)) masked_gates = gates - mask_1 - expected_exhausted # This section is similar to the section above. gate_2, index_2 = common_layers.top_1_tpu(masked_gates) # [batch, length, num_experts] mask_2 = tf.one_hot(index_2, num_experts) position_in_expert_2 = ( common_layers.cumsum(mask_2, axis=1, exclusive=True) + mask_1_count) position_in_expert_2 *= mask_2 mask_2 *= tf.to_float(tf.less(position_in_expert_2, expert_capacity_f)) mask_2_count = tf.reduce_sum(mask_2, axis=1, keepdims=True) mask_2_flat = tf.reduce_sum(mask_2, axis=2) position_in_expert_2 = tf.reduce_sum(position_in_expert_2, axis=2) gate_2 *= mask_2_flat # What fraction didn't fit - show summaries miss_rate_1 = 1.0 - tf.reduce_sum(mask_1_count) / tf.to_float(batch * length) miss_rate_2 = 1.0 - tf.reduce_sum(mask_2_count) / tf.to_float(batch * length) tf.summary.scalar("miss_rate_1", miss_rate_1) tf.summary.scalar("miss_rate_2", miss_rate_2) # renormalize the two gate values to add up to 1 denom = gate_1 + gate_2 + 1e-9 gate_1 /= denom gate_2 /= denom # inputs: [batch, length, input_size] # forward_assignment: [batch, length, num_experts * expert_capacity] # expert_inputs: [batch, num_experts * expert_capacity, input_size] segment_ids_forward_1 = ( (index_1 * expert_capacity) + tf.to_int32(position_in_expert_1) + tf.to_int32(1.0 - mask_1_flat) * (num_experts * expert_capacity)) segment_ids_forward_2 = ( (index_2 * expert_capacity) + tf.to_int32(position_in_expert_2) + tf.to_int32(1.0 - mask_2_flat) * (num_experts * expert_capacity)) # Gather and scatter are painfully slow on TPU. # We will use one_hot and matmul instead. # [batch, length, num_experts * expert_capacity] one_hot_1 = tf.one_hot( segment_ids_forward_1, num_experts * expert_capacity, dtype=inputs.dtype) one_hot_2 = tf.one_hot( segment_ids_forward_2, num_experts * expert_capacity, dtype=inputs.dtype) forward_assignment = (one_hot_1 + one_hot_2) # [batch, num_experts * expert_capacity, input_size] expert_inputs = tf.matmul(forward_assignment, inputs, transpose_a=True) # [batch, num_experts, expert_capacity, input_size] expert_inputs = tf.reshape( expert_inputs, [batch, num_experts, expert_capacity, input_size]) # [num_experts, batch, expert_capacity, input_size] expert_inputs = tf.transpose(expert_inputs, [1, 0, 2, 3]) # [num_experts, batch * expert_capacity, input_size] expert_inputs = tf.reshape( expert_inputs, [num_experts, batch * expert_capacity, input_size]) # Now feed the expert inputs through the experts. h = common_layers.batch_dense( expert_inputs, hidden_size, activation=tf.nn.relu, name="x0") expert_output = common_layers.batch_dense(h, output_size, name="x1") expert_output = tf.reshape( expert_output, [num_experts, batch, expert_capacity, output_size]) # [batch, num_experts, expert_capacity, output_size] expert_output = tf.transpose(expert_output, [1, 0, 2, 3]) expert_output = tf.reshape( expert_output, [batch, num_experts * expert_capacity, output_size]) # Again, use matmul instead of unsorted_segment_sum. This time, we need # to multiply by the combination weights gate_1 and gate_2. # expert_output: [batch, num_experts * expert_capacity, output_size] # backward_assigmnent: [batch, length, num_experts * expert_capacity] # output: [batch, length, output_size] backward_assigmnent = ( one_hot_1 * tf.cast(tf.expand_dims(gate_1, 2), inputs.dtype) + one_hot_2 * tf.cast(tf.expand_dims(gate_2, 2), inputs.dtype)) output = tf.matmul(backward_assigmnent, expert_output) # Compute a loss equal to the coefficient ov variation of the # total gate value per expert per sequence. # This loss causes the experts to be used about equally used per sequence. importance = tf.reduce_sum(gates * (mask_1 + mask_2), 1) loss = loss_coef * cv_squared(importance) return output, loss
[ "def", "local_moe_tpu", "(", "inputs", ",", "hidden_size", ",", "output_size", ",", "num_experts", ",", "loss_coef", "=", "1e-3", ",", "overhead", "=", "1.0", ")", ":", "batch", ",", "length", ",", "input_size", "=", "common_layers", ".", "shape_list", "(", "inputs", ")", "[", ":", "]", "# Each sequence sends expert_capacity positions to each expert.", "if", "isinstance", "(", "length", ",", "int", ")", ":", "expert_capacity", "=", "min", "(", "length", ",", "int", "(", "(", "length", "*", "2", "*", "overhead", ")", "/", "num_experts", ")", ")", "else", ":", "expert_capacity", "=", "tf", ".", "minimum", "(", "length", ",", "tf", ".", "to_int32", "(", "tf", ".", "to_float", "(", "length", ")", "*", "2", "*", "overhead", "/", "num_experts", ")", ")", "expert_capacity_f", "=", "tf", ".", "to_float", "(", "expert_capacity", ")", "# This is the learned gating function.", "gates", "=", "tf", ".", "nn", ".", "softmax", "(", "tf", ".", "to_float", "(", "common_layers", ".", "dense", "(", "inputs", ",", "num_experts", ",", "name", "=", "\"logits\"", ")", ")", ")", "# Find the top expert for each position.", "gate_1", ",", "index_1", "=", "common_layers", ".", "top_1_tpu", "(", "gates", ")", "# [batch, length, num_experts]", "mask_1", "=", "tf", ".", "one_hot", "(", "index_1", ",", "num_experts", ")", "# [batch, length, num_experts]", "# This is the position within the expert's mini-batch for this sequence", "position_in_expert_1", "=", "common_layers", ".", "cumsum", "(", "mask_1", ",", "axis", "=", "1", ",", "exclusive", "=", "True", ")", "*", "mask_1", "# Remove the elements that don't fit.", "mask_1", "*=", "tf", ".", "to_float", "(", "tf", ".", "less", "(", "position_in_expert_1", ",", "expert_capacity_f", ")", ")", "# [batch, 1, num_experts]", "# How many examples in this sequence go to this expert", "mask_1_count", "=", "tf", ".", "reduce_sum", "(", "mask_1", ",", "axis", "=", "1", ",", "keepdims", "=", "True", ")", "# [batch, length] - mostly ones, but zeros where something didn't fit", "mask_1_flat", "=", "tf", ".", "reduce_sum", "(", "mask_1", ",", "axis", "=", "2", ")", "position_in_expert_1", "=", "tf", ".", "reduce_sum", "(", "position_in_expert_1", ",", "axis", "=", "2", ")", "# Weight assigned to first expert.", "gate_1", "*=", "mask_1_flat", "# Pick a second-place expert for each position.", "# We first mask out the experts that we expect to be over-capacity", "space_remaining", "=", "expert_capacity_f", "-", "mask_1_count", "use_rate", "=", "(", "mask_1_count", "+", "1.0", ")", "/", "tf", ".", "to_float", "(", "length", ")", "# At what point in the sequence do we expect the expert to be full.", "expected_exhaustion_pos", "=", "space_remaining", "/", "use_rate", "# A Tensor with shape [batch, length, num_experts] representing a boolean", "# - whether we expect that the expert will already be full.", "expected_exhausted", "=", "tf", ".", "to_float", "(", "tf", ".", "greater", "(", "tf", ".", "reshape", "(", "tf", ".", "to_float", "(", "tf", ".", "range", "(", "length", ")", ")", ",", "[", "1", ",", "length", ",", "1", "]", ")", ",", "expected_exhaustion_pos", ")", ")", "masked_gates", "=", "gates", "-", "mask_1", "-", "expected_exhausted", "# This section is similar to the section above.", "gate_2", ",", "index_2", "=", "common_layers", ".", "top_1_tpu", "(", "masked_gates", ")", "# [batch, length, num_experts]", "mask_2", "=", "tf", ".", "one_hot", "(", "index_2", ",", "num_experts", ")", "position_in_expert_2", "=", "(", "common_layers", ".", "cumsum", "(", "mask_2", ",", "axis", "=", "1", ",", "exclusive", "=", "True", ")", "+", "mask_1_count", ")", "position_in_expert_2", "*=", "mask_2", "mask_2", "*=", "tf", ".", "to_float", "(", "tf", ".", "less", "(", "position_in_expert_2", ",", "expert_capacity_f", ")", ")", "mask_2_count", "=", "tf", ".", "reduce_sum", "(", "mask_2", ",", "axis", "=", "1", ",", "keepdims", "=", "True", ")", "mask_2_flat", "=", "tf", ".", "reduce_sum", "(", "mask_2", ",", "axis", "=", "2", ")", "position_in_expert_2", "=", "tf", ".", "reduce_sum", "(", "position_in_expert_2", ",", "axis", "=", "2", ")", "gate_2", "*=", "mask_2_flat", "# What fraction didn't fit - show summaries", "miss_rate_1", "=", "1.0", "-", "tf", ".", "reduce_sum", "(", "mask_1_count", ")", "/", "tf", ".", "to_float", "(", "batch", "*", "length", ")", "miss_rate_2", "=", "1.0", "-", "tf", ".", "reduce_sum", "(", "mask_2_count", ")", "/", "tf", ".", "to_float", "(", "batch", "*", "length", ")", "tf", ".", "summary", ".", "scalar", "(", "\"miss_rate_1\"", ",", "miss_rate_1", ")", "tf", ".", "summary", ".", "scalar", "(", "\"miss_rate_2\"", ",", "miss_rate_2", ")", "# renormalize the two gate values to add up to 1", "denom", "=", "gate_1", "+", "gate_2", "+", "1e-9", "gate_1", "/=", "denom", "gate_2", "/=", "denom", "# inputs: [batch, length, input_size]", "# forward_assignment: [batch, length, num_experts * expert_capacity]", "# expert_inputs: [batch, num_experts * expert_capacity, input_size]", "segment_ids_forward_1", "=", "(", "(", "index_1", "*", "expert_capacity", ")", "+", "tf", ".", "to_int32", "(", "position_in_expert_1", ")", "+", "tf", ".", "to_int32", "(", "1.0", "-", "mask_1_flat", ")", "*", "(", "num_experts", "*", "expert_capacity", ")", ")", "segment_ids_forward_2", "=", "(", "(", "index_2", "*", "expert_capacity", ")", "+", "tf", ".", "to_int32", "(", "position_in_expert_2", ")", "+", "tf", ".", "to_int32", "(", "1.0", "-", "mask_2_flat", ")", "*", "(", "num_experts", "*", "expert_capacity", ")", ")", "# Gather and scatter are painfully slow on TPU.", "# We will use one_hot and matmul instead.", "# [batch, length, num_experts * expert_capacity]", "one_hot_1", "=", "tf", ".", "one_hot", "(", "segment_ids_forward_1", ",", "num_experts", "*", "expert_capacity", ",", "dtype", "=", "inputs", ".", "dtype", ")", "one_hot_2", "=", "tf", ".", "one_hot", "(", "segment_ids_forward_2", ",", "num_experts", "*", "expert_capacity", ",", "dtype", "=", "inputs", ".", "dtype", ")", "forward_assignment", "=", "(", "one_hot_1", "+", "one_hot_2", ")", "# [batch, num_experts * expert_capacity, input_size]", "expert_inputs", "=", "tf", ".", "matmul", "(", "forward_assignment", ",", "inputs", ",", "transpose_a", "=", "True", ")", "# [batch, num_experts, expert_capacity, input_size]", "expert_inputs", "=", "tf", ".", "reshape", "(", "expert_inputs", ",", "[", "batch", ",", "num_experts", ",", "expert_capacity", ",", "input_size", "]", ")", "# [num_experts, batch, expert_capacity, input_size]", "expert_inputs", "=", "tf", ".", "transpose", "(", "expert_inputs", ",", "[", "1", ",", "0", ",", "2", ",", "3", "]", ")", "# [num_experts, batch * expert_capacity, input_size]", "expert_inputs", "=", "tf", ".", "reshape", "(", "expert_inputs", ",", "[", "num_experts", ",", "batch", "*", "expert_capacity", ",", "input_size", "]", ")", "# Now feed the expert inputs through the experts.", "h", "=", "common_layers", ".", "batch_dense", "(", "expert_inputs", ",", "hidden_size", ",", "activation", "=", "tf", ".", "nn", ".", "relu", ",", "name", "=", "\"x0\"", ")", "expert_output", "=", "common_layers", ".", "batch_dense", "(", "h", ",", "output_size", ",", "name", "=", "\"x1\"", ")", "expert_output", "=", "tf", ".", "reshape", "(", "expert_output", ",", "[", "num_experts", ",", "batch", ",", "expert_capacity", ",", "output_size", "]", ")", "# [batch, num_experts, expert_capacity, output_size]", "expert_output", "=", "tf", ".", "transpose", "(", "expert_output", ",", "[", "1", ",", "0", ",", "2", ",", "3", "]", ")", "expert_output", "=", "tf", ".", "reshape", "(", "expert_output", ",", "[", "batch", ",", "num_experts", "*", "expert_capacity", ",", "output_size", "]", ")", "# Again, use matmul instead of unsorted_segment_sum. This time, we need", "# to multiply by the combination weights gate_1 and gate_2.", "# expert_output: [batch, num_experts * expert_capacity, output_size]", "# backward_assigmnent: [batch, length, num_experts * expert_capacity]", "# output: [batch, length, output_size]", "backward_assigmnent", "=", "(", "one_hot_1", "*", "tf", ".", "cast", "(", "tf", ".", "expand_dims", "(", "gate_1", ",", "2", ")", ",", "inputs", ".", "dtype", ")", "+", "one_hot_2", "*", "tf", ".", "cast", "(", "tf", ".", "expand_dims", "(", "gate_2", ",", "2", ")", ",", "inputs", ".", "dtype", ")", ")", "output", "=", "tf", ".", "matmul", "(", "backward_assigmnent", ",", "expert_output", ")", "# Compute a loss equal to the coefficient ov variation of the", "# total gate value per expert per sequence.", "# This loss causes the experts to be used about equally used per sequence.", "importance", "=", "tf", ".", "reduce_sum", "(", "gates", "*", "(", "mask_1", "+", "mask_2", ")", ",", "1", ")", "loss", "=", "loss_coef", "*", "cv_squared", "(", "importance", ")", "return", "output", ",", "loss" ]
Local mixture of experts that works well on TPU. See https://arxiv.org/abs/1701.06538 There are num_experts expert networks, each containing a relu-activated hidden layer of size hidden_size, followed by an output projection. The number of parameters is thus: num_experts * (input_size * hidden_size + hidden_size * output_size) The input is 3d: [batch, length, depth], consisting of the representations of all positions in a batch of sequences. Each position of each sequence is sent to 0-2 experts. The expert choices and the combination weights are determined by a learned gating function. This function returns a small auxiliary loss that should be added to the training loss of the model. This loss helps to balance expert usage. Without the loss, it is very likely that a few experts will be trained and the rest will starve. Several hacks are necessary to get around current TPU limitations: - To ensure static shapes, we enforce (by truncation/padding) that each sequence send the same number of elements to each expert. It would make more sense to enforce this equality over the entire batch, as opposed to on individual sequences. This would allow more freedom for individual sequences to be unbalanced. Unfortunately, that would slow down our hacked-up gather-by-matmul implementation. TODO(noam): There is no real reason for a single sequence to be the unit of equal allocation. Reshaping the inputs would allow us to pick a different unit of equal allocation. TODO(noam): Factor this code better. We want to be able to substitute different code for the experts themselves. We also want to integrate this gating/dispatching logic into multi-device mixtures-of-experts. Args: inputs: a Tensor with shape [batch, length, depth] hidden_size: an integer output_size: an integer num_experts: an integer loss_coef: a float scalar overhead: multiplicative factor of how much spare capacity to assign Returns: outputs: a Tensor with shape [batch, length, output_size] loss: a scalar
[ "Local", "mixture", "of", "experts", "that", "works", "well", "on", "TPU", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L1217-L1411
train
Local mixture of experts that works well on TPU.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbq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,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1951 - 1903) + chr(4916 - 4805) + chr(0b110000 + 0o7), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b1010 + 0o51) + chr(1874 - 1823) + chr(0b110110), 41265 - 41257), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + '\x32' + chr(826 - 778) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x35' + chr(1675 - 1621), 0o10), ehT0Px3KOsy9(chr(1937 - 1889) + '\x6f' + chr(0b110010) + '\060' + chr(0b110111), 48648 - 48640), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(380 - 329) + chr(2531 - 2478) + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(1777 - 1726) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11716 - 11605) + chr(0b10111 + 0o33) + '\065' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101111 + 0o7) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1419 - 1371) + chr(0b11111 + 0o120) + '\x31' + chr(0b1111 + 0o42) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(8877 - 8766) + '\062' + chr(0b100010 + 0o22) + chr(1456 - 1404), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b110011) + chr(48), 41803 - 41795), ehT0Px3KOsy9('\060' + chr(0b111 + 0o150) + chr(50) + chr(0b110111) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1010111 + 0o30) + '\x33' + chr(54) + chr(0b110000), 2550 - 2542), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(1439 - 1387) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + chr(50) + '\063' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + chr(0b100001 + 0o20) + chr(54) + chr(0b110010 + 0o5), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010 + 0o4) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + '\061' + chr(0b110101) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + chr(0b101101 + 0o4), 61631 - 61623), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110100) + chr(0b11101 + 0o24), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1348 - 1298) + '\066' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\062' + chr(784 - 731), ord("\x08")), ehT0Px3KOsy9(chr(1526 - 1478) + chr(0b1100010 + 0o15) + chr(1171 - 1120) + chr(0b110011) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\063' + '\x37', 21319 - 21311), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + chr(2159 - 2110) + '\063' + chr(48), 8), ehT0Px3KOsy9(chr(1453 - 1405) + chr(111) + chr(51) + chr(0b11100 + 0o30) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + '\067' + chr(502 - 447), 48093 - 48085), ehT0Px3KOsy9('\060' + chr(0b111100 + 0o63) + chr(52) + '\067', 46644 - 46636), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1921 - 1871) + chr(1254 - 1200) + chr(0b11 + 0o61), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b10010 + 0o135) + chr(0b110010) + chr(361 - 312) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(0b110010) + chr(49) + chr(2588 - 2533), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101111 + 0o2) + '\x33' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001100 + 0o43) + chr(0b110001) + chr(0b100101 + 0o13), 3423 - 3415), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + '\061' + chr(2806 - 2753) + chr(0b10110 + 0o34), 15919 - 15911), ehT0Px3KOsy9('\x30' + chr(0b101 + 0o152) + chr(0b101011 + 0o7) + chr(989 - 940) + chr(2695 - 2640), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(55), 8), ehT0Px3KOsy9(chr(116 - 68) + '\x6f' + '\x31' + chr(0b1101 + 0o47) + '\x33', 30720 - 30712), ehT0Px3KOsy9('\060' + chr(0b11111 + 0o120) + chr(49) + '\065' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(253 - 205) + '\157' + '\x32' + chr(0b110100) + chr(0b110101), 52268 - 52260)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + '\065' + chr(0b100 + 0o54), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b')'), chr(0b1100100) + chr(0b101010 + 0o73) + '\x63' + chr(111) + chr(4113 - 4013) + chr(0b1001001 + 0o34))(chr(0b1110101) + '\164' + '\x66' + chr(0b11000 + 0o25) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def U9lMEbiykbRp(vXoupepMtCXU, qzoyXN3kdhDL, NOWUhJWuP8qU, et6dMbqOJH62, sumjy1Ds0MCA=0.001, DuxXqaFDM_wB=1.0): (dNwAahu8tvoY, CHAOgk5VCHH_, uNAGRcXaNiGu) = jSKPaHwSAfVv.shape_list(vXoupepMtCXU)[:] if PlSM16l2KDPD(CHAOgk5VCHH_, ehT0Px3KOsy9): B2uy5TvYnLkE = Dx22bkKPdt5d(CHAOgk5VCHH_, ehT0Px3KOsy9(CHAOgk5VCHH_ * ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(50), 0o10) * DuxXqaFDM_wB / et6dMbqOJH62)) else: B2uy5TvYnLkE = IDJ2eXGCBCDu.minimum(CHAOgk5VCHH_, IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.ZUL3kHBGU8Uu(CHAOgk5VCHH_) * ehT0Px3KOsy9('\x30' + chr(111) + chr(1543 - 1493), 8) * DuxXqaFDM_wB / et6dMbqOJH62)) wH4pDclQjNdq = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(B2uy5TvYnLkE) D5FfJKnAV_lN = IDJ2eXGCBCDu.nn.softmax(IDJ2eXGCBCDu.ZUL3kHBGU8Uu(jSKPaHwSAfVv.dense(vXoupepMtCXU, et6dMbqOJH62, name=xafqLlk3kkUe(SXOLrMavuUCe(b'k\xb1\xe7G\xf3\x9d'), '\x64' + chr(0b1100101) + '\143' + chr(111) + chr(0b1100100) + chr(101))('\165' + chr(0b110000 + 0o104) + chr(0b101010 + 0o74) + '\055' + '\070')))) (HhwapRPW8Ov5, qfI2LM_BJZjc) = jSKPaHwSAfVv.top_1_tpu(D5FfJKnAV_lN) psNQXqohlXjK = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(qfI2LM_BJZjc, et6dMbqOJH62) HheNCmM2GCnq = jSKPaHwSAfVv.i0lzZW3r00ue(psNQXqohlXjK, axis=ehT0Px3KOsy9('\x30' + '\x6f' + '\061', 45004 - 44996), exclusive=ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + '\x31', 8)) * psNQXqohlXjK psNQXqohlXjK *= IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.less(HheNCmM2GCnq, wH4pDclQjNdq)) BWmdZKMWumHL = IDJ2eXGCBCDu.reduce_sum(psNQXqohlXjK, axis=ehT0Px3KOsy9(chr(243 - 195) + chr(111) + chr(0b101000 + 0o11), 8), keepdims=ehT0Px3KOsy9(chr(0b110000) + chr(3923 - 3812) + chr(1757 - 1708), 8)) pYrt6xoaLBuo = IDJ2eXGCBCDu.reduce_sum(psNQXqohlXjK, axis=ehT0Px3KOsy9('\x30' + '\x6f' + chr(50), 8)) HheNCmM2GCnq = IDJ2eXGCBCDu.reduce_sum(HheNCmM2GCnq, axis=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10101 + 0o35), 8)) HhwapRPW8Ov5 *= pYrt6xoaLBuo AtIJaCrZBBKP = wH4pDclQjNdq - BWmdZKMWumHL WBzJICn4jikc = (BWmdZKMWumHL + 1.0) / IDJ2eXGCBCDu.ZUL3kHBGU8Uu(CHAOgk5VCHH_) Ptd9FXZfGa6_ = AtIJaCrZBBKP / WBzJICn4jikc ilVzTWxYmKwB = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.greater(IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.range(CHAOgk5VCHH_)), [ehT0Px3KOsy9(chr(48) + '\x6f' + '\061', 8), CHAOgk5VCHH_, ehT0Px3KOsy9(chr(69 - 21) + chr(0b10010 + 0o135) + '\x31', 8)]), Ptd9FXZfGa6_)) MKMIC55DjeIN = D5FfJKnAV_lN - psNQXqohlXjK - ilVzTWxYmKwB (ZVQ8iYSFf6j2, asSbw1PSIiEe) = jSKPaHwSAfVv.top_1_tpu(MKMIC55DjeIN) kjIPnpENqlZi = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(asSbw1PSIiEe, et6dMbqOJH62) FqTbGm9HHDVt = jSKPaHwSAfVv.i0lzZW3r00ue(kjIPnpENqlZi, axis=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 8), exclusive=ehT0Px3KOsy9('\060' + chr(1911 - 1800) + '\x31', 8)) + BWmdZKMWumHL FqTbGm9HHDVt *= kjIPnpENqlZi kjIPnpENqlZi *= IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.less(FqTbGm9HHDVt, wH4pDclQjNdq)) a0zTdCqiaJJU = IDJ2eXGCBCDu.reduce_sum(kjIPnpENqlZi, axis=ehT0Px3KOsy9('\x30' + chr(1757 - 1646) + chr(1265 - 1216), 8), keepdims=ehT0Px3KOsy9(chr(1981 - 1933) + chr(0b1101111) + '\x31', 8)) tLMHE4kUCyvX = IDJ2eXGCBCDu.reduce_sum(kjIPnpENqlZi, axis=ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + '\062', 8)) FqTbGm9HHDVt = IDJ2eXGCBCDu.reduce_sum(FqTbGm9HHDVt, axis=ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010), 8)) ZVQ8iYSFf6j2 *= tLMHE4kUCyvX PhSHOA1Lw9XF = 1.0 - IDJ2eXGCBCDu.reduce_sum(BWmdZKMWumHL) / IDJ2eXGCBCDu.ZUL3kHBGU8Uu(dNwAahu8tvoY * CHAOgk5VCHH_) rhpbH7gXPt98 = 1.0 - IDJ2eXGCBCDu.reduce_sum(a0zTdCqiaJJU) / IDJ2eXGCBCDu.ZUL3kHBGU8Uu(dNwAahu8tvoY * CHAOgk5VCHH_) xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b't\xbd\xe1B\xe6\x9c'), '\144' + chr(8241 - 8140) + chr(5888 - 5789) + '\157' + chr(100) + chr(2536 - 2435))('\165' + chr(0b1000101 + 0o57) + chr(0b1100110) + chr(1023 - 978) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'j\xb7\xf3]\xd8\x9c\xf9\xddU\x17\x95'), chr(100) + chr(3780 - 3679) + chr(5651 - 5552) + '\x6f' + '\144' + '\x65')(chr(117) + chr(0b1001001 + 0o53) + '\146' + '\x2d' + chr(1082 - 1026)), PhSHOA1Lw9XF) xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b't\xbd\xe1B\xe6\x9c'), '\144' + '\x65' + chr(0b1001110 + 0o25) + chr(111) + chr(100) + '\x65')(chr(117) + '\164' + chr(102) + chr(0b101101 + 0o0) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'j\xb7\xf3]\xd8\x9c\xf9\xddU\x17\x96'), chr(5798 - 5698) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(100) + '\145')(chr(117) + '\164' + '\x66' + chr(0b100000 + 0o15) + chr(0b111000)), rhpbH7gXPt98) fXheFXeFuYd1 = HhwapRPW8Ov5 + ZVQ8iYSFf6j2 + 1e-09 HhwapRPW8Ov5 /= fXheFXeFuYd1 ZVQ8iYSFf6j2 /= fXheFXeFuYd1 z4uD3r9n912e = qfI2LM_BJZjc * B2uy5TvYnLkE + IDJ2eXGCBCDu.to_int32(HheNCmM2GCnq) + IDJ2eXGCBCDu.to_int32(1.0 - pYrt6xoaLBuo) * (et6dMbqOJH62 * B2uy5TvYnLkE) qOVZmptBkIvB = asSbw1PSIiEe * B2uy5TvYnLkE + IDJ2eXGCBCDu.to_int32(FqTbGm9HHDVt) + IDJ2eXGCBCDu.to_int32(1.0 - tLMHE4kUCyvX) * (et6dMbqOJH62 * B2uy5TvYnLkE) vxmSiARQqf36 = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(z4uD3r9n912e, et6dMbqOJH62 * B2uy5TvYnLkE, dtype=vXoupepMtCXU.jSV9IKnemH7K) UGmpfRGhtllI = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(qOVZmptBkIvB, et6dMbqOJH62 * B2uy5TvYnLkE, dtype=vXoupepMtCXU.jSV9IKnemH7K) fYByodNmjevI = vxmSiARQqf36 + UGmpfRGhtllI C9doWr_CSLsB = IDJ2eXGCBCDu.matmul(fYByodNmjevI, vXoupepMtCXU, transpose_a=ehT0Px3KOsy9('\x30' + chr(111) + chr(443 - 394), 8)) C9doWr_CSLsB = IDJ2eXGCBCDu.reshape(C9doWr_CSLsB, [dNwAahu8tvoY, et6dMbqOJH62, B2uy5TvYnLkE, uNAGRcXaNiGu]) C9doWr_CSLsB = IDJ2eXGCBCDu.transpose(C9doWr_CSLsB, [ehT0Px3KOsy9(chr(0b110000) + chr(5153 - 5042) + chr(0b1001 + 0o50), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110000), 16714 - 16706), ehT0Px3KOsy9(chr(758 - 710) + '\x6f' + '\x32', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\063', 0b1000)]) C9doWr_CSLsB = IDJ2eXGCBCDu.reshape(C9doWr_CSLsB, [et6dMbqOJH62, dNwAahu8tvoY * B2uy5TvYnLkE, uNAGRcXaNiGu]) sz4HVsFVF8nL = jSKPaHwSAfVv.batch_dense(C9doWr_CSLsB, qzoyXN3kdhDL, activation=IDJ2eXGCBCDu.nn.relu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\xee'), '\144' + chr(0b1100101) + chr(5336 - 5237) + chr(10714 - 10603) + chr(2135 - 2035) + chr(0b1011010 + 0o13))(chr(0b1000 + 0o155) + chr(0b1110100) + chr(5014 - 4912) + chr(45) + chr(0b111000))) SsSb4XXTss5e = jSKPaHwSAfVv.batch_dense(sz4HVsFVF8nL, NOWUhJWuP8qU, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\xef'), chr(0b1100100) + chr(1641 - 1540) + chr(0b1100011) + '\x6f' + chr(100) + chr(101))(chr(8104 - 7987) + '\164' + '\x66' + chr(0b101101) + chr(1184 - 1128))) SsSb4XXTss5e = IDJ2eXGCBCDu.reshape(SsSb4XXTss5e, [et6dMbqOJH62, dNwAahu8tvoY, B2uy5TvYnLkE, NOWUhJWuP8qU]) SsSb4XXTss5e = IDJ2eXGCBCDu.transpose(SsSb4XXTss5e, [ehT0Px3KOsy9(chr(48) + chr(6401 - 6290) + chr(0b11001 + 0o30), 8), ehT0Px3KOsy9(chr(1149 - 1101) + chr(111) + chr(0b1100 + 0o44), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10011 + 0o37), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1536 - 1485), 8)]) SsSb4XXTss5e = IDJ2eXGCBCDu.reshape(SsSb4XXTss5e, [dNwAahu8tvoY, et6dMbqOJH62 * B2uy5TvYnLkE, NOWUhJWuP8qU]) LjVS2YzmssSk = vxmSiARQqf36 * IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.expand_dims(HhwapRPW8Ov5, ehT0Px3KOsy9(chr(736 - 688) + '\157' + '\062', 8)), vXoupepMtCXU.jSV9IKnemH7K) + UGmpfRGhtllI * IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.expand_dims(ZVQ8iYSFf6j2, ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100110 + 0o14), 8)), vXoupepMtCXU.jSV9IKnemH7K) e1jVqMSBZ01Y = IDJ2eXGCBCDu.matmul(LjVS2YzmssSk, SsSb4XXTss5e) dFLRzkDkORpe = IDJ2eXGCBCDu.reduce_sum(D5FfJKnAV_lN * (psNQXqohlXjK + kjIPnpENqlZi), ehT0Px3KOsy9('\060' + chr(111) + chr(49), 8)) YpO0BcZ6fMsf = sumjy1Ds0MCA * wrwwPr_mZ8_E(dFLRzkDkORpe) return (e1jVqMSBZ01Y, YpO0BcZ6fMsf)
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
reduce_by_device
def reduce_by_device(parallelism, data, reduce_fn): """Reduces data per device. This can be useful, for example, if we want to all-reduce n tensors on k<n devices (like during eval when we have only one device). We call reduce_by_device() to first sum the tensors per device, then call our usual all-reduce operation to create one sum per device, followed by expand_by_device, to create the appropriate number of pointers to these results. See all_reduce_ring() below for an example of how this is used. Args: parallelism: a expert_utils.Parallelism object data: a list of Tensors with length parallelism.n reduce_fn: a function taking a list of Tensors. e.g. tf.add_n Returns: device_parallelism: a Parallelism object with each device listed only once. reduced_data: A list of Tensors, one per device. """ unique_devices = [] device_to_data = {} for dev, datum in zip(parallelism.devices, data): if dev not in device_to_data: unique_devices.append(dev) device_to_data[dev] = [datum] else: device_to_data[dev].append(datum) device_parallelism = Parallelism(unique_devices) grouped_data = [device_to_data[dev] for dev in unique_devices] return device_parallelism, device_parallelism(reduce_fn, grouped_data)
python
def reduce_by_device(parallelism, data, reduce_fn): """Reduces data per device. This can be useful, for example, if we want to all-reduce n tensors on k<n devices (like during eval when we have only one device). We call reduce_by_device() to first sum the tensors per device, then call our usual all-reduce operation to create one sum per device, followed by expand_by_device, to create the appropriate number of pointers to these results. See all_reduce_ring() below for an example of how this is used. Args: parallelism: a expert_utils.Parallelism object data: a list of Tensors with length parallelism.n reduce_fn: a function taking a list of Tensors. e.g. tf.add_n Returns: device_parallelism: a Parallelism object with each device listed only once. reduced_data: A list of Tensors, one per device. """ unique_devices = [] device_to_data = {} for dev, datum in zip(parallelism.devices, data): if dev not in device_to_data: unique_devices.append(dev) device_to_data[dev] = [datum] else: device_to_data[dev].append(datum) device_parallelism = Parallelism(unique_devices) grouped_data = [device_to_data[dev] for dev in unique_devices] return device_parallelism, device_parallelism(reduce_fn, grouped_data)
[ "def", "reduce_by_device", "(", "parallelism", ",", "data", ",", "reduce_fn", ")", ":", "unique_devices", "=", "[", "]", "device_to_data", "=", "{", "}", "for", "dev", ",", "datum", "in", "zip", "(", "parallelism", ".", "devices", ",", "data", ")", ":", "if", "dev", "not", "in", "device_to_data", ":", "unique_devices", ".", "append", "(", "dev", ")", "device_to_data", "[", "dev", "]", "=", "[", "datum", "]", "else", ":", "device_to_data", "[", "dev", "]", ".", "append", "(", "datum", ")", "device_parallelism", "=", "Parallelism", "(", "unique_devices", ")", "grouped_data", "=", "[", "device_to_data", "[", "dev", "]", "for", "dev", "in", "unique_devices", "]", "return", "device_parallelism", ",", "device_parallelism", "(", "reduce_fn", ",", "grouped_data", ")" ]
Reduces data per device. This can be useful, for example, if we want to all-reduce n tensors on k<n devices (like during eval when we have only one device). We call reduce_by_device() to first sum the tensors per device, then call our usual all-reduce operation to create one sum per device, followed by expand_by_device, to create the appropriate number of pointers to these results. See all_reduce_ring() below for an example of how this is used. Args: parallelism: a expert_utils.Parallelism object data: a list of Tensors with length parallelism.n reduce_fn: a function taking a list of Tensors. e.g. tf.add_n Returns: device_parallelism: a Parallelism object with each device listed only once. reduced_data: A list of Tensors, one per device.
[ "Reduces", "data", "per", "device", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L1414-L1443
train
Reduces data per device.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ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yaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(857 - 809) + chr(0b1101111) + chr(1878 - 1829) + '\062' + '\063', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110010) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(90 - 41) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(8256 - 8145) + chr(50) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1185 - 1136) + chr(0b110100) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(2444 - 2393) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(0b110010) + '\x32' + '\x36', 0o10), ehT0Px3KOsy9(chr(146 - 98) + chr(111) + chr(0b11100 + 0o31) + chr(0b111 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\061' + '\062' + chr(55), 8), ehT0Px3KOsy9('\x30' + chr(9527 - 9416) + '\063' + chr(0b110100) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100 + 0o143) + chr(0b100010 + 0o17) + chr(48) + chr(2158 - 2105), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1000010 + 0o55) + '\063' + chr(0b110000) + chr(49), 37120 - 37112), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + chr(0b10111 + 0o33) + chr(0b110001) + chr(1084 - 1029), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + '\061' + chr(0b0 + 0o60) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(50) + chr(0b100001 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5702 - 5591) + '\x35' + chr(50), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(10415 - 10304) + chr(0b1001 + 0o52) + '\x36' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1001110 + 0o41) + chr(49) + chr(2256 - 2204) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(49) + chr(0b101111 + 0o10), 8), ehT0Px3KOsy9(chr(2099 - 2051) + chr(1626 - 1515) + chr(1930 - 1879) + chr(0b110101) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + '\x32' + '\067' + chr(0b110000 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + '\x32' + chr(55) + chr(1968 - 1920), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9590 - 9479) + chr(49) + chr(0b110011) + chr(0b1000 + 0o54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(555 - 505) + '\x30', 50347 - 50339), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110101) + chr(0b100100 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110110) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(11153 - 11042) + chr(51) + '\x30' + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b11101 + 0o31) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7633 - 7522) + chr(0b110010) + chr(0b11001 + 0o33) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(1168 - 1118) + '\061' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\065' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(50) + '\062', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(3836 - 3725) + chr(0b11000 + 0o33) + '\063', 0o10), ehT0Px3KOsy9(chr(64 - 16) + chr(0b1101111) + chr(50) + chr(0b11101 + 0o26) + chr(974 - 923), 0b1000), ehT0Px3KOsy9('\060' + chr(6273 - 6162) + '\063' + chr(55) + chr(1108 - 1059), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(48) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\x33' + chr(289 - 234), 50221 - 50213), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b10100 + 0o42) + chr(1646 - 1592), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\067', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(777 - 724) + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'}'), chr(2998 - 2898) + '\x65' + chr(99) + '\157' + chr(8890 - 8790) + '\x65')(chr(117) + '\164' + '\146' + chr(0b11010 + 0o23) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TohOP5jQ8TXD(LLZXD7Tzta9r, ULnjp6D6efFH, GANVVmMoicCy): LQZWpGNjwqFi = [] eZ5JClRswlJ2 = {} for (KUGShP2Xd_zs, RuhCLOFrxBnI) in pZ0NK2y6HRbn(xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'72<{\x03{\xe5'), '\x64' + chr(101) + chr(8586 - 8487) + '\157' + chr(0b1100100) + chr(101))(chr(117) + chr(0b10001 + 0o143) + chr(102) + chr(0b101101) + '\x38')), ULnjp6D6efFH): if KUGShP2Xd_zs not in eZ5JClRswlJ2: xafqLlk3kkUe(LQZWpGNjwqFi, xafqLlk3kkUe(SXOLrMavuUCe(b"2':w\x0ez"), chr(100) + '\x65' + chr(4425 - 4326) + chr(0b100111 + 0o110) + '\x64' + chr(0b1100 + 0o131))(chr(0b1011010 + 0o33) + chr(0b11110 + 0o126) + chr(0b10010 + 0o124) + chr(411 - 366) + '\x38'))(KUGShP2Xd_zs) eZ5JClRswlJ2[KUGShP2Xd_zs] = [RuhCLOFrxBnI] else: xafqLlk3kkUe(eZ5JClRswlJ2[KUGShP2Xd_zs], xafqLlk3kkUe(SXOLrMavuUCe(b"2':w\x0ez"), chr(100) + '\145' + chr(0b10111 + 0o114) + chr(0b1011011 + 0o24) + '\x64' + chr(0b1100101))('\x75' + chr(2543 - 2427) + '\146' + '\055' + '\070'))(RuhCLOFrxBnI) uSNMibCcogLV = rYH0bbeoAhO2(LQZWpGNjwqFi) z1dRmUjyWABZ = [eZ5JClRswlJ2[KUGShP2Xd_zs] for KUGShP2Xd_zs in LQZWpGNjwqFi] return (uSNMibCcogLV, uSNMibCcogLV(GANVVmMoicCy, z1dRmUjyWABZ))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
expand_by_device
def expand_by_device(original_parallelism, device_parallelism, data): """Opposite of reduce_by_device(). Args: original_parallelism: a expert_utils.Parallelism object. device_parallelism: a expert_utils.Parallelism object. data: a list of tensors with length device_parallelism.n Returns: a list of Tensors with length original_parallelism.n """ device_to_datum = { device_parallelism.devices[i]: data[i] for i in range(device_parallelism.n)} return [device_to_datum[d] for d in original_parallelism.devices]
python
def expand_by_device(original_parallelism, device_parallelism, data): """Opposite of reduce_by_device(). Args: original_parallelism: a expert_utils.Parallelism object. device_parallelism: a expert_utils.Parallelism object. data: a list of tensors with length device_parallelism.n Returns: a list of Tensors with length original_parallelism.n """ device_to_datum = { device_parallelism.devices[i]: data[i] for i in range(device_parallelism.n)} return [device_to_datum[d] for d in original_parallelism.devices]
[ "def", "expand_by_device", "(", "original_parallelism", ",", "device_parallelism", ",", "data", ")", ":", "device_to_datum", "=", "{", "device_parallelism", ".", "devices", "[", "i", "]", ":", "data", "[", "i", "]", "for", "i", "in", "range", "(", "device_parallelism", ".", "n", ")", "}", "return", "[", "device_to_datum", "[", "d", "]", "for", "d", "in", "original_parallelism", ".", "devices", "]" ]
Opposite of reduce_by_device(). Args: original_parallelism: a expert_utils.Parallelism object. device_parallelism: a expert_utils.Parallelism object. data: a list of tensors with length device_parallelism.n Returns: a list of Tensors with length original_parallelism.n
[ "Opposite", "of", "reduce_by_device", "()", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L1446-L1460
train
Opposite of reduce_by_device.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamn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tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2080 - 2030) + chr(48) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101110 + 0o1) + '\x33' + chr(0b101111 + 0o5) + chr(466 - 412), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b110110) + chr(0b11000 + 0o30), 11080 - 11072), ehT0Px3KOsy9('\x30' + chr(111) + chr(1116 - 1065) + chr(53) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b101001 + 0o16) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b110100) + chr(48), 37002 - 36994), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b100010 + 0o23) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1731 - 1680) + chr(0b110010) + chr(1208 - 1154), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(54) + chr(0b0 + 0o60), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(51) + chr(1097 - 1048), 23692 - 23684), ehT0Px3KOsy9(chr(1317 - 1269) + chr(111) + chr(904 - 854) + '\x37' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7131 - 7020) + chr(0b110001) + chr(0b110110) + chr(2469 - 2418), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(8890 - 8779) + chr(0b100100 + 0o16) + '\064' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110010) + '\063', 44669 - 44661), ehT0Px3KOsy9(chr(1791 - 1743) + '\x6f' + '\062' + chr(1995 - 1942) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110100) + chr(651 - 602), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(2768 - 2714) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2532 - 2481) + chr(52), 5078 - 5070), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\061', 44236 - 44228), ehT0Px3KOsy9(chr(1870 - 1822) + chr(0b110 + 0o151) + chr(0b100000 + 0o25) + '\x30', 1728 - 1720), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\x36' + chr(0b1000 + 0o51), 22748 - 22740), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\x31' + '\x36', 27327 - 27319), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(1439 - 1385) + chr(0b110000), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(0b110110) + chr(0b11000 + 0o37), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(489 - 438) + '\062' + chr(575 - 527), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(50) + chr(0b110011 + 0o0), 8), ehT0Px3KOsy9('\x30' + chr(3533 - 3422) + '\061' + chr(0b110 + 0o54) + chr(0b110000), 33239 - 33231), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11011 + 0o30) + '\064', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110100) + chr(744 - 691), ord("\x08")), ehT0Px3KOsy9(chr(164 - 116) + '\x6f' + chr(51) + chr(0b1001 + 0o54) + '\065', 58064 - 58056), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(1697 - 1586) + chr(49) + chr(2249 - 2199), 28414 - 28406), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + chr(0b100000 + 0o23) + chr(48) + chr(0b1001 + 0o56), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3749 - 3638) + chr(50) + '\x33' + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10 + 0o57) + chr(54) + chr(1839 - 1789), 32278 - 32270), ehT0Px3KOsy9(chr(48) + chr(2104 - 1993) + chr(54) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(0b1000 + 0o57) + chr(0b101010 + 0o10), 21457 - 21449), ehT0Px3KOsy9(chr(0b110000) + chr(8065 - 7954) + chr(1327 - 1278) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101011 + 0o12) + '\x30', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1400 - 1352) + '\x6f' + chr(0b110101) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xad'), '\x64' + chr(0b1010001 + 0o24) + chr(0b10010 + 0o121) + chr(111) + '\144' + chr(2981 - 2880))('\165' + '\164' + chr(102) + chr(609 - 564) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def z8nJvj8aMriZ(QwkGQEOkVWVA, uSNMibCcogLV, ULnjp6D6efFH): nte_5XmYH6un = {uSNMibCcogLV.devices[WVxHKyX45z_L]: ULnjp6D6efFH[WVxHKyX45z_L] for WVxHKyX45z_L in vQr8gNKaIaWE(uSNMibCcogLV.m1NkCryOw9Bx)} return [nte_5XmYH6un[pd3lxn9vqWxp] for pd3lxn9vqWxp in xafqLlk3kkUe(QwkGQEOkVWVA, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7\x83\x86\x86\x9a\x05\xde'), chr(9175 - 9075) + chr(0b1000101 + 0o40) + chr(99) + chr(111) + chr(100) + '\145')('\x75' + chr(5000 - 4884) + chr(102) + chr(0b100000 + 0o15) + '\x38'))]
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
all_reduce_ring
def all_reduce_ring(x, parallelism, maybe_reduce=True, use_bfloat16=True): """Compute the sum of all Tensors and put the result everywhere. Assumes that the devices are connected in a ring. Args: x: a list of Tensors with length parallelism.n parallelism: a expert_utils.Parallelism object. maybe_reduce: a boolean - first reduce per device. use_bfloat16: a boolean - saves bandwidth but loses precision Returns: a list of Tensors with length parallelism.n """ if parallelism.n == 1: return x if maybe_reduce: original_parallelism = parallelism parallelism, x = reduce_by_device(parallelism, x, tf.add_n) if parallelism.n == 1: y = x else: # first shard the input: x_flat = parallelism(tf.reshape, x, [[-1]] * parallelism.n) # [device, shard] x_split = parallelism( common_layers.approximate_split, x_flat, parallelism.n, 0) def _step(source_replica, target_replica, x_split, op="plus_eq"): """Helper function - one step of summing or copying. If op == "plus_eq", then adds source_replica into target_replica If op == "copy", then copies source_replica onto target_replica These operations happen for all shards. The replica numbers are offset by the shard numbers to keep all physical links busy. Args: source_replica: an integer target_replica: an integer x_split: a list of lists of tensors op: a string """ for shard in range(parallelism.n): source_device = (shard + source_replica) % parallelism.n target_device = (shard + target_replica) % parallelism.n source = x_split[source_device][shard] if use_bfloat16: with tf.device(parallelism.devices[source_device]): source = tf.to_bfloat16(source) with tf.device(parallelism.devices[target_device]): source = tf.to_float(source) if op == "plus_eq": x_split[target_device][shard] += source else: assert op == "copy" x_split[target_device][shard] = tf.identity(source) center = parallelism.n // 2 # accumulate everything towards the center. for i in reversed(range(center, parallelism.n - 1)): _step(i + 1, i, x_split, op="plus_eq") for i in range(center): _step(i, i + 1, x_split, op="plus_eq") # copy everything away from the center. for i in range(center, parallelism.n - 1): _step(i, i + 1, x_split, op="copy") for i in reversed(range(center)): _step(i + 1, i, x_split, op="copy") x_concat = parallelism(tf.concat, x_split, 0) y = parallelism(common_layers.reshape_like_all_dims, x_concat, x) if maybe_reduce: y = expand_by_device(original_parallelism, parallelism, y) return y
python
def all_reduce_ring(x, parallelism, maybe_reduce=True, use_bfloat16=True): """Compute the sum of all Tensors and put the result everywhere. Assumes that the devices are connected in a ring. Args: x: a list of Tensors with length parallelism.n parallelism: a expert_utils.Parallelism object. maybe_reduce: a boolean - first reduce per device. use_bfloat16: a boolean - saves bandwidth but loses precision Returns: a list of Tensors with length parallelism.n """ if parallelism.n == 1: return x if maybe_reduce: original_parallelism = parallelism parallelism, x = reduce_by_device(parallelism, x, tf.add_n) if parallelism.n == 1: y = x else: # first shard the input: x_flat = parallelism(tf.reshape, x, [[-1]] * parallelism.n) # [device, shard] x_split = parallelism( common_layers.approximate_split, x_flat, parallelism.n, 0) def _step(source_replica, target_replica, x_split, op="plus_eq"): """Helper function - one step of summing or copying. If op == "plus_eq", then adds source_replica into target_replica If op == "copy", then copies source_replica onto target_replica These operations happen for all shards. The replica numbers are offset by the shard numbers to keep all physical links busy. Args: source_replica: an integer target_replica: an integer x_split: a list of lists of tensors op: a string """ for shard in range(parallelism.n): source_device = (shard + source_replica) % parallelism.n target_device = (shard + target_replica) % parallelism.n source = x_split[source_device][shard] if use_bfloat16: with tf.device(parallelism.devices[source_device]): source = tf.to_bfloat16(source) with tf.device(parallelism.devices[target_device]): source = tf.to_float(source) if op == "plus_eq": x_split[target_device][shard] += source else: assert op == "copy" x_split[target_device][shard] = tf.identity(source) center = parallelism.n // 2 # accumulate everything towards the center. for i in reversed(range(center, parallelism.n - 1)): _step(i + 1, i, x_split, op="plus_eq") for i in range(center): _step(i, i + 1, x_split, op="plus_eq") # copy everything away from the center. for i in range(center, parallelism.n - 1): _step(i, i + 1, x_split, op="copy") for i in reversed(range(center)): _step(i + 1, i, x_split, op="copy") x_concat = parallelism(tf.concat, x_split, 0) y = parallelism(common_layers.reshape_like_all_dims, x_concat, x) if maybe_reduce: y = expand_by_device(original_parallelism, parallelism, y) return y
[ "def", "all_reduce_ring", "(", "x", ",", "parallelism", ",", "maybe_reduce", "=", "True", ",", "use_bfloat16", "=", "True", ")", ":", "if", "parallelism", ".", "n", "==", "1", ":", "return", "x", "if", "maybe_reduce", ":", "original_parallelism", "=", "parallelism", "parallelism", ",", "x", "=", "reduce_by_device", "(", "parallelism", ",", "x", ",", "tf", ".", "add_n", ")", "if", "parallelism", ".", "n", "==", "1", ":", "y", "=", "x", "else", ":", "# first shard the input:", "x_flat", "=", "parallelism", "(", "tf", ".", "reshape", ",", "x", ",", "[", "[", "-", "1", "]", "]", "*", "parallelism", ".", "n", ")", "# [device, shard]", "x_split", "=", "parallelism", "(", "common_layers", ".", "approximate_split", ",", "x_flat", ",", "parallelism", ".", "n", ",", "0", ")", "def", "_step", "(", "source_replica", ",", "target_replica", ",", "x_split", ",", "op", "=", "\"plus_eq\"", ")", ":", "\"\"\"Helper function - one step of summing or copying.\n\n If op == \"plus_eq\", then adds source_replica into target_replica\n If op == \"copy\", then copies source_replica onto target_replica\n\n These operations happen for all shards. The replica numbers are offset\n by the shard numbers to keep all physical links busy.\n\n Args:\n source_replica: an integer\n target_replica: an integer\n x_split: a list of lists of tensors\n op: a string\n \"\"\"", "for", "shard", "in", "range", "(", "parallelism", ".", "n", ")", ":", "source_device", "=", "(", "shard", "+", "source_replica", ")", "%", "parallelism", ".", "n", "target_device", "=", "(", "shard", "+", "target_replica", ")", "%", "parallelism", ".", "n", "source", "=", "x_split", "[", "source_device", "]", "[", "shard", "]", "if", "use_bfloat16", ":", "with", "tf", ".", "device", "(", "parallelism", ".", "devices", "[", "source_device", "]", ")", ":", "source", "=", "tf", ".", "to_bfloat16", "(", "source", ")", "with", "tf", ".", "device", "(", "parallelism", ".", "devices", "[", "target_device", "]", ")", ":", "source", "=", "tf", ".", "to_float", "(", "source", ")", "if", "op", "==", "\"plus_eq\"", ":", "x_split", "[", "target_device", "]", "[", "shard", "]", "+=", "source", "else", ":", "assert", "op", "==", "\"copy\"", "x_split", "[", "target_device", "]", "[", "shard", "]", "=", "tf", ".", "identity", "(", "source", ")", "center", "=", "parallelism", ".", "n", "//", "2", "# accumulate everything towards the center.", "for", "i", "in", "reversed", "(", "range", "(", "center", ",", "parallelism", ".", "n", "-", "1", ")", ")", ":", "_step", "(", "i", "+", "1", ",", "i", ",", "x_split", ",", "op", "=", "\"plus_eq\"", ")", "for", "i", "in", "range", "(", "center", ")", ":", "_step", "(", "i", ",", "i", "+", "1", ",", "x_split", ",", "op", "=", "\"plus_eq\"", ")", "# copy everything away from the center.", "for", "i", "in", "range", "(", "center", ",", "parallelism", ".", "n", "-", "1", ")", ":", "_step", "(", "i", ",", "i", "+", "1", ",", "x_split", ",", "op", "=", "\"copy\"", ")", "for", "i", "in", "reversed", "(", "range", "(", "center", ")", ")", ":", "_step", "(", "i", "+", "1", ",", "i", ",", "x_split", ",", "op", "=", "\"copy\"", ")", "x_concat", "=", "parallelism", "(", "tf", ".", "concat", ",", "x_split", ",", "0", ")", "y", "=", "parallelism", "(", "common_layers", ".", "reshape_like_all_dims", ",", "x_concat", ",", "x", ")", "if", "maybe_reduce", ":", "y", "=", "expand_by_device", "(", "original_parallelism", ",", "parallelism", ",", "y", ")", "return", "y" ]
Compute the sum of all Tensors and put the result everywhere. Assumes that the devices are connected in a ring. Args: x: a list of Tensors with length parallelism.n parallelism: a expert_utils.Parallelism object. maybe_reduce: a boolean - first reduce per device. use_bfloat16: a boolean - saves bandwidth but loses precision Returns: a list of Tensors with length parallelism.n
[ "Compute", "the", "sum", "of", "all", "Tensors", "and", "put", "the", "result", "everywhere", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L1463-L1537
train
Compute the sum of all Tensors and put the result everywhere.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0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G,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + chr(0b110111) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\x35' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11281 - 11170) + chr(0b101101 + 0o6) + chr(53) + chr(1361 - 1312), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(466 - 415) + '\065' + chr(0b101101 + 0o12), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101110 + 0o6) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + '\062' + chr(0b100100 + 0o21) + chr(2798 - 2745), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10101 + 0o36) + chr(0b110111) + chr(0b11011 + 0o25), 16834 - 16826), ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + chr(49) + chr(52) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b110110 + 0o71) + chr(65 - 14) + '\060', 40558 - 40550), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b10000 + 0o42) + chr(0b101001 + 0o11), ord("\x08")), ehT0Px3KOsy9(chr(117 - 69) + chr(7090 - 6979) + '\062' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b110011) + '\064', 0o10), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + chr(0b110011) + chr(2408 - 2357), 17002 - 16994), ehT0Px3KOsy9('\060' + chr(0b1001011 + 0o44) + chr(0b110101) + chr(963 - 912), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b101001 + 0o106) + chr(0b101111 + 0o4) + chr(1772 - 1722) + chr(2242 - 2193), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9043 - 8932) + chr(49) + chr(0b110001) + chr(52), 37074 - 37066), ehT0Px3KOsy9(chr(676 - 628) + chr(111) + '\067' + chr(1846 - 1797), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1953 - 1842) + '\x31' + chr(722 - 674) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2404 - 2353) + chr(2028 - 1977) + chr(1711 - 1661), 36878 - 36870), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(11843 - 11732) + chr(56 - 5) + chr(559 - 507) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(788 - 677) + chr(0b110001) + chr(0b1001 + 0o54) + chr(0b100100 + 0o22), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110 + 0o151) + '\061' + '\060' + chr(926 - 873), 22915 - 22907), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1011 + 0o50) + '\066' + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(3698 - 3587) + '\x35' + chr(0b11001 + 0o36), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(2057 - 2006) + chr(647 - 594) + '\062', 7684 - 7676), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b110000 + 0o1) + chr(0b110001 + 0o5), 32579 - 32571), ehT0Px3KOsy9(chr(48) + chr(4567 - 4456) + chr(0b110 + 0o54) + chr(51) + chr(49), 24580 - 24572), ehT0Px3KOsy9('\060' + chr(111) + chr(429 - 375) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + '\x32' + chr(0b110000) + chr(1103 - 1054), 20203 - 20195), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b1011 + 0o52) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + '\065' + chr(0b10 + 0o61), 8), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b110010 + 0o75) + chr(0b110011) + chr(0b110101) + '\x37', 8), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b110001) + '\064' + chr(50), 46229 - 46221), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + '\x35' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(1657 - 1609) + chr(782 - 671) + chr(51) + chr(52) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\x30' + chr(2967 - 2912), 0o10), ehT0Px3KOsy9(chr(48) + chr(8457 - 8346) + chr(0b101101 + 0o5) + '\x35' + chr(49), 51285 - 51277), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b10111 + 0o32) + chr(2682 - 2629), 0o10), ehT0Px3KOsy9(chr(278 - 230) + chr(536 - 425) + chr(605 - 555) + '\x31', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(5355 - 5244) + '\065' + chr(48), 41736 - 41728)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x15'), chr(6803 - 6703) + chr(8683 - 8582) + '\143' + '\x6f' + chr(0b111010 + 0o52) + chr(0b1000001 + 0o44))(chr(117) + chr(0b100000 + 0o124) + chr(102) + chr(45) + chr(0b11 + 0o65)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def it5pYwo4YrT9(OeWW0F1dBPRQ, LLZXD7Tzta9r, G9AXBsz4foDE=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1110 + 0o43), ord("\x08")), Urmwaz6v7XSx=ehT0Px3KOsy9(chr(1784 - 1736) + chr(9094 - 8983) + '\061', 8)): if xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xdc\xa7\x84g\xdf\x81.o+V$'), '\x64' + chr(2225 - 2124) + '\x63' + '\x6f' + '\144' + '\145')('\x75' + '\164' + chr(102) + chr(982 - 937) + '\070')) == ehT0Px3KOsy9('\060' + chr(0b11100 + 0o123) + '\x31', 8): return OeWW0F1dBPRQ if G9AXBsz4foDE: QwkGQEOkVWVA = LLZXD7Tzta9r (LLZXD7Tzta9r, OeWW0F1dBPRQ) = TohOP5jQ8TXD(LLZXD7Tzta9r, OeWW0F1dBPRQ, IDJ2eXGCBCDu.add_n) if xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xdc\xa7\x84g\xdf\x81.o+V$'), chr(6913 - 6813) + '\x65' + '\143' + chr(0b1100001 + 0o16) + chr(522 - 422) + chr(101))(chr(117) + '\x74' + chr(102) + chr(0b1110 + 0o37) + chr(0b100110 + 0o22))) == ehT0Px3KOsy9('\x30' + chr(1850 - 1739) + chr(0b110001), 8): SqiSOtYOqOJH = OeWW0F1dBPRQ else: mstS6zVd22Jf = LLZXD7Tzta9r(IDJ2eXGCBCDu.reshape, OeWW0F1dBPRQ, [[-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1939 - 1890), 8)]] * LLZXD7Tzta9r.m1NkCryOw9Bx) uP28tvcfe4xQ = LLZXD7Tzta9r(jSKPaHwSAfVv.approximate_split, mstS6zVd22Jf, LLZXD7Tzta9r.m1NkCryOw9Bx, ehT0Px3KOsy9('\x30' + '\x6f' + '\060', 9780 - 9772)) def TqJNIV_7POBe(x5xtyEiPlzQB, w9B5kTEZ94Zm, uP28tvcfe4xQ, C8dAr6Ujq2Tn=xafqLlk3kkUe(SXOLrMavuUCe(b'K\x81\x9c\x9c{\xc8\x89'), chr(100) + chr(3856 - 3755) + '\x63' + chr(1760 - 1649) + '\x64' + '\x65')(chr(117) + '\x74' + chr(102) + chr(474 - 429) + chr(56))): for pn2mJYbTTPyv in vQr8gNKaIaWE(xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xdc\xa7\x84g\xdf\x81.o+V$'), chr(0b1100100) + chr(0b111000 + 0o55) + chr(3838 - 3739) + '\157' + chr(1445 - 1345) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100 + 0o132) + chr(0b101101) + chr(1587 - 1531)))): gPN3Oz8RX552 = (pn2mJYbTTPyv + x5xtyEiPlzQB) % LLZXD7Tzta9r.m1NkCryOw9Bx jEpcGTTnvXle = (pn2mJYbTTPyv + w9B5kTEZ94Zm) % LLZXD7Tzta9r.m1NkCryOw9Bx Qas9W3D0Xbzi = uP28tvcfe4xQ[gPN3Oz8RX552][pn2mJYbTTPyv] if Urmwaz6v7XSx: with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'_\x88\x9f\x86G\xc8'), chr(8639 - 8539) + chr(1069 - 968) + chr(99) + chr(1946 - 1835) + chr(3072 - 2972) + '\x65')('\x75' + chr(0b110011 + 0o101) + chr(0b100110 + 0o100) + '\055' + '\070'))(xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'_\x88\x9f\x86G\xc8\x8b'), '\x64' + chr(0b111011 + 0o52) + chr(0b1010101 + 0o16) + '\157' + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000)))[gPN3Oz8RX552]): Qas9W3D0Xbzi = IDJ2eXGCBCDu.to_bfloat16(Qas9W3D0Xbzi) with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'_\x88\x9f\x86G\xc8'), chr(0b1100100) + '\x65' + chr(99) + chr(0b1110 + 0o141) + '\144' + chr(1364 - 1263))(chr(0b101000 + 0o115) + chr(0b1110100) + chr(102) + chr(837 - 792) + chr(1196 - 1140)))(xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'_\x88\x9f\x86G\xc8\x8b'), chr(0b1100010 + 0o2) + chr(101) + chr(0b10010 + 0o121) + chr(9786 - 9675) + chr(100) + chr(101))('\x75' + chr(0b1000110 + 0o56) + chr(0b101111 + 0o67) + chr(829 - 784) + chr(0b111000)))[jEpcGTTnvXle]): Qas9W3D0Xbzi = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(Qas9W3D0Xbzi) if C8dAr6Ujq2Tn == xafqLlk3kkUe(SXOLrMavuUCe(b'K\x81\x9c\x9c{\xc8\x89'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(0b10110 + 0o131) + chr(100) + '\x65')(chr(0b1110101) + '\x74' + chr(102) + '\055' + chr(1085 - 1029)): uP28tvcfe4xQ[jEpcGTTnvXle][pn2mJYbTTPyv] += Qas9W3D0Xbzi else: assert C8dAr6Ujq2Tn == xafqLlk3kkUe(SXOLrMavuUCe(b'X\x82\x99\x96'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\x6f' + chr(8394 - 8294) + chr(0b1010010 + 0o23))(chr(0b1110101) + chr(0b1110100) + chr(0b1100100 + 0o2) + chr(0b101101) + chr(0b100101 + 0o23)) uP28tvcfe4xQ[jEpcGTTnvXle][pn2mJYbTTPyv] = IDJ2eXGCBCDu.vFUG5mKXcvYG(Qas9W3D0Xbzi) qkYxsmydG0V_ = LLZXD7Tzta9r.m1NkCryOw9Bx // ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11110 + 0o24), 0b1000) for WVxHKyX45z_L in RFiwrCZH9Ie6(vQr8gNKaIaWE(qkYxsmydG0V_, xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xdc\xa7\x84g\xdf\x81.o+V$'), '\144' + chr(101) + '\x63' + chr(0b1010 + 0o145) + '\144' + '\x65')('\165' + chr(0b110 + 0o156) + chr(8919 - 8817) + chr(0b101101) + chr(0b111000))) - ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001), 8))): TqJNIV_7POBe(WVxHKyX45z_L + ehT0Px3KOsy9('\x30' + chr(111) + chr(1070 - 1021), 8), WVxHKyX45z_L, uP28tvcfe4xQ, op=xafqLlk3kkUe(SXOLrMavuUCe(b'K\x81\x9c\x9c{\xc8\x89'), chr(100) + chr(0b101010 + 0o73) + chr(0b11011 + 0o110) + '\x6f' + chr(0b1100100) + '\145')(chr(117) + '\164' + chr(0b1010010 + 0o24) + '\055' + '\x38')) for WVxHKyX45z_L in vQr8gNKaIaWE(qkYxsmydG0V_): TqJNIV_7POBe(WVxHKyX45z_L, WVxHKyX45z_L + ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + chr(0b110001), 8), uP28tvcfe4xQ, op=xafqLlk3kkUe(SXOLrMavuUCe(b'K\x81\x9c\x9c{\xc8\x89'), chr(7200 - 7100) + chr(101) + '\x63' + '\157' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56))) for WVxHKyX45z_L in vQr8gNKaIaWE(qkYxsmydG0V_, xafqLlk3kkUe(LLZXD7Tzta9r, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xdc\xa7\x84g\xdf\x81.o+V$'), chr(0b100100 + 0o100) + chr(0b1100101) + '\x63' + chr(11471 - 11360) + '\144' + chr(0b101101 + 0o70))('\x75' + chr(0b1110100) + chr(7616 - 7514) + chr(0b101100 + 0o1) + '\x38')) - ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1636 - 1587), 8)): TqJNIV_7POBe(WVxHKyX45z_L, WVxHKyX45z_L + ehT0Px3KOsy9(chr(0b110000) + chr(5787 - 5676) + '\061', 8), uP28tvcfe4xQ, op=xafqLlk3kkUe(SXOLrMavuUCe(b'X\x82\x99\x96'), '\144' + chr(101) + chr(99) + '\x6f' + chr(100) + '\145')('\x75' + chr(0b1110100) + '\x66' + chr(45) + '\x38')) for WVxHKyX45z_L in RFiwrCZH9Ie6(vQr8gNKaIaWE(qkYxsmydG0V_)): TqJNIV_7POBe(WVxHKyX45z_L + ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8), WVxHKyX45z_L, uP28tvcfe4xQ, op=xafqLlk3kkUe(SXOLrMavuUCe(b'X\x82\x99\x96'), chr(100) + '\x65' + chr(99) + chr(0b1010000 + 0o37) + chr(8790 - 8690) + chr(5080 - 4979))('\165' + chr(0b100011 + 0o121) + chr(102) + chr(0b101101) + '\x38')) NauyRJdldrOF = LLZXD7Tzta9r(IDJ2eXGCBCDu.concat, uP28tvcfe4xQ, ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(187 - 139), 8)) SqiSOtYOqOJH = LLZXD7Tzta9r(jSKPaHwSAfVv.reshape_like_all_dims, NauyRJdldrOF, OeWW0F1dBPRQ) if G9AXBsz4foDE: SqiSOtYOqOJH = z8nJvj8aMriZ(QwkGQEOkVWVA, LLZXD7Tzta9r, SqiSOtYOqOJH) return SqiSOtYOqOJH
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
Parallelism._maybe_repeat
def _maybe_repeat(self, x): """Utility function for processing arguments that are singletons or lists. Args: x: either a list of self.n elements, or not a list. Returns: a list of self.n elements. """ if isinstance(x, list): assert len(x) == self.n return x else: return [x] * self.n
python
def _maybe_repeat(self, x): """Utility function for processing arguments that are singletons or lists. Args: x: either a list of self.n elements, or not a list. Returns: a list of self.n elements. """ if isinstance(x, list): assert len(x) == self.n return x else: return [x] * self.n
[ "def", "_maybe_repeat", "(", "self", ",", "x", ")", ":", "if", "isinstance", "(", "x", ",", "list", ")", ":", "assert", "len", "(", "x", ")", "==", "self", ".", "n", "return", "x", "else", ":", "return", "[", "x", "]", "*", "self", ".", "n" ]
Utility function for processing arguments that are singletons or lists. Args: x: either a list of self.n elements, or not a list. Returns: a list of self.n elements.
[ "Utility", "function", "for", "processing", "arguments", "that", "are", "singletons", "or", "lists", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L251-L264
train
Utility function for processing arguments that are singletons or lists.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OT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4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(598 - 487) + chr(1663 - 1614) + chr(0b110000) + chr(0b110000), 44266 - 44258), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + '\x37' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4787 - 4676) + '\061' + '\x30' + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110101 + 0o72) + chr(51) + chr(2155 - 2102) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1001 + 0o50) + chr(54) + chr(0b101010 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(52) + chr(0b110 + 0o60), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\066' + '\062', 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(55) + '\x30', 26001 - 25993), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(554 - 503) + chr(0b110110) + chr(0b1111 + 0o44), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + '\062' + '\063' + '\067', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + '\x33' + '\062' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\060' + chr(0b110100 + 0o0), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(0b110011) + '\063' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(1857 - 1809) + '\157' + chr(0b110001) + chr(0b110001) + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\063' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(601 - 553) + '\x6f' + chr(0b110010) + chr(0b110101) + '\064', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b101110 + 0o3) + chr(48) + chr(1592 - 1538), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1590 - 1540) + chr(0b100000 + 0o27) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(2201 - 2151) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(0b100100 + 0o17) + chr(51) + chr(0b11 + 0o62), 8), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + '\x37' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(1762 - 1713) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + chr(0b10110 + 0o33) + '\064' + chr(0b10101 + 0o36), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111110 + 0o61) + '\x36' + chr(0b1001 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11111 + 0o22) + '\064' + chr(2757 - 2704), 0b1000), ehT0Px3KOsy9('\x30' + chr(9102 - 8991) + '\x34' + chr(1815 - 1763), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100100 + 0o13) + '\x32' + chr(494 - 444) + chr(0b10001 + 0o40), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10111 + 0o32) + chr(0b110110) + chr(0b101010 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(1762 - 1714) + chr(111) + chr(51) + chr(2163 - 2109) + chr(0b100 + 0o62), 0o10), ehT0Px3KOsy9(chr(1934 - 1886) + chr(0b1101111) + chr(249 - 194) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + chr(52) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\x35' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(0b100100 + 0o22), 0b1000), ehT0Px3KOsy9(chr(1270 - 1222) + chr(4561 - 4450) + chr(1635 - 1585) + chr(49) + chr(0b10101 + 0o34), 34420 - 34412), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b110011) + '\062' + chr(0b110110), 8392 - 8384), ehT0Px3KOsy9('\060' + '\157' + chr(177 - 128) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + chr(0b101010 + 0o11) + chr(1762 - 1709) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\065' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\x31', 65138 - 65130), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(54) + '\x33', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1943 - 1895) + '\x6f' + chr(0b110101) + chr(0b10011 + 0o35), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'n'), '\x64' + '\x65' + chr(0b1011 + 0o130) + '\157' + '\x64' + '\145')(chr(0b1011000 + 0o35) + chr(0b1110100) + chr(9762 - 9660) + chr(300 - 255) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def IdSdHB6R3Rnx(oVre8I6UXc3b, OeWW0F1dBPRQ): if PlSM16l2KDPD(OeWW0F1dBPRQ, YyaZ4tpXu4lf): assert c2A0yzQpDQB3(OeWW0F1dBPRQ) == xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'-\n\x0f\x847\xd4Kw\x84\xa6\x90<'), chr(3716 - 3616) + chr(101) + chr(0b10001 + 0o122) + chr(0b1010110 + 0o31) + chr(0b1100100) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b11011 + 0o113) + chr(0b101101) + '\x38')) return OeWW0F1dBPRQ else: return [OeWW0F1dBPRQ] * xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'-\n\x0f\x847\xd4Kw\x84\xa6\x90<'), chr(0b1011000 + 0o14) + chr(0b11101 + 0o110) + chr(0b10100 + 0o117) + chr(0b1101111) + chr(0b101110 + 0o66) + chr(0b11 + 0o142))(chr(667 - 550) + '\164' + chr(0b1100110) + chr(0b101101) + '\x38'))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
PadRemover.remove
def remove(self, x): """Remove padding from the given tensor. Args: x (tf.Tensor): of shape [dim_origin,...] Returns: a tensor of shape [dim_compressed,...] with dim_compressed <= dim_origin """ with tf.name_scope("pad_reduce/remove"): x_shape = x.get_shape().as_list() x = tf.gather_nd( x, indices=self.nonpad_ids, ) if not tf.executing_eagerly(): # This is a hack but for some reason, gather_nd return a tensor of # undefined shape, so the shape is set up manually x.set_shape([None] + x_shape[1:]) return x
python
def remove(self, x): """Remove padding from the given tensor. Args: x (tf.Tensor): of shape [dim_origin,...] Returns: a tensor of shape [dim_compressed,...] with dim_compressed <= dim_origin """ with tf.name_scope("pad_reduce/remove"): x_shape = x.get_shape().as_list() x = tf.gather_nd( x, indices=self.nonpad_ids, ) if not tf.executing_eagerly(): # This is a hack but for some reason, gather_nd return a tensor of # undefined shape, so the shape is set up manually x.set_shape([None] + x_shape[1:]) return x
[ "def", "remove", "(", "self", ",", "x", ")", ":", "with", "tf", ".", "name_scope", "(", "\"pad_reduce/remove\"", ")", ":", "x_shape", "=", "x", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "x", "=", "tf", ".", "gather_nd", "(", "x", ",", "indices", "=", "self", ".", "nonpad_ids", ",", ")", "if", "not", "tf", ".", "executing_eagerly", "(", ")", ":", "# This is a hack but for some reason, gather_nd return a tensor of", "# undefined shape, so the shape is set up manually", "x", ".", "set_shape", "(", "[", "None", "]", "+", "x_shape", "[", "1", ":", "]", ")", "return", "x" ]
Remove padding from the given tensor. Args: x (tf.Tensor): of shape [dim_origin,...] Returns: a tensor of shape [dim_compressed,...] with dim_compressed <= dim_origin
[ "Remove", "padding", "from", "the", "given", "tensor", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L624-L643
train
Remove padding from the given tensor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83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S,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(6365 - 6254) + chr(49) + '\x35' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9229 - 9118) + chr(0b1101 + 0o44) + chr(1291 - 1243) + chr(2299 - 2245), 0b1000), ehT0Px3KOsy9('\x30' + chr(2144 - 2033) + chr(1149 - 1099) + chr(53) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(10028 - 9917) + '\061' + chr(710 - 659) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(369 - 320) + chr(0b110111) + '\062', 6162 - 6154), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(55) + chr(0b1011 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(548 - 500) + '\x6f' + chr(0b100000 + 0o23), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(1490 - 1442) + chr(0b1101111) + '\063' + chr(53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10111 + 0o33) + chr(0b101100 + 0o6) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b110 + 0o151) + '\063' + chr(51) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(915 - 804) + '\063' + '\064' + chr(2522 - 2467), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x35' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(0b110101) + chr(1377 - 1322), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + '\061' + chr(0b101111 + 0o3), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + chr(1432 - 1382) + chr(52) + chr(0b110111), 53529 - 53521), ehT0Px3KOsy9(chr(1822 - 1774) + chr(0b1001 + 0o146) + chr(0b110010) + chr(0b11001 + 0o36) + chr(519 - 467), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(802 - 751) + chr(0b100011 + 0o24) + chr(2339 - 2287), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b110010 + 0o4) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b100100 + 0o113) + '\062' + chr(0b110011) + chr(1898 - 1846), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\067' + chr(646 - 595), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(3667 - 3556) + chr(714 - 664) + '\064' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1011011 + 0o24) + chr(0b101 + 0o54) + chr(0b110111) + chr(0b110010), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(2528 - 2473) + chr(833 - 780), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\066' + chr(492 - 444), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\x33' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110101) + chr(1975 - 1924), 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(50) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1284 - 1236) + chr(0b1101111) + '\x31' + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(6518 - 6407) + chr(52) + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1940 - 1890) + chr(49) + chr(0b100101 + 0o16), 0o10), ehT0Px3KOsy9('\060' + chr(9258 - 9147) + chr(0b110010) + chr(0b110100) + chr(1947 - 1894), 52570 - 52562), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1176 - 1123) + chr(0b111 + 0o54), 48384 - 48376), ehT0Px3KOsy9(chr(569 - 521) + chr(0b1101111) + '\x32' + chr(50) + chr(0b100000 + 0o24), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b10111 + 0o34) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(0b110011) + chr(0b1 + 0o66), 0b1000), ehT0Px3KOsy9('\060' + chr(8658 - 8547) + chr(0b110101) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101100 + 0o7) + chr(0b110101) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(52) + chr(0b101000 + 0o10), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(10139 - 10028) + chr(1333 - 1280) + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'D'), chr(6258 - 6158) + chr(0b1100101) + chr(0b10100 + 0o117) + chr(0b111001 + 0o66) + chr(2538 - 2438) + chr(101))(chr(117) + chr(0b1100011 + 0o21) + chr(1658 - 1556) + '\055' + chr(1223 - 1167)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def VyFz6vG9R56f(oVre8I6UXc3b, OeWW0F1dBPRQ): with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"\x04'\xc0>%O`o\x9c\xf3"), '\x64' + chr(0b1011110 + 0o7) + chr(0b100110 + 0o75) + '\x6f' + chr(5900 - 5800) + chr(101))(chr(11897 - 11780) + chr(2287 - 2171) + chr(102) + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\x1a'\xc9\x04\x08Ygu\x8f\xf3\xf4\x95H\t\x00<\xc2"), chr(100) + chr(101) + chr(0b1100011) + chr(111) + chr(0b111100 + 0o50) + chr(101))(chr(0b100001 + 0o124) + chr(7107 - 6991) + chr(102) + chr(45) + chr(56))): QQEXXbdZyz6m = OeWW0F1dBPRQ.get_shape().as_list() OeWW0F1dBPRQ = IDJ2eXGCBCDu.gather_nd(OeWW0F1dBPRQ, indices=oVre8I6UXc3b.nonpad_ids) if not xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f>\xc88\x0fHjn\x8b\xc9\xbe\x86J\x01\x1d&\xde'), chr(100) + chr(0b1010101 + 0o20) + chr(0b1100011) + chr(2673 - 2562) + chr(0b110110 + 0o56) + '\x65')(chr(0b1110101) + chr(3169 - 3053) + '\x66' + chr(0b10000 + 0o35) + chr(56)))(): xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x19#\xd9\x04\tTbp\x89'), chr(0b1 + 0o143) + chr(0b1100101) + chr(0b1001011 + 0o30) + '\157' + chr(0b1100100) + chr(0b1100011 + 0o2))(chr(5257 - 5140) + chr(116) + chr(102) + chr(0b10001 + 0o34) + chr(0b11111 + 0o31)))([None] + QQEXXbdZyz6m[ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(0b10010 + 0o37), 0o10):]) return OeWW0F1dBPRQ
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
PadRemover.restore
def restore(self, x): """Add padding back to the given tensor. Args: x (tf.Tensor): of shape [dim_compressed,...] Returns: a tensor of shape [dim_origin,...] with dim_compressed >= dim_origin. The dim is restored from the original reference tensor """ with tf.name_scope("pad_reduce/restore"): x = tf.scatter_nd( indices=self.nonpad_ids, updates=x, shape=tf.concat([self.dim_origin, tf.shape(x)[1:]], axis=0), ) return x
python
def restore(self, x): """Add padding back to the given tensor. Args: x (tf.Tensor): of shape [dim_compressed,...] Returns: a tensor of shape [dim_origin,...] with dim_compressed >= dim_origin. The dim is restored from the original reference tensor """ with tf.name_scope("pad_reduce/restore"): x = tf.scatter_nd( indices=self.nonpad_ids, updates=x, shape=tf.concat([self.dim_origin, tf.shape(x)[1:]], axis=0), ) return x
[ "def", "restore", "(", "self", ",", "x", ")", ":", "with", "tf", ".", "name_scope", "(", "\"pad_reduce/restore\"", ")", ":", "x", "=", "tf", ".", "scatter_nd", "(", "indices", "=", "self", ".", "nonpad_ids", ",", "updates", "=", "x", ",", "shape", "=", "tf", ".", "concat", "(", "[", "self", ".", "dim_origin", ",", "tf", ".", "shape", "(", "x", ")", "[", "1", ":", "]", "]", ",", "axis", "=", "0", ")", ",", ")", "return", "x" ]
Add padding back to the given tensor. Args: x (tf.Tensor): of shape [dim_compressed,...] Returns: a tensor of shape [dim_origin,...] with dim_compressed >= dim_origin. The dim is restored from the original reference tensor
[ "Add", "padding", "back", "to", "the", "given", "tensor", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L645-L661
train
Adds padding back to the given tensor.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3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + chr(2324 - 2275), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(929 - 818) + chr(0b1011 + 0o51) + chr(0b100110 + 0o15), 45875 - 45867), ehT0Px3KOsy9('\x30' + chr(0b110111 + 0o70) + chr(50) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101100 + 0o7) + chr(594 - 544) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(2664 - 2553) + '\061' + '\x32' + '\x32', 53954 - 53946), ehT0Px3KOsy9(chr(889 - 841) + chr(0b1101111) + chr(0b11101 + 0o26) + chr(0b10101 + 0o37) + chr(1886 - 1831), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\x36' + chr(1458 - 1405), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(984 - 931) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(1868 - 1757) + '\x32' + chr(0b110101) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7854 - 7743) + chr(0b110010) + chr(2243 - 2195) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(2110 - 2058) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b101000 + 0o107) + chr(0b110001) + chr(1778 - 1727) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(50) + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(8037 - 7926) + chr(51) + chr(234 - 185) + chr(1483 - 1431), 23985 - 23977), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + chr(51) + chr(0b110110) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(0b110010) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b111000 + 0o67) + '\x33' + '\061' + '\063', 31771 - 31763), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + '\x31' + chr(0b11101 + 0o24) + chr(0b11001 + 0o34), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(53) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(1814 - 1703) + '\x32' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1644 - 1596) + '\x6f' + '\061' + chr(0b101000 + 0o11) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(960 - 912) + chr(0b1101110 + 0o1) + chr(0b110001) + chr(0b101100 + 0o6) + chr(780 - 732), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(51) + chr(2112 - 2060), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\x36', 11647 - 11639), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\060' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(473 - 423) + chr(50), 8), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + '\x32' + chr(51), 18815 - 18807), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + '\063' + chr(551 - 503), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b110111) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100101 + 0o12) + '\061' + chr(2472 - 2417) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + chr(50) + chr(51) + chr(50), 30556 - 30548), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + '\x33', 8), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(0b110010) + '\x30' + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b1110 + 0o44) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(1258 - 1205) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(2009 - 1961) + chr(0b1001000 + 0o47) + chr(0b110010) + chr(2090 - 2037) + chr(1342 - 1287), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\066' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + '\063' + chr(0b110001) + chr(0b110111), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b101011 + 0o104) + chr(53) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'/'), '\144' + chr(5328 - 5227) + chr(6557 - 6458) + chr(5831 - 5720) + chr(3283 - 3183) + chr(101))(chr(0b110111 + 0o76) + chr(0b1110100) + '\x66' + chr(0b1010 + 0o43) + chr(1617 - 1561)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Z4YDSWFz1Gfu(oVre8I6UXc3b, OeWW0F1dBPRQ): with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'oBy\xb2\r\x94\x16\xc4\xdc\xe5'), chr(5400 - 5300) + '\x65' + chr(0b10011 + 0o120) + chr(0b1011011 + 0o24) + '\144' + chr(0b1100100 + 0o1))('\165' + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b10 + 0o66)))(xafqLlk3kkUe(SXOLrMavuUCe(b'qBp\x88 \x82\x11\xde\xcf\xe5\xcd(\xb0\xbf\x80\xfa\xb9('), chr(0b101101 + 0o67) + '\145' + chr(7984 - 7885) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(0b1101001 + 0o14) + chr(0b1010000 + 0o44) + chr(102) + chr(0b11100 + 0o21) + chr(3123 - 3067))): OeWW0F1dBPRQ = IDJ2eXGCBCDu.scatter_nd(indices=oVre8I6UXc3b.nonpad_ids, updates=OeWW0F1dBPRQ, shape=IDJ2eXGCBCDu.concat([oVre8I6UXc3b.dim_origin, IDJ2eXGCBCDu.nauYfLglTpcb(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(1613 - 1565) + chr(0b100000 + 0o117) + chr(1197 - 1148), 8):]], axis=ehT0Px3KOsy9(chr(48) + '\157' + '\x30', 0o10))) return OeWW0F1dBPRQ
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
SparseDispatcher.dispatch
def dispatch(self, inp): """Create one input Tensor for each expert. The `Tensor` for a expert `i` contains the slices of `inp` corresponding to the batch elements `b` where `gates[b, i] > 0`. Args: inp: a `Tensor` of shape "[batch_size, <extra_input_dims>]` Returns: a list of `num_experts` `Tensor`s with shapes `[expert_batch_size_i, <extra_input_dims>]`. """ inp = tf.gather(inp, self._batch_index) return tf.split(inp, self._part_sizes_tensor, 0, num=self._num_experts)
python
def dispatch(self, inp): """Create one input Tensor for each expert. The `Tensor` for a expert `i` contains the slices of `inp` corresponding to the batch elements `b` where `gates[b, i] > 0`. Args: inp: a `Tensor` of shape "[batch_size, <extra_input_dims>]` Returns: a list of `num_experts` `Tensor`s with shapes `[expert_batch_size_i, <extra_input_dims>]`. """ inp = tf.gather(inp, self._batch_index) return tf.split(inp, self._part_sizes_tensor, 0, num=self._num_experts)
[ "def", "dispatch", "(", "self", ",", "inp", ")", ":", "inp", "=", "tf", ".", "gather", "(", "inp", ",", "self", ".", "_batch_index", ")", "return", "tf", ".", "split", "(", "inp", ",", "self", ".", "_part_sizes_tensor", ",", "0", ",", "num", "=", "self", ".", "_num_experts", ")" ]
Create one input Tensor for each expert. The `Tensor` for a expert `i` contains the slices of `inp` corresponding to the batch elements `b` where `gates[b, i] > 0`. Args: inp: a `Tensor` of shape "[batch_size, <extra_input_dims>]` Returns: a list of `num_experts` `Tensor`s with shapes `[expert_batch_size_i, <extra_input_dims>]`.
[ "Create", "one", "input", "Tensor", "for", "each", "expert", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L794-L807
train
Create one input Tensor for each expert.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej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9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\061' + chr(0b100 + 0o61) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + chr(2297 - 2248) + chr(2126 - 2075) + chr(0b10111 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(0b100 + 0o56) + '\062', 57228 - 57220), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b111 + 0o54) + chr(53) + chr(200 - 146), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b100000 + 0o26) + chr(0b100001 + 0o23), 28082 - 28074), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001 + 0o0) + chr(0b11010 + 0o34) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(51) + chr(49) + chr(922 - 869), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1560 - 1510) + chr(0b10 + 0o61) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + '\x37' + chr(0b101 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9498 - 9387) + '\x33' + chr(0b11101 + 0o32) + '\x33', 0b1000), ehT0Px3KOsy9(chr(792 - 744) + chr(4675 - 4564) + chr(49) + chr(50) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + chr(0b11000 + 0o31) + chr(53), 762 - 754), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b11000 + 0o31) + chr(49), 29471 - 29463), ehT0Px3KOsy9('\x30' + chr(111) + chr(244 - 193) + '\x33' + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\064' + chr(49), 8990 - 8982), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(6070 - 5959) + chr(1683 - 1634) + chr(49) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(0b110000 + 0o2) + '\x30' + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7889 - 7778) + '\x33' + '\x37', 0o10), ehT0Px3KOsy9(chr(552 - 504) + chr(111) + '\062' + chr(51) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + '\x32' + chr(0b110010) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(1614 - 1562) + chr(53), 20227 - 20219), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b100100 + 0o22) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36' + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1610 - 1561) + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(1168 - 1118) + chr(947 - 895) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(9183 - 9072) + '\061' + chr(0b110010) + chr(0b110000), 32327 - 32319), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + '\067', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1000 + 0o51) + '\061' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(1431 - 1381) + '\063' + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x37' + '\065', 8), ehT0Px3KOsy9(chr(1692 - 1644) + chr(0b11000 + 0o127) + chr(50) + chr(0b1110 + 0o45) + chr(0b10 + 0o57), 0o10), ehT0Px3KOsy9(chr(48) + chr(8905 - 8794) + chr(0b110011 + 0o0) + chr(52) + chr(2526 - 2474), 0b1000), ehT0Px3KOsy9('\x30' + chr(10747 - 10636) + chr(0b10 + 0o60) + chr(0b110010) + '\067', 44491 - 44483), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(716 - 668) + chr(0b1011 + 0o47), 52538 - 52530), ehT0Px3KOsy9(chr(251 - 203) + chr(7912 - 7801) + '\x32' + '\065' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\x33' + '\067', 46447 - 46439), ehT0Px3KOsy9('\060' + chr(3020 - 2909) + chr(1582 - 1531) + chr(950 - 902) + chr(53), 18720 - 18712), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(55) + chr(0b1000 + 0o53), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b101101 + 0o4) + chr(414 - 359) + chr(0b110011), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'@'), '\144' + chr(0b1100101) + chr(7257 - 7158) + '\157' + chr(4884 - 4784) + '\145')(chr(0b1001 + 0o154) + chr(116) + chr(102) + '\x2d' + chr(568 - 512)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def UlFo0iP69moK(oVre8I6UXc3b, _axPQ91Y6C0x): _axPQ91Y6C0x = IDJ2eXGCBCDu.kGr_8mTaGpVE(_axPQ91Y6C0x, oVre8I6UXc3b._batch_index) return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d/~\x87\x00'), chr(0b11001 + 0o113) + chr(3922 - 3821) + chr(0b1100011) + '\157' + '\144' + '\145')(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b1 + 0o54) + chr(2232 - 2176)))(_axPQ91Y6C0x, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'1/s\x9c\x00+\xbe\xf7\x07\x9e&R\xbd\xbd\xcf?\xe9m'), chr(0b1000 + 0o134) + chr(101) + chr(0b1100011) + '\157' + '\x64' + chr(0b1100101))(chr(0b1110000 + 0o5) + '\164' + chr(102) + chr(0b101101) + '\x38')), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\060', 0b1000), num=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'11g\x83+\x11\xb5\xee\x18\x89!~'), '\x64' + chr(0b101111 + 0o66) + chr(0b1010 + 0o131) + '\x6f' + chr(0b1100100 + 0o0) + chr(0b1100101))('\x75' + chr(116) + chr(0b1010011 + 0o23) + chr(0b101101) + chr(854 - 798))))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
SparseDispatcher.combine
def combine(self, expert_out, multiply_by_gates=True): """Sum together the expert output, weighted by the gates. The slice corresponding to a particular batch element `b` is computed as the sum over all experts `i` of the expert output, weighted by the corresponding gate values. If `multiply_by_gates` is set to False, the gate values are ignored. Args: expert_out: a list of `num_experts` `Tensor`s, each with shape `[expert_batch_size_i, <extra_output_dims>]`. multiply_by_gates: a boolean Returns: a `Tensor` with shape `[batch_size, <extra_output_dims>]`. """ # see comments on convert_gradient_to_tensor stitched = common_layers.convert_gradient_to_tensor( tf.concat(expert_out, 0)) if multiply_by_gates: stitched *= tf.expand_dims(self._nonzero_gates, 1) combined = tf.unsorted_segment_sum(stitched, self._batch_index, tf.shape(self._gates)[0]) return combined
python
def combine(self, expert_out, multiply_by_gates=True): """Sum together the expert output, weighted by the gates. The slice corresponding to a particular batch element `b` is computed as the sum over all experts `i` of the expert output, weighted by the corresponding gate values. If `multiply_by_gates` is set to False, the gate values are ignored. Args: expert_out: a list of `num_experts` `Tensor`s, each with shape `[expert_batch_size_i, <extra_output_dims>]`. multiply_by_gates: a boolean Returns: a `Tensor` with shape `[batch_size, <extra_output_dims>]`. """ # see comments on convert_gradient_to_tensor stitched = common_layers.convert_gradient_to_tensor( tf.concat(expert_out, 0)) if multiply_by_gates: stitched *= tf.expand_dims(self._nonzero_gates, 1) combined = tf.unsorted_segment_sum(stitched, self._batch_index, tf.shape(self._gates)[0]) return combined
[ "def", "combine", "(", "self", ",", "expert_out", ",", "multiply_by_gates", "=", "True", ")", ":", "# see comments on convert_gradient_to_tensor", "stitched", "=", "common_layers", ".", "convert_gradient_to_tensor", "(", "tf", ".", "concat", "(", "expert_out", ",", "0", ")", ")", "if", "multiply_by_gates", ":", "stitched", "*=", "tf", ".", "expand_dims", "(", "self", ".", "_nonzero_gates", ",", "1", ")", "combined", "=", "tf", ".", "unsorted_segment_sum", "(", "stitched", ",", "self", ".", "_batch_index", ",", "tf", ".", "shape", "(", "self", ".", "_gates", ")", "[", "0", "]", ")", "return", "combined" ]
Sum together the expert output, weighted by the gates. The slice corresponding to a particular batch element `b` is computed as the sum over all experts `i` of the expert output, weighted by the corresponding gate values. If `multiply_by_gates` is set to False, the gate values are ignored. Args: expert_out: a list of `num_experts` `Tensor`s, each with shape `[expert_batch_size_i, <extra_output_dims>]`. multiply_by_gates: a boolean Returns: a `Tensor` with shape `[batch_size, <extra_output_dims>]`.
[ "Sum", "together", "the", "expert", "output", "weighted", "by", "the", "gates", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L810-L833
train
Sum together the expert output with the gates.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,j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ef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1566 - 1518) + chr(0b1101111) + chr(0b110010) + chr(54) + chr(628 - 575), ord("\x08")), ehT0Px3KOsy9(chr(555 - 507) + '\x6f' + '\062' + chr(52) + chr(822 - 768), 0b1000), ehT0Px3KOsy9(chr(545 - 497) + chr(5821 - 5710) + '\x32' + '\x36' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(1899 - 1851) + '\157' + chr(0b110001) + '\x30' + chr(0b11100 + 0o30), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11000 + 0o31) + '\x32' + chr(0b11001 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(5015 - 4904) + chr(0b1110 + 0o44) + chr(50) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8819 - 8708) + '\x35' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1520 - 1469) + chr(0b110100) + chr(0b100 + 0o56), 34253 - 34245), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2399 - 2350) + '\x36' + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10101 + 0o42) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001 + 0o4), 0b1000), ehT0Px3KOsy9(chr(358 - 310) + chr(111) + chr(0b101111 + 0o3) + chr(1176 - 1122) + chr(2897 - 2843), 8), ehT0Px3KOsy9(chr(0b110000) + chr(10708 - 10597) + '\066' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(2496 - 2446) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9749 - 9638) + chr(0b110001) + chr(0b11010 + 0o32), 20392 - 20384), ehT0Px3KOsy9(chr(2008 - 1960) + '\x6f' + '\062' + '\066' + chr(1254 - 1206), 0b1000), ehT0Px3KOsy9(chr(1412 - 1364) + chr(111) + '\x32' + chr(53) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1000 + 0o53) + '\x32' + chr(1219 - 1171), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1100 + 0o47) + chr(627 - 579) + '\061', 59373 - 59365), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b110000), 19692 - 19684), ehT0Px3KOsy9(chr(2008 - 1960) + chr(0b1010000 + 0o37) + chr(1359 - 1309) + '\060' + chr(0b110 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8058 - 7947) + chr(2333 - 2283) + chr(0b100011 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010000 + 0o37) + chr(0b110010) + '\063' + '\x35', 0o10), ehT0Px3KOsy9(chr(501 - 453) + chr(0b1101111) + chr(0b1001 + 0o51) + chr(0b110011) + chr(0b10100 + 0o41), 8), ehT0Px3KOsy9(chr(1108 - 1060) + '\157' + '\x32' + '\x33' + chr(55), 0o10), ehT0Px3KOsy9(chr(460 - 412) + chr(111) + chr(54) + chr(49), 0o10), ehT0Px3KOsy9(chr(1884 - 1836) + '\x6f' + '\x32' + chr(0b11111 + 0o23), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1944 - 1894) + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b110000) + chr(1539 - 1487), 52760 - 52752), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10001 + 0o42) + '\x33' + chr(0b11100 + 0o24), 6841 - 6833), ehT0Px3KOsy9(chr(673 - 625) + chr(111) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(55) + chr(0b110000), 19989 - 19981), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1646 - 1596) + chr(0b110111) + chr(0b1100 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3552 - 3441) + chr(0b110001) + '\064' + chr(0b11111 + 0o26), 0b1000), ehT0Px3KOsy9('\060' + chr(11145 - 11034) + chr(0b110010) + chr(0b101011 + 0o13) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100 + 0o153) + chr(1632 - 1581) + '\061' + chr(1013 - 963), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\065' + '\x37', 9238 - 9230), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + chr(51) + chr(1599 - 1546), ord("\x08")), ehT0Px3KOsy9(chr(941 - 893) + chr(0b1101100 + 0o3) + chr(0b110010) + chr(0b110010) + chr(48), 58279 - 58271)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b100110 + 0o111) + '\065' + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b'), chr(100) + chr(101) + chr(3826 - 3727) + chr(9472 - 9361) + '\x64' + chr(9215 - 9114))('\165' + chr(9996 - 9880) + chr(8489 - 8387) + chr(45) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Gz4N6zeeyqgm(oVre8I6UXc3b, NcEKgwXVRbyx, C36Uw3aClJyQ=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(687 - 638), 0o10)): LbrpbWSOWE6i = jSKPaHwSAfVv.convert_gradient_to_tensor(IDJ2eXGCBCDu.concat(NcEKgwXVRbyx, ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(48), 0o10))) if C36Uw3aClJyQ: LbrpbWSOWE6i *= IDJ2eXGCBCDu.expand_dims(oVre8I6UXc3b._nonzero_gates, ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49), 8)) xMNXHLn0_u2b = IDJ2eXGCBCDu.unsorted_segment_sum(LbrpbWSOWE6i, oVre8I6UXc3b._batch_index, IDJ2eXGCBCDu.nauYfLglTpcb(oVre8I6UXc3b._gates)[ehT0Px3KOsy9(chr(668 - 620) + chr(111) + chr(0b110000), 8)]) return xMNXHLn0_u2b
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
SparseDispatcher.expert_to_gates
def expert_to_gates(self): """Gate values corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s with type `tf.float32` and shapes `[expert_batch_size_i]` """ return tf.split( self._nonzero_gates, self._part_sizes_tensor, 0, num=self._num_experts)
python
def expert_to_gates(self): """Gate values corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s with type `tf.float32` and shapes `[expert_batch_size_i]` """ return tf.split( self._nonzero_gates, self._part_sizes_tensor, 0, num=self._num_experts)
[ "def", "expert_to_gates", "(", "self", ")", ":", "return", "tf", ".", "split", "(", "self", ".", "_nonzero_gates", ",", "self", ".", "_part_sizes_tensor", ",", "0", ",", "num", "=", "self", ".", "_num_experts", ")" ]
Gate values corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s with type `tf.float32` and shapes `[expert_batch_size_i]`
[ "Gate", "values", "corresponding", "to", "the", "examples", "in", "the", "per", "-", "expert", "Tensor", "s", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L835-L843
train
Returns a list of tensors corresponding to the examples in the per - expert Tensor s.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V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8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b11010 + 0o34) + chr(2324 - 2270), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11001 + 0o32) + chr(525 - 473) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11000 + 0o35) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + '\x33' + chr(0b110110) + '\x32', 0o10), ehT0Px3KOsy9(chr(557 - 509) + chr(111) + chr(233 - 184) + chr(0b110110) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7976 - 7865) + chr(1874 - 1823) + chr(0b110101) + chr(48), 18043 - 18035), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10011 + 0o36) + chr(0b11001 + 0o32) + '\x35', 12104 - 12096), ehT0Px3KOsy9('\060' + chr(5108 - 4997) + chr(50) + chr(0b110100) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101000 + 0o7) + '\x33' + chr(0b110000 + 0o1) + '\x33', 39159 - 39151), ehT0Px3KOsy9('\x30' + chr(8203 - 8092) + '\x33' + chr(100 - 45) + chr(2144 - 2090), 39166 - 39158), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(0b1000 + 0o53) + chr(143 - 93) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\064' + chr(55), 46794 - 46786), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + '\061' + chr(1511 - 1463), 54029 - 54021), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1010101 + 0o32) + chr(728 - 678) + chr(622 - 574) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101001 + 0o6) + '\x33' + '\x31' + '\063', 8), ehT0Px3KOsy9(chr(713 - 665) + chr(111) + '\x33' + '\x32' + chr(1717 - 1667), 52727 - 52719), ehT0Px3KOsy9('\x30' + chr(1649 - 1538) + chr(50) + chr(0b110000) + chr(370 - 317), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2592 - 2541) + chr(2182 - 2130) + chr(0b101 + 0o53), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + chr(0b10101 + 0o35) + chr(0b11001 + 0o34) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000111 + 0o50) + chr(2353 - 2303) + chr(179 - 129) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(55) + chr(1379 - 1330), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101010 + 0o10) + chr(1089 - 1040) + '\x31', 61623 - 61615), ehT0Px3KOsy9('\x30' + chr(0b110011 + 0o74) + chr(1436 - 1387) + chr(0b110010) + chr(2612 - 2558), 0b1000), ehT0Px3KOsy9(chr(697 - 649) + chr(0b1001 + 0o146) + '\x34' + chr(0b10010 + 0o42), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(55) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + '\x31' + chr(0b110001) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1110 + 0o43) + chr(48) + chr(50), 0o10), ehT0Px3KOsy9(chr(2196 - 2148) + chr(0b11001 + 0o126) + chr(0b110010) + '\067' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(2079 - 2031) + chr(10157 - 10046) + '\x31' + chr(1917 - 1865) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(923 - 875), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1143 - 1092) + '\063' + chr(0b110010), 11303 - 11295), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + '\x31' + chr(0b11100 + 0o26) + chr(0b10010 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110011) + chr(50) + chr(0b10011 + 0o44), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\062' + chr(53), 0b1000), ehT0Px3KOsy9(chr(893 - 845) + '\157' + chr(1186 - 1137) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\x32' + '\061' + chr(1403 - 1349), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11 + 0o60) + chr(0b110000) + chr(2053 - 2004), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000), 49278 - 49270), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110100) + chr(52), 8), ehT0Px3KOsy9('\x30' + chr(5695 - 5584) + chr(50) + '\x35' + chr(0b110011), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(10895 - 10784) + chr(0b110101) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'X'), chr(6811 - 6711) + chr(101) + chr(9319 - 9220) + chr(0b1101111) + chr(100) + '\145')(chr(0b1110101) + chr(7869 - 7753) + chr(0b1010001 + 0o25) + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def AGtEjtTaW8hS(oVre8I6UXc3b): return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\x90E\x9b\x05'), '\144' + chr(5668 - 5567) + chr(99) + chr(0b1101111) + '\x64' + '\145')(chr(531 - 414) + chr(9431 - 9315) + '\x66' + chr(0b10011 + 0o32) + chr(2333 - 2277)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b')\x8eF\x9c\x0b\x8d/\xcf\x94\x99\xb6\x93m\xf5'), '\x64' + chr(101) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(101))(chr(117) + chr(116) + '\x66' + chr(0b101101) + chr(0b111000))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b')\x90H\x80\x05\xb7.\xc9\xb1\x9b\xa4\xb8|\xe3\xa5\xa1\xea\x92'), chr(100) + '\x65' + chr(99) + chr(3013 - 2902) + chr(0b1010001 + 0o23) + chr(9008 - 8907))('\x75' + chr(0b1010110 + 0o36) + '\x66' + chr(45) + '\070')), ehT0Px3KOsy9(chr(2179 - 2131) + '\x6f' + chr(48), 8), num=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b')\x8e\\\x9f.\x8d%\xd0\xae\x8c\xa3\x94'), '\144' + '\x65' + '\x63' + '\157' + '\x64' + '\145')(chr(0b1110101) + chr(116) + '\146' + '\x2d' + chr(1735 - 1679))))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
SparseDispatcher.expert_to_batch_indices
def expert_to_batch_indices(self): """Batch indices corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s with type `tf.int64` and shapes `[expert_batch_size_i]` """ return tf.split( self._batch_index, self._part_sizes_tensor, 0, num=self._num_experts)
python
def expert_to_batch_indices(self): """Batch indices corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s with type `tf.int64` and shapes `[expert_batch_size_i]` """ return tf.split( self._batch_index, self._part_sizes_tensor, 0, num=self._num_experts)
[ "def", "expert_to_batch_indices", "(", "self", ")", ":", "return", "tf", ".", "split", "(", "self", ".", "_batch_index", ",", "self", ".", "_part_sizes_tensor", ",", "0", ",", "num", "=", "self", ".", "_num_experts", ")" ]
Batch indices corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s with type `tf.int64` and shapes `[expert_batch_size_i]`
[ "Batch", "indices", "corresponding", "to", "the", "examples", "in", "the", "per", "-", "expert", "Tensor", "s", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L845-L853
train
Returns a list of batch indices corresponding to the examples in the per - expert Tensor s.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,y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UdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + chr(51) + chr(49), 37789 - 37781), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + '\065' + chr(57 - 4), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + '\065' + chr(0b110111), 44982 - 44974), ehT0Px3KOsy9(chr(1042 - 994) + chr(12097 - 11986) + chr(50) + '\x35' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(4757 - 4646) + chr(49) + chr(0b101101 + 0o7) + chr(0b110110), 19273 - 19265), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(1999 - 1948) + '\x35' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(0b110111) + chr(1841 - 1793), 4640 - 4632), ehT0Px3KOsy9('\060' + chr(0b100111 + 0o110) + '\062' + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + chr(425 - 374) + chr(50) + chr(2121 - 2073), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100101 + 0o16) + chr(0b10001 + 0o40) + chr(0b110101), 57524 - 57516), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\066' + '\x31', 19965 - 19957), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(51) + chr(0b110100) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(359 - 311) + '\x6f' + chr(50) + '\064' + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100011 + 0o23) + chr(1796 - 1746), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8384 - 8273) + chr(0b101 + 0o60) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7259 - 7148) + chr(0b1111 + 0o44) + '\066' + chr(0b100001 + 0o20), 29683 - 29675), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(2129 - 2076) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1510 - 1460) + chr(0b110111) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2292 - 2243) + '\x30' + '\060', 0b1000), ehT0Px3KOsy9(chr(394 - 346) + chr(0b1101111) + chr(50) + chr(715 - 666) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + '\063' + chr(48) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(3324 - 3213) + chr(0b1100 + 0o45) + '\067' + '\x32', 20124 - 20116), ehT0Px3KOsy9(chr(48) + chr(0b1100010 + 0o15) + '\061' + chr(0b11100 + 0o25) + chr(2575 - 2523), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2297 - 2246) + '\063' + chr(0b11001 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1000 + 0o147) + '\066', 64212 - 64204), ehT0Px3KOsy9('\x30' + chr(111) + chr(52), 58118 - 58110), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b110101) + chr(2076 - 2025), 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + '\063' + chr(0b110100) + chr(0b110111), 23877 - 23869), ehT0Px3KOsy9(chr(746 - 698) + chr(0b100100 + 0o113) + chr(0b110010) + chr(795 - 742) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(10563 - 10452) + '\x32' + chr(749 - 701), 0o10), ehT0Px3KOsy9(chr(1047 - 999) + '\x6f' + '\065' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1647 - 1599) + '\157' + '\x34' + chr(0b111 + 0o53), 7282 - 7274), ehT0Px3KOsy9(chr(1882 - 1834) + '\x6f' + '\063' + chr(233 - 180) + chr(53), 8), ehT0Px3KOsy9(chr(932 - 884) + chr(0b11 + 0o154) + '\063' + chr(0b110010) + '\064', 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + chr(0b10010 + 0o40) + chr(0b100000 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\061' + chr(0b11100 + 0o25) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + '\061' + chr(1838 - 1790) + chr(600 - 551), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + '\x31' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1000011 + 0o54) + chr(0b101010 + 0o13) + chr(0b111 + 0o56), 8), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(4947 - 4836) + '\x33' + chr(51) + '\065', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(1129 - 1076) + chr(0b101111 + 0o1), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'7'), chr(1261 - 1161) + chr(0b1100101) + '\x63' + chr(4919 - 4808) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(116) + '\x66' + '\055' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def o9jdJmxIBLvc(oVre8I6UXc3b): return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'j]C\xc0\x12'), chr(100) + chr(0b1011101 + 0o10) + '\x63' + chr(111) + chr(0b1100100) + chr(861 - 760))(chr(0b1110101) + '\x74' + chr(0b1100110) + '\x2d' + '\070'))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'FON\xdd\x05\x85g\xfd\xbe\xa9\x14\x9d'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(100) + '\x65')('\x75' + chr(116) + '\146' + '\x2d' + chr(56))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'F]N\xdb\x12\xb2K\xfd\xaa\xa8\x02\xba\xd2WG\x82\xc5\xc8'), chr(9622 - 9522) + '\145' + '\143' + '\157' + chr(7782 - 7682) + '\x65')('\x75' + '\164' + chr(0b1100110) + chr(0b101101) + chr(56))), ehT0Px3KOsy9(chr(0b110000) + chr(10261 - 10150) + chr(1824 - 1776), 0o10), num=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'FCZ\xc49\x88@\xe4\xb5\xbf\x05\x96'), '\x64' + '\x65' + chr(99) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(6990 - 6888) + chr(0b10011 + 0o32) + chr(0b100101 + 0o23))))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
DistributedSparseDispatcher.dispatch
def dispatch(self, inp): """Create one input Tensor for each expert. Args: inp: a list of length num_datashards `Tensor`s with shapes `[batch_size[d], <extra_input_dims>]`. Returns: a list of `num_experts` `Tensor`s with shapes `[num_examples[i], <extra_input_dims>]`. """ dispatched = self._dp(lambda a, b: a.dispatch(b), self._dispatchers, inp) ret = self._ep(tf.concat, transpose_list_of_lists(dispatched), 0) if ret[0].dtype == tf.float32: # see comments on common_layers.convert_gradient_to_tensor ret = self._ep(common_layers.convert_gradient_to_tensor, ret) return ret
python
def dispatch(self, inp): """Create one input Tensor for each expert. Args: inp: a list of length num_datashards `Tensor`s with shapes `[batch_size[d], <extra_input_dims>]`. Returns: a list of `num_experts` `Tensor`s with shapes `[num_examples[i], <extra_input_dims>]`. """ dispatched = self._dp(lambda a, b: a.dispatch(b), self._dispatchers, inp) ret = self._ep(tf.concat, transpose_list_of_lists(dispatched), 0) if ret[0].dtype == tf.float32: # see comments on common_layers.convert_gradient_to_tensor ret = self._ep(common_layers.convert_gradient_to_tensor, ret) return ret
[ "def", "dispatch", "(", "self", ",", "inp", ")", ":", "dispatched", "=", "self", ".", "_dp", "(", "lambda", "a", ",", "b", ":", "a", ".", "dispatch", "(", "b", ")", ",", "self", ".", "_dispatchers", ",", "inp", ")", "ret", "=", "self", ".", "_ep", "(", "tf", ".", "concat", ",", "transpose_list_of_lists", "(", "dispatched", ")", ",", "0", ")", "if", "ret", "[", "0", "]", ".", "dtype", "==", "tf", ".", "float32", ":", "# see comments on common_layers.convert_gradient_to_tensor", "ret", "=", "self", ".", "_ep", "(", "common_layers", ".", "convert_gradient_to_tensor", ",", "ret", ")", "return", "ret" ]
Create one input Tensor for each expert. Args: inp: a list of length num_datashards `Tensor`s with shapes `[batch_size[d], <extra_input_dims>]`. Returns: a list of `num_experts` `Tensor`s with shapes `[num_examples[i], <extra_input_dims>]`.
[ "Create", "one", "input", "Tensor", "for", "each", "expert", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L890-L905
train
Dispatches the input tensor inp and returns a list of num_experts Tensors with shapes [ batch_size num_examples ].
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQ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CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x35' + chr(0b0 + 0o65), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(477 - 427) + chr(2416 - 2362) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000 + 0o6) + chr(1731 - 1676), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + '\063' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1788 - 1737) + '\x31' + chr(48), 2266 - 2258), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b101100 + 0o13) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(1833 - 1784), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\065' + chr(0b10100 + 0o35), 0b1000), ehT0Px3KOsy9('\x30' + chr(10078 - 9967) + chr(0b110001) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + '\062' + chr(874 - 824) + chr(1294 - 1239), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(252 - 199) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(1655 - 1607) + chr(0b1101111) + chr(0b101 + 0o56) + chr(50) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(2936 - 2825) + chr(1516 - 1467), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\066' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(326 - 277) + chr(1120 - 1066) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b10001 + 0o136) + chr(0b10 + 0o61) + '\064' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\x31' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(51) + chr(0b11001 + 0o30) + '\x35', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x37' + chr(49), 6358 - 6350), ehT0Px3KOsy9(chr(0b110000) + chr(7374 - 7263) + '\x32' + '\x33' + chr(49), 33828 - 33820), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x33' + chr(1008 - 953), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\x32' + chr(304 - 253), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(8913 - 8802) + chr(1628 - 1579) + chr(51) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10883 - 10772) + '\063' + chr(293 - 244) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(4083 - 3972) + '\063' + chr(51) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(2097 - 2049) + chr(0b10100 + 0o133) + '\x33' + chr(0b1101 + 0o45) + '\x36', 42464 - 42456), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b11000 + 0o127) + chr(0b101111 + 0o4) + chr(0b110110), 12827 - 12819), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b100001 + 0o20) + chr(1179 - 1131), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(0b1101 + 0o50) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + chr(0b0 + 0o61), 8), ehT0Px3KOsy9('\x30' + chr(196 - 85) + chr(50) + chr(2430 - 2378) + '\x32', 39697 - 39689), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + chr(0b110010) + chr(0b101010 + 0o13) + '\x37', 37826 - 37818), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1590 - 1539) + chr(0b110001 + 0o1), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011 + 0o144) + chr(1419 - 1370) + chr(1436 - 1387) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + chr(49) + chr(1263 - 1211) + chr(1714 - 1659), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110111) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(128 - 73), 0o10), ehT0Px3KOsy9(chr(2235 - 2187) + chr(0b1001 + 0o146) + chr(0b110001) + '\x34' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\063' + '\x31' + chr(2547 - 2495), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b1111 + 0o41) + chr(0b110111), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + chr(1891 - 1843), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'C'), chr(100) + chr(0b1011 + 0o132) + chr(99) + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(9985 - 9868) + chr(0b1001 + 0o153) + '\146' + chr(0b100100 + 0o11) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def UlFo0iP69moK(oVre8I6UXc3b, _axPQ91Y6C0x): VhIKETXngdym = oVre8I6UXc3b._dp(lambda XPh1qbAgrPgG, wmN3dvez4qzC: XPh1qbAgrPgG.dispatch(wmN3dvez4qzC), oVre8I6UXc3b._dispatchers, _axPQ91Y6C0x) VHn4CV4Ymrei = oVre8I6UXc3b._ep(IDJ2eXGCBCDu.concat, NPkENjTuhYUz(VhIKETXngdym), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\060', 0b1000)) if xafqLlk3kkUe(VHn4CV4Ymrei[ehT0Px3KOsy9('\060' + chr(4550 - 4439) + '\060', 8)], xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\xe4a\xa5\x81\xb7\x7f\x8cd\xdf\x1c\x99'), '\144' + chr(3913 - 3812) + '\143' + '\157' + '\144' + chr(0b1100101))(chr(0b1001111 + 0o46) + chr(116) + chr(0b1100110) + '\055' + chr(0b111000))) == xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xdbX\xfd\xbc\xcf#'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(0b1100011 + 0o14) + chr(2399 - 2299) + chr(971 - 870))(chr(0b1110101) + '\x74' + chr(0b1100101 + 0o1) + chr(532 - 487) + '\x38')): VHn4CV4Ymrei = oVre8I6UXc3b._ep(jSKPaHwSAfVv.convert_gradient_to_tensor, VHn4CV4Ymrei) return VHn4CV4Ymrei
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
DistributedSparseDispatcher.combine
def combine(self, expert_out, multiply_by_gates=True): """Sum together the expert output, multiplied by the corresponding gates. Args: expert_out: a list of `num_experts` `Tensor`s, each with shape `[expert_batch_size_i, <extra_output_dims>]`. multiply_by_gates: a boolean. Returns: a list of num_datashards `Tensor`s with shapes `[batch_size[d], <extra_output_dims>]`. """ expert_part_sizes = tf.unstack( tf.stack([d.part_sizes for d in self._dispatchers]), num=self._ep.n, axis=1) # list of lists of shape [num_experts][num_datashards] expert_output_parts = self._ep(tf.split, expert_out, expert_part_sizes) expert_output_parts_t = transpose_list_of_lists(expert_output_parts) def my_combine(dispatcher, parts): return dispatcher.combine( common_layers.convert_gradient_to_tensor(tf.concat(parts, 0)), multiply_by_gates=multiply_by_gates) return self._dp(my_combine, self._dispatchers, expert_output_parts_t)
python
def combine(self, expert_out, multiply_by_gates=True): """Sum together the expert output, multiplied by the corresponding gates. Args: expert_out: a list of `num_experts` `Tensor`s, each with shape `[expert_batch_size_i, <extra_output_dims>]`. multiply_by_gates: a boolean. Returns: a list of num_datashards `Tensor`s with shapes `[batch_size[d], <extra_output_dims>]`. """ expert_part_sizes = tf.unstack( tf.stack([d.part_sizes for d in self._dispatchers]), num=self._ep.n, axis=1) # list of lists of shape [num_experts][num_datashards] expert_output_parts = self._ep(tf.split, expert_out, expert_part_sizes) expert_output_parts_t = transpose_list_of_lists(expert_output_parts) def my_combine(dispatcher, parts): return dispatcher.combine( common_layers.convert_gradient_to_tensor(tf.concat(parts, 0)), multiply_by_gates=multiply_by_gates) return self._dp(my_combine, self._dispatchers, expert_output_parts_t)
[ "def", "combine", "(", "self", ",", "expert_out", ",", "multiply_by_gates", "=", "True", ")", ":", "expert_part_sizes", "=", "tf", ".", "unstack", "(", "tf", ".", "stack", "(", "[", "d", ".", "part_sizes", "for", "d", "in", "self", ".", "_dispatchers", "]", ")", ",", "num", "=", "self", ".", "_ep", ".", "n", ",", "axis", "=", "1", ")", "# list of lists of shape [num_experts][num_datashards]", "expert_output_parts", "=", "self", ".", "_ep", "(", "tf", ".", "split", ",", "expert_out", ",", "expert_part_sizes", ")", "expert_output_parts_t", "=", "transpose_list_of_lists", "(", "expert_output_parts", ")", "def", "my_combine", "(", "dispatcher", ",", "parts", ")", ":", "return", "dispatcher", ".", "combine", "(", "common_layers", ".", "convert_gradient_to_tensor", "(", "tf", ".", "concat", "(", "parts", ",", "0", ")", ")", ",", "multiply_by_gates", "=", "multiply_by_gates", ")", "return", "self", ".", "_dp", "(", "my_combine", ",", "self", ".", "_dispatchers", ",", "expert_output_parts_t", ")" ]
Sum together the expert output, multiplied by the corresponding gates. Args: expert_out: a list of `num_experts` `Tensor`s, each with shape `[expert_batch_size_i, <extra_output_dims>]`. multiply_by_gates: a boolean. Returns: a list of num_datashards `Tensor`s with shapes `[batch_size[d], <extra_output_dims>]`.
[ "Sum", "together", "the", "expert", "output", "multiplied", "by", "the", "corresponding", "gates", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L907-L930
train
Combine the expert output with the dispatchers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxp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Ycwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(10067 - 9956) + '\062' + '\x30' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(2038 - 1990) + chr(0b1101111) + chr(1443 - 1394) + chr(0b110000) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b110100) + chr(0b100010 + 0o25), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11 + 0o56) + chr(460 - 412) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\062' + chr(0b101011 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110000) + chr(0b101100 + 0o12), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b11001 + 0o27), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + chr(0b110100) + chr(0b100101 + 0o17), 0b1000), ehT0Px3KOsy9('\x30' + chr(7627 - 7516) + '\061' + chr(0b110101) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100100 + 0o17) + chr(0b110111) + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b10011 + 0o37) + chr(50) + '\x37', 50802 - 50794), ehT0Px3KOsy9('\060' + chr(5388 - 5277) + chr(0b11011 + 0o27) + chr(177 - 122) + chr(244 - 196), ord("\x08")), ehT0Px3KOsy9(chr(155 - 107) + chr(0b11110 + 0o121) + chr(2425 - 2375) + '\060' + chr(55), 28604 - 28596), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(217 - 163) + chr(0b100011 + 0o23), 1207 - 1199), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(3747 - 3636) + chr(50) + chr(833 - 783) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(0b11110 + 0o23) + chr(52) + '\x37', 23180 - 23172), ehT0Px3KOsy9(chr(884 - 836) + chr(0b1101111) + '\063' + '\067' + '\060', 0b1000), ehT0Px3KOsy9(chr(1374 - 1326) + chr(111) + chr(49) + '\x30' + chr(1467 - 1418), 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b110 + 0o151) + chr(548 - 497) + '\x32' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1297 - 1249) + chr(0b1011101 + 0o22) + chr(52) + chr(0b1 + 0o57), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b110001) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(0b10 + 0o64) + chr(0b110000 + 0o2), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(418 - 364) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + '\x33' + chr(0b110111) + '\x30', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11011 + 0o26) + '\065' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(169 - 120) + chr(49) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\066' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1943 - 1895) + '\157' + '\x31' + chr(55) + chr(0b10000 + 0o47), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(2453 - 2402) + '\067' + chr(0b110010), 45475 - 45467), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110001) + '\x35', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b110011) + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(1833 - 1779) + '\067', 38737 - 38729), ehT0Px3KOsy9(chr(1353 - 1305) + chr(5475 - 5364) + chr(0b110011) + '\x31' + chr(2498 - 2443), 32199 - 32191), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110000) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(2160 - 2112) + chr(11667 - 11556) + chr(49) + '\061' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9218 - 9107) + chr(55) + '\x36', 8888 - 8880), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100001 + 0o21) + chr(0b11011 + 0o26) + chr(1464 - 1416), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + chr(0b11100 + 0o26) + '\x37' + chr(1475 - 1427), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(52) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(1774 - 1723) + chr(1151 - 1097) + chr(55), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(8206 - 8095) + chr(53) + '\060', 45404 - 45396)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xab'), '\144' + chr(8589 - 8488) + chr(0b111100 + 0o47) + '\x6f' + chr(0b1110 + 0o126) + chr(3319 - 3218))('\x75' + chr(116) + chr(102) + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Gz4N6zeeyqgm(oVre8I6UXc3b, NcEKgwXVRbyx, C36Uw3aClJyQ=ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 15255 - 15247)): wFsjhIzxmOPV = IDJ2eXGCBCDu.unstack(IDJ2eXGCBCDu.stack([pd3lxn9vqWxp.part_sizes for pd3lxn9vqWxp in oVre8I6UXc3b._dispatchers]), num=oVre8I6UXc3b._ep.m1NkCryOw9Bx, axis=ehT0Px3KOsy9(chr(701 - 653) + chr(111) + chr(0b110001), 8)) u_XlT1BOomaJ = oVre8I6UXc3b._ep(IDJ2eXGCBCDu.split, NcEKgwXVRbyx, wFsjhIzxmOPV) dNa4MigR4qGZ = NPkENjTuhYUz(u_XlT1BOomaJ) def Re9RdNWXtMKz(wF7ILDoyApOb, gIfWK5W_pmM4): return xafqLlk3kkUe(wF7ILDoyApOb, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc29\xd3\x0f\xe3\xfcmA\x14\x88\xf0\xd5'), chr(0b1100100) + chr(0b110101 + 0o60) + '\143' + '\157' + chr(0b110000 + 0o64) + chr(1804 - 1703))(chr(0b1110101) + chr(0b1110100) + '\x66' + '\055' + chr(0b111000)))(xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6,\x897\xb0\xf4|{\n\x8b\xf6\xdc\xeeS\xfd\x13\xa75\xbb\x7f\xf9W\x1e\x8b\x05:'), chr(0b1001100 + 0o30) + chr(7046 - 6945) + chr(4101 - 4002) + chr(893 - 782) + '\144' + chr(101))(chr(0b1110101) + chr(0b1110100) + '\146' + '\x2d' + chr(1904 - 1848)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6,\x89"\xb4\xf2'), '\x64' + '\145' + '\x63' + '\157' + chr(0b1011100 + 0o10) + '\x65')(chr(0b1110101) + '\x74' + '\x66' + '\x2d' + chr(0b100011 + 0o25)))(gIfWK5W_pmM4, ehT0Px3KOsy9(chr(1432 - 1384) + chr(0b1001 + 0o146) + chr(0b101001 + 0o7), 13451 - 13443))), multiply_by_gates=C36Uw3aClJyQ) return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"\xda'\x97"), '\144' + chr(7201 - 7100) + chr(0b1100011) + chr(2266 - 2155) + chr(100) + chr(0b110111 + 0o56))('\165' + chr(0b100100 + 0o120) + '\x66' + chr(894 - 849) + chr(0b10100 + 0o44)))(Re9RdNWXtMKz, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"\xda'\x8e2\xa5\xe7|G\x05\x9c\xe5\xcb"), chr(0b1100100) + chr(0b1100011 + 0o2) + chr(0b1100011) + '\157' + chr(0b110 + 0o136) + chr(846 - 745))(chr(8014 - 7897) + chr(8551 - 8435) + chr(9724 - 9622) + chr(45) + chr(56))), dNa4MigR4qGZ)
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
DistributedSparseDispatcher.expert_to_gates
def expert_to_gates(self): """Gate values corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s of type `tf.float32`. """ return self._ep( tf.concat, transpose_list_of_lists( self._dp(lambda d: d.expert_to_gates(), self._dispatchers)), 0)
python
def expert_to_gates(self): """Gate values corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s of type `tf.float32`. """ return self._ep( tf.concat, transpose_list_of_lists( self._dp(lambda d: d.expert_to_gates(), self._dispatchers)), 0)
[ "def", "expert_to_gates", "(", "self", ")", ":", "return", "self", ".", "_ep", "(", "tf", ".", "concat", ",", "transpose_list_of_lists", "(", "self", ".", "_dp", "(", "lambda", "d", ":", "d", ".", "expert_to_gates", "(", ")", ",", "self", ".", "_dispatchers", ")", ")", ",", "0", ")" ]
Gate values corresponding to the examples in the per-expert `Tensor`s. Returns: a list of `num_experts` one-dimensional `Tensor`s of type `tf.float32`.
[ "Gate", "values", "corresponding", "to", "the", "examples", "in", "the", "per", "-", "expert", "Tensor", "s", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L932-L941
train
Returns a list of num_experts one - dimensional Tensor s corresponding to the examples in the per - expert Tensor s.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvig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mzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1746 - 1698) + '\x6f' + '\x37' + chr(70 - 22), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(1541 - 1488), 0b1000), ehT0Px3KOsy9('\060' + chr(6527 - 6416) + chr(0b10100 + 0o36), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110000 + 0o1) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4367 - 4256) + chr(51) + chr(0b11111 + 0o25) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(2286 - 2233), 45193 - 45185), ehT0Px3KOsy9(chr(0b110000) + chr(6581 - 6470) + '\063' + chr(0b110110) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1724 - 1676) + chr(11865 - 11754) + '\x32' + '\x32' + chr(2559 - 2507), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\x35' + chr(0b110000), 25157 - 25149), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b101011 + 0o5) + '\060', 16159 - 16151), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + '\x34' + chr(0b10110 + 0o35), 0o10), ehT0Px3KOsy9('\x30' + chr(7104 - 6993) + chr(1704 - 1654) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(53) + '\x34', 0o10), ehT0Px3KOsy9(chr(851 - 803) + chr(0b1101111) + chr(50) + chr(0b100010 + 0o25) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110 + 0o57) + chr(0b10110 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(0b101001 + 0o12) + chr(0b110010), 31467 - 31459), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(2320 - 2271) + chr(50) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\x32' + chr(0b110000), 18310 - 18302), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(0b100010 + 0o25) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1715 - 1667) + chr(8256 - 8145) + '\x32' + chr(54) + chr(1279 - 1226), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110001) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(443 - 391), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + '\061' + '\067' + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1730 - 1681) + chr(0b110110), 21444 - 21436), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(11417 - 11306) + chr(51) + chr(454 - 406) + chr(837 - 786), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + chr(0b110101) + '\x35', 8), ehT0Px3KOsy9('\x30' + chr(0b10010 + 0o135) + chr(49) + chr(54) + chr(1941 - 1893), 0b1000), ehT0Px3KOsy9(chr(113 - 65) + chr(111) + chr(2020 - 1971) + '\x37', 54719 - 54711), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(2457 - 2407) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000011 + 0o54) + '\x31' + '\x30' + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(506 - 455) + chr(51) + chr(1514 - 1460), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(2031 - 1982) + chr(0b10000 + 0o42), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1010001 + 0o36) + chr(828 - 775) + chr(0b111 + 0o60), 0b1000), ehT0Px3KOsy9(chr(1974 - 1926) + chr(6617 - 6506) + chr(0b110001) + '\061' + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b110100) + chr(849 - 796), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(0b110001) + chr(49) + chr(316 - 266), 8), ehT0Px3KOsy9(chr(48) + chr(3541 - 3430) + chr(0b1 + 0o62) + chr(1085 - 1032) + chr(854 - 804), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(55) + '\062', 27650 - 27642), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\067' + chr(1363 - 1309), 60286 - 60278), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(540 - 487) + chr(0b110001), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11100 + 0o31) + '\060', 37374 - 37366)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x16'), chr(4046 - 3946) + chr(101) + chr(99) + chr(0b1001101 + 0o42) + '\x64' + '\145')(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def AGtEjtTaW8hS(oVre8I6UXc3b): return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'gxr'), '\144' + chr(0b1100100 + 0o1) + chr(0b100010 + 0o101) + '\x6f' + chr(0b100110 + 0o76) + chr(2468 - 2367))(chr(0b1110101) + chr(10572 - 10456) + chr(102) + chr(0b1110 + 0o37) + chr(0b10010 + 0o46)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'[rl\xea\x81y'), chr(3113 - 3013) + '\x65' + chr(99) + chr(0b1101111) + '\144' + chr(101))(chr(7704 - 7587) + '\x74' + chr(0b11110 + 0o110) + chr(45) + chr(0b11 + 0o65))), NPkENjTuhYUz(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'gyr'), chr(100) + '\x65' + chr(0b111101 + 0o46) + '\x6f' + chr(408 - 308) + '\145')(chr(12609 - 12492) + chr(12262 - 12146) + chr(7240 - 7138) + chr(1502 - 1457) + chr(56)))(lambda pd3lxn9vqWxp: xafqLlk3kkUe(pd3lxn9vqWxp, xafqLlk3kkUe(SXOLrMavuUCe(b']er\xec\x92y\xa9\xe0\xc7\x1fDt\xd8\xd8^'), chr(100) + chr(0b11100 + 0o111) + '\143' + '\x6f' + '\x64' + '\145')(chr(0b1110101) + chr(0b1010001 + 0o43) + chr(6921 - 6819) + chr(0b100100 + 0o11) + '\x38'))(), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'gyk\xfa\x90l\x82\xf7\xc0%Qf'), '\144' + chr(101) + chr(0b100001 + 0o102) + chr(2542 - 2431) + chr(100) + '\x65')('\x75' + chr(2018 - 1902) + chr(102) + '\055' + '\x38')))), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(96 - 48), ord("\x08")))
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
TruncatingDispatcher.dispatch
def dispatch(self, inp): """Send the inputs to the experts. Args: inp: a `Tensor` of shape "[batch, length, depth]` Returns: a tensor with shape [batch, num_experts, expert_capacity, depth] """ inp = tf.reshape(inp, [self._batch * self._length, -1]) # [batch, num_experts, expert_capacity, depth] ret = tf.gather(inp, self._flat_indices) return ret
python
def dispatch(self, inp): """Send the inputs to the experts. Args: inp: a `Tensor` of shape "[batch, length, depth]` Returns: a tensor with shape [batch, num_experts, expert_capacity, depth] """ inp = tf.reshape(inp, [self._batch * self._length, -1]) # [batch, num_experts, expert_capacity, depth] ret = tf.gather(inp, self._flat_indices) return ret
[ "def", "dispatch", "(", "self", ",", "inp", ")", ":", "inp", "=", "tf", ".", "reshape", "(", "inp", ",", "[", "self", ".", "_batch", "*", "self", ".", "_length", ",", "-", "1", "]", ")", "# [batch, num_experts, expert_capacity, depth]", "ret", "=", "tf", ".", "gather", "(", "inp", ",", "self", ".", "_flat_indices", ")", "return", "ret" ]
Send the inputs to the experts. Args: inp: a `Tensor` of shape "[batch, length, depth]` Returns: a tensor with shape [batch, num_experts, expert_capacity, depth]
[ "Send", "the", "inputs", "to", "the", "experts", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L1158-L1169
train
Send the inputs to the experts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,LgE_IO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pv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\066' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1283 - 1235) + chr(2654 - 2543) + chr(0b110010) + '\063' + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(0b11 + 0o60) + chr(0b110110) + '\x34', 8320 - 8312), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1111 + 0o140) + chr(186 - 136) + chr(1260 - 1208) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + '\061' + chr(0b110000) + chr(2592 - 2539), 9888 - 9880), ehT0Px3KOsy9('\x30' + chr(12299 - 12188) + chr(0b10011 + 0o37) + chr(0b10111 + 0o40) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + chr(49) + chr(0b101101 + 0o11) + chr(55), 12232 - 12224), ehT0Px3KOsy9('\x30' + chr(9304 - 9193) + chr(0b101110 + 0o3) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3466 - 3355) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000000 + 0o57) + chr(51) + '\067' + '\066', 11728 - 11720), ehT0Px3KOsy9(chr(445 - 397) + '\157' + '\061' + chr(0b101010 + 0o6) + chr(0b0 + 0o66), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\x30' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4681 - 4570) + chr(1287 - 1236) + '\062' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + chr(51) + '\062', 0o10), ehT0Px3KOsy9(chr(1102 - 1054) + chr(0b1101111) + '\063' + '\x31' + chr(50), 29694 - 29686), ehT0Px3KOsy9('\x30' + chr(6270 - 6159) + chr(0b110001) + '\x37' + chr(2495 - 2441), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1372 - 1322) + chr(0b111 + 0o51) + chr(49), 19435 - 19427), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(323 - 272) + '\x33' + '\063', 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(654 - 603) + chr(0b10101 + 0o37) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100101 + 0o14) + chr(0b11001 + 0o34) + '\060', 42149 - 42141), ehT0Px3KOsy9('\060' + '\157' + '\065' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10001 + 0o46) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001000 + 0o47) + chr(0b110010) + chr(50) + chr(0b11101 + 0o24), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110001) + '\063', 52123 - 52115), ehT0Px3KOsy9('\x30' + chr(111) + chr(339 - 290) + '\060' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + '\063', 20106 - 20098), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(48) + chr(186 - 137), 8), ehT0Px3KOsy9('\x30' + chr(9778 - 9667) + chr(49) + '\x36' + '\060', 46292 - 46284), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(0b101 + 0o54) + chr(893 - 844) + '\063', 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(54) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(656 - 545) + chr(0b100010 + 0o17) + '\x35' + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110 + 0o57) + chr(0b1100 + 0o44), 15261 - 15253), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(8897 - 8786) + chr(0b11001 + 0o32) + chr(51) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110010) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1010011 + 0o34) + '\061' + chr(55) + chr(61 - 10), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(626 - 575) + chr(0b110011 + 0o1) + chr(1796 - 1743), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b100101 + 0o21) + chr(120 - 68), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1110 + 0o47) + chr(0b110001), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1178 - 1128) + '\061' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(548 - 500) + chr(0b1000000 + 0o57) + chr(1739 - 1688) + chr(0b1000 + 0o53) + chr(267 - 216), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + '\065' + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a'), '\144' + chr(0b1100101) + '\x63' + chr(111) + '\x64' + chr(6314 - 6213))(chr(2439 - 2322) + chr(0b1101100 + 0o10) + chr(0b1100110) + chr(1242 - 1197) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def UlFo0iP69moK(oVre8I6UXc3b, _axPQ91Y6C0x): _axPQ91Y6C0x = IDJ2eXGCBCDu.reshape(_axPQ91Y6C0x, [oVre8I6UXc3b._batch * oVre8I6UXc3b._length, -ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(250 - 201), 0o10)]) VHn4CV4Ymrei = IDJ2eXGCBCDu.kGr_8mTaGpVE(_axPQ91Y6C0x, oVre8I6UXc3b._flat_indices) return VHn4CV4Ymrei
tensorflow/tensor2tensor
tensor2tensor/utils/expert_utils.py
TruncatingDispatcher.combine
def combine(self, x): """Return the output from the experts. When one example goes to multiple experts, the outputs are summed. Args: x: a Tensor with shape [batch, num_experts, expert_capacity, depth] Returns: a `Tensor` with shape `[batch, length, depth] """ depth = tf.shape(x)[-1] x *= tf.expand_dims(self._nonpadding, -1) ret = tf.unsorted_segment_sum( x, self._flat_indices, num_segments=self._batch * self._length) ret = tf.reshape(ret, [self._batch, self._length, depth]) return ret
python
def combine(self, x): """Return the output from the experts. When one example goes to multiple experts, the outputs are summed. Args: x: a Tensor with shape [batch, num_experts, expert_capacity, depth] Returns: a `Tensor` with shape `[batch, length, depth] """ depth = tf.shape(x)[-1] x *= tf.expand_dims(self._nonpadding, -1) ret = tf.unsorted_segment_sum( x, self._flat_indices, num_segments=self._batch * self._length) ret = tf.reshape(ret, [self._batch, self._length, depth]) return ret
[ "def", "combine", "(", "self", ",", "x", ")", ":", "depth", "=", "tf", ".", "shape", "(", "x", ")", "[", "-", "1", "]", "x", "*=", "tf", ".", "expand_dims", "(", "self", ".", "_nonpadding", ",", "-", "1", ")", "ret", "=", "tf", ".", "unsorted_segment_sum", "(", "x", ",", "self", ".", "_flat_indices", ",", "num_segments", "=", "self", ".", "_batch", "*", "self", ".", "_length", ")", "ret", "=", "tf", ".", "reshape", "(", "ret", ",", "[", "self", ".", "_batch", ",", "self", ".", "_length", ",", "depth", "]", ")", "return", "ret" ]
Return the output from the experts. When one example goes to multiple experts, the outputs are summed. Args: x: a Tensor with shape [batch, num_experts, expert_capacity, depth] Returns: a `Tensor` with shape `[batch, length, depth]
[ "Return", "the", "output", "from", "the", "experts", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L1172-L1188
train
Combine the output from the experts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0S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iu2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b110111) + chr(2225 - 2171), ord("\x08")), ehT0Px3KOsy9(chr(1674 - 1626) + chr(0b11000 + 0o127) + '\x31' + chr(48) + chr(49), 29890 - 29882), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(48) + chr(0b100001 + 0o23), 0o10), ehT0Px3KOsy9(chr(1863 - 1815) + chr(10435 - 10324) + chr(49) + chr(0b101010 + 0o10) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + chr(0b110001) + '\064' + chr(0b101011 + 0o6), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10100 + 0o35) + chr(51) + chr(1380 - 1332), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + '\061' + chr(55) + chr(2333 - 2283), 50188 - 50180), ehT0Px3KOsy9(chr(0b110000) + chr(1297 - 1186) + chr(0b110001) + '\067' + '\062', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(465 - 414) + chr(0b110101) + chr(0b11 + 0o64), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10010 + 0o41) + chr(0b11001 + 0o33) + chr(0b110011), 19153 - 19145), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(856 - 808), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b110110) + chr(0b100010 + 0o16), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b11001 + 0o34) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(517 - 406) + '\064' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1100100 + 0o13) + '\062' + chr(51) + chr(1228 - 1179), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(50) + '\x32', 0b1000), ehT0Px3KOsy9(chr(664 - 616) + chr(111) + '\062' + '\065' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(2175 - 2127) + chr(0b111011 + 0o64) + chr(0b100011 + 0o16) + '\064' + chr(0b1010 + 0o51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100011 + 0o16) + chr(48) + chr(0b110 + 0o55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(2016 - 1962) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b100010 + 0o23) + chr(55), 13304 - 13296), ehT0Px3KOsy9(chr(48) + chr(111) + chr(54) + chr(0b101000 + 0o16), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\063' + chr(0b11010 + 0o31) + chr(0b101101 + 0o7), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(55) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + '\062' + chr(50) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b110010) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(518 - 470) + chr(389 - 278) + chr(50) + chr(54), 15439 - 15431), ehT0Px3KOsy9('\060' + chr(889 - 778) + chr(0b110001) + chr(0b110000) + '\061', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b11101 + 0o25), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(54) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x36' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(49) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(136 - 83) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(0b101110 + 0o11) + chr(0b1000 + 0o52), 1319 - 1311), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(0b1111 + 0o42) + chr(1492 - 1440) + '\064', 55426 - 55418), ehT0Px3KOsy9(chr(438 - 390) + chr(111) + chr(49) + chr(51) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(826 - 776) + chr(0b110111) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + '\x32' + chr(2631 - 2579) + '\063', 0o10), ehT0Px3KOsy9(chr(1438 - 1390) + chr(0b100000 + 0o117) + '\x33' + chr(888 - 836) + chr(55), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(6680 - 6569) + chr(907 - 854) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'2'), chr(0b1100100) + chr(0b1100101) + chr(3968 - 3869) + chr(0b1101111) + chr(0b1100100) + chr(101))('\165' + '\164' + chr(102) + '\055' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Gz4N6zeeyqgm(oVre8I6UXc3b, OeWW0F1dBPRQ): UEys4_lSwsID = IDJ2eXGCBCDu.nauYfLglTpcb(OeWW0F1dBPRQ)[-ehT0Px3KOsy9('\060' + chr(10001 - 9890) + chr(0b110001), 47009 - 47001)] OeWW0F1dBPRQ *= IDJ2eXGCBCDu.expand_dims(oVre8I6UXc3b._nonpadding, -ehT0Px3KOsy9(chr(1785 - 1737) + chr(111) + chr(0b110001), 8)) VHn4CV4Ymrei = IDJ2eXGCBCDu.unsorted_segment_sum(OeWW0F1dBPRQ, oVre8I6UXc3b._flat_indices, num_segments=oVre8I6UXc3b._batch * oVre8I6UXc3b._length) VHn4CV4Ymrei = IDJ2eXGCBCDu.reshape(VHn4CV4Ymrei, [oVre8I6UXc3b._batch, oVre8I6UXc3b._length, UEys4_lSwsID]) return VHn4CV4Ymrei
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
make_env
def make_env(env_type, real_env, sim_env_kwargs): """Factory function for envs.""" return { "real": lambda: real_env.new_like( # pylint: disable=g-long-lambda batch_size=sim_env_kwargs["batch_size"], store_rollouts=False, ), "simulated": lambda: rl_utils.SimulatedBatchGymEnvWithFixedInitialFrames( # pylint: disable=g-long-lambda **sim_env_kwargs ), }[env_type]()
python
def make_env(env_type, real_env, sim_env_kwargs): """Factory function for envs.""" return { "real": lambda: real_env.new_like( # pylint: disable=g-long-lambda batch_size=sim_env_kwargs["batch_size"], store_rollouts=False, ), "simulated": lambda: rl_utils.SimulatedBatchGymEnvWithFixedInitialFrames( # pylint: disable=g-long-lambda **sim_env_kwargs ), }[env_type]()
[ "def", "make_env", "(", "env_type", ",", "real_env", ",", "sim_env_kwargs", ")", ":", "return", "{", "\"real\"", ":", "lambda", ":", "real_env", ".", "new_like", "(", "# pylint: disable=g-long-lambda", "batch_size", "=", "sim_env_kwargs", "[", "\"batch_size\"", "]", ",", "store_rollouts", "=", "False", ",", ")", ",", "\"simulated\"", ":", "lambda", ":", "rl_utils", ".", "SimulatedBatchGymEnvWithFixedInitialFrames", "(", "# pylint: disable=g-long-lambda", "*", "*", "sim_env_kwargs", ")", ",", "}", "[", "env_type", "]", "(", ")" ]
Factory function for envs.
[ "Factory", "function", "for", "envs", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L240-L250
train
Factory function for envs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj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,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(0b10101 + 0o34) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101000 + 0o12) + '\x30' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1894 - 1846) + '\157' + '\x33' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b101110 + 0o11), 23268 - 23260), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\x33' + chr(0b110101), 21981 - 21973), ehT0Px3KOsy9('\060' + chr(11090 - 10979) + chr(51) + '\x31' + '\064', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(48) + chr(0b11001 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(1824 - 1776) + chr(111) + '\063' + chr(2652 - 2600) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(55) + '\060', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1117 - 1066) + chr(55), 32240 - 32232), ehT0Px3KOsy9(chr(1033 - 985) + chr(0b1101111) + chr(0b110110) + chr(815 - 766), 35310 - 35302), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(1701 - 1651), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b110100 + 0o1) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(8209 - 8098) + chr(0b1000 + 0o57), 14960 - 14952), ehT0Px3KOsy9(chr(728 - 680) + chr(0b1101111) + chr(72 - 19) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\x35' + '\x30', 8), ehT0Px3KOsy9('\060' + chr(6218 - 6107) + chr(49) + chr(1382 - 1329) + chr(0b110000), 57473 - 57465), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b11010 + 0o30) + '\x32', 32560 - 32552), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(49) + '\062', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\x35' + '\x33', 0o10), ehT0Px3KOsy9(chr(93 - 45) + chr(111) + chr(0b110 + 0o55) + chr(907 - 859), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(53) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(10186 - 10075) + chr(49) + chr(55) + chr(2711 - 2657), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + '\062' + chr(0b110001) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101100 + 0o3) + chr(1835 - 1785) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(1987 - 1934), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + chr(51) + chr(897 - 844) + '\062', 0b1000), ehT0Px3KOsy9(chr(1742 - 1694) + chr(0b1011000 + 0o27) + '\x34' + chr(0b1110 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(1206 - 1158) + chr(111) + chr(0b1111 + 0o43) + chr(0b101111 + 0o4) + chr(0b110011), 49783 - 49775), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010 + 0o0) + '\x37' + chr(1509 - 1457), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\x37', 8), ehT0Px3KOsy9(chr(2276 - 2228) + chr(0b101011 + 0o104) + chr(0b110001) + chr(1844 - 1794) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101110 + 0o4) + chr(327 - 273) + chr(0b110011), 54979 - 54971), ehT0Px3KOsy9(chr(1162 - 1114) + chr(0b1101000 + 0o7) + chr(2661 - 2608) + chr(2096 - 2043), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + '\063' + '\x33' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(3064 - 2953) + chr(0b101 + 0o54) + chr(0b11 + 0o63) + chr(55), 3830 - 3822), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\061' + chr(2148 - 2099), 54867 - 54859), ehT0Px3KOsy9(chr(1892 - 1844) + chr(111) + chr(50) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b10000 + 0o137) + chr(0b110011) + chr(2076 - 2023) + chr(0b110000), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(53) + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'&'), '\x64' + chr(0b1000000 + 0o45) + '\x63' + '\157' + chr(3445 - 3345) + '\145')('\x75' + chr(6133 - 6017) + chr(0b1100110) + chr(0b11010 + 0o23) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def D1WlCKq4TxNh(lnBbVpms5gnU, EgS9dR_BAieQ, s2aEkGXvrneB): return {xafqLlk3kkUe(SXOLrMavuUCe(b'z\xe5\x7f{'), '\x64' + chr(101) + chr(99) + chr(0b1101111) + chr(0b111 + 0o135) + '\145')(chr(0b110110 + 0o77) + '\x74' + chr(7787 - 7685) + '\055' + chr(56)): lambda : xafqLlk3kkUe(EgS9dR_BAieQ, xafqLlk3kkUe(SXOLrMavuUCe(b'f\xe5iH\xb1\xa5\xa8\x80'), chr(0b1100100) + chr(101) + '\143' + '\157' + chr(100) + chr(101))(chr(117) + chr(116) + chr(0b1100110) + '\055' + chr(56)))(batch_size=s2aEkGXvrneB[xafqLlk3kkUe(SXOLrMavuUCe(b'j\xe1jt\xb5\x93\xb0\x8cBz'), '\144' + chr(101) + chr(0b11 + 0o140) + '\157' + '\x64' + chr(5667 - 5566))('\x75' + chr(0b1110100) + chr(1374 - 1272) + chr(45) + chr(1587 - 1531))], store_rollouts=ehT0Px3KOsy9(chr(0b110000) + chr(0b11001 + 0o126) + chr(48), 0o10)), xafqLlk3kkUe(SXOLrMavuUCe(b'{\xe9sb\xb1\xad\xb7\x80\\'), chr(0b1001110 + 0o26) + chr(0b1100101) + chr(0b1100011) + chr(6371 - 6260) + chr(0b1000001 + 0o43) + chr(0b101101 + 0o70))(chr(1376 - 1259) + chr(0b1110100) + '\x66' + '\x2d' + '\x38'): lambda : xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'[\xe9sb\xb1\xad\xb7\x80\\]Pf\x8bol\x91\x05\x97$\xddOE\n\xe7A\x7fm\x8fB\xd2\xd2v#\xdaL\xb01;v\x85m\xf3'), chr(0b1110 + 0o126) + chr(1224 - 1123) + chr(99) + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(0b10011 + 0o142) + '\164' + '\x66' + chr(45) + chr(0b101010 + 0o16)))(**s2aEkGXvrneB)}[lnBbVpms5gnU]()
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
make_agent
def make_agent( agent_type, env, policy_hparams, policy_dir, sampling_temp, sim_env_kwargs_fn=None, frame_stack_size=None, rollout_agent_type=None, batch_size=None, inner_batch_size=None, env_type=None, **planner_kwargs ): """Factory function for Agents.""" if batch_size is None: batch_size = env.batch_size return { "random": lambda: rl_utils.RandomAgent( # pylint: disable=g-long-lambda batch_size, env.observation_space, env.action_space ), "policy": lambda: rl_utils.PolicyAgent( # pylint: disable=g-long-lambda batch_size, env.observation_space, env.action_space, policy_hparams, policy_dir, sampling_temp ), "planner": lambda: rl_utils.PlannerAgent( # pylint: disable=g-long-lambda batch_size, make_agent( rollout_agent_type, env, policy_hparams, policy_dir, sampling_temp, batch_size=inner_batch_size ), make_env(env_type, env.env, sim_env_kwargs_fn()), lambda env: rl_utils.BatchStackWrapper(env, frame_stack_size), discount_factor=policy_hparams.gae_gamma, **planner_kwargs ), }[agent_type]()
python
def make_agent( agent_type, env, policy_hparams, policy_dir, sampling_temp, sim_env_kwargs_fn=None, frame_stack_size=None, rollout_agent_type=None, batch_size=None, inner_batch_size=None, env_type=None, **planner_kwargs ): """Factory function for Agents.""" if batch_size is None: batch_size = env.batch_size return { "random": lambda: rl_utils.RandomAgent( # pylint: disable=g-long-lambda batch_size, env.observation_space, env.action_space ), "policy": lambda: rl_utils.PolicyAgent( # pylint: disable=g-long-lambda batch_size, env.observation_space, env.action_space, policy_hparams, policy_dir, sampling_temp ), "planner": lambda: rl_utils.PlannerAgent( # pylint: disable=g-long-lambda batch_size, make_agent( rollout_agent_type, env, policy_hparams, policy_dir, sampling_temp, batch_size=inner_batch_size ), make_env(env_type, env.env, sim_env_kwargs_fn()), lambda env: rl_utils.BatchStackWrapper(env, frame_stack_size), discount_factor=policy_hparams.gae_gamma, **planner_kwargs ), }[agent_type]()
[ "def", "make_agent", "(", "agent_type", ",", "env", ",", "policy_hparams", ",", "policy_dir", ",", "sampling_temp", ",", "sim_env_kwargs_fn", "=", "None", ",", "frame_stack_size", "=", "None", ",", "rollout_agent_type", "=", "None", ",", "batch_size", "=", "None", ",", "inner_batch_size", "=", "None", ",", "env_type", "=", "None", ",", "*", "*", "planner_kwargs", ")", ":", "if", "batch_size", "is", "None", ":", "batch_size", "=", "env", ".", "batch_size", "return", "{", "\"random\"", ":", "lambda", ":", "rl_utils", ".", "RandomAgent", "(", "# pylint: disable=g-long-lambda", "batch_size", ",", "env", ".", "observation_space", ",", "env", ".", "action_space", ")", ",", "\"policy\"", ":", "lambda", ":", "rl_utils", ".", "PolicyAgent", "(", "# pylint: disable=g-long-lambda", "batch_size", ",", "env", ".", "observation_space", ",", "env", ".", "action_space", ",", "policy_hparams", ",", "policy_dir", ",", "sampling_temp", ")", ",", "\"planner\"", ":", "lambda", ":", "rl_utils", ".", "PlannerAgent", "(", "# pylint: disable=g-long-lambda", "batch_size", ",", "make_agent", "(", "rollout_agent_type", ",", "env", ",", "policy_hparams", ",", "policy_dir", ",", "sampling_temp", ",", "batch_size", "=", "inner_batch_size", ")", ",", "make_env", "(", "env_type", ",", "env", ".", "env", ",", "sim_env_kwargs_fn", "(", ")", ")", ",", "lambda", "env", ":", "rl_utils", ".", "BatchStackWrapper", "(", "env", ",", "frame_stack_size", ")", ",", "discount_factor", "=", "policy_hparams", ".", "gae_gamma", ",", "*", "*", "planner_kwargs", ")", ",", "}", "[", "agent_type", "]", "(", ")" ]
Factory function for Agents.
[ "Factory", "function", "for", "Agents", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L253-L277
train
Factory function for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iUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(0b110001) + '\064' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(0b11 + 0o56) + chr(1207 - 1152) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2772 - 2661) + chr(53) + chr(55), 37102 - 37094), ehT0Px3KOsy9('\060' + chr(4056 - 3945) + chr(0b110011) + '\x37' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(52) + chr(0b10111 + 0o34), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x36' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001010 + 0o45) + chr(49) + chr(0b110010) + chr(0b110 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(0b110110) + '\065', 46014 - 46006), ehT0Px3KOsy9(chr(48) + chr(11679 - 11568) + chr(0b110010) + chr(0b110000) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1826 - 1776) + '\x36' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(8309 - 8198) + '\x32' + chr(52) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1939 - 1888) + chr(0b100110 + 0o13) + chr(0b0 + 0o62), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(53) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(495 - 444) + '\062' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001000 + 0o47) + chr(0b110011) + chr(54) + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(2368 - 2319), 65066 - 65058), ehT0Px3KOsy9(chr(1632 - 1584) + chr(3588 - 3477) + chr(494 - 445) + chr(53) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(1902 - 1852) + chr(0b110011) + '\060', 59891 - 59883), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + chr(0b110010) + '\x35' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x34' + '\065', 0o10), ehT0Px3KOsy9(chr(759 - 711) + chr(111) + chr(55), 38668 - 38660), ehT0Px3KOsy9(chr(833 - 785) + chr(0b1101111) + chr(2154 - 2100) + chr(2552 - 2499), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000 + 0o2) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b1001 + 0o47) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(1874 - 1826) + '\x6f' + chr(0b110000 + 0o1) + chr(1456 - 1404), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b0 + 0o63) + chr(0b110001) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\062' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b1011 + 0o47) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b0 + 0o61) + '\063' + '\063', 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1011 + 0o144) + '\x32' + '\x34' + chr(0b110010), 4706 - 4698), ehT0Px3KOsy9('\060' + '\x6f' + chr(832 - 782) + chr(0b110100) + chr(0b101000 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(652 - 602) + '\x30' + chr(1761 - 1706), 8), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1011000 + 0o27) + chr(1510 - 1461) + '\x31' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(53) + chr(51), 40791 - 40783), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101011 + 0o10) + '\064' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\x37' + '\065', 19685 - 19677), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + '\061' + chr(0b110001) + chr(0b1111 + 0o43), 0b1000), ehT0Px3KOsy9(chr(256 - 208) + chr(4039 - 3928) + '\x32' + chr(0b110110) + chr(1158 - 1104), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110001) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(2377 - 2322) + '\x36', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(7922 - 7811) + chr(0b11001 + 0o34) + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'N'), '\x64' + chr(101) + chr(4995 - 4896) + chr(0b110111 + 0o70) + '\144' + '\x65')('\x75' + chr(0b1 + 0o163) + chr(0b1100110) + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def LHacCZO4x5Kg(_ot6CvKfFhL0, xzsHIGfR8Ip5, irXbreMwM8Zh, ICnty4yNE3Zz, Ep30xVZP6Jij, objeCIjRYXpY=None, YYpMgs8WK8M7=None, XaCTrm0LToo8=None, ix9dZyeAmUxY=None, OsVOWARpTMON=None, lnBbVpms5gnU=None, **F1SEIId64i8y): if ix9dZyeAmUxY is None: ix9dZyeAmUxY = xzsHIGfR8Ip5.ix9dZyeAmUxY return {xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\x18A\x9eL\xd8'), '\x64' + chr(8455 - 8354) + chr(2490 - 2391) + chr(111) + '\144' + chr(0b1011 + 0o132))(chr(0b1110101) + chr(6200 - 6084) + chr(102) + chr(45) + chr(0b1111 + 0o51)): lambda : xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'2\x18A\x9eL\xd8\x14R\xe2\xdc\xd3'), '\x64' + '\x65' + '\143' + chr(0b1101111) + chr(100) + chr(7751 - 7650))(chr(0b1110101) + chr(1392 - 1276) + '\146' + chr(0b100100 + 0o11) + '\070'))(ix9dZyeAmUxY, xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\x1b\\\x9fQ\xc34A\xee\xdd\xc9\x95\xdf\xa0\x97\xfa\r'), chr(0b1100100) + chr(101) + '\143' + chr(0b1101111) + chr(559 - 459) + chr(7714 - 7613))(chr(117) + '\164' + chr(0b1100110) + '\055' + chr(56))), xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\x1a[\x93L\xdb\nF\xf7\xd3\xc4\xaf'), '\144' + '\145' + '\143' + chr(3318 - 3207) + '\144' + '\145')('\165' + '\x74' + chr(0b1100110) + chr(0b101101) + '\x38'))), xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\x16C\x93@\xcc'), '\144' + chr(678 - 577) + chr(99) + '\157' + chr(0b1100100) + chr(6090 - 5989))('\165' + chr(6340 - 6224) + '\x66' + '\055' + chr(56)): lambda : xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'0\x16C\x93@\xcc\x14R\xe2\xdc\xd3'), '\x64' + '\x65' + chr(6284 - 6185) + chr(8959 - 8848) + '\x64' + '\145')('\165' + chr(8389 - 8273) + '\146' + chr(0b101101) + chr(56)))(ix9dZyeAmUxY, xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\x1b\\\x9fQ\xc34A\xee\xdd\xc9\x95\xdf\xa0\x97\xfa\r'), chr(100) + '\x65' + '\143' + '\157' + chr(2595 - 2495) + '\145')(chr(0b1110101) + chr(11761 - 11645) + '\146' + chr(1671 - 1626) + '\070')), xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\x1a[\x93L\xdb\nF\xf7\xd3\xc4\xaf'), chr(0b1100100) + '\145' + '\x63' + chr(11940 - 11829) + '\144' + '\145')(chr(0b1110101) + '\164' + '\146' + chr(0b101101) + chr(0b111000))), irXbreMwM8Zh, ICnty4yNE3Zz, Ep30xVZP6Jij), xafqLlk3kkUe(SXOLrMavuUCe(b"\x10\x15N\x94M\xd0'"), chr(6699 - 6599) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(2059 - 1959) + chr(101))('\x75' + '\164' + chr(102) + chr(299 - 254) + chr(0b111000)): lambda : xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b"0\x15N\x94M\xd0't\xe0\xd7\xc9\xbe"), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(111) + chr(0b1001111 + 0o25) + '\145')(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(0b110 + 0o47) + '\x38'))(ix9dZyeAmUxY, LHacCZO4x5Kg(XaCTrm0LToo8, xzsHIGfR8Ip5, irXbreMwM8Zh, ICnty4yNE3Zz, Ep30xVZP6Jij, batch_size=OsVOWARpTMON), D1WlCKq4TxNh(lnBbVpms5gnU, xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\x17Y'), chr(0b10011 + 0o121) + '\x65' + chr(99) + '\x6f' + chr(0b1100100) + chr(101))(chr(117) + chr(0b101011 + 0o111) + '\x66' + '\x2d' + chr(1057 - 1001))), objeCIjRYXpY()), lambda xzsHIGfR8Ip5: xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'"\x18[\x99K\xe6!T\xe4\xd9\xf0\xb8\xcd\xa0\x86\xfc\x1a'), chr(100) + '\145' + chr(6964 - 6865) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1010010 + 0o42) + '\x66' + chr(45) + chr(2972 - 2916)))(xzsHIGfR8Ip5, YYpMgs8WK8M7), discount_factor=xafqLlk3kkUe(irXbreMwM8Zh, xafqLlk3kkUe(SXOLrMavuUCe(b'%:`\xbc|\xc37{\xbe\xc6\xc0\xfe'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))('\x75' + '\164' + chr(102) + chr(45) + '\070')), **F1SEIId64i8y)}[_ot6CvKfFhL0]()
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
collect_frames_for_random_starts
def collect_frames_for_random_starts( storage_env, stacked_env, agent, frame_stack_size, random_starts_step_limit, log_every_steps=None ): """Collects frames from real env for random starts of simulated env.""" del frame_stack_size storage_env.start_new_epoch(0) tf.logging.info( "Collecting %d frames for random starts.", random_starts_step_limit ) rl_utils.run_rollouts( stacked_env, agent, stacked_env.reset(), step_limit=random_starts_step_limit, many_rollouts_from_each_env=True, log_every_steps=log_every_steps, ) # Save unfinished rollouts to history. stacked_env.reset()
python
def collect_frames_for_random_starts( storage_env, stacked_env, agent, frame_stack_size, random_starts_step_limit, log_every_steps=None ): """Collects frames from real env for random starts of simulated env.""" del frame_stack_size storage_env.start_new_epoch(0) tf.logging.info( "Collecting %d frames for random starts.", random_starts_step_limit ) rl_utils.run_rollouts( stacked_env, agent, stacked_env.reset(), step_limit=random_starts_step_limit, many_rollouts_from_each_env=True, log_every_steps=log_every_steps, ) # Save unfinished rollouts to history. stacked_env.reset()
[ "def", "collect_frames_for_random_starts", "(", "storage_env", ",", "stacked_env", ",", "agent", ",", "frame_stack_size", ",", "random_starts_step_limit", ",", "log_every_steps", "=", "None", ")", ":", "del", "frame_stack_size", "storage_env", ".", "start_new_epoch", "(", "0", ")", "tf", ".", "logging", ".", "info", "(", "\"Collecting %d frames for random starts.\"", ",", "random_starts_step_limit", ")", "rl_utils", ".", "run_rollouts", "(", "stacked_env", ",", "agent", ",", "stacked_env", ".", "reset", "(", ")", ",", "step_limit", "=", "random_starts_step_limit", ",", "many_rollouts_from_each_env", "=", "True", ",", "log_every_steps", "=", "log_every_steps", ",", ")", "# Save unfinished rollouts to history.", "stacked_env", ".", "reset", "(", ")" ]
Collects frames from real env for random starts of simulated env.
[ "Collects", "frames", "from", "real", "env", "for", "random", "starts", "of", "simulated", "env", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L280-L297
train
Collect frames from real env for random starts of simulated env.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIw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UoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1661 - 1613) + '\x6f' + chr(0b110011) + chr(48) + '\067', 0o10), ehT0Px3KOsy9(chr(1480 - 1432) + chr(0b1101001 + 0o6) + '\063' + '\x33' + chr(49), 0b1000), ehT0Px3KOsy9(chr(575 - 527) + chr(0b1001 + 0o146) + chr(2083 - 2029) + chr(0b100100 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(50) + chr(0b11010 + 0o34) + chr(1142 - 1094), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(2490 - 2440) + chr(0b110001) + chr(0b111 + 0o55), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(344 - 293) + '\065' + chr(0b101011 + 0o11), 42696 - 42688), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1001100 + 0o43) + chr(52) + chr(0b11101 + 0o23), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111010 + 0o65) + chr(0b11110 + 0o23) + chr(0b1111 + 0o43), 62912 - 62904), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(51) + '\066' + chr(54), 0o10), ehT0Px3KOsy9(chr(1738 - 1690) + '\x6f' + chr(0b110011) + '\066' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + chr(52) + chr(935 - 887), 8), ehT0Px3KOsy9(chr(0b110000) + chr(7436 - 7325) + chr(1851 - 1797) + '\064', 2141 - 2133), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100 + 0o57) + chr(0b110110) + chr(0b11000 + 0o33), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100101 + 0o12) + '\062' + chr(53) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110001 + 0o3) + chr(598 - 550), 38539 - 38531), ehT0Px3KOsy9('\x30' + '\157' + chr(54) + chr(0b1111 + 0o50), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010 + 0o1) + '\x31' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(227 - 116) + '\x33' + chr(0b0 + 0o61) + '\060', 0b1000), ehT0Px3KOsy9(chr(865 - 817) + chr(1607 - 1496) + '\x32' + chr(2380 - 2327) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b101001 + 0o106) + chr(0b101001 + 0o10) + chr(0b110101) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110111) + chr(55), 12016 - 12008), ehT0Px3KOsy9(chr(48) + chr(0b111100 + 0o63) + chr(1839 - 1787) + chr(0b11101 + 0o30), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b100100 + 0o15) + '\x33' + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(1237 - 1126) + chr(0b110001) + '\x31' + chr(54), 61640 - 61632), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101010 + 0o13) + chr(0b101110 + 0o11), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b11000 + 0o32) + chr(0b101010 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(1011 - 963) + '\x6f' + '\x36' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(11607 - 11496) + '\x32' + chr(913 - 860) + chr(1963 - 1908), 36322 - 36314), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b110001 + 0o76) + chr(0b100 + 0o57) + chr(0b10011 + 0o35) + '\064', 47300 - 47292), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(8473 - 8362) + '\x31' + chr(0b110111) + chr(2577 - 2525), 0o10), ehT0Px3KOsy9('\x30' + chr(8699 - 8588) + chr(49) + '\x35' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + '\062' + chr(48) + chr(0b10110 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(1931 - 1883) + chr(7517 - 7406) + chr(0b100111 + 0o12) + chr(0b110 + 0o61) + chr(0b101111 + 0o2), 55974 - 55966), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110110) + chr(52), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10111 + 0o35) + chr(0b110000), 8), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(1408 - 1355) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + chr(0b110010) + chr(0b1001 + 0o56) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(139 - 91) + chr(111) + chr(49) + chr(0b110100) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(5176 - 5065) + chr(0b110011) + chr(0b110110) + '\x30', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(2150 - 2101) + '\061', 13523 - 13515)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + '\x35' + chr(48), 20975 - 20967)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9'), chr(0b1000000 + 0o44) + chr(101) + '\143' + '\157' + chr(269 - 169) + chr(5094 - 4993))('\x75' + chr(6371 - 6255) + '\x66' + '\x2d' + chr(913 - 857)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def h_CJN50EVBLn(DMhva6X_4voZ, DRq51GqcB63d, PjFixOurfobW, YYpMgs8WK8M7, uZ9gmvmeV_oP, Ntj8wLboIg4O=None): del YYpMgs8WK8M7 xafqLlk3kkUe(DMhva6X_4voZ, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\xadP\xc2\xf8\xb3No\x81\xaaED\x9c\xca\x88'), chr(0b1100100) + chr(101) + chr(1721 - 1622) + chr(111) + chr(100) + chr(0b1100101))('\165' + chr(0b10100 + 0o140) + chr(0b111 + 0o137) + chr(0b100101 + 0o10) + chr(0b111000)))(ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x30', 29820 - 29812)) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x94\xeey\xc8\xf9\x8fG=\x9c\x99z_'), chr(0b110010 + 0o62) + chr(0b1100101) + chr(0b11001 + 0o112) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b1000100 + 0o61) + chr(9374 - 9258) + chr(0b1010110 + 0o20) + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x84\xb6]\xdc\xe9\x8fTc\x98\x92\x00\x11\x97\x89\x86E\xae\xa5\xc9\x1e\x1fC4<\x0f\xe3W\xc1\xa0\x13\x05\xa0\n@A\x1b\xca\x11\xde'), '\144' + '\145' + chr(0b110011 + 0o60) + '\x6f' + chr(0b100101 + 0o77) + '\145')(chr(0b1110101) + chr(116) + chr(0b101000 + 0o76) + chr(475 - 430) + chr(234 - 178)), uZ9gmvmeV_oP) xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5\xac_\xef\xfe\x83Lf\x99\x80TG'), '\x64' + chr(0b1111 + 0o126) + '\143' + chr(10086 - 9975) + '\144' + chr(122 - 21))(chr(0b1110101) + '\164' + chr(102) + '\055' + '\x38'))(DRq51GqcB63d, PjFixOurfobW, xafqLlk3kkUe(DRq51GqcB63d, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5\xbcB\xd5\xf8'), '\x64' + '\x65' + '\x63' + '\x6f' + chr(8975 - 8875) + chr(4406 - 4305))(chr(0b10001 + 0o144) + '\x74' + chr(0b1010 + 0o134) + '\x2d' + '\070'))(), step_limit=uZ9gmvmeV_oP, many_rollouts_from_each_env=ehT0Px3KOsy9(chr(222 - 174) + '\x6f' + chr(49), 63468 - 63460), log_every_steps=Ntj8wLboIg4O) xafqLlk3kkUe(DRq51GqcB63d, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5\xbcB\xd5\xf8'), '\x64' + '\x65' + chr(2261 - 2162) + chr(8374 - 8263) + '\144' + '\x65')('\x75' + '\164' + chr(0b1100110) + '\x2d' + '\x38'))()
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
make_agent_from_hparams
def make_agent_from_hparams( agent_type, base_env, stacked_env, loop_hparams, policy_hparams, planner_hparams, model_dir, policy_dir, sampling_temp, video_writers=() ): """Creates an Agent from hparams.""" def sim_env_kwargs_fn(): return rl.make_simulated_env_kwargs( base_env, loop_hparams, batch_size=planner_hparams.batch_size, model_dir=model_dir ) planner_kwargs = planner_hparams.values() planner_kwargs.pop("batch_size") planner_kwargs.pop("rollout_agent_type") planner_kwargs.pop("env_type") return make_agent( agent_type, stacked_env, policy_hparams, policy_dir, sampling_temp, sim_env_kwargs_fn, loop_hparams.frame_stack_size, planner_hparams.rollout_agent_type, inner_batch_size=planner_hparams.batch_size, env_type=planner_hparams.env_type, video_writers=video_writers, **planner_kwargs )
python
def make_agent_from_hparams( agent_type, base_env, stacked_env, loop_hparams, policy_hparams, planner_hparams, model_dir, policy_dir, sampling_temp, video_writers=() ): """Creates an Agent from hparams.""" def sim_env_kwargs_fn(): return rl.make_simulated_env_kwargs( base_env, loop_hparams, batch_size=planner_hparams.batch_size, model_dir=model_dir ) planner_kwargs = planner_hparams.values() planner_kwargs.pop("batch_size") planner_kwargs.pop("rollout_agent_type") planner_kwargs.pop("env_type") return make_agent( agent_type, stacked_env, policy_hparams, policy_dir, sampling_temp, sim_env_kwargs_fn, loop_hparams.frame_stack_size, planner_hparams.rollout_agent_type, inner_batch_size=planner_hparams.batch_size, env_type=planner_hparams.env_type, video_writers=video_writers, **planner_kwargs )
[ "def", "make_agent_from_hparams", "(", "agent_type", ",", "base_env", ",", "stacked_env", ",", "loop_hparams", ",", "policy_hparams", ",", "planner_hparams", ",", "model_dir", ",", "policy_dir", ",", "sampling_temp", ",", "video_writers", "=", "(", ")", ")", ":", "def", "sim_env_kwargs_fn", "(", ")", ":", "return", "rl", ".", "make_simulated_env_kwargs", "(", "base_env", ",", "loop_hparams", ",", "batch_size", "=", "planner_hparams", ".", "batch_size", ",", "model_dir", "=", "model_dir", ")", "planner_kwargs", "=", "planner_hparams", ".", "values", "(", ")", "planner_kwargs", ".", "pop", "(", "\"batch_size\"", ")", "planner_kwargs", ".", "pop", "(", "\"rollout_agent_type\"", ")", "planner_kwargs", ".", "pop", "(", "\"env_type\"", ")", "return", "make_agent", "(", "agent_type", ",", "stacked_env", ",", "policy_hparams", ",", "policy_dir", ",", "sampling_temp", ",", "sim_env_kwargs_fn", ",", "loop_hparams", ".", "frame_stack_size", ",", "planner_hparams", ".", "rollout_agent_type", ",", "inner_batch_size", "=", "planner_hparams", ".", "batch_size", ",", "env_type", "=", "planner_hparams", ".", "env_type", ",", "video_writers", "=", "video_writers", ",", "*", "*", "planner_kwargs", ")" ]
Creates an Agent from hparams.
[ "Creates", "an", "Agent", "from", "hparams", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L300-L321
train
Creates an Agent from hparams.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9Dhhi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cpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\067' + chr(0b1010 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(49) + '\x37', 47743 - 47735), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(835 - 786), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1011101 + 0o22) + '\062' + chr(0b110100) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11101 + 0o31) + chr(0b10100 + 0o34), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + '\063' + chr(0b110001) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(289 - 241) + chr(0b1101111) + chr(0b110011) + chr(0b10000 + 0o45), 62648 - 62640), ehT0Px3KOsy9(chr(48) + chr(0b10001 + 0o136) + chr(1257 - 1206) + '\060' + chr(985 - 934), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(1276 - 1225) + chr(2686 - 2634), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1172 - 1120), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + '\061' + chr(48) + chr(2780 - 2727), 13436 - 13428), ehT0Px3KOsy9('\060' + '\157' + chr(0b100001 + 0o20) + '\x33' + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + chr(685 - 634) + '\x31' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1218 - 1170) + '\157' + chr(0b110001) + chr(48) + '\061', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(10353 - 10242) + '\x33' + chr(1631 - 1578) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110110) + chr(2149 - 2098), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110100) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(0b110110) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110111) + chr(0b11 + 0o62), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b1101 + 0o47) + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(202 - 152) + '\062' + chr(0b110101), 1439 - 1431), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100100 + 0o22) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + '\063' + '\x35' + chr(1320 - 1272), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(1188 - 1135) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b111 + 0o52) + '\x31' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(648 - 600) + chr(111) + '\063' + chr(50) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\066' + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b110000 + 0o7) + '\066', 6996 - 6988), ehT0Px3KOsy9(chr(48) + chr(5437 - 5326) + chr(0b110011) + chr(0b0 + 0o63) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(9953 - 9842) + '\x33' + '\066' + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3482 - 3371) + chr(1886 - 1836) + chr(0b110111) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\063' + '\063' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b10100 + 0o133) + chr(52) + '\064', 11008 - 11000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1445 - 1396) + chr(1667 - 1619) + chr(0b0 + 0o63), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11111 + 0o24) + chr(48) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\067' + '\062', 0b1000), ehT0Px3KOsy9(chr(1836 - 1788) + chr(0b1101111) + '\062' + '\x34' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(81 - 33) + chr(111) + '\x33' + chr(0b100100 + 0o17) + chr(54 - 1), 19976 - 19968), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11110 + 0o23) + chr(50), 12226 - 12218), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110101) + chr(0b1100 + 0o53), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(1644 - 1591) + chr(268 - 220), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'W'), '\x64' + chr(101) + '\x63' + chr(0b1101111) + chr(1863 - 1763) + chr(6165 - 6064))(chr(3984 - 3867) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def LP4Gsy3HKZSm(_ot6CvKfFhL0, pZfvXNgReLjA, DRq51GqcB63d, GyhQ1Iopww6m, irXbreMwM8Zh, lmyewJocwkxB, kwWCbiWUCezq, ICnty4yNE3Zz, Ep30xVZP6Jij, V2Ka7YDfMK26=()): def objeCIjRYXpY(): return xafqLlk3kkUe(iwzD7IVqUS5S, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14\xeej\xc5o\xbet\xaeih$(\xae%\xb5V\x8f\x80b\xca\xe2Q\x9a\x8a='), chr(100) + '\x65' + chr(0b1000111 + 0o34) + '\x6f' + '\144' + chr(101))(chr(0b1010 + 0o153) + chr(116) + chr(4308 - 4206) + '\x2d' + '\x38'))(pZfvXNgReLjA, GyhQ1Iopww6m, batch_size=xafqLlk3kkUe(lmyewJocwkxB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xf78\xc4j\xb4x\x82qQ=\x05'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b1010111 + 0o30) + chr(1365 - 1265) + chr(0b1011010 + 0o13))(chr(0b1100000 + 0o25) + '\x74' + chr(0b1000001 + 0o45) + chr(0b100010 + 0o13) + '\x38')), model_dir=kwWCbiWUCezq) F1SEIId64i8y = lmyewJocwkxB.SPnCNu54H1db() xafqLlk3kkUe(F1SEIId64i8y, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xe0q'), '\144' + chr(101) + chr(0b1100011) + chr(0b1101111) + '\144' + '\145')(chr(117) + '\x74' + chr(0b10011 + 0o123) + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b\xeeu\xc3X\x92n\xaafa'), '\x64' + '\145' + '\x63' + chr(0b101111 + 0o100) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(2704 - 2588) + chr(0b111000 + 0o56) + chr(0b101101) + chr(56))) xafqLlk3kkUe(F1SEIId64i8y, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xe0q'), chr(100) + chr(0b1100101) + chr(99) + chr(8490 - 8379) + chr(0b1100100) + chr(0b1100101))('\x75' + chr(2211 - 2095) + chr(0b1100110) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xe0m\xcc_\xb8i\x9c}c 2\xbf\x1e\x9eJ\x91\x93'), chr(2707 - 2607) + '\x65' + chr(673 - 574) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + chr(0b1110001 + 0o3) + chr(9364 - 9262) + chr(678 - 633) + '\x38')) xafqLlk3kkUe(F1SEIId64i8y, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xe0q'), '\x64' + chr(0b1100101) + '\143' + chr(0b100000 + 0o117) + '\144' + chr(101))(chr(117) + chr(1961 - 1845) + chr(1345 - 1243) + chr(532 - 487) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xe1w\xffD\xb4m\xa6'), '\x64' + chr(4762 - 4661) + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(0b101100 + 0o111) + chr(116) + chr(0b1100110) + chr(45) + chr(56))) return LHacCZO4x5Kg(_ot6CvKfFhL0, DRq51GqcB63d, irXbreMwM8Zh, ICnty4yNE3Zz, Ep30xVZP6Jij, objeCIjRYXpY, xafqLlk3kkUe(GyhQ1Iopww6m, xafqLlk3kkUe(SXOLrMavuUCe(b' \xd6q\xedW\xbe%\x94W<\x08k'), chr(100) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + chr(0b1010111 + 0o16))(chr(0b1110101) + '\x74' + chr(102) + '\055' + '\070')), xafqLlk3kkUe(lmyewJocwkxB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xe0m\xcc_\xb8i\x9c}c 2\xbf\x1e\x9eJ\x91\x93'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b1010101 + 0o20))(chr(8416 - 8299) + '\x74' + '\x66' + chr(0b101101) + '\070')), inner_batch_size=xafqLlk3kkUe(lmyewJocwkxB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xf78\xc4j\xb4x\x82qQ=\x05'), '\x64' + chr(0b1010110 + 0o17) + chr(0b1101 + 0o126) + chr(111) + chr(0b1100100) + chr(0b1100101))('\x75' + chr(11385 - 11269) + chr(7618 - 7516) + chr(1961 - 1916) + chr(56))), env_type=xafqLlk3kkUe(lmyewJocwkxB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xe1w\xffD\xb4m\xa6'), '\x64' + chr(6027 - 5926) + chr(9515 - 9416) + chr(0b1101111) + chr(0b1100100) + chr(9339 - 9238))('\x75' + chr(0b1000001 + 0o63) + chr(7582 - 7480) + chr(0b101010 + 0o3) + chr(321 - 265))), video_writers=V2Ka7YDfMK26, **F1SEIId64i8y)
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
make_eval_fn_with_agent
def make_eval_fn_with_agent( agent_type, eval_mode, planner_hparams, model_dir, log_every_steps=None, video_writers=(), random_starts_step_limit=None ): """Returns an out-of-graph eval_fn using the Agent API.""" def eval_fn(env, loop_hparams, policy_hparams, policy_dir, sampling_temp): """Eval function.""" base_env = env env = rl_utils.BatchStackWrapper(env, loop_hparams.frame_stack_size) agent = make_agent_from_hparams( agent_type, base_env, env, loop_hparams, policy_hparams, planner_hparams, model_dir, policy_dir, sampling_temp, video_writers ) if eval_mode == "agent_simulated": real_env = base_env.new_like(batch_size=1) stacked_env = rl_utils.BatchStackWrapper( real_env, loop_hparams.frame_stack_size ) collect_frames_for_random_starts( real_env, stacked_env, agent, loop_hparams.frame_stack_size, random_starts_step_limit, log_every_steps ) initial_frame_chooser = rl_utils.make_initial_frame_chooser( real_env, loop_hparams.frame_stack_size, simulation_random_starts=True, simulation_flip_first_random_for_beginning=False, split=None, ) env_fn = rl.make_simulated_env_fn_from_hparams( real_env, loop_hparams, batch_size=loop_hparams.eval_batch_size, initial_frame_chooser=initial_frame_chooser, model_dir=model_dir ) sim_env = env_fn(in_graph=False) env = rl_utils.BatchStackWrapper(sim_env, loop_hparams.frame_stack_size) kwargs = {} if not agent.records_own_videos: kwargs["video_writers"] = video_writers step_limit = base_env.rl_env_max_episode_steps if step_limit == -1: step_limit = None rl_utils.run_rollouts( env, agent, env.reset(), log_every_steps=log_every_steps, step_limit=step_limit, **kwargs ) if eval_mode == "agent_real": assert len(base_env.current_epoch_rollouts()) == env.batch_size return eval_fn
python
def make_eval_fn_with_agent( agent_type, eval_mode, planner_hparams, model_dir, log_every_steps=None, video_writers=(), random_starts_step_limit=None ): """Returns an out-of-graph eval_fn using the Agent API.""" def eval_fn(env, loop_hparams, policy_hparams, policy_dir, sampling_temp): """Eval function.""" base_env = env env = rl_utils.BatchStackWrapper(env, loop_hparams.frame_stack_size) agent = make_agent_from_hparams( agent_type, base_env, env, loop_hparams, policy_hparams, planner_hparams, model_dir, policy_dir, sampling_temp, video_writers ) if eval_mode == "agent_simulated": real_env = base_env.new_like(batch_size=1) stacked_env = rl_utils.BatchStackWrapper( real_env, loop_hparams.frame_stack_size ) collect_frames_for_random_starts( real_env, stacked_env, agent, loop_hparams.frame_stack_size, random_starts_step_limit, log_every_steps ) initial_frame_chooser = rl_utils.make_initial_frame_chooser( real_env, loop_hparams.frame_stack_size, simulation_random_starts=True, simulation_flip_first_random_for_beginning=False, split=None, ) env_fn = rl.make_simulated_env_fn_from_hparams( real_env, loop_hparams, batch_size=loop_hparams.eval_batch_size, initial_frame_chooser=initial_frame_chooser, model_dir=model_dir ) sim_env = env_fn(in_graph=False) env = rl_utils.BatchStackWrapper(sim_env, loop_hparams.frame_stack_size) kwargs = {} if not agent.records_own_videos: kwargs["video_writers"] = video_writers step_limit = base_env.rl_env_max_episode_steps if step_limit == -1: step_limit = None rl_utils.run_rollouts( env, agent, env.reset(), log_every_steps=log_every_steps, step_limit=step_limit, **kwargs ) if eval_mode == "agent_real": assert len(base_env.current_epoch_rollouts()) == env.batch_size return eval_fn
[ "def", "make_eval_fn_with_agent", "(", "agent_type", ",", "eval_mode", ",", "planner_hparams", ",", "model_dir", ",", "log_every_steps", "=", "None", ",", "video_writers", "=", "(", ")", ",", "random_starts_step_limit", "=", "None", ")", ":", "def", "eval_fn", "(", "env", ",", "loop_hparams", ",", "policy_hparams", ",", "policy_dir", ",", "sampling_temp", ")", ":", "\"\"\"Eval function.\"\"\"", "base_env", "=", "env", "env", "=", "rl_utils", ".", "BatchStackWrapper", "(", "env", ",", "loop_hparams", ".", "frame_stack_size", ")", "agent", "=", "make_agent_from_hparams", "(", "agent_type", ",", "base_env", ",", "env", ",", "loop_hparams", ",", "policy_hparams", ",", "planner_hparams", ",", "model_dir", ",", "policy_dir", ",", "sampling_temp", ",", "video_writers", ")", "if", "eval_mode", "==", "\"agent_simulated\"", ":", "real_env", "=", "base_env", ".", "new_like", "(", "batch_size", "=", "1", ")", "stacked_env", "=", "rl_utils", ".", "BatchStackWrapper", "(", "real_env", ",", "loop_hparams", ".", "frame_stack_size", ")", "collect_frames_for_random_starts", "(", "real_env", ",", "stacked_env", ",", "agent", ",", "loop_hparams", ".", "frame_stack_size", ",", "random_starts_step_limit", ",", "log_every_steps", ")", "initial_frame_chooser", "=", "rl_utils", ".", "make_initial_frame_chooser", "(", "real_env", ",", "loop_hparams", ".", "frame_stack_size", ",", "simulation_random_starts", "=", "True", ",", "simulation_flip_first_random_for_beginning", "=", "False", ",", "split", "=", "None", ",", ")", "env_fn", "=", "rl", ".", "make_simulated_env_fn_from_hparams", "(", "real_env", ",", "loop_hparams", ",", "batch_size", "=", "loop_hparams", ".", "eval_batch_size", ",", "initial_frame_chooser", "=", "initial_frame_chooser", ",", "model_dir", "=", "model_dir", ")", "sim_env", "=", "env_fn", "(", "in_graph", "=", "False", ")", "env", "=", "rl_utils", ".", "BatchStackWrapper", "(", "sim_env", ",", "loop_hparams", ".", "frame_stack_size", ")", "kwargs", "=", "{", "}", "if", "not", "agent", ".", "records_own_videos", ":", "kwargs", "[", "\"video_writers\"", "]", "=", "video_writers", "step_limit", "=", "base_env", ".", "rl_env_max_episode_steps", "if", "step_limit", "==", "-", "1", ":", "step_limit", "=", "None", "rl_utils", ".", "run_rollouts", "(", "env", ",", "agent", ",", "env", ".", "reset", "(", ")", ",", "log_every_steps", "=", "log_every_steps", ",", "step_limit", "=", "step_limit", ",", "*", "*", "kwargs", ")", "if", "eval_mode", "==", "\"agent_real\"", ":", "assert", "len", "(", "base_env", ".", "current_epoch_rollouts", "(", ")", ")", "==", "env", ".", "batch_size", "return", "eval_fn" ]
Returns an out-of-graph eval_fn using the Agent API.
[ "Returns", "an", "out", "-", "of", "-", "graph", "eval_fn", "using", "the", "Agent", "API", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L324-L372
train
Returns an eval_fn using the Agent API.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0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Im,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1226 - 1178) + chr(0b1101111) + chr(0b11001 + 0o30) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(1874 - 1825) + chr(1856 - 1807) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(2765 - 2710) + '\061', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(53) + chr(2345 - 2291), 23513 - 23505), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101110 + 0o5) + chr(2706 - 2652) + chr(1383 - 1335), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001 + 0o0) + chr(737 - 682) + chr(0b111 + 0o53), 14589 - 14581), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100111 + 0o14) + '\063' + chr(48), 1137 - 1129), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b110101 + 0o72) + chr(481 - 432) + chr(0b101111 + 0o5) + '\x33', 2220 - 2212), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1 + 0o64), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b101001 + 0o106) + '\x32' + '\x31' + chr(0b10110 + 0o33), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + '\x32' + chr(0b110011), 16032 - 16024), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10000 + 0o41) + chr(54) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010100 + 0o33) + '\x33' + '\x34' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\061' + '\x35', 4754 - 4746), ehT0Px3KOsy9(chr(48) + chr(9246 - 9135) + '\x31' + chr(0b1010 + 0o51) + chr(649 - 598), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x35' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(670 - 615) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1107 - 996) + chr(722 - 671) + '\x33' + chr(0b11010 + 0o33), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9228 - 9117) + chr(0b110010 + 0o1) + chr(54) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(0b110010) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(546 - 498) + '\x6f' + chr(0b110001) + chr(49) + '\x35', 8), ehT0Px3KOsy9(chr(1458 - 1410) + chr(0b1101111) + chr(0b101010 + 0o12), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110001) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1356 - 1307) + '\x33' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b110110) + chr(2157 - 2106), 22872 - 22864), ehT0Px3KOsy9(chr(1262 - 1214) + chr(111) + chr(0b110010) + '\060' + '\061', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110110) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100100 + 0o13) + '\x33' + chr(0b100000 + 0o22) + chr(51), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(387 - 337), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(1292 - 1243) + chr(1424 - 1370), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + '\061' + '\x32' + chr(1640 - 1592), 0o10), ehT0Px3KOsy9(chr(241 - 193) + chr(0b1101111) + '\x33' + chr(53) + chr(0b101111 + 0o4), 37061 - 37053), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11110 + 0o24) + '\063' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x37' + chr(49), 12475 - 12467), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b110001) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(9426 - 9315) + '\x36' + chr(673 - 625), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110 + 0o55) + '\060' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1987 - 1939) + chr(4314 - 4203) + chr(49) + chr(0b110101) + '\x30', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1978 - 1930) + '\x6f' + '\065' + chr(0b110000), 52107 - 52099)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'!'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(0b11111 + 0o120) + '\x64' + chr(0b1100101))('\x75' + chr(2743 - 2627) + '\146' + '\x2d' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def X75a9JxjDxha(_ot6CvKfFhL0, R5oNZFYE7jtB, lmyewJocwkxB, kwWCbiWUCezq, Ntj8wLboIg4O=None, V2Ka7YDfMK26=(), uZ9gmvmeV_oP=None): def Og6v8y1JqxXN(xzsHIGfR8Ip5, GyhQ1Iopww6m, irXbreMwM8Zh, ICnty4yNE3Zz, Ep30xVZP6Jij): pZfvXNgReLjA = xzsHIGfR8Ip5 xzsHIGfR8Ip5 = dS9nMkNNnOq2.BatchStackWrapper(xzsHIGfR8Ip5, GyhQ1Iopww6m.YYpMgs8WK8M7) PjFixOurfobW = LP4Gsy3HKZSm(_ot6CvKfFhL0, pZfvXNgReLjA, xzsHIGfR8Ip5, GyhQ1Iopww6m, irXbreMwM8Zh, lmyewJocwkxB, kwWCbiWUCezq, ICnty4yNE3Zz, Ep30xVZP6Jij, V2Ka7YDfMK26) if R5oNZFYE7jtB == xafqLlk3kkUe(SXOLrMavuUCe(b'n*\x1c\x00\x84%\xab\nh\xfc\xbf\x11r\x87\xe9'), '\x64' + chr(0b11000 + 0o115) + '\143' + chr(6535 - 6424) + '\144' + chr(0b1000101 + 0o40))(chr(0b1110010 + 0o3) + '\x74' + '\x66' + '\055' + chr(56)): EgS9dR_BAieQ = pZfvXNgReLjA.new_like(batch_size=ehT0Px3KOsy9(chr(1906 - 1858) + chr(1754 - 1643) + chr(0b110001), 47270 - 47262)) DRq51GqcB63d = dS9nMkNNnOq2.BatchStackWrapper(EgS9dR_BAieQ, GyhQ1Iopww6m.YYpMgs8WK8M7) h_CJN50EVBLn(EgS9dR_BAieQ, DRq51GqcB63d, PjFixOurfobW, xafqLlk3kkUe(GyhQ1Iopww6m, xafqLlk3kkUe(SXOLrMavuUCe(b'V\x14\t#\x97\t\xe04N\xb1\x9eG'), chr(7284 - 7184) + chr(0b1100101) + '\143' + chr(11555 - 11444) + '\144' + '\145')('\x75' + chr(4032 - 3916) + chr(4326 - 4224) + '\055' + chr(0b11011 + 0o35))), uZ9gmvmeV_oP, Ntj8wLboIg4O) OkKotjp_CVo5 = dS9nMkNNnOq2.make_initial_frame_chooser(EgS9dR_BAieQ, GyhQ1Iopww6m.YYpMgs8WK8M7, simulation_random_starts=ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + chr(1736 - 1687), 8), simulation_flip_first_random_for_beginning=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000), 23466 - 23458), split=None) LwGmvHQYXm7c = iwzD7IVqUS5S.make_simulated_env_fn_from_hparams(EgS9dR_BAieQ, GyhQ1Iopww6m, batch_size=GyhQ1Iopww6m.eval_batch_size, initial_frame_chooser=OkKotjp_CVo5, model_dir=kwWCbiWUCezq) KnK5DDqYil2I = LwGmvHQYXm7c(in_graph=ehT0Px3KOsy9(chr(48) + chr(0b1000 + 0o147) + chr(0b1 + 0o57), 8)) xzsHIGfR8Ip5 = dS9nMkNNnOq2.BatchStackWrapper(KnK5DDqYil2I, GyhQ1Iopww6m.YYpMgs8WK8M7) M8EIoTs2GJXE = {} if not xafqLlk3kkUe(PjFixOurfobW, xafqLlk3kkUe(SXOLrMavuUCe(b'}(\x1a\x01\x82\x1e\xab<j\xfe\xbd/p\x8b\xe9>B\x0f'), chr(0b1100100) + '\145' + chr(2417 - 2318) + chr(6668 - 6557) + chr(3314 - 3214) + chr(0b1100101))(chr(0b111100 + 0o71) + chr(3504 - 3388) + chr(6302 - 6200) + '\055' + '\x38')): M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'y$\x1d\x0b\x9f%\xaf\x11l\xfd\xb6\x02u'), '\144' + '\x65' + chr(0b110011 + 0o60) + chr(0b11 + 0o154) + chr(0b11110 + 0o106) + '\145')('\165' + '\x74' + chr(0b1000110 + 0o40) + chr(596 - 551) + chr(0b111000))] = V2Ka7YDfMK26 GcFQj0CoVat7 = pZfvXNgReLjA.rl_env_max_episode_steps if GcFQj0CoVat7 == -ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1001 + 0o50), 8): GcFQj0CoVat7 = None xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'}8\x171\x82\x15\xb4\x0fj\xfc\xa7\x03'), chr(4449 - 4349) + '\x65' + chr(0b100101 + 0o76) + chr(111) + chr(1534 - 1434) + chr(3198 - 3097))(chr(0b10111 + 0o136) + chr(0b1110100) + chr(0b1100110) + chr(45) + '\x38'))(xzsHIGfR8Ip5, PjFixOurfobW, xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'}(\n\x0b\x84'), '\x64' + chr(101) + chr(99) + chr(0b1101111) + chr(100) + chr(0b1100 + 0o131))('\x75' + '\164' + '\146' + chr(45) + chr(0b10010 + 0o46)))(), log_every_steps=Ntj8wLboIg4O, step_limit=GcFQj0CoVat7, **M8EIoTs2GJXE) if R5oNZFYE7jtB == xafqLlk3kkUe(SXOLrMavuUCe(b'n*\x1c\x00\x84%\xaa\x06d\xe5'), '\x64' + chr(0b1101 + 0o130) + chr(99) + chr(111) + chr(0b1111 + 0o125) + '\x65')('\x75' + chr(0b1110100) + chr(102) + chr(1229 - 1184) + chr(781 - 725)): assert c2A0yzQpDQB3(xafqLlk3kkUe(pZfvXNgReLjA, xafqLlk3kkUe(SXOLrMavuUCe(b'l8\x0b\x1c\x95\x14\xac<`\xf9\xbc\x13n\xbd\xff4A\x10\xb2\x83`>'), chr(100) + chr(0b1100101) + chr(0b100010 + 0o101) + chr(0b1101001 + 0o6) + chr(0b1100100) + chr(0b1010 + 0o133))(chr(0b1110101) + '\x74' + '\x66' + '\x2d' + '\x38'))()) == xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'f5@\n\xaa\x03\xbd"h\xdc\xab)'), chr(5574 - 5474) + '\x65' + chr(0b1100011) + '\x6f' + '\x64' + chr(101))(chr(0b1110101) + chr(0b1100010 + 0o22) + '\146' + chr(1933 - 1888) + '\x38')) return Og6v8y1JqxXN
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
evaluate_world_model
def evaluate_world_model( agent_type, loop_hparams, planner_hparams, model_dir, policy_dir, random_starts_step_limit, debug_video_path, log_every_steps ): """Evaluates the world model.""" if debug_video_path: debug_video_path = os.path.join(debug_video_path, "0.avi") storage_env = rl_utils.setup_env(loop_hparams, batch_size=1, max_num_noops=0) stacked_env = rl_utils.BatchStackWrapper( storage_env, loop_hparams.frame_stack_size ) policy_hparams = trainer_lib.create_hparams(loop_hparams.base_algo_params) agent = make_agent_from_hparams( agent_type, storage_env, stacked_env, loop_hparams, policy_hparams, planner_hparams, model_dir, policy_dir, # TODO(koz4k): Loop over eval_sampling_temps? sampling_temp=loop_hparams.eval_sampling_temps[0], ) collect_frames_for_random_starts( storage_env, stacked_env, agent, loop_hparams.frame_stack_size, random_starts_step_limit, log_every_steps ) return rl_utils.evaluate_world_model( storage_env, loop_hparams, model_dir, debug_video_path, split=None )
python
def evaluate_world_model( agent_type, loop_hparams, planner_hparams, model_dir, policy_dir, random_starts_step_limit, debug_video_path, log_every_steps ): """Evaluates the world model.""" if debug_video_path: debug_video_path = os.path.join(debug_video_path, "0.avi") storage_env = rl_utils.setup_env(loop_hparams, batch_size=1, max_num_noops=0) stacked_env = rl_utils.BatchStackWrapper( storage_env, loop_hparams.frame_stack_size ) policy_hparams = trainer_lib.create_hparams(loop_hparams.base_algo_params) agent = make_agent_from_hparams( agent_type, storage_env, stacked_env, loop_hparams, policy_hparams, planner_hparams, model_dir, policy_dir, # TODO(koz4k): Loop over eval_sampling_temps? sampling_temp=loop_hparams.eval_sampling_temps[0], ) collect_frames_for_random_starts( storage_env, stacked_env, agent, loop_hparams.frame_stack_size, random_starts_step_limit, log_every_steps ) return rl_utils.evaluate_world_model( storage_env, loop_hparams, model_dir, debug_video_path, split=None )
[ "def", "evaluate_world_model", "(", "agent_type", ",", "loop_hparams", ",", "planner_hparams", ",", "model_dir", ",", "policy_dir", ",", "random_starts_step_limit", ",", "debug_video_path", ",", "log_every_steps", ")", ":", "if", "debug_video_path", ":", "debug_video_path", "=", "os", ".", "path", ".", "join", "(", "debug_video_path", ",", "\"0.avi\"", ")", "storage_env", "=", "rl_utils", ".", "setup_env", "(", "loop_hparams", ",", "batch_size", "=", "1", ",", "max_num_noops", "=", "0", ")", "stacked_env", "=", "rl_utils", ".", "BatchStackWrapper", "(", "storage_env", ",", "loop_hparams", ".", "frame_stack_size", ")", "policy_hparams", "=", "trainer_lib", ".", "create_hparams", "(", "loop_hparams", ".", "base_algo_params", ")", "agent", "=", "make_agent_from_hparams", "(", "agent_type", ",", "storage_env", ",", "stacked_env", ",", "loop_hparams", ",", "policy_hparams", ",", "planner_hparams", ",", "model_dir", ",", "policy_dir", ",", "# TODO(koz4k): Loop over eval_sampling_temps?", "sampling_temp", "=", "loop_hparams", ".", "eval_sampling_temps", "[", "0", "]", ",", ")", "collect_frames_for_random_starts", "(", "storage_env", ",", "stacked_env", ",", "agent", ",", "loop_hparams", ".", "frame_stack_size", ",", "random_starts_step_limit", ",", "log_every_steps", ")", "return", "rl_utils", ".", "evaluate_world_model", "(", "storage_env", ",", "loop_hparams", ",", "model_dir", ",", "debug_video_path", ",", "split", "=", "None", ")" ]
Evaluates the world model.
[ "Evaluates", "the", "world", "model", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tens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wAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + chr(0b110001 + 0o0) + chr(2095 - 2047) + chr(53), 10885 - 10877), ehT0Px3KOsy9('\x30' + chr(3469 - 3358) + '\062' + chr(0b110011) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b110111) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b101101 + 0o102) + chr(0b100101 + 0o15) + '\063' + chr(54), 8), ehT0Px3KOsy9(chr(1316 - 1268) + chr(111) + '\064' + '\064', 13825 - 13817), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(349 - 300) + '\065' + chr(1097 - 1044), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(2198 - 2147) + chr(55), 25650 - 25642), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + '\x36' + chr(50), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\x33' + chr(53), 26991 - 26983), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\x31' + chr(0b101 + 0o62), 25937 - 25929), ehT0Px3KOsy9(chr(617 - 569) + chr(7678 - 7567) + chr(0b110010) + chr(0b11 + 0o57) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b110110) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + '\063' + '\066' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(1642 - 1593) + '\x36' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(90 - 41) + chr(1330 - 1276) + '\064', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + '\x33' + chr(0b110101) + chr(732 - 678), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10275 - 10164) + chr(0b100001 + 0o21) + chr(54) + chr(0b110000), 26653 - 26645), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b110001) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(525 - 476) + chr(0b100110 + 0o16) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + '\x32' + '\066' + '\x32', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(65 - 10), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\063' + chr(0b110001 + 0o5), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111 + 0o150) + chr(723 - 673) + chr(48) + chr(1176 - 1122), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(6595 - 6484) + chr(0b110001) + chr(0b11001 + 0o35) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b110110) + chr(0b101010 + 0o15), 0b1000), ehT0Px3KOsy9(chr(706 - 658) + '\157' + '\063' + chr(2402 - 2347) + chr(72 - 24), 0b1000), ehT0Px3KOsy9(chr(126 - 78) + chr(427 - 316) + '\062' + chr(0b110110) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(161 - 108) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(1704 - 1653) + chr(0b110110 + 0o1), 8), ehT0Px3KOsy9(chr(1551 - 1503) + chr(0b1101111) + chr(2537 - 2486) + chr(52) + chr(48), 16138 - 16130), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110100) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(2559 - 2507) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\x31' + chr(0b101110 + 0o10), 0b1000), ehT0Px3KOsy9(chr(2178 - 2130) + chr(2959 - 2848) + chr(1084 - 1031) + '\x31', 45545 - 45537), ehT0Px3KOsy9('\x30' + '\157' + chr(53) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(0b110011) + '\061' + '\063', 2462 - 2454), ehT0Px3KOsy9(chr(48) + chr(0b1000110 + 0o51) + chr(0b100011 + 0o20) + chr(0b101 + 0o56) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1111 + 0o42) + '\x32' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b111 + 0o57) + '\x31', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(7535 - 7424) + '\065' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'k'), chr(0b1001110 + 0o26) + '\x65' + chr(99) + '\x6f' + '\144' + chr(7753 - 7652))(chr(0b1110101) + chr(2422 - 2306) + '\146' + chr(45) + chr(1389 - 1333)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def H1fEmy7WhNMc(_ot6CvKfFhL0, GyhQ1Iopww6m, lmyewJocwkxB, kwWCbiWUCezq, ICnty4yNE3Zz, uZ9gmvmeV_oP, hojfa0zbgkh3, Ntj8wLboIg4O): if hojfa0zbgkh3: hojfa0zbgkh3 = oqhJDdMJfuwx.path.join(hojfa0zbgkh3, xafqLlk3kkUe(SXOLrMavuUCe(b'u\xb0X\xe8M'), chr(7361 - 7261) + '\145' + chr(0b10101 + 0o116) + chr(0b111111 + 0o60) + chr(3743 - 3643) + chr(101))(chr(117) + chr(0b101010 + 0o112) + chr(0b1100110) + chr(0b11101 + 0o20) + chr(0b110001 + 0o7))) DMhva6X_4voZ = dS9nMkNNnOq2.setup_env(GyhQ1Iopww6m, batch_size=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1042 - 993), ord("\x08")), max_num_noops=ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\060', ord("\x08"))) DRq51GqcB63d = dS9nMkNNnOq2.BatchStackWrapper(DMhva6X_4voZ, GyhQ1Iopww6m.YYpMgs8WK8M7) irXbreMwM8Zh = KvtIAVGi33Ty.create_hparams(GyhQ1Iopww6m.eNhPLh6cTW8q) PjFixOurfobW = LP4Gsy3HKZSm(_ot6CvKfFhL0, DMhva6X_4voZ, DRq51GqcB63d, GyhQ1Iopww6m, irXbreMwM8Zh, lmyewJocwkxB, kwWCbiWUCezq, ICnty4yNE3Zz, sampling_temp=GyhQ1Iopww6m.dXdg5YsfUP4x[ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1000101 + 0o52) + chr(0b110000), 8)]) h_CJN50EVBLn(DMhva6X_4voZ, DRq51GqcB63d, PjFixOurfobW, xafqLlk3kkUe(GyhQ1Iopww6m, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xc7I\xd3C\x1e\xa7%\x16\xf7\xdb\x84'), chr(6427 - 6327) + chr(101) + chr(7673 - 7574) + chr(8828 - 8717) + '\144' + chr(9927 - 9826))(chr(0b1 + 0o164) + chr(116) + '\146' + '\055' + '\070')), uZ9gmvmeV_oP, Ntj8wLboIg4O) return xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b' \xe8X\xf2Q\x0c\xeb\x17\x02\xb8\xf9\xc1\x9c\x15+\x83\xdf)\x02\xde'), chr(0b1000000 + 0o44) + chr(101) + '\143' + '\x6f' + chr(100) + '\145')(chr(117) + chr(5701 - 5585) + chr(7552 - 7450) + '\055' + '\x38'))(DMhva6X_4voZ, GyhQ1Iopww6m, kwWCbiWUCezq, hojfa0zbgkh3, split=None)
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
evaluate
def evaluate( loop_hparams, planner_hparams, policy_dir, model_dir, eval_metrics_dir, agent_type, eval_mode, eval_with_learner, log_every_steps, debug_video_path, num_debug_videos=1, random_starts_step_limit=None, report_fn=None, report_metric=None ): """Evaluate.""" if eval_with_learner: assert agent_type == "policy" if report_fn: assert report_metric is not None eval_metrics_writer = tf.summary.FileWriter(eval_metrics_dir) video_writers = () kwargs = {} if eval_mode in ["agent_real", "agent_simulated"]: if not eval_with_learner: if debug_video_path: tf.gfile.MakeDirs(debug_video_path) video_writers = [ common_video.WholeVideoWriter( # pylint: disable=g-complex-comprehension fps=10, output_path=os.path.join(debug_video_path, "{}.avi".format(i)), file_format="avi", ) for i in range(num_debug_videos) ] kwargs["eval_fn"] = make_eval_fn_with_agent( agent_type, eval_mode, planner_hparams, model_dir, log_every_steps=log_every_steps, video_writers=video_writers, random_starts_step_limit=random_starts_step_limit ) eval_metrics = rl_utils.evaluate_all_configs( loop_hparams, policy_dir, **kwargs ) else: eval_metrics = evaluate_world_model( agent_type, loop_hparams, planner_hparams, model_dir, policy_dir, random_starts_step_limit, debug_video_path, log_every_steps ) rl_utils.summarize_metrics(eval_metrics_writer, eval_metrics, 0) for video_writer in video_writers: video_writer.finish_to_disk() # Report metrics if report_fn: if report_metric == "mean_reward": metric_name = rl_utils.get_metric_name( sampling_temp=loop_hparams.eval_sampling_temps[0], max_num_noops=loop_hparams.eval_max_num_noops, clipped=False ) report_fn(eval_metrics[metric_name], 0) else: report_fn(eval_metrics[report_metric], 0) return eval_metrics
python
def evaluate( loop_hparams, planner_hparams, policy_dir, model_dir, eval_metrics_dir, agent_type, eval_mode, eval_with_learner, log_every_steps, debug_video_path, num_debug_videos=1, random_starts_step_limit=None, report_fn=None, report_metric=None ): """Evaluate.""" if eval_with_learner: assert agent_type == "policy" if report_fn: assert report_metric is not None eval_metrics_writer = tf.summary.FileWriter(eval_metrics_dir) video_writers = () kwargs = {} if eval_mode in ["agent_real", "agent_simulated"]: if not eval_with_learner: if debug_video_path: tf.gfile.MakeDirs(debug_video_path) video_writers = [ common_video.WholeVideoWriter( # pylint: disable=g-complex-comprehension fps=10, output_path=os.path.join(debug_video_path, "{}.avi".format(i)), file_format="avi", ) for i in range(num_debug_videos) ] kwargs["eval_fn"] = make_eval_fn_with_agent( agent_type, eval_mode, planner_hparams, model_dir, log_every_steps=log_every_steps, video_writers=video_writers, random_starts_step_limit=random_starts_step_limit ) eval_metrics = rl_utils.evaluate_all_configs( loop_hparams, policy_dir, **kwargs ) else: eval_metrics = evaluate_world_model( agent_type, loop_hparams, planner_hparams, model_dir, policy_dir, random_starts_step_limit, debug_video_path, log_every_steps ) rl_utils.summarize_metrics(eval_metrics_writer, eval_metrics, 0) for video_writer in video_writers: video_writer.finish_to_disk() # Report metrics if report_fn: if report_metric == "mean_reward": metric_name = rl_utils.get_metric_name( sampling_temp=loop_hparams.eval_sampling_temps[0], max_num_noops=loop_hparams.eval_max_num_noops, clipped=False ) report_fn(eval_metrics[metric_name], 0) else: report_fn(eval_metrics[report_metric], 0) return eval_metrics
[ "def", "evaluate", "(", "loop_hparams", ",", "planner_hparams", ",", "policy_dir", ",", "model_dir", ",", "eval_metrics_dir", ",", "agent_type", ",", "eval_mode", ",", "eval_with_learner", ",", "log_every_steps", ",", "debug_video_path", ",", "num_debug_videos", "=", "1", ",", "random_starts_step_limit", "=", "None", ",", "report_fn", "=", "None", ",", "report_metric", "=", "None", ")", ":", "if", "eval_with_learner", ":", "assert", "agent_type", "==", "\"policy\"", "if", "report_fn", ":", "assert", "report_metric", "is", "not", "None", "eval_metrics_writer", "=", "tf", ".", "summary", ".", "FileWriter", "(", "eval_metrics_dir", ")", "video_writers", "=", "(", ")", "kwargs", "=", "{", "}", "if", "eval_mode", "in", "[", "\"agent_real\"", ",", "\"agent_simulated\"", "]", ":", "if", "not", "eval_with_learner", ":", "if", "debug_video_path", ":", "tf", ".", "gfile", ".", "MakeDirs", "(", "debug_video_path", ")", "video_writers", "=", "[", "common_video", ".", "WholeVideoWriter", "(", "# pylint: disable=g-complex-comprehension", "fps", "=", "10", ",", "output_path", "=", "os", ".", "path", ".", "join", "(", "debug_video_path", ",", "\"{}.avi\"", ".", "format", "(", "i", ")", ")", ",", "file_format", "=", "\"avi\"", ",", ")", "for", "i", "in", "range", "(", "num_debug_videos", ")", "]", "kwargs", "[", "\"eval_fn\"", "]", "=", "make_eval_fn_with_agent", "(", "agent_type", ",", "eval_mode", ",", "planner_hparams", ",", "model_dir", ",", "log_every_steps", "=", "log_every_steps", ",", "video_writers", "=", "video_writers", ",", "random_starts_step_limit", "=", "random_starts_step_limit", ")", "eval_metrics", "=", "rl_utils", ".", "evaluate_all_configs", "(", "loop_hparams", ",", "policy_dir", ",", "*", "*", "kwargs", ")", "else", ":", "eval_metrics", "=", "evaluate_world_model", "(", "agent_type", ",", "loop_hparams", ",", "planner_hparams", ",", "model_dir", ",", "policy_dir", ",", "random_starts_step_limit", ",", "debug_video_path", ",", "log_every_steps", ")", "rl_utils", ".", "summarize_metrics", "(", "eval_metrics_writer", ",", "eval_metrics", ",", "0", ")", "for", "video_writer", "in", "video_writers", ":", "video_writer", ".", "finish_to_disk", "(", ")", "# Report metrics", "if", "report_fn", ":", "if", "report_metric", "==", "\"mean_reward\"", ":", "metric_name", "=", "rl_utils", ".", "get_metric_name", "(", "sampling_temp", "=", "loop_hparams", ".", "eval_sampling_temps", "[", "0", "]", ",", "max_num_noops", "=", "loop_hparams", ".", "eval_max_num_noops", ",", "clipped", "=", "False", ")", "report_fn", "(", "eval_metrics", "[", "metric_name", "]", ",", "0", ")", "else", ":", "report_fn", "(", "eval_metrics", "[", "report_metric", "]", ",", "0", ")", "return", "eval_metrics" ]
Evaluate.
[ "Evaluate", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L403-L461
train
Evaluate the world model.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvb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nectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1399 - 1351) + chr(0b1101001 + 0o6) + chr(1001 - 952) + chr(2388 - 2334) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(881 - 833) + chr(2058 - 2009), 0b1000), ehT0Px3KOsy9('\x30' + chr(12317 - 12206) + '\x32' + chr(48) + chr(884 - 831), 44655 - 44647), ehT0Px3KOsy9(chr(1210 - 1162) + chr(11681 - 11570) + chr(49) + chr(0b110100) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(0b110010) + chr(50) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + '\062' + chr(0b101111 + 0o6) + '\x32', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b11011 + 0o30) + chr(50) + chr(51), 61644 - 61636), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\064', 0b1000), ehT0Px3KOsy9(chr(2239 - 2191) + chr(111) + '\x31' + chr(0b1111 + 0o41) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\061' + '\064', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(5255 - 5144) + chr(1906 - 1856) + chr(0b110101 + 0o0) + chr(0b110101 + 0o0), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(1075 - 1027) + chr(0b101101 + 0o7), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110100) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1216 - 1168) + chr(2581 - 2470) + '\061' + '\x33' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1069 - 1021) + chr(111) + '\x37' + chr(51), 47656 - 47648), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(0b110001) + chr(55) + '\065', 64731 - 64723), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b101001 + 0o106) + chr(0b110001) + '\x32' + chr(908 - 859), 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(6352 - 6241) + '\x32' + chr(965 - 912) + chr(1404 - 1349), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1345 - 1295) + chr(1726 - 1674) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4694 - 4583) + chr(51) + chr(0b110001) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(460 - 411) + chr(0b100010 + 0o23) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010001 + 0o36) + chr(50) + '\x30' + '\x36', 0b1000), ehT0Px3KOsy9(chr(2132 - 2084) + chr(111) + chr(1383 - 1333) + '\x35' + chr(0b11101 + 0o31), 0o10), ehT0Px3KOsy9(chr(808 - 760) + '\157' + chr(0b10000 + 0o41) + chr(1506 - 1456) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6184 - 6073) + chr(950 - 899) + '\066' + '\x32', 48728 - 48720), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\064', 8), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(510 - 399) + chr(0b110100) + chr(1646 - 1592), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(11784 - 11673) + chr(54) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010001 + 0o36) + '\x31' + '\067' + chr(0b110101), 8), ehT0Px3KOsy9(chr(2203 - 2155) + '\x6f' + '\063' + chr(2127 - 2077) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1783 - 1735) + chr(0b1101111) + chr(49) + '\x34' + chr(55), 0b1000), ehT0Px3KOsy9(chr(981 - 933) + chr(111) + '\061' + chr(0b100110 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8706 - 8595) + chr(0b10100 + 0o35) + chr(49) + chr(55), 47227 - 47219), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110011) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(51) + chr(0b10111 + 0o33) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(708 - 658) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\x36' + chr(55), 24686 - 24678), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(0b11000 + 0o32) + chr(0b1001 + 0o52), 8), ehT0Px3KOsy9(chr(381 - 333) + '\x6f' + chr(921 - 871) + '\060' + chr(0b101101 + 0o3), 15466 - 15458), ehT0Px3KOsy9(chr(48) + chr(11477 - 11366) + '\x31' + chr(0b110111) + '\x33', 50344 - 50336)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(8391 - 8280) + chr(1262 - 1209) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'['), '\144' + '\145' + chr(5542 - 5443) + chr(10447 - 10336) + '\144' + chr(101))('\165' + '\x74' + '\146' + '\055' + chr(0b110 + 0o62)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Usx5_tnbQ5R4(GyhQ1Iopww6m, lmyewJocwkxB, ICnty4yNE3Zz, kwWCbiWUCezq, YJ1Ho2nmjmPl, _ot6CvKfFhL0, R5oNZFYE7jtB, lV3FkowUAncj, Ntj8wLboIg4O, hojfa0zbgkh3, y07CCcAcy8Rf=ehT0Px3KOsy9(chr(1182 - 1134) + chr(0b1101111) + chr(49), 0o10), uZ9gmvmeV_oP=None, FRqNoLmvqdQl=None, Ct55e2RMOtPX=None): if lV3FkowUAncj: assert _ot6CvKfFhL0 == xafqLlk3kkUe(SXOLrMavuUCe(b'\x05.\xe9\x08\xf4\xd3'), '\x64' + '\145' + '\143' + '\157' + chr(0b0 + 0o144) + '\145')(chr(0b11110 + 0o127) + chr(0b1100000 + 0o24) + '\146' + chr(0b101101) + '\070') if FRqNoLmvqdQl: assert Ct55e2RMOtPX is not None mOm1AorxMOLi = IDJ2eXGCBCDu.summary.FileWriter(YJ1Ho2nmjmPl) V2Ka7YDfMK26 = () M8EIoTs2GJXE = {} if R5oNZFYE7jtB in [xafqLlk3kkUe(SXOLrMavuUCe(b'\x14&\xe0\x0f\xe3\xf5\xa1a! '), '\x64' + chr(0b111001 + 0o54) + chr(99) + chr(5199 - 5088) + '\x64' + chr(0b100001 + 0o104))(chr(117) + '\x74' + '\146' + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x14&\xe0\x0f\xe3\xf5\xa0m-9\xc1\xa5U:_'), chr(0b1011010 + 0o12) + chr(0b111000 + 0o55) + chr(0b10100 + 0o117) + '\x6f' + '\144' + '\x65')(chr(117) + chr(0b1110100) + chr(0b1010001 + 0o25) + '\055' + chr(0b111000))]: if not lV3FkowUAncj: if hojfa0zbgkh3: xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'8 \xee\x04\xd3\xc3\xa1w'), '\x64' + chr(0b1100101) + chr(1703 - 1604) + '\157' + chr(100) + chr(0b1100101))('\x75' + chr(6737 - 6621) + chr(0b1010100 + 0o22) + chr(0b101101) + chr(56)))(hojfa0zbgkh3) V2Ka7YDfMK26 = [feDooRjkbHzt.WholeVideoWriter(fps=ehT0Px3KOsy9('\x30' + '\x6f' + chr(1356 - 1307) + '\062', 31902 - 31894), output_path=oqhJDdMJfuwx.path.join(hojfa0zbgkh3, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e<\xab\x00\xe1\xc3'), chr(100) + chr(0b1000011 + 0o42) + '\x63' + chr(0b1101111) + '\144' + chr(0b1100101))('\165' + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\x38').V4roHaS3Ppej(WVxHKyX45z_L)), file_format=xafqLlk3kkUe(SXOLrMavuUCe(b'\x147\xec'), '\x64' + chr(0b110 + 0o137) + '\x63' + '\157' + chr(0b1100100) + chr(1736 - 1635))(chr(0b11110 + 0o127) + chr(116) + '\x66' + '\x2d' + chr(56))) for WVxHKyX45z_L in vQr8gNKaIaWE(y07CCcAcy8Rf)] M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\x107\xe4\r\xc8\xcc\xbd'), chr(0b101010 + 0o72) + chr(4399 - 4298) + '\143' + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(7086 - 6970) + '\x66' + chr(0b100000 + 0o15) + chr(0b11111 + 0o31))] = X75a9JxjDxha(_ot6CvKfFhL0, R5oNZFYE7jtB, lmyewJocwkxB, kwWCbiWUCezq, log_every_steps=Ntj8wLboIg4O, video_writers=V2Ka7YDfMK26, random_starts_step_limit=uZ9gmvmeV_oP) gEY30c7K0x8W = dS9nMkNNnOq2.evaluate_all_configs(GyhQ1Iopww6m, ICnty4yNE3Zz, **M8EIoTs2GJXE) else: gEY30c7K0x8W = H1fEmy7WhNMc(_ot6CvKfFhL0, GyhQ1Iopww6m, lmyewJocwkxB, kwWCbiWUCezq, ICnty4yNE3Zz, uZ9gmvmeV_oP, hojfa0zbgkh3, Ntj8wLboIg4O) xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'\x064\xe8\x0c\xf6\xd8\xba~%\x13\xc0\xa1U-R\x1e"'), chr(100) + chr(101) + '\x63' + chr(8141 - 8030) + chr(0b1100 + 0o130) + chr(101))('\x75' + chr(116) + chr(0b1100110) + chr(45) + '\x38'))(mOm1AorxMOLi, gEY30c7K0x8W, ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(2274 - 2226), ord("\x08"))) for TEiFeTBBrmQQ in V2Ka7YDfMK26: xafqLlk3kkUe(TEiFeTBBrmQQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x13(\xeb\x08\xe4\xc2\x8cp/\x13\xc9\xadR4'), chr(6737 - 6637) + '\x65' + chr(0b1001000 + 0o33) + '\157' + chr(0b111011 + 0o51) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1000110 + 0o40) + chr(2002 - 1957) + chr(56)))() if FRqNoLmvqdQl: if Ct55e2RMOtPX == xafqLlk3kkUe(SXOLrMavuUCe(b'\x18$\xe4\x0f\xc8\xd8\xb6s!>\xc9'), chr(5670 - 5570) + chr(0b1010 + 0o133) + '\143' + '\157' + chr(8418 - 8318) + chr(101))(chr(0b1110101) + chr(0b1000000 + 0o64) + '\x66' + '\x2d' + chr(0b111000)): Fk10FZM6EP2K = dS9nMkNNnOq2.get_metric_name(sampling_temp=GyhQ1Iopww6m.dXdg5YsfUP4x[ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(10754 - 10643) + '\060', 8)], max_num_noops=GyhQ1Iopww6m.OwVsnpOOrOZC, clipped=ehT0Px3KOsy9('\060' + '\157' + chr(48), 8)) FRqNoLmvqdQl(gEY30c7K0x8W[Fk10FZM6EP2K], ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000), 8)) else: FRqNoLmvqdQl(gEY30c7K0x8W[Ct55e2RMOtPX], ehT0Px3KOsy9('\x30' + chr(0b1000101 + 0o52) + chr(167 - 119), 8)) return gEY30c7K0x8W
tensorflow/tensor2tensor
tensor2tensor/rl/evaluator.py
get_game_for_worker
def get_game_for_worker(map_name, directory_id): """Get game for the given worker (directory) id.""" if map_name == "v100unfriendly": games = ["chopper_command", "boxing", "asterix", "seaquest"] worker_per_game = 5 elif map_name == "human_nice": games = gym_env.ATARI_GAMES_WITH_HUMAN_SCORE_NICE worker_per_game = 5 else: raise ValueError("Unknown worker to game map name: %s" % map_name) games.sort() game_id = (directory_id - 1) // worker_per_game tf.logging.info("Getting game %d from %s." % (game_id, games)) return games[game_id]
python
def get_game_for_worker(map_name, directory_id): """Get game for the given worker (directory) id.""" if map_name == "v100unfriendly": games = ["chopper_command", "boxing", "asterix", "seaquest"] worker_per_game = 5 elif map_name == "human_nice": games = gym_env.ATARI_GAMES_WITH_HUMAN_SCORE_NICE worker_per_game = 5 else: raise ValueError("Unknown worker to game map name: %s" % map_name) games.sort() game_id = (directory_id - 1) // worker_per_game tf.logging.info("Getting game %d from %s." % (game_id, games)) return games[game_id]
[ "def", "get_game_for_worker", "(", "map_name", ",", "directory_id", ")", ":", "if", "map_name", "==", "\"v100unfriendly\"", ":", "games", "=", "[", "\"chopper_command\"", ",", "\"boxing\"", ",", "\"asterix\"", ",", "\"seaquest\"", "]", "worker_per_game", "=", "5", "elif", "map_name", "==", "\"human_nice\"", ":", "games", "=", "gym_env", ".", "ATARI_GAMES_WITH_HUMAN_SCORE_NICE", "worker_per_game", "=", "5", "else", ":", "raise", "ValueError", "(", "\"Unknown worker to game map name: %s\"", "%", "map_name", ")", "games", ".", "sort", "(", ")", "game_id", "=", "(", "directory_id", "-", "1", ")", "//", "worker_per_game", "tf", ".", "logging", ".", "info", "(", "\"Getting game %d from %s.\"", "%", "(", "game_id", ",", "games", ")", ")", "return", "games", "[", "game_id", "]" ]
Get game for the given worker (directory) id.
[ "Get", "game", "for", "the", "given", "worker", "(", "directory", ")", "id", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/evaluator.py#L464-L477
train
Get the game for the given worker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bd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PkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(2063 - 2015) + chr(0b1001100 + 0o43) + chr(0b110001) + '\x35' + '\x31', 40601 - 40593), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(741 - 692) + '\060' + chr(0b101011 + 0o11), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101010 + 0o12) + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110000) + chr(921 - 872), 48345 - 48337), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1010001 + 0o36) + chr(0b110001) + chr(0b110000) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(53) + chr(55), 13249 - 13241), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + chr(0b1111 + 0o43) + chr(0b100100 + 0o21) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(48) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\x34' + chr(1660 - 1606), 0b1000), ehT0Px3KOsy9(chr(982 - 934) + chr(2727 - 2616) + '\x32' + chr(0b110010) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(2365 - 2314) + chr(0b110000) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(565 - 514) + chr(53) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\064' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(0b101100 + 0o7) + chr(0b110001) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + '\061' + chr(49), 64585 - 64577), ehT0Px3KOsy9(chr(0b110000) + chr(8731 - 8620) + '\x32' + chr(0b110001) + chr(54), 0o10), ehT0Px3KOsy9(chr(749 - 701) + chr(0b1101111) + chr(0b110111) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110100 + 0o73) + '\061' + chr(49) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + chr(0b110010) + chr(50) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(6980 - 6869) + chr(776 - 722) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b10110 + 0o33) + chr(339 - 291), 20697 - 20689), ehT0Px3KOsy9('\x30' + chr(111) + chr(1112 - 1062) + '\x35' + chr(1409 - 1354), 0b1000), ehT0Px3KOsy9('\060' + chr(10495 - 10384) + chr(0b110010) + chr(0b11111 + 0o26), 5214 - 5206), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10000 + 0o42) + '\066' + '\064', 0b1000), ehT0Px3KOsy9(chr(1494 - 1446) + '\157' + '\061' + chr(0b100100 + 0o15) + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111111 + 0o60) + chr(51) + '\x31' + chr(0b110101), 5500 - 5492), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x30' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(53) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(399 - 347), 6382 - 6374), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(6850 - 6739) + chr(0b110110) + chr(2373 - 2321), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1345 - 1294) + chr(762 - 708) + chr(0b110110), 26208 - 26200), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(50) + '\066' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1181 - 1133) + chr(111) + chr(0b110001) + chr(0b110000 + 0o7) + chr(359 - 311), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b1010 + 0o53) + chr(49), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b0 + 0o67) + chr(499 - 448), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\066' + chr(52), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + chr(2517 - 2466) + chr(0b110000) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(2474 - 2363) + chr(1748 - 1699) + '\062' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(0b110011) + '\x34' + chr(0b101110 + 0o7), 12578 - 12570), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11100 + 0o27) + '\061' + chr(0b110110), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(3271 - 3160) + chr(53) + '\060', 24865 - 24857)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'G'), chr(0b11110 + 0o106) + chr(5578 - 5477) + chr(3803 - 3704) + chr(0b1101111) + '\x64' + chr(8462 - 8361))('\x75' + chr(0b1110100) + chr(3989 - 3887) + chr(45) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def u9tU_qF9zvxW(nDrkiNwX9yWz, tpYOtqtjlNMO): if nDrkiNwX9yWz == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1fu\x17\xf13\x01\xc8\xf2\xcf\xf7\xaa\x8bO\xb7'), chr(2418 - 2318) + '\x65' + chr(0b110110 + 0o55) + chr(0b1101111) + '\x64' + chr(9728 - 9627))('\x75' + '\164' + chr(102) + chr(45) + chr(0b111000)): cg2I4aM6OQ_J = [xafqLlk3kkUe(SXOLrMavuUCe(b'\n,H\xb16\n\xdc\xdf\xc5\xfd\xa9\x82B\xa0m'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(9809 - 9698) + '\144' + chr(8305 - 8204))('\165' + chr(116) + chr(102) + chr(1522 - 1477) + chr(0b1001 + 0o57)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b+_\xa8(\x08'), '\x64' + chr(0b1100101) + chr(2780 - 2681) + chr(0b1101111) + chr(2816 - 2716) + '\145')(chr(0b110111 + 0o76) + chr(0b1010001 + 0o43) + chr(0b1100 + 0o132) + chr(45) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x087S\xa44\x06\xd6'), chr(100) + chr(101) + chr(0b10100 + 0o117) + chr(111) + chr(6300 - 6200) + '\145')(chr(0b1110101) + chr(3586 - 3470) + chr(0b1111 + 0o127) + chr(0b11101 + 0o20) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a!F\xb03\n\xdd\xf4'), chr(0b100100 + 0o100) + '\145' + chr(0b110100 + 0o57) + chr(0b1000000 + 0o57) + '\x64' + chr(0b1100101))('\x75' + '\x74' + '\146' + chr(45) + chr(2185 - 2129))] YYj8aZxNpbM_ = ehT0Px3KOsy9('\060' + '\157' + chr(0b110101), 0b1000) elif nDrkiNwX9yWz == xafqLlk3kkUe(SXOLrMavuUCe(b'\x011J\xa0(0\xc0\xe9\xc5\xf7'), '\x64' + chr(101) + chr(0b1100011) + chr(4660 - 4549) + chr(0b1100100) + '\x65')(chr(0b11 + 0o162) + chr(116) + chr(7823 - 7721) + chr(0b101101) + '\070'): cg2I4aM6OQ_J = WrYi4sKkxlBa.ATARI_GAMES_WITH_HUMAN_SCORE_NICE YYj8aZxNpbM_ = ehT0Px3KOsy9(chr(996 - 948) + chr(0b1010010 + 0o35) + '\065', 8) else: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'<*L\xaf)\x18\xc0\xa0\xd1\xfd\xb6\x84F\xbc)\xfaPm\xf3P\xe5\xca5\xd9+\xbdcDuY\x93\x8fXL\x88'), chr(0b1100100) + chr(101) + chr(0b100110 + 0o75) + '\x6f' + chr(100) + '\x65')('\165' + '\x74' + chr(10257 - 10155) + '\055' + chr(0b111000)) % nDrkiNwX9yWz) xafqLlk3kkUe(cg2I4aM6OQ_J, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a+U\xb5'), chr(100) + chr(0b1100101) + chr(8722 - 8623) + chr(0b101101 + 0o102) + chr(0b1010 + 0o132) + '\145')('\165' + chr(0b1110100) + '\x66' + chr(0b10100 + 0o31) + chr(1467 - 1411)))() HFHfmdP3AZEx = (tpYOtqtjlNMO - ehT0Px3KOsy9(chr(48) + '\157' + '\061', ord("\x08"))) // YYj8aZxNpbM_ xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b':so\xb93\x0c\xc9\xb7\xcc\xfe\x9e\x84'), '\144' + chr(0b1100101) + '\x63' + '\x6f' + chr(9563 - 9463) + '\145')('\x75' + '\x74' + '\x66' + chr(0b101101) + chr(2148 - 2092)))(xafqLlk3kkUe(SXOLrMavuUCe(b'.!S\xb5/\x01\xc9\xa0\xc1\xf3\xa9\x8a\x03\xebm\xaeY?\xfb\\\xa8\x8af\x9a'), '\x64' + chr(5492 - 5391) + chr(0b1011001 + 0o12) + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + chr(116) + chr(0b1000100 + 0o42) + chr(74 - 29) + '\070') % (HFHfmdP3AZEx, cg2I4aM6OQ_J)) return cg2I4aM6OQ_J[HFHfmdP3AZEx]
tensorflow/tensor2tensor
tensor2tensor/envs/tic_tac_toe_env.py
get_open_spaces
def get_open_spaces(board): """Given a representation of the board, returns a list of open spaces.""" open_spaces = [] for i in range(3): for j in range(3): if board[i][j] == 0: open_spaces.append(encode_pos(i, j)) return open_spaces
python
def get_open_spaces(board): """Given a representation of the board, returns a list of open spaces.""" open_spaces = [] for i in range(3): for j in range(3): if board[i][j] == 0: open_spaces.append(encode_pos(i, j)) return open_spaces
[ "def", "get_open_spaces", "(", "board", ")", ":", "open_spaces", "=", "[", "]", "for", "i", "in", "range", "(", "3", ")", ":", "for", "j", "in", "range", "(", "3", ")", ":", "if", "board", "[", "i", "]", "[", "j", "]", "==", "0", ":", "open_spaces", ".", "append", "(", "encode_pos", "(", "i", ",", "j", ")", ")", "return", "open_spaces" ]
Given a representation of the board, returns a list of open spaces.
[ "Given", "a", "representation", "of", "the", "board", "returns", "a", "list", "of", "open", "spaces", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/envs/tic_tac_toe_env.py#L46-L53
train
Given a representation of the board returns a list of open spaces.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwF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fR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\066' + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(233 - 184) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(1307 - 1258) + '\067' + chr(0b100100 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(0b110010) + chr(0b100000 + 0o22) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4076 - 3965) + '\065', 46150 - 46142), ehT0Px3KOsy9(chr(1383 - 1335) + '\157' + chr(0b100110 + 0o17), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(590 - 541) + '\062' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b100100 + 0o23) + chr(1812 - 1763), ord("\x08")), ehT0Px3KOsy9(chr(896 - 848) + chr(111) + chr(0b110001) + '\063', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10101 + 0o34) + chr(1004 - 956) + '\x32', 49881 - 49873), ehT0Px3KOsy9(chr(929 - 881) + chr(0b11111 + 0o120) + '\x32' + '\063' + chr(0b10111 + 0o37), 60624 - 60616), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b110010 + 0o0) + chr(0b110101) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(1037 - 926) + chr(0b110010) + chr(0b110001 + 0o4) + '\060', 8), ehT0Px3KOsy9(chr(0b110000) + chr(4058 - 3947) + '\061' + '\x33' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(10058 - 9947) + chr(0b10000 + 0o44) + chr(0b110010 + 0o1), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10792 - 10681) + chr(0b10111 + 0o32) + chr(0b111 + 0o53) + chr(1156 - 1107), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(4384 - 4273) + chr(0b110001), 41673 - 41665), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(0b110111) + chr(274 - 223), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(285 - 234) + chr(1181 - 1129) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\064' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111 + 0o150) + chr(51) + '\x35' + chr(55), 0o10), ehT0Px3KOsy9(chr(1654 - 1606) + chr(0b1101111) + '\x37', 29259 - 29251), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(52) + chr(1620 - 1568), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1036 - 985) + chr(0b101010 + 0o7) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(386 - 336) + chr(0b110001) + chr(0b11001 + 0o36), 0o10), ehT0Px3KOsy9('\060' + chr(6045 - 5934) + chr(0b1000 + 0o56) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(4737 - 4626) + chr(0b110010) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(2565 - 2454) + chr(0b110010) + chr(865 - 810) + chr(0b110000 + 0o2), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\067' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x32' + '\x32', 8), ehT0Px3KOsy9(chr(426 - 378) + chr(0b1101111) + chr(1938 - 1889) + chr(51) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(0b100111 + 0o15) + '\064', 8), ehT0Px3KOsy9(chr(1374 - 1326) + chr(0b1101111) + chr(51) + chr(0b110110) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\x37' + '\x31', 38969 - 38961), ehT0Px3KOsy9(chr(1340 - 1292) + chr(0b1101111) + chr(0b11101 + 0o26) + '\063' + chr(0b10110 + 0o34), 45293 - 45285), ehT0Px3KOsy9('\x30' + chr(5769 - 5658) + chr(0b10010 + 0o37) + chr(278 - 230) + chr(2243 - 2195), 52337 - 52329), ehT0Px3KOsy9(chr(0b110000) + chr(4855 - 4744) + chr(1575 - 1521) + chr(0b101000 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + '\x33' + chr(0b110111) + chr(54), 0o10), ehT0Px3KOsy9(chr(782 - 734) + chr(0b100101 + 0o112) + chr(1774 - 1725), 8), ehT0Px3KOsy9(chr(2247 - 2199) + chr(9964 - 9853) + '\067' + chr(48), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(53) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xda'), chr(100) + chr(101) + chr(653 - 554) + '\x6f' + chr(100) + chr(0b1100101))('\165' + chr(13100 - 12984) + chr(0b1001 + 0o135) + chr(1273 - 1228) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def xLjp8NgGHmPR(h3qkoJjQJPeh): VtpgUXzppYHQ = [] for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063', ord("\x08"))): for tlORBuYsiw3X in vQr8gNKaIaWE(ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011), 8)): if h3qkoJjQJPeh[WVxHKyX45z_L][tlORBuYsiw3X] == ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1958 - 1910), 0o10): xafqLlk3kkUe(VtpgUXzppYHQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\xbe\n\xf2ka'), '\x64' + chr(0b1100001 + 0o4) + chr(0b1010101 + 0o16) + '\x6f' + chr(100) + '\x65')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(724 - 679) + chr(211 - 155)))(uGurzUOB87v9(WVxHKyX45z_L, tlORBuYsiw3X)) return VtpgUXzppYHQ
tensorflow/tensor2tensor
tensor2tensor/envs/tic_tac_toe_env.py
get_reward_and_done
def get_reward_and_done(board): """Given a representation of the board, returns reward and done.""" # Returns (reward, done) where: # reward: -1 means lost, +1 means win, 0 means draw or continuing. # done: True if the game is over, i.e. someone won or it is a draw. # Sum all rows ... all_sums = [np.sum(board[i, :]) for i in range(3)] # ... all columns all_sums.extend([np.sum(board[:, i]) for i in range(3)]) # and both diagonals. all_sums.append(np.sum([board[i, i] for i in range(3)])) all_sums.append(np.sum([board[i, 2 - i] for i in range(3)])) if -3 in all_sums: return -1, True if 3 in all_sums: return 1, True done = True if get_open_spaces(board): done = False return 0, done
python
def get_reward_and_done(board): """Given a representation of the board, returns reward and done.""" # Returns (reward, done) where: # reward: -1 means lost, +1 means win, 0 means draw or continuing. # done: True if the game is over, i.e. someone won or it is a draw. # Sum all rows ... all_sums = [np.sum(board[i, :]) for i in range(3)] # ... all columns all_sums.extend([np.sum(board[:, i]) for i in range(3)]) # and both diagonals. all_sums.append(np.sum([board[i, i] for i in range(3)])) all_sums.append(np.sum([board[i, 2 - i] for i in range(3)])) if -3 in all_sums: return -1, True if 3 in all_sums: return 1, True done = True if get_open_spaces(board): done = False return 0, done
[ "def", "get_reward_and_done", "(", "board", ")", ":", "# Returns (reward, done) where:", "# reward: -1 means lost, +1 means win, 0 means draw or continuing.", "# done: True if the game is over, i.e. someone won or it is a draw.", "# Sum all rows ...", "all_sums", "=", "[", "np", ".", "sum", "(", "board", "[", "i", ",", ":", "]", ")", "for", "i", "in", "range", "(", "3", ")", "]", "# ... all columns", "all_sums", ".", "extend", "(", "[", "np", ".", "sum", "(", "board", "[", ":", ",", "i", "]", ")", "for", "i", "in", "range", "(", "3", ")", "]", ")", "# and both diagonals.", "all_sums", ".", "append", "(", "np", ".", "sum", "(", "[", "board", "[", "i", ",", "i", "]", "for", "i", "in", "range", "(", "3", ")", "]", ")", ")", "all_sums", ".", "append", "(", "np", ".", "sum", "(", "[", "board", "[", "i", ",", "2", "-", "i", "]", "for", "i", "in", "range", "(", "3", ")", "]", ")", ")", "if", "-", "3", "in", "all_sums", ":", "return", "-", "1", ",", "True", "if", "3", "in", "all_sums", ":", "return", "1", ",", "True", "done", "=", "True", "if", "get_open_spaces", "(", "board", ")", ":", "done", "=", "False", "return", "0", ",", "done" ]
Given a representation of the board, returns reward and done.
[ "Given", "a", "representation", "of", "the", "board", "returns", "reward", "and", "done", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/envs/tic_tac_toe_env.py#L56-L80
train
Given a representation of the board returns reward and done.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WT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8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b100001 + 0o26) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2297 - 2186) + '\x32' + chr(0b100111 + 0o13) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + chr(0b1110 + 0o43) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1100 + 0o51), 0b1000), ehT0Px3KOsy9(chr(1571 - 1523) + '\157' + chr(0b11100 + 0o27) + chr(0b100111 + 0o13) + '\064', 0o10), ehT0Px3KOsy9(chr(1636 - 1588) + chr(0b1101111) + '\x32' + chr(2392 - 2341), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(1296 - 1247) + chr(52) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + '\x36' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + chr(0b110010) + chr(51) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\x35' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(51) + chr(0b0 + 0o65), 0o10), ehT0Px3KOsy9(chr(1661 - 1613) + '\x6f' + chr(0b111 + 0o54) + chr(0b110011) + '\062', 0o10), ehT0Px3KOsy9(chr(2216 - 2168) + chr(1285 - 1174) + '\x33' + chr(0b110010) + chr(0b101010 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1460 - 1411) + '\x33', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(1912 - 1863) + chr(0b11011 + 0o33), 61499 - 61491), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1000 + 0o53) + '\x37' + chr(0b10110 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b110111) + chr(440 - 390), 11794 - 11786), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(1316 - 1267) + chr(2295 - 2246), 9142 - 9134), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(306 - 257) + '\x33' + chr(1277 - 1225), ord("\x08")), ehT0Px3KOsy9(chr(1265 - 1217) + chr(111) + chr(1123 - 1074) + chr(55) + '\065', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1023 - 974) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(463 - 415) + chr(111) + chr(49) + '\x36' + chr(0b11100 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(650 - 602) + chr(5910 - 5799) + chr(51) + '\064' + chr(53), 17033 - 17025), ehT0Px3KOsy9('\x30' + chr(11022 - 10911) + chr(0b110011) + chr(2069 - 2020) + chr(2060 - 2005), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101001 + 0o10) + '\x30' + '\x37', 0o10), ehT0Px3KOsy9(chr(1609 - 1561) + '\157' + '\x33' + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + '\x31' + chr(52) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x36' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(51) + chr(0b11010 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + '\063' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(12270 - 12159) + chr(53) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + chr(0b110000 + 0o2) + chr(611 - 562), 7045 - 7037), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100000 + 0o23) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\060' + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10111 + 0o34) + '\x37' + chr(0b110101), 52634 - 52626), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(5813 - 5702) + '\x33' + '\x30' + chr(52), 22975 - 22967), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(51) + chr(0b110111), 64211 - 64203), ehT0Px3KOsy9('\060' + chr(3937 - 3826) + '\x33' + chr(2036 - 1985) + '\x35', 8), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + '\x31' + chr(54) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(654 - 606) + '\157' + chr(0b110011) + chr(54) + '\x37', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(0b110101) + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'S'), '\x64' + '\145' + chr(99) + chr(111) + chr(0b1000011 + 0o41) + '\145')('\x75' + chr(116) + '\x66' + '\055' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def r2QSRI0OF6TO(h3qkoJjQJPeh): NXu_KKJa10At = [WqUC3KWvYVup.xkxBmo49x2An(h3qkoJjQJPeh[WVxHKyX45z_L, :]) for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33', 0o10))] xafqLlk3kkUe(NXu_KKJa10At, xafqLlk3kkUe(SXOLrMavuUCe(b'\x18\xe8}`\xbaw'), chr(100) + chr(7942 - 7841) + chr(6653 - 6554) + '\157' + '\144' + chr(0b11000 + 0o115))('\165' + chr(116) + '\x66' + '\x2d' + '\x38'))([xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xfbqG\xb9|WI\xe4\xdf\x9c\xb4'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\x6f' + '\144' + chr(0b1001001 + 0o34))(chr(2042 - 1925) + '\164' + chr(0b111 + 0o137) + chr(0b101100 + 0o1) + '\x38'))(h3qkoJjQJPeh[:, WVxHKyX45z_L]) for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011), 8))]) xafqLlk3kkUe(NXu_KKJa10At, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xe0y`\xbaw'), chr(100) + chr(9826 - 9725) + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + chr(838 - 736) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xfbqG\xb9|WI\xe4\xdf\x9c\xb4'), chr(0b1010111 + 0o15) + chr(0b1100101) + chr(8159 - 8060) + chr(0b1100010 + 0o15) + chr(100) + chr(3269 - 3168))(chr(8612 - 8495) + '\164' + '\x66' + '\x2d' + '\x38'))([h3qkoJjQJPeh[WVxHKyX45z_L, WVxHKyX45z_L] for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + '\x33', 8))])) xafqLlk3kkUe(NXu_KKJa10At, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xe0y`\xbaw'), '\x64' + '\145' + chr(0b1100011) + chr(7993 - 7882) + chr(8509 - 8409) + chr(101))('\x75' + chr(0b1110100) + chr(0b1011101 + 0o11) + chr(1347 - 1302) + chr(1665 - 1609)))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xfbqG\xb9|WI\xe4\xdf\x9c\xb4'), chr(7557 - 7457) + chr(0b1100101) + chr(0b1100011) + chr(111) + '\x64' + '\x65')(chr(0b1110101) + chr(12760 - 12644) + '\146' + chr(45) + '\x38'))([h3qkoJjQJPeh[WVxHKyX45z_L, ehT0Px3KOsy9(chr(1353 - 1305) + chr(111) + chr(0b11011 + 0o27), 57901 - 57893) - WVxHKyX45z_L] for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9(chr(983 - 935) + chr(0b11100 + 0o123) + chr(0b10100 + 0o37), 8))])) if -ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11010 + 0o31), 8) in NXu_KKJa10At: return (-ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 0o10), ehT0Px3KOsy9(chr(288 - 240) + chr(0b1001001 + 0o46) + chr(49), 8)) if ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063', 8) in NXu_KKJa10At: return (ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(1393 - 1344), 8), ehT0Px3KOsy9(chr(2055 - 2007) + '\x6f' + '\061', 8)) Ki86oC9WfglU = ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + '\061', 8) if xLjp8NgGHmPR(h3qkoJjQJPeh): Ki86oC9WfglU = ehT0Px3KOsy9(chr(1911 - 1863) + '\x6f' + chr(0b10111 + 0o31), 41057 - 41049) return (ehT0Px3KOsy9('\060' + chr(111) + chr(0b110000), 8), Ki86oC9WfglU)
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
decode_hparams
def decode_hparams(overrides=""): """Hyperparameters for decoding.""" hp = hparam.HParams( save_images=False, log_results=True, extra_length=100, min_length_ratio=0.0, batch_size=0, beam_size=4, alpha=0.6, eos_penalty=0.0, block_size=0, guess_and_check_top_k=0, guess_and_check_epsilon=-1, insertion_parallel=False, return_beams=False, write_beam_scores=False, max_input_size=-1, identity_output=False, num_samples=-1, # Number of examples to decode. delimiter="\n", decode_to_file="", # str. Prefix for filename to write decodings to. decode_reference="", # str. Filename to read references from. decode_in_memory=False, # How much decode should wait for the next checkpoint decode_timeout_mins=240, summaries_log_dir="decode", # Directory to write hook summaries. shards=1, # How many shards of data to decode (treating 1 as None). shard_id=0, # Which shard are we decoding if more than 1 above. shards_start_offset=0, # Number of the first shard to decode. shard_google_format=False, # If True use Google shard naming format. num_decodes=1, # Number of times to go over the dataset. force_decode_length=False, display_decoded_images=False, # Multi-problem decoding task id. multiproblem_task_id=-1, # Used for video decoding. frames_per_second=10, skip_eos_postprocess=False, # Creates a blue/red border covering border_percent of the frame. border_percent=2, # Maximum number of videos displayed. # number of videos displayed = max_display_outputs * max_display_decodes max_display_outputs=10, max_display_decodes=5, # Used in computation of VGG feature based video metrics. # Set this to be the path to a trained VGG ckpt to output # useful metrics. vgg_ckpt_path="", # Used for MLPerf compliance logging. mlperf_decode_step=0.0, mlperf_threshold=25.0, mlperf_success=False) hp.parse(overrides) return hp
python
def decode_hparams(overrides=""): """Hyperparameters for decoding.""" hp = hparam.HParams( save_images=False, log_results=True, extra_length=100, min_length_ratio=0.0, batch_size=0, beam_size=4, alpha=0.6, eos_penalty=0.0, block_size=0, guess_and_check_top_k=0, guess_and_check_epsilon=-1, insertion_parallel=False, return_beams=False, write_beam_scores=False, max_input_size=-1, identity_output=False, num_samples=-1, # Number of examples to decode. delimiter="\n", decode_to_file="", # str. Prefix for filename to write decodings to. decode_reference="", # str. Filename to read references from. decode_in_memory=False, # How much decode should wait for the next checkpoint decode_timeout_mins=240, summaries_log_dir="decode", # Directory to write hook summaries. shards=1, # How many shards of data to decode (treating 1 as None). shard_id=0, # Which shard are we decoding if more than 1 above. shards_start_offset=0, # Number of the first shard to decode. shard_google_format=False, # If True use Google shard naming format. num_decodes=1, # Number of times to go over the dataset. force_decode_length=False, display_decoded_images=False, # Multi-problem decoding task id. multiproblem_task_id=-1, # Used for video decoding. frames_per_second=10, skip_eos_postprocess=False, # Creates a blue/red border covering border_percent of the frame. border_percent=2, # Maximum number of videos displayed. # number of videos displayed = max_display_outputs * max_display_decodes max_display_outputs=10, max_display_decodes=5, # Used in computation of VGG feature based video metrics. # Set this to be the path to a trained VGG ckpt to output # useful metrics. vgg_ckpt_path="", # Used for MLPerf compliance logging. mlperf_decode_step=0.0, mlperf_threshold=25.0, mlperf_success=False) hp.parse(overrides) return hp
[ "def", "decode_hparams", "(", "overrides", "=", "\"\"", ")", ":", "hp", "=", "hparam", ".", "HParams", "(", "save_images", "=", "False", ",", "log_results", "=", "True", ",", "extra_length", "=", "100", ",", "min_length_ratio", "=", "0.0", ",", "batch_size", "=", "0", ",", "beam_size", "=", "4", ",", "alpha", "=", "0.6", ",", "eos_penalty", "=", "0.0", ",", "block_size", "=", "0", ",", "guess_and_check_top_k", "=", "0", ",", "guess_and_check_epsilon", "=", "-", "1", ",", "insertion_parallel", "=", "False", ",", "return_beams", "=", "False", ",", "write_beam_scores", "=", "False", ",", "max_input_size", "=", "-", "1", ",", "identity_output", "=", "False", ",", "num_samples", "=", "-", "1", ",", "# Number of examples to decode.", "delimiter", "=", "\"\\n\"", ",", "decode_to_file", "=", "\"\"", ",", "# str. Prefix for filename to write decodings to.", "decode_reference", "=", "\"\"", ",", "# str. Filename to read references from.", "decode_in_memory", "=", "False", ",", "# How much decode should wait for the next checkpoint", "decode_timeout_mins", "=", "240", ",", "summaries_log_dir", "=", "\"decode\"", ",", "# Directory to write hook summaries.", "shards", "=", "1", ",", "# How many shards of data to decode (treating 1 as None).", "shard_id", "=", "0", ",", "# Which shard are we decoding if more than 1 above.", "shards_start_offset", "=", "0", ",", "# Number of the first shard to decode.", "shard_google_format", "=", "False", ",", "# If True use Google shard naming format.", "num_decodes", "=", "1", ",", "# Number of times to go over the dataset.", "force_decode_length", "=", "False", ",", "display_decoded_images", "=", "False", ",", "# Multi-problem decoding task id.", "multiproblem_task_id", "=", "-", "1", ",", "# Used for video decoding.", "frames_per_second", "=", "10", ",", "skip_eos_postprocess", "=", "False", ",", "# Creates a blue/red border covering border_percent of the frame.", "border_percent", "=", "2", ",", "# Maximum number of videos displayed.", "# number of videos displayed = max_display_outputs * max_display_decodes", "max_display_outputs", "=", "10", ",", "max_display_decodes", "=", "5", ",", "# Used in computation of VGG feature based video metrics.", "# Set this to be the path to a trained VGG ckpt to output", "# useful metrics.", "vgg_ckpt_path", "=", "\"\"", ",", "# Used for MLPerf compliance logging.", "mlperf_decode_step", "=", "0.0", ",", "mlperf_threshold", "=", "25.0", ",", "mlperf_success", "=", "False", ")", "hp", ".", "parse", "(", "overrides", ")", "return", "hp" ]
Hyperparameters for decoding.
[ "Hyperparameters", "for", "decoding", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L47-L101
train
Hyperparameters for decoding.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,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LUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b10001 + 0o42) + chr(1989 - 1936) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b110101) + chr(0b101001 + 0o14), 0o10), ehT0Px3KOsy9(chr(2095 - 2047) + chr(0b1101111) + '\064' + chr(0b11110 + 0o31), 61001 - 60993), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(0b110010) + '\x31' + '\063', 18557 - 18549), ehT0Px3KOsy9('\x30' + chr(111) + chr(414 - 364) + chr(0b110000) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\061' + chr(51), 0b1000), ehT0Px3KOsy9(chr(1281 - 1233) + chr(0b1001011 + 0o44) + chr(0b110011) + chr(0b110101) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b110111) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b110110) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b110100 + 0o73) + chr(0b110001) + '\x36' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2041 - 1930) + '\063' + '\064' + '\060', 48205 - 48197), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b11100 + 0o25) + chr(51), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(54) + chr(0b110001), 38848 - 38840), ehT0Px3KOsy9(chr(328 - 280) + '\x6f' + chr(0b110010) + chr(0b10 + 0o63) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1016 - 966) + chr(0b11110 + 0o25), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + chr(0b110110) + chr(0b110110), 51718 - 51710), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\x35' + chr(53), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(49) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(0b11111 + 0o23) + '\067' + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101110 + 0o3) + '\063' + chr(0b11110 + 0o23), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7199 - 7088) + chr(0b100000 + 0o21) + chr(931 - 879) + chr(2651 - 2596), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(999 - 950) + chr(0b110001), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(565 - 513) + chr(55), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(52) + '\x35', 0o10), ehT0Px3KOsy9(chr(649 - 601) + chr(0b1101011 + 0o4) + chr(2356 - 2307) + '\064' + chr(0b1110 + 0o50), 35940 - 35932), ehT0Px3KOsy9(chr(441 - 393) + '\x6f' + '\x31' + '\x37' + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110 + 0o55) + chr(0b10010 + 0o40) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(2100 - 2052), 25069 - 25061), ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + chr(1799 - 1748) + chr(0b100100 + 0o23) + chr(0b110 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9058 - 8947) + chr(1988 - 1939) + '\x36' + chr(55), 2384 - 2376), ehT0Px3KOsy9('\x30' + '\157' + chr(54) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110001) + chr(221 - 167), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(50) + chr(0b101001 + 0o15), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110001) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(258 - 210) + '\157' + chr(0b110011) + '\060' + chr(50), 0o10), ehT0Px3KOsy9(chr(2130 - 2082) + '\x6f' + chr(0b110011) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(49) + chr(0b111 + 0o56), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\x35' + chr(0b10011 + 0o41), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + chr(0b1000 + 0o50), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'-'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + chr(8337 - 8237) + chr(2480 - 2379))(chr(0b1001110 + 0o47) + chr(116) + chr(0b1100110) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def LrQSWg3uwmK8(de6iQhrbBQ5Y=xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(0b1011100 + 0o10) + '\x65' + '\x63' + '\157' + '\x64' + chr(0b101101 + 0o70))('\x75' + chr(6350 - 6234) + chr(0b1100110) + '\055' + chr(0b101100 + 0o14))): ny6shRSJO9Wm = guRGmljwUVnc.HParams(save_images=ehT0Px3KOsy9(chr(48) + chr(0b101011 + 0o104) + '\x30', 8), log_results=ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001), 61475 - 61467), extra_length=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\x34' + chr(52), ord("\x08")), min_length_ratio=0.0, batch_size=ehT0Px3KOsy9(chr(1842 - 1794) + chr(111) + chr(0b10110 + 0o32), 8), beam_size=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001 + 0o3), 58323 - 58315), alpha=0.6, eos_penalty=0.0, block_size=ehT0Px3KOsy9(chr(0b110000) + chr(3162 - 3051) + chr(0b101010 + 0o6), 8), guess_and_check_top_k=ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(0b110000), 8), guess_and_check_epsilon=-ehT0Px3KOsy9(chr(0b110000) + chr(2770 - 2659) + '\x31', 8), insertion_parallel=ehT0Px3KOsy9('\060' + chr(111) + '\x30', 8), return_beams=ehT0Px3KOsy9('\060' + '\x6f' + '\x30', 8), write_beam_scores=ehT0Px3KOsy9(chr(48) + '\157' + chr(48), 8), max_input_size=-ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 8), identity_output=ehT0Px3KOsy9(chr(1869 - 1821) + '\x6f' + chr(320 - 272), 8), num_samples=-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001), 8), delimiter=xafqLlk3kkUe(SXOLrMavuUCe(b'\t'), chr(100) + '\145' + chr(99) + chr(0b1011101 + 0o22) + '\144' + chr(0b1100101))(chr(493 - 376) + chr(0b1101111 + 0o5) + chr(0b1100110) + '\x2d' + chr(2376 - 2320)), decode_to_file=xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(0b11001 + 0o113) + '\x65' + chr(99) + '\x6f' + chr(100) + '\145')('\x75' + chr(6129 - 6013) + '\x66' + '\x2d' + chr(0b10110 + 0o42)), decode_reference=xafqLlk3kkUe(SXOLrMavuUCe(b''), '\144' + chr(0b1011100 + 0o11) + '\143' + chr(0b11 + 0o154) + chr(0b1011000 + 0o14) + '\145')(chr(0b11000 + 0o135) + '\x74' + chr(0b1100110) + chr(0b11001 + 0o24) + chr(0b111000)), decode_in_memory=ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1934 - 1886), 8), decode_timeout_mins=ehT0Px3KOsy9(chr(2274 - 2226) + chr(0b1010111 + 0o30) + '\063' + '\066' + '\x30', 0o10), summaries_log_dir=xafqLlk3kkUe(SXOLrMavuUCe(b'g\x8d\x8eH\xef\xe0'), '\x64' + chr(0b1100101) + '\143' + chr(111) + '\x64' + chr(1426 - 1325))(chr(0b111 + 0o156) + chr(0b111100 + 0o70) + chr(102) + '\x2d' + '\x38'), shards=ehT0Px3KOsy9(chr(0b110000) + chr(3829 - 3718) + '\x31', 8), shard_id=ehT0Px3KOsy9('\060' + '\157' + '\060', 8), shards_start_offset=ehT0Px3KOsy9('\x30' + '\x6f' + '\060', 8), shard_google_format=ehT0Px3KOsy9(chr(48) + '\x6f' + '\x30', 8), num_decodes=ehT0Px3KOsy9('\060' + chr(111) + '\061', 8), force_decode_length=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110000), 8), display_decoded_images=ehT0Px3KOsy9(chr(0b110000) + chr(8156 - 8045) + chr(0b110000), 8), multiproblem_task_id=-ehT0Px3KOsy9(chr(48) + chr(8237 - 8126) + chr(0b110001), 8), frames_per_second=ehT0Px3KOsy9(chr(2056 - 2008) + chr(3874 - 3763) + chr(0b1000 + 0o51) + chr(0b110010), 20603 - 20595), skip_eos_postprocess=ehT0Px3KOsy9(chr(0b110000) + '\157' + '\060', 8), border_percent=ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(1849 - 1799), ord("\x08")), max_display_outputs=ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(0b110001) + chr(0b110010), 8), max_display_decodes=ehT0Px3KOsy9(chr(48) + '\157' + '\x35', 0b1000), vgg_ckpt_path=xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(0b1100100) + chr(0b1100101) + chr(0b101111 + 0o64) + chr(0b1010001 + 0o36) + '\x64' + chr(5207 - 5106))(chr(117) + chr(0b101101 + 0o107) + chr(0b1100110) + chr(0b101101) + chr(56)), mlperf_decode_step=0.0, mlperf_threshold=25.0, mlperf_success=ehT0Px3KOsy9(chr(2265 - 2217) + chr(0b1000000 + 0o57) + chr(48), 8)) xafqLlk3kkUe(ny6shRSJO9Wm, xafqLlk3kkUe(SXOLrMavuUCe(b's\x89\x9fT\xee'), chr(6418 - 6318) + chr(0b1100101) + '\x63' + chr(0b1011110 + 0o21) + '\144' + chr(101))(chr(0b101101 + 0o110) + '\164' + chr(102) + chr(0b101101) + '\x38'))(de6iQhrbBQ5Y) return ny6shRSJO9Wm
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
log_decode_results
def log_decode_results(inputs, outputs, problem_name, prediction_idx, inputs_vocab, targets_vocab, targets=None, save_images=False, output_dir=None, identity_output=False, log_results=True, skip_eos_postprocess=False): """Log inference results.""" # TODO(lukaszkaiser) refactor this into feature_encoder is_video = "video" in problem_name or "gym" in problem_name if is_video: def fix_and_save_video(vid, prefix): save_path_template = os.path.join( output_dir, "%s_%s_%05d_{:05d}.png" % (problem_name, prefix, prediction_idx)) # this is only required for predictions if vid.shape[-1] == 1: vid = np.squeeze(vid, axis=-1) save_video(vid, save_path_template) tf.logging.info("Saving video: {}".format(prediction_idx)) fix_and_save_video(inputs, "inputs") fix_and_save_video(outputs, "outputs") fix_and_save_video(targets, "targets") is_image = "image" in problem_name is_text2class = isinstance(registry.problem(problem_name), text_problems.Text2ClassProblem) skip_eos_postprocess = is_image or is_text2class or skip_eos_postprocess decoded_inputs = None if is_image and save_images: save_path = os.path.join( output_dir, "%s_prediction_%d.jpg" % (problem_name, prediction_idx)) show_and_save_image(inputs / 255., save_path) elif inputs is not None and inputs_vocab: if identity_output: decoded_inputs = " ".join(map(str, inputs.flatten())) else: decoded_inputs = inputs_vocab.decode(_save_until_eos( inputs, skip_eos_postprocess)) if log_results and not is_video: tf.logging.info("Inference results INPUT: %s" % decoded_inputs) decoded_targets = None decoded_outputs = None if identity_output: decoded_outputs = " ".join(map(str, outputs.flatten())) if targets is not None: decoded_targets = " ".join(map(str, targets.flatten())) else: decoded_outputs = targets_vocab.decode(_save_until_eos( outputs, skip_eos_postprocess)) if targets is not None and log_results: decoded_targets = targets_vocab.decode(_save_until_eos( targets, skip_eos_postprocess)) if log_results and not is_video: tf.logging.info("Inference results OUTPUT: %s" % decoded_outputs) if targets is not None and log_results and not is_video: tf.logging.info("Inference results TARGET: %s" % decoded_targets) return decoded_inputs, decoded_outputs, decoded_targets
python
def log_decode_results(inputs, outputs, problem_name, prediction_idx, inputs_vocab, targets_vocab, targets=None, save_images=False, output_dir=None, identity_output=False, log_results=True, skip_eos_postprocess=False): """Log inference results.""" # TODO(lukaszkaiser) refactor this into feature_encoder is_video = "video" in problem_name or "gym" in problem_name if is_video: def fix_and_save_video(vid, prefix): save_path_template = os.path.join( output_dir, "%s_%s_%05d_{:05d}.png" % (problem_name, prefix, prediction_idx)) # this is only required for predictions if vid.shape[-1] == 1: vid = np.squeeze(vid, axis=-1) save_video(vid, save_path_template) tf.logging.info("Saving video: {}".format(prediction_idx)) fix_and_save_video(inputs, "inputs") fix_and_save_video(outputs, "outputs") fix_and_save_video(targets, "targets") is_image = "image" in problem_name is_text2class = isinstance(registry.problem(problem_name), text_problems.Text2ClassProblem) skip_eos_postprocess = is_image or is_text2class or skip_eos_postprocess decoded_inputs = None if is_image and save_images: save_path = os.path.join( output_dir, "%s_prediction_%d.jpg" % (problem_name, prediction_idx)) show_and_save_image(inputs / 255., save_path) elif inputs is not None and inputs_vocab: if identity_output: decoded_inputs = " ".join(map(str, inputs.flatten())) else: decoded_inputs = inputs_vocab.decode(_save_until_eos( inputs, skip_eos_postprocess)) if log_results and not is_video: tf.logging.info("Inference results INPUT: %s" % decoded_inputs) decoded_targets = None decoded_outputs = None if identity_output: decoded_outputs = " ".join(map(str, outputs.flatten())) if targets is not None: decoded_targets = " ".join(map(str, targets.flatten())) else: decoded_outputs = targets_vocab.decode(_save_until_eos( outputs, skip_eos_postprocess)) if targets is not None and log_results: decoded_targets = targets_vocab.decode(_save_until_eos( targets, skip_eos_postprocess)) if log_results and not is_video: tf.logging.info("Inference results OUTPUT: %s" % decoded_outputs) if targets is not None and log_results and not is_video: tf.logging.info("Inference results TARGET: %s" % decoded_targets) return decoded_inputs, decoded_outputs, decoded_targets
[ "def", "log_decode_results", "(", "inputs", ",", "outputs", ",", "problem_name", ",", "prediction_idx", ",", "inputs_vocab", ",", "targets_vocab", ",", "targets", "=", "None", ",", "save_images", "=", "False", ",", "output_dir", "=", "None", ",", "identity_output", "=", "False", ",", "log_results", "=", "True", ",", "skip_eos_postprocess", "=", "False", ")", ":", "# TODO(lukaszkaiser) refactor this into feature_encoder", "is_video", "=", "\"video\"", "in", "problem_name", "or", "\"gym\"", "in", "problem_name", "if", "is_video", ":", "def", "fix_and_save_video", "(", "vid", ",", "prefix", ")", ":", "save_path_template", "=", "os", ".", "path", ".", "join", "(", "output_dir", ",", "\"%s_%s_%05d_{:05d}.png\"", "%", "(", "problem_name", ",", "prefix", ",", "prediction_idx", ")", ")", "# this is only required for predictions", "if", "vid", ".", "shape", "[", "-", "1", "]", "==", "1", ":", "vid", "=", "np", ".", "squeeze", "(", "vid", ",", "axis", "=", "-", "1", ")", "save_video", "(", "vid", ",", "save_path_template", ")", "tf", ".", "logging", ".", "info", "(", "\"Saving video: {}\"", ".", "format", "(", "prediction_idx", ")", ")", "fix_and_save_video", "(", "inputs", ",", "\"inputs\"", ")", "fix_and_save_video", "(", "outputs", ",", "\"outputs\"", ")", "fix_and_save_video", "(", "targets", ",", "\"targets\"", ")", "is_image", "=", "\"image\"", "in", "problem_name", "is_text2class", "=", "isinstance", "(", "registry", ".", "problem", "(", "problem_name", ")", ",", "text_problems", ".", "Text2ClassProblem", ")", "skip_eos_postprocess", "=", "is_image", "or", "is_text2class", "or", "skip_eos_postprocess", "decoded_inputs", "=", "None", "if", "is_image", "and", "save_images", ":", "save_path", "=", "os", ".", "path", ".", "join", "(", "output_dir", ",", "\"%s_prediction_%d.jpg\"", "%", "(", "problem_name", ",", "prediction_idx", ")", ")", "show_and_save_image", "(", "inputs", "/", "255.", ",", "save_path", ")", "elif", "inputs", "is", "not", "None", "and", "inputs_vocab", ":", "if", "identity_output", ":", "decoded_inputs", "=", "\" \"", ".", "join", "(", "map", "(", "str", ",", "inputs", ".", "flatten", "(", ")", ")", ")", "else", ":", "decoded_inputs", "=", "inputs_vocab", ".", "decode", "(", "_save_until_eos", "(", "inputs", ",", "skip_eos_postprocess", ")", ")", "if", "log_results", "and", "not", "is_video", ":", "tf", ".", "logging", ".", "info", "(", "\"Inference results INPUT: %s\"", "%", "decoded_inputs", ")", "decoded_targets", "=", "None", "decoded_outputs", "=", "None", "if", "identity_output", ":", "decoded_outputs", "=", "\" \"", ".", "join", "(", "map", "(", "str", ",", "outputs", ".", "flatten", "(", ")", ")", ")", "if", "targets", "is", "not", "None", ":", "decoded_targets", "=", "\" \"", ".", "join", "(", "map", "(", "str", ",", "targets", ".", "flatten", "(", ")", ")", ")", "else", ":", "decoded_outputs", "=", "targets_vocab", ".", "decode", "(", "_save_until_eos", "(", "outputs", ",", "skip_eos_postprocess", ")", ")", "if", "targets", "is", "not", "None", "and", "log_results", ":", "decoded_targets", "=", "targets_vocab", ".", "decode", "(", "_save_until_eos", "(", "targets", ",", "skip_eos_postprocess", ")", ")", "if", "log_results", "and", "not", "is_video", ":", "tf", ".", "logging", ".", "info", "(", "\"Inference results OUTPUT: %s\"", "%", "decoded_outputs", ")", "if", "targets", "is", "not", "None", "and", "log_results", "and", "not", "is_video", ":", "tf", ".", "logging", ".", "info", "(", "\"Inference results TARGET: %s\"", "%", "decoded_targets", ")", "return", "decoded_inputs", ",", "decoded_outputs", ",", "decoded_targets" ]
Log inference results.
[ "Log", "inference", "results", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github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ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1100111 + 0o10) + chr(1224 - 1169), 21844 - 21836), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + '\062' + chr(381 - 331) + '\062', 27197 - 27189), ehT0Px3KOsy9(chr(48) + chr(9951 - 9840) + chr(527 - 472) + '\062', 0o10), ehT0Px3KOsy9(chr(963 - 915) + chr(0b111001 + 0o66) + chr(0b110011) + chr(49) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(3739 - 3628) + chr(0b110010) + chr(50) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(8537 - 8426) + chr(50) + chr(0b110101) + '\067', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100011 + 0o16) + '\060' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(1127 - 1076) + chr(0b11010 + 0o32), 0b1000), ehT0Px3KOsy9(chr(716 - 668) + chr(0b1101111) + '\061' + chr(1262 - 1209), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1303 - 1252) + chr(50) + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001 + 0o0) + chr(49) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + '\x36' + chr(0b111 + 0o60), 38583 - 38575), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\064' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(54) + chr(1511 - 1458), 24988 - 24980), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1100 + 0o45) + chr(0b1010 + 0o53) + chr(0b100000 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11 + 0o60) + chr(0b100001 + 0o20) + '\x30', 8), ehT0Px3KOsy9(chr(814 - 766) + chr(111) + chr(1512 - 1463) + '\062' + chr(0b10100 + 0o34), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + chr(971 - 921) + chr(1202 - 1154) + chr(667 - 616), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2067 - 2018) + chr(0b1101 + 0o43) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\x31' + '\060', 26189 - 26181), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b101110 + 0o11) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(11183 - 11072) + '\063' + chr(0b11010 + 0o33) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(1209 - 1159) + chr(555 - 507), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\063' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(832 - 783), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(1857 - 1804) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(0b110110), 35290 - 35282), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(52) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110010) + chr(1142 - 1092), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b110111) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(55) + '\x34', 42570 - 42562), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + '\062' + chr(0b10011 + 0o40) + chr(0b0 + 0o60), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1610 - 1560) + chr(51) + chr(67 - 13), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + chr(0b110011) + '\x36' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + '\x31' + chr(0b110111) + '\062', 56035 - 56027), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(54) + chr(0b110110), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + chr(87 - 33), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1001 + 0o146) + chr(821 - 770) + chr(0b110001) + chr(49), 30763 - 30755), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110010 + 0o0) + chr(0b10111 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10577 - 10466) + chr(50) + chr(50), 62846 - 62838)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b')'), chr(0b1100100) + chr(0b1001001 + 0o34) + chr(99) + '\x6f' + '\144' + chr(101))(chr(117) + chr(0b100011 + 0o121) + '\146' + '\055' + chr(1706 - 1650)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def K9rTheAZ6Epi(vXoupepMtCXU, Dx_DllZ8uCko, wezGpYDorAsK, MdAmWxqhwGdC, GFENRgsjdCkQ, GpnyPjDizdlO, xIEmRseySp3z=None, jDa6JrIsNd3v=ehT0Px3KOsy9(chr(1963 - 1915) + chr(11733 - 11622) + chr(0b110000), 24104 - 24096), nd0OX_BS6_o4=None, hgqKJuQDwjUL=ehT0Px3KOsy9(chr(511 - 463) + chr(0b1101100 + 0o3) + '\x30', 8), wps_9DOfYptw=ehT0Px3KOsy9('\060' + chr(5931 - 5820) + chr(49), 8), KcP8yjEFaiUr=ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1000 + 0o147) + chr(48), 8)): ctzH4bgyBYlB = xafqLlk3kkUe(SXOLrMavuUCe(b'q\xfb^\xad\xff'), chr(2825 - 2725) + chr(3990 - 3889) + '\143' + chr(0b1101111) + '\144' + chr(0b10001 + 0o124))(chr(117) + chr(116) + '\x66' + chr(0b101001 + 0o4) + chr(2331 - 2275)) in wezGpYDorAsK or xafqLlk3kkUe(SXOLrMavuUCe(b'`\xebW'), '\144' + chr(0b1100 + 0o131) + chr(5218 - 5119) + chr(111) + '\144' + '\x65')(chr(13000 - 12883) + chr(0b111111 + 0o65) + '\x66' + chr(1844 - 1799) + '\070') in wezGpYDorAsK if ctzH4bgyBYlB: def wnaHivI8Jmf5(oPTVcBpYFqxJ, K1Ha0XjJTAE7): o8UeCCT6Q4Tm = oqhJDdMJfuwx.path.join(nd0OX_BS6_o4, xafqLlk3kkUe(SXOLrMavuUCe(b'"\xe1e\xed\xe3\xf0dl8\xb3\x16\xcc\x99\x05^\xac-\xad7&\xdc'), '\144' + chr(101) + '\143' + chr(111) + chr(100) + '\145')('\x75' + chr(116) + '\x66' + '\055' + chr(0b111000)) % (wezGpYDorAsK, K1Ha0XjJTAE7, MdAmWxqhwGdC)) if xafqLlk3kkUe(oPTVcBpYFqxJ, xafqLlk3kkUe(SXOLrMavuUCe(b'i\xf3O\x91\xf6\xe3&0Y\xa7*\xd5'), chr(4849 - 4749) + '\145' + chr(381 - 282) + chr(0b1101111) + chr(0b1 + 0o143) + chr(4704 - 4603))(chr(0b100010 + 0o123) + chr(11986 - 11870) + chr(474 - 372) + chr(696 - 651) + chr(1010 - 954)))[-ehT0Px3KOsy9(chr(48) + chr(111) + chr(49), 8)] == ehT0Px3KOsy9(chr(1672 - 1624) + chr(0b1001 + 0o146) + chr(0b101011 + 0o6), 8): oPTVcBpYFqxJ = WqUC3KWvYVup.squeeze(oPTVcBpYFqxJ, axis=-ehT0Px3KOsy9('\x30' + chr(8960 - 8849) + '\061', 8)) r0JtGi8OzFa8(oPTVcBpYFqxJ, o8UeCCT6Q4Tm) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xa5r\xb0\xe5\xcc&kg\xbb\x13\xdc'), chr(100) + '\x65' + '\x63' + chr(111) + '\144' + chr(3935 - 3834))(chr(13602 - 13485) + '\x74' + '\146' + chr(0b101101) + '\070'))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'T\xf3L\xa1\xfe\xc8a*d\xb3,\xd8\x99\x15\x10\xb5'), '\144' + '\x65' + chr(99) + chr(111) + '\144' + '\145')('\165' + chr(0b1110100) + chr(0b1100110) + chr(581 - 536) + chr(0b110101 + 0o3)), xafqLlk3kkUe(SXOLrMavuUCe(b'Q\xa6H\xa7\xd8\xce\x12o]\xa7,\xdd'), '\x64' + '\x65' + chr(99) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(102) + '\055' + '\x38'))(MdAmWxqhwGdC)) wnaHivI8Jmf5(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'n\xfcJ\xbd\xe4\xdc'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + chr(111) + '\144' + '\145')('\165' + chr(4287 - 4171) + '\146' + chr(45) + chr(0b100011 + 0o25))) wnaHivI8Jmf5(Dx_DllZ8uCko, xafqLlk3kkUe(SXOLrMavuUCe(b'h\xe7N\xb8\xe5\xdb2'), chr(0b1100100) + chr(0b111110 + 0o47) + chr(414 - 315) + chr(0b1000111 + 0o50) + chr(1944 - 1844) + chr(0b110001 + 0o64))(chr(0b1100010 + 0o23) + chr(0b1110100) + chr(102) + '\055' + chr(56))) wnaHivI8Jmf5(xIEmRseySp3z, xafqLlk3kkUe(SXOLrMavuUCe(b's\xf3H\xaf\xf5\xdb2'), chr(0b1011010 + 0o12) + chr(0b1100101) + '\143' + chr(7597 - 7486) + chr(5163 - 5063) + chr(0b100 + 0o141))('\x75' + chr(0b1110100) + chr(102) + '\x2d' + chr(60 - 4))) ENdldzEw6maI = xafqLlk3kkUe(SXOLrMavuUCe(b'n\xff[\xaf\xf5'), '\144' + '\x65' + chr(8448 - 8349) + chr(0b1101000 + 0o7) + '\x64' + chr(1980 - 1879))(chr(117) + chr(0b1110100) + chr(8316 - 8214) + chr(0b100011 + 0o12) + chr(56)) in wezGpYDorAsK XzvxSNl3m3eQ = PlSM16l2KDPD(U24OBsRcVqkJ.sO7e1A_Mor6Q(wezGpYDorAsK), GkH56QMxhclz.Text2ClassProblem) KcP8yjEFaiUr = ENdldzEw6maI or XzvxSNl3m3eQ or KcP8yjEFaiUr r7O2I87mob1B = None if ENdldzEw6maI and jDa6JrIsNd3v: uxepbmQxAOsp = oqhJDdMJfuwx.path.join(nd0OX_BS6_o4, xafqLlk3kkUe(SXOLrMavuUCe(b'"\xe1e\xb8\xe2\xca%5n\xa3 \xd8\xcdjN\xac~\xe97/'), chr(0b101110 + 0o66) + chr(101) + chr(0b1100011) + chr(111) + chr(0b1011000 + 0o14) + chr(0b110110 + 0o57))(chr(829 - 712) + chr(0b110011 + 0o101) + chr(0b1100110) + '\055' + chr(56)) % (wezGpYDorAsK, MdAmWxqhwGdC)) CG5Z4N9nKSvI(vXoupepMtCXU / 255.0, uxepbmQxAOsp) elif vXoupepMtCXU is not None and GFENRgsjdCkQ: if hgqKJuQDwjUL: r7O2I87mob1B = xafqLlk3kkUe(SXOLrMavuUCe(b"'"), chr(0b1100100) + '\x65' + chr(99) + '\x6f' + chr(100) + '\145')(chr(3781 - 3664) + chr(116) + chr(2809 - 2707) + chr(466 - 421) + chr(0b101101 + 0o13)).join(abA97kOQKaLo(M8_cKLkHVB2V, vXoupepMtCXU.flatten())) else: r7O2I87mob1B = GFENRgsjdCkQ.decode(M0l7BzX3KemY(vXoupepMtCXU, KcP8yjEFaiUr)) if wps_9DOfYptw and (not ctzH4bgyBYlB): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xa5r\xb0\xe5\xcc&kg\xbb\x13\xdc'), chr(9513 - 9413) + chr(0b10010 + 0o123) + '\x63' + '\x6f' + chr(0b1100100) + chr(2691 - 2590))(chr(0b1110101) + '\164' + '\x66' + chr(45) + chr(2640 - 2584)))(xafqLlk3kkUe(SXOLrMavuUCe(b'N\xfc\\\xad\xe2\xca/?h\xf7;\xd2\xd0@\x07\xbc#\xa3\x0e\x06\xeb\xb9\x04\xa0!Oe'), chr(6497 - 6397) + '\x65' + chr(8854 - 8755) + chr(4366 - 4255) + chr(1960 - 1860) + chr(0b1100101))(chr(0b1100101 + 0o20) + '\x74' + chr(102) + chr(0b110 + 0o47) + '\070') % r7O2I87mob1B) unWnobaemw2j = None WWdNah7UQWQY = None if hgqKJuQDwjUL: WWdNah7UQWQY = xafqLlk3kkUe(SXOLrMavuUCe(b"'"), chr(0b0 + 0o144) + chr(101) + chr(99) + '\x6f' + '\144' + '\x65')(chr(0b1110101) + chr(0b11110 + 0o126) + chr(0b1100110) + chr(0b10001 + 0o34) + chr(2940 - 2884)).join(abA97kOQKaLo(M8_cKLkHVB2V, Dx_DllZ8uCko.flatten())) if xIEmRseySp3z is not None: unWnobaemw2j = xafqLlk3kkUe(SXOLrMavuUCe(b"'"), chr(100) + chr(0b11011 + 0o112) + chr(0b1000101 + 0o36) + chr(4225 - 4114) + chr(0b1100100) + '\x65')(chr(6487 - 6370) + chr(0b1001110 + 0o46) + chr(0b1100110) + '\x2d' + chr(0b1 + 0o67)).join(abA97kOQKaLo(M8_cKLkHVB2V, xIEmRseySp3z.flatten())) else: WWdNah7UQWQY = GpnyPjDizdlO.decode(M0l7BzX3KemY(Dx_DllZ8uCko, KcP8yjEFaiUr)) if xIEmRseySp3z is not None and wps_9DOfYptw: unWnobaemw2j = GpnyPjDizdlO.decode(M0l7BzX3KemY(xIEmRseySp3z, KcP8yjEFaiUr)) if wps_9DOfYptw and (not ctzH4bgyBYlB): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xa5r\xb0\xe5\xcc&kg\xbb\x13\xdc'), chr(100) + chr(0b1100101) + '\143' + '\x6f' + chr(3734 - 3634) + '\145')(chr(0b1110101) + chr(0b11010 + 0o132) + '\x66' + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'N\xfc\\\xad\xe2\xca/?h\xf7;\xd2\xd0@\x07\xbc#\xa3\x08\x1d\xef\xbc\x05\xce;J3\x90'), '\x64' + '\x65' + '\143' + '\x6f' + '\x64' + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(3828 - 3726) + chr(593 - 548) + chr(0b111000)) % WWdNah7UQWQY) if xIEmRseySp3z is not None and wps_9DOfYptw and (not ctzH4bgyBYlB): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xa5r\xb0\xe5\xcc&kg\xbb\x13\xdc'), chr(100) + chr(101) + chr(0b1100011) + '\x6f' + chr(0b111001 + 0o53) + chr(101))('\x75' + chr(116) + chr(0b1100110) + chr(0b101 + 0o50) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'N\xfc\\\xad\xe2\xca/?h\xf7;\xd2\xd0@\x07\xbc#\xa3\x13\t\xe9\xab\x15\xce;J3\x90'), chr(100) + chr(0b1100101) + chr(0b110001 + 0o62) + chr(0b1101111) + '\x64' + '\145')(chr(0b1110101) + '\x74' + chr(102) + chr(1620 - 1575) + chr(1789 - 1733)) % unWnobaemw2j) return (r7O2I87mob1B, WWdNah7UQWQY, unWnobaemw2j)
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
decode_from_dataset
def decode_from_dataset(estimator, problem_name, hparams, decode_hp, decode_to_file=None, dataset_split=None, checkpoint_path=None): """Perform decoding from dataset.""" tf.logging.info("Performing local inference from dataset for %s.", str(problem_name)) # We assume that worker_id corresponds to shard number. shard = decode_hp.shard_id if decode_hp.shards > 1 else None # Setup output directory for any artifacts that may be written out. output_dir = os.path.join(estimator.model_dir, "decode") tf.gfile.MakeDirs(output_dir) # If decode_hp.batch_size is specified, use a fixed batch size if decode_hp.batch_size: hparams.batch_size = decode_hp.batch_size hparams.use_fixed_batch_size = True dataset_kwargs = { "shard": shard, "dataset_split": dataset_split, "max_records": decode_hp.num_samples } # Build the inference input function problem = hparams.problem infer_input_fn = problem.make_estimator_input_fn( tf.estimator.ModeKeys.PREDICT, hparams, dataset_kwargs=dataset_kwargs) predictions, output_dirs = [], [] for decode_id in range(decode_hp.num_decodes): tf.logging.info("Decoding {}".format(decode_id)) # Create decode directory if not in-memory decoding. if not decode_hp.decode_in_memory: output_dir = os.path.join(estimator.model_dir, "decode_%05d" % decode_id) tf.gfile.MakeDirs(output_dir) output_dirs.append(output_dir) result = decode_once(estimator, problem_name, hparams, infer_input_fn, decode_hp, decode_to_file, output_dir, log_results=decode_hp.log_results, checkpoint_path=checkpoint_path) if decode_hp.decode_in_memory: output_dirs = [output_dir] predictions.append(result) if decode_hp.decode_to_file: decode_hp.decode_to_file = _decode_filename( decode_hp.decode_to_file, problem_name, decode_hp) run_postdecode_hooks(DecodeHookArgs( estimator=estimator, problem=problem, output_dirs=output_dirs, hparams=hparams, decode_hparams=decode_hp, predictions=predictions ), dataset_split) return predictions
python
def decode_from_dataset(estimator, problem_name, hparams, decode_hp, decode_to_file=None, dataset_split=None, checkpoint_path=None): """Perform decoding from dataset.""" tf.logging.info("Performing local inference from dataset for %s.", str(problem_name)) # We assume that worker_id corresponds to shard number. shard = decode_hp.shard_id if decode_hp.shards > 1 else None # Setup output directory for any artifacts that may be written out. output_dir = os.path.join(estimator.model_dir, "decode") tf.gfile.MakeDirs(output_dir) # If decode_hp.batch_size is specified, use a fixed batch size if decode_hp.batch_size: hparams.batch_size = decode_hp.batch_size hparams.use_fixed_batch_size = True dataset_kwargs = { "shard": shard, "dataset_split": dataset_split, "max_records": decode_hp.num_samples } # Build the inference input function problem = hparams.problem infer_input_fn = problem.make_estimator_input_fn( tf.estimator.ModeKeys.PREDICT, hparams, dataset_kwargs=dataset_kwargs) predictions, output_dirs = [], [] for decode_id in range(decode_hp.num_decodes): tf.logging.info("Decoding {}".format(decode_id)) # Create decode directory if not in-memory decoding. if not decode_hp.decode_in_memory: output_dir = os.path.join(estimator.model_dir, "decode_%05d" % decode_id) tf.gfile.MakeDirs(output_dir) output_dirs.append(output_dir) result = decode_once(estimator, problem_name, hparams, infer_input_fn, decode_hp, decode_to_file, output_dir, log_results=decode_hp.log_results, checkpoint_path=checkpoint_path) if decode_hp.decode_in_memory: output_dirs = [output_dir] predictions.append(result) if decode_hp.decode_to_file: decode_hp.decode_to_file = _decode_filename( decode_hp.decode_to_file, problem_name, decode_hp) run_postdecode_hooks(DecodeHookArgs( estimator=estimator, problem=problem, output_dirs=output_dirs, hparams=hparams, decode_hparams=decode_hp, predictions=predictions ), dataset_split) return predictions
[ "def", "decode_from_dataset", "(", "estimator", ",", "problem_name", ",", "hparams", ",", "decode_hp", ",", "decode_to_file", "=", "None", ",", "dataset_split", "=", "None", ",", "checkpoint_path", "=", "None", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"Performing local inference from dataset for %s.\"", ",", "str", "(", "problem_name", ")", ")", "# We assume that worker_id corresponds to shard number.", "shard", "=", "decode_hp", ".", "shard_id", "if", "decode_hp", ".", "shards", ">", "1", "else", "None", "# Setup output directory for any artifacts that may be written out.", "output_dir", "=", "os", ".", "path", ".", "join", "(", "estimator", ".", "model_dir", ",", "\"decode\"", ")", "tf", ".", "gfile", ".", "MakeDirs", "(", "output_dir", ")", "# If decode_hp.batch_size is specified, use a fixed batch size", "if", "decode_hp", ".", "batch_size", ":", "hparams", ".", "batch_size", "=", "decode_hp", ".", "batch_size", "hparams", ".", "use_fixed_batch_size", "=", "True", "dataset_kwargs", "=", "{", "\"shard\"", ":", "shard", ",", "\"dataset_split\"", ":", "dataset_split", ",", "\"max_records\"", ":", "decode_hp", ".", "num_samples", "}", "# Build the inference input function", "problem", "=", "hparams", ".", "problem", "infer_input_fn", "=", "problem", ".", "make_estimator_input_fn", "(", "tf", ".", "estimator", ".", "ModeKeys", ".", "PREDICT", ",", "hparams", ",", "dataset_kwargs", "=", "dataset_kwargs", ")", "predictions", ",", "output_dirs", "=", "[", "]", ",", "[", "]", "for", "decode_id", "in", "range", "(", "decode_hp", ".", "num_decodes", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"Decoding {}\"", ".", "format", "(", "decode_id", ")", ")", "# Create decode directory if not in-memory decoding.", "if", "not", "decode_hp", ".", "decode_in_memory", ":", "output_dir", "=", "os", ".", "path", ".", "join", "(", "estimator", ".", "model_dir", ",", "\"decode_%05d\"", "%", "decode_id", ")", "tf", ".", "gfile", ".", "MakeDirs", "(", "output_dir", ")", "output_dirs", ".", "append", "(", "output_dir", ")", "result", "=", "decode_once", "(", "estimator", ",", "problem_name", ",", "hparams", ",", "infer_input_fn", ",", "decode_hp", ",", "decode_to_file", ",", "output_dir", ",", "log_results", "=", "decode_hp", ".", "log_results", ",", "checkpoint_path", "=", "checkpoint_path", ")", "if", "decode_hp", ".", "decode_in_memory", ":", "output_dirs", "=", "[", "output_dir", "]", "predictions", ".", "append", "(", "result", ")", "if", "decode_hp", ".", "decode_to_file", ":", "decode_hp", ".", "decode_to_file", "=", "_decode_filename", "(", "decode_hp", ".", "decode_to_file", ",", "problem_name", ",", "decode_hp", ")", "run_postdecode_hooks", "(", "DecodeHookArgs", "(", "estimator", "=", "estimator", ",", "problem", "=", "problem", ",", "output_dirs", "=", "output_dirs", ",", "hparams", "=", "hparams", ",", "decode_hparams", "=", "decode_hp", ",", "predictions", "=", "predictions", ")", ",", "dataset_split", ")", "return", "predictions" ]
Perform decoding from dataset.
[ "Perform", "decoding", "from", "dataset", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L173-L242
train
Perform decoding from dataset.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,O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,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11110 + 0o23) + '\x32' + '\x30', 0o10), ehT0Px3KOsy9(chr(1590 - 1542) + '\x6f' + '\062' + chr(2075 - 2022) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(287 - 239) + '\157' + chr(1064 - 1015) + chr(51) + chr(0b1100 + 0o53), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + '\063' + chr(0b10010 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(54) + chr(2414 - 2364), 0o10), ehT0Px3KOsy9(chr(48) + chr(699 - 588) + chr(50) + '\x33' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(0b110001) + chr(55) + chr(0b100 + 0o60), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110100) + chr(0b10101 + 0o42), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\060' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(926 - 878) + '\157' + chr(2434 - 2384) + '\067' + chr(63 - 12), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(952 - 900) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2476 - 2426) + chr(54) + chr(82 - 34), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11 + 0o61) + chr(2043 - 1992), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(2029 - 1974) + '\061', 24806 - 24798), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + '\x31' + chr(55) + chr(0b110110), 21125 - 21117), ehT0Px3KOsy9('\x30' + chr(8528 - 8417) + chr(1771 - 1722) + chr(49) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(1720 - 1672) + chr(111) + chr(0b101100 + 0o10), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11581 - 11470) + '\063' + chr(0b100011 + 0o16), 41982 - 41974), ehT0Px3KOsy9(chr(48) + chr(909 - 798) + chr(0b110010) + chr(0b110100) + chr(1818 - 1764), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1010110 + 0o31) + chr(0b10101 + 0o36) + chr(51) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110000 + 0o3) + chr(0b1101 + 0o46) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + chr(55) + chr(583 - 535), 54829 - 54821), ehT0Px3KOsy9(chr(48) + chr(6925 - 6814) + chr(50) + '\x30' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1601 - 1553) + chr(0b1101111) + '\062' + '\062' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(0b11101 + 0o24) + '\067' + chr(81 - 31), ord("\x08")), ehT0Px3KOsy9(chr(339 - 291) + chr(5114 - 5003) + chr(89 - 40) + chr(148 - 95) + '\065', 0o10), ehT0Px3KOsy9(chr(1417 - 1369) + chr(0b11000 + 0o127) + chr(0b110001) + chr(0b11000 + 0o37) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(0b110 + 0o60) + chr(0b110 + 0o54), 8), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(1060 - 1011) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1100100 + 0o13) + '\063' + chr(0b101001 + 0o11) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x34', 8), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b110011 + 0o2) + chr(0b101011 + 0o12), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b10001 + 0o40) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(833 - 784) + chr(670 - 617) + chr(53), 8), ehT0Px3KOsy9(chr(1985 - 1937) + chr(0b1000100 + 0o53) + chr(49) + chr(0b101 + 0o57) + chr(373 - 318), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2816 - 2705) + chr(49) + '\x36' + chr(0b11110 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11205 - 11094) + chr(0b110011 + 0o1) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + '\061' + chr(0b100010 + 0o25) + chr(1304 - 1256), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110100) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + chr(0b100000 + 0o21) + chr(0b100001 + 0o22) + chr(0b110110), 16956 - 16948)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\065' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'~'), '\144' + '\x65' + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(101))(chr(10531 - 10414) + chr(0b1001000 + 0o54) + chr(3014 - 2912) + chr(427 - 382) + chr(0b11011 + 0o35)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Q0RIO_x2tZhB(GDZi5OTNos9m, wezGpYDorAsK, n4ljua2gi1Pr, dcaitvFqg9pp, fIXoiUadZGQd=None, XqbfPmad1kJ4=None, lbKq88EBpYWb=None): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x9d\x17\xe3G\xf9\x1b\x10*\xd7{\xdb'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(111) + chr(100) + chr(101))('\165' + chr(0b1110100) + chr(0b1100110) + chr(1246 - 1201) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\xcf-\xfd]\xe8\x11N.\xdc\x01\xdcL\x9a\x1f$$p\xc8\xbe\xb8J\xe6\xfb\x19\x08_T\x7f\xbfiM\xee\x0c\x13\x16V\x1d\x14~6\xc5-\xbb\x17\xe9R'), chr(0b101010 + 0o72) + '\145' + '\x63' + '\x6f' + chr(100) + chr(101))(chr(0b1110101) + chr(116) + '\x66' + chr(85 - 40) + chr(1939 - 1883)), M8_cKLkHVB2V(wezGpYDorAsK)) pn2mJYbTTPyv = dcaitvFqg9pp.shard_id if dcaitvFqg9pp.shards > ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(647 - 598), 0b1000) else None nd0OX_BS6_o4 = oqhJDdMJfuwx.path.join(GDZi5OTNos9m.model_dir, xafqLlk3kkUe(SXOLrMavuUCe(b'4\xcf<\xf4V\xff'), chr(0b110000 + 0o64) + '\x65' + '\x63' + '\x6f' + chr(4711 - 4611) + '\145')(chr(117) + chr(11218 - 11102) + chr(102) + chr(45) + chr(56))) xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\xcb4\xfev\xf3\x0eT'), chr(100) + '\x65' + chr(0b11111 + 0o104) + '\x6f' + chr(0b1001100 + 0o30) + '\x65')(chr(4029 - 3912) + '\x74' + chr(0b101110 + 0o70) + '\x2d' + chr(56)))(nd0OX_BS6_o4) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'9\xd2f\xffh\xe3\x19f-\xeeY\xe9'), chr(0b1100100) + chr(5158 - 5057) + '\143' + '\157' + chr(9213 - 9113) + chr(0b1011101 + 0o10))(chr(0b1110101) + chr(6322 - 6206) + '\x66' + chr(0b10001 + 0o34) + chr(2260 - 2204))): n4ljua2gi1Pr.ix9dZyeAmUxY = dcaitvFqg9pp.ix9dZyeAmUxY n4ljua2gi1Pr.V9YwhDsFOlGK = ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1010110 + 0o31) + chr(207 - 158), 8) Sa4GuE_apyvu = {xafqLlk3kkUe(SXOLrMavuUCe(b'#\xc2>\xe9V'), chr(0b1001011 + 0o31) + chr(101) + '\143' + chr(7242 - 7131) + chr(1924 - 1824) + chr(2752 - 2651))(chr(0b1000111 + 0o56) + chr(3699 - 3583) + chr(6857 - 6755) + chr(0b11101 + 0o20) + chr(1096 - 1040)): pn2mJYbTTPyv, xafqLlk3kkUe(SXOLrMavuUCe(b'4\xcb+\xfaA\xff\x08x3\xcbM\xd9W'), chr(0b1100100) + '\x65' + '\143' + '\157' + chr(100) + chr(4262 - 4161))('\165' + chr(0b1110100) + '\x66' + '\x2d' + chr(0b110000 + 0o10)): XqbfPmad1kJ4, xafqLlk3kkUe(SXOLrMavuUCe(b"=\xcb'\xc4@\xff\x1fH2\xdfR"), '\x64' + '\145' + '\x63' + '\157' + '\x64' + '\x65')(chr(117) + chr(116) + '\x66' + chr(0b101101) + chr(0b111000)): dcaitvFqg9pp.num_samples} sO7e1A_Mor6Q = n4ljua2gi1Pr.sO7e1A_Mor6Q HU1DaIKhwbv7 = sO7e1A_Mor6Q.make_estimator_input_fn(IDJ2eXGCBCDu.estimator.ModeKeys.PREDICT, n4ljua2gi1Pr, dataset_kwargs=Sa4GuE_apyvu) (qIQi_VFCIFZL, Y_PWX8ooWmlm) = ([], []) for vbHniaPEXcdT in vQr8gNKaIaWE(xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'>\xdf2\xc4V\xff\x1fH$\xdeR'), chr(0b1100100) + chr(0b1110 + 0o127) + '\143' + '\x6f' + chr(0b111101 + 0o47) + chr(6857 - 6756))(chr(0b11 + 0o162) + '\x74' + chr(102) + chr(1124 - 1079) + chr(2452 - 2396)))): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x9d\x17\xe3G\xf9\x1b\x10*\xd7{\xdb'), chr(2854 - 2754) + '\145' + '\143' + '\x6f' + '\x64' + chr(0b1001100 + 0o31))('\x75' + '\164' + '\146' + '\x2d' + chr(0b11010 + 0o36)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x14\xcf<\xf4V\xf3\x12@`\xc0\\'), chr(0b1100100) + chr(0b1100101) + chr(9118 - 9019) + chr(1017 - 906) + chr(853 - 753) + '\x65')('\x75' + '\164' + chr(102) + chr(0b101101) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x06\x9e-\xf4z\xfb/\x14\x10\xcbD\xda'), '\x64' + chr(101) + chr(0b1100011) + chr(0b1000010 + 0o55) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(0b1000 + 0o136) + chr(45) + '\070'))(vbHniaPEXcdT)) if not xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'4\xcf<\xf4V\xff#N.\xe4L\xd5N\x96\x0c1'), chr(6815 - 6715) + '\145' + '\x63' + chr(0b1100100 + 0o13) + chr(4524 - 4424) + chr(0b1100101))('\x75' + '\x74' + chr(1842 - 1740) + chr(45) + '\x38')): nd0OX_BS6_o4 = oqhJDdMJfuwx.path.join(GDZi5OTNos9m.model_dir, xafqLlk3kkUe(SXOLrMavuUCe(b'4\xcf<\xf4V\xff#\x02p\x8eE'), chr(0b1100100) + '\x65' + chr(0b11001 + 0o112) + chr(0b1101111) + '\144' + '\145')(chr(0b110010 + 0o103) + '\x74' + chr(102) + '\x2d' + chr(0b111000)) % vbHniaPEXcdT) xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\xcb4\xfev\xf3\x0eT'), chr(100) + chr(0b1000001 + 0o44) + chr(0b111 + 0o134) + '\157' + chr(7450 - 7350) + chr(0b1100101))(chr(0b1110101) + chr(1143 - 1027) + chr(102) + chr(0b1100 + 0o41) + chr(0b111000)))(nd0OX_BS6_o4) xafqLlk3kkUe(Y_PWX8ooWmlm, xafqLlk3kkUe(SXOLrMavuUCe(b'1\xda/\xfe\\\xfe'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(13486 - 13369) + '\164' + chr(3816 - 3714) + chr(0b101101) + '\x38'))(nd0OX_BS6_o4) ShZmEKfTkAOZ = jac9GiDJ3Ezq(GDZi5OTNos9m, wezGpYDorAsK, n4ljua2gi1Pr, HU1DaIKhwbv7, dcaitvFqg9pp, fIXoiUadZGQd, nd0OX_BS6_o4, log_results=dcaitvFqg9pp.log_results, checkpoint_path=lbKq88EBpYWb) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'4\xcf<\xf4V\xff#N.\xe4L\xd5N\x96\x0c1'), chr(5510 - 5410) + chr(4463 - 4362) + '\143' + chr(111) + chr(2216 - 2116) + chr(8979 - 8878))('\x75' + '\164' + chr(0b1100110) + chr(0b101101) + chr(0b111000))): Y_PWX8ooWmlm = [nd0OX_BS6_o4] xafqLlk3kkUe(qIQi_VFCIFZL, xafqLlk3kkUe(SXOLrMavuUCe(b'1\xda/\xfe\\\xfe'), '\x64' + chr(0b1001101 + 0o30) + '\x63' + chr(0b10111 + 0o130) + chr(100) + chr(8092 - 7991))(chr(13074 - 12957) + chr(0b1110100) + chr(0b110000 + 0o66) + '\055' + chr(1026 - 970)))(ShZmEKfTkAOZ) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'6\xe3\x07\xf4[\xcf\x1dC\x1a\xfcp\xd4'), chr(8563 - 8463) + chr(2743 - 2642) + chr(2906 - 2807) + chr(5713 - 5602) + chr(100) + chr(8949 - 8848))('\165' + '\164' + chr(102) + chr(0b101101) + '\070')): dcaitvFqg9pp.fIXoiUadZGQd = basVkyHhP3Xl(dcaitvFqg9pp.fIXoiUadZGQd, wezGpYDorAsK, dcaitvFqg9pp) oJMfSdtl4_t2(gRTJLPEZwIMF(estimator=GDZi5OTNos9m, problem=sO7e1A_Mor6Q, output_dirs=Y_PWX8ooWmlm, hparams=n4ljua2gi1Pr, decode_hparams=dcaitvFqg9pp, predictions=qIQi_VFCIFZL), XqbfPmad1kJ4) return qIQi_VFCIFZL
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
decode_once
def decode_once(estimator, problem_name, hparams, infer_input_fn, decode_hp, decode_to_file, output_dir, log_results=True, checkpoint_path=None): """Decodes once. Args: estimator: tf.estimator.Estimator instance. Used to generate encoded predictions. problem_name: str. Name of problem. hparams: HParams instance. HParams for model training. infer_input_fn: zero-arg function. Input function for estimator. decode_hp: HParams instance. See decode_hparams() above. decode_to_file: str. Prefix for filenames. Used to generated filenames to which decoded predictions are written. output_dir: str. Output directory. Only used for writing images. log_results: bool. If False, return encoded predictions without any further processing. checkpoint_path: str. Path to load model checkpoint from. If unspecified, Estimator's default is used. Returns: If decode_hp.decode_in_memory is True: List of dicts, one per example. Values are either numpy arrays or decoded strings. If decode_hp.decode_in_memory is False: An empty list. """ # Get the predictions as an iterable predictions = estimator.predict(infer_input_fn, checkpoint_path=checkpoint_path) if not log_results: return list(predictions) # Prepare output file writers if decode_to_file passed decode_to_file = decode_to_file or decode_hp.decode_to_file if decode_to_file: output_filepath = _decode_filename(decode_to_file, problem_name, decode_hp) parts = output_filepath.split(".") parts[-1] = "targets" target_filepath = ".".join(parts) parts[-1] = "inputs" input_filepath = ".".join(parts) output_file = tf.gfile.Open(output_filepath, "w") target_file = tf.gfile.Open(target_filepath, "w") input_file = tf.gfile.Open(input_filepath, "w") problem_hparams = hparams.problem_hparams # Inputs vocabulary is set to targets if there are no inputs in the problem, # e.g., for language models where the inputs are just a prefix of targets. has_input = "inputs" in problem_hparams.vocabulary inputs_vocab_key = "inputs" if has_input else "targets" inputs_vocab = problem_hparams.vocabulary[inputs_vocab_key] targets_vocab = problem_hparams.vocabulary["targets"] num_eval_samples = 0 # all_outputs[i][j] = (input: str, output: str, target: str). Input, # decoded output, and target strings for example i, beam rank j. all_outputs = [] for num_predictions, prediction in enumerate(predictions): num_eval_samples += 1 num_predictions += 1 inputs = prediction.get("inputs") targets = prediction.get("targets") outputs = prediction.get("outputs") # Log predictions decoded_outputs = [] # [(str, str, str)]. See all_outputs above. if decode_hp.decode_in_memory: all_outputs.append(decoded_outputs) decoded_scores = [] if decode_hp.return_beams: output_beams = np.split(outputs, decode_hp.beam_size, axis=0) scores = None if "scores" in prediction: scores = np.split(prediction["scores"], decode_hp.beam_size, axis=0) for i, beam in enumerate(output_beams): tf.logging.info("BEAM %d:" % i) score = scores and scores[i] decoded = log_decode_results( inputs, beam, problem_name, num_predictions, inputs_vocab, targets_vocab, save_images=decode_hp.save_images, output_dir=output_dir, identity_output=decode_hp.identity_output, targets=targets, log_results=log_results) decoded_outputs.append(decoded) if decode_hp.write_beam_scores: decoded_scores.append(score) else: decoded = log_decode_results( inputs, outputs, problem_name, num_predictions, inputs_vocab, targets_vocab, save_images=decode_hp.save_images, output_dir=output_dir, identity_output=decode_hp.identity_output, targets=targets, log_results=log_results, skip_eos_postprocess=decode_hp.skip_eos_postprocess) decoded_outputs.append(decoded) # Write out predictions if decode_to_file passed if decode_to_file: for i, (d_input, d_output, d_target) in enumerate(decoded_outputs): # Skip if all padding if d_input and re.match("^({})+$".format(text_encoder.PAD), d_input): continue beam_score_str = "" if decode_hp.write_beam_scores: beam_score_str = "\t%.2f" % decoded_scores[i] output_file.write(str(d_output) + beam_score_str + decode_hp.delimiter) target_file.write(str(d_target) + decode_hp.delimiter) input_file.write(str(d_input) + decode_hp.delimiter) if (decode_hp.num_samples >= 0 and num_predictions >= decode_hp.num_samples): break mlperf_log.transformer_print(key=mlperf_log.EVAL_SIZE, value=num_eval_samples, hparams=hparams) if decode_to_file: output_file.close() target_file.close() input_file.close() return all_outputs
python
def decode_once(estimator, problem_name, hparams, infer_input_fn, decode_hp, decode_to_file, output_dir, log_results=True, checkpoint_path=None): """Decodes once. Args: estimator: tf.estimator.Estimator instance. Used to generate encoded predictions. problem_name: str. Name of problem. hparams: HParams instance. HParams for model training. infer_input_fn: zero-arg function. Input function for estimator. decode_hp: HParams instance. See decode_hparams() above. decode_to_file: str. Prefix for filenames. Used to generated filenames to which decoded predictions are written. output_dir: str. Output directory. Only used for writing images. log_results: bool. If False, return encoded predictions without any further processing. checkpoint_path: str. Path to load model checkpoint from. If unspecified, Estimator's default is used. Returns: If decode_hp.decode_in_memory is True: List of dicts, one per example. Values are either numpy arrays or decoded strings. If decode_hp.decode_in_memory is False: An empty list. """ # Get the predictions as an iterable predictions = estimator.predict(infer_input_fn, checkpoint_path=checkpoint_path) if not log_results: return list(predictions) # Prepare output file writers if decode_to_file passed decode_to_file = decode_to_file or decode_hp.decode_to_file if decode_to_file: output_filepath = _decode_filename(decode_to_file, problem_name, decode_hp) parts = output_filepath.split(".") parts[-1] = "targets" target_filepath = ".".join(parts) parts[-1] = "inputs" input_filepath = ".".join(parts) output_file = tf.gfile.Open(output_filepath, "w") target_file = tf.gfile.Open(target_filepath, "w") input_file = tf.gfile.Open(input_filepath, "w") problem_hparams = hparams.problem_hparams # Inputs vocabulary is set to targets if there are no inputs in the problem, # e.g., for language models where the inputs are just a prefix of targets. has_input = "inputs" in problem_hparams.vocabulary inputs_vocab_key = "inputs" if has_input else "targets" inputs_vocab = problem_hparams.vocabulary[inputs_vocab_key] targets_vocab = problem_hparams.vocabulary["targets"] num_eval_samples = 0 # all_outputs[i][j] = (input: str, output: str, target: str). Input, # decoded output, and target strings for example i, beam rank j. all_outputs = [] for num_predictions, prediction in enumerate(predictions): num_eval_samples += 1 num_predictions += 1 inputs = prediction.get("inputs") targets = prediction.get("targets") outputs = prediction.get("outputs") # Log predictions decoded_outputs = [] # [(str, str, str)]. See all_outputs above. if decode_hp.decode_in_memory: all_outputs.append(decoded_outputs) decoded_scores = [] if decode_hp.return_beams: output_beams = np.split(outputs, decode_hp.beam_size, axis=0) scores = None if "scores" in prediction: scores = np.split(prediction["scores"], decode_hp.beam_size, axis=0) for i, beam in enumerate(output_beams): tf.logging.info("BEAM %d:" % i) score = scores and scores[i] decoded = log_decode_results( inputs, beam, problem_name, num_predictions, inputs_vocab, targets_vocab, save_images=decode_hp.save_images, output_dir=output_dir, identity_output=decode_hp.identity_output, targets=targets, log_results=log_results) decoded_outputs.append(decoded) if decode_hp.write_beam_scores: decoded_scores.append(score) else: decoded = log_decode_results( inputs, outputs, problem_name, num_predictions, inputs_vocab, targets_vocab, save_images=decode_hp.save_images, output_dir=output_dir, identity_output=decode_hp.identity_output, targets=targets, log_results=log_results, skip_eos_postprocess=decode_hp.skip_eos_postprocess) decoded_outputs.append(decoded) # Write out predictions if decode_to_file passed if decode_to_file: for i, (d_input, d_output, d_target) in enumerate(decoded_outputs): # Skip if all padding if d_input and re.match("^({})+$".format(text_encoder.PAD), d_input): continue beam_score_str = "" if decode_hp.write_beam_scores: beam_score_str = "\t%.2f" % decoded_scores[i] output_file.write(str(d_output) + beam_score_str + decode_hp.delimiter) target_file.write(str(d_target) + decode_hp.delimiter) input_file.write(str(d_input) + decode_hp.delimiter) if (decode_hp.num_samples >= 0 and num_predictions >= decode_hp.num_samples): break mlperf_log.transformer_print(key=mlperf_log.EVAL_SIZE, value=num_eval_samples, hparams=hparams) if decode_to_file: output_file.close() target_file.close() input_file.close() return all_outputs
[ "def", "decode_once", "(", "estimator", ",", "problem_name", ",", "hparams", ",", "infer_input_fn", ",", "decode_hp", ",", "decode_to_file", ",", "output_dir", ",", "log_results", "=", "True", ",", "checkpoint_path", "=", "None", ")", ":", "# Get the predictions as an iterable", "predictions", "=", "estimator", ".", "predict", "(", "infer_input_fn", ",", "checkpoint_path", "=", "checkpoint_path", ")", "if", "not", "log_results", ":", "return", "list", "(", "predictions", ")", "# Prepare output file writers if decode_to_file passed", "decode_to_file", "=", "decode_to_file", "or", "decode_hp", ".", "decode_to_file", "if", "decode_to_file", ":", "output_filepath", "=", "_decode_filename", "(", "decode_to_file", ",", "problem_name", ",", "decode_hp", ")", "parts", "=", "output_filepath", ".", "split", "(", "\".\"", ")", "parts", "[", "-", "1", "]", "=", "\"targets\"", "target_filepath", "=", "\".\"", ".", "join", "(", "parts", ")", "parts", "[", "-", "1", "]", "=", "\"inputs\"", "input_filepath", "=", "\".\"", ".", "join", "(", "parts", ")", "output_file", "=", "tf", ".", "gfile", ".", "Open", "(", "output_filepath", ",", "\"w\"", ")", "target_file", "=", "tf", ".", "gfile", ".", "Open", "(", "target_filepath", ",", "\"w\"", ")", "input_file", "=", "tf", ".", "gfile", ".", "Open", "(", "input_filepath", ",", "\"w\"", ")", "problem_hparams", "=", "hparams", ".", "problem_hparams", "# Inputs vocabulary is set to targets if there are no inputs in the problem,", "# e.g., for language models where the inputs are just a prefix of targets.", "has_input", "=", "\"inputs\"", "in", "problem_hparams", ".", "vocabulary", "inputs_vocab_key", "=", "\"inputs\"", "if", "has_input", "else", "\"targets\"", "inputs_vocab", "=", "problem_hparams", ".", "vocabulary", "[", "inputs_vocab_key", "]", "targets_vocab", "=", "problem_hparams", ".", "vocabulary", "[", "\"targets\"", "]", "num_eval_samples", "=", "0", "# all_outputs[i][j] = (input: str, output: str, target: str). Input,", "# decoded output, and target strings for example i, beam rank j.", "all_outputs", "=", "[", "]", "for", "num_predictions", ",", "prediction", "in", "enumerate", "(", "predictions", ")", ":", "num_eval_samples", "+=", "1", "num_predictions", "+=", "1", "inputs", "=", "prediction", ".", "get", "(", "\"inputs\"", ")", "targets", "=", "prediction", ".", "get", "(", "\"targets\"", ")", "outputs", "=", "prediction", ".", "get", "(", "\"outputs\"", ")", "# Log predictions", "decoded_outputs", "=", "[", "]", "# [(str, str, str)]. See all_outputs above.", "if", "decode_hp", ".", "decode_in_memory", ":", "all_outputs", ".", "append", "(", "decoded_outputs", ")", "decoded_scores", "=", "[", "]", "if", "decode_hp", ".", "return_beams", ":", "output_beams", "=", "np", ".", "split", "(", "outputs", ",", "decode_hp", ".", "beam_size", ",", "axis", "=", "0", ")", "scores", "=", "None", "if", "\"scores\"", "in", "prediction", ":", "scores", "=", "np", ".", "split", "(", "prediction", "[", "\"scores\"", "]", ",", "decode_hp", ".", "beam_size", ",", "axis", "=", "0", ")", "for", "i", ",", "beam", "in", "enumerate", "(", "output_beams", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"BEAM %d:\"", "%", "i", ")", "score", "=", "scores", "and", "scores", "[", "i", "]", "decoded", "=", "log_decode_results", "(", "inputs", ",", "beam", ",", "problem_name", ",", "num_predictions", ",", "inputs_vocab", ",", "targets_vocab", ",", "save_images", "=", "decode_hp", ".", "save_images", ",", "output_dir", "=", "output_dir", ",", "identity_output", "=", "decode_hp", ".", "identity_output", ",", "targets", "=", "targets", ",", "log_results", "=", "log_results", ")", "decoded_outputs", ".", "append", "(", "decoded", ")", "if", "decode_hp", ".", "write_beam_scores", ":", "decoded_scores", ".", "append", "(", "score", ")", "else", ":", "decoded", "=", "log_decode_results", "(", "inputs", ",", "outputs", ",", "problem_name", ",", "num_predictions", ",", "inputs_vocab", ",", "targets_vocab", ",", "save_images", "=", "decode_hp", ".", "save_images", ",", "output_dir", "=", "output_dir", ",", "identity_output", "=", "decode_hp", ".", "identity_output", ",", "targets", "=", "targets", ",", "log_results", "=", "log_results", ",", "skip_eos_postprocess", "=", "decode_hp", ".", "skip_eos_postprocess", ")", "decoded_outputs", ".", "append", "(", "decoded", ")", "# Write out predictions if decode_to_file passed", "if", "decode_to_file", ":", "for", "i", ",", "(", "d_input", ",", "d_output", ",", "d_target", ")", "in", "enumerate", "(", "decoded_outputs", ")", ":", "# Skip if all padding", "if", "d_input", "and", "re", ".", "match", "(", "\"^({})+$\"", ".", "format", "(", "text_encoder", ".", "PAD", ")", ",", "d_input", ")", ":", "continue", "beam_score_str", "=", "\"\"", "if", "decode_hp", ".", "write_beam_scores", ":", "beam_score_str", "=", "\"\\t%.2f\"", "%", "decoded_scores", "[", "i", "]", "output_file", ".", "write", "(", "str", "(", "d_output", ")", "+", "beam_score_str", "+", "decode_hp", ".", "delimiter", ")", "target_file", ".", "write", "(", "str", "(", "d_target", ")", "+", "decode_hp", ".", "delimiter", ")", "input_file", ".", "write", "(", "str", "(", "d_input", ")", "+", "decode_hp", ".", "delimiter", ")", "if", "(", "decode_hp", ".", "num_samples", ">=", "0", "and", "num_predictions", ">=", "decode_hp", ".", "num_samples", ")", ":", "break", "mlperf_log", ".", "transformer_print", "(", "key", "=", "mlperf_log", ".", "EVAL_SIZE", ",", "value", "=", "num_eval_samples", ",", "hparams", "=", "hparams", ")", "if", "decode_to_file", ":", "output_file", ".", "close", "(", ")", "target_file", ".", "close", "(", ")", "input_file", ".", "close", "(", ")", "return", "all_outputs" ]
Decodes once. Args: estimator: tf.estimator.Estimator instance. Used to generate encoded predictions. problem_name: str. Name of problem. hparams: HParams instance. HParams for model training. infer_input_fn: zero-arg function. Input function for estimator. decode_hp: HParams instance. See decode_hparams() above. decode_to_file: str. Prefix for filenames. Used to generated filenames to which decoded predictions are written. output_dir: str. Output directory. Only used for writing images. log_results: bool. If False, return encoded predictions without any further processing. checkpoint_path: str. Path to load model checkpoint from. If unspecified, Estimator's default is used. Returns: If decode_hp.decode_in_memory is True: List of dicts, one per example. Values are either numpy arrays or decoded strings. If decode_hp.decode_in_memory is False: An empty list.
[ "Decodes", "once", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L245-L391
train
Decodes one of the encoded images.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,F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XYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + '\063' + chr(0b10 + 0o63) + '\064', 8834 - 8826), ehT0Px3KOsy9('\060' + chr(7205 - 7094) + '\x31' + chr(55) + '\064', 0b1000), ehT0Px3KOsy9(chr(695 - 647) + '\157' + chr(257 - 207) + chr(50) + chr(0b10101 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + chr(340 - 291) + chr(0b101110 + 0o4) + chr(0b1000 + 0o50), 0o10), ehT0Px3KOsy9(chr(752 - 704) + chr(0b1101111) + chr(51) + chr(0b10111 + 0o34) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(7584 - 7473) + chr(50) + chr(0b10101 + 0o36) + chr(1022 - 970), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(2112 - 2058) + '\061', 46315 - 46307), ehT0Px3KOsy9(chr(48) + chr(8622 - 8511) + chr(52) + chr(0b10100 + 0o41), 0o10), ehT0Px3KOsy9(chr(1368 - 1320) + chr(11242 - 11131) + '\063' + chr(52) + '\x33', 25991 - 25983), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100111 + 0o12) + chr(0b110001) + chr(2028 - 1975), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1111 + 0o50) + chr(958 - 906), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(50) + chr(634 - 584) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1319 - 1271) + chr(0b10110 + 0o131) + chr(215 - 164) + chr(49) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(480 - 429) + '\064' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + chr(0b110101) + chr(0b110110), 6530 - 6522), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(7927 - 7816) + '\061' + chr(1985 - 1933) + chr(1748 - 1700), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(576 - 527) + '\x36' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4688 - 4577) + chr(2243 - 2193) + chr(52) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + '\x33' + chr(0b10101 + 0o42) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(510 - 462) + chr(10658 - 10547) + '\x33' + '\065', 15117 - 15109), ehT0Px3KOsy9('\x30' + chr(0b101101 + 0o102) + chr(0b110011) + '\x30' + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(578 - 528) + chr(52), 35324 - 35316), ehT0Px3KOsy9(chr(1154 - 1106) + chr(0b111000 + 0o67) + chr(52) + chr(0b1011 + 0o53), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(7112 - 7001) + chr(0b1000 + 0o52) + chr(0b110110) + chr(0b11000 + 0o31), 52665 - 52657), ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + '\x33' + chr(0b10101 + 0o37) + chr(889 - 836), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110 + 0o54) + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(10728 - 10617) + chr(0b110111) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b1000 + 0o52) + chr(0b1010 + 0o55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1202 - 1153) + chr(404 - 354), 25362 - 25354), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(1611 - 1561) + chr(0b100011 + 0o15) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1508 - 1457) + '\061' + chr(0b1010 + 0o51), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + '\062' + '\x33', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + '\061' + chr(398 - 346), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b110110) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(1996 - 1885) + '\063' + '\x36' + chr(675 - 623), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + chr(1355 - 1304) + chr(1837 - 1785), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(8104 - 7993) + chr(0b110011) + chr(0b101001 + 0o10) + chr(754 - 705), 21267 - 21259), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110010) + chr(0b101010 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(488 - 438) + chr(48) + chr(0b11101 + 0o32), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + '\065' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2'), '\x64' + chr(0b1100101 + 0o0) + '\x63' + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(3210 - 3108) + '\055' + chr(0b101 + 0o63)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def jac9GiDJ3Ezq(GDZi5OTNos9m, wezGpYDorAsK, n4ljua2gi1Pr, HU1DaIKhwbv7, dcaitvFqg9pp, fIXoiUadZGQd, nd0OX_BS6_o4, wps_9DOfYptw=ehT0Px3KOsy9(chr(795 - 747) + chr(4116 - 4005) + '\061', 0o10), lbKq88EBpYWb=None): qIQi_VFCIFZL = GDZi5OTNos9m.POyImYQwg5VB(HU1DaIKhwbv7, checkpoint_path=lbKq88EBpYWb) if not wps_9DOfYptw: return YyaZ4tpXu4lf(qIQi_VFCIFZL) fIXoiUadZGQd = fIXoiUadZGQd or dcaitvFqg9pp.fIXoiUadZGQd if fIXoiUadZGQd: dW637rIAFzVK = basVkyHhP3Xl(fIXoiUadZGQd, wezGpYDorAsK, dcaitvFqg9pp) gIfWK5W_pmM4 = dW637rIAFzVK.split(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2'), '\x64' + chr(0b111101 + 0o50) + chr(0b1100011) + chr(2033 - 1922) + '\144' + chr(0b1100101))(chr(4638 - 4521) + '\164' + '\x66' + chr(0b101101) + chr(0b100100 + 0o24))) gIfWK5W_pmM4[-ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + chr(0b10001 + 0o40), 8)] = xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x1d\xe07\xbc\xe8\x02'), chr(100) + chr(0b1100101) + '\x63' + chr(0b111011 + 0o64) + chr(0b1001001 + 0o33) + chr(101))(chr(117) + '\164' + '\x66' + chr(45) + chr(0b111000)) KgPC4KzIIniZ = xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2'), chr(0b1100100) + '\x65' + chr(7584 - 7485) + chr(0b1101111) + '\x64' + '\145')(chr(2386 - 2269) + chr(116) + chr(0b1010 + 0o134) + chr(45) + '\x38').join(gIfWK5W_pmM4) gIfWK5W_pmM4[-ehT0Px3KOsy9(chr(0b110000) + chr(0b111011 + 0o64) + '\x31', 8)] = xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x12\xe2%\xad\xef'), '\144' + chr(0b1011 + 0o132) + chr(4518 - 4419) + '\157' + '\144' + '\145')('\x75' + chr(0b1101101 + 0o7) + chr(102) + chr(0b101101) + chr(0b111000)) uOrfkm4xYEkU = xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2'), '\x64' + chr(0b10001 + 0o124) + chr(9233 - 9134) + chr(0b1101111) + '\144' + '\x65')(chr(117) + '\164' + chr(102) + chr(0b101101) + chr(0b111000)).join(gIfWK5W_pmM4) mkvzj_PhLPP2 = IDJ2eXGCBCDu.gfile.Open(dW637rIAFzVK, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b'), chr(1226 - 1126) + chr(0b1100101) + '\143' + chr(4663 - 4552) + chr(0b1100100) + chr(101))('\165' + chr(0b1001101 + 0o47) + chr(102) + '\x2d' + '\070')) CRIagLW0mIXH = IDJ2eXGCBCDu.gfile.Open(KgPC4KzIIniZ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b'), chr(8399 - 8299) + chr(0b1100101) + chr(99) + chr(9614 - 9503) + chr(0b1100000 + 0o4) + '\x65')(chr(117) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b10101 + 0o43))) ZS43hVvGhK4C = IDJ2eXGCBCDu.gfile.Open(uOrfkm4xYEkU, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b'), '\144' + chr(101) + chr(0b1100011) + '\x6f' + chr(5950 - 5850) + '\x65')(chr(117) + chr(0b1110100) + chr(5899 - 5797) + chr(1402 - 1357) + '\070')) sXqesioLf7Ji = n4ljua2gi1Pr.sXqesioLf7Ji pfhXZufo40AS = xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x12\xe2%\xad\xef'), chr(100) + chr(0b1100101) + chr(0b111111 + 0o44) + chr(9651 - 9540) + '\144' + '\145')(chr(117) + chr(4704 - 4588) + '\146' + chr(45) + chr(56)) in sXqesioLf7Ji.Vemi1XCgm0ph q198siCVdcld = xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x12\xe2%\xad\xef'), '\x64' + '\145' + '\143' + chr(111) + chr(3112 - 3012) + '\x65')(chr(0b1110101) + '\164' + chr(102) + '\055' + chr(0b111000)) if pfhXZufo40AS else xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x1d\xe07\xbc\xe8\x02'), '\144' + chr(9606 - 9505) + '\143' + chr(2004 - 1893) + chr(0b1100100) + chr(0b10000 + 0o125))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(0b10 + 0o66)) GFENRgsjdCkQ = sXqesioLf7Ji.Vemi1XCgm0ph[q198siCVdcld] GpnyPjDizdlO = sXqesioLf7Ji.Vemi1XCgm0ph[xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x1d\xe07\xbc\xe8\x02'), '\144' + chr(0b100000 + 0o105) + chr(99) + chr(11481 - 11370) + chr(5132 - 5032) + chr(0b1100101))(chr(117) + '\164' + chr(102) + '\055' + chr(0b111000))] c6s9BKVEPCXR = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000), 0b1000) A1zXvrNsUZlG = [] for (DVYEn8ljvWRc, ys6Y0jo7ObhM) in YlkZvXL8qwsX(qIQi_VFCIFZL): c6s9BKVEPCXR += ehT0Px3KOsy9(chr(0b110000) + chr(6400 - 6289) + chr(653 - 604), 8) DVYEn8ljvWRc += ehT0Px3KOsy9(chr(1341 - 1293) + chr(0b1101111) + chr(0b110001), 8) vXoupepMtCXU = ys6Y0jo7ObhM.get(xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x12\xe2%\xad\xef'), chr(0b1100100) + '\145' + chr(3490 - 3391) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))('\165' + chr(0b1110100) + chr(0b1100110) + '\055' + chr(0b111000))) xIEmRseySp3z = ys6Y0jo7ObhM.get(xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x1d\xe07\xbc\xe8\x02'), chr(4543 - 4443) + chr(4600 - 4499) + '\x63' + '\x6f' + chr(100) + '\145')('\165' + '\164' + chr(5154 - 5052) + chr(0b101101) + chr(0b100101 + 0o23))) Dx_DllZ8uCko = ys6Y0jo7ObhM.get(xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\t\xe6 \xac\xe8\x02'), chr(9200 - 9100) + '\145' + chr(0b1000111 + 0o34) + chr(0b101010 + 0o105) + chr(0b1010101 + 0o17) + chr(0b1100101))(chr(117) + chr(0b1100011 + 0o21) + chr(8304 - 8202) + chr(0b101101) + '\x38')) WWdNah7UQWQY = [] if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x19\xf1?\xbd\xf9.L\x8d\x12Q\xf4\xa2\x8a\\\x19'), chr(100) + '\145' + chr(0b10 + 0o141) + chr(3284 - 3173) + chr(100) + '\x65')(chr(0b1110101) + '\x74' + chr(0b10001 + 0o125) + '\x2d' + chr(0b1110 + 0o52))): xafqLlk3kkUe(A1zXvrNsUZlG, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d\x0c\xe25\xb7\xf8'), chr(0b1100100) + chr(101) + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1010111 + 0o16))('\x75' + chr(0b1011110 + 0o26) + chr(0b111000 + 0o56) + chr(783 - 738) + '\x38'))(WWdNah7UQWQY) ia482Ga1blyA = [] if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9e\x19\xe6%\xab\xf2.G\x86,Q\xe2'), chr(0b100111 + 0o75) + '\145' + chr(99) + chr(9694 - 9583) + chr(100) + chr(0b1101 + 0o130))('\x75' + chr(116) + chr(0b1011 + 0o133) + chr(0b100000 + 0o15) + '\x38')): XQjqFLtNskxo = WqUC3KWvYVup.split(Dx_DllZ8uCko, dcaitvFqg9pp.PQZjDxhiHJGf, axis=ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(0b100101 + 0o13), 8)) b8rpGniBNUPr = None if xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f\x1f\xfd"\xbc\xef'), '\144' + chr(0b1100101) + chr(0b1100011) + '\157' + '\144' + chr(101))('\x75' + chr(0b100101 + 0o117) + '\x66' + chr(226 - 181) + chr(56)) in ys6Y0jo7ObhM: b8rpGniBNUPr = WqUC3KWvYVup.split(ys6Y0jo7ObhM[xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f\x1f\xfd"\xbc\xef'), chr(0b1100100) + chr(0b1000100 + 0o41) + chr(0b1100011) + chr(111) + chr(0b101001 + 0o73) + chr(2322 - 2221))(chr(0b1110101) + chr(116) + chr(2967 - 2865) + chr(0b101100 + 0o1) + chr(0b110000 + 0o10))], dcaitvFqg9pp.PQZjDxhiHJGf, axis=ehT0Px3KOsy9(chr(1360 - 1312) + chr(111) + chr(0b11111 + 0o21), 8)) for (WVxHKyX45z_L, g37JLGi8ajKb) in YlkZvXL8qwsX(XQjqFLtNskxo): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbfK\xda(\xac\xff\x16\x12\x89!f\xfa'), '\144' + chr(101) + chr(0b1100011) + '\x6f' + chr(2123 - 2023) + '\x65')(chr(117) + '\x74' + chr(0b1100110) + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xae9\xd3\x1d\xf9\xb9\x15\x1f'), '\x64' + chr(0b1100101) + chr(0b1100011) + '\157' + chr(8142 - 8042) + chr(7712 - 7611))(chr(0b1110101) + chr(0b1100001 + 0o23) + '\x66' + chr(0b101101) + '\x38') % WVxHKyX45z_L) n9fd4FsgoqFs = b8rpGniBNUPr and b8rpGniBNUPr[WVxHKyX45z_L] xv8V2FHKfu8K = K9rTheAZ6Epi(vXoupepMtCXU, g37JLGi8ajKb, wezGpYDorAsK, DVYEn8ljvWRc, GFENRgsjdCkQ, GpnyPjDizdlO, save_images=dcaitvFqg9pp.save_images, output_dir=nd0OX_BS6_o4, identity_output=dcaitvFqg9pp.identity_output, targets=xIEmRseySp3z, log_results=wps_9DOfYptw) xafqLlk3kkUe(WWdNah7UQWQY, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d\x0c\xe25\xb7\xf8'), '\x64' + '\145' + '\143' + chr(11804 - 11693) + chr(0b1100100) + '\x65')(chr(1884 - 1767) + chr(1697 - 1581) + chr(0b110111 + 0o57) + chr(0b101101) + '\070'))(xv8V2FHKfu8K) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\x0e\xfb$\xbc\xc3\x13@\x82 c\xe2\xac\x8a\\\x05\x04'), '\x64' + chr(10112 - 10011) + '\143' + chr(9454 - 9343) + chr(3160 - 3060) + chr(5623 - 5522))(chr(0b100 + 0o161) + '\164' + chr(9017 - 8915) + '\x2d' + chr(0b1110 + 0o52))): xafqLlk3kkUe(ia482Ga1blyA, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d\x0c\xe25\xb7\xf8'), '\144' + '\x65' + chr(99) + chr(1997 - 1886) + chr(1394 - 1294) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(1923 - 1878) + '\070'))(n9fd4FsgoqFs) else: xv8V2FHKfu8K = K9rTheAZ6Epi(vXoupepMtCXU, Dx_DllZ8uCko, wezGpYDorAsK, DVYEn8ljvWRc, GFENRgsjdCkQ, GpnyPjDizdlO, save_images=dcaitvFqg9pp.save_images, output_dir=nd0OX_BS6_o4, identity_output=dcaitvFqg9pp.identity_output, targets=xIEmRseySp3z, log_results=wps_9DOfYptw, skip_eos_postprocess=dcaitvFqg9pp.skip_eos_postprocess) xafqLlk3kkUe(WWdNah7UQWQY, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d\x0c\xe25\xb7\xf8'), '\144' + chr(3248 - 3147) + '\143' + chr(111) + '\x64' + chr(0b1100101))('\x75' + chr(0b1100010 + 0o22) + '\146' + chr(1374 - 1329) + '\070'))(xv8V2FHKfu8K) if fIXoiUadZGQd: for (WVxHKyX45z_L, (lcxlSb76V1S2, WUyhfcVaQR8I, Z5O9leePzwBV)) in YlkZvXL8qwsX(WWdNah7UQWQY): if lcxlSb76V1S2 and xafqLlk3kkUe(_7u55U49WwX2, xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\x1d\xe63\xb1'), chr(8331 - 8231) + chr(0b1010110 + 0o17) + '\x63' + chr(9871 - 9760) + chr(100) + chr(0b1000101 + 0o40))(chr(117) + chr(4301 - 4185) + chr(0b101 + 0o141) + chr(0b101101) + chr(1830 - 1774)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2T\xe9-\xf0\xb7U'), chr(100) + chr(101) + '\143' + '\x6f' + '\144' + chr(0b1000000 + 0o45))(chr(7154 - 7037) + '\164' + chr(2589 - 2487) + '\x2d' + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xbaH\xe0?\x91\xfd"\x16\xb3=Y\xfb'), '\x64' + chr(0b10010 + 0o123) + '\x63' + '\x6f' + '\144' + chr(0b1000011 + 0o42))(chr(117) + chr(116) + '\x66' + chr(0b101101) + chr(56)))(xafqLlk3kkUe(nCRDzZ_Is9fz, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc=\xd6'), '\x64' + chr(0b1100101) + chr(0b100110 + 0o75) + chr(111) + '\144' + chr(0b100111 + 0o76))(chr(117) + chr(11471 - 11355) + chr(0b1100110) + chr(75 - 30) + '\070'))), lcxlSb76V1S2): continue eUjczuFi21x5 = xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(6319 - 6219) + chr(2259 - 2158) + chr(0b110000 + 0o63) + chr(275 - 164) + '\x64' + '\x65')(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b10100 + 0o31) + chr(56)) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\x0e\xfb$\xbc\xc3\x13@\x82 c\xe2\xac\x8a\\\x05\x04'), '\144' + chr(5359 - 5258) + chr(3280 - 3181) + chr(0b1101000 + 0o7) + chr(0b1000101 + 0o37) + chr(8149 - 8048))(chr(0b111000 + 0o75) + '\x74' + chr(10105 - 10003) + chr(45) + chr(0b1111 + 0o51))): eUjczuFi21x5 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe5Y\xbcb\xbf'), chr(0b1000101 + 0o37) + '\x65' + '\x63' + '\x6f' + chr(0b1001001 + 0o33) + chr(101))(chr(11809 - 11692) + chr(116) + chr(0b10000 + 0o126) + '\x2d' + '\x38') % ia482Ga1blyA[WVxHKyX45z_L] xafqLlk3kkUe(mkvzj_PhLPP2, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\x0e\xfb$\xbc'), chr(100) + chr(0b10111 + 0o116) + chr(0b1100011) + '\157' + chr(2529 - 2429) + '\145')(chr(13668 - 13551) + '\x74' + '\146' + chr(0b101101) + '\070'))(M8_cKLkHVB2V(WUyhfcVaQR8I) + eUjczuFi21x5 + xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x19\xfe9\xb4\xf5\x05@\x91'), '\144' + '\145' + chr(0b1100011) + chr(9330 - 9219) + chr(0b1100100) + '\145')(chr(117) + '\x74' + chr(0b1000010 + 0o44) + chr(1979 - 1934) + '\070'))) xafqLlk3kkUe(CRIagLW0mIXH, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\x0e\xfb$\xbc'), '\x64' + chr(5970 - 5869) + '\x63' + chr(0b111000 + 0o67) + chr(0b1100100) + chr(101))(chr(3511 - 3394) + chr(0b1110100) + chr(102) + '\x2d' + chr(0b111000)))(M8_cKLkHVB2V(Z5O9leePzwBV) + xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x19\xfe9\xb4\xf5\x05@\x91'), chr(100) + chr(101) + chr(6181 - 6082) + chr(0b11011 + 0o124) + '\144' + chr(0b1100101))('\165' + chr(116) + chr(4269 - 4167) + '\x2d' + chr(0b11001 + 0o37)))) xafqLlk3kkUe(ZS43hVvGhK4C, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\x0e\xfb$\xbc'), chr(0b1100100) + chr(0b1001110 + 0o27) + '\x63' + chr(0b1000011 + 0o54) + chr(0b1001001 + 0o33) + chr(0b1100101))('\165' + '\x74' + chr(9292 - 9190) + '\x2d' + chr(2450 - 2394)))(M8_cKLkHVB2V(lcxlSb76V1S2) + xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x19\xfe9\xb4\xf5\x05@\x91'), chr(0b10101 + 0o117) + chr(0b1010010 + 0o23) + '\143' + chr(0b101101 + 0o102) + chr(5414 - 5314) + chr(0b1100101))('\x75' + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b111000)))) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x82\t\xff\x0f\xaa\xfd\x1cU\x8f(O'), chr(3665 - 3565) + '\145' + chr(99) + chr(0b100 + 0o153) + '\x64' + chr(2428 - 2327))(chr(117) + chr(0b1011111 + 0o25) + chr(102) + '\055' + '\x38')) >= ehT0Px3KOsy9(chr(48) + '\157' + chr(1532 - 1484), 8) and DVYEn8ljvWRc >= xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x82\t\xff\x0f\xaa\xfd\x1cU\x8f(O'), '\144' + chr(0b1100101) + '\143' + chr(1646 - 1535) + '\144' + '\x65')('\165' + chr(11138 - 11022) + '\146' + chr(0b101101) + chr(0b111000))): break xafqLlk3kkUe(mcP9wB7s3wV8, xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x0e\xf3>\xaa\xfa\x1eW\x8e(N\xce\xbf\x97G\x0e\x03'), chr(100) + chr(0b111110 + 0o47) + chr(8452 - 8353) + '\x6f' + chr(932 - 832) + '\145')('\x75' + chr(116) + chr(102) + '\x2d' + '\070'))(key=xafqLlk3kkUe(mcP9wB7s3wV8, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9*\xd3\x1c\x86\xcf8\x7f\xa6'), chr(3912 - 3812) + chr(0b1100101) + chr(0b101011 + 0o70) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(102) + chr(1207 - 1162) + chr(56))), value=c6s9BKVEPCXR, hparams=n4ljua2gi1Pr) if fIXoiUadZGQd: xafqLlk3kkUe(mkvzj_PhLPP2, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f\x10\xfd#\xbc'), chr(0b1100100) + chr(101) + '\143' + chr(0b1011110 + 0o21) + '\144' + '\145')(chr(117) + '\164' + '\x66' + chr(0b101101) + chr(0b10111 + 0o41)))() xafqLlk3kkUe(CRIagLW0mIXH, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f\x10\xfd#\xbc'), chr(3972 - 3872) + '\x65' + chr(0b1100011) + chr(111) + '\x64' + '\145')(chr(13124 - 13007) + chr(889 - 773) + '\146' + chr(45) + chr(0b111000)))() xafqLlk3kkUe(ZS43hVvGhK4C, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f\x10\xfd#\xbc'), chr(100) + chr(5254 - 5153) + chr(99) + chr(0b1101111) + chr(100) + chr(101))('\165' + '\164' + chr(9205 - 9103) + chr(391 - 346) + chr(1083 - 1027)))() return A1zXvrNsUZlG
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
decode_from_file
def decode_from_file(estimator, filename, hparams, decode_hp, decode_to_file=None, checkpoint_path=None): """Compute predictions on entries in filename and write them out.""" if not decode_hp.batch_size: decode_hp.batch_size = 32 tf.logging.info( "decode_hp.batch_size not specified; default=%d" % decode_hp.batch_size) # Inputs vocabulary is set to targets if there are no inputs in the problem, # e.g., for language models where the inputs are just a prefix of targets. p_hp = hparams.problem_hparams has_input = "inputs" in p_hp.vocabulary inputs_vocab_key = "inputs" if has_input else "targets" inputs_vocab = p_hp.vocabulary[inputs_vocab_key] targets_vocab = p_hp.vocabulary["targets"] problem_name = FLAGS.problem filename = _add_shard_to_filename(filename, decode_hp) tf.logging.info("Performing decoding from file (%s)." % filename) if has_input: sorted_inputs, sorted_keys = _get_sorted_inputs( filename, decode_hp.delimiter) else: sorted_inputs = _get_language_modeling_inputs( filename, decode_hp.delimiter, repeat=decode_hp.num_decodes) sorted_keys = range(len(sorted_inputs)) num_sentences = len(sorted_inputs) num_decode_batches = (num_sentences - 1) // decode_hp.batch_size + 1 if estimator.config.use_tpu: length = getattr(hparams, "length", 0) or hparams.max_length batch_ids = [] for line in sorted_inputs: if has_input: ids = inputs_vocab.encode(line.strip()) + [1] else: ids = targets_vocab.encode(line) if len(ids) < length: ids.extend([0] * (length - len(ids))) else: ids = ids[:length] batch_ids.append(ids) np_ids = np.array(batch_ids, dtype=np.int32) def input_fn(params): batch_size = params["batch_size"] dataset = tf.data.Dataset.from_tensor_slices({"inputs": np_ids}) dataset = dataset.map( lambda ex: {"inputs": tf.reshape(ex["inputs"], (length, 1, 1))}) dataset = dataset.batch(batch_size) return dataset else: def input_fn(): input_gen = _decode_batch_input_fn( num_decode_batches, sorted_inputs, inputs_vocab, decode_hp.batch_size, decode_hp.max_input_size, task_id=decode_hp.multiproblem_task_id, has_input=has_input) gen_fn = make_input_fn_from_generator(input_gen) example = gen_fn() return _decode_input_tensor_to_features_dict(example, hparams) decodes = [] result_iter = estimator.predict(input_fn, checkpoint_path=checkpoint_path) start_time = time.time() total_time_per_step = 0 total_cnt = 0 def timer(gen): while True: try: start_time = time.time() item = next(gen) elapsed_time = time.time() - start_time yield elapsed_time, item except StopIteration: break for elapsed_time, result in timer(result_iter): if decode_hp.return_beams: beam_decodes = [] beam_scores = [] output_beams = np.split(result["outputs"], decode_hp.beam_size, axis=0) scores = None if "scores" in result: if np.isscalar(result["scores"]): result["scores"] = result["scores"].reshape(1) scores = np.split(result["scores"], decode_hp.beam_size, axis=0) for k, beam in enumerate(output_beams): tf.logging.info("BEAM %d:" % k) score = scores and scores[k] _, decoded_outputs, _ = log_decode_results( result["inputs"], beam, problem_name, None, inputs_vocab, targets_vocab, log_results=decode_hp.log_results, skip_eos_postprocess=decode_hp.skip_eos_postprocess) beam_decodes.append(decoded_outputs) if decode_hp.write_beam_scores: beam_scores.append(score) if decode_hp.write_beam_scores: decodes.append("\t".join([ "\t".join([d, "%.2f" % s]) for d, s in zip(beam_decodes, beam_scores) ])) else: decodes.append("\t".join(beam_decodes)) else: _, decoded_outputs, _ = log_decode_results( result["inputs"], result["outputs"], problem_name, None, inputs_vocab, targets_vocab, log_results=decode_hp.log_results, skip_eos_postprocess=decode_hp.skip_eos_postprocess) decodes.append(decoded_outputs) total_time_per_step += elapsed_time total_cnt += result["outputs"].shape[-1] duration = time.time() - start_time tf.logging.info("Elapsed Time: %5.5f" % duration) tf.logging.info("Averaged Single Token Generation Time: %5.7f " "(time %5.7f count %d)" % (total_time_per_step / total_cnt, total_time_per_step, total_cnt)) if decode_hp.batch_size == 1: tf.logging.info("Inference time %.4f seconds " "(Latency = %.4f ms/setences)" % (duration, 1000.0*duration/num_sentences)) else: tf.logging.info("Inference time %.4f seconds " "(Throughput = %.4f sentences/second)" % (duration, num_sentences/duration)) # If decode_to_file was provided use it as the output filename without change # (except for adding shard_id if using more shards for decoding). # Otherwise, use the input filename plus model, hp, problem, beam, alpha. decode_filename = decode_to_file if decode_to_file else filename if not decode_to_file: decode_filename = _decode_filename(decode_filename, problem_name, decode_hp) else: decode_filename = _add_shard_to_filename(decode_filename, decode_hp) tf.logging.info("Writing decodes into %s" % decode_filename) outfile = tf.gfile.Open(decode_filename, "w") for index in range(len(sorted_inputs)): outfile.write("%s%s" % (decodes[sorted_keys[index]], decode_hp.delimiter)) outfile.flush() outfile.close() output_dir = os.path.join(estimator.model_dir, "decode") tf.gfile.MakeDirs(output_dir) run_postdecode_hooks(DecodeHookArgs( estimator=estimator, problem=hparams.problem, output_dirs=[output_dir], hparams=hparams, decode_hparams=decode_hp, predictions=list(result_iter) ), None)
python
def decode_from_file(estimator, filename, hparams, decode_hp, decode_to_file=None, checkpoint_path=None): """Compute predictions on entries in filename and write them out.""" if not decode_hp.batch_size: decode_hp.batch_size = 32 tf.logging.info( "decode_hp.batch_size not specified; default=%d" % decode_hp.batch_size) # Inputs vocabulary is set to targets if there are no inputs in the problem, # e.g., for language models where the inputs are just a prefix of targets. p_hp = hparams.problem_hparams has_input = "inputs" in p_hp.vocabulary inputs_vocab_key = "inputs" if has_input else "targets" inputs_vocab = p_hp.vocabulary[inputs_vocab_key] targets_vocab = p_hp.vocabulary["targets"] problem_name = FLAGS.problem filename = _add_shard_to_filename(filename, decode_hp) tf.logging.info("Performing decoding from file (%s)." % filename) if has_input: sorted_inputs, sorted_keys = _get_sorted_inputs( filename, decode_hp.delimiter) else: sorted_inputs = _get_language_modeling_inputs( filename, decode_hp.delimiter, repeat=decode_hp.num_decodes) sorted_keys = range(len(sorted_inputs)) num_sentences = len(sorted_inputs) num_decode_batches = (num_sentences - 1) // decode_hp.batch_size + 1 if estimator.config.use_tpu: length = getattr(hparams, "length", 0) or hparams.max_length batch_ids = [] for line in sorted_inputs: if has_input: ids = inputs_vocab.encode(line.strip()) + [1] else: ids = targets_vocab.encode(line) if len(ids) < length: ids.extend([0] * (length - len(ids))) else: ids = ids[:length] batch_ids.append(ids) np_ids = np.array(batch_ids, dtype=np.int32) def input_fn(params): batch_size = params["batch_size"] dataset = tf.data.Dataset.from_tensor_slices({"inputs": np_ids}) dataset = dataset.map( lambda ex: {"inputs": tf.reshape(ex["inputs"], (length, 1, 1))}) dataset = dataset.batch(batch_size) return dataset else: def input_fn(): input_gen = _decode_batch_input_fn( num_decode_batches, sorted_inputs, inputs_vocab, decode_hp.batch_size, decode_hp.max_input_size, task_id=decode_hp.multiproblem_task_id, has_input=has_input) gen_fn = make_input_fn_from_generator(input_gen) example = gen_fn() return _decode_input_tensor_to_features_dict(example, hparams) decodes = [] result_iter = estimator.predict(input_fn, checkpoint_path=checkpoint_path) start_time = time.time() total_time_per_step = 0 total_cnt = 0 def timer(gen): while True: try: start_time = time.time() item = next(gen) elapsed_time = time.time() - start_time yield elapsed_time, item except StopIteration: break for elapsed_time, result in timer(result_iter): if decode_hp.return_beams: beam_decodes = [] beam_scores = [] output_beams = np.split(result["outputs"], decode_hp.beam_size, axis=0) scores = None if "scores" in result: if np.isscalar(result["scores"]): result["scores"] = result["scores"].reshape(1) scores = np.split(result["scores"], decode_hp.beam_size, axis=0) for k, beam in enumerate(output_beams): tf.logging.info("BEAM %d:" % k) score = scores and scores[k] _, decoded_outputs, _ = log_decode_results( result["inputs"], beam, problem_name, None, inputs_vocab, targets_vocab, log_results=decode_hp.log_results, skip_eos_postprocess=decode_hp.skip_eos_postprocess) beam_decodes.append(decoded_outputs) if decode_hp.write_beam_scores: beam_scores.append(score) if decode_hp.write_beam_scores: decodes.append("\t".join([ "\t".join([d, "%.2f" % s]) for d, s in zip(beam_decodes, beam_scores) ])) else: decodes.append("\t".join(beam_decodes)) else: _, decoded_outputs, _ = log_decode_results( result["inputs"], result["outputs"], problem_name, None, inputs_vocab, targets_vocab, log_results=decode_hp.log_results, skip_eos_postprocess=decode_hp.skip_eos_postprocess) decodes.append(decoded_outputs) total_time_per_step += elapsed_time total_cnt += result["outputs"].shape[-1] duration = time.time() - start_time tf.logging.info("Elapsed Time: %5.5f" % duration) tf.logging.info("Averaged Single Token Generation Time: %5.7f " "(time %5.7f count %d)" % (total_time_per_step / total_cnt, total_time_per_step, total_cnt)) if decode_hp.batch_size == 1: tf.logging.info("Inference time %.4f seconds " "(Latency = %.4f ms/setences)" % (duration, 1000.0*duration/num_sentences)) else: tf.logging.info("Inference time %.4f seconds " "(Throughput = %.4f sentences/second)" % (duration, num_sentences/duration)) # If decode_to_file was provided use it as the output filename without change # (except for adding shard_id if using more shards for decoding). # Otherwise, use the input filename plus model, hp, problem, beam, alpha. decode_filename = decode_to_file if decode_to_file else filename if not decode_to_file: decode_filename = _decode_filename(decode_filename, problem_name, decode_hp) else: decode_filename = _add_shard_to_filename(decode_filename, decode_hp) tf.logging.info("Writing decodes into %s" % decode_filename) outfile = tf.gfile.Open(decode_filename, "w") for index in range(len(sorted_inputs)): outfile.write("%s%s" % (decodes[sorted_keys[index]], decode_hp.delimiter)) outfile.flush() outfile.close() output_dir = os.path.join(estimator.model_dir, "decode") tf.gfile.MakeDirs(output_dir) run_postdecode_hooks(DecodeHookArgs( estimator=estimator, problem=hparams.problem, output_dirs=[output_dir], hparams=hparams, decode_hparams=decode_hp, predictions=list(result_iter) ), None)
[ "def", "decode_from_file", "(", "estimator", ",", "filename", ",", "hparams", ",", "decode_hp", ",", "decode_to_file", "=", "None", ",", "checkpoint_path", "=", "None", ")", ":", "if", "not", "decode_hp", ".", "batch_size", ":", "decode_hp", ".", "batch_size", "=", "32", "tf", ".", "logging", ".", "info", "(", "\"decode_hp.batch_size not specified; default=%d\"", "%", "decode_hp", ".", "batch_size", ")", "# Inputs vocabulary is set to targets if there are no inputs in the problem,", "# e.g., for language models where the inputs are just a prefix of targets.", "p_hp", "=", "hparams", ".", "problem_hparams", "has_input", "=", "\"inputs\"", "in", "p_hp", ".", "vocabulary", "inputs_vocab_key", "=", "\"inputs\"", "if", "has_input", "else", "\"targets\"", "inputs_vocab", "=", "p_hp", ".", "vocabulary", "[", "inputs_vocab_key", "]", "targets_vocab", "=", "p_hp", ".", "vocabulary", "[", "\"targets\"", "]", "problem_name", "=", "FLAGS", ".", "problem", "filename", "=", "_add_shard_to_filename", "(", "filename", ",", "decode_hp", ")", "tf", ".", "logging", ".", "info", "(", "\"Performing decoding from file (%s).\"", "%", "filename", ")", "if", "has_input", ":", "sorted_inputs", ",", "sorted_keys", "=", "_get_sorted_inputs", "(", "filename", ",", "decode_hp", ".", "delimiter", ")", "else", ":", "sorted_inputs", "=", "_get_language_modeling_inputs", "(", "filename", ",", "decode_hp", ".", "delimiter", ",", "repeat", "=", "decode_hp", ".", "num_decodes", ")", "sorted_keys", "=", "range", "(", "len", "(", "sorted_inputs", ")", ")", "num_sentences", "=", "len", "(", "sorted_inputs", ")", "num_decode_batches", "=", "(", "num_sentences", "-", "1", ")", "//", "decode_hp", ".", "batch_size", "+", "1", "if", "estimator", ".", "config", ".", "use_tpu", ":", "length", "=", "getattr", "(", "hparams", ",", "\"length\"", ",", "0", ")", "or", "hparams", ".", "max_length", "batch_ids", "=", "[", "]", "for", "line", "in", "sorted_inputs", ":", "if", "has_input", ":", "ids", "=", "inputs_vocab", ".", "encode", "(", "line", ".", "strip", "(", ")", ")", "+", "[", "1", "]", "else", ":", "ids", "=", "targets_vocab", ".", "encode", "(", "line", ")", "if", "len", "(", "ids", ")", "<", "length", ":", "ids", ".", "extend", "(", "[", "0", "]", "*", "(", "length", "-", "len", "(", "ids", ")", ")", ")", "else", ":", "ids", "=", "ids", "[", ":", "length", "]", "batch_ids", ".", "append", "(", "ids", ")", "np_ids", "=", "np", ".", "array", "(", "batch_ids", ",", "dtype", "=", "np", ".", "int32", ")", "def", "input_fn", "(", "params", ")", ":", "batch_size", "=", "params", "[", "\"batch_size\"", "]", "dataset", "=", "tf", ".", "data", ".", "Dataset", ".", "from_tensor_slices", "(", "{", "\"inputs\"", ":", "np_ids", "}", ")", "dataset", "=", "dataset", ".", "map", "(", "lambda", "ex", ":", "{", "\"inputs\"", ":", "tf", ".", "reshape", "(", "ex", "[", "\"inputs\"", "]", ",", "(", "length", ",", "1", ",", "1", ")", ")", "}", ")", "dataset", "=", "dataset", ".", "batch", "(", "batch_size", ")", "return", "dataset", "else", ":", "def", "input_fn", "(", ")", ":", "input_gen", "=", "_decode_batch_input_fn", "(", "num_decode_batches", ",", "sorted_inputs", ",", "inputs_vocab", ",", "decode_hp", ".", "batch_size", ",", "decode_hp", ".", "max_input_size", ",", "task_id", "=", "decode_hp", ".", "multiproblem_task_id", ",", "has_input", "=", "has_input", ")", "gen_fn", "=", "make_input_fn_from_generator", "(", "input_gen", ")", "example", "=", "gen_fn", "(", ")", "return", "_decode_input_tensor_to_features_dict", "(", "example", ",", "hparams", ")", "decodes", "=", "[", "]", "result_iter", "=", "estimator", ".", "predict", "(", "input_fn", ",", "checkpoint_path", "=", "checkpoint_path", ")", "start_time", "=", "time", ".", "time", "(", ")", "total_time_per_step", "=", "0", "total_cnt", "=", "0", "def", "timer", "(", "gen", ")", ":", "while", "True", ":", "try", ":", "start_time", "=", "time", ".", "time", "(", ")", "item", "=", "next", "(", "gen", ")", "elapsed_time", "=", "time", ".", "time", "(", ")", "-", "start_time", "yield", "elapsed_time", ",", "item", "except", "StopIteration", ":", "break", "for", "elapsed_time", ",", "result", "in", "timer", "(", "result_iter", ")", ":", "if", "decode_hp", ".", "return_beams", ":", "beam_decodes", "=", "[", "]", "beam_scores", "=", "[", "]", "output_beams", "=", "np", ".", "split", "(", "result", "[", "\"outputs\"", "]", ",", "decode_hp", ".", "beam_size", ",", "axis", "=", "0", ")", "scores", "=", "None", "if", "\"scores\"", "in", "result", ":", "if", "np", ".", "isscalar", "(", "result", "[", "\"scores\"", "]", ")", ":", "result", "[", "\"scores\"", "]", "=", "result", "[", "\"scores\"", "]", ".", "reshape", "(", "1", ")", "scores", "=", "np", ".", "split", "(", "result", "[", "\"scores\"", "]", ",", "decode_hp", ".", "beam_size", ",", "axis", "=", "0", ")", "for", "k", ",", "beam", "in", "enumerate", "(", "output_beams", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"BEAM %d:\"", "%", "k", ")", "score", "=", "scores", "and", "scores", "[", "k", "]", "_", ",", "decoded_outputs", ",", "_", "=", "log_decode_results", "(", "result", "[", "\"inputs\"", "]", ",", "beam", ",", "problem_name", ",", "None", ",", "inputs_vocab", ",", "targets_vocab", ",", "log_results", "=", "decode_hp", ".", "log_results", ",", "skip_eos_postprocess", "=", "decode_hp", ".", "skip_eos_postprocess", ")", "beam_decodes", ".", "append", "(", "decoded_outputs", ")", "if", "decode_hp", ".", "write_beam_scores", ":", "beam_scores", ".", "append", "(", "score", ")", "if", "decode_hp", ".", "write_beam_scores", ":", "decodes", ".", "append", "(", "\"\\t\"", ".", "join", "(", "[", "\"\\t\"", ".", "join", "(", "[", "d", ",", "\"%.2f\"", "%", "s", "]", ")", "for", "d", ",", "s", "in", "zip", "(", "beam_decodes", ",", "beam_scores", ")", "]", ")", ")", "else", ":", "decodes", ".", "append", "(", "\"\\t\"", ".", "join", "(", "beam_decodes", ")", ")", "else", ":", "_", ",", "decoded_outputs", ",", "_", "=", "log_decode_results", "(", "result", "[", "\"inputs\"", "]", ",", "result", "[", "\"outputs\"", "]", ",", "problem_name", ",", "None", ",", "inputs_vocab", ",", "targets_vocab", ",", "log_results", "=", "decode_hp", ".", "log_results", ",", "skip_eos_postprocess", "=", "decode_hp", ".", "skip_eos_postprocess", ")", "decodes", ".", "append", "(", "decoded_outputs", ")", "total_time_per_step", "+=", "elapsed_time", "total_cnt", "+=", "result", "[", "\"outputs\"", "]", ".", "shape", "[", "-", "1", "]", "duration", "=", "time", ".", "time", "(", ")", "-", "start_time", "tf", ".", "logging", ".", "info", "(", "\"Elapsed Time: %5.5f\"", "%", "duration", ")", "tf", ".", "logging", ".", "info", "(", "\"Averaged Single Token Generation Time: %5.7f \"", "\"(time %5.7f count %d)\"", "%", "(", "total_time_per_step", "/", "total_cnt", ",", "total_time_per_step", ",", "total_cnt", ")", ")", "if", "decode_hp", ".", "batch_size", "==", "1", ":", "tf", ".", "logging", ".", "info", "(", "\"Inference time %.4f seconds \"", "\"(Latency = %.4f ms/setences)\"", "%", "(", "duration", ",", "1000.0", "*", "duration", "/", "num_sentences", ")", ")", "else", ":", "tf", ".", "logging", ".", "info", "(", "\"Inference time %.4f seconds \"", "\"(Throughput = %.4f sentences/second)\"", "%", "(", "duration", ",", "num_sentences", "/", "duration", ")", ")", "# If decode_to_file was provided use it as the output filename without change", "# (except for adding shard_id if using more shards for decoding).", "# Otherwise, use the input filename plus model, hp, problem, beam, alpha.", "decode_filename", "=", "decode_to_file", "if", "decode_to_file", "else", "filename", "if", "not", "decode_to_file", ":", "decode_filename", "=", "_decode_filename", "(", "decode_filename", ",", "problem_name", ",", "decode_hp", ")", "else", ":", "decode_filename", "=", "_add_shard_to_filename", "(", "decode_filename", ",", "decode_hp", ")", "tf", ".", "logging", ".", "info", "(", "\"Writing decodes into %s\"", "%", "decode_filename", ")", "outfile", "=", "tf", ".", "gfile", ".", "Open", "(", "decode_filename", ",", "\"w\"", ")", "for", "index", "in", "range", "(", "len", "(", "sorted_inputs", ")", ")", ":", "outfile", ".", "write", "(", "\"%s%s\"", "%", "(", "decodes", "[", "sorted_keys", "[", "index", "]", "]", ",", "decode_hp", ".", "delimiter", ")", ")", "outfile", ".", "flush", "(", ")", "outfile", ".", "close", "(", ")", "output_dir", "=", "os", ".", "path", ".", "join", "(", "estimator", ".", "model_dir", ",", "\"decode\"", ")", "tf", ".", "gfile", ".", "MakeDirs", "(", "output_dir", ")", "run_postdecode_hooks", "(", "DecodeHookArgs", "(", "estimator", "=", "estimator", ",", "problem", "=", "hparams", ".", "problem", ",", "output_dirs", "=", "[", "output_dir", "]", ",", "hparams", "=", "hparams", ",", "decode_hparams", "=", "decode_hp", ",", "predictions", "=", "list", "(", "result_iter", ")", ")", ",", "None", ")" ]
Compute predictions on entries in filename and write them out.
[ "Compute", "predictions", "on", "entries", "in", "filename", "and", "write", "them", "out", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L394-L559
train
Decodes the given file into a set of predictions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAA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meticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\062' + '\063' + chr(0b11100 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(11394 - 11283) + chr(0b110001) + chr(2396 - 2342) + chr(1945 - 1891), 0o10), ehT0Px3KOsy9(chr(1527 - 1479) + '\157' + chr(0b100100 + 0o15) + '\065' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110100) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(0b10000 + 0o41) + chr(48) + chr(59 - 10), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b101001 + 0o10) + chr(0b11110 + 0o30), 42188 - 42180), ehT0Px3KOsy9(chr(936 - 888) + '\x6f' + chr(0b100011 + 0o20) + chr(49) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1724 - 1674) + chr(0b101111 + 0o6) + chr(2501 - 2450), 5383 - 5375), ehT0Px3KOsy9(chr(48) + chr(859 - 748) + chr(0b110010) + '\x34', 316 - 308), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b10101 + 0o36) + chr(0b110111), 8), ehT0Px3KOsy9(chr(1602 - 1554) + '\157' + chr(0b110010) + chr(541 - 493) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + chr(100 - 49), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(0b110011) + '\064' + chr(55), 46319 - 46311), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(759 - 710) + chr(522 - 472) + chr(53), 4010 - 4002), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(2362 - 2309) + chr(1913 - 1858), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\x37' + chr(48), 22183 - 22175), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + chr(0b100 + 0o56) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b110001) + '\063', 63725 - 63717), ehT0Px3KOsy9(chr(1390 - 1342) + chr(111) + '\x32' + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101110 + 0o6) + chr(50), 0o10), ehT0Px3KOsy9(chr(792 - 744) + '\x6f' + '\065' + chr(0b101100 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b101010 + 0o6) + chr(0b110010), 39360 - 39352), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(699 - 647) + chr(0b110100), 59972 - 59964), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\060' + chr(1182 - 1129), 33949 - 33941), ehT0Px3KOsy9(chr(1698 - 1650) + '\x6f' + '\x31' + '\x36' + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + '\x37' + '\x36', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(1912 - 1863) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b100110 + 0o20), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + chr(0b110001) + chr(0b1001 + 0o55) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\x35' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + chr(0b10100 + 0o36) + chr(2324 - 2275) + chr(0b10001 + 0o46), 61696 - 61688), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(1516 - 1405) + chr(1985 - 1935) + chr(0b101110 + 0o10) + chr(2167 - 2118), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1012 - 957) + '\x32', 0o10), ehT0Px3KOsy9(chr(706 - 658) + chr(0b1101111) + chr(1112 - 1062) + chr(1355 - 1306) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8459 - 8348) + chr(50) + chr(0b110110) + chr(2289 - 2235), 0b1000), ehT0Px3KOsy9(chr(663 - 615) + chr(5969 - 5858) + chr(291 - 242) + chr(53) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1566 - 1516) + chr(0b110111) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(3534 - 3423) + chr(0b110000 + 0o3) + chr(0b110111) + '\x36', 8), ehT0Px3KOsy9(chr(2006 - 1958) + chr(8282 - 8171) + chr(862 - 811) + '\065' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(1614 - 1561) + '\063', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\065' + chr(1163 - 1115), 28640 - 28632)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb1'), chr(100) + '\x65' + '\x63' + chr(9916 - 9805) + chr(100) + chr(101))('\x75' + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TTsk1pxwDMKj(GDZi5OTNos9m, xw4DsBfIJ22E, n4ljua2gi1Pr, dcaitvFqg9pp, fIXoiUadZGQd=None, lbKq88EBpYWb=None): if not xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x0eQ\x82\x1b\xb7\xad\xeay\xca\xf9Z'), '\x64' + chr(101) + '\x63' + '\x6f' + '\x64' + chr(7585 - 7484))(chr(117) + '\x74' + chr(102) + chr(0b101101) + chr(1113 - 1057))): dcaitvFqg9pp.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x34' + '\060', 59516 - 59508) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), '\x64' + chr(101) + chr(3864 - 3765) + chr(0b110101 + 0o72) + '\x64' + '\x65')('\165' + chr(0b1101011 + 0o11) + chr(102) + chr(45) + chr(100 - 44)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xfb\x13\x0b\x89%\xab\x97\xc3d\xb1\xe3b\x936\x07'b\xe2kG\n,K\xf1W\x8d\xfas\x16\x05\xe9\xd8_\xec\x8dK\xdc\x9b\x8e\xca\xea\x1a\x1c\xdbd\xaa"), chr(0b101010 + 0o72) + '\x65' + '\x63' + '\x6f' + chr(8741 - 8641) + chr(101))('\x75' + chr(0b1001010 + 0o52) + chr(0b101001 + 0o75) + '\x2d' + '\x38') % xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x0eQ\x82\x1b\xb7\xad\xeay\xca\xf9Z'), chr(0b1010100 + 0o20) + chr(0b1010 + 0o133) + chr(672 - 573) + chr(11668 - 11557) + chr(0b1011 + 0o131) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56)))) VnMmhixm5Q_Z = n4ljua2gi1Pr.sXqesioLf7Ji pfhXZufo40AS = xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), chr(0b1100100) + chr(101) + chr(0b1001111 + 0o24) + chr(111) + chr(0b110010 + 0o62) + '\145')('\165' + chr(1584 - 1468) + chr(0b1100110) + chr(0b101010 + 0o3) + chr(56)) in VnMmhixm5Q_Z.Vemi1XCgm0ph q198siCVdcld = xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), '\144' + chr(5676 - 5575) + chr(99) + '\x6f' + '\x64' + '\x65')(chr(8286 - 8169) + chr(4868 - 4752) + '\146' + chr(852 - 807) + '\x38') if pfhXZufo40AS else xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\x17\x1a\x81$\xba\xbb'), '\x64' + chr(0b1010010 + 0o23) + chr(0b1100011) + chr(111) + '\x64' + '\145')(chr(117) + '\164' + chr(10225 - 10123) + chr(1450 - 1405) + chr(0b101001 + 0o17)) GFENRgsjdCkQ = VnMmhixm5Q_Z.Vemi1XCgm0ph[q198siCVdcld] GpnyPjDizdlO = VnMmhixm5Q_Z.Vemi1XCgm0ph[xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\x17\x1a\x81$\xba\xbb'), chr(100) + chr(0b1100101) + chr(99) + '\157' + chr(0b110100 + 0o60) + '\x65')(chr(117) + chr(0b1010010 + 0o42) + chr(10389 - 10287) + chr(45) + chr(56))] wezGpYDorAsK = vUTZFbqN0o8F.sO7e1A_Mor6Q xw4DsBfIJ22E = rhp5rbSIWIqB(xw4DsBfIJ22E, dcaitvFqg9pp) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), chr(0b1100100) + '\145' + chr(0b10000 + 0o123) + chr(111) + chr(0b1100100) + '\145')('\165' + chr(0b1110100) + chr(650 - 548) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf\x13\x1a\x80.\xbc\xa5\xc2z\xf8\xa1g\x826\x00\x1cx\xe5v\x02L0K\xe8W\x98\xe3z\x10L\xa7\x94I\xa1\x98'), '\144' + chr(101) + chr(0b1001000 + 0o33) + '\x6f' + '\x64' + '\x65')('\x75' + chr(9085 - 8969) + '\x66' + chr(0b100001 + 0o14) + chr(188 - 132)) % xw4DsBfIJ22E) if pfhXZufo40AS: (RA19AwBpedWr, BLAnPTKfUUc5) = xMW4Y7oEMTHR(xw4DsBfIJ22E, dcaitvFqg9pp.delimiter) else: RA19AwBpedWr = SuK67CVuKKhG(xw4DsBfIJ22E, dcaitvFqg9pp.delimiter, repeat=dcaitvFqg9pp.num_decodes) BLAnPTKfUUc5 = vQr8gNKaIaWE(c2A0yzQpDQB3(RA19AwBpedWr)) WSQEZ7aaS3nT = c2A0yzQpDQB3(RA19AwBpedWr) LItBGdTUwtJq = (WSQEZ7aaS3nT - ehT0Px3KOsy9(chr(1092 - 1044) + '\157' + chr(0b10110 + 0o33), 0b1000)) // dcaitvFqg9pp.ix9dZyeAmUxY + ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(0b110001), 8) if xafqLlk3kkUe(GDZi5OTNos9m.config, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3B\r\xa3v\xa5\xab\xd1]\xd5\xf6b'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1101111) + chr(5988 - 5888) + chr(0b101000 + 0o75))(chr(12395 - 12278) + '\x74' + '\146' + chr(1895 - 1850) + '\x38')): CHAOgk5VCHH_ = xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\x13\x06\x815\xa6'), chr(5807 - 5707) + chr(0b1100101) + chr(0b10110 + 0o115) + '\157' + chr(0b10000 + 0o124) + chr(0b1100101))(chr(0b1110100 + 0o1) + '\x74' + chr(10251 - 10149) + '\055' + chr(56)), ehT0Px3KOsy9(chr(48) + chr(2717 - 2606) + '\060', 2857 - 2849)) or n4ljua2gi1Pr._o7pVXAdOCRy JMNvVwyLFTYY = [] for LycYkDpyelF6 in RA19AwBpedWr: if pfhXZufo40AS: zdjj2pRemk_P = GFENRgsjdCkQ.encode(LycYkDpyelF6.strip()) + [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001), 8)] else: zdjj2pRemk_P = GpnyPjDizdlO.encode(LycYkDpyelF6) if c2A0yzQpDQB3(zdjj2pRemk_P) < CHAOgk5VCHH_: xafqLlk3kkUe(zdjj2pRemk_P, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\x0e\x1c\x83/\xaa'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b11 + 0o52) + chr(2045 - 1989)))([ehT0Px3KOsy9('\x30' + '\157' + chr(48), 8)] * (CHAOgk5VCHH_ - c2A0yzQpDQB3(zdjj2pRemk_P))) else: zdjj2pRemk_P = zdjj2pRemk_P[:CHAOgk5VCHH_] xafqLlk3kkUe(JMNvVwyLFTYY, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\x18\x83/\xaa'), '\x64' + '\145' + chr(1043 - 944) + chr(0b1000011 + 0o54) + chr(0b1100100) + chr(0b1100101))('\x75' + chr(0b1101000 + 0o14) + chr(102) + chr(1072 - 1027) + '\x38'))(zdjj2pRemk_P) wxYzg_5CMZSO = WqUC3KWvYVup.B0ePDhpqxN5n(JMNvVwyLFTYY, dtype=WqUC3KWvYVup.int32) def MVwQV4Upte2X(nEbJZ4wfte2w): ix9dZyeAmUxY = nEbJZ4wfte2w[xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\x17\x1c\x85)\x91\xbb\xc2n\xfa'), chr(100) + chr(101) + chr(0b1010111 + 0o14) + '\157' + '\x64' + chr(101))('\165' + chr(116) + chr(0b1100110) + '\x2d' + '\070')] xQt6gV9VfTO3 = IDJ2eXGCBCDu.data.Dataset.from_tensor_slices({xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), chr(0b100000 + 0o104) + '\x65' + '\143' + chr(7787 - 7676) + chr(1418 - 1318) + chr(2363 - 2262))('\165' + chr(116) + chr(0b1100110) + '\x2d' + chr(2845 - 2789)): wxYzg_5CMZSO}) xQt6gV9VfTO3 = xQt6gV9VfTO3.map(lambda DfdhY28yEwAF: {xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), chr(3776 - 3676) + '\145' + '\143' + chr(0b101110 + 0o101) + chr(8780 - 8680) + '\x65')(chr(117) + chr(2033 - 1917) + chr(8510 - 8408) + chr(0b101101) + chr(988 - 932)): IDJ2eXGCBCDu.reshape(DfdhY28yEwAF[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), '\x64' + chr(0b1100101) + '\143' + '\x6f' + chr(100) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b110010 + 0o64) + '\x2d' + chr(0b101011 + 0o15))], (CHAOgk5VCHH_, ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(1455 - 1344) + '\x31', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), 8)))}) xQt6gV9VfTO3 = xQt6gV9VfTO3.dNwAahu8tvoY(ix9dZyeAmUxY) return xQt6gV9VfTO3 else: def MVwQV4Upte2X(): NV6bpOSPa6bj = XOn01vg4Zdkm(LItBGdTUwtJq, RA19AwBpedWr, GFENRgsjdCkQ, dcaitvFqg9pp.ix9dZyeAmUxY, dcaitvFqg9pp.max_input_size, task_id=dcaitvFqg9pp.multiproblem_task_id, has_input=pfhXZufo40AS) R6_MYqV8djOL = pzsO3mHxucTJ(NV6bpOSPa6bj) kP4qaKv0ZkGv = R6_MYqV8djOL() return eP2Fingmc0IP(kP4qaKv0ZkGv, n4ljua2gi1Pr) JgwtGBp07ZIP = [] VRSPKYG7TaoE = GDZi5OTNos9m.POyImYQwg5VB(MVwQV4Upte2X, checkpoint_path=lbKq88EBpYWb) tSzPDN5a8DrS = ltvhPP4VhXre.time() IqlGW4WqLAKW = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(48), 8) U_CTsGVuFKEP = ehT0Px3KOsy9(chr(1575 - 1527) + chr(0b1001000 + 0o47) + '\060', 8) def gY2Es2eMB1I_(A3KGdOxgWpUn): while ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001), 8): try: tSzPDN5a8DrS = ltvhPP4VhXre.time() N7j7ePTXzzI0 = nSwwHEeM4cxI(A3KGdOxgWpUn) Ql8yIDpWqYEB = ltvhPP4VhXre.time() - tSzPDN5a8DrS yield (Ql8yIDpWqYEB, N7j7ePTXzzI0) except hr2QaoivbFQ2: break for (Ql8yIDpWqYEB, ShZmEKfTkAOZ) in gY2Es2eMB1I_(VRSPKYG7TaoE): if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\x13\x1c\x933\xa0\x97\xc9q\xfe\xecp'), chr(0b1100100) + '\x65' + chr(4423 - 4324) + chr(0b1101111) + chr(0b1001110 + 0o26) + chr(0b10010 + 0o123))(chr(0b111111 + 0o66) + chr(9552 - 9436) + chr(0b1100110) + chr(0b11100 + 0o21) + chr(0b10001 + 0o47))): f7Vmbw7C7whP = [] gjOYRZ6sm9I7 = [] XQjqFLtNskxo = WqUC3KWvYVup.split(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\x03\x1c\x964\xba\xbb'), chr(4062 - 3962) + '\x65' + chr(0b1000001 + 0o42) + chr(0b100 + 0o153) + chr(0b1001001 + 0o33) + chr(0b1100101))(chr(117) + chr(0b1101110 + 0o6) + '\146' + '\x2d' + '\070')], dcaitvFqg9pp.PQZjDxhiHJGf, axis=ehT0Px3KOsy9('\x30' + chr(0b1001 + 0o146) + chr(683 - 635), 8)) b8rpGniBNUPr = None if xafqLlk3kkUe(SXOLrMavuUCe(b'\xec\x15\x07\x94$\xbd'), chr(100) + chr(3851 - 3750) + chr(4327 - 4228) + chr(111) + '\144' + '\145')(chr(117) + chr(0b1011 + 0o151) + '\146' + '\x2d' + '\x38') in ShZmEKfTkAOZ: if xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x05\x1b\x85 \xa2\xa9\xd9'), '\x64' + chr(101) + '\x63' + '\157' + chr(0b111000 + 0o54) + chr(0b1100101))('\165' + chr(0b1110 + 0o146) + chr(2819 - 2717) + '\055' + chr(0b111000)))(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xec\x15\x07\x94$\xbd'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\157' + chr(7962 - 7862) + chr(2772 - 2671))('\x75' + chr(0b10001 + 0o143) + chr(0b1100110) + chr(0b11110 + 0o17) + chr(0b111000))]): ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xec\x15\x07\x94$\xbd'), chr(100) + '\145' + chr(99) + chr(0b1101111) + '\144' + '\145')(chr(0b1110101) + '\164' + '\146' + chr(1237 - 1192) + chr(56))] = ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xec\x15\x07\x94$\xbd'), chr(0b111110 + 0o46) + '\145' + '\143' + chr(111) + chr(2206 - 2106) + chr(0b111110 + 0o47))(chr(6395 - 6278) + '\x74' + chr(0b1100110) + chr(0b1111 + 0o36) + '\070')].reshape(ehT0Px3KOsy9(chr(979 - 931) + '\157' + '\x31', 8)) b8rpGniBNUPr = WqUC3KWvYVup.split(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xec\x15\x07\x94$\xbd'), chr(2916 - 2816) + chr(4008 - 3907) + '\x63' + chr(111) + '\x64' + chr(0b110010 + 0o63))(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(45) + '\x38')], dcaitvFqg9pp.PQZjDxhiHJGf, axis=ehT0Px3KOsy9('\x30' + chr(7515 - 7404) + '\x30', 8)) for (OolUPRJhRaJd, g37JLGi8ajKb) in YlkZvXL8qwsX(XQjqFLtNskxo): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), chr(0b1100001 + 0o3) + chr(0b100000 + 0o105) + '\x63' + '\157' + chr(6267 - 6167) + chr(0b1001001 + 0o34))('\165' + chr(0b1110100) + chr(3602 - 3500) + chr(0b1110 + 0o37) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd3)\xaba\xeb\xac\x91'), '\x64' + chr(0b1100101) + chr(0b10011 + 0o120) + chr(0b1101111) + '\144' + '\x65')('\x75' + '\x74' + chr(0b1010000 + 0o26) + '\055' + '\x38') % OolUPRJhRaJd) n9fd4FsgoqFs = b8rpGniBNUPr and b8rpGniBNUPr[OolUPRJhRaJd] (VNGQdHSFPrso, WWdNah7UQWQY, VNGQdHSFPrso) = K9rTheAZ6Epi(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), chr(2099 - 1999) + '\x65' + chr(99) + '\157' + '\x64' + '\x65')(chr(117) + '\x74' + chr(0b1011100 + 0o12) + '\x2d' + '\070')], g37JLGi8ajKb, wezGpYDorAsK, None, GFENRgsjdCkQ, GpnyPjDizdlO, log_results=dcaitvFqg9pp.log_results, skip_eos_postprocess=dcaitvFqg9pp.skip_eos_postprocess) xafqLlk3kkUe(f7Vmbw7C7whP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\x18\x83/\xaa'), chr(0b1000101 + 0o37) + chr(101) + chr(99) + '\x6f' + chr(100) + chr(101))('\165' + chr(0b1110100) + chr(0b11011 + 0o113) + chr(0b101101) + chr(0b110110 + 0o2)))(WWdNah7UQWQY) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8\x04\x01\x92$\x91\xaa\xceu\xf2\xdep\x84:\x1d\x1db'), '\x64' + chr(101) + chr(3731 - 3632) + '\x6f' + '\144' + chr(101))('\x75' + chr(0b1101001 + 0o13) + chr(102) + chr(688 - 643) + '\070')): xafqLlk3kkUe(gjOYRZ6sm9I7, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\x18\x83/\xaa'), '\x64' + chr(0b1011110 + 0o7) + chr(5546 - 5447) + '\157' + '\x64' + chr(2089 - 1988))(chr(0b1110101) + '\164' + chr(102) + chr(0b101101) + chr(56)))(n9fd4FsgoqFs) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8\x04\x01\x92$\x91\xaa\xceu\xf2\xdep\x84:\x1d\x1db'), '\144' + chr(0b1100 + 0o131) + '\143' + chr(111) + chr(100) + chr(0b111000 + 0o55))(chr(9142 - 9025) + chr(0b1110100) + '\146' + '\x2d' + chr(56))): xafqLlk3kkUe(JgwtGBp07ZIP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\x18\x83/\xaa'), '\x64' + '\x65' + '\x63' + chr(0b111101 + 0o62) + '\144' + '\x65')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(45) + chr(1865 - 1809)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x96'), chr(0b1100100) + '\145' + '\143' + chr(0b1101111) + chr(0b101010 + 0o72) + chr(0b1101 + 0o130))(chr(0b1110101) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5\x19\x01\x88'), '\x64' + '\145' + chr(0b1100011) + '\157' + '\144' + '\x65')('\x75' + chr(876 - 760) + chr(3367 - 3265) + chr(505 - 460) + chr(2164 - 2108)))([xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x96'), chr(4502 - 4402) + chr(101) + chr(8427 - 8328) + chr(111) + '\x64' + chr(0b1100101))('\165' + chr(116) + chr(0b1100110) + chr(45) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5\x19\x01\x88'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(3132 - 3021) + chr(8838 - 8738) + chr(0b1000011 + 0o42))('\x75' + '\164' + chr(0b101100 + 0o72) + '\x2d' + chr(0b10011 + 0o45)))([pd3lxn9vqWxp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbaXZ\x80'), '\x64' + chr(101) + chr(0b1001010 + 0o31) + '\157' + chr(100) + chr(0b1011101 + 0o10))('\165' + chr(0b1011011 + 0o31) + '\x66' + chr(987 - 942) + chr(56)) % vGrByMSYMp9h]) for (pd3lxn9vqWxp, vGrByMSYMp9h) in pZ0NK2y6HRbn(f7Vmbw7C7whP, gjOYRZ6sm9I7)])) else: xafqLlk3kkUe(JgwtGBp07ZIP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\x18\x83/\xaa'), '\144' + chr(0b100010 + 0o103) + chr(3359 - 3260) + chr(2851 - 2740) + chr(0b110011 + 0o61) + '\145')('\165' + chr(7870 - 7754) + chr(0b1100110) + '\055' + chr(2841 - 2785)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x96'), chr(100) + chr(101) + chr(99) + chr(0b1100000 + 0o17) + '\x64' + chr(0b111100 + 0o51))(chr(117) + chr(116) + chr(974 - 872) + '\x2d' + chr(0b10101 + 0o43)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5\x19\x01\x88'), chr(0b11101 + 0o107) + '\x65' + chr(0b1001110 + 0o25) + chr(12078 - 11967) + chr(584 - 484) + chr(0b1100101))('\165' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(f7Vmbw7C7whP)) else: (VNGQdHSFPrso, WWdNah7UQWQY, VNGQdHSFPrso) = K9rTheAZ6Epi(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x18\x18\x935\xbd'), chr(100) + chr(101) + chr(0b1010101 + 0o16) + chr(0b111100 + 0o63) + '\x64' + chr(0b1100101))(chr(0b1110101) + '\164' + '\146' + chr(0b101101) + chr(56))], ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\x03\x1c\x964\xba\xbb'), chr(100) + '\145' + chr(0b1011100 + 0o7) + chr(2618 - 2507) + chr(0b101110 + 0o66) + chr(0b1100101))('\x75' + chr(116) + chr(0b1000100 + 0o42) + '\055' + chr(56))], wezGpYDorAsK, None, GFENRgsjdCkQ, GpnyPjDizdlO, log_results=dcaitvFqg9pp.log_results, skip_eos_postprocess=dcaitvFqg9pp.skip_eos_postprocess) xafqLlk3kkUe(JgwtGBp07ZIP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x06\x18\x83/\xaa'), chr(2928 - 2828) + chr(101) + chr(9320 - 9221) + '\x6f' + chr(0b1100100) + '\x65')(chr(117) + '\x74' + '\146' + '\x2d' + chr(60 - 4)))(WWdNah7UQWQY) IqlGW4WqLAKW += Ql8yIDpWqYEB U_CTsGVuFKEP += ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\x03\x1c\x964\xba\xbb'), chr(0b1100010 + 0o2) + '\x65' + '\143' + '\x6f' + chr(9829 - 9729) + '\145')(chr(8849 - 8732) + chr(0b1110100) + '\x66' + chr(0b11011 + 0o22) + chr(0b111000))].nauYfLglTpcb[-ehT0Px3KOsy9(chr(313 - 265) + '\157' + '\061', 8)] AW3Z20f3DKFA = ltvhPP4VhXre.time() - tSzPDN5a8DrS xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), '\144' + chr(0b1011011 + 0o12) + chr(0b1100011) + '\x6f' + chr(0b11100 + 0o110) + chr(101))('\165' + chr(116) + chr(4963 - 4861) + chr(0b101100 + 0o1) + chr(0b0 + 0o70)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xda\x1a\t\x962\xab\xac\x8b@\xf6\xecf\xdduJM?\xbew'), '\x64' + chr(6035 - 5934) + chr(0b1100011) + chr(6779 - 6668) + '\144' + '\x65')(chr(0b1101111 + 0o6) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b101010 + 0o16)) % AW3Z20f3DKFA) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), chr(1291 - 1191) + chr(0b10111 + 0o116) + '\143' + chr(0b1000110 + 0o51) + chr(0b1100100) + '\x65')('\x75' + chr(11875 - 11759) + chr(2656 - 2554) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\x00\r\x94 \xa9\xad\xcf4\xcc\xe8m\x809\nXE\xe4zGDbc\xe0\x19\x9b\xf8w\x01\x05\xe0\xdf\x1a\xdc\xdf\x06\xdd\xc4\xc8\x8e\xaaX_\x80a\xe6\xbc\xc2y\xfa\xa1&\xd2{X\x1e1\xe8~WD6\x04\xa0\x13\xd7'), '\144' + chr(5537 - 5436) + '\x63' + '\x6f' + chr(0b1010101 + 0o17) + chr(0b101010 + 0o73))('\165' + chr(116) + '\146' + chr(0b10011 + 0o32) + chr(56)) % (IqlGW4WqLAKW / U_CTsGVuFKEP, IqlGW4WqLAKW, U_CTsGVuFKEP)) if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x0eQ\x82\x1b\xb7\xad\xeay\xca\xf9Z'), chr(0b1100100) + chr(0b1100101) + chr(4819 - 4720) + '\157' + chr(0b1011100 + 0o10) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(0b1110 + 0o130) + '\055' + chr(56))) == ehT0Px3KOsy9(chr(2183 - 2135) + chr(0b1101001 + 0o6) + chr(1307 - 1258), 8): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), '\x64' + chr(1058 - 957) + '\x63' + chr(111) + chr(9499 - 9399) + '\145')('\x75' + chr(0b1110100) + '\146' + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xd6\x18\x0e\x833\xab\xa6\xc8q\xbf\xf5j\x8a0O]?\xbfw\x02Y'G\xea\x19\x9a\xf96] \xee\xc5_\xe6\xd5\x12\x98\xc3\xc8\x8e\xb1B\x0e\xc6,\xbd\xe7\xd8q\xeb\xe4m\x840\x1cQ"), '\144' + chr(0b1000000 + 0o45) + '\143' + chr(0b1101111) + chr(100) + '\145')('\x75' + chr(3765 - 3649) + chr(8333 - 8231) + chr(0b101101) + chr(0b110110 + 0o2)) % (AW3Z20f3DKFA, 1000.0 * AW3Z20f3DKFA / WSQEZ7aaS3nT)) else: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), '\x64' + '\145' + chr(0b1001011 + 0o30) + chr(0b1101111) + '\x64' + chr(0b1100101))('\165' + chr(0b1110100) + '\146' + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xd6\x18\x0e\x833\xab\xa6\xc8q\xbf\xf5j\x8a0O]?\xbfw\x02Y'G\xea\x19\x9a\xf96]8\xe7\xc3U\xfd\xd1\x03\xc8\x8b\x9c\x8b\xa2VM\xc8u\xa8\xe8\xd8q\xf1\xf5f\x896\n\x0b>\xf8tAE,@\xac"), '\x64' + '\145' + chr(99) + chr(12149 - 12038) + '\x64' + chr(0b1010000 + 0o25))(chr(0b11100 + 0o131) + chr(116) + '\x66' + chr(45) + chr(0b100 + 0o64)) % (AW3Z20f3DKFA, WSQEZ7aaS3nT / AW3Z20f3DKFA)) fhCpkYyZHPcr = fIXoiUadZGQd if fIXoiUadZGQd else xw4DsBfIJ22E if not fIXoiUadZGQd: fhCpkYyZHPcr = basVkyHhP3Xl(fhCpkYyZHPcr, wezGpYDorAsK, dcaitvFqg9pp) else: fhCpkYyZHPcr = rhp5rbSIWIqB(fhCpkYyZHPcr, dcaitvFqg9pp) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xccA \x9e4\xad\xaf\x9c~\xf3\xdbh'), '\144' + chr(8705 - 8604) + '\143' + '\157' + chr(100) + '\145')('\x75' + '\x74' + chr(0b1100110) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\x04\x01\x92(\xa0\xaf\x8bp\xfa\xe2l\x830\x1cXx\xe5eM\ngW'), chr(7614 - 7514) + '\145' + chr(99) + chr(111) + '\144' + chr(0b10000 + 0o125))('\165' + '\x74' + '\146' + '\055' + chr(0b111000)) % fhCpkYyZHPcr) VYUfp6Ou9W7x = IDJ2eXGCBCDu.gfile.Open(fhCpkYyZHPcr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8'), '\144' + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(0b1000 + 0o134) + '\145')('\x75' + '\164' + '\x66' + chr(1203 - 1158) + chr(56))) for XdowRbJKZWL9 in vQr8gNKaIaWE(c2A0yzQpDQB3(RA19AwBpedWr)): xafqLlk3kkUe(VYUfp6Ou9W7x, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8\x04\x01\x92$'), '\x64' + chr(9980 - 9879) + '\x63' + chr(111) + chr(0b1100100) + chr(2984 - 2883))('\x75' + chr(0b1110100) + chr(10229 - 10127) + chr(1628 - 1583) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xba\x05M\x95'), '\144' + chr(8528 - 8427) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(10004 - 9903))(chr(6316 - 6199) + chr(0b1110100) + '\146' + '\055' + chr(2806 - 2750)) % (JgwtGBp07ZIP[BLAnPTKfUUc5[XdowRbJKZWL9]], xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x13\x04\x8f,\xa7\xbc\xcef'), chr(9298 - 9198) + '\145' + '\143' + chr(10215 - 10104) + chr(1235 - 1135) + chr(0b111000 + 0o55))('\x75' + chr(0b1011 + 0o151) + '\x66' + chr(0b101101) + '\x38')))) xafqLlk3kkUe(VYUfp6Ou9W7x, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9\x1a\x1d\x95)'), chr(9518 - 9418) + '\145' + chr(113 - 14) + '\x6f' + '\144' + chr(101))(chr(117) + chr(116) + '\146' + chr(0b1 + 0o54) + chr(0b11001 + 0o37)))() xafqLlk3kkUe(VYUfp6Ou9W7x, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\x1a\x07\x95$'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(11940 - 11829) + chr(0b1100100) + chr(0b1100101))(chr(0b111111 + 0o66) + chr(116) + '\146' + '\x2d' + chr(56)))() nd0OX_BS6_o4 = oqhJDdMJfuwx.path.join(GDZi5OTNos9m.model_dir, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\x13\x0b\x89%\xab'), chr(0b1100100) + '\x65' + '\143' + chr(0b1101111) + chr(0b101110 + 0o66) + chr(5880 - 5779))('\x75' + chr(0b1100 + 0o150) + chr(0b111111 + 0o47) + chr(45) + chr(0b100010 + 0o26))) xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\x17\x03\x83\x05\xa7\xba\xd8'), chr(0b1100100) + chr(6044 - 5943) + chr(1680 - 1581) + chr(0b1101111) + chr(0b111 + 0o135) + '\145')(chr(4239 - 4122) + chr(116) + chr(0b1100110) + '\x2d' + chr(0b111000)))(nd0OX_BS6_o4) oJMfSdtl4_t2(gRTJLPEZwIMF(estimator=GDZi5OTNos9m, problem=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xec9_\x83p\x8f\x97\xe6{\xed\xb7R'), '\144' + '\x65' + chr(99) + '\x6f' + chr(0b100111 + 0o75) + chr(0b10110 + 0o117))('\x75' + '\164' + chr(6420 - 6318) + '\x2d' + chr(0b11 + 0o65))), output_dirs=[nd0OX_BS6_o4], hparams=n4ljua2gi1Pr, decode_hparams=dcaitvFqg9pp, predictions=YyaZ4tpXu4lf(VRSPKYG7TaoE)), None)
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_decode_filename
def _decode_filename(base_filename, problem_name, decode_hp): """Generates decode filename. Args: base_filename: A string, base of the decode filename. problem_name: A string, name of the problem. decode_hp: HParams for decoding. Returns: A string, produced decode filename. """ if decode_hp.shards > 1: base_filename = _add_shard_to_filename(base_filename, decode_hp) if ("beam{beam}.alpha{alpha}.decodes".format( beam=str(decode_hp.beam_size), alpha=str(decode_hp.alpha)) in base_filename): return base_filename else: return ( "{base}.{model}.{hp}.{problem}.beam{beam}.alpha{alpha}.decodes".format( base=base_filename, model=FLAGS.model, hp=FLAGS.hparams_set, problem=problem_name, beam=str(decode_hp.beam_size), alpha=str(decode_hp.alpha)))
python
def _decode_filename(base_filename, problem_name, decode_hp): """Generates decode filename. Args: base_filename: A string, base of the decode filename. problem_name: A string, name of the problem. decode_hp: HParams for decoding. Returns: A string, produced decode filename. """ if decode_hp.shards > 1: base_filename = _add_shard_to_filename(base_filename, decode_hp) if ("beam{beam}.alpha{alpha}.decodes".format( beam=str(decode_hp.beam_size), alpha=str(decode_hp.alpha)) in base_filename): return base_filename else: return ( "{base}.{model}.{hp}.{problem}.beam{beam}.alpha{alpha}.decodes".format( base=base_filename, model=FLAGS.model, hp=FLAGS.hparams_set, problem=problem_name, beam=str(decode_hp.beam_size), alpha=str(decode_hp.alpha)))
[ "def", "_decode_filename", "(", "base_filename", ",", "problem_name", ",", "decode_hp", ")", ":", "if", "decode_hp", ".", "shards", ">", "1", ":", "base_filename", "=", "_add_shard_to_filename", "(", "base_filename", ",", "decode_hp", ")", "if", "(", "\"beam{beam}.alpha{alpha}.decodes\"", ".", "format", "(", "beam", "=", "str", "(", "decode_hp", ".", "beam_size", ")", ",", "alpha", "=", "str", "(", "decode_hp", ".", "alpha", ")", ")", "in", "base_filename", ")", ":", "return", "base_filename", "else", ":", "return", "(", "\"{base}.{model}.{hp}.{problem}.beam{beam}.alpha{alpha}.decodes\"", ".", "format", "(", "base", "=", "base_filename", ",", "model", "=", "FLAGS", ".", "model", ",", "hp", "=", "FLAGS", ".", "hparams_set", ",", "problem", "=", "problem_name", ",", "beam", "=", "str", "(", "decode_hp", ".", "beam_size", ")", ",", "alpha", "=", "str", "(", "decode_hp", ".", "alpha", ")", ")", ")" ]
Generates decode filename. Args: base_filename: A string, base of the decode filename. problem_name: A string, name of the problem. decode_hp: HParams for decoding. Returns: A string, produced decode filename.
[ "Generates", "decode", "filename", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56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7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(50) + chr(0b1011 + 0o45), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(1862 - 1814) + '\x36', 4455 - 4447), ehT0Px3KOsy9('\060' + chr(111) + chr(912 - 863) + '\x37' + '\x34', 46489 - 46481), ehT0Px3KOsy9(chr(1999 - 1951) + chr(0b1101111) + '\063' + chr(50) + chr(49), 33354 - 33346), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(222 - 173) + '\x36', 48971 - 48963), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1110 + 0o46) + chr(2365 - 2311), 0o10), ehT0Px3KOsy9(chr(316 - 268) + '\x6f' + chr(2254 - 2203) + chr(1932 - 1882) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(10951 - 10840) + chr(49) + chr(51) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1055 - 944) + chr(2507 - 2454) + chr(0b11 + 0o64), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11101 + 0o25) + chr(0b110000) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(2921 - 2810) + chr(0b100110 + 0o15) + chr(0b100001 + 0o23) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(3186 - 3075) + chr(0b1101 + 0o46) + chr(0b110010) + chr(52), 11395 - 11387), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b110001) + chr(1678 - 1626), 0o10), ehT0Px3KOsy9(chr(815 - 767) + '\157' + chr(0b110100) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10101 + 0o35) + chr(0b110110) + '\061', 16129 - 16121), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(51) + '\060' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(265 - 217), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110010) + chr(1055 - 1007), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b11110 + 0o121) + '\062' + chr(0b101010 + 0o10) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1712 - 1663) + chr(0b100 + 0o61) + chr(0b101010 + 0o7), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + chr(0b110010) + chr(53) + chr(0b10010 + 0o36), 0o10), ehT0Px3KOsy9('\060' + chr(0b1010011 + 0o34) + chr(50) + '\065' + chr(0b10010 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b100101 + 0o17) + chr(54), 36094 - 36086), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101000 + 0o7) + chr(0b100011 + 0o21) + chr(0b110100), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(52) + chr(0b1111 + 0o43), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1614 - 1565) + chr(0b110110) + chr(0b100011 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4092 - 3981) + chr(0b110010) + chr(0b1001 + 0o51) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(1990 - 1936) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1693 - 1645) + chr(111) + '\062' + chr(55) + chr(0b110011), 54212 - 54204), ehT0Px3KOsy9('\x30' + chr(7166 - 7055) + chr(50) + '\067' + chr(2088 - 2036), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1111 + 0o44) + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x34' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b100001 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\063' + chr(0b11 + 0o64), 63215 - 63207), ehT0Px3KOsy9(chr(1454 - 1406) + chr(2200 - 2089) + chr(0b101101 + 0o6) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b110010) + chr(1373 - 1322), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b111 + 0o52) + '\067' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7511 - 7400) + chr(2271 - 2221) + chr(48) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1100 + 0o46) + '\x36' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(0b110010) + chr(0b11010 + 0o30) + '\x32', 65208 - 65200)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(9612 - 9501) + '\065' + chr(2102 - 2054), 51958 - 51950)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe'), chr(0b1100100) + chr(0b1001110 + 0o27) + '\x63' + '\157' + chr(0b10111 + 0o115) + chr(7485 - 7384))(chr(0b1110101) + chr(116) + '\146' + '\055' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def basVkyHhP3Xl(x_LzgrprY3GK, wezGpYDorAsK, dcaitvFqg9pp): if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3\xee\x1d\xa3jU'), chr(8210 - 8110) + chr(7958 - 7857) + chr(0b1100011) + chr(0b101011 + 0o104) + chr(0b1100100) + chr(5574 - 5473))(chr(117) + '\164' + '\146' + chr(85 - 40) + '\x38')) > ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + chr(65 - 16), 12062 - 12054): x_LzgrprY3GK = rhp5rbSIWIqB(x_LzgrprY3GK, dcaitvFqg9pp) if xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\xe3\x1d\xbcuD\xb79B\xfe\xcf\xb5\xa0T\xd9\xa2{1\xf8\x19\xc0\xca\x9b\n\xc6\x17\xf5\x1c\xdf\xd9m'), chr(1879 - 1779) + chr(8659 - 8558) + chr(0b1100011) + chr(111) + chr(3381 - 3281) + chr(101))(chr(9344 - 9227) + '\x74' + '\146' + chr(109 - 64) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6\xb2\x0e\xbeFG\x81k\x7f\xf3\x84\xbe'), '\144' + chr(5038 - 4937) + chr(99) + chr(0b101 + 0o152) + chr(0b100001 + 0o103) + chr(0b10011 + 0o122))('\x75' + chr(0b1001110 + 0o46) + chr(102) + chr(45) + chr(504 - 448)))(beam=M8_cKLkHVB2V(xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\xd7&\xbbJ^\xba1g\xc9\xa6\xb2'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + chr(2484 - 2384) + '\x65')('\165' + '\x74' + chr(0b1100110) + chr(636 - 591) + chr(0b111000)))), alpha=M8_cKLkHVB2V(xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf7\xc2)\x897Q\xe1mv\xcb\xa7\x91'), chr(100) + chr(0b1100010 + 0o3) + '\143' + chr(111) + chr(0b1100100) + chr(9992 - 9891))(chr(0b1001 + 0o154) + '\164' + '\146' + '\x2d' + '\070')))) in x_LzgrprY3GK: return x_LzgrprY3GK else: return xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\xe4\x1d\xa2k[\xfc#B\xec\x85\xb1\xa0Y\x9f\xb8h \xe9G\xd3\xdb\x94K\xc0\x1e\xf3\x1e\xc6\x92|\x86r\xf2a\xf1\x1b\xe3\xd8\xef\xbe\xe7\x10\xa1fG\xa99C\xf3\x89\xb5\xb1\n\xd5\xa6c?\xf0\x0c\xdb'), chr(100) + chr(0b1100101) + chr(99) + chr(8941 - 8830) + chr(0b110101 + 0o57) + chr(0b1110 + 0o127))(chr(0b111111 + 0o66) + '\164' + chr(102) + '\055' + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6\xb2\x0e\xbeFG\x81k\x7f\xf3\x84\xbe'), chr(100) + '\x65' + '\x63' + '\x6f' + '\x64' + chr(101))(chr(0b1010111 + 0o36) + '\164' + '\x66' + chr(0b100100 + 0o11) + '\070'))(base=x_LzgrprY3GK, model=xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6\xcdL\xa7\x7f\\\x88mH\xd3\xaf\xe2'), chr(4611 - 4511) + chr(1395 - 1294) + '\x63' + chr(904 - 793) + '\144' + '\x65')(chr(0b111011 + 0o72) + '\x74' + '\x66' + chr(0b100 + 0o51) + '\x38')), hp=xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\xf6\x1d\xa3oK\xa1\x07\\\xe6\x95'), '\x64' + chr(101) + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\x65')('\x75' + chr(0b1110100) + chr(0b1100110) + chr(0b100001 + 0o14) + chr(2425 - 2369))), problem=wezGpYDorAsK, beam=M8_cKLkHVB2V(xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\xd7&\xbbJ^\xba1g\xc9\xa6\xb2'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b1010110 + 0o31) + '\144' + chr(101))('\x75' + chr(3369 - 3253) + '\x66' + chr(45) + '\070'))), alpha=M8_cKLkHVB2V(xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf7\xc2)\x897Q\xe1mv\xcb\xa7\x91'), chr(0b1100100) + '\145' + chr(5548 - 5449) + chr(111) + '\x64' + chr(2484 - 2383))(chr(12728 - 12611) + chr(0b1110100) + '\146' + chr(1377 - 1332) + chr(56)))))
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
make_input_fn_from_generator
def make_input_fn_from_generator(gen): """Use py_func to yield elements from the given generator.""" first_ex = six.next(gen) flattened = tf.contrib.framework.nest.flatten(first_ex) types = [t.dtype for t in flattened] shapes = [[None] * len(t.shape) for t in flattened] first_ex_list = [first_ex] def py_func(): if first_ex_list: example = first_ex_list.pop() else: example = six.next(gen) return tf.contrib.framework.nest.flatten(example) def input_fn(): flat_example = tf.py_func(py_func, [], types) _ = [t.set_shape(shape) for t, shape in zip(flat_example, shapes)] example = tf.contrib.framework.nest.pack_sequence_as(first_ex, flat_example) return example return input_fn
python
def make_input_fn_from_generator(gen): """Use py_func to yield elements from the given generator.""" first_ex = six.next(gen) flattened = tf.contrib.framework.nest.flatten(first_ex) types = [t.dtype for t in flattened] shapes = [[None] * len(t.shape) for t in flattened] first_ex_list = [first_ex] def py_func(): if first_ex_list: example = first_ex_list.pop() else: example = six.next(gen) return tf.contrib.framework.nest.flatten(example) def input_fn(): flat_example = tf.py_func(py_func, [], types) _ = [t.set_shape(shape) for t, shape in zip(flat_example, shapes)] example = tf.contrib.framework.nest.pack_sequence_as(first_ex, flat_example) return example return input_fn
[ "def", "make_input_fn_from_generator", "(", "gen", ")", ":", "first_ex", "=", "six", ".", "next", "(", "gen", ")", "flattened", "=", "tf", ".", "contrib", ".", "framework", ".", "nest", ".", "flatten", "(", "first_ex", ")", "types", "=", "[", "t", ".", "dtype", "for", "t", "in", "flattened", "]", "shapes", "=", "[", "[", "None", "]", "*", "len", "(", "t", ".", "shape", ")", "for", "t", "in", "flattened", "]", "first_ex_list", "=", "[", "first_ex", "]", "def", "py_func", "(", ")", ":", "if", "first_ex_list", ":", "example", "=", "first_ex_list", ".", "pop", "(", ")", "else", ":", "example", "=", "six", ".", "next", "(", "gen", ")", "return", "tf", ".", "contrib", ".", "framework", ".", "nest", ".", "flatten", "(", "example", ")", "def", "input_fn", "(", ")", ":", "flat_example", "=", "tf", ".", "py_func", "(", "py_func", ",", "[", "]", ",", "types", ")", "_", "=", "[", "t", ".", "set_shape", "(", "shape", ")", "for", "t", ",", "shape", "in", "zip", "(", "flat_example", ",", "shapes", ")", "]", "example", "=", "tf", ".", "contrib", ".", "framework", ".", "nest", ".", "pack_sequence_as", "(", "first_ex", ",", "flat_example", ")", "return", "example", "return", "input_fn" ]
Use py_func to yield elements from the given generator.
[ "Use", "py_func", "to", "yield", "elements", "from", "the", "given", "generator", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L601-L622
train
Use py_func to yield elements from the given generator.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthd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Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(10857 - 10746) + chr(0b110010) + '\067' + chr(697 - 648), 34647 - 34639), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10100 + 0o40) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010000 + 0o37) + '\064' + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\061' + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101010 + 0o11) + chr(1106 - 1051) + chr(0b101 + 0o61), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\064' + chr(0b1111 + 0o46), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(496 - 448) + chr(1674 - 1621), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4911 - 4800) + '\x31' + chr(0b100010 + 0o21) + chr(0b110111), 45724 - 45716), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(0b101100 + 0o12) + chr(407 - 354), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(0b101000 + 0o12) + chr(48) + chr(1678 - 1626), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(0b110010) + chr(50) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110100) + chr(768 - 715), 5405 - 5397), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(986 - 935) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(0b101111 + 0o2) + chr(2107 - 2056) + chr(55), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b110100) + chr(54), 0o10), ehT0Px3KOsy9(chr(824 - 776) + '\157' + '\064', 0o10), ehT0Px3KOsy9(chr(1457 - 1409) + chr(0b1010000 + 0o37) + chr(0b10010 + 0o37) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(153 - 104) + chr(1986 - 1937) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b11001 + 0o30) + chr(0b110001) + chr(0b11110 + 0o31), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\062' + chr(54), 61030 - 61022), ehT0Px3KOsy9(chr(48) + chr(8639 - 8528) + chr(0b110100) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110110 + 0o71) + chr(1100 - 1049) + chr(50) + chr(991 - 941), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2254 - 2205) + '\x32' + chr(0b0 + 0o65), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7450 - 7339) + '\x32' + '\061' + '\060', 38442 - 38434), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1532 - 1481) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(54) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x36' + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(1373 - 1325) + chr(0b10101 + 0o132) + chr(760 - 710) + chr(0b110111) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + '\x37' + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b1001 + 0o56) + chr(219 - 171), 0b1000), ehT0Px3KOsy9(chr(1234 - 1186) + chr(111) + chr(49) + chr(1505 - 1454) + chr(0b101111 + 0o4), 27037 - 27029), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b110010) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + '\x32' + chr(302 - 248) + '\x34', 25331 - 25323), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b11010 + 0o26) + chr(49), 29086 - 29078), ehT0Px3KOsy9(chr(48) + chr(5761 - 5650) + chr(0b100011 + 0o16) + '\x33' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(262 - 214) + '\157' + chr(49) + chr(2366 - 2317) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(0b110011) + chr(1559 - 1509) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(9953 - 9842) + chr(51) + chr(49) + '\066', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x97'), chr(933 - 833) + chr(3889 - 3788) + '\143' + chr(7382 - 7271) + chr(0b11101 + 0o107) + '\145')('\165' + chr(9870 - 9754) + chr(0b1100110) + chr(45) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def pzsO3mHxucTJ(A3KGdOxgWpUn): eALfTIpZr8F5 = sYby0kpfssd4.nSwwHEeM4cxI(A3KGdOxgWpUn) p5MEUvPjpug9 = IDJ2eXGCBCDu.contrib.framework.nest.flatten(eALfTIpZr8F5) yorMPSC245Rr = [YeT3l7JgTbWR.jSV9IKnemH7K for YeT3l7JgTbWR in p5MEUvPjpug9] OVHEymXlQYjG = [[None] * c2A0yzQpDQB3(YeT3l7JgTbWR.nauYfLglTpcb) for YeT3l7JgTbWR in p5MEUvPjpug9] M09qlbYNKRLr = [eALfTIpZr8F5] def OgcDV75kE7Te(): if M09qlbYNKRLr: kP4qaKv0ZkGv = M09qlbYNKRLr.pop() else: kP4qaKv0ZkGv = sYby0kpfssd4.nSwwHEeM4cxI(A3KGdOxgWpUn) return xafqLlk3kkUe(IDJ2eXGCBCDu.contrib.framework.nest, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdfMF>\x8am\x0b'), chr(100) + '\145' + chr(0b1100011) + chr(7565 - 7454) + '\x64' + '\145')(chr(0b1110101) + chr(0b1001010 + 0o52) + '\146' + '\x2d' + chr(0b111000)))(kP4qaKv0ZkGv) def MVwQV4Upte2X(): CGDYeIH003YP = IDJ2eXGCBCDu.OgcDV75kE7Te(OgcDV75kE7Te, [], yorMPSC245Rr) VNGQdHSFPrso = [YeT3l7JgTbWR.set_shape(nauYfLglTpcb) for (YeT3l7JgTbWR, nauYfLglTpcb) in pZ0NK2y6HRbn(CGDYeIH003YP, OVHEymXlQYjG)] kP4qaKv0ZkGv = IDJ2eXGCBCDu.contrib.framework.nest.pack_sequence_as(eALfTIpZr8F5, CGDYeIH003YP) return kP4qaKv0ZkGv return MVwQV4Upte2X
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
decode_interactively
def decode_interactively(estimator, hparams, decode_hp, checkpoint_path=None): """Interactive decoding.""" is_image = "image" in hparams.problem.name is_text2class = isinstance(hparams.problem, text_problems.Text2ClassProblem) skip_eos_postprocess = ( is_image or is_text2class or decode_hp.skip_eos_postprocess) def input_fn(): gen_fn = make_input_fn_from_generator( _interactive_input_fn(hparams, decode_hp)) example = gen_fn() example = _interactive_input_tensor_to_features_dict(example, hparams) return example result_iter = estimator.predict(input_fn, checkpoint_path=checkpoint_path) for result in result_iter: targets_vocab = hparams.problem_hparams.vocabulary["targets"] if decode_hp.return_beams: beams = np.split(result["outputs"], decode_hp.beam_size, axis=0) scores = None if "scores" in result: if np.isscalar(result["scores"]): result["scores"] = result["scores"].reshape(1) scores = np.split(result["scores"], decode_hp.beam_size, axis=0) for k, beam in enumerate(beams): tf.logging.info("BEAM %d:" % k) beam_string = targets_vocab.decode(_save_until_eos( beam, skip_eos_postprocess)) if scores is not None: tf.logging.info("\"%s\"\tScore:%f" % (beam_string, scores[k])) else: tf.logging.info("\"%s\"" % beam_string) else: if decode_hp.identity_output: tf.logging.info(" ".join(map(str, result["outputs"].flatten()))) else: tf.logging.info( targets_vocab.decode(_save_until_eos( result["outputs"], skip_eos_postprocess)))
python
def decode_interactively(estimator, hparams, decode_hp, checkpoint_path=None): """Interactive decoding.""" is_image = "image" in hparams.problem.name is_text2class = isinstance(hparams.problem, text_problems.Text2ClassProblem) skip_eos_postprocess = ( is_image or is_text2class or decode_hp.skip_eos_postprocess) def input_fn(): gen_fn = make_input_fn_from_generator( _interactive_input_fn(hparams, decode_hp)) example = gen_fn() example = _interactive_input_tensor_to_features_dict(example, hparams) return example result_iter = estimator.predict(input_fn, checkpoint_path=checkpoint_path) for result in result_iter: targets_vocab = hparams.problem_hparams.vocabulary["targets"] if decode_hp.return_beams: beams = np.split(result["outputs"], decode_hp.beam_size, axis=0) scores = None if "scores" in result: if np.isscalar(result["scores"]): result["scores"] = result["scores"].reshape(1) scores = np.split(result["scores"], decode_hp.beam_size, axis=0) for k, beam in enumerate(beams): tf.logging.info("BEAM %d:" % k) beam_string = targets_vocab.decode(_save_until_eos( beam, skip_eos_postprocess)) if scores is not None: tf.logging.info("\"%s\"\tScore:%f" % (beam_string, scores[k])) else: tf.logging.info("\"%s\"" % beam_string) else: if decode_hp.identity_output: tf.logging.info(" ".join(map(str, result["outputs"].flatten()))) else: tf.logging.info( targets_vocab.decode(_save_until_eos( result["outputs"], skip_eos_postprocess)))
[ "def", "decode_interactively", "(", "estimator", ",", "hparams", ",", "decode_hp", ",", "checkpoint_path", "=", "None", ")", ":", "is_image", "=", "\"image\"", "in", "hparams", ".", "problem", ".", "name", "is_text2class", "=", "isinstance", "(", "hparams", ".", "problem", ",", "text_problems", ".", "Text2ClassProblem", ")", "skip_eos_postprocess", "=", "(", "is_image", "or", "is_text2class", "or", "decode_hp", ".", "skip_eos_postprocess", ")", "def", "input_fn", "(", ")", ":", "gen_fn", "=", "make_input_fn_from_generator", "(", "_interactive_input_fn", "(", "hparams", ",", "decode_hp", ")", ")", "example", "=", "gen_fn", "(", ")", "example", "=", "_interactive_input_tensor_to_features_dict", "(", "example", ",", "hparams", ")", "return", "example", "result_iter", "=", "estimator", ".", "predict", "(", "input_fn", ",", "checkpoint_path", "=", "checkpoint_path", ")", "for", "result", "in", "result_iter", ":", "targets_vocab", "=", "hparams", ".", "problem_hparams", ".", "vocabulary", "[", "\"targets\"", "]", "if", "decode_hp", ".", "return_beams", ":", "beams", "=", "np", ".", "split", "(", "result", "[", "\"outputs\"", "]", ",", "decode_hp", ".", "beam_size", ",", "axis", "=", "0", ")", "scores", "=", "None", "if", "\"scores\"", "in", "result", ":", "if", "np", ".", "isscalar", "(", "result", "[", "\"scores\"", "]", ")", ":", "result", "[", "\"scores\"", "]", "=", "result", "[", "\"scores\"", "]", ".", "reshape", "(", "1", ")", "scores", "=", "np", ".", "split", "(", "result", "[", "\"scores\"", "]", ",", "decode_hp", ".", "beam_size", ",", "axis", "=", "0", ")", "for", "k", ",", "beam", "in", "enumerate", "(", "beams", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"BEAM %d:\"", "%", "k", ")", "beam_string", "=", "targets_vocab", ".", "decode", "(", "_save_until_eos", "(", "beam", ",", "skip_eos_postprocess", ")", ")", "if", "scores", "is", "not", "None", ":", "tf", ".", "logging", ".", "info", "(", "\"\\\"%s\\\"\\tScore:%f\"", "%", "(", "beam_string", ",", "scores", "[", "k", "]", ")", ")", "else", ":", "tf", ".", "logging", ".", "info", "(", "\"\\\"%s\\\"\"", "%", "beam_string", ")", "else", ":", "if", "decode_hp", ".", "identity_output", ":", "tf", ".", "logging", ".", "info", "(", "\" \"", ".", "join", "(", "map", "(", "str", ",", "result", "[", "\"outputs\"", "]", ".", "flatten", "(", ")", ")", ")", ")", "else", ":", "tf", ".", "logging", ".", "info", "(", "targets_vocab", ".", "decode", "(", "_save_until_eos", "(", "result", "[", "\"outputs\"", "]", ",", "skip_eos_postprocess", ")", ")", ")" ]
Interactive decoding.
[ "Interactive", "decoding", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L625-L666
train
Interactive decoding.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce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ThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\062' + chr(0b101001 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\x35' + chr(406 - 358), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b100100 + 0o113) + '\x31' + chr(0b110110) + chr(53), 16502 - 16494), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(0b110111) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101001 + 0o14) + chr(48), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(48) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b100001 + 0o22) + chr(0b110110) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(48) + chr(2057 - 2002), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(52) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(51) + chr(1430 - 1378), 13827 - 13819), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(9849 - 9738) + '\x33' + '\x35' + chr(0b110011), 15112 - 15104), ehT0Px3KOsy9('\060' + chr(10981 - 10870) + chr(49) + chr(0b1 + 0o57) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(9830 - 9719) + chr(0b10001 + 0o41) + '\x32', 0o10), ehT0Px3KOsy9(chr(1923 - 1875) + chr(7898 - 7787) + chr(49) + chr(0b1100 + 0o46) + chr(0b11111 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(374 - 263) + chr(49) + '\x36' + chr(0b1010 + 0o46), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(55) + chr(0b110111), 57332 - 57324), ehT0Px3KOsy9('\x30' + chr(0b1011100 + 0o23) + '\062' + '\064' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + '\061' + chr(1857 - 1806) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(10272 - 10161) + chr(590 - 540) + '\065' + chr(0b100110 + 0o17), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(427 - 376) + chr(1519 - 1467) + chr(2254 - 2201), 35373 - 35365), ehT0Px3KOsy9(chr(206 - 158) + '\x6f' + chr(990 - 940) + chr(54) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(11410 - 11299) + chr(0b10100 + 0o40) + chr(2248 - 2199), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9741 - 9630) + chr(50) + chr(0b10101 + 0o36) + chr(762 - 711), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b1111 + 0o44) + chr(0b110011) + chr(0b101000 + 0o14), 58762 - 58754), ehT0Px3KOsy9('\060' + chr(0b1010011 + 0o34) + chr(0b110001) + chr(0b10 + 0o60) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(1338 - 1288) + '\064' + chr(0b101 + 0o56), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + '\x31' + chr(0b110000) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11299 - 11188) + '\061' + chr(0b110000) + chr(0b100001 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(1415 - 1367) + '\157' + chr(2910 - 2856) + chr(0b11 + 0o62), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11111 + 0o23) + '\x37' + chr(1174 - 1124), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\x34' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + '\063' + '\065' + chr(0b110000 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(1408 - 1360) + chr(0b1101111) + '\063' + '\064' + '\063', 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(0b10111 + 0o32) + chr(0b100011 + 0o15) + chr(0b1011 + 0o52), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(54), 0o10), ehT0Px3KOsy9(chr(399 - 351) + chr(0b101110 + 0o101) + chr(0b101010 + 0o11) + chr(0b11001 + 0o32) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b10101 + 0o42) + chr(0b1110 + 0o50), 30453 - 30445), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(1803 - 1753) + '\067' + chr(0b100000 + 0o24), 28680 - 28672), ehT0Px3KOsy9(chr(869 - 821) + chr(0b110101 + 0o72) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + '\067' + chr(0b110111), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(7606 - 7495) + chr(2298 - 2245) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'~'), chr(0b1100100) + chr(7680 - 7579) + chr(0b110111 + 0o54) + '\x6f' + '\144' + '\x65')(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(0b100100 + 0o11) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def yiV9zbZgnqr6(GDZi5OTNos9m, n4ljua2gi1Pr, dcaitvFqg9pp, lbKq88EBpYWb=None): ENdldzEw6maI = xafqLlk3kkUe(SXOLrMavuUCe(b'9E\x14YM'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(588 - 477) + chr(0b110110 + 0o56) + '\x65')(chr(6966 - 6849) + chr(0b1100001 + 0o23) + chr(0b100001 + 0o105) + chr(838 - 793) + chr(2207 - 2151)) in n4ljua2gi1Pr.problem.AIvJRzLdDfgF XzvxSNl3m3eQ = PlSM16l2KDPD(n4ljua2gi1Pr.sO7e1A_Mor6Q, GkH56QMxhclz.Text2ClassProblem) KcP8yjEFaiUr = ENdldzEw6maI or XzvxSNl3m3eQ or dcaitvFqg9pp.skip_eos_postprocess def MVwQV4Upte2X(): R6_MYqV8djOL = pzsO3mHxucTJ(wu0iCC_L8XKz(n4ljua2gi1Pr, dcaitvFqg9pp)) kP4qaKv0ZkGv = R6_MYqV8djOL() kP4qaKv0ZkGv = hRM6qOp6s9pL(kP4qaKv0ZkGv, n4ljua2gi1Pr) return kP4qaKv0ZkGv VRSPKYG7TaoE = GDZi5OTNos9m.POyImYQwg5VB(MVwQV4Upte2X, checkpoint_path=lbKq88EBpYWb) for ShZmEKfTkAOZ in VRSPKYG7TaoE: GpnyPjDizdlO = n4ljua2gi1Pr.problem_hparams.Vemi1XCgm0ph[xafqLlk3kkUe(SXOLrMavuUCe(b'$I\x07YM\xf1\x84'), '\x64' + chr(4887 - 4786) + '\143' + '\157' + chr(0b1010111 + 0o15) + '\x65')('\x75' + chr(0b1110100) + chr(0b1100110) + chr(1018 - 973) + chr(56))] if xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'"M\x01KZ\xeb\xa8\xa5E=\x860'), chr(0b1010111 + 0o15) + chr(101) + chr(0b11101 + 0o106) + chr(10636 - 10525) + chr(0b10001 + 0o123) + chr(0b11010 + 0o113))('\165' + chr(11153 - 11037) + chr(102) + chr(0b11001 + 0o24) + '\x38')): QGiqnHqpgLrD = WqUC3KWvYVup.split(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'?]\x01N]\xf1\x84'), chr(0b1100100) + chr(9895 - 9794) + chr(0b1100011) + chr(0b1101111) + chr(100) + '\x65')(chr(117) + chr(0b1110100) + chr(102) + chr(0b101100 + 0o1) + '\x38')], dcaitvFqg9pp.PQZjDxhiHJGf, axis=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(642 - 594), 0o10)) b8rpGniBNUPr = None if xafqLlk3kkUe(SXOLrMavuUCe(b'#K\x1aLM\xf6'), '\144' + chr(0b1100101) + chr(857 - 758) + '\157' + '\144' + chr(0b1001011 + 0o32))(chr(117) + '\x74' + chr(0b1100110) + '\055' + '\070') in ShZmEKfTkAOZ: if xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'9[\x06]I\xe9\x96\xb5'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(111) + chr(0b1010 + 0o132) + chr(0b1011110 + 0o7))('\165' + '\x74' + chr(0b1 + 0o145) + '\x2d' + chr(56)))(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'#K\x1aLM\xf6'), '\x64' + '\x65' + '\x63' + '\157' + chr(0b1100100) + chr(101))(chr(117) + chr(116) + '\146' + chr(0b101101) + '\070')]): ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'#K\x1aLM\xf6'), chr(0b1010001 + 0o23) + '\x65' + chr(99) + chr(8435 - 8324) + chr(2984 - 2884) + '\145')(chr(0b101111 + 0o106) + chr(116) + '\146' + '\055' + '\070')] = ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'#K\x1aLM\xf6'), chr(2802 - 2702) + chr(0b1 + 0o144) + chr(99) + chr(0b1101111) + chr(0b111101 + 0o47) + chr(0b110011 + 0o62))(chr(117) + chr(1303 - 1187) + chr(0b100101 + 0o101) + '\x2d' + chr(56))].reshape(ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 0o10)) b8rpGniBNUPr = WqUC3KWvYVup.split(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'#K\x1aLM\xf6'), chr(0b1011111 + 0o5) + chr(0b1100101) + chr(8056 - 7957) + chr(111) + '\x64' + chr(9579 - 9478))('\165' + '\x74' + chr(102) + '\x2d' + chr(56))], dcaitvFqg9pp.PQZjDxhiHJGf, axis=ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x30', 8)) for (OolUPRJhRaJd, g37JLGi8ajKb) in YlkZvXL8qwsX(QGiqnHqpgLrD): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x1f=F]\xe6\x90\xf0J0\xb1('), chr(1053 - 953) + chr(101) + '\143' + '\x6f' + chr(5917 - 5817) + chr(101))(chr(0b1110101) + chr(0b1110100) + '\x66' + '\x2d' + chr(2167 - 2111)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x12m4s\x08\xa0\x93\xfd'), chr(0b1100100) + chr(101) + '\x63' + chr(0b1100 + 0o143) + chr(1028 - 928) + chr(0b1100 + 0o131))(chr(0b10 + 0o163) + chr(116) + chr(102) + '\055' + '\070') % OolUPRJhRaJd) jSkGYxFfqxQQ = GpnyPjDizdlO.decode(M0l7BzX3KemY(g37JLGi8ajKb, KcP8yjEFaiUr)) if b8rpGniBNUPr is not None: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x1f=F]\xe6\x90\xf0J0\xb1('), '\144' + '\x65' + chr(99) + '\157' + '\x64' + chr(0b1100101))(chr(117) + chr(116) + '\146' + chr(45) + chr(2301 - 2245)))(xafqLlk3kkUe(SXOLrMavuUCe(b'r\r\x06\x1c!\xd6\x94\xa8R9\xd1ft'), chr(0b1100100) + chr(101) + chr(0b110111 + 0o54) + chr(111) + chr(0b1100100) + '\145')(chr(7858 - 7741) + '\164' + chr(0b111010 + 0o54) + chr(0b11110 + 0o17) + '\x38') % (jSkGYxFfqxQQ, b8rpGniBNUPr[OolUPRJhRaJd])) else: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x1f=F]\xe6\x90\xf0J0\xb1('), chr(0b1100100) + chr(0b11101 + 0o110) + chr(0b1100011) + chr(111) + chr(100) + '\x65')(chr(0b100100 + 0o121) + chr(116) + chr(121 - 19) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'r\r\x06\x1c'), '\144' + chr(0b1100101) + chr(99) + chr(0b1011001 + 0o26) + chr(100) + chr(0b1010101 + 0o20))('\x75' + '\164' + chr(0b101001 + 0o75) + chr(45) + '\x38') % jSkGYxFfqxQQ) elif xafqLlk3kkUe(dcaitvFqg9pp, xafqLlk3kkUe(SXOLrMavuUCe(b'9L\x10P\\\xec\x83\xbe\x7f3\x9e7b&\x04'), chr(329 - 229) + '\145' + chr(99) + '\x6f' + chr(0b1100100) + chr(0b110001 + 0o64))(chr(0b1110101) + '\164' + chr(0b1100110) + '\055' + chr(0b101010 + 0o16))): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x1f=F]\xe6\x90\xf0J0\xb1('), chr(100) + chr(9698 - 9597) + chr(0b1100011) + chr(0b101001 + 0o106) + chr(9243 - 9143) + '\x65')(chr(0b101001 + 0o114) + chr(5221 - 5105) + chr(0b1100110) + '\x2d' + chr(0b111000)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'p'), chr(0b1100100) + chr(0b1010101 + 0o20) + '\143' + chr(0b10100 + 0o133) + chr(100) + chr(9763 - 9662))(chr(4127 - 4010) + chr(116) + chr(0b1100110) + '\055' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b':G\x1cP'), '\x64' + '\x65' + chr(7658 - 7559) + chr(2007 - 1896) + chr(0b1100100) + '\145')('\165' + '\x74' + '\x66' + chr(45) + '\070'))(abA97kOQKaLo(M8_cKLkHVB2V, xafqLlk3kkUe(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'?]\x01N]\xf1\x84'), chr(0b1100100) + chr(0b1000001 + 0o44) + chr(99) + '\x6f' + '\144' + '\x65')('\x75' + chr(1950 - 1834) + '\146' + chr(45) + chr(0b111000))], xafqLlk3kkUe(SXOLrMavuUCe(b'6D\x14J\\\xe0\x99'), chr(0b1100100) + chr(0b110100 + 0o61) + chr(0b1000111 + 0o34) + '\x6f' + chr(7118 - 7018) + '\145')('\165' + '\164' + chr(0b100001 + 0o105) + chr(567 - 522) + chr(2731 - 2675)))()))) else: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x1f=F]\xe6\x90\xf0J0\xb1('), '\x64' + '\145' + chr(99) + '\157' + chr(100) + '\x65')(chr(6058 - 5941) + '\164' + '\146' + '\x2d' + chr(2332 - 2276)))(xafqLlk3kkUe(GpnyPjDizdlO, '\144' + chr(101) + '\x63' + chr(111) + '\x64' + chr(0b1100101))(M0l7BzX3KemY(ShZmEKfTkAOZ[xafqLlk3kkUe(SXOLrMavuUCe(b'?]\x01N]\xf1\x84'), chr(3078 - 2978) + chr(0b1100101) + '\143' + '\157' + '\x64' + '\x65')(chr(2498 - 2381) + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(0b111000))], KcP8yjEFaiUr)))
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_decode_batch_input_fn
def _decode_batch_input_fn(num_decode_batches, sorted_inputs, vocabulary, batch_size, max_input_size, task_id=-1, has_input=True): """Generator to produce batches of inputs.""" tf.logging.info(" batch %d" % num_decode_batches) for b in range(num_decode_batches): tf.logging.info("Decoding batch %d" % b) batch_length = 0 batch_inputs = [] for inputs in sorted_inputs[b * batch_size:(b + 1) * batch_size]: input_ids = vocabulary.encode(inputs) if max_input_size > 0: # Subtract 1 for the EOS_ID. input_ids = input_ids[:max_input_size - 1] if has_input or task_id > -1: # Do not append EOS for pure LM tasks. final_id = text_encoder.EOS_ID if task_id < 0 else task_id input_ids.append(final_id) batch_inputs.append(input_ids) if len(input_ids) > batch_length: batch_length = len(input_ids) final_batch_inputs = [] for input_ids in batch_inputs: assert len(input_ids) <= batch_length x = input_ids + [0] * (batch_length - len(input_ids)) final_batch_inputs.append(x) yield { "inputs": np.array(final_batch_inputs).astype(np.int32), }
python
def _decode_batch_input_fn(num_decode_batches, sorted_inputs, vocabulary, batch_size, max_input_size, task_id=-1, has_input=True): """Generator to produce batches of inputs.""" tf.logging.info(" batch %d" % num_decode_batches) for b in range(num_decode_batches): tf.logging.info("Decoding batch %d" % b) batch_length = 0 batch_inputs = [] for inputs in sorted_inputs[b * batch_size:(b + 1) * batch_size]: input_ids = vocabulary.encode(inputs) if max_input_size > 0: # Subtract 1 for the EOS_ID. input_ids = input_ids[:max_input_size - 1] if has_input or task_id > -1: # Do not append EOS for pure LM tasks. final_id = text_encoder.EOS_ID if task_id < 0 else task_id input_ids.append(final_id) batch_inputs.append(input_ids) if len(input_ids) > batch_length: batch_length = len(input_ids) final_batch_inputs = [] for input_ids in batch_inputs: assert len(input_ids) <= batch_length x = input_ids + [0] * (batch_length - len(input_ids)) final_batch_inputs.append(x) yield { "inputs": np.array(final_batch_inputs).astype(np.int32), }
[ "def", "_decode_batch_input_fn", "(", "num_decode_batches", ",", "sorted_inputs", ",", "vocabulary", ",", "batch_size", ",", "max_input_size", ",", "task_id", "=", "-", "1", ",", "has_input", "=", "True", ")", ":", "tf", ".", "logging", ".", "info", "(", "\" batch %d\"", "%", "num_decode_batches", ")", "for", "b", "in", "range", "(", "num_decode_batches", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"Decoding batch %d\"", "%", "b", ")", "batch_length", "=", "0", "batch_inputs", "=", "[", "]", "for", "inputs", "in", "sorted_inputs", "[", "b", "*", "batch_size", ":", "(", "b", "+", "1", ")", "*", "batch_size", "]", ":", "input_ids", "=", "vocabulary", ".", "encode", "(", "inputs", ")", "if", "max_input_size", ">", "0", ":", "# Subtract 1 for the EOS_ID.", "input_ids", "=", "input_ids", "[", ":", "max_input_size", "-", "1", "]", "if", "has_input", "or", "task_id", ">", "-", "1", ":", "# Do not append EOS for pure LM tasks.", "final_id", "=", "text_encoder", ".", "EOS_ID", "if", "task_id", "<", "0", "else", "task_id", "input_ids", ".", "append", "(", "final_id", ")", "batch_inputs", ".", "append", "(", "input_ids", ")", "if", "len", "(", "input_ids", ")", ">", "batch_length", ":", "batch_length", "=", "len", "(", "input_ids", ")", "final_batch_inputs", "=", "[", "]", "for", "input_ids", "in", "batch_inputs", ":", "assert", "len", "(", "input_ids", ")", "<=", "batch_length", "x", "=", "input_ids", "+", "[", "0", "]", "*", "(", "batch_length", "-", "len", "(", "input_ids", ")", ")", "final_batch_inputs", ".", "append", "(", "x", ")", "yield", "{", "\"inputs\"", ":", "np", ".", "array", "(", "final_batch_inputs", ")", ".", "astype", "(", "np", ".", "int32", ")", ",", "}" ]
Generator to produce batches of inputs.
[ "Generator", "to", "produce", "batches", "of", "inputs", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L669-L697
train
Generator to produce batches of inputs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sg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u2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10000 + 0o43) + chr(0b110110) + chr(0b10010 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(614 - 562), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b10101 + 0o41) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(643 - 592) + '\x31' + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(2511 - 2400) + '\061' + '\x37' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100111 + 0o10) + chr(2048 - 1994) + chr(0b110010), 16803 - 16795), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + '\x34' + '\x34', 41044 - 41036), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(982 - 927) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(2208 - 2160) + chr(0b1101111) + chr(51) + chr(1572 - 1521) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1314 - 1259), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(8035 - 7924) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b10 + 0o57) + chr(0b1010 + 0o46), 8), ehT0Px3KOsy9(chr(1465 - 1417) + '\x6f' + '\063' + chr(49) + chr(0b10101 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(2237 - 2189) + chr(3886 - 3775) + '\061' + '\x30' + '\x37', 18921 - 18913), ehT0Px3KOsy9(chr(1100 - 1052) + chr(111) + chr(50) + chr(0b110110 + 0o1) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100110 + 0o13) + '\x30' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(9745 - 9634) + chr(0b100100 + 0o17) + chr(0b100000 + 0o27) + chr(48), 29325 - 29317), ehT0Px3KOsy9(chr(998 - 950) + chr(0b1010101 + 0o32) + chr(1653 - 1603) + chr(2171 - 2121) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\066' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + '\062' + chr(553 - 504) + chr(0b101101 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\060' + chr(2049 - 1994), 55812 - 55804), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(1164 - 1115) + '\x34' + chr(0b101010 + 0o12), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + '\x32' + chr(0b100010 + 0o21) + chr(0b100 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(0b110010) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(54) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\067' + '\x36', 8), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(51) + chr(199 - 148), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11 + 0o56) + '\x35' + '\060', 0o10), ehT0Px3KOsy9(chr(1730 - 1682) + '\x6f' + '\061' + chr(892 - 841) + chr(0b100110 + 0o14), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(1059 - 1007) + chr(0b100010 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(1232 - 1184) + '\157' + '\x31' + '\061' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2401 - 2350) + chr(0b110110 + 0o0) + chr(2437 - 2382), 0o10), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + chr(53) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(773 - 721) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b100100 + 0o15) + '\062', 8), ehT0Px3KOsy9(chr(1259 - 1211) + '\157' + chr(51) + chr(52) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(2036 - 1985) + chr(49) + '\060', 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(885 - 835) + chr(0b101000 + 0o12) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(2797 - 2686) + '\x34' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\064' + chr(0b1001 + 0o52), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b1100 + 0o51) + chr(48), 5710 - 5702)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf'), '\x64' + chr(0b1100101) + '\143' + chr(111) + chr(3294 - 3194) + chr(0b111 + 0o136))('\x75' + chr(116) + chr(102) + chr(83 - 38) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def XOn01vg4Zdkm(LItBGdTUwtJq, RA19AwBpedWr, Vemi1XCgm0ph, ix9dZyeAmUxY, _CrRh_E4Qt3a, h_MwKIdeQ6Ce=-ehT0Px3KOsy9(chr(1736 - 1688) + chr(9041 - 8930) + '\061', 33620 - 33612), pfhXZufo40AS=ehT0Px3KOsy9(chr(0b110000) + chr(356 - 245) + '\x31', 8)): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa2+\xfd\xb0\x0fQC\xcd\xb6kY\xa3'), '\x64' + '\x65' + chr(7987 - 7888) + chr(0b101011 + 0o104) + chr(0b101010 + 0o72) + chr(0b100100 + 0o101))(chr(0b111000 + 0o75) + chr(3797 - 3681) + '\x66' + chr(0b101101) + chr(1886 - 1830)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd1~\xd4\xbc\x19Z\x04\xdf\xb8'), chr(100) + '\145' + chr(0b101001 + 0o72) + chr(0b10 + 0o155) + '\144' + chr(0b1010010 + 0o23))('\165' + chr(0b1110100) + chr(0b1010000 + 0o26) + chr(2017 - 1972) + '\x38') % LItBGdTUwtJq) for wmN3dvez4qzC in vQr8gNKaIaWE(LItBGdTUwtJq): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa2+\xfd\xb0\x0fQC\xcd\xb6kY\xa3'), '\x64' + chr(0b1001100 + 0o31) + chr(0b1100011) + chr(0b1101111) + chr(0b1011110 + 0o6) + chr(101))(chr(0b111000 + 0o75) + '\164' + chr(7322 - 7220) + chr(595 - 550) + chr(2437 - 2381)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5y\xd6\xa7\x1e[J\x9d\xfceb\xbc\xa9/\x9e`\x9c'), '\x64' + chr(0b11011 + 0o112) + '\143' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(5138 - 5021) + '\x74' + chr(0b110111 + 0o57) + chr(0b100001 + 0o14) + chr(937 - 881)) % wmN3dvez4qzC) pO5UVV3EWNfa = ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + chr(0b110000), 0o10) eODVD1XFDCfc = [] for vXoupepMtCXU in RA19AwBpedWr[wmN3dvez4qzC * ix9dZyeAmUxY:(wmN3dvez4qzC + ehT0Px3KOsy9(chr(2165 - 2117) + chr(0b1101111) + '\x31', 8)) * ix9dZyeAmUxY]: CyiZkgWrlgA9 = Vemi1XCgm0ph.encode(vXoupepMtCXU) if _CrRh_E4Qt3a > ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + '\x30', 8): CyiZkgWrlgA9 = CyiZkgWrlgA9[:_CrRh_E4Qt3a - ehT0Px3KOsy9('\x30' + '\157' + chr(2092 - 2043), 8)] if pfhXZufo40AS or h_MwKIdeQ6Ce > -ehT0Px3KOsy9(chr(0b110000) + chr(1424 - 1313) + '\061', 8): mqZ8JMgpIR2e = nCRDzZ_Is9fz.EOS_ID if h_MwKIdeQ6Ce < ehT0Px3KOsy9(chr(1616 - 1568) + chr(0b1101111) + chr(0b101001 + 0o7), 8) else h_MwKIdeQ6Ce xafqLlk3kkUe(CyiZkgWrlgA9, xafqLlk3kkUe(SXOLrMavuUCe(b'\x90l\xc5\xad\x14V'), chr(0b1100100) + chr(0b10 + 0o143) + '\143' + chr(10801 - 10690) + chr(0b1100100) + chr(101))(chr(117) + chr(0b1110100) + chr(0b1000100 + 0o42) + chr(0b1000 + 0o45) + '\x38'))(mqZ8JMgpIR2e) xafqLlk3kkUe(eODVD1XFDCfc, xafqLlk3kkUe(SXOLrMavuUCe(b'\x90l\xc5\xad\x14V'), '\144' + chr(8325 - 8224) + chr(4122 - 4023) + chr(111) + '\x64' + chr(1271 - 1170))(chr(117) + chr(0b1001010 + 0o52) + chr(175 - 73) + '\x2d' + chr(0b11110 + 0o32)))(CyiZkgWrlgA9) if c2A0yzQpDQB3(CyiZkgWrlgA9) > pO5UVV3EWNfa: pO5UVV3EWNfa = c2A0yzQpDQB3(CyiZkgWrlgA9) Lj5icfl6nAXn = [] for CyiZkgWrlgA9 in eODVD1XFDCfc: assert c2A0yzQpDQB3(CyiZkgWrlgA9) <= pO5UVV3EWNfa OeWW0F1dBPRQ = CyiZkgWrlgA9 + [ehT0Px3KOsy9(chr(1986 - 1938) + chr(0b1001011 + 0o44) + '\x30', 8)] * (pO5UVV3EWNfa - c2A0yzQpDQB3(CyiZkgWrlgA9)) xafqLlk3kkUe(Lj5icfl6nAXn, xafqLlk3kkUe(SXOLrMavuUCe(b'\x90l\xc5\xad\x14V'), chr(0b101110 + 0o66) + chr(8285 - 8184) + chr(99) + chr(0b100010 + 0o115) + '\144' + chr(0b101011 + 0o72))('\165' + '\164' + chr(0b1100110) + '\x2d' + '\x38'))(OeWW0F1dBPRQ) yield {xafqLlk3kkUe(SXOLrMavuUCe(b'\x98r\xc5\xbd\x0eA'), chr(0b10 + 0o142) + chr(101) + chr(0b1011111 + 0o4) + '\x6f' + '\x64' + chr(101))(chr(10662 - 10545) + '\x74' + '\x66' + '\055' + chr(0b11001 + 0o37)): xafqLlk3kkUe(WqUC3KWvYVup.array(Lj5icfl6nAXn), xafqLlk3kkUe(SXOLrMavuUCe(b'\x90o\xc1\xb1\nW'), chr(0b1100100) + chr(7101 - 7000) + chr(0b1000011 + 0o40) + chr(0b1000 + 0o147) + chr(100) + chr(2225 - 2124))(chr(0b1110101) + chr(0b1011000 + 0o34) + chr(0b1100110) + '\055' + chr(0b10 + 0o66)))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x98r\xc1\xfbH'), chr(100) + chr(101) + '\143' + chr(0b1101111) + '\x64' + chr(101))('\x75' + chr(0b1101111 + 0o5) + '\x66' + chr(1748 - 1703) + chr(2987 - 2931))))}
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_interactive_input_fn
def _interactive_input_fn(hparams, decode_hp): """Generator that reads from the terminal and yields "interactive inputs". Due to temporary limitations in tf.learn, if we don't want to reload the whole graph, then we are stuck encoding all of the input as one fixed-size numpy array. We yield int32 arrays with shape [const_array_size]. The format is: [num_samples, decode_length, len(input ids), <input ids>, <padding>] Args: hparams: model hparams decode_hp: decode hparams Yields: numpy arrays Raises: Exception: when `input_type` is invalid. """ num_samples = decode_hp.num_samples if decode_hp.num_samples > 0 else 1 decode_length = decode_hp.extra_length input_type = "text" p_hparams = hparams.problem_hparams has_input = "inputs" in p_hparams.modality vocabulary = p_hparams.vocabulary["inputs" if has_input else "targets"] # This should be longer than the longest input. const_array_size = 10000 # Import readline if available for command line editing and recall. try: import readline # pylint: disable=g-import-not-at-top,unused-variable except ImportError: pass while True: prompt = ("INTERACTIVE MODE num_samples=%d decode_length=%d \n" " it=<input_type> ('text' or 'image' or 'label', default: " "text)\n" " ns=<num_samples> (changes number of samples, default: 1)\n" " dl=<decode_length> (changes decode length, default: 100)\n" " <%s> (decode)\n" " q (quit)\n" ">" % (num_samples, decode_length, "source_string" if has_input else "target_prefix")) input_string = input(prompt) if input_string == "q": return elif input_string[:3] == "ns=": num_samples = int(input_string[3:]) elif input_string[:3] == "dl=": decode_length = int(input_string[3:]) elif input_string[:3] == "it=": input_type = input_string[3:] else: if input_type == "text": input_ids = vocabulary.encode(input_string) if has_input: input_ids.append(text_encoder.EOS_ID) x = [num_samples, decode_length, len(input_ids)] + input_ids assert len(x) < const_array_size x += [0] * (const_array_size - len(x)) features = { "inputs": np.array(x).astype(np.int32), } elif input_type == "image": input_path = input_string img = vocabulary.encode(input_path) features = { "inputs": img.astype(np.int32), } elif input_type == "label": input_ids = [int(input_string)] x = [num_samples, decode_length, len(input_ids)] + input_ids features = { "inputs": np.array(x).astype(np.int32), } else: raise Exception("Unsupported input type.") for k, v in six.iteritems( problem_lib.problem_hparams_to_features(p_hparams)): features[k] = np.array(v).astype(np.int32) yield features
python
def _interactive_input_fn(hparams, decode_hp): """Generator that reads from the terminal and yields "interactive inputs". Due to temporary limitations in tf.learn, if we don't want to reload the whole graph, then we are stuck encoding all of the input as one fixed-size numpy array. We yield int32 arrays with shape [const_array_size]. The format is: [num_samples, decode_length, len(input ids), <input ids>, <padding>] Args: hparams: model hparams decode_hp: decode hparams Yields: numpy arrays Raises: Exception: when `input_type` is invalid. """ num_samples = decode_hp.num_samples if decode_hp.num_samples > 0 else 1 decode_length = decode_hp.extra_length input_type = "text" p_hparams = hparams.problem_hparams has_input = "inputs" in p_hparams.modality vocabulary = p_hparams.vocabulary["inputs" if has_input else "targets"] # This should be longer than the longest input. const_array_size = 10000 # Import readline if available for command line editing and recall. try: import readline # pylint: disable=g-import-not-at-top,unused-variable except ImportError: pass while True: prompt = ("INTERACTIVE MODE num_samples=%d decode_length=%d \n" " it=<input_type> ('text' or 'image' or 'label', default: " "text)\n" " ns=<num_samples> (changes number of samples, default: 1)\n" " dl=<decode_length> (changes decode length, default: 100)\n" " <%s> (decode)\n" " q (quit)\n" ">" % (num_samples, decode_length, "source_string" if has_input else "target_prefix")) input_string = input(prompt) if input_string == "q": return elif input_string[:3] == "ns=": num_samples = int(input_string[3:]) elif input_string[:3] == "dl=": decode_length = int(input_string[3:]) elif input_string[:3] == "it=": input_type = input_string[3:] else: if input_type == "text": input_ids = vocabulary.encode(input_string) if has_input: input_ids.append(text_encoder.EOS_ID) x = [num_samples, decode_length, len(input_ids)] + input_ids assert len(x) < const_array_size x += [0] * (const_array_size - len(x)) features = { "inputs": np.array(x).astype(np.int32), } elif input_type == "image": input_path = input_string img = vocabulary.encode(input_path) features = { "inputs": img.astype(np.int32), } elif input_type == "label": input_ids = [int(input_string)] x = [num_samples, decode_length, len(input_ids)] + input_ids features = { "inputs": np.array(x).astype(np.int32), } else: raise Exception("Unsupported input type.") for k, v in six.iteritems( problem_lib.problem_hparams_to_features(p_hparams)): features[k] = np.array(v).astype(np.int32) yield features
[ "def", "_interactive_input_fn", "(", "hparams", ",", "decode_hp", ")", ":", "num_samples", "=", "decode_hp", ".", "num_samples", "if", "decode_hp", ".", "num_samples", ">", "0", "else", "1", "decode_length", "=", "decode_hp", ".", "extra_length", "input_type", "=", "\"text\"", "p_hparams", "=", "hparams", ".", "problem_hparams", "has_input", "=", "\"inputs\"", "in", "p_hparams", ".", "modality", "vocabulary", "=", "p_hparams", ".", "vocabulary", "[", "\"inputs\"", "if", "has_input", "else", "\"targets\"", "]", "# This should be longer than the longest input.", "const_array_size", "=", "10000", "# Import readline if available for command line editing and recall.", "try", ":", "import", "readline", "# pylint: disable=g-import-not-at-top,unused-variable", "except", "ImportError", ":", "pass", "while", "True", ":", "prompt", "=", "(", "\"INTERACTIVE MODE num_samples=%d decode_length=%d \\n\"", "\" it=<input_type> ('text' or 'image' or 'label', default: \"", "\"text)\\n\"", "\" ns=<num_samples> (changes number of samples, default: 1)\\n\"", "\" dl=<decode_length> (changes decode length, default: 100)\\n\"", "\" <%s> (decode)\\n\"", "\" q (quit)\\n\"", "\">\"", "%", "(", "num_samples", ",", "decode_length", ",", "\"source_string\"", "if", "has_input", "else", "\"target_prefix\"", ")", ")", "input_string", "=", "input", "(", "prompt", ")", "if", "input_string", "==", "\"q\"", ":", "return", "elif", "input_string", "[", ":", "3", "]", "==", "\"ns=\"", ":", "num_samples", "=", "int", "(", "input_string", "[", "3", ":", "]", ")", "elif", "input_string", "[", ":", "3", "]", "==", "\"dl=\"", ":", "decode_length", "=", "int", "(", "input_string", "[", "3", ":", "]", ")", "elif", "input_string", "[", ":", "3", "]", "==", "\"it=\"", ":", "input_type", "=", "input_string", "[", "3", ":", "]", "else", ":", "if", "input_type", "==", "\"text\"", ":", "input_ids", "=", "vocabulary", ".", "encode", "(", "input_string", ")", "if", "has_input", ":", "input_ids", ".", "append", "(", "text_encoder", ".", "EOS_ID", ")", "x", "=", "[", "num_samples", ",", "decode_length", ",", "len", "(", "input_ids", ")", "]", "+", "input_ids", "assert", "len", "(", "x", ")", "<", "const_array_size", "x", "+=", "[", "0", "]", "*", "(", "const_array_size", "-", "len", "(", "x", ")", ")", "features", "=", "{", "\"inputs\"", ":", "np", ".", "array", "(", "x", ")", ".", "astype", "(", "np", ".", "int32", ")", ",", "}", "elif", "input_type", "==", "\"image\"", ":", "input_path", "=", "input_string", "img", "=", "vocabulary", ".", "encode", "(", "input_path", ")", "features", "=", "{", "\"inputs\"", ":", "img", ".", "astype", "(", "np", ".", "int32", ")", ",", "}", "elif", "input_type", "==", "\"label\"", ":", "input_ids", "=", "[", "int", "(", "input_string", ")", "]", "x", "=", "[", "num_samples", ",", "decode_length", ",", "len", "(", "input_ids", ")", "]", "+", "input_ids", "features", "=", "{", "\"inputs\"", ":", "np", ".", "array", "(", "x", ")", ".", "astype", "(", "np", ".", "int32", ")", ",", "}", "else", ":", "raise", "Exception", "(", "\"Unsupported input type.\"", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "problem_lib", ".", "problem_hparams_to_features", "(", "p_hparams", ")", ")", ":", "features", "[", "k", "]", "=", "np", ".", "array", "(", "v", ")", ".", "astype", "(", "np", ".", "int32", ")", "yield", "features" ]
Generator that reads from the terminal and yields "interactive inputs". Due to temporary limitations in tf.learn, if we don't want to reload the whole graph, then we are stuck encoding all of the input as one fixed-size numpy array. We yield int32 arrays with shape [const_array_size]. The format is: [num_samples, decode_length, len(input ids), <input ids>, <padding>] Args: hparams: model hparams decode_hp: decode hparams Yields: numpy arrays Raises: Exception: when `input_type` is invalid.
[ "Generator", "that", "reads", "from", "the", "terminal", "and", "yields", "interactive", "inputs", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L700-L779
train
Generator that reads from the terminal and yields interactive inputs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJ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6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\067' + chr(0b111 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(7566 - 7455) + '\x33' + '\x34' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(5526 - 5415) + chr(49) + chr(0b110011) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + '\x32' + chr(2766 - 2713) + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + chr(1579 - 1530) + '\x33' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(0b10101 + 0o35) + '\x36' + '\x32', 8993 - 8985), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(51) + chr(0b110111) + chr(52), 8), ehT0Px3KOsy9(chr(48) + chr(3855 - 3744) + chr(2223 - 2173) + chr(462 - 409) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(669 - 620) + chr(0b10101 + 0o37) + '\060', 30109 - 30101), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(395 - 344) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\x6f' + '\x31' + '\x32' + chr(113 - 61), 0o10), ehT0Px3KOsy9(chr(1836 - 1788) + chr(0b1111 + 0o140) + '\063' + chr(2689 - 2636) + chr(0b110110), 44602 - 44594), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + chr(2096 - 2042) + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + chr(1975 - 1864) + chr(0b1100 + 0o47) + '\x32', 21670 - 21662), ehT0Px3KOsy9('\060' + chr(111) + chr(55) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(1753 - 1703) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110101) + '\066', 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(1719 - 1668) + '\x35' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(2370 - 2318), 28218 - 28210), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + '\x37' + chr(1719 - 1671), 6535 - 6527), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(53) + chr(0b1111 + 0o47), 8), ehT0Px3KOsy9(chr(354 - 306) + chr(0b1101111) + chr(0b110001) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(4020 - 3909) + '\x32' + '\x30' + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(0b110001 + 0o76) + chr(50) + chr(0b110000 + 0o3) + '\x31', 0o10), ehT0Px3KOsy9('\x30' + chr(5981 - 5870) + chr(53), 61938 - 61930), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(2294 - 2243) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(762 - 714) + chr(111) + chr(0b110010 + 0o0) + chr(53) + chr(1685 - 1635), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(4280 - 4169) + chr(0b100100 + 0o16) + chr(0b110 + 0o52) + chr(55), 0o10), ehT0Px3KOsy9(chr(326 - 278) + '\x6f' + chr(0b110011) + '\067' + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100010 + 0o15) + chr(0b110001 + 0o2) + chr(0b110010) + chr(2410 - 2360), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(55) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(11210 - 11099) + chr(0b100100 + 0o16) + chr(1440 - 1389) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100111 + 0o12) + chr(0b110111) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + '\063' + chr(0b110101) + chr(53), 27287 - 27279), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100010 + 0o20) + '\x35' + chr(0b110100), 12858 - 12850), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100011 + 0o21) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(1899 - 1788) + '\x32' + chr(1033 - 982) + '\x31', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + chr(0b1000 + 0o54), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\062' + chr(0b101010 + 0o7), 42558 - 42550)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(0b110101) + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2'), '\x64' + '\x65' + chr(0b1100011) + chr(731 - 620) + chr(100) + '\x65')(chr(0b1010000 + 0o45) + chr(116) + '\146' + '\x2d' + chr(0b1011 + 0o55)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def wu0iCC_L8XKz(n4ljua2gi1Pr, dcaitvFqg9pp): Wuetkhsbidt0 = dcaitvFqg9pp.num_samples if dcaitvFqg9pp.num_samples > ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10011 + 0o35), 0b1000) else ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b10001 + 0o136) + '\061', ord("\x08")) U6Ej34SVvx1Y = dcaitvFqg9pp.extra_length vsugdZNHo5OD = xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x84!\xdd'), chr(8850 - 8750) + chr(0b111111 + 0o46) + '\x63' + chr(0b1000001 + 0o56) + chr(100) + chr(101))(chr(11063 - 10946) + chr(116) + '\x66' + '\x2d' + '\070') bb9KhnGWdDAt = n4ljua2gi1Pr.sXqesioLf7Ji pfhXZufo40AS = xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x8f)\xdc(\xc1'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b101110 + 0o66) + chr(101))(chr(117) + '\x74' + chr(6528 - 6426) + chr(45) + '\070') in bb9KhnGWdDAt.bYPswhysd3s2 Vemi1XCgm0ph = bb9KhnGWdDAt.Vemi1XCgm0ph[xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x8f)\xdc(\xc1'), chr(0b10100 + 0o120) + '\145' + chr(0b1011100 + 0o7) + chr(0b1101111) + chr(0b1101 + 0o127) + chr(9498 - 9397))(chr(117) + chr(0b1100011 + 0o21) + chr(0b101 + 0o141) + chr(0b111 + 0o46) + '\070') if pfhXZufo40AS else xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x80+\xce9\xc6\x8f'), chr(0b1100100) + chr(101) + chr(0b10110 + 0o115) + chr(0b11111 + 0o120) + '\x64' + chr(0b10 + 0o143))(chr(117) + chr(0b1110100) + chr(854 - 752) + chr(0b100010 + 0o13) + chr(56))] JZWNsZd37VpX = ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\x33' + chr(52) + '\x32' + '\x30', 0o10) try: (SzBQIcL4RCw3,) = (jFWsnpHpAUWz(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e\x848\xcd0\xdb\x92\xcd'), chr(0b1010001 + 0o23) + chr(0b1100101) + chr(3111 - 3012) + '\157' + '\144' + chr(0b1100101))(chr(117) + '\x74' + '\x66' + chr(218 - 173) + chr(0b100111 + 0o21))),) except yROw0HWBk0Qc: pass while ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1100011 + 0o14) + '\x31', 8): otIJj53SOGM5 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5\xaf\r\xec\x0e\xf3\xbf\xfc)\t\x11\xcexUz\x16\xce\xc8rMg\xb1|\xe4\xf4u\xb2\xcf\xf4\xc6\xf7\x9a\xbf_\x89\xc9@\xf6H\xb4\xa3\x8d<\xc7;\xc6\x94\x95E;t\xce?:\x1e:\x9a\xd5 Qd\x9ez\xf1\xc6q\xa7\xda\xe2\xc5\xf2\xde\xbf_\xcd\x84\x04\xedI\xa9\x88\xc6y\xc6.\x92\xdb\xc1\r>3\x8b\x12:Q!\xce\xcfpYh\x8bc\xa2\xb5%\xba\xcf\xe1\x9a\xa7\x92\xebE\xcd\xd8F\xe1X\xf8\xf6\xc1y\xc7/\x8f\xc0\xc6\x152\x0b\x9dTwN?\x8b\x9b"\x18*\xce/\xad\xfam\xbf\xc4\xe0\x9e\xa1\xde\xf1\n\x80\xceF\xeb\x0c\xbe\x9a\xc1*\xc81\xc2\x90\xcd\x13st\x8aP|_&\x82\x9c&\x18;\xc7\x05\xa5\xb9a\xb2\x97\xbb\x9f\xb7\x9d\xf0\x1b\x88\xf3O\xfcB\xb6\x88\x89g\x89|\x9a\x9f\xc0\x0113\x8bF:Z6\x8d\x87x]*\x82j\xeb\xfeq\xb6\x86\xa7\x9f\xb7\x98\xfe\n\x81\xd8\x19\xb9\x1d\xe1\xcc\xc8S\x89|\x8e\xd9\xdb^\x7ft\xce\x15:\x1es\xce\xc8<\x18*\xce/\xa5\xb9-\xba\xcf\xe4\x94\xb6\x9b\xb6u\xcd\x8cR\xb9\x0c\xf1\xdc\xc1y\x89|\x92\xdc\x88@\x7ft\xce\x15:\x1es\xc6\x99iQ~\xc7\x05\xbb'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + '\x65')('\165' + chr(116) + '\146' + chr(0b101101) + '\x38') % (Wuetkhsbidt0, U6Ej34SVvx1Y, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f\x8e,\xdb?\xd7\xa3\xdb\x14-=\x80R'), '\144' + chr(0b1100101) + chr(99) + chr(0b1001110 + 0o41) + chr(0b1100100) + '\145')(chr(117) + chr(116) + chr(102) + '\x2d' + chr(56)) if pfhXZufo40AS else xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x80+\xce9\xc6\xa3\xd8\x12:2\x87M'), '\x64' + chr(101) + '\x63' + chr(111) + chr(100) + chr(101))('\x75' + '\x74' + chr(0b1100110) + '\055' + '\070')) DH7io1rudAkV = Y3jVKaC8LEDU(otIJj53SOGM5) if DH7io1rudAkV == xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d'), chr(0b1100100) + chr(2747 - 2646) + chr(0b1100011) + chr(0b1010110 + 0o31) + chr(100) + chr(8031 - 7930))('\165' + chr(4861 - 4745) + chr(0b1100110) + chr(0b10011 + 0o32) + '\070'): return elif DH7io1rudAkV[:ehT0Px3KOsy9('\x30' + chr(0b101010 + 0o105) + '\063', 0b1000)] == xafqLlk3kkUe(SXOLrMavuUCe(b'\x92\x92d'), '\144' + chr(6171 - 6070) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(5820 - 5719))('\x75' + chr(0b11 + 0o161) + chr(0b101000 + 0o76) + '\055' + chr(0b111000)): Wuetkhsbidt0 = ehT0Px3KOsy9(DH7io1rudAkV[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101 + 0o142) + '\x33', 8):]) elif DH7io1rudAkV[:ehT0Px3KOsy9(chr(2095 - 2047) + '\157' + '\x33', 8)] == xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x8dd'), chr(2447 - 2347) + chr(2786 - 2685) + chr(474 - 375) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(117) + '\x74' + chr(0b101101 + 0o71) + chr(45) + chr(1015 - 959)): U6Ej34SVvx1Y = ehT0Px3KOsy9(DH7io1rudAkV[ehT0Px3KOsy9(chr(425 - 377) + chr(0b1101111) + '\x33', 8):]) elif DH7io1rudAkV[:ehT0Px3KOsy9('\x30' + chr(755 - 644) + chr(0b10111 + 0o34), 8)] == xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x95d'), chr(0b1100100) + '\x65' + chr(4357 - 4258) + chr(0b1101111) + chr(100) + chr(101))('\165' + chr(116) + chr(0b1100110) + chr(154 - 109) + '\070'): vsugdZNHo5OD = DH7io1rudAkV[ehT0Px3KOsy9(chr(48) + chr(0b1000000 + 0o57) + chr(0b110011), 8):] else: if vsugdZNHo5OD == xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\x84!\xdd'), chr(100) + chr(3479 - 3378) + chr(6559 - 6460) + chr(0b1101111) + '\x64' + chr(0b10010 + 0o123))(chr(0b100011 + 0o122) + chr(0b1100011 + 0o21) + '\x66' + chr(45) + '\x38'): CyiZkgWrlgA9 = Vemi1XCgm0ph.encode(DH7io1rudAkV) if pfhXZufo40AS: xafqLlk3kkUe(CyiZkgWrlgA9, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9d\x91)\xcc2\xd6'), '\144' + chr(0b1000101 + 0o40) + chr(7773 - 7674) + '\157' + '\144' + '\x65')('\x75' + '\164' + chr(102) + '\055' + chr(1600 - 1544)))(xafqLlk3kkUe(nCRDzZ_Is9fz, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xae\n\xf6\x15\xf6'), chr(0b1100100) + chr(0b1011000 + 0o15) + chr(99) + chr(111) + '\x64' + '\145')('\165' + chr(0b1000111 + 0o55) + chr(6637 - 6535) + chr(45) + chr(0b101001 + 0o17)))) OeWW0F1dBPRQ = [Wuetkhsbidt0, U6Ej34SVvx1Y, c2A0yzQpDQB3(CyiZkgWrlgA9)] + CyiZkgWrlgA9 assert c2A0yzQpDQB3(OeWW0F1dBPRQ) < JZWNsZd37VpX OeWW0F1dBPRQ += [ehT0Px3KOsy9('\060' + chr(111) + chr(48), 8)] * (JZWNsZd37VpX - c2A0yzQpDQB3(OeWW0F1dBPRQ)) EEf4r9nUvta_ = {xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x8f)\xdc(\xc1'), chr(6734 - 6634) + '\145' + chr(0b1011101 + 0o6) + chr(111) + chr(4963 - 4863) + chr(5319 - 5218))('\x75' + chr(116) + '\x66' + '\x2d' + chr(2114 - 2058)): WqUC3KWvYVup.array(OeWW0F1dBPRQ).astype(WqUC3KWvYVup.int32)} elif vsugdZNHo5OD == xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x8c8\xce9'), chr(100) + chr(101) + chr(5622 - 5523) + chr(111) + '\x64' + '\145')('\x75' + chr(0b1110100) + chr(0b110001 + 0o65) + '\055' + chr(0b111000)): f4VmsQ86qYDJ = DH7io1rudAkV s63jeLEbd8fs = Vemi1XCgm0ph.encode(f4VmsQ86qYDJ) EEf4r9nUvta_ = {xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x8f)\xdc(\xc1'), chr(100) + chr(101) + chr(597 - 498) + chr(111) + chr(0b1000010 + 0o42) + '\x65')(chr(117) + chr(0b1101101 + 0o7) + '\146' + '\x2d' + chr(1816 - 1760)): s63jeLEbd8fs.astype(WqUC3KWvYVup.int32)} elif vsugdZNHo5OD == xafqLlk3kkUe(SXOLrMavuUCe(b'\x90\x80;\xcc0'), chr(0b1100100) + '\145' + chr(99) + chr(0b1100 + 0o143) + '\144' + chr(8217 - 8116))('\x75' + chr(0b1110100) + '\146' + chr(118 - 73) + chr(1237 - 1181)): CyiZkgWrlgA9 = [ehT0Px3KOsy9(DH7io1rudAkV)] OeWW0F1dBPRQ = [Wuetkhsbidt0, U6Ej34SVvx1Y, c2A0yzQpDQB3(CyiZkgWrlgA9)] + CyiZkgWrlgA9 EEf4r9nUvta_ = {xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x8f)\xdc(\xc1'), chr(4944 - 4844) + chr(0b1100101) + chr(0b1111 + 0o124) + chr(111) + chr(0b1100100) + chr(0b101111 + 0o66))(chr(1447 - 1330) + '\164' + chr(0b110110 + 0o60) + chr(0b1101 + 0o40) + '\070'): WqUC3KWvYVup.array(OeWW0F1dBPRQ).astype(WqUC3KWvYVup.int32)} else: raise jLmadlzMdunT(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9\x8f*\xdc,\xc2\x93\xda\x14:0\xce\\tN&\x9a\xc8hAz\x8b!'), chr(3104 - 3004) + chr(7081 - 6980) + '\143' + chr(1990 - 1879) + '\144' + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(1838 - 1793) + chr(2047 - 1991))) for (OolUPRJhRaJd, cMbll0QYhULo) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\x95<\xdb5\xc6\x99\xc5\x13'), chr(100) + chr(101) + chr(99) + chr(0b1101111) + '\x64' + chr(0b110111 + 0o56))(chr(10810 - 10693) + chr(0b111101 + 0o67) + chr(102) + chr(45) + '\x38'))(xafqLlk3kkUe(OcGfgf09xxxc, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c\x936\xcb0\xd7\x91\xf7\x08/5\x9cTwM\x0c\x9a\x87C^o\x8f{\xf0\xeb`\xad'), '\x64' + chr(8617 - 8516) + '\x63' + chr(0b10010 + 0o135) + chr(0b1001010 + 0o32) + '\145')(chr(8077 - 7960) + chr(4667 - 4551) + chr(0b1100110) + '\x2d' + '\x38'))(bb9KhnGWdDAt)): EEf4r9nUvta_[OolUPRJhRaJd] = WqUC3KWvYVup.array(cMbll0QYhULo).astype(WqUC3KWvYVup.int32) yield EEf4r9nUvta_
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
save_video
def save_video(video, save_path_template): """Save frames of the videos into files.""" try: from PIL import Image # pylint: disable=g-import-not-at-top except ImportError as e: tf.logging.warning( "Showing and saving an image requires PIL library to be " "installed: %s", e) raise NotImplementedError("Image display and save not implemented.") for i, frame in enumerate(video): save_path = save_path_template.format(i) with tf.gfile.Open(save_path, "wb") as sp: Image.fromarray(np.uint8(frame)).save(sp)
python
def save_video(video, save_path_template): """Save frames of the videos into files.""" try: from PIL import Image # pylint: disable=g-import-not-at-top except ImportError as e: tf.logging.warning( "Showing and saving an image requires PIL library to be " "installed: %s", e) raise NotImplementedError("Image display and save not implemented.") for i, frame in enumerate(video): save_path = save_path_template.format(i) with tf.gfile.Open(save_path, "wb") as sp: Image.fromarray(np.uint8(frame)).save(sp)
[ "def", "save_video", "(", "video", ",", "save_path_template", ")", ":", "try", ":", "from", "PIL", "import", "Image", "# pylint: disable=g-import-not-at-top", "except", "ImportError", "as", "e", ":", "tf", ".", "logging", ".", "warning", "(", "\"Showing and saving an image requires PIL library to be \"", "\"installed: %s\"", ",", "e", ")", "raise", "NotImplementedError", "(", "\"Image display and save not implemented.\"", ")", "for", "i", ",", "frame", "in", "enumerate", "(", "video", ")", ":", "save_path", "=", "save_path_template", ".", "format", "(", "i", ")", "with", "tf", ".", "gfile", ".", "Open", "(", "save_path", ",", "\"wb\"", ")", "as", "sp", ":", "Image", ".", "fromarray", "(", "np", ".", "uint8", "(", "frame", ")", ")", ".", "save", "(", "sp", ")" ]
Save frames of the videos into files.
[ "Save", "frames", "of", "the", "videos", "into", "files", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L782-L795
train
Save frames of the videos into files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNG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hLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(1511 - 1400) + chr(975 - 926) + chr(0b110101) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6214 - 6103) + chr(990 - 941) + chr(0b110100) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1477 - 1426) + chr(48) + chr(0b100001 + 0o20), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10000 + 0o137) + chr(55) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + '\x31' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x36' + chr(2441 - 2386), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(630 - 581) + '\x31' + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b101000 + 0o14) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b110001) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(0b111 + 0o60) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b10111 + 0o36) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(690 - 642) + chr(111) + chr(0b110011) + chr(51) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110011 + 0o74) + chr(0b110001) + '\x35' + '\x33', 41452 - 41444), ehT0Px3KOsy9('\060' + chr(0b10000 + 0o137) + chr(1608 - 1558) + chr(1882 - 1832) + chr(627 - 579), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(1605 - 1553), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b111010 + 0o65) + '\x31' + '\x32' + '\060', 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(6869 - 6758) + chr(52) + chr(0b10001 + 0o41), 16835 - 16827), ehT0Px3KOsy9(chr(0b110000) + chr(9362 - 9251) + chr(0b110101) + chr(0b110111), 41142 - 41134), ehT0Px3KOsy9(chr(1147 - 1099) + chr(0b1101111) + chr(0b110011) + '\065' + chr(0b100110 + 0o15), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + chr(1895 - 1845) + chr(0b11000 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1239 - 1128) + chr(0b110001) + '\061' + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(49) + chr(48), 10349 - 10341), ehT0Px3KOsy9(chr(1403 - 1355) + '\x6f' + chr(0b110011) + chr(52) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + chr(363 - 314) + chr(0b10010 + 0o42) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(55) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b10110 + 0o34) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(49) + chr(359 - 307) + chr(0b101101 + 0o3), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101111 + 0o2) + '\066' + '\x32', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(2181 - 2133) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11141 - 11030) + chr(0b110001) + chr(2022 - 1970) + chr(2272 - 2222), ord("\x08")), ehT0Px3KOsy9(chr(407 - 359) + '\157' + chr(51) + chr(0b101010 + 0o7) + '\062', 7242 - 7234), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(0b100010 + 0o17) + chr(0b110100) + '\064', 8), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x32' + chr(0b10100 + 0o42), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(1026 - 974) + chr(1361 - 1310), 0b1000), ehT0Px3KOsy9('\x30' + chr(211 - 100) + '\x31' + chr(0b110010) + chr(1808 - 1758), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + '\x32' + chr(0b110011) + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\060' + chr(0b110000), 9728 - 9720), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(309 - 256) + '\x33', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b100101 + 0o20) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'F'), chr(100) + chr(0b1100101) + chr(2234 - 2135) + chr(0b1011 + 0o144) + chr(0b1100100) + chr(9793 - 9692))(chr(0b1100111 + 0o16) + chr(0b1010100 + 0o40) + chr(0b1100110) + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def r0JtGi8OzFa8(lADoCDXuSFEg, o8UeCCT6Q4Tm): try: (Xi3KfA6brWYX,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'8(\x8d'), chr(0b1001 + 0o133) + chr(0b10110 + 0o117) + chr(99) + chr(0b10010 + 0o135) + '\144' + '\145')(chr(0b1110101) + '\x74' + chr(0b100011 + 0o103) + chr(45) + chr(1063 - 1007)), xafqLlk3kkUe(SXOLrMavuUCe(b'!\x0c\xa0X\xec'), chr(100) + '\x65' + chr(0b1101 + 0o126) + '\x6f' + chr(100) + chr(0b1010100 + 0o21))('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56))), xafqLlk3kkUe(SXOLrMavuUCe(b'!\x0c\xa0X\xec'), chr(0b1100100) + chr(0b1001111 + 0o26) + chr(0b1000011 + 0o40) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(117) + '\164' + chr(102) + chr(0b10010 + 0o33) + chr(0b1010 + 0o56))),) except yROw0HWBk0Qc as GlnVAPeT6CUe: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x00\xb3Q\xe0\x19.'), chr(100) + '\x65' + chr(1301 - 1202) + chr(0b11111 + 0o120) + chr(867 - 767) + chr(0b1100 + 0o131))('\x75' + '\x74' + '\146' + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b';\t\xaeH\xe0\x19.\x85\xea\x14O\x06\xaa\n\xe6}>E\x0f\x8a~h\xe1\x8b\x05\x9d\xb2@\x00\xe1\x13\xbf\r\xe4r\x90r\xc9\t\xa7H\r\xa8]\xfb\x16;\xdc\xab\x0eD\x06\xbb\x0e\xb0}>Q[\x8a|$\xed\x82^\xda\xf2\x13'), chr(100) + '\145' + chr(99) + chr(111) + chr(100) + chr(1079 - 978))(chr(0b1101010 + 0o13) + chr(116) + chr(0b111110 + 0o50) + '\055' + chr(0b111000)), GlnVAPeT6CUe) raise _zJ24Vce7wp0(xafqLlk3kkUe(SXOLrMavuUCe(b'!\x0c\xa0X\xecW-\xcc\xf8\nGG\xa0K\xf1z4\x02\\\x8af-\xa8\x88\x0b\x8e\xf7\t\x1f\xf4\x0e\xaf\t\xf3y\x977\xfdn'), chr(0b1100100) + '\x65' + chr(99) + chr(0b1101111) + '\144' + chr(101))(chr(117) + chr(951 - 835) + chr(1908 - 1806) + '\055' + chr(2467 - 2411))) for (WVxHKyX45z_L, C4IqNNmLfHXB) in YlkZvXL8qwsX(lADoCDXuSFEg): uxepbmQxAOsp = o8UeCCT6Q4Tm.V4roHaS3Ppej(WVxHKyX45z_L) with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b"'\x11\xa4Q"), chr(0b1001111 + 0o25) + '\x65' + chr(1338 - 1239) + chr(0b1101111) + '\x64' + chr(6372 - 6271))(chr(117) + chr(116) + '\146' + chr(2017 - 1972) + '\070'))(uxepbmQxAOsp, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x03'), chr(9205 - 9105) + chr(101) + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(8300 - 8183) + chr(116) + chr(0b1100001 + 0o5) + '\x2d' + chr(641 - 585))) as ryOzkpXaokEu: xafqLlk3kkUe(Xi3KfA6brWYX.fromarray(WqUC3KWvYVup.uint8(C4IqNNmLfHXB)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b\x00\xb7Z'), chr(3189 - 3089) + '\x65' + '\143' + '\157' + chr(100) + chr(8690 - 8589))('\x75' + '\x74' + chr(102) + chr(0b101011 + 0o2) + chr(0b110001 + 0o7)))(ryOzkpXaokEu)
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
show_and_save_image
def show_and_save_image(img, save_path): """Shows an image using matplotlib and saves it.""" try: import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top except ImportError as e: tf.logging.warning( "Showing and saving an image requires matplotlib to be " "installed: %s", e) raise NotImplementedError("Image display and save not implemented.") plt.imshow(img) with tf.gfile.Open(save_path, "wb") as sp: plt.savefig(sp)
python
def show_and_save_image(img, save_path): """Shows an image using matplotlib and saves it.""" try: import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top except ImportError as e: tf.logging.warning( "Showing and saving an image requires matplotlib to be " "installed: %s", e) raise NotImplementedError("Image display and save not implemented.") plt.imshow(img) with tf.gfile.Open(save_path, "wb") as sp: plt.savefig(sp)
[ "def", "show_and_save_image", "(", "img", ",", "save_path", ")", ":", "try", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "# pylint: disable=g-import-not-at-top", "except", "ImportError", "as", "e", ":", "tf", ".", "logging", ".", "warning", "(", "\"Showing and saving an image requires matplotlib to be \"", "\"installed: %s\"", ",", "e", ")", "raise", "NotImplementedError", "(", "\"Image display and save not implemented.\"", ")", "plt", ".", "imshow", "(", "img", ")", "with", "tf", ".", "gfile", ".", "Open", "(", "save_path", ",", "\"wb\"", ")", "as", "sp", ":", "plt", ".", "savefig", "(", "sp", ")" ]
Shows an image using matplotlib and saves it.
[ "Shows", "an", "image", "using", "matplotlib", "and", "saves", "it", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L798-L809
train
Shows an image using matplotlib and saves it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSI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Z2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + '\x37' + chr(459 - 411), 58194 - 58186), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(2597 - 2486) + chr(1002 - 953) + chr(52) + chr(50), 47774 - 47766), ehT0Px3KOsy9(chr(587 - 539) + chr(111) + chr(2371 - 2320) + chr(52) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9690 - 9579) + chr(1689 - 1638) + '\066' + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2240 - 2189) + chr(1438 - 1385) + chr(1757 - 1705), 41193 - 41185), ehT0Px3KOsy9(chr(1241 - 1193) + chr(0b1101111) + chr(49) + chr(1222 - 1171) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9016 - 8905) + chr(0b110010) + chr(0b100011 + 0o21) + chr(0b10011 + 0o36), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(1257 - 1207) + '\066' + chr(302 - 254), 0b1000), ehT0Px3KOsy9(chr(2041 - 1993) + '\x6f' + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(4125 - 4014) + '\061' + chr(0b110110) + chr(2277 - 2224), 0b1000), ehT0Px3KOsy9(chr(518 - 470) + '\157' + '\063' + chr(0b110111) + chr(0b11111 + 0o25), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1387 - 1336) + chr(0b110100) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1011100 + 0o23) + chr(0b10001 + 0o40) + chr(53) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1010000 + 0o37) + chr(0b110010) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1456 - 1405) + '\062' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(52) + chr(0b101010 + 0o15), 0b1000), ehT0Px3KOsy9(chr(48) + chr(282 - 171) + chr(0b1111 + 0o44) + chr(1058 - 1004) + '\067', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110 + 0o55) + chr(1422 - 1368) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x36' + '\067', 8946 - 8938), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\062' + '\x33' + chr(0b101000 + 0o10), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11 + 0o57) + chr(0b110100) + chr(872 - 820), 0b1000), ehT0Px3KOsy9('\060' + chr(6214 - 6103) + chr(493 - 438) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(49) + chr(0b10101 + 0o42), 53190 - 53182), ehT0Px3KOsy9(chr(1186 - 1138) + '\157' + chr(0b1001 + 0o50) + '\x31' + chr(55), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b110110) + chr(0b1111 + 0o44), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b10010 + 0o135) + chr(55) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010 + 0o145) + chr(0b110001) + chr(1133 - 1085) + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101011 + 0o6) + chr(48) + '\x31', 16179 - 16171), ehT0Px3KOsy9(chr(48) + chr(111) + '\x35', 50310 - 50302), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100101 + 0o14) + chr(51) + '\x32', 64879 - 64871), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1652 - 1601) + chr(52) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\x36' + chr(96 - 43), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + '\x30' + chr(2039 - 1991), 14459 - 14451), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(49) + chr(971 - 920), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(996 - 946) + chr(1841 - 1792) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(52) + chr(917 - 862), 48297 - 48289), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(49) + chr(52) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(1982 - 1871) + chr(0b110001) + chr(55) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + chr(1936 - 1885), ord("\x08")), ehT0Px3KOsy9(chr(617 - 569) + '\x6f' + '\063' + chr(0b110010), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + '\x35' + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x16'), chr(0b1011001 + 0o13) + '\x65' + '\x63' + '\157' + chr(523 - 423) + chr(7970 - 7869))('\x75' + '\x74' + '\x66' + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def CG5Z4N9nKSvI(s63jeLEbd8fs, uxepbmQxAOsp): try: (eRubm8FH879n,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'U\x03\x97\x87\x802\xd5\xdcj\x17\xd2\x91\x16g\xbf\xc8\x83'), chr(2431 - 2331) + chr(101) + chr(5562 - 5463) + '\x6f' + '\x64' + chr(0b1100101))(chr(0b1010001 + 0o44) + chr(0b1110100) + '\146' + chr(88 - 43) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'H\x1b\x93\x9b\x83)'), '\x64' + '\145' + chr(0b1100011) + '\x6f' + '\144' + chr(0b11101 + 0o110))('\x75' + chr(3729 - 3613) + chr(102) + chr(0b0 + 0o55) + chr(56))), xafqLlk3kkUe(SXOLrMavuUCe(b'H\x1b\x93\x9b\x83)'), chr(0b1100100) + '\145' + chr(99) + '\157' + '\144' + chr(101))(chr(10690 - 10573) + '\164' + '\x66' + chr(331 - 286) + chr(222 - 166))),) except yROw0HWBk0Qc as GlnVAPeT6CUe: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'O\x03\x91\x99\x853\xc6'), chr(0b1100100) + '\x65' + '\x63' + '\x6f' + chr(100) + '\145')(chr(0b1110101) + chr(116) + '\146' + chr(0b100010 + 0o13) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'k\n\x8c\x80\x853\xc6\x90b\x1b\x98\xc1\x1cv\xa5\xce\x99\x96\x17\xf9\xca\x1c&"\x92]"aw?\x95\xc0)9\xe9T@\x12BnH\x0e\x8c\x83\x804\xc3\x90w\x1a\xdc\x83\n7\xba\xc9\x84\x85V\xf4\xc8Y+u\xd3\x1f4'), chr(0b10110 + 0o116) + chr(101) + chr(4181 - 4082) + '\x6f' + chr(100) + '\145')('\165' + '\x74' + chr(2597 - 2495) + '\x2d' + chr(56)), GlnVAPeT6CUe) raise _zJ24Vce7wp0(xafqLlk3kkUe(SXOLrMavuUCe(b'q\x0f\x82\x90\x89}\xc5\xd9p\x05\x90\x80\x167\xb2\xc9\x93\xd1D\xf9\xd2Yo!\x9cNg(h*\x88\xd0-.\xe2S\x05\x1b\r'), chr(0b1100100) + chr(0b110011 + 0o62) + chr(8068 - 7969) + '\157' + '\144' + chr(0b111000 + 0o55))(chr(524 - 407) + '\164' + '\x66' + '\x2d' + '\x38')) xafqLlk3kkUe(eRubm8FH879n, xafqLlk3kkUe(SXOLrMavuUCe(b'Q\x0f\x90\x9f\x83*'), chr(0b1100100) + chr(101) + chr(99) + chr(6552 - 6441) + chr(100) + chr(2904 - 2803))(chr(0b1110101) + chr(0b1010100 + 0o40) + chr(9032 - 8930) + chr(0b101101) + '\070'))(s63jeLEbd8fs) with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'w\x12\x86\x99'), chr(3641 - 3541) + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b100110 + 0o76) + chr(0b1100101))(chr(0b1010000 + 0o45) + '\164' + '\x66' + '\055' + chr(1108 - 1052)))(uxepbmQxAOsp, xafqLlk3kkUe(SXOLrMavuUCe(b'O\x00'), chr(5409 - 5309) + chr(7740 - 7639) + chr(9715 - 9616) + chr(0b110100 + 0o73) + '\x64' + chr(0b11000 + 0o115))(chr(0b110011 + 0o102) + '\164' + chr(0b1100110) + chr(45) + chr(0b110101 + 0o3))) as ryOzkpXaokEu: xafqLlk3kkUe(eRubm8FH879n, xafqLlk3kkUe(SXOLrMavuUCe(b'K\x03\x95\x92\x8a4\xc6'), chr(0b1110 + 0o126) + chr(101) + chr(99) + chr(0b1100101 + 0o12) + chr(100) + chr(101))('\x75' + chr(5076 - 4960) + chr(9538 - 9436) + chr(45) + chr(1579 - 1523)))(ryOzkpXaokEu)
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_get_language_modeling_inputs
def _get_language_modeling_inputs(filename, delimiter="\n", repeat=1, append_space_to_final_punctionation=True): """Read a file of partial texts to continue. The purpose of append_space_to_final_punctionation is that SubwordTokenizer groups punctuation and the ensuing space in the same token. Adding a space causes the token to be completed. Args: filename: a string delimiter: a string repeat: an integer - we repeat the entire file that many times. append_space_to_final_punctionation: a boolean Returns: a list of strings """ with tf.gfile.Open(filename) as f: text = f.read() inputs = text.split(delimiter) if not inputs[-1]: inputs.pop() inputs *= repeat if append_space_to_final_punctionation: inputs = [ s + " " if s and s[-1] in string.punctuation else s for s in inputs] return inputs
python
def _get_language_modeling_inputs(filename, delimiter="\n", repeat=1, append_space_to_final_punctionation=True): """Read a file of partial texts to continue. The purpose of append_space_to_final_punctionation is that SubwordTokenizer groups punctuation and the ensuing space in the same token. Adding a space causes the token to be completed. Args: filename: a string delimiter: a string repeat: an integer - we repeat the entire file that many times. append_space_to_final_punctionation: a boolean Returns: a list of strings """ with tf.gfile.Open(filename) as f: text = f.read() inputs = text.split(delimiter) if not inputs[-1]: inputs.pop() inputs *= repeat if append_space_to_final_punctionation: inputs = [ s + " " if s and s[-1] in string.punctuation else s for s in inputs] return inputs
[ "def", "_get_language_modeling_inputs", "(", "filename", ",", "delimiter", "=", "\"\\n\"", ",", "repeat", "=", "1", ",", "append_space_to_final_punctionation", "=", "True", ")", ":", "with", "tf", ".", "gfile", ".", "Open", "(", "filename", ")", "as", "f", ":", "text", "=", "f", ".", "read", "(", ")", "inputs", "=", "text", ".", "split", "(", "delimiter", ")", "if", "not", "inputs", "[", "-", "1", "]", ":", "inputs", ".", "pop", "(", ")", "inputs", "*=", "repeat", "if", "append_space_to_final_punctionation", ":", "inputs", "=", "[", "s", "+", "\" \"", "if", "s", "and", "s", "[", "-", "1", "]", "in", "string", ".", "punctuation", "else", "s", "for", "s", "in", "inputs", "]", "return", "inputs" ]
Read a file of partial texts to continue. The purpose of append_space_to_final_punctionation is that SubwordTokenizer groups punctuation and the ensuing space in the same token. Adding a space causes the token to be completed. Args: filename: a string delimiter: a string repeat: an integer - we repeat the entire file that many times. append_space_to_final_punctionation: a boolean Returns: a list of strings
[ "Read", "a", "file", "of", "partial", "texts", "to", "continue", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L812-L840
train
Read a file of partial texts to continue.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7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JWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1000011 + 0o54) + chr(0b100010 + 0o21) + '\063' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + '\x33' + chr(0b100101 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\065' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + chr(0b10110 + 0o33) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(9810 - 9699) + chr(0b11101 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + '\x35' + '\067', 58307 - 58299), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10101 + 0o34) + chr(52) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(2087 - 2039) + chr(0b1101111) + '\x32' + chr(0b110100) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\062' + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\065' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + chr(0b110101) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(0b11111 + 0o26) + chr(0b11 + 0o64), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b101101 + 0o12) + chr(0b100001 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1010 + 0o50) + '\x31' + chr(54), 49835 - 49827), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + '\x32' + chr(0b1001 + 0o50), 43904 - 43896), ehT0Px3KOsy9(chr(1469 - 1421) + chr(111) + chr(660 - 610) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100000 + 0o17) + chr(49) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(2170 - 2122) + chr(0b1101111) + '\061' + '\064' + chr(0b11 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\065' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b0 + 0o67), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001101 + 0o42) + chr(0b110001) + '\x37' + chr(1583 - 1535), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + '\062' + chr(0b110111) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(11725 - 11614) + chr(50) + '\x33' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10416 - 10305) + chr(1841 - 1791) + chr(51) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\063' + chr(0b1011 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10 + 0o60) + chr(53) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b1000 + 0o53) + chr(0b100111 + 0o11), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\066' + '\x31', 33826 - 33818), ehT0Px3KOsy9('\x30' + chr(4799 - 4688) + '\063' + '\x34' + chr(2075 - 2023), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4571 - 4460) + chr(0b100100 + 0o15) + chr(50) + chr(0b10111 + 0o33), 27053 - 27045), ehT0Px3KOsy9(chr(48) + chr(111) + chr(599 - 549) + chr(49) + chr(661 - 606), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\x37' + chr(0b10100 + 0o41), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(51) + chr(1009 - 954) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001 + 0o146) + chr(1339 - 1289) + chr(0b11100 + 0o24) + chr(1399 - 1351), 926 - 918), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1178 - 1128) + '\066' + chr(0b101111 + 0o5), 47846 - 47838), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x30' + chr(0b110000), 28567 - 28559), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b110000) + '\x32', 51467 - 51459), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10111 + 0o36), 47416 - 47408), ehT0Px3KOsy9(chr(1295 - 1247) + chr(0b1101000 + 0o7) + '\x36' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7538 - 7427) + '\x32' + '\064', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf7'), chr(100) + chr(3318 - 3217) + '\x63' + chr(111) + chr(100) + chr(0b100110 + 0o77))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(1844 - 1788)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def SuK67CVuKKhG(xw4DsBfIJ22E, wVeUGUOGuSDo=xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3'), '\x64' + chr(5751 - 5650) + chr(99) + '\157' + chr(7063 - 6963) + chr(0b11100 + 0o111))(chr(11753 - 11636) + chr(6062 - 5946) + '\x66' + '\x2d' + chr(0b111000)), hpyK9c505LBh=ehT0Px3KOsy9('\060' + chr(111) + chr(49), 8), ob_3yz01SU5T=ehT0Px3KOsy9('\x30' + '\157' + '\x31', 8)): with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\x96\xef\x8ba'), chr(0b1100100) + chr(0b1100101) + chr(7427 - 7328) + '\157' + chr(0b1100100) + chr(0b1100101))('\x75' + chr(0b1110 + 0o146) + chr(0b1001010 + 0o34) + chr(0b1000 + 0o45) + '\070'))(xw4DsBfIJ22E) as EGyt1xfPT1P6: Ah1rInvg48Hb = EGyt1xfPT1P6.U6MiWrhuCi2Y() vXoupepMtCXU = Ah1rInvg48Hb.split(wVeUGUOGuSDo) if not vXoupepMtCXU[-ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\061', 8)]: xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9\xf0\x9e'), chr(2781 - 2681) + '\145' + chr(3656 - 3557) + chr(0b1101111) + chr(5159 - 5059) + chr(4395 - 4294))('\165' + '\x74' + '\146' + chr(45) + chr(0b111000)))() vXoupepMtCXU *= hpyK9c505LBh if ob_3yz01SU5T: vXoupepMtCXU = [vGrByMSYMp9h + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9'), chr(0b1100100) + chr(0b10110 + 0o117) + '\143' + chr(7211 - 7100) + chr(0b100 + 0o140) + '\145')('\165' + chr(116) + chr(9755 - 9653) + '\x2d' + chr(2214 - 2158)) if vGrByMSYMp9h and vGrByMSYMp9h[-ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(9209 - 9098) + '\x31', 8)] in YfpuhF1UI1FC.punctuation else vGrByMSYMp9h for vGrByMSYMp9h in vXoupepMtCXU] return vXoupepMtCXU
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_get_sorted_inputs
def _get_sorted_inputs(filename, delimiter="\n"): """Returning inputs sorted according to decreasing length. This causes inputs of similar lengths to be processed in the same batch, facilitating early stopping for short sequences. Longer sequences are sorted first so that if you're going to get OOMs, you'll see it in the first batch. Args: filename: path to file with inputs, 1 per line. delimiter: str, delimits records in the file. Returns: a sorted list of inputs """ tf.logging.info("Getting sorted inputs") with tf.gfile.Open(filename) as f: text = f.read() records = text.split(delimiter) inputs = [record.strip() for record in records] # Strip the last empty line. if not inputs[-1]: inputs.pop() input_lens = [(i, -len(line.split())) for i, line in enumerate(inputs)] sorted_input_lens = sorted(input_lens, key=operator.itemgetter(1)) # We'll need the keys to rearrange the inputs back into their original order sorted_keys = {} sorted_inputs = [] for i, (index, _) in enumerate(sorted_input_lens): sorted_inputs.append(inputs[index]) sorted_keys[index] = i return sorted_inputs, sorted_keys
python
def _get_sorted_inputs(filename, delimiter="\n"): """Returning inputs sorted according to decreasing length. This causes inputs of similar lengths to be processed in the same batch, facilitating early stopping for short sequences. Longer sequences are sorted first so that if you're going to get OOMs, you'll see it in the first batch. Args: filename: path to file with inputs, 1 per line. delimiter: str, delimits records in the file. Returns: a sorted list of inputs """ tf.logging.info("Getting sorted inputs") with tf.gfile.Open(filename) as f: text = f.read() records = text.split(delimiter) inputs = [record.strip() for record in records] # Strip the last empty line. if not inputs[-1]: inputs.pop() input_lens = [(i, -len(line.split())) for i, line in enumerate(inputs)] sorted_input_lens = sorted(input_lens, key=operator.itemgetter(1)) # We'll need the keys to rearrange the inputs back into their original order sorted_keys = {} sorted_inputs = [] for i, (index, _) in enumerate(sorted_input_lens): sorted_inputs.append(inputs[index]) sorted_keys[index] = i return sorted_inputs, sorted_keys
[ "def", "_get_sorted_inputs", "(", "filename", ",", "delimiter", "=", "\"\\n\"", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"Getting sorted inputs\"", ")", "with", "tf", ".", "gfile", ".", "Open", "(", "filename", ")", "as", "f", ":", "text", "=", "f", ".", "read", "(", ")", "records", "=", "text", ".", "split", "(", "delimiter", ")", "inputs", "=", "[", "record", ".", "strip", "(", ")", "for", "record", "in", "records", "]", "# Strip the last empty line.", "if", "not", "inputs", "[", "-", "1", "]", ":", "inputs", ".", "pop", "(", ")", "input_lens", "=", "[", "(", "i", ",", "-", "len", "(", "line", ".", "split", "(", ")", ")", ")", "for", "i", ",", "line", "in", "enumerate", "(", "inputs", ")", "]", "sorted_input_lens", "=", "sorted", "(", "input_lens", ",", "key", "=", "operator", ".", "itemgetter", "(", "1", ")", ")", "# We'll need the keys to rearrange the inputs back into their original order", "sorted_keys", "=", "{", "}", "sorted_inputs", "=", "[", "]", "for", "i", ",", "(", "index", ",", "_", ")", "in", "enumerate", "(", "sorted_input_lens", ")", ":", "sorted_inputs", ".", "append", "(", "inputs", "[", "index", "]", ")", "sorted_keys", "[", "index", "]", "=", "i", "return", "sorted_inputs", ",", "sorted_keys" ]
Returning inputs sorted according to decreasing length. This causes inputs of similar lengths to be processed in the same batch, facilitating early stopping for short sequences. Longer sequences are sorted first so that if you're going to get OOMs, you'll see it in the first batch. Args: filename: path to file with inputs, 1 per line. delimiter: str, delimits records in the file. Returns: a sorted list of inputs
[ "Returning", "inputs", "sorted", "according", "to", "decreasing", "length", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L843-L876
train
Returns a list of sorted inputs according to decreasing length.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,LgE_IO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pv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(3685 - 3574) + '\062' + '\066' + chr(55), 42316 - 42308), ehT0Px3KOsy9(chr(48) + chr(6204 - 6093) + chr(0b110110) + chr(0b101111 + 0o3), 19085 - 19077), ehT0Px3KOsy9('\x30' + chr(5552 - 5441) + chr(0b1001 + 0o51) + chr(1155 - 1100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11 + 0o57) + '\x36' + chr(1212 - 1157), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(2004 - 1949) + chr(1923 - 1868), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111110 + 0o61) + chr(49) + '\x37' + '\067', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x33' + chr(0b110000), 18084 - 18076), ehT0Px3KOsy9(chr(48) + chr(5109 - 4998) + '\061' + chr(0b110010) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011000 + 0o27) + chr(2174 - 2123) + chr(54) + '\x37', 6087 - 6079), ehT0Px3KOsy9(chr(1414 - 1366) + chr(9299 - 9188) + chr(1162 - 1113) + chr(0b11011 + 0o32) + chr(52), 2739 - 2731), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(0b101101 + 0o7), 51526 - 51518), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(51) + chr(818 - 764) + chr(0b11101 + 0o26), 12698 - 12690), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + '\061' + chr(180 - 128), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101111 + 0o100) + '\061' + '\061' + chr(1724 - 1676), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10353 - 10242) + chr(0b100 + 0o61) + chr(0b101111 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(7214 - 7103) + '\x37' + chr(0b100010 + 0o16), 0o10), ehT0Px3KOsy9('\060' + chr(4878 - 4767) + '\062' + chr(0b110111), 8), ehT0Px3KOsy9(chr(806 - 758) + chr(0b1010011 + 0o34) + chr(0b110001) + chr(0b110011) + '\x31', 8561 - 8553), ehT0Px3KOsy9(chr(0b110000) + chr(0b111110 + 0o61) + chr(0b110011) + chr(0b10011 + 0o41) + chr(1094 - 1042), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(54) + chr(0b101111 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10011 + 0o40) + chr(54) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + '\061' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(51) + chr(1776 - 1727) + chr(2243 - 2192), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\x36' + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(56 - 7) + chr(51) + chr(0b100100 + 0o22), 12681 - 12673), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110110) + chr(0b1110 + 0o47), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(0b1010 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1922 - 1871) + '\063' + chr(0b101010 + 0o14), 0o10), ehT0Px3KOsy9('\060' + chr(0b111100 + 0o63) + '\x31' + chr(0b11111 + 0o24) + chr(0b1110 + 0o42), 51136 - 51128), ehT0Px3KOsy9('\060' + '\157' + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + '\x31' + chr(0b10010 + 0o40) + '\x33', 34738 - 34730), ehT0Px3KOsy9('\x30' + chr(2052 - 1941) + chr(0b100 + 0o62) + chr(0b110011 + 0o0), 8753 - 8745), ehT0Px3KOsy9(chr(0b110000) + chr(8365 - 8254) + chr(50) + chr(52) + chr(0b10110 + 0o32), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + '\x31' + '\064', 0o10), ehT0Px3KOsy9(chr(1494 - 1446) + chr(0b101010 + 0o105) + chr(0b110010) + chr(0b101100 + 0o11) + '\066', 31558 - 31550), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1011 + 0o51) + chr(50), 16361 - 16353), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b101000 + 0o11) + '\x32' + chr(54), 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(7003 - 6892) + chr(50) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(920 - 871) + '\x34' + chr(0b110111), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x99'), chr(0b1110 + 0o126) + chr(0b111110 + 0o47) + chr(99) + chr(0b1101111) + chr(100) + chr(3581 - 3480))(chr(0b1110101) + chr(116) + chr(915 - 813) + chr(1127 - 1082) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def xMW4Y7oEMTHR(xw4DsBfIJ22E, wVeUGUOGuSDo=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd'), '\144' + '\145' + chr(0b1100011) + chr(0b1101111) + chr(760 - 660) + '\x65')('\x75' + '\x74' + chr(102) + chr(0b101101) + chr(895 - 839))): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4\x05_\xcfJ\x1c\xbfa\x9d\x00v\x98'), chr(100) + chr(0b10010 + 0o123) + '\x63' + chr(111) + '\x64' + chr(101))('\x75' + chr(0b1110100) + '\146' + '\055' + chr(940 - 884)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0Wc\xc3V\x11\xbfv\x84\x03^\x87i\x1ahBVg,\x90\x06'), '\144' + '\x65' + chr(99) + chr(0b101110 + 0o101) + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + chr(0b1100110) + '\055' + chr(0b111000))) with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8Br\xd9'), chr(8765 - 8665) + '\x65' + chr(0b1001100 + 0o27) + chr(9914 - 9803) + '\x64' + '\x65')(chr(117) + chr(0b110011 + 0o101) + '\146' + '\x2d' + chr(56)))(xw4DsBfIJ22E) as EGyt1xfPT1P6: Ah1rInvg48Hb = EGyt1xfPT1P6.U6MiWrhuCi2Y() mov_6OW2Bcur = Ah1rInvg48Hb.split(wVeUGUOGuSDo) vXoupepMtCXU = [SIWbn6wzltxD.strip() for SIWbn6wzltxD in mov_6OW2Bcur] if not vXoupepMtCXU[-ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 0o10)]: xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7]g'), chr(0b1001011 + 0o31) + '\x65' + chr(99) + chr(111) + chr(100) + chr(0b1011 + 0o132))(chr(10257 - 10140) + chr(116) + chr(0b11 + 0o143) + chr(0b101101) + chr(1716 - 1660)))() roSqn3YK7U4i = [(WVxHKyX45z_L, -c2A0yzQpDQB3(LycYkDpyelF6.split())) for (WVxHKyX45z_L, LycYkDpyelF6) in YlkZvXL8qwsX(vXoupepMtCXU)] devWOQUH0IWb = vUlqIvNSaRMa(roSqn3YK7U4i, key=xJShi6yitBWy.itemgetter(ehT0Px3KOsy9('\060' + '\157' + chr(0b100011 + 0o16), 8))) BLAnPTKfUUc5 = {} RA19AwBpedWr = [] for (WVxHKyX45z_L, (XdowRbJKZWL9, VNGQdHSFPrso)) in YlkZvXL8qwsX(devWOQUH0IWb): xafqLlk3kkUe(RA19AwBpedWr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6Bg\xd2Q\x1b'), chr(1755 - 1655) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(0b100000 + 0o104) + chr(9153 - 9052))(chr(0b1011011 + 0o32) + chr(4867 - 4751) + chr(0b1100110) + '\055' + chr(56)))(vXoupepMtCXU[XdowRbJKZWL9]) BLAnPTKfUUc5[XdowRbJKZWL9] = WVxHKyX45z_L return (RA19AwBpedWr, BLAnPTKfUUc5)
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_save_until_eos
def _save_until_eos(ids, skip=False): """Strips everything after the first <EOS> token, which is normally 1.""" ids = ids.flatten() if skip: return ids try: index = list(ids).index(text_encoder.EOS_ID) return ids[0:index] except ValueError: # No EOS_ID: return the array as-is. return ids
python
def _save_until_eos(ids, skip=False): """Strips everything after the first <EOS> token, which is normally 1.""" ids = ids.flatten() if skip: return ids try: index = list(ids).index(text_encoder.EOS_ID) return ids[0:index] except ValueError: # No EOS_ID: return the array as-is. return ids
[ "def", "_save_until_eos", "(", "ids", ",", "skip", "=", "False", ")", ":", "ids", "=", "ids", ".", "flatten", "(", ")", "if", "skip", ":", "return", "ids", "try", ":", "index", "=", "list", "(", "ids", ")", ".", "index", "(", "text_encoder", ".", "EOS_ID", ")", "return", "ids", "[", "0", ":", "index", "]", "except", "ValueError", ":", "# No EOS_ID: return the array as-is.", "return", "ids" ]
Strips everything after the first <EOS> token, which is normally 1.
[ "Strips", "everything", "after", "the", "first", "<EOS", ">", "token", "which", "is", "normally", "1", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L879-L889
train
Strips everything after the first <EOS > token which is normally 1.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIA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2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + '\x31' + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(10054 - 9943) + chr(0b110010) + chr(0b110001 + 0o4) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1570 - 1520) + chr(1195 - 1143) + '\067', 55849 - 55841), ehT0Px3KOsy9('\060' + chr(4469 - 4358) + chr(1147 - 1097) + chr(0b110100) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1371 - 1323) + '\x6f' + chr(0b110000 + 0o3) + chr(0b11000 + 0o34) + chr(0b10101 + 0o34), 41603 - 41595), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b111111 + 0o60) + '\x36' + '\x37', 22914 - 22906), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + '\x33' + '\065' + chr(48), 28125 - 28117), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + '\x31' + '\x36' + chr(2597 - 2542), 45988 - 45980), ehT0Px3KOsy9(chr(701 - 653) + chr(0b1100100 + 0o13) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(0b110001) + '\060' + '\066', 0o10), ehT0Px3KOsy9(chr(1305 - 1257) + chr(0b1101111) + '\x32' + '\x33' + chr(0b100010 + 0o25), 0o10), ehT0Px3KOsy9(chr(1924 - 1876) + '\x6f' + chr(51) + chr(0b110110) + chr(1894 - 1846), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11111 + 0o24) + '\063' + '\063', 63185 - 63177), ehT0Px3KOsy9(chr(914 - 866) + '\x6f' + '\x31' + chr(54) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(995 - 947) + chr(111) + chr(0b1 + 0o60) + chr(0b110001) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b110011) + chr(379 - 330), 15174 - 15166), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b100101 + 0o112) + chr(0b110001) + chr(0b111 + 0o60) + chr(642 - 593), ord("\x08")), ehT0Px3KOsy9(chr(124 - 76) + '\x6f' + '\x31' + chr(54) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7899 - 7788) + chr(0b110011) + chr(0b110001) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(596 - 544) + chr(0b110000), 16909 - 16901), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(664 - 611) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + '\x31' + '\x36' + chr(0b100111 + 0o15), 8), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + '\x31' + chr(1437 - 1385) + '\060', 0o10), ehT0Px3KOsy9(chr(839 - 791) + '\157' + chr(50) + '\062' + chr(0b11110 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(85 - 37) + '\x6f' + chr(49) + chr(0b11100 + 0o25) + chr(1780 - 1732), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + chr(0b110011) + chr(53) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + '\x33' + chr(2393 - 2338) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x37' + chr(0b101 + 0o53), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(2668 - 2615) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(51) + chr(240 - 185), 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(7845 - 7734) + chr(49) + chr(0b100011 + 0o23), 64262 - 64254), ehT0Px3KOsy9(chr(452 - 404) + '\157' + chr(51) + '\065' + '\066', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(0b110010) + chr(0b10110 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110 + 0o151) + '\x33' + chr(2655 - 2601) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(5505 - 5394) + chr(0b100110 + 0o15) + '\x33' + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\061' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1118 - 1070) + chr(0b10111 + 0o130) + chr(1103 - 1053) + '\067' + chr(0b110110 + 0o1), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(0b110010) + chr(0b110000 + 0o1) + chr(765 - 710), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110010) + '\065', 48023 - 48015), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101001 + 0o6) + '\061' + '\x33' + chr(0b110100), 12041 - 12033)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + '\x35' + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'$'), chr(100) + chr(101) + chr(0b110110 + 0o55) + chr(11803 - 11692) + chr(0b1100100) + chr(0b1100 + 0o131))('\x75' + chr(116) + chr(102) + '\x2d' + chr(0b11110 + 0o32)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def M0l7BzX3KemY(zdjj2pRemk_P, tU3KFflKK59b=ehT0Px3KOsy9(chr(1358 - 1310) + chr(11800 - 11689) + '\060', ord("\x08"))): zdjj2pRemk_P = zdjj2pRemk_P.flatten() if tU3KFflKK59b: return zdjj2pRemk_P try: XdowRbJKZWL9 = YyaZ4tpXu4lf(zdjj2pRemk_P).XdowRbJKZWL9(nCRDzZ_Is9fz.EOS_ID) return zdjj2pRemk_P[ehT0Px3KOsy9(chr(48) + chr(111) + chr(48), 8):XdowRbJKZWL9] except q1QCh3W88sgk: return zdjj2pRemk_P
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_interactive_input_tensor_to_features_dict
def _interactive_input_tensor_to_features_dict(feature_map, hparams): """Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder. """ inputs = tf.convert_to_tensor(feature_map["inputs"]) input_is_image = False if len(inputs.get_shape()) < 3 else True x = inputs if input_is_image: x = tf.image.resize_images(x, [299, 299]) x = tf.reshape(x, [1, 299, 299, -1]) x = tf.to_int32(x) else: # Remove the batch dimension. num_samples = x[0] length = x[2] x = tf.slice(x, [3], tf.to_int32([length])) x = tf.reshape(x, [1, -1, 1, 1]) # Transform into a batch of size num_samples to get that many random # decodes. x = tf.tile(x, tf.to_int32([num_samples, 1, 1, 1])) p_hparams = hparams.problem_hparams input_space_id = tf.constant(p_hparams.input_space_id) target_space_id = tf.constant(p_hparams.target_space_id) features = {} features["input_space_id"] = input_space_id features["target_space_id"] = target_space_id features["decode_length"] = ( IMAGE_DECODE_LENGTH if input_is_image else inputs[1]) features["inputs"] = x return features
python
def _interactive_input_tensor_to_features_dict(feature_map, hparams): """Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder. """ inputs = tf.convert_to_tensor(feature_map["inputs"]) input_is_image = False if len(inputs.get_shape()) < 3 else True x = inputs if input_is_image: x = tf.image.resize_images(x, [299, 299]) x = tf.reshape(x, [1, 299, 299, -1]) x = tf.to_int32(x) else: # Remove the batch dimension. num_samples = x[0] length = x[2] x = tf.slice(x, [3], tf.to_int32([length])) x = tf.reshape(x, [1, -1, 1, 1]) # Transform into a batch of size num_samples to get that many random # decodes. x = tf.tile(x, tf.to_int32([num_samples, 1, 1, 1])) p_hparams = hparams.problem_hparams input_space_id = tf.constant(p_hparams.input_space_id) target_space_id = tf.constant(p_hparams.target_space_id) features = {} features["input_space_id"] = input_space_id features["target_space_id"] = target_space_id features["decode_length"] = ( IMAGE_DECODE_LENGTH if input_is_image else inputs[1]) features["inputs"] = x return features
[ "def", "_interactive_input_tensor_to_features_dict", "(", "feature_map", ",", "hparams", ")", ":", "inputs", "=", "tf", ".", "convert_to_tensor", "(", "feature_map", "[", "\"inputs\"", "]", ")", "input_is_image", "=", "False", "if", "len", "(", "inputs", ".", "get_shape", "(", ")", ")", "<", "3", "else", "True", "x", "=", "inputs", "if", "input_is_image", ":", "x", "=", "tf", ".", "image", ".", "resize_images", "(", "x", ",", "[", "299", ",", "299", "]", ")", "x", "=", "tf", ".", "reshape", "(", "x", ",", "[", "1", ",", "299", ",", "299", ",", "-", "1", "]", ")", "x", "=", "tf", ".", "to_int32", "(", "x", ")", "else", ":", "# Remove the batch dimension.", "num_samples", "=", "x", "[", "0", "]", "length", "=", "x", "[", "2", "]", "x", "=", "tf", ".", "slice", "(", "x", ",", "[", "3", "]", ",", "tf", ".", "to_int32", "(", "[", "length", "]", ")", ")", "x", "=", "tf", ".", "reshape", "(", "x", ",", "[", "1", ",", "-", "1", ",", "1", ",", "1", "]", ")", "# Transform into a batch of size num_samples to get that many random", "# decodes.", "x", "=", "tf", ".", "tile", "(", "x", ",", "tf", ".", "to_int32", "(", "[", "num_samples", ",", "1", ",", "1", ",", "1", "]", ")", ")", "p_hparams", "=", "hparams", ".", "problem_hparams", "input_space_id", "=", "tf", ".", "constant", "(", "p_hparams", ".", "input_space_id", ")", "target_space_id", "=", "tf", ".", "constant", "(", "p_hparams", ".", "target_space_id", ")", "features", "=", "{", "}", "features", "[", "\"input_space_id\"", "]", "=", "input_space_id", "features", "[", "\"target_space_id\"", "]", "=", "target_space_id", "features", "[", "\"decode_length\"", "]", "=", "(", "IMAGE_DECODE_LENGTH", "if", "input_is_image", "else", "inputs", "[", "1", "]", ")", "features", "[", "\"inputs\"", "]", "=", "x", "return", "features" ]
Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder.
[ "Convert", "the", "interactive", "input", "format", "(", "see", "above", ")", "to", "a", "dictionary", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500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Rbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1011010 + 0o25) + '\062' + chr(52) + chr(0b110000), 11960 - 11952), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11000 + 0o31) + chr(2339 - 2286) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(0b110001) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(52), 13076 - 13068), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(583 - 532) + chr(0b11010 + 0o33) + chr(0b11010 + 0o30), 33048 - 33040), ehT0Px3KOsy9(chr(1285 - 1237) + chr(111) + chr(0b10110 + 0o34) + chr(0b110010) + '\x33', 18150 - 18142), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(52) + chr(0b101111 + 0o10), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(0b110011) + chr(1459 - 1409) + chr(1493 - 1442), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\x33' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110101) + chr(0b110010), 24886 - 24878), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\x32' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1 + 0o60) + chr(1446 - 1391) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + '\x31' + '\067' + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(49) + chr(54) + '\065', 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(0b100101 + 0o14) + chr(0b10011 + 0o42) + chr(0b101110 + 0o11), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(1632 - 1578) + '\x33', 63043 - 63035), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\063' + chr(0b11001 + 0o35), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(55), 0b1000), ehT0Px3KOsy9(chr(2035 - 1987) + '\157' + chr(0b110001) + chr(0b110010) + chr(0b1011 + 0o50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b100100 + 0o21) + '\064', 45456 - 45448), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(48) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b100010 + 0o25) + chr(0b110 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(50) + chr(2186 - 2134) + chr(0b110110 + 0o0), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1962 - 1913) + chr(50) + chr(0b110011), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\064' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(54) + chr(51), 0o10), ehT0Px3KOsy9(chr(1084 - 1036) + '\x6f' + '\061' + chr(48) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(55) + '\064', 0o10), ehT0Px3KOsy9(chr(2253 - 2205) + chr(0b101000 + 0o107) + '\065' + '\065', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11011 + 0o30) + chr(55) + '\065', 45525 - 45517), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100) + chr(0b10110 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(968 - 920) + chr(0b100011 + 0o114) + chr(0b110010 + 0o2) + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2296 - 2247) + chr(369 - 320), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\061', 8), ehT0Px3KOsy9('\060' + '\157' + chr(2269 - 2220) + chr(49) + '\x33', 28019 - 28011), ehT0Px3KOsy9(chr(187 - 139) + chr(0b1101111) + chr(0b1100 + 0o46) + chr(0b101110 + 0o11) + chr(1747 - 1692), ord("\x08")), ehT0Px3KOsy9(chr(1863 - 1815) + chr(111) + chr(49) + chr(0b110000) + '\x34', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\064' + chr(0b110100), 11345 - 11337)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(481 - 428) + chr(0b10001 + 0o37), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e'), chr(6137 - 6037) + '\x65' + '\143' + chr(3552 - 3441) + chr(100) + '\x65')(chr(0b1011110 + 0o27) + '\164' + chr(7675 - 7573) + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def hRM6qOp6s9pL(_kv7JS3YtL4P, n4ljua2gi1Pr): vXoupepMtCXU = IDJ2eXGCBCDu.convert_to_tensor(_kv7JS3YtL4P[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\x05}`h\x99'), chr(0b101000 + 0o74) + chr(0b100101 + 0o100) + chr(99) + chr(9005 - 8894) + chr(0b1100100) + chr(4464 - 4363))('\x75' + chr(4136 - 4020) + '\x66' + '\x2d' + '\070')]) O1nkeHsIoU6W = ehT0Px3KOsy9(chr(106 - 58) + chr(0b1101011 + 0o4) + chr(48), 0b1000) if c2A0yzQpDQB3(vXoupepMtCXU.get_shape()) < ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011), 50777 - 50769) else ehT0Px3KOsy9(chr(48) + '\157' + '\061', 0o10) OeWW0F1dBPRQ = vXoupepMtCXU if O1nkeHsIoU6W: OeWW0F1dBPRQ = IDJ2eXGCBCDu.image.resize_images(OeWW0F1dBPRQ, [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\064' + '\x35' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b100000 + 0o117) + chr(0b110100) + chr(53) + '\x33', 8)]) OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [ehT0Px3KOsy9(chr(48) + chr(111) + '\061', 8), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(52) + '\065' + '\063', 8), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + chr(52) + chr(0b101 + 0o60) + chr(0b110011), 8), -ehT0Px3KOsy9('\060' + '\157' + chr(49), 8)]) OeWW0F1dBPRQ = IDJ2eXGCBCDu.to_int32(OeWW0F1dBPRQ) else: Wuetkhsbidt0 = OeWW0F1dBPRQ[ehT0Px3KOsy9(chr(1845 - 1797) + chr(111) + chr(48), 8)] CHAOgk5VCHH_ = OeWW0F1dBPRQ[ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + chr(0b1001 + 0o51), ord("\x08"))] OeWW0F1dBPRQ = IDJ2eXGCBCDu.slice(OeWW0F1dBPRQ, [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1010 + 0o51), 8)], IDJ2eXGCBCDu.to_int32([CHAOgk5VCHH_])) OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061', 8), -ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8), ehT0Px3KOsy9(chr(317 - 269) + chr(0b1101111) + chr(0b100000 + 0o21), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49), 8)]) OeWW0F1dBPRQ = IDJ2eXGCBCDu.tile(OeWW0F1dBPRQ, IDJ2eXGCBCDu.to_int32([Wuetkhsbidt0, ehT0Px3KOsy9(chr(0b110000) + chr(0b1100011 + 0o14) + chr(49), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101010 + 0o7), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8)])) bb9KhnGWdDAt = n4ljua2gi1Pr.sXqesioLf7Ji Fj2ITAWgKC7G = IDJ2eXGCBCDu.constant(bb9KhnGWdDAt.Fj2ITAWgKC7G) F_zsiH5GNezn = IDJ2eXGCBCDu.constant(bb9KhnGWdDAt.F_zsiH5GNezn) EEf4r9nUvta_ = {} EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\x05}`h\xb5\xe0W\xb2=O\xcf\x17\x1f'), chr(0b1100100) + '\145' + '\143' + chr(1553 - 1442) + '\x64' + chr(101))(chr(0b1 + 0o164) + '\164' + '\146' + chr(0b10101 + 0o30) + chr(0b111000))] = Fj2ITAWgKC7G EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\n\x7fry\x9e\xccT\xa3?I\xf5!\x12\x11'), chr(0b1010001 + 0o23) + '\145' + chr(9731 - 9632) + chr(0b1101111) + chr(0b101001 + 0o73) + chr(9584 - 9483))(chr(3194 - 3077) + '\x74' + chr(302 - 200) + '\055' + chr(0b110111 + 0o1))] = F_zsiH5GNezn EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4\x0enzx\x8f\xccK\xb60M\xe4\x16'), chr(8120 - 8020) + '\145' + chr(0b1100000 + 0o3) + '\x6f' + '\x64' + chr(101))(chr(0b1101011 + 0o12) + '\x74' + '\x66' + '\x2d' + '\070')] = nwo6FQ1_OSPA if O1nkeHsIoU6W else vXoupepMtCXU[ehT0Px3KOsy9('\060' + chr(2379 - 2268) + chr(0b11000 + 0o31), 8)] EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\x05}`h\x99'), chr(100) + '\145' + chr(0b1100011) + '\157' + chr(0b100011 + 0o101) + '\145')(chr(117) + chr(0b1110100) + '\146' + chr(0b101101) + '\070')] = OeWW0F1dBPRQ return EEf4r9nUvta_
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
_decode_input_tensor_to_features_dict
def _decode_input_tensor_to_features_dict(feature_map, hparams): """Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder. """ inputs = tf.convert_to_tensor(feature_map["inputs"]) input_is_image = False x = inputs p_hparams = hparams.problem_hparams # Add a third empty dimension x = tf.expand_dims(x, axis=[2]) x = tf.to_int32(x) input_space_id = tf.constant(p_hparams.input_space_id) target_space_id = tf.constant(p_hparams.target_space_id) features = {} features["input_space_id"] = input_space_id features["target_space_id"] = target_space_id features["decode_length"] = ( IMAGE_DECODE_LENGTH if input_is_image else tf.shape(x)[1] + 50) features["inputs"] = x return features
python
def _decode_input_tensor_to_features_dict(feature_map, hparams): """Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder. """ inputs = tf.convert_to_tensor(feature_map["inputs"]) input_is_image = False x = inputs p_hparams = hparams.problem_hparams # Add a third empty dimension x = tf.expand_dims(x, axis=[2]) x = tf.to_int32(x) input_space_id = tf.constant(p_hparams.input_space_id) target_space_id = tf.constant(p_hparams.target_space_id) features = {} features["input_space_id"] = input_space_id features["target_space_id"] = target_space_id features["decode_length"] = ( IMAGE_DECODE_LENGTH if input_is_image else tf.shape(x)[1] + 50) features["inputs"] = x return features
[ "def", "_decode_input_tensor_to_features_dict", "(", "feature_map", ",", "hparams", ")", ":", "inputs", "=", "tf", ".", "convert_to_tensor", "(", "feature_map", "[", "\"inputs\"", "]", ")", "input_is_image", "=", "False", "x", "=", "inputs", "p_hparams", "=", "hparams", ".", "problem_hparams", "# Add a third empty dimension", "x", "=", "tf", ".", "expand_dims", "(", "x", ",", "axis", "=", "[", "2", "]", ")", "x", "=", "tf", ".", "to_int32", "(", "x", ")", "input_space_id", "=", "tf", ".", "constant", "(", "p_hparams", ".", "input_space_id", ")", "target_space_id", "=", "tf", ".", "constant", "(", "p_hparams", ".", "target_space_id", ")", "features", "=", "{", "}", "features", "[", "\"input_space_id\"", "]", "=", "input_space_id", "features", "[", "\"target_space_id\"", "]", "=", "target_space_id", "features", "[", "\"decode_length\"", "]", "=", "(", "IMAGE_DECODE_LENGTH", "if", "input_is_image", "else", "tf", ".", "shape", "(", "x", ")", "[", "1", "]", "+", "50", ")", "features", "[", "\"inputs\"", "]", "=", "x", "return", "features" ]
Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder.
[ "Convert", "the", "interactive", "input", "format", "(", "see", "above", ")", "to", "a", "dictionary", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L933-L960
train
Convert the interactive input format to a dictionary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw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DU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110100) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + chr(2492 - 2441) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(0b110010) + '\067' + chr(0b11100 + 0o33), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x36' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(1911 - 1862) + '\x35', 49279 - 49271), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(52) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(2148 - 2100) + '\x6f' + chr(2201 - 2152) + chr(340 - 286) + chr(0b100100 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\064' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b10 + 0o155) + chr(0b10000 + 0o41) + '\061' + chr(53), 29737 - 29729), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b10011 + 0o35) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + '\064', 0o10), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + chr(49) + chr(0b110011) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1110 + 0o44) + chr(0b110000) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(48) + chr(0b100 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + '\063' + '\065', 8357 - 8349), ehT0Px3KOsy9(chr(48) + chr(111) + '\065', 11893 - 11885), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1111 + 0o43) + chr(2047 - 1998) + '\x31', 40098 - 40090), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1011 + 0o47) + chr(0b110000) + chr(55), 30356 - 30348), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b100011 + 0o114) + '\x36' + '\x33', 0o10), ehT0Px3KOsy9(chr(1186 - 1138) + chr(0b100101 + 0o112) + chr(2365 - 2314) + chr(130 - 79) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b101011 + 0o104) + chr(0b110001) + chr(52) + '\064', 8), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x30' + chr(0b110010), 23632 - 23624), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(49) + chr(51) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x34' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1803 - 1755) + chr(0b1101111) + chr(948 - 894) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\062' + '\x36', 23576 - 23568), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b101111 + 0o4) + '\x34', 49278 - 49270), ehT0Px3KOsy9('\x30' + chr(875 - 764) + '\062' + chr(0b101010 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110111) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + chr(50) + '\x36' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(336 - 288) + chr(111) + chr(0b110101) + chr(0b101 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110001) + chr(2262 - 2207), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1000 + 0o57) + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(2116 - 2065) + chr(0b101110 + 0o3) + chr(902 - 849), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b1100 + 0o45) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\067' + '\x32', 28731 - 28723), ehT0Px3KOsy9(chr(48) + chr(0b100 + 0o153) + '\061' + '\x35' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b101010 + 0o12) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2203 - 2154) + '\x33' + '\x32', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + chr(0b110000), 6070 - 6062)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'M'), chr(2626 - 2526) + chr(2182 - 2081) + '\143' + chr(0b1101111) + chr(6216 - 6116) + chr(0b1000101 + 0o40))('\165' + chr(116) + chr(0b1100110) + '\x2d' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def eP2Fingmc0IP(_kv7JS3YtL4P, n4ljua2gi1Pr): vXoupepMtCXU = IDJ2eXGCBCDu.convert_to_tensor(_kv7JS3YtL4P[xafqLlk3kkUe(SXOLrMavuUCe(b'\nt\xcfv\x02\xfe'), chr(1518 - 1418) + '\x65' + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(101))(chr(3495 - 3378) + chr(0b111101 + 0o67) + chr(0b1100110) + '\x2d' + '\070')]) O1nkeHsIoU6W = ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1000100 + 0o53) + '\x30', 0o10) OeWW0F1dBPRQ = vXoupepMtCXU bb9KhnGWdDAt = n4ljua2gi1Pr.sXqesioLf7Ji OeWW0F1dBPRQ = IDJ2eXGCBCDu.expand_dims(OeWW0F1dBPRQ, axis=[ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101010 + 0o10), ord("\x08"))]) OeWW0F1dBPRQ = IDJ2eXGCBCDu.to_int32(OeWW0F1dBPRQ) Fj2ITAWgKC7G = IDJ2eXGCBCDu.constant(bb9KhnGWdDAt.Fj2ITAWgKC7G) F_zsiH5GNezn = IDJ2eXGCBCDu.constant(bb9KhnGWdDAt.F_zsiH5GNezn) EEf4r9nUvta_ = {} EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\nt\xcfv\x02\xd2\xd1\x07\x05.\xe6s7\xe0'), chr(2318 - 2218) + chr(101) + chr(9453 - 9354) + chr(566 - 455) + chr(0b1100000 + 0o4) + chr(0b100 + 0o141))(chr(0b1110101) + chr(116) + '\146' + chr(0b101101) + chr(1270 - 1214))] = Fj2ITAWgKC7G EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\x17{\xcdd\x13\xf9\xfd\x04\x14,\xe0I\x01\xed\xa7'), chr(0b1010101 + 0o17) + chr(312 - 211) + '\x63' + chr(5905 - 5794) + chr(0b1010000 + 0o24) + '\x65')(chr(5748 - 5631) + chr(0b10101 + 0o137) + chr(6557 - 6455) + '\x2d' + chr(2557 - 2501))] = F_zsiH5GNezn EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x7f\xdcl\x12\xe8\xfd\x1b\x01#\xe4X6'), chr(100) + '\x65' + chr(0b1100011) + chr(10055 - 9944) + chr(100) + chr(0b11 + 0o142))(chr(0b1010100 + 0o41) + chr(0b101101 + 0o107) + '\146' + chr(0b101101) + chr(56))] = nwo6FQ1_OSPA if O1nkeHsIoU6W else IDJ2eXGCBCDu.nauYfLglTpcb(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(8992 - 8881) + chr(0b1 + 0o60), ord("\x08"))] + ehT0Px3KOsy9(chr(1020 - 972) + chr(3999 - 3888) + chr(0b10110 + 0o40) + chr(0b10001 + 0o41), ord("\x08")) EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'\nt\xcfv\x02\xfe'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(1234 - 1134) + chr(101))('\165' + chr(116) + chr(0b1000011 + 0o43) + chr(0b101101) + chr(0b111000))] = OeWW0F1dBPRQ return EEf4r9nUvta_
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
run_postdecode_hooks
def run_postdecode_hooks(decode_hook_args, dataset_split): """Run hooks after decodes have run.""" hooks = decode_hook_args.problem.decode_hooks if not hooks: return global_step = latest_checkpoint_step(decode_hook_args.estimator.model_dir) if global_step is None: tf.logging.info( "Skipping decode hooks because no checkpoint yet available.") return tf.logging.info("Running decode hooks.") parent_dir = os.path.join(decode_hook_args.output_dirs[0], os.pardir) child_dir = decode_hook_args.decode_hparams.summaries_log_dir if dataset_split is not None: child_dir += "_{}".format(dataset_split) final_dir = os.path.join(parent_dir, child_dir) summary_writer = tf.summary.FileWriter(final_dir) for hook in hooks: # Isolate each hook in case it creates TF ops with tf.Graph().as_default(): summaries = hook(decode_hook_args) if summaries: summary = tf.Summary(value=list(summaries)) summary_writer.add_summary(summary, global_step) summary_writer.close() tf.logging.info("Decode hooks done.")
python
def run_postdecode_hooks(decode_hook_args, dataset_split): """Run hooks after decodes have run.""" hooks = decode_hook_args.problem.decode_hooks if not hooks: return global_step = latest_checkpoint_step(decode_hook_args.estimator.model_dir) if global_step is None: tf.logging.info( "Skipping decode hooks because no checkpoint yet available.") return tf.logging.info("Running decode hooks.") parent_dir = os.path.join(decode_hook_args.output_dirs[0], os.pardir) child_dir = decode_hook_args.decode_hparams.summaries_log_dir if dataset_split is not None: child_dir += "_{}".format(dataset_split) final_dir = os.path.join(parent_dir, child_dir) summary_writer = tf.summary.FileWriter(final_dir) for hook in hooks: # Isolate each hook in case it creates TF ops with tf.Graph().as_default(): summaries = hook(decode_hook_args) if summaries: summary = tf.Summary(value=list(summaries)) summary_writer.add_summary(summary, global_step) summary_writer.close() tf.logging.info("Decode hooks done.")
[ "def", "run_postdecode_hooks", "(", "decode_hook_args", ",", "dataset_split", ")", ":", "hooks", "=", "decode_hook_args", ".", "problem", ".", "decode_hooks", "if", "not", "hooks", ":", "return", "global_step", "=", "latest_checkpoint_step", "(", "decode_hook_args", ".", "estimator", ".", "model_dir", ")", "if", "global_step", "is", "None", ":", "tf", ".", "logging", ".", "info", "(", "\"Skipping decode hooks because no checkpoint yet available.\"", ")", "return", "tf", ".", "logging", ".", "info", "(", "\"Running decode hooks.\"", ")", "parent_dir", "=", "os", ".", "path", ".", "join", "(", "decode_hook_args", ".", "output_dirs", "[", "0", "]", ",", "os", ".", "pardir", ")", "child_dir", "=", "decode_hook_args", ".", "decode_hparams", ".", "summaries_log_dir", "if", "dataset_split", "is", "not", "None", ":", "child_dir", "+=", "\"_{}\"", ".", "format", "(", "dataset_split", ")", "final_dir", "=", "os", ".", "path", ".", "join", "(", "parent_dir", ",", "child_dir", ")", "summary_writer", "=", "tf", ".", "summary", ".", "FileWriter", "(", "final_dir", ")", "for", "hook", "in", "hooks", ":", "# Isolate each hook in case it creates TF ops", "with", "tf", ".", "Graph", "(", ")", ".", "as_default", "(", ")", ":", "summaries", "=", "hook", "(", "decode_hook_args", ")", "if", "summaries", ":", "summary", "=", "tf", ".", "Summary", "(", "value", "=", "list", "(", "summaries", ")", ")", "summary_writer", ".", "add_summary", "(", "summary", ",", "global_step", ")", "summary_writer", ".", "close", "(", ")", "tf", ".", "logging", ".", "info", "(", "\"Decode hooks done.\"", ")" ]
Run hooks after decodes have run.
[ "Run", "hooks", "after", "decodes", "have", "run", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L982-L1008
train
Run hooks after decodes have run.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4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HEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(53) + chr(523 - 472), ord("\x08")), ehT0Px3KOsy9(chr(460 - 412) + chr(111) + chr(0b1100 + 0o45) + chr(0b110100) + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(9099 - 8988) + '\063' + chr(54) + chr(2297 - 2248), 25532 - 25524), ehT0Px3KOsy9('\060' + chr(111) + chr(55) + chr(1227 - 1179), 0b1000), ehT0Px3KOsy9('\060' + chr(10177 - 10066) + chr(2258 - 2203) + '\x30', 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1001001 + 0o46) + chr(51) + chr(0b110110) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(50) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(2259 - 2208) + chr(0b10010 + 0o40), 56414 - 56406), ehT0Px3KOsy9('\x30' + chr(111) + chr(448 - 399) + '\066' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110110) + chr(0b110 + 0o52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11340 - 11229) + chr(49) + chr(0b10010 + 0o43) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(3157 - 3046) + chr(51) + chr(51) + chr(0b110100), 31696 - 31688), ehT0Px3KOsy9(chr(48) + '\157' + chr(1679 - 1624) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\x33' + chr(0b110011), 21389 - 21381), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b10110 + 0o37) + chr(1342 - 1294), 0b1000), ehT0Px3KOsy9(chr(716 - 668) + chr(0b110100 + 0o73) + chr(0b110001) + chr(0b11010 + 0o34) + chr(0b110001 + 0o2), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(1632 - 1581) + '\x32' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + '\067' + chr(0b1010 + 0o53), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(1006 - 957) + chr(2561 - 2506), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x34' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b10100 + 0o37) + chr(0b11101 + 0o24) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1189 - 1139) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(3426 - 3315) + chr(0b110011) + '\x30' + chr(0b100011 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b100000 + 0o21) + chr(0b100000 + 0o21) + chr(207 - 152), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(51) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110000), 206 - 198), ehT0Px3KOsy9(chr(0b110000) + chr(4210 - 4099) + chr(2366 - 2316) + chr(0b110001) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b110110) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(3446 - 3335) + chr(50) + chr(0b101101 + 0o5) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001 + 0o4) + chr(776 - 725), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(0b100101 + 0o14), 60699 - 60691), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x35' + chr(0b10001 + 0o44), 39262 - 39254), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(119 - 69) + '\x35' + chr(0b100111 + 0o17), 51978 - 51970), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b11001 + 0o36), 57195 - 57187), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100011 + 0o14) + chr(103 - 54) + chr(1760 - 1707) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b1110 + 0o47) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\x36' + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(0b100110 + 0o16) + '\060', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53) + chr(0b0 + 0o60), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x05'), chr(100) + chr(101) + chr(99) + chr(111) + '\144' + chr(0b11101 + 0o110))(chr(8615 - 8498) + '\x74' + '\146' + chr(45) + chr(0b10010 + 0o46)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def oJMfSdtl4_t2(azdXwnhb45_0, XqbfPmad1kJ4): rxW1_nsw8u9L = azdXwnhb45_0.problem.decode_hooks if not rxW1_nsw8u9L: return tnqEWmPx71Oj = ATQSMRPsCSvL(azdXwnhb45_0.estimator.model_dir) if tnqEWmPx71Oj is None: xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'xVT\x89M[\x91\xe10\x1e*\x02'), chr(0b1001 + 0o133) + chr(7803 - 7702) + chr(1197 - 1098) + chr(9624 - 9513) + chr(3328 - 3228) + '\x65')('\165' + chr(116) + chr(6950 - 6848) + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'x\nu\x81HQ\x98\xb1z\x16\x15\nj\xb8^{\x00\x1c\xb8\x96\xbc\x00\xaap\xa2.\xa8c\xea\x92\xfdD!\x8e\xc6r\x08\x05\x07\x8fB\x0fh\xd1A]\x82\xf6;\x04\x11\x00i\xbdY7\r]'), chr(0b1100100) + '\145' + chr(1926 - 1827) + chr(111) + chr(0b100000 + 0o104) + chr(6515 - 6414))('\165' + chr(0b1110100) + '\x66' + chr(0b100100 + 0o11) + chr(0b10001 + 0o47))) return xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'xVT\x89M[\x91\xe10\x1e*\x02'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(111) + chr(0b1011110 + 0o6) + '\145')(chr(0b1110101) + chr(116) + chr(4121 - 4019) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'y\x14r\x9fQV\x91\xf6>\x17\x13\x06a\xb9\x1b3\x07\x1c\xbc\x8e\xe1'), chr(100) + '\145' + '\x63' + '\157' + chr(0b10010 + 0o122) + '\145')(chr(0b10001 + 0o144) + '\164' + '\x66' + '\x2d' + chr(56))) bsdJzEjGYYxg = oqhJDdMJfuwx.path.join(azdXwnhb45_0.output_dirs[ehT0Px3KOsy9(chr(812 - 764) + '\157' + chr(2174 - 2126), 0b1000)], oqhJDdMJfuwx.pardir) SFhNrnqLHTmk = azdXwnhb45_0.decode_hparams.summaries_log_dir if XqbfPmad1kJ4 is not None: SFhNrnqLHTmk += xafqLlk3kkUe(SXOLrMavuUCe(b't\x1aa'), chr(0b1100100) + chr(0b1111 + 0o126) + chr(0b1100011) + '\x6f' + '\144' + chr(0b1000001 + 0o44))('\165' + chr(0b1011111 + 0o25) + chr(0b100101 + 0o101) + chr(0b101101) + chr(56)).V4roHaS3Ppej(XqbfPmad1kJ4) Vpg5pBRYRIgZ = oqhJDdMJfuwx.path.join(bsdJzEjGYYxg, SFhNrnqLHTmk) S5uPA4n8ItHK = IDJ2eXGCBCDu.summary.FileWriter(Vpg5pBRYRIgZ) for SjzcWMjGgX7L in rxW1_nsw8u9L: with xafqLlk3kkUe(IDJ2eXGCBCDu.Graph(), xafqLlk3kkUe(SXOLrMavuUCe(b'J\x12C\x95]^\x97\xa36\x06'), '\x64' + chr(101) + chr(0b101110 + 0o65) + '\x6f' + chr(0b1100100) + '\x65')('\165' + chr(1109 - 993) + chr(4483 - 4381) + chr(0b11 + 0o52) + '\x38'))(): Ss61w8pBYeZH = SjzcWMjGgX7L(azdXwnhb45_0) if Ss61w8pBYeZH: oLgyQ45ORWXM = IDJ2eXGCBCDu.Summary(value=YyaZ4tpXu4lf(Ss61w8pBYeZH)) xafqLlk3kkUe(S5uPA4n8ItHK, xafqLlk3kkUe(SXOLrMavuUCe(b'J\x05x\xaeKM\x9b\xbb;\x00\t'), chr(100) + '\x65' + '\x63' + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(9082 - 8965) + chr(0b111101 + 0o67) + chr(0b110101 + 0o61) + '\x2d' + '\070'))(oLgyQ45ORWXM, tnqEWmPx71Oj) xafqLlk3kkUe(S5uPA4n8ItHK, xafqLlk3kkUe(SXOLrMavuUCe(b'H\rs\x82]'), chr(100) + chr(0b1100101) + chr(99) + chr(0b1001111 + 0o40) + '\144' + chr(101))(chr(117) + '\x74' + '\146' + chr(0b101101 + 0o0) + chr(0b110101 + 0o3)))() xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'xVT\x89M[\x91\xe10\x1e*\x02'), chr(0b1100100) + '\145' + chr(99) + chr(111) + '\144' + chr(101))('\165' + chr(0b1110100) + '\x66' + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'o\x04\x7f\x9e\\]\xd6\xbe5\x1d\x1b\x1a%\xb8T5\r]'), chr(0b1100100) + chr(0b100001 + 0o104) + '\x63' + '\x6f' + '\144' + chr(0b100 + 0o141))('\165' + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000)))
tensorflow/tensor2tensor
tensor2tensor/data_generators/style_transfer.py
StyleTransferProblemShakespeare.dataset_splits
def dataset_splits(self): """Splits of data to produce and number of output shards for each.""" return [{ "split": problem.DatasetSplit.TRAIN, "shards": _TRAIN_SHARDS, }, { "split": problem.DatasetSplit.EVAL, "shards": _DEV_SHARDS, }]
python
def dataset_splits(self): """Splits of data to produce and number of output shards for each.""" return [{ "split": problem.DatasetSplit.TRAIN, "shards": _TRAIN_SHARDS, }, { "split": problem.DatasetSplit.EVAL, "shards": _DEV_SHARDS, }]
[ "def", "dataset_splits", "(", "self", ")", ":", "return", "[", "{", "\"split\"", ":", "problem", ".", "DatasetSplit", ".", "TRAIN", ",", "\"shards\"", ":", "_TRAIN_SHARDS", ",", "}", ",", "{", "\"split\"", ":", "problem", ".", "DatasetSplit", ".", "EVAL", ",", "\"shards\"", ":", "_DEV_SHARDS", ",", "}", "]" ]
Splits of data to produce and number of output shards for each.
[ "Splits", "of", "data", "to", "produce", "and", "number", "of", "output", "shards", "for", "each", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/style_transfer.py#L87-L95
train
Splits of data to produce and number of output shards for each.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB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seException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2482 - 2429) + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(876 - 823), 15309 - 15301), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\x32' + chr(0b110000) + chr(1136 - 1081), 45994 - 45986), ehT0Px3KOsy9(chr(2274 - 2226) + chr(0b1010011 + 0o34) + chr(0b110010) + '\x36' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1666 - 1618) + chr(111) + '\065' + chr(0b110010), 41977 - 41969), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1001100 + 0o43) + chr(49) + chr(0b110101) + '\x37', 54953 - 54945), ehT0Px3KOsy9(chr(668 - 620) + chr(0b1101111) + chr(986 - 937) + chr(0b1001 + 0o55) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b101010 + 0o11) + chr(0b100100 + 0o22), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b110010 + 0o4) + chr(582 - 534), 41881 - 41873), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\065' + chr(0b111 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(289 - 241) + chr(0b11110 + 0o121) + chr(623 - 573) + chr(2312 - 2260) + chr(1901 - 1846), ord("\x08")), ehT0Px3KOsy9(chr(792 - 744) + '\x6f' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(3322 - 3211) + chr(2326 - 2276) + '\x31' + chr(1034 - 986), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11111 + 0o22) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\066' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(112 - 1) + chr(0b0 + 0o63) + chr(0b100011 + 0o15) + chr(1996 - 1948), 0b1000), ehT0Px3KOsy9(chr(48) + chr(12009 - 11898) + '\061' + chr(0b110000 + 0o0) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001011 + 0o44) + chr(2198 - 2147) + '\x30' + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b101 + 0o62) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(478 - 425) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(0b101010 + 0o7) + chr(55) + '\x31', 33941 - 33933), ehT0Px3KOsy9('\060' + '\157' + '\x32' + '\067' + chr(0b110100), 13302 - 13294), ehT0Px3KOsy9(chr(1241 - 1193) + chr(2144 - 2033) + chr(0b0 + 0o63) + chr(0b110100) + '\065', 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(12180 - 12069) + chr(0b0 + 0o61) + '\x36' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8657 - 8546) + chr(51) + chr(2309 - 2255) + chr(51), 0b1000), ehT0Px3KOsy9(chr(718 - 670) + '\x6f' + chr(0b110 + 0o54) + '\065' + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b110011) + chr(1267 - 1214), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110101 + 0o72) + '\063' + '\064' + chr(53), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(1535 - 1486) + chr(55), 50914 - 50906), ehT0Px3KOsy9(chr(116 - 68) + chr(111) + chr(0b11111 + 0o24) + chr(55) + chr(2312 - 2262), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(9603 - 9492) + chr(0b101000 + 0o13) + chr(0b110001) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b110011 + 0o0) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7074 - 6963) + chr(0b10010 + 0o40) + chr(929 - 881) + '\x34', 11491 - 11483), ehT0Px3KOsy9('\x30' + '\x6f' + '\067' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + '\x37' + '\063', 0b1000), ehT0Px3KOsy9(chr(1800 - 1752) + '\157' + chr(49) + chr(54) + chr(0b101110 + 0o2), 8), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + chr(0b110011) + '\x31' + chr(2193 - 2144), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\066', 0o10), ehT0Px3KOsy9(chr(549 - 501) + chr(0b1101111) + chr(49) + chr(0b110001) + '\x32', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(10420 - 10309) + '\065' + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x02'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1100101))('\165' + chr(12800 - 12684) + chr(0b101 + 0o141) + chr(45) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def kqpTgMZ4pC7L(oVre8I6UXc3b): return [{xafqLlk3kkUe(SXOLrMavuUCe(b'_u\xeb\xdb^'), chr(100) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(3843 - 3743) + '\x65')(chr(10878 - 10761) + chr(2037 - 1921) + chr(0b110 + 0o140) + '\x2d' + '\070'): xafqLlk3kkUe(sO7e1A_Mor6Q.DatasetSplit, xafqLlk3kkUe(SXOLrMavuUCe(b'xW\xc6\xfbd'), chr(100) + chr(101) + chr(0b1100011) + '\157' + chr(7433 - 7333) + chr(0b100000 + 0o105))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b10111 + 0o26) + chr(0b111000))), xafqLlk3kkUe(SXOLrMavuUCe(b'_m\xe6\xc0N\x1c'), '\144' + chr(0b101101 + 0o70) + chr(0b1011001 + 0o12) + chr(111) + chr(0b1100100) + '\145')(chr(0b11100 + 0o131) + chr(116) + chr(0b1000001 + 0o45) + chr(45) + '\070'): PJhyksVjIKXd}, {xafqLlk3kkUe(SXOLrMavuUCe(b'_u\xeb\xdb^'), '\144' + '\145' + chr(99) + '\x6f' + chr(100) + chr(0b1010111 + 0o16))(chr(5449 - 5332) + chr(116) + chr(0b1100110) + chr(1175 - 1130) + '\x38'): xafqLlk3kkUe(sO7e1A_Mor6Q.DatasetSplit, xafqLlk3kkUe(SXOLrMavuUCe(b'iS\xc6\xfe'), chr(3129 - 3029) + chr(101) + chr(99) + '\157' + chr(338 - 238) + chr(0b1001111 + 0o26))(chr(117) + chr(116) + chr(0b100011 + 0o103) + chr(0b1101 + 0o40) + '\070')), xafqLlk3kkUe(SXOLrMavuUCe(b'_m\xe6\xc0N\x1c'), chr(0b110010 + 0o62) + chr(101) + chr(0b1011000 + 0o13) + '\157' + chr(100) + chr(7040 - 6939))('\x75' + chr(0b1010011 + 0o41) + chr(0b1011010 + 0o14) + chr(525 - 480) + '\070'): aiLPTTsh6d4R}]
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
local_attention1d_spatial_decoder
def local_attention1d_spatial_decoder(x, kv_dim, heads_dim, feedforward_dim, hparams): """Image Transformer decoder with local1D spatial layers.""" batch_dim, length_dim, model_dim = x.shape.dims blocks_w_dim = mtf.Dimension("blocksw", hparams.block_length) num_w_blocks_dim = mtf.Dimension("num_wblocks", length_dim.size // blocks_w_dim.size) x = mtf.reshape( x, mtf.Shape([batch_dim, num_w_blocks_dim, blocks_w_dim, model_dim])) # [ self attention - ffn - residual + dropout] x n for layer in range(hparams.num_decoder_layers): layer_name = "decoder_layer_%d" % layer with tf.variable_scope(layer_name): # Self attention layer x += layer_prepostprocess_dropout( mtf.layers.local_self_attention_spatial_blocks( mtf.layers.layer_norm(x, model_dim, name="layer_norm_att"), kv_dim, heads_dim, memory_w_dim=blocks_w_dim, mask_right=True, name="self_att"), hparams) # ffn layer x += layer_prepostprocess_dropout( mtf.layers.dense_relu_dense( mtf.layers.layer_norm(x, model_dim, name="layer_norm_ffn"), feedforward_dim, hparams.dropout, dropout_broadcast_dims=[length_dim]), hparams) output = mtf.layers.layer_norm(x, model_dim, name="final_layer_norm") return output
python
def local_attention1d_spatial_decoder(x, kv_dim, heads_dim, feedforward_dim, hparams): """Image Transformer decoder with local1D spatial layers.""" batch_dim, length_dim, model_dim = x.shape.dims blocks_w_dim = mtf.Dimension("blocksw", hparams.block_length) num_w_blocks_dim = mtf.Dimension("num_wblocks", length_dim.size // blocks_w_dim.size) x = mtf.reshape( x, mtf.Shape([batch_dim, num_w_blocks_dim, blocks_w_dim, model_dim])) # [ self attention - ffn - residual + dropout] x n for layer in range(hparams.num_decoder_layers): layer_name = "decoder_layer_%d" % layer with tf.variable_scope(layer_name): # Self attention layer x += layer_prepostprocess_dropout( mtf.layers.local_self_attention_spatial_blocks( mtf.layers.layer_norm(x, model_dim, name="layer_norm_att"), kv_dim, heads_dim, memory_w_dim=blocks_w_dim, mask_right=True, name="self_att"), hparams) # ffn layer x += layer_prepostprocess_dropout( mtf.layers.dense_relu_dense( mtf.layers.layer_norm(x, model_dim, name="layer_norm_ffn"), feedforward_dim, hparams.dropout, dropout_broadcast_dims=[length_dim]), hparams) output = mtf.layers.layer_norm(x, model_dim, name="final_layer_norm") return output
[ "def", "local_attention1d_spatial_decoder", "(", "x", ",", "kv_dim", ",", "heads_dim", ",", "feedforward_dim", ",", "hparams", ")", ":", "batch_dim", ",", "length_dim", ",", "model_dim", "=", "x", ".", "shape", ".", "dims", "blocks_w_dim", "=", "mtf", ".", "Dimension", "(", "\"blocksw\"", ",", "hparams", ".", "block_length", ")", "num_w_blocks_dim", "=", "mtf", ".", "Dimension", "(", "\"num_wblocks\"", ",", "length_dim", ".", "size", "//", "blocks_w_dim", ".", "size", ")", "x", "=", "mtf", ".", "reshape", "(", "x", ",", "mtf", ".", "Shape", "(", "[", "batch_dim", ",", "num_w_blocks_dim", ",", "blocks_w_dim", ",", "model_dim", "]", ")", ")", "# [ self attention - ffn - residual + dropout] x n", "for", "layer", "in", "range", "(", "hparams", ".", "num_decoder_layers", ")", ":", "layer_name", "=", "\"decoder_layer_%d\"", "%", "layer", "with", "tf", ".", "variable_scope", "(", "layer_name", ")", ":", "# Self attention layer", "x", "+=", "layer_prepostprocess_dropout", "(", "mtf", ".", "layers", ".", "local_self_attention_spatial_blocks", "(", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"layer_norm_att\"", ")", ",", "kv_dim", ",", "heads_dim", ",", "memory_w_dim", "=", "blocks_w_dim", ",", "mask_right", "=", "True", ",", "name", "=", "\"self_att\"", ")", ",", "hparams", ")", "# ffn layer", "x", "+=", "layer_prepostprocess_dropout", "(", "mtf", ".", "layers", ".", "dense_relu_dense", "(", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"layer_norm_ffn\"", ")", ",", "feedforward_dim", ",", "hparams", ".", "dropout", ",", "dropout_broadcast_dims", "=", "[", "length_dim", "]", ")", ",", "hparams", ")", "output", "=", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"final_layer_norm\"", ")", "return", "output" ]
Image Transformer decoder with local1D spatial layers.
[ "Image", "Transformer", "decoder", "with", "local1D", "spatial", "layers", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L252-L283
train
Image Transformer decoder with local1D spatial layers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jL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15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(51) + chr(53) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(289 - 241) + '\x6f' + '\061' + '\x37' + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(3013 - 2902) + '\x33' + chr(1141 - 1088) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\060' + chr(2390 - 2340), 0b1000), ehT0Px3KOsy9('\060' + chr(9035 - 8924) + '\x32' + chr(0b110011) + chr(0b100111 + 0o11), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(54) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101000 + 0o14) + chr(48), 63976 - 63968), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(1081 - 970) + '\062' + '\062' + '\x30', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\065' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\157' + chr(51) + chr(0b10010 + 0o44) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b110011) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(0b100011 + 0o17) + chr(0b110010) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + '\x30' + chr(0b110001 + 0o6), 46082 - 46074), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b110100) + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(1475 - 1422) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(5967 - 5856) + chr(0b110010) + chr(53) + chr(0b110011), 32093 - 32085), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b110010) + '\x32', 42792 - 42784), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(11617 - 11506) + chr(51) + '\066' + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(55) + chr(2080 - 2026), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(174 - 63) + chr(0b11011 + 0o27) + '\061' + '\062', 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b100110 + 0o111) + chr(2370 - 2315) + '\066', 42701 - 42693), ehT0Px3KOsy9(chr(48) + chr(11662 - 11551) + chr(1187 - 1137) + chr(1050 - 999) + chr(1142 - 1087), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(445 - 334) + '\061' + chr(0b110101) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(9866 - 9755) + '\063' + chr(0b110101) + '\063', 8), ehT0Px3KOsy9('\060' + chr(0b1001111 + 0o40) + '\x33' + '\x33' + chr(0b11101 + 0o26), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + '\063' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110100) + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11001 + 0o32) + chr(0b101011 + 0o13) + chr(747 - 697), 0o10), ehT0Px3KOsy9(chr(472 - 424) + '\157' + '\x31' + chr(0b11010 + 0o27) + chr(1415 - 1361), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(4199 - 4088) + chr(170 - 115) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(2238 - 2190) + chr(10548 - 10437) + chr(50) + '\x37' + '\062', 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b10100 + 0o133) + '\067' + chr(51), 49546 - 49538), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\062' + chr(0b110110 + 0o0), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100001 + 0o116) + '\062' + chr(48) + chr(1943 - 1894), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(794 - 744), 1567 - 1559), ehT0Px3KOsy9('\x30' + chr(0b111001 + 0o66) + chr(0b110001) + '\x34' + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(51) + chr(873 - 825), 0o10), ehT0Px3KOsy9(chr(1138 - 1090) + chr(111) + chr(0b110010) + chr(0b110011) + chr(0b10110 + 0o34), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + chr(0b11111 + 0o21), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7'), chr(0b1100100) + chr(0b10111 + 0o116) + chr(5576 - 5477) + '\x6f' + '\x64' + chr(4742 - 4641))('\165' + '\x74' + '\x66' + chr(0b10100 + 0o31) + chr(940 - 884)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def r_u1Eqvrd7aT(OeWW0F1dBPRQ, skdElAbBTKr9, B1_XldK3qehn, m3_JZBN2FRQL, n4ljua2gi1Pr): (EpjjOe8vuYsi, QYJPqG75TqEv, p8LgqJaDQSBu) = OeWW0F1dBPRQ.shape.dims LA7OTnP343fM = n08eHRtHxoln.Dimension(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b\x15n\x88\xa9\xebE'), '\144' + '\145' + chr(3188 - 3089) + chr(0b110101 + 0o72) + chr(0b101001 + 0o73) + chr(0b1100101))(chr(10571 - 10454) + chr(1382 - 1266) + chr(0b1010010 + 0o24) + chr(1696 - 1651) + chr(56)), n4ljua2gi1Pr.MMwtQ0bPonxt) gVR1wP5PUWaD = n08eHRtHxoln.Dimension(xafqLlk3kkUe(SXOLrMavuUCe(b'\x87\x0cl\xb4\xb5\xfa^O\xf3\x87\x85'), '\144' + chr(0b1100101) + chr(6871 - 6772) + '\x6f' + chr(100) + '\145')(chr(0b1110101) + chr(3275 - 3159) + chr(102) + chr(0b101101) + '\070'), QYJPqG75TqEv.NLcc3BCJnQka // LA7OTnP343fM.NLcc3BCJnQka) OeWW0F1dBPRQ = n08eHRtHxoln.reshape(OeWW0F1dBPRQ, n08eHRtHxoln.Shape([EpjjOe8vuYsi, gVR1wP5PUWaD, LA7OTnP343fM, p8LgqJaDQSBu])) for wgamNHppspXj in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x99+h\xdd\x9b\xdesy\xd5\x82\xbe\xec'), chr(0b1100100) + '\145' + chr(0b1001000 + 0o33) + '\157' + chr(100) + chr(0b1100101))(chr(4940 - 4823) + '\164' + '\x66' + chr(0b10101 + 0o30) + '\x38'))): YzJBPucQyDh2 = xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d\x1cb\x84\xa6\xfd@\x7f\xfc\x8d\x8f\xbd\xe5\xd8\x04\x8d'), chr(2919 - 2819) + chr(0b1000101 + 0o40) + chr(0b1100011) + '\x6f' + '\x64' + chr(0b1000011 + 0o42))(chr(0b1110101) + '\164' + chr(0b1010000 + 0o26) + '\x2d' + chr(56)) % wgamNHppspXj with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f\x18s\x82\xa3\xfa^E\xcf\x9f\x95\xb7\xe7\xe2'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1101111) + chr(0b1000001 + 0o43) + chr(0b1100101))(chr(117) + chr(8100 - 7984) + chr(0b1100110) + '\055' + chr(1544 - 1488)))(YzJBPucQyDh2): OeWW0F1dBPRQ += RW_xSzp18UeS(n08eHRtHxoln.layers.local_self_attention_spatial_blocks(n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x18x\x8e\xb0\xc7\\O\xe2\x81\xa9\xb9\xe3\xf3'), chr(100) + chr(0b1100101) + '\143' + '\x6f' + chr(0b1100100) + chr(1320 - 1219))(chr(117) + chr(0b10 + 0o162) + '\x66' + '\x2d' + chr(0b111000))), skdElAbBTKr9, B1_XldK3qehn, memory_w_dim=LA7OTnP343fM, mask_right=ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a\x1cm\x8d\x9d\xf9FT'), '\x64' + chr(0b1100101) + chr(0b110100 + 0o57) + '\x6f' + chr(0b1100100) + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(346 - 301) + '\x38')), n4ljua2gi1Pr) OeWW0F1dBPRQ += RW_xSzp18UeS(n08eHRtHxoln.layers.dense_relu_dense(n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x18x\x8e\xb0\xc7\\O\xe2\x81\xa9\xbe\xf1\xe9'), chr(100) + '\x65' + chr(99) + '\x6f' + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b1000000 + 0o64) + chr(0b1100110) + chr(45) + '\x38')), m3_JZBN2FRQL, n4ljua2gi1Pr.ag0mwEgWzjYv, dropout_broadcast_dims=[QYJPqG75TqEv]), n4ljua2gi1Pr) e1jVqMSBZ01Y = n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f\x10o\x8a\xae\xc7^A\xe9\x89\x84\x87\xf9\xe8S\x84'), '\x64' + '\145' + chr(99) + '\157' + chr(2290 - 2190) + chr(0b1100000 + 0o5))(chr(117) + '\164' + '\x66' + chr(1080 - 1035) + chr(56))) return e1jVqMSBZ01Y
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
local_attention2d_spatial_decoder
def local_attention2d_spatial_decoder(x, kv_dim, heads_dim, feedforward_dim, hparams): """Image Transformer decoder with local2D spatial layers.""" batch_dim, length_dim, model_dim = x.shape.dims blocks_h_dim = mtf.Dimension("blocksh", hparams.block_height) blocks_w_dim = mtf.Dimension("blocksw", hparams.block_width) num_h_blocks_dim = mtf.Dimension("num_h_blocks", hparams.img_len // hparams.block_height) num_w_blocks_dim = mtf.Dimension( "num_w_blocks", hparams.img_len * hparams.num_channels // hparams.block_width) x = mtf.transpose( mtf.reshape( x, mtf.Shape([ batch_dim, num_h_blocks_dim, blocks_h_dim, num_w_blocks_dim, blocks_w_dim, model_dim ])), mtf.Shape([ batch_dim, num_h_blocks_dim, num_w_blocks_dim, blocks_h_dim, blocks_w_dim, model_dim ])) # Image Transformer Decoder # [ self attention - ffn - residual + dropout] x n for layer in range(hparams.num_decoder_layers): layer_name = "decoder_layer_%d" % layer with tf.variable_scope(layer_name): # Self attention layer x += layer_prepostprocess_dropout( mtf.layers.local_2d_self_attention_spatial_blocks( mtf.layers.layer_norm(x, model_dim, name="layer_norm_att"), kv_dim, heads_dim, memory_h_dim=num_h_blocks_dim, memory_w_dim=num_w_blocks_dim, name="self_att"), hparams) # ffn layer x += layer_prepostprocess_dropout( mtf.layers.dense_relu_dense( mtf.layers.layer_norm(x, model_dim, name="layer_norm_ffn"), feedforward_dim, hparams.dropout, dropout_broadcast_dims=[length_dim]), hparams) output = mtf.layers.layer_norm(x, model_dim, name="final_layer_norm") return output
python
def local_attention2d_spatial_decoder(x, kv_dim, heads_dim, feedforward_dim, hparams): """Image Transformer decoder with local2D spatial layers.""" batch_dim, length_dim, model_dim = x.shape.dims blocks_h_dim = mtf.Dimension("blocksh", hparams.block_height) blocks_w_dim = mtf.Dimension("blocksw", hparams.block_width) num_h_blocks_dim = mtf.Dimension("num_h_blocks", hparams.img_len // hparams.block_height) num_w_blocks_dim = mtf.Dimension( "num_w_blocks", hparams.img_len * hparams.num_channels // hparams.block_width) x = mtf.transpose( mtf.reshape( x, mtf.Shape([ batch_dim, num_h_blocks_dim, blocks_h_dim, num_w_blocks_dim, blocks_w_dim, model_dim ])), mtf.Shape([ batch_dim, num_h_blocks_dim, num_w_blocks_dim, blocks_h_dim, blocks_w_dim, model_dim ])) # Image Transformer Decoder # [ self attention - ffn - residual + dropout] x n for layer in range(hparams.num_decoder_layers): layer_name = "decoder_layer_%d" % layer with tf.variable_scope(layer_name): # Self attention layer x += layer_prepostprocess_dropout( mtf.layers.local_2d_self_attention_spatial_blocks( mtf.layers.layer_norm(x, model_dim, name="layer_norm_att"), kv_dim, heads_dim, memory_h_dim=num_h_blocks_dim, memory_w_dim=num_w_blocks_dim, name="self_att"), hparams) # ffn layer x += layer_prepostprocess_dropout( mtf.layers.dense_relu_dense( mtf.layers.layer_norm(x, model_dim, name="layer_norm_ffn"), feedforward_dim, hparams.dropout, dropout_broadcast_dims=[length_dim]), hparams) output = mtf.layers.layer_norm(x, model_dim, name="final_layer_norm") return output
[ "def", "local_attention2d_spatial_decoder", "(", "x", ",", "kv_dim", ",", "heads_dim", ",", "feedforward_dim", ",", "hparams", ")", ":", "batch_dim", ",", "length_dim", ",", "model_dim", "=", "x", ".", "shape", ".", "dims", "blocks_h_dim", "=", "mtf", ".", "Dimension", "(", "\"blocksh\"", ",", "hparams", ".", "block_height", ")", "blocks_w_dim", "=", "mtf", ".", "Dimension", "(", "\"blocksw\"", ",", "hparams", ".", "block_width", ")", "num_h_blocks_dim", "=", "mtf", ".", "Dimension", "(", "\"num_h_blocks\"", ",", "hparams", ".", "img_len", "//", "hparams", ".", "block_height", ")", "num_w_blocks_dim", "=", "mtf", ".", "Dimension", "(", "\"num_w_blocks\"", ",", "hparams", ".", "img_len", "*", "hparams", ".", "num_channels", "//", "hparams", ".", "block_width", ")", "x", "=", "mtf", ".", "transpose", "(", "mtf", ".", "reshape", "(", "x", ",", "mtf", ".", "Shape", "(", "[", "batch_dim", ",", "num_h_blocks_dim", ",", "blocks_h_dim", ",", "num_w_blocks_dim", ",", "blocks_w_dim", ",", "model_dim", "]", ")", ")", ",", "mtf", ".", "Shape", "(", "[", "batch_dim", ",", "num_h_blocks_dim", ",", "num_w_blocks_dim", ",", "blocks_h_dim", ",", "blocks_w_dim", ",", "model_dim", "]", ")", ")", "# Image Transformer Decoder", "# [ self attention - ffn - residual + dropout] x n", "for", "layer", "in", "range", "(", "hparams", ".", "num_decoder_layers", ")", ":", "layer_name", "=", "\"decoder_layer_%d\"", "%", "layer", "with", "tf", ".", "variable_scope", "(", "layer_name", ")", ":", "# Self attention layer", "x", "+=", "layer_prepostprocess_dropout", "(", "mtf", ".", "layers", ".", "local_2d_self_attention_spatial_blocks", "(", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"layer_norm_att\"", ")", ",", "kv_dim", ",", "heads_dim", ",", "memory_h_dim", "=", "num_h_blocks_dim", ",", "memory_w_dim", "=", "num_w_blocks_dim", ",", "name", "=", "\"self_att\"", ")", ",", "hparams", ")", "# ffn layer", "x", "+=", "layer_prepostprocess_dropout", "(", "mtf", ".", "layers", ".", "dense_relu_dense", "(", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"layer_norm_ffn\"", ")", ",", "feedforward_dim", ",", "hparams", ".", "dropout", ",", "dropout_broadcast_dims", "=", "[", "length_dim", "]", ")", ",", "hparams", ")", "output", "=", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"final_layer_norm\"", ")", "return", "output" ]
Image Transformer decoder with local2D spatial layers.
[ "Image", "Transformer", "decoder", "with", "local2D", "spatial", "layers", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L286-L331
train
Image Transformer decoder with local2D spatial layers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrf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,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1489 - 1441) + chr(0b1101111) + chr(0b110001) + '\x32' + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010001 + 0o36) + chr(408 - 358) + chr(50) + chr(760 - 708), 53790 - 53782), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + '\061' + chr(0b10100 + 0o42) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\060' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(49) + chr(0b101101 + 0o10) + '\x35', 21605 - 21597), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\067' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x37' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000111 + 0o50) + chr(50) + chr(0b10111 + 0o40) + '\x32', 4089 - 4081), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + chr(783 - 731) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101011 + 0o6) + '\065' + chr(0b1100 + 0o53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101010 + 0o10) + '\x35' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5504 - 5393) + chr(2018 - 1967) + chr(55) + chr(54), 21966 - 21958), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + '\x31' + chr(0b11001 + 0o36) + chr(0b1111 + 0o43), 49841 - 49833), ehT0Px3KOsy9(chr(2195 - 2147) + chr(0b1011011 + 0o24) + '\x32' + chr(0b110110) + '\062', 47420 - 47412), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(0b1100 + 0o47) + chr(49) + chr(0b110101), 36337 - 36329), ehT0Px3KOsy9(chr(0b110000) + chr(7201 - 7090) + '\063' + chr(54) + '\x30', 0b1000), ehT0Px3KOsy9(chr(770 - 722) + chr(111) + chr(0b101110 + 0o5) + '\x34' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110111 + 0o70) + chr(1945 - 1896) + chr(2376 - 2326) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b111100 + 0o63) + chr(50) + '\x34' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3779 - 3668) + '\x33' + '\x35' + chr(0b1110 + 0o45), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(1332 - 1283) + chr(0b111 + 0o53) + chr(48), 37060 - 37052), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b100000 + 0o21) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + chr(0b110011) + chr(64 - 15) + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(53) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\x32' + chr(51) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10001 + 0o42) + chr(482 - 428) + chr(1961 - 1912), ord("\x08")), ehT0Px3KOsy9(chr(637 - 589) + chr(111) + chr(0b10010 + 0o41) + chr(0b11 + 0o61) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(4160 - 4049) + chr(0b101001 + 0o10) + chr(54) + chr(0b101011 + 0o13), 8), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(10535 - 10424) + '\x33' + chr(0b1 + 0o64) + chr(51), 8), ehT0Px3KOsy9(chr(374 - 326) + chr(0b111100 + 0o63) + '\x31' + chr(0b101000 + 0o17) + chr(691 - 638), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(73 - 19) + chr(2281 - 2233), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(2326 - 2215) + chr(0b110011) + '\060' + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100010 + 0o115) + chr(0b110011) + chr(0b110100) + chr(0b11011 + 0o32), 0b1000), ehT0Px3KOsy9('\060' + chr(10877 - 10766) + '\x31' + chr(0b110110) + chr(0b101101 + 0o7), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7030 - 6919) + '\062' + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\x32' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2383 - 2333) + chr(0b10111 + 0o40) + '\x32', 8), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(54) + chr(0b11010 + 0o34), 0o10), ehT0Px3KOsy9(chr(48) + chr(7369 - 7258) + chr(51) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(10430 - 10319) + '\x32' + chr(50) + '\x34', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(53) + chr(2026 - 1978), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f'), chr(0b1100100) + chr(101) + chr(6520 - 6421) + chr(111) + chr(0b1011100 + 0o10) + chr(101))(chr(117) + chr(0b1001111 + 0o45) + '\x66' + chr(0b10 + 0o53) + chr(2535 - 2479)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def LPx_LqJazbnm(OeWW0F1dBPRQ, skdElAbBTKr9, B1_XldK3qehn, m3_JZBN2FRQL, n4ljua2gi1Pr): (EpjjOe8vuYsi, QYJPqG75TqEv, p8LgqJaDQSBu) = OeWW0F1dBPRQ.shape.dims w4L80FXKRxQu = n08eHRtHxoln.Dimension(xafqLlk3kkUe(SXOLrMavuUCe(b'3\xf8\x19&\x06\x8eP'), chr(5068 - 4968) + chr(0b1100101) + chr(0b11111 + 0o104) + chr(0b1011010 + 0o25) + chr(0b1011100 + 0o10) + '\x65')(chr(0b1110101) + chr(116) + chr(0b1100110) + '\055' + chr(0b111000)), n4ljua2gi1Pr.block_height) LA7OTnP343fM = n08eHRtHxoln.Dimension(xafqLlk3kkUe(SXOLrMavuUCe(b'3\xf8\x19&\x06\x8eO'), chr(6282 - 6182) + chr(101) + chr(99) + chr(5087 - 4976) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(7000 - 6898) + chr(0b100001 + 0o14) + '\x38'), n4ljua2gi1Pr.H_cF2TKAb4ed) xLKq2Wk3U79B = n08eHRtHxoln.Dimension(xafqLlk3kkUe(SXOLrMavuUCe(b'?\xe1\x1b\x1a\x05\xa2Z\xd6H\x0c\xc0\x8d'), '\x64' + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(3107 - 3007) + chr(0b1100101))(chr(0b1011111 + 0o26) + chr(4194 - 4078) + '\146' + chr(0b11100 + 0o21) + chr(414 - 358)), n4ljua2gi1Pr.laxD7jy5y7k1 // n4ljua2gi1Pr.block_height) gVR1wP5PUWaD = n08eHRtHxoln.Dimension(xafqLlk3kkUe(SXOLrMavuUCe(b'?\xe1\x1b\x1a\x1a\xa2Z\xd6H\x0c\xc0\x8d'), chr(100) + chr(4631 - 4530) + '\143' + chr(2510 - 2399) + chr(0b1100100) + chr(101))(chr(4438 - 4321) + chr(4516 - 4400) + '\x66' + chr(0b11000 + 0o25) + chr(0b111000)), n4ljua2gi1Pr.laxD7jy5y7k1 * n4ljua2gi1Pr.X1ZpHSxyKbHn // n4ljua2gi1Pr.H_cF2TKAb4ed) OeWW0F1dBPRQ = n08eHRtHxoln.transpose(n08eHRtHxoln.reshape(OeWW0F1dBPRQ, n08eHRtHxoln.Shape([EpjjOe8vuYsi, xLKq2Wk3U79B, w4L80FXKRxQu, gVR1wP5PUWaD, LA7OTnP343fM, p8LgqJaDQSBu])), n08eHRtHxoln.Shape([EpjjOe8vuYsi, xLKq2Wk3U79B, gVR1wP5PUWaD, w4L80FXKRxQu, LA7OTnP343fM, p8LgqJaDQSBu])) for wgamNHppspXj in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'!\xc6\x1fs4\xbby\xe3b\x01\xe3\xca'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(56)))): YzJBPucQyDh2 = xafqLlk3kkUe(SXOLrMavuUCe(b'5\xf1\x15*\t\x98J\xe5K\x0e\xd2\x9b\x08\xed\xe8\x94'), chr(2686 - 2586) + chr(0b1100101) + chr(3260 - 3161) + chr(111) + '\144' + chr(0b1100101))(chr(117) + '\x74' + chr(0b110101 + 0o61) + chr(1268 - 1223) + chr(1275 - 1219)) % wgamNHppspXj with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"'\xf5\x04,\x0c\x9fT\xdfx\x1c\xc8\x91\n\xd7"), chr(0b0 + 0o144) + '\x65' + chr(0b10101 + 0o116) + chr(0b1101111) + chr(0b1 + 0o143) + '\x65')(chr(117) + chr(0b101011 + 0o111) + chr(102) + '\x2d' + '\x38'))(YzJBPucQyDh2): OeWW0F1dBPRQ += RW_xSzp18UeS(n08eHRtHxoln.layers.local_2d_self_attention_spatial_blocks(n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'=\xf5\x0f \x1f\xa2V\xd5U\x02\xf4\x9f\x0e\xc6'), chr(1470 - 1370) + chr(0b1100101) + '\143' + '\157' + '\144' + '\145')(chr(1119 - 1002) + chr(116) + chr(0b101111 + 0o67) + chr(981 - 936) + chr(56))), skdElAbBTKr9, B1_XldK3qehn, memory_h_dim=xLKq2Wk3U79B, memory_w_dim=gVR1wP5PUWaD, name=xafqLlk3kkUe(SXOLrMavuUCe(b'"\xf1\x1a#2\x9cL\xce'), chr(0b11101 + 0o107) + '\145' + chr(99) + '\x6f' + chr(100) + '\145')('\x75' + chr(12893 - 12777) + chr(0b1100110) + '\x2d' + chr(0b100110 + 0o22))), n4ljua2gi1Pr) OeWW0F1dBPRQ += RW_xSzp18UeS(n08eHRtHxoln.layers.dense_relu_dense(n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'=\xf5\x0f \x1f\xa2V\xd5U\x02\xf4\x98\x1c\xdc'), chr(2011 - 1911) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(100) + chr(7678 - 7577))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(2760 - 2704))), m3_JZBN2FRQL, n4ljua2gi1Pr.ag0mwEgWzjYv, dropout_broadcast_dims=[QYJPqG75TqEv]), n4ljua2gi1Pr) e1jVqMSBZ01Y = n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'7\xfd\x18$\x01\xa2T\xdb^\n\xd9\xa1\x14\xdd\xbf\x9d'), '\x64' + '\x65' + '\x63' + '\x6f' + chr(100) + chr(0b1001 + 0o134))('\165' + '\x74' + chr(8296 - 8194) + chr(1912 - 1867) + '\070')) return e1jVqMSBZ01Y
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
local_attention1d_masked_decoder
def local_attention1d_masked_decoder(x, kv_dim, heads_dim, feedforward_dim, hparams): """Image Transformer decoder with local1D masked layers.""" print(x) _, length_dim, model_dim = x.shape.dims for layer in range(hparams.num_decoder_layers): layer_name = "decoder_layer_%d" % layer with tf.variable_scope(layer_name): # Self attention layer length_per_split = mtf.tensor_dim_to_size_per_split( hparams.layout, hparams.mesh_shape, length_dim) x += layer_prepostprocess_dropout( mtf.layers.masked_local_attention_1d( mtf.layers.layer_norm(x, model_dim, name="layer_norm_att"), kv_dim, heads_dim, window_size=hparams.block_length, length_per_split=length_per_split, name="self_att"), hparams) # ffn layer x += layer_prepostprocess_dropout( mtf.layers.dense_relu_dense( mtf.layers.layer_norm(x, model_dim, name="layer_norm_ffn"), feedforward_dim, hparams.dropout, dropout_broadcast_dims=[length_dim]), hparams) output = mtf.layers.layer_norm(x, model_dim, name="final_layer_norm") return output
python
def local_attention1d_masked_decoder(x, kv_dim, heads_dim, feedforward_dim, hparams): """Image Transformer decoder with local1D masked layers.""" print(x) _, length_dim, model_dim = x.shape.dims for layer in range(hparams.num_decoder_layers): layer_name = "decoder_layer_%d" % layer with tf.variable_scope(layer_name): # Self attention layer length_per_split = mtf.tensor_dim_to_size_per_split( hparams.layout, hparams.mesh_shape, length_dim) x += layer_prepostprocess_dropout( mtf.layers.masked_local_attention_1d( mtf.layers.layer_norm(x, model_dim, name="layer_norm_att"), kv_dim, heads_dim, window_size=hparams.block_length, length_per_split=length_per_split, name="self_att"), hparams) # ffn layer x += layer_prepostprocess_dropout( mtf.layers.dense_relu_dense( mtf.layers.layer_norm(x, model_dim, name="layer_norm_ffn"), feedforward_dim, hparams.dropout, dropout_broadcast_dims=[length_dim]), hparams) output = mtf.layers.layer_norm(x, model_dim, name="final_layer_norm") return output
[ "def", "local_attention1d_masked_decoder", "(", "x", ",", "kv_dim", ",", "heads_dim", ",", "feedforward_dim", ",", "hparams", ")", ":", "print", "(", "x", ")", "_", ",", "length_dim", ",", "model_dim", "=", "x", ".", "shape", ".", "dims", "for", "layer", "in", "range", "(", "hparams", ".", "num_decoder_layers", ")", ":", "layer_name", "=", "\"decoder_layer_%d\"", "%", "layer", "with", "tf", ".", "variable_scope", "(", "layer_name", ")", ":", "# Self attention layer", "length_per_split", "=", "mtf", ".", "tensor_dim_to_size_per_split", "(", "hparams", ".", "layout", ",", "hparams", ".", "mesh_shape", ",", "length_dim", ")", "x", "+=", "layer_prepostprocess_dropout", "(", "mtf", ".", "layers", ".", "masked_local_attention_1d", "(", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"layer_norm_att\"", ")", ",", "kv_dim", ",", "heads_dim", ",", "window_size", "=", "hparams", ".", "block_length", ",", "length_per_split", "=", "length_per_split", ",", "name", "=", "\"self_att\"", ")", ",", "hparams", ")", "# ffn layer", "x", "+=", "layer_prepostprocess_dropout", "(", "mtf", ".", "layers", ".", "dense_relu_dense", "(", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"layer_norm_ffn\"", ")", ",", "feedforward_dim", ",", "hparams", ".", "dropout", ",", "dropout_broadcast_dims", "=", "[", "length_dim", "]", ")", ",", "hparams", ")", "output", "=", "mtf", ".", "layers", ".", "layer_norm", "(", "x", ",", "model_dim", ",", "name", "=", "\"final_layer_norm\"", ")", "return", "output" ]
Image Transformer decoder with local1D masked layers.
[ "Image", "Transformer", "decoder", "with", "local1D", "masked", "layers", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L334-L362
train
Image Transformer decoder with local1D masked layers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4x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6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(3032 - 2921) + chr(53) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1065 - 1017) + chr(0b1101111) + chr(0b110001) + chr(0b11001 + 0o30) + chr(0b110101), 2069 - 2061), ehT0Px3KOsy9(chr(581 - 533) + chr(5279 - 5168) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(6043 - 5932) + '\x31' + chr(0b110010) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + chr(1383 - 1333) + '\x32' + chr(0b11001 + 0o27), 54664 - 54656), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b100101 + 0o17) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2448 - 2398) + '\x31' + chr(0b110100), 16579 - 16571), ehT0Px3KOsy9(chr(0b110000) + chr(3115 - 3004) + '\061' + chr(0b0 + 0o61) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(6034 - 5923) + '\x33' + '\x37' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(9339 - 9228) + chr(0b11110 + 0o25) + '\x34' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b1101 + 0o45) + chr(1555 - 1500) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(55) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(51) + '\066', 0b1000), ehT0Px3KOsy9(chr(1053 - 1005) + chr(111) + '\063' + chr(0b11 + 0o61) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x33' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001000 + 0o47) + chr(51) + '\061' + '\066', 0o10), ehT0Px3KOsy9(chr(2182 - 2134) + '\x6f' + chr(0b110001) + chr(1789 - 1738) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110100) + chr(2370 - 2315), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1010 + 0o53) + '\064', 27786 - 27778), ehT0Px3KOsy9('\x30' + '\x6f' + '\066' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x35' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110001) + '\060', 43852 - 43844), ehT0Px3KOsy9('\x30' + chr(0b1110 + 0o141) + chr(0b110001) + chr(1246 - 1195) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\x36' + chr(49), 0o10), ehT0Px3KOsy9(chr(841 - 793) + chr(3715 - 3604) + chr(0b11000 + 0o33) + '\x34' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + '\x37' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1100 + 0o143) + chr(0b110001) + '\x32' + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b10101 + 0o132) + chr(0b110011) + '\063' + chr(0b11 + 0o62), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1 + 0o60) + chr(0b110011) + chr(2750 - 2695), 8), ehT0Px3KOsy9('\x30' + chr(1526 - 1415) + chr(0b1000 + 0o51) + chr(0b100 + 0o62) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2554 - 2503) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100001 + 0o21) + chr(51) + chr(0b100111 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(0b110010) + chr(0b110010) + chr(52), 0o10), ehT0Px3KOsy9(chr(2148 - 2100) + '\x6f' + chr(0b11 + 0o63) + chr(0b1011 + 0o53), 44921 - 44913), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b11100 + 0o26) + chr(2006 - 1951), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b110000 + 0o6) + chr(943 - 895), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\x33' + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\x37' + chr(50), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\x34' + chr(1020 - 968), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2105 - 2055) + chr(88 - 40) + chr(0b110010), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1093 - 1045) + chr(0b100010 + 0o115) + '\x35' + '\060', 5808 - 5800)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x07'), chr(100) + chr(4925 - 4824) + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1100000 + 0o25) + chr(116) + chr(0b101011 + 0o73) + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def kqdw2gIWkypf(OeWW0F1dBPRQ, skdElAbBTKr9, B1_XldK3qehn, m3_JZBN2FRQL, n4ljua2gi1Pr): zLUzGokYBM2Z(OeWW0F1dBPRQ) (VNGQdHSFPrso, QYJPqG75TqEv, p8LgqJaDQSBu) = OeWW0F1dBPRQ.shape.dims for wgamNHppspXj in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'Y\x1fl`\xc9#\xcd\x17\xbc\x8e\xf2\xce'), '\144' + chr(101) + '\143' + chr(9129 - 9018) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(116) + '\x66' + '\x2d' + chr(56)))): YzJBPucQyDh2 = xafqLlk3kkUe(SXOLrMavuUCe(b'M(f9\xf4\x00\xfe\x11\x95\x81\xc3\x9fl\xbf\xbc\xaa'), '\144' + chr(0b1100011 + 0o2) + '\x63' + '\x6f' + '\144' + chr(1560 - 1459))('\165' + '\x74' + chr(8078 - 7976) + chr(346 - 301) + '\070') % wgamNHppspXj with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'_,w?\xf1\x07\xe0+\xa6\x93\xd9\x95n\x85'), chr(0b1100100) + chr(0b11001 + 0o114) + '\143' + '\157' + chr(0b1100100) + chr(101))(chr(0b1110101) + '\x74' + chr(0b1100110) + '\055' + chr(0b111000)))(YzJBPucQyDh2): swYJry0pY8zd = n08eHRtHxoln.tensor_dim_to_size_per_split(n4ljua2gi1Pr.HDH7OEwZuDah, n4ljua2gi1Pr.GnGMnRt7o0q6, QYJPqG75TqEv) OeWW0F1dBPRQ += RW_xSzp18UeS(n08eHRtHxoln.layers.masked_local_attention_1d(n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'E,|3\xe2:\xe2!\x8b\x8d\xe5\x9bj\x94'), chr(0b1100100) + chr(5696 - 5595) + '\x63' + chr(3275 - 3164) + '\144' + '\x65')(chr(0b1110101) + '\164' + chr(3898 - 3796) + chr(0b101101 + 0o0) + '\070')), skdElAbBTKr9, B1_XldK3qehn, window_size=n4ljua2gi1Pr.MMwtQ0bPonxt, length_per_split=swYJry0pY8zd, name=xafqLlk3kkUe(SXOLrMavuUCe(b'Z(i0\xcf\x04\xf8:'), chr(0b11000 + 0o114) + chr(0b1100101) + chr(99) + chr(0b1010 + 0o145) + '\144' + '\x65')(chr(0b111100 + 0o71) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(2738 - 2682))), n4ljua2gi1Pr) OeWW0F1dBPRQ += RW_xSzp18UeS(n08eHRtHxoln.layers.dense_relu_dense(n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'E,|3\xe2:\xe2!\x8b\x8d\xe5\x9cx\x8e'), chr(100) + chr(0b110110 + 0o57) + chr(0b1100011) + '\x6f' + '\x64' + '\145')('\x75' + '\164' + chr(102) + '\055' + chr(0b111 + 0o61))), m3_JZBN2FRQL, n4ljua2gi1Pr.ag0mwEgWzjYv, dropout_broadcast_dims=[QYJPqG75TqEv]), n4ljua2gi1Pr) e1jVqMSBZ01Y = n08eHRtHxoln.layers.layer_norm(OeWW0F1dBPRQ, p8LgqJaDQSBu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'O$k7\xfc:\xe0/\x80\x85\xc8\xa5p\x8f\xeb\xa3'), '\x64' + '\x65' + '\143' + '\x6f' + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + chr(102) + chr(491 - 446) + '\070')) return e1jVqMSBZ01Y
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base
def mtf_image_transformer_base(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.no_data_parallelism = True hparams.use_fixed_batch_size = True hparams.batch_size = 1 hparams.max_length = 3072 hparams.hidden_size = 256 hparams.label_smoothing = 0.0 # 8-way model-parallelism hparams.add_hparam("mesh_shape", "batch:8") hparams.add_hparam("layout", "batch:batch") hparams.add_hparam("mtf_mode", True) hparams.add_hparam("num_heads", 8) hparams.add_hparam("filter_size", 1024) hparams.add_hparam("num_encoder_layers", 0) hparams.add_hparam("num_decoder_layers", 6) hparams.add_hparam("attention_key_size", 256) hparams.add_hparam("attention_value_size", 256) # Share weights between input and target embeddings hparams.shared_embedding = True # mixture of experts hparams hparams.add_hparam("ffn_layer", "dense_relu_dense") hparams.add_hparam("moe_overhead_train", 1.0) hparams.add_hparam("moe_overhead_eval", 2.0) hparams.moe_num_experts = 16 hparams.moe_loss_coef = 1e-3 hparams.shared_embedding_and_softmax_weights = True hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay" hparams.learning_rate_warmup_steps = 10000 hparams.add_hparam("d_kv", 64) hparams.add_hparam("d_ff", 2048) # Image related hparams hparams.add_hparam("img_len", 32) hparams.add_hparam("num_channels", 3) hparams.add_hparam("unconditional", True) # Local Attention related params hparams.add_hparam("block_length", 128) hparams.add_hparam("block_height", 16) hparams.add_hparam("block_width", 16) hparams.add_hparam("attention_type", "local1d") return hparams
python
def mtf_image_transformer_base(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.no_data_parallelism = True hparams.use_fixed_batch_size = True hparams.batch_size = 1 hparams.max_length = 3072 hparams.hidden_size = 256 hparams.label_smoothing = 0.0 # 8-way model-parallelism hparams.add_hparam("mesh_shape", "batch:8") hparams.add_hparam("layout", "batch:batch") hparams.add_hparam("mtf_mode", True) hparams.add_hparam("num_heads", 8) hparams.add_hparam("filter_size", 1024) hparams.add_hparam("num_encoder_layers", 0) hparams.add_hparam("num_decoder_layers", 6) hparams.add_hparam("attention_key_size", 256) hparams.add_hparam("attention_value_size", 256) # Share weights between input and target embeddings hparams.shared_embedding = True # mixture of experts hparams hparams.add_hparam("ffn_layer", "dense_relu_dense") hparams.add_hparam("moe_overhead_train", 1.0) hparams.add_hparam("moe_overhead_eval", 2.0) hparams.moe_num_experts = 16 hparams.moe_loss_coef = 1e-3 hparams.shared_embedding_and_softmax_weights = True hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay" hparams.learning_rate_warmup_steps = 10000 hparams.add_hparam("d_kv", 64) hparams.add_hparam("d_ff", 2048) # Image related hparams hparams.add_hparam("img_len", 32) hparams.add_hparam("num_channels", 3) hparams.add_hparam("unconditional", True) # Local Attention related params hparams.add_hparam("block_length", 128) hparams.add_hparam("block_height", 16) hparams.add_hparam("block_width", 16) hparams.add_hparam("attention_type", "local1d") return hparams
[ "def", "mtf_image_transformer_base", "(", ")", ":", "hparams", "=", "common_hparams", ".", "basic_params1", "(", ")", "hparams", ".", "no_data_parallelism", "=", "True", "hparams", ".", "use_fixed_batch_size", "=", "True", "hparams", ".", "batch_size", "=", "1", "hparams", ".", "max_length", "=", "3072", "hparams", ".", "hidden_size", "=", "256", "hparams", ".", "label_smoothing", "=", "0.0", "# 8-way model-parallelism", "hparams", ".", "add_hparam", "(", "\"mesh_shape\"", ",", "\"batch:8\"", ")", "hparams", ".", "add_hparam", "(", "\"layout\"", ",", "\"batch:batch\"", ")", "hparams", ".", "add_hparam", "(", "\"mtf_mode\"", ",", "True", ")", "hparams", ".", "add_hparam", "(", "\"num_heads\"", ",", "8", ")", "hparams", ".", "add_hparam", "(", "\"filter_size\"", ",", "1024", ")", "hparams", ".", "add_hparam", "(", "\"num_encoder_layers\"", ",", "0", ")", "hparams", ".", "add_hparam", "(", "\"num_decoder_layers\"", ",", "6", ")", "hparams", ".", "add_hparam", "(", "\"attention_key_size\"", ",", "256", ")", "hparams", ".", "add_hparam", "(", "\"attention_value_size\"", ",", "256", ")", "# Share weights between input and target embeddings", "hparams", ".", "shared_embedding", "=", "True", "# mixture of experts hparams", "hparams", ".", "add_hparam", "(", "\"ffn_layer\"", ",", "\"dense_relu_dense\"", ")", "hparams", ".", "add_hparam", "(", "\"moe_overhead_train\"", ",", "1.0", ")", "hparams", ".", "add_hparam", "(", "\"moe_overhead_eval\"", ",", "2.0", ")", "hparams", ".", "moe_num_experts", "=", "16", "hparams", ".", "moe_loss_coef", "=", "1e-3", "hparams", ".", "shared_embedding_and_softmax_weights", "=", "True", "hparams", ".", "optimizer", "=", "\"Adafactor\"", "hparams", ".", "learning_rate_schedule", "=", "\"rsqrt_decay\"", "hparams", ".", "learning_rate_warmup_steps", "=", "10000", "hparams", ".", "add_hparam", "(", "\"d_kv\"", ",", "64", ")", "hparams", ".", "add_hparam", "(", "\"d_ff\"", ",", "2048", ")", "# Image related hparams", "hparams", ".", "add_hparam", "(", "\"img_len\"", ",", "32", ")", "hparams", ".", "add_hparam", "(", "\"num_channels\"", ",", "3", ")", "hparams", ".", "add_hparam", "(", "\"unconditional\"", ",", "True", ")", "# Local Attention related params", "hparams", ".", "add_hparam", "(", "\"block_length\"", ",", "128", ")", "hparams", ".", "add_hparam", "(", "\"block_height\"", ",", "16", ")", "hparams", ".", "add_hparam", "(", "\"block_width\"", ",", "16", ")", "hparams", ".", "add_hparam", "(", "\"attention_type\"", ",", "\"local1d\"", ")", "return", "hparams" ]
Set of hyperparameters.
[ "Set", "of", "hyperparameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L366-L412
train
Set of hyperparameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9g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0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(1653 - 1542) + chr(0b110010) + '\067' + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(0b1110 + 0o42) + chr(201 - 146), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101110 + 0o4) + chr(0b10001 + 0o44) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\065' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b10110 + 0o131) + chr(0b110011) + '\063' + chr(528 - 477), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\064' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1204 - 1156) + chr(0b1010000 + 0o37) + chr(0b110 + 0o53) + chr(53) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(50) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1495 - 1446) + '\x33' + chr(54), 37278 - 37270), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + '\x32' + chr(0b1100 + 0o45) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1551 - 1503) + chr(4170 - 4059) + chr(1421 - 1369) + '\x32', 41881 - 41873), ehT0Px3KOsy9(chr(0b110000) + chr(0b101001 + 0o106) + '\x33' + chr(789 - 734) + chr(516 - 461), 25986 - 25978), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + chr(0b110010) + chr(0b0 + 0o63) + chr(0b1010 + 0o46), 0o10), ehT0Px3KOsy9(chr(2100 - 2052) + chr(1780 - 1669) + chr(0b110011) + chr(0b101011 + 0o14) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b110100 + 0o73) + '\063' + '\x31' + '\062', 24950 - 24942), ehT0Px3KOsy9('\060' + chr(0b1101101 + 0o2) + chr(0b110101) + '\x37', 0b1000), ehT0Px3KOsy9(chr(768 - 720) + chr(0b1101111) + '\061' + chr(1632 - 1582) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\064' + '\x33', 59977 - 59969), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(1533 - 1479) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + '\065' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + '\061' + chr(0b11010 + 0o34) + chr(153 - 105), 0o10), ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + chr(2180 - 2131) + chr(2492 - 2437) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(172 - 61) + chr(1016 - 963) + chr(51), 0o10), ehT0Px3KOsy9(chr(209 - 161) + chr(0b1101111) + '\066' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(0b11000 + 0o33) + chr(54) + chr(2423 - 2373), 45683 - 45675), ehT0Px3KOsy9('\060' + '\157' + '\061', 39256 - 39248), ehT0Px3KOsy9(chr(2116 - 2068) + chr(4054 - 3943) + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\065' + chr(963 - 914), 5348 - 5340), ehT0Px3KOsy9('\x30' + chr(8329 - 8218) + '\x31' + '\064' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000111 + 0o50) + chr(54) + chr(0b110001 + 0o5), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b110111) + chr(0b110000), 24141 - 24133), ehT0Px3KOsy9('\060' + chr(3865 - 3754) + chr(0b110010) + chr(0b1001 + 0o51) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(2163 - 2115) + chr(111) + chr(1040 - 989) + chr(49) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + '\061' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(10051 - 9940) + chr(0b110001) + '\065' + chr(531 - 481), 21551 - 21543), ehT0Px3KOsy9('\x30' + '\x6f' + chr(714 - 665) + chr(1675 - 1623) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11111 + 0o120) + chr(51) + '\x37' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + chr(51) + '\061' + chr(2421 - 2366), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100110 + 0o111) + chr(51) + chr(0b110010), 19434 - 19426)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + '\065' + chr(2005 - 1957), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x91'), chr(8711 - 8611) + chr(5114 - 5013) + chr(0b11010 + 0o111) + chr(2223 - 2112) + '\144' + chr(0b1000101 + 0o40))('\x75' + '\x74' + '\146' + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def IQVaU75bOmJQ(): n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1() n4ljua2gi1Pr.ahN6YYm9NJTr = ehT0Px3KOsy9('\x30' + chr(2954 - 2843) + '\061', 8) n4ljua2gi1Pr.V9YwhDsFOlGK = ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(4514 - 4403) + chr(49), 8) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b111 + 0o150) + chr(49), 8) n4ljua2gi1Pr._o7pVXAdOCRy = ehT0Px3KOsy9('\060' + '\157' + chr(1927 - 1873) + chr(48) + '\060' + chr(0b110000), 0b1000) n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b110100) + '\060' + '\x30', 2691 - 2683) n4ljua2gi1Pr.FSjUgdaczzRk = 0.0 xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\x64' + chr(0b10110 + 0o117) + chr(0b1100011) + chr(3947 - 3836) + chr(0b11011 + 0o111) + chr(101))(chr(0b1110101) + '\x74' + chr(0b1100110) + chr(1538 - 1493) + chr(0b101100 + 0o14)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\xa2\xdeE\x84\x90\x055.l'), chr(100) + '\x65' + chr(5965 - 5866) + chr(9282 - 9171) + chr(100) + '\x65')(chr(0b1110101) + chr(0b10001 + 0o143) + chr(102) + chr(45) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\xa6\xd9N\xb3\xd9U'), '\144' + chr(4781 - 4680) + chr(0b1100011) + chr(0b1101111) + chr(719 - 619) + chr(101))(chr(8035 - 7918) + '\164' + '\146' + chr(45) + chr(0b1010 + 0o56))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\x64' + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(0b101 + 0o137) + chr(0b100101 + 0o100))(chr(0b1000110 + 0o57) + chr(0b1110100) + chr(102) + chr(341 - 296) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3\xa6\xd4B\xae\x97'), '\x64' + '\x65' + chr(0b1001011 + 0o30) + chr(0b1101111) + chr(9201 - 9101) + '\x65')(chr(0b1110101) + chr(6443 - 6327) + chr(6587 - 6485) + '\055' + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\xa6\xd9N\xb3\xd9\x0f5*j\xe6'), chr(0b1110 + 0o126) + chr(3812 - 3711) + chr(99) + chr(0b111111 + 0o60) + chr(4671 - 4571) + chr(0b10101 + 0o120))(chr(117) + chr(0b1110010 + 0o2) + chr(0b1100110) + chr(0b101101) + chr(56))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(0b1100100) + chr(0b110110 + 0o57) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1110100) + '\x66' + chr(45) + chr(0b110 + 0o62)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\xb3\xcbr\xb6\x8c\t1'), chr(0b11001 + 0o113) + chr(7415 - 7314) + '\143' + chr(111) + chr(100) + chr(0b11010 + 0o113))(chr(5930 - 5813) + chr(0b1110100) + '\x66' + chr(45) + chr(0b111000)), ehT0Px3KOsy9('\x30' + chr(0b100100 + 0o113) + chr(0b100001 + 0o20), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(4870 - 4770) + '\145' + '\x63' + '\157' + chr(0b1011 + 0o131) + '\145')(chr(0b1000011 + 0o62) + '\164' + chr(102) + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd1\xb2\xc0r\xb3\x86\x0c0-'), '\144' + chr(0b0 + 0o145) + chr(0b1100011) + chr(0b1010001 + 0o36) + chr(0b11110 + 0o106) + '\145')(chr(0b1110101 + 0o0) + chr(0b101 + 0o157) + chr(0b1100110) + chr(0b10101 + 0o30) + chr(0b1 + 0o67)), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1101 + 0o44) + chr(0b100101 + 0o13), 0o10)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\144' + chr(284 - 183) + chr(4771 - 4672) + chr(0b1101111) + chr(100) + chr(101))(chr(0b1110101) + '\164' + '\146' + chr(1930 - 1885) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xd9\xae\xc1Y\xbe\x912'7s\xeb"), chr(0b1100100) + '\x65' + chr(0b1000000 + 0o43) + '\x6f' + '\x64' + '\x65')('\x75' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b100100 + 0o24)), ehT0Px3KOsy9('\x30' + chr(0b1101001 + 0o6) + chr(0b110000 + 0o2) + chr(0b10 + 0o56) + chr(2240 - 2192) + chr(48), 0o10)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\144' + chr(0b1001110 + 0o27) + chr(0b110110 + 0o55) + '\x6f' + chr(1365 - 1265) + chr(101))('\165' + chr(116) + chr(0b1100110) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd1\xb2\xc0r\xbe\x8d\x0e;:l\xfc}\x93\xf9\x81\xaf]$'), chr(416 - 316) + '\x65' + '\x63' + chr(111) + chr(0b10 + 0o142) + '\145')(chr(0b101010 + 0o113) + chr(116) + '\x66' + chr(1956 - 1911) + '\x38'), ehT0Px3KOsy9(chr(1026 - 978) + chr(0b1101111) + '\060', 38843 - 38835)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\144' + chr(0b101 + 0o140) + chr(0b1100011) + chr(0b1101111) + chr(7032 - 6932) + chr(0b100001 + 0o104))(chr(0b1011 + 0o152) + chr(116) + chr(102) + chr(45) + chr(1239 - 1183)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd1\xb2\xc0r\xbf\x86\x0e;:l\xfc}\x93\xf9\x81\xaf]$'), chr(0b1011100 + 0o10) + '\x65' + chr(0b111101 + 0o46) + chr(0b111110 + 0o61) + chr(100) + '\x65')(chr(0b1110101) + chr(11697 - 11581) + '\146' + '\x2d' + '\x38'), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000000 + 0o57) + '\x36', 0b1000)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(6432 - 6332) + '\x65' + '\143' + chr(7710 - 7599) + '\144' + chr(0b1100101))('\x75' + chr(1784 - 1668) + chr(102) + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xb3\xd9H\xb5\x97\x04;0V\xe5G\x86\xc7\x8b\xa3U2'), chr(409 - 309) + '\145' + chr(0b1100011) + '\157' + chr(0b1100100) + '\x65')('\x75' + '\x74' + '\146' + '\055' + '\x38'), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110100) + chr(48) + chr(0b1110 + 0o42), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(3573 - 3473) + chr(0b111010 + 0o53) + chr(0b1100011) + chr(0b110101 + 0o72) + '\144' + chr(0b111011 + 0o52))('\x75' + chr(0b100010 + 0o122) + chr(0b110001 + 0o65) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xb3\xd9H\xb5\x97\x04;0V\xf8C\x93\xed\x9d\x95\\>Y\x14'), '\x64' + chr(0b1000011 + 0o42) + '\143' + chr(9010 - 8899) + '\144' + chr(101))(chr(2047 - 1930) + chr(0b1110100) + '\x66' + chr(900 - 855) + chr(0b100110 + 0o22)), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1010 + 0o52) + chr(48) + '\x30', 8)) n4ljua2gi1Pr.f7bdxoAgzo_R = ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b11100 + 0o25), 8) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\x64' + '\145' + chr(99) + chr(0b1101111) + chr(100) + chr(0b1100101))('\165' + chr(1500 - 1384) + '\146' + chr(0b1001 + 0o44) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9\xa1\xc3r\xb7\x82\x141,'), '\x64' + chr(101) + chr(0b1011010 + 0o11) + chr(111) + '\144' + chr(7591 - 7490))(chr(0b1110101) + chr(0b1010111 + 0o35) + chr(0b1100000 + 0o6) + '\x2d' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\xa2\xc3^\xbe\xbc\x1f12|\xd1F\x9a\xf6\x8b\xaf'), chr(0b11 + 0o141) + chr(0b1100101) + chr(0b1100011) + chr(0b110110 + 0o71) + chr(5241 - 5141) + chr(0b100111 + 0o76))('\165' + chr(0b100111 + 0o115) + chr(6639 - 6537) + chr(1151 - 1106) + chr(0b0 + 0o70))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\x64' + chr(101) + '\x63' + chr(5306 - 5195) + '\x64' + chr(101))('\x75' + chr(5653 - 5537) + '\x66' + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\xa8\xc8r\xb4\x95\x08&6l\xefF\xa0\xec\x8a\xabF9'), '\144' + '\x65' + '\143' + chr(111) + chr(0b1011101 + 0o7) + '\x65')(chr(11246 - 11129) + chr(0b1110 + 0o146) + '\x66' + chr(0b101010 + 0o3) + chr(56)), 1.0) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(8655 - 8555) + chr(101) + chr(0b111000 + 0o53) + chr(5274 - 5163) + chr(0b110001 + 0o63) + chr(0b1100101))(chr(12990 - 12873) + chr(116) + chr(102) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\xa8\xc8r\xb4\x95\x08&6l\xefF\xa0\xfd\x8e\xabC'), chr(100) + chr(0b111 + 0o136) + chr(0b10000 + 0o123) + '\157' + chr(0b1011101 + 0o7) + chr(9626 - 9525))(chr(0b111101 + 0o70) + chr(116) + '\x66' + '\x2d' + chr(0b100010 + 0o26)), 2.0) n4ljua2gi1Pr.r99iQzD4Y8i3 = ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(1576 - 1528), 0o10) n4ljua2gi1Pr.VMsZZrjA_RNt = 0.001 n4ljua2gi1Pr.qVamxim0L2I1 = ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1100010 + 0o15) + chr(0b110001), 8) n4ljua2gi1Pr.XdKNcYRObPK3 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xa3\xccK\xba\x80\x19;,'), chr(0b110000 + 0o64) + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(0b101 + 0o137) + chr(6151 - 6050))(chr(117) + '\x74' + chr(8405 - 8303) + chr(0b10000 + 0o35) + chr(0b111000)) n4ljua2gi1Pr.Lz_s7neUzM5V = xafqLlk3kkUe(SXOLrMavuUCe(b'\xcd\xb4\xdc_\xaf\xbc\t1=h\xf7'), chr(0b1011111 + 0o5) + '\145' + '\143' + chr(0b1000111 + 0o50) + '\144' + '\145')(chr(13207 - 13090) + chr(0b100100 + 0o120) + chr(6616 - 6514) + chr(1390 - 1345) + '\070') n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9(chr(0b110000) + chr(4323 - 4212) + chr(0b110010) + chr(0b110011) + chr(52) + chr(0b0 + 0o62) + '\060', 0o10) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\x64' + chr(0b1010000 + 0o25) + chr(99) + '\x6f' + '\x64' + '\145')(chr(12849 - 12732) + chr(0b1010011 + 0o41) + chr(0b1110 + 0o130) + '\055' + chr(438 - 382)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x98\xc6['), chr(0b1011101 + 0o7) + chr(8804 - 8703) + chr(99) + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(0b1001000 + 0o55) + '\x74' + chr(0b1011110 + 0o10) + chr(0b100011 + 0o12) + chr(0b111000)), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101101 + 0o4) + chr(1990 - 1942) + chr(0b1000 + 0o50), 64721 - 64713)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\x64' + chr(0b1100101) + chr(5323 - 5224) + chr(0b11100 + 0o123) + '\144' + chr(0b111101 + 0o50))(chr(0b1100010 + 0o23) + '\164' + '\146' + chr(0b101101) + chr(1210 - 1154)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x98\xcbK'), '\144' + chr(2561 - 2460) + '\143' + chr(111) + '\x64' + '\x65')(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(0b111000 + 0o0)), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1000110 + 0o51) + chr(370 - 318) + chr(1610 - 1562) + chr(0b110000) + chr(2271 - 2223), 65273 - 65265)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(0b10011 + 0o121) + chr(5998 - 5897) + chr(0b1000110 + 0o35) + chr(0b1101111) + chr(0b1100100) + chr(6734 - 6633))(chr(2872 - 2755) + chr(3377 - 3261) + chr(0b101111 + 0o67) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6\xaa\xcar\xb7\x86\x03'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(100) + '\145')(chr(117) + '\164' + '\146' + '\x2d' + '\x38'), ehT0Px3KOsy9('\060' + chr(111) + chr(2398 - 2346) + chr(0b10000 + 0o40), ord("\x08"))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\144' + chr(8489 - 8388) + chr(2478 - 2379) + chr(2803 - 2692) + chr(0b1100100) + '\145')('\165' + chr(0b1110100) + chr(0b1100110) + chr(132 - 87) + chr(1977 - 1921)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd1\xb2\xc0r\xb8\x8b\x0c:0l\xe2Q'), chr(0b100100 + 0o100) + chr(3507 - 3406) + chr(99) + chr(0b1101111) + chr(6898 - 6798) + chr(101))(chr(0b1110101) + '\164' + '\146' + '\x2d' + chr(0b111000)), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + '\063', 57107 - 57099)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(100) + chr(0b1100101) + '\x63' + chr(6688 - 6577) + chr(0b1100100) + chr(101))('\x75' + chr(0b11000 + 0o134) + chr(754 - 652) + chr(0b101101) + chr(1547 - 1491)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xca\xa9\xceB\xb5\x87\x04 7f\xe0C\x93'), chr(100) + '\x65' + chr(2293 - 2194) + chr(328 - 217) + chr(8869 - 8769) + chr(9782 - 9681))(chr(117) + chr(0b1110100) + '\x66' + chr(0b11111 + 0o16) + '\x38'), ehT0Px3KOsy9('\x30' + chr(7669 - 7558) + chr(1939 - 1890), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(100) + '\x65' + '\x63' + chr(5718 - 5607) + chr(5590 - 5490) + chr(0b1100101))(chr(117) + chr(0b1110011 + 0o1) + '\146' + chr(149 - 104) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\xab\xc2N\xb0\xbc\x0110n\xfaJ'), chr(8340 - 8240) + chr(9548 - 9447) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(2554 - 2453))('\165' + chr(116) + '\146' + chr(1443 - 1398) + '\070'), ehT0Px3KOsy9(chr(1239 - 1191) + chr(0b111001 + 0o66) + chr(992 - 942) + '\060' + chr(48), 43279 - 43271)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), '\144' + chr(0b1100101) + chr(1192 - 1093) + '\x6f' + chr(811 - 711) + chr(7434 - 7333))(chr(0b110001 + 0o104) + chr(0b1110100) + chr(102) + chr(45) + chr(745 - 689)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\xab\xc2N\xb0\xbc\x0517n\xe6V'), '\144' + '\145' + chr(7554 - 7455) + chr(0b1001000 + 0o47) + chr(0b111001 + 0o53) + chr(101))(chr(0b11011 + 0o132) + chr(0b1110100) + chr(0b1100110) + chr(1183 - 1138) + chr(312 - 256)), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(1569 - 1458) + chr(955 - 905) + '\x30', 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(100) + chr(101) + chr(0b1100011) + chr(111) + chr(100) + chr(101))(chr(117) + chr(0b1110100) + chr(102) + chr(0b0 + 0o55) + chr(0b10010 + 0o46)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\xab\xc2N\xb0\xbc\x1a=:}\xe6'), chr(0b100010 + 0o102) + '\x65' + chr(2918 - 2819) + chr(111) + '\144' + '\145')(chr(0b1110101) + '\x74' + '\x66' + '\x2d' + '\x38'), ehT0Px3KOsy9(chr(1356 - 1308) + '\x6f' + chr(0b1000 + 0o52) + chr(1728 - 1680), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xa3\xc9r\xb3\x93\x0c&?d'), chr(0b1100100) + '\145' + chr(9586 - 9487) + chr(111) + chr(0b10110 + 0o116) + '\x65')(chr(0b1110101) + chr(4869 - 4753) + chr(0b1001 + 0o135) + chr(0b101101) + chr(293 - 237)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xb3\xd9H\xb5\x97\x04;0V\xfa[\x8f\xfd'), '\x64' + chr(8749 - 8648) + chr(6225 - 6126) + chr(2828 - 2717) + '\144' + chr(4891 - 4790))(chr(117) + chr(0b1110100) + chr(102) + '\055' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3\xa8\xceL\xb7\xd2\t'), chr(100) + chr(0b1100101) + chr(0b1110 + 0o125) + chr(0b1101111) + chr(100) + '\x65')(chr(2981 - 2864) + '\x74' + chr(102) + '\x2d' + chr(2263 - 2207))) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_tiny
def mtf_image_transformer_tiny(): """Catch bugs locally...""" hparams = mtf_image_transformer_base() hparams.hidden_size = 128 hparams.d_ff = 256 hparams.batch_size = 4 hparams.num_encoder_layers = 1 hparams.num_decoder_layers = 4 hparams.num_heads = 4 hparams.attention_key_size = 128 hparams.attention_value_size = 128 hparams.block_length = 32 # data parallelism and model-parallelism hparams.mesh_shape = "batch:2" hparams.layout = "batch:batch" return hparams
python
def mtf_image_transformer_tiny(): """Catch bugs locally...""" hparams = mtf_image_transformer_base() hparams.hidden_size = 128 hparams.d_ff = 256 hparams.batch_size = 4 hparams.num_encoder_layers = 1 hparams.num_decoder_layers = 4 hparams.num_heads = 4 hparams.attention_key_size = 128 hparams.attention_value_size = 128 hparams.block_length = 32 # data parallelism and model-parallelism hparams.mesh_shape = "batch:2" hparams.layout = "batch:batch" return hparams
[ "def", "mtf_image_transformer_tiny", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base", "(", ")", "hparams", ".", "hidden_size", "=", "128", "hparams", ".", "d_ff", "=", "256", "hparams", ".", "batch_size", "=", "4", "hparams", ".", "num_encoder_layers", "=", "1", "hparams", ".", "num_decoder_layers", "=", "4", "hparams", ".", "num_heads", "=", "4", "hparams", ".", "attention_key_size", "=", "128", "hparams", ".", "attention_value_size", "=", "128", "hparams", ".", "block_length", "=", "32", "# data parallelism and model-parallelism", "hparams", ".", "mesh_shape", "=", "\"batch:2\"", "hparams", ".", "layout", "=", "\"batch:batch\"", "return", "hparams" ]
Catch bugs locally...
[ "Catch", "bugs", "locally", "..." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L416-L431
train
Catch bugs locally...
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X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kZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\060' + '\060', 28706 - 28698), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + chr(2375 - 2324) + chr(0b110111) + chr(0b100001 + 0o21), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(723 - 669) + chr(2352 - 2301), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\065' + '\063', 54245 - 54237), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(517 - 466) + '\062' + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + '\x32' + '\067' + chr(792 - 737), 63057 - 63049), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x31' + chr(0b110110), 43508 - 43500), ehT0Px3KOsy9(chr(0b110000) + chr(0b111010 + 0o65) + chr(0b110100) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8129 - 8018) + chr(0b110010) + '\066' + '\061', 0b1000), ehT0Px3KOsy9(chr(1791 - 1743) + chr(0b1000000 + 0o57) + '\x31' + chr(0b110110) + chr(0b110101), 31862 - 31854), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\x32' + '\x36' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(49) + '\066', 0o10), ehT0Px3KOsy9(chr(2082 - 2034) + '\157' + '\063' + chr(51) + chr(0b1010 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(1055 - 1007) + '\157' + chr(0b110000 + 0o1) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2492 - 2442) + chr(0b1000 + 0o54) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1343 - 1293) + chr(0b110010) + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100000 + 0o23) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110001) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1100011 + 0o14) + chr(0b110010) + chr(53) + '\x32', 4001 - 3993), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(146 - 95) + chr(1491 - 1440) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(624 - 576) + chr(0b1101111) + chr(1180 - 1129) + '\x34' + chr(0b100010 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(2054 - 2006) + '\x6f' + chr(49) + chr(0b11010 + 0o33) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11111 + 0o23) + chr(1713 - 1659) + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b11010 + 0o27) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(655 - 607) + chr(9549 - 9438) + chr(51) + chr(2232 - 2182) + chr(0b11010 + 0o26), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(2442 - 2388), 33996 - 33988), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10 + 0o61) + chr(53) + chr(0b110101), 42865 - 42857), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(830 - 775), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11111 + 0o120) + chr(0b10000 + 0o41) + chr(0b110011) + chr(0b1011 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + chr(49) + '\063' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\x33' + chr(52) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(6116 - 6005) + '\063' + '\x34' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + '\x32' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110010) + chr(2501 - 2446) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(10149 - 10038) + chr(0b101 + 0o62) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(1317 - 1266) + chr(52), 26686 - 26678), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10000 + 0o42) + '\x34' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + '\066' + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + chr(0b101001 + 0o11) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b110001) + chr(0b110100), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + '\x35' + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xae'), '\144' + chr(918 - 817) + chr(0b110011 + 0o60) + '\157' + chr(100) + '\145')(chr(117) + chr(0b1011110 + 0o26) + chr(102) + chr(0b10001 + 0o34) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def dS_Afp5bSGhn(): n4ljua2gi1Pr = IQVaU75bOmJQ() n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(306 - 258) + chr(0b1101011 + 0o4) + chr(50) + chr(0b110000) + chr(0b100110 + 0o12), 8) n4ljua2gi1Pr.EpyOHjLLhjxL = ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b110100) + '\060' + chr(0b110000), 0o10) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(683 - 635) + '\157' + '\x34', 0b1000) n4ljua2gi1Pr.RS6YkARoTleN = ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(49), 0o10) n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9('\x30' + chr(9466 - 9355) + chr(0b110100), 8) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(4991 - 4880) + '\064', 8) n4ljua2gi1Pr.RlRC4NxQK4cg = ehT0Px3KOsy9('\x30' + chr(3308 - 3197) + chr(0b110010) + chr(48) + chr(48), 8) n4ljua2gi1Pr.juqFZu2ar3_d = ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(1262 - 1214) + '\060', 8) n4ljua2gi1Pr.MMwtQ0bPonxt = ehT0Px3KOsy9('\060' + chr(111) + chr(290 - 238) + chr(48), 8) n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2\x9b\xc7H\xbc\x85\xfc'), chr(0b1100100) + '\x65' + '\143' + '\x6f' + chr(0b1100100) + '\145')('\x75' + chr(0b11011 + 0o131) + chr(0b1100110) + chr(965 - 920) + chr(56)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2\x9b\xc7H\xbc\x85\xacA\xc5\x16\xda'), chr(100) + '\x65' + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101 + 0o0) + chr(6420 - 6304) + '\x66' + '\055' + chr(252 - 196)) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_single
def mtf_image_transformer_single(): """Small single parameters.""" hparams = mtf_image_transformer_tiny() hparams.mesh_shape = "" hparams.layout = "" hparams.hidden_size = 32 hparams.filter_size = 32 hparams.batch_size = 1 hparams.num_encoder_layers = 1 hparams.num_decoder_layers = 1 hparams.num_heads = 2 hparams.attention_key_size = 32 hparams.attention_value_size = 32 hparams.block_length = 16 return hparams
python
def mtf_image_transformer_single(): """Small single parameters.""" hparams = mtf_image_transformer_tiny() hparams.mesh_shape = "" hparams.layout = "" hparams.hidden_size = 32 hparams.filter_size = 32 hparams.batch_size = 1 hparams.num_encoder_layers = 1 hparams.num_decoder_layers = 1 hparams.num_heads = 2 hparams.attention_key_size = 32 hparams.attention_value_size = 32 hparams.block_length = 16 return hparams
[ "def", "mtf_image_transformer_single", "(", ")", ":", "hparams", "=", "mtf_image_transformer_tiny", "(", ")", "hparams", ".", "mesh_shape", "=", "\"\"", "hparams", ".", "layout", "=", "\"\"", "hparams", ".", "hidden_size", "=", "32", "hparams", ".", "filter_size", "=", "32", "hparams", ".", "batch_size", "=", "1", "hparams", ".", "num_encoder_layers", "=", "1", "hparams", ".", "num_decoder_layers", "=", "1", "hparams", ".", "num_heads", "=", "2", "hparams", ".", "attention_key_size", "=", "32", "hparams", ".", "attention_value_size", "=", "32", "hparams", ".", "block_length", "=", "16", "return", "hparams" ]
Small single parameters.
[ "Small", "single", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L435-L449
train
Small single parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,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aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(861 - 813) + '\x6f' + '\x32' + chr(164 - 111) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b101 + 0o152) + '\x32' + chr(2716 - 2661), 769 - 761), ehT0Px3KOsy9(chr(0b110000) + chr(0b100100 + 0o113) + chr(0b110001) + chr(0b110001 + 0o1), 0o10), ehT0Px3KOsy9(chr(48) + chr(3372 - 3261) + '\x31' + chr(53) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\x37' + chr(53), 1975 - 1967), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1100101 + 0o12) + chr(0b101101 + 0o5) + chr(0b110101) + '\x34', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(51) + '\x32', 40727 - 40719), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b101110 + 0o101) + '\x33' + chr(475 - 422) + '\064', 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1011101 + 0o22) + '\x32' + chr(0b110101) + chr(347 - 298), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7644 - 7533) + chr(0b100110 + 0o21) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5202 - 5091) + chr(1092 - 1040) + chr(0b110100), 58733 - 58725), ehT0Px3KOsy9(chr(1226 - 1178) + chr(1139 - 1028) + chr(0b100010 + 0o21) + '\062' + chr(0b10100 + 0o36), 28743 - 28735), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b11001 + 0o31), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1000 + 0o53) + '\061' + chr(0b1111 + 0o47), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(55) + '\060', 38530 - 38522), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(54) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2629 - 2518) + chr(1228 - 1178) + '\x30' + chr(0b110110), 26146 - 26138), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b100111 + 0o12) + chr(1270 - 1219), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\062', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110 + 0o53) + chr(52) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(49) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000101 + 0o52) + '\x37' + chr(0b101101 + 0o6), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\065' + chr(0b110010), 8), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(52) + chr(48), 37117 - 37109), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(52) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1356 - 1308) + '\x6f' + '\x31' + chr(0b110110) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(475 - 426) + '\060' + chr(0b110101), 10888 - 10880), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2129 - 2078) + chr(1392 - 1337) + chr(0b1000 + 0o50), 30831 - 30823), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(10717 - 10606) + chr(0b100 + 0o55) + chr(48) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(11195 - 11084) + '\x31' + chr(0b110101) + '\x33', 26032 - 26024), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1011100 + 0o23) + '\062' + chr(0b110100 + 0o3) + chr(0b100111 + 0o14), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(2300 - 2246) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(129 - 76) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(520 - 466) + chr(1879 - 1826), 0b1000), ehT0Px3KOsy9('\x30' + chr(4201 - 4090) + '\x33' + chr(53) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1878 - 1767) + chr(453 - 403) + chr(0b110001) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2230 - 2181) + chr(408 - 359) + '\067', 19197 - 19189), ehT0Px3KOsy9(chr(0b110000) + chr(7155 - 7044) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + '\061' + chr(2472 - 2421) + chr(48), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + '\060', 59114 - 59106)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x84'), chr(0b110010 + 0o62) + '\x65' + chr(3048 - 2949) + chr(0b1101111) + '\144' + chr(101))('\165' + chr(9229 - 9113) + chr(8079 - 7977) + '\x2d' + chr(0b1100 + 0o54)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def QBYvu2OEBQdH(): n4ljua2gi1Pr = dS_Afp5bSGhn() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(6001 - 5901) + '\x65' + chr(636 - 537) + chr(111) + chr(0b1000101 + 0o37) + chr(0b1100101))(chr(1911 - 1794) + chr(0b1110100) + '\x66' + chr(0b1111 + 0o36) + '\070') n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b''), '\x64' + chr(101) + '\143' + chr(111) + chr(7336 - 7236) + chr(0b101000 + 0o75))('\165' + '\x74' + chr(0b1011111 + 0o7) + '\055' + '\x38') n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(48) + '\157' + '\064' + chr(48), 43051 - 43043) n4ljua2gi1Pr.deybX8NJ0oEI = ehT0Px3KOsy9(chr(1819 - 1771) + chr(11277 - 11166) + chr(0b11100 + 0o30) + chr(0b1101 + 0o43), 8) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + chr(0b1011 + 0o46), ord("\x08")) n4ljua2gi1Pr.RS6YkARoTleN = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100011 + 0o16), 8) n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31', 8) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9(chr(48) + chr(4262 - 4151) + chr(198 - 148), 0b1000) n4ljua2gi1Pr.RlRC4NxQK4cg = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011 + 0o1) + chr(315 - 267), 8) n4ljua2gi1Pr.juqFZu2ar3_d = ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + chr(0b110000), 8) n4ljua2gi1Pr.MMwtQ0bPonxt = ehT0Px3KOsy9(chr(48) + chr(1635 - 1524) + '\x32' + chr(0b110000), 0o10) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_single
def mtf_image_transformer_base_single(): """Small single parameters.""" hparams = mtf_image_transformer_base() hparams.num_decoder_layers = 6 hparams.filter_size = 256 hparams.block_length = 128 hparams.mesh_shape = "" hparams.layout = "" return hparams
python
def mtf_image_transformer_base_single(): """Small single parameters.""" hparams = mtf_image_transformer_base() hparams.num_decoder_layers = 6 hparams.filter_size = 256 hparams.block_length = 128 hparams.mesh_shape = "" hparams.layout = "" return hparams
[ "def", "mtf_image_transformer_base_single", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base", "(", ")", "hparams", ".", "num_decoder_layers", "=", "6", "hparams", ".", "filter_size", "=", "256", "hparams", ".", "block_length", "=", "128", "hparams", ".", "mesh_shape", "=", "\"\"", "hparams", ".", "layout", "=", "\"\"", "return", "hparams" ]
Small single parameters.
[ "Small", "single", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L453-L461
train
Small single parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,s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,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(474 - 425), 0b1000), ehT0Px3KOsy9(chr(1576 - 1528) + chr(0b1001010 + 0o45) + chr(0b1000 + 0o51) + '\067' + chr(1308 - 1256), 27000 - 26992), ehT0Px3KOsy9(chr(1806 - 1758) + '\157' + chr(118 - 67) + chr(0b10001 + 0o44) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x34' + chr(0b110101), 10259 - 10251), ehT0Px3KOsy9('\060' + chr(7835 - 7724) + chr(0b110100) + chr(53), 8), ehT0Px3KOsy9(chr(2223 - 2175) + '\157' + '\x31' + chr(50) + chr(0b1101 + 0o44), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b101011 + 0o104) + '\x31' + '\x36' + chr(2195 - 2144), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(345 - 291) + chr(89 - 35), 0b1000), ehT0Px3KOsy9(chr(1764 - 1716) + chr(0b1101111) + '\x31' + '\x35' + chr(399 - 350), 0o10), ehT0Px3KOsy9(chr(283 - 235) + '\x6f' + chr(0b111 + 0o53) + chr(0b10011 + 0o36) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(0b11 + 0o154) + chr(857 - 806) + chr(0b110010) + chr(0b1010 + 0o47), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(54) + chr(392 - 339), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b11111 + 0o120) + chr(0b1000 + 0o51) + chr(0b110101) + '\062', 14464 - 14456), ehT0Px3KOsy9(chr(885 - 837) + '\157' + chr(1974 - 1923) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\x32' + chr(0b101101 + 0o11) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\065' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(400 - 349) + chr(49) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(3194 - 3083) + chr(0b110011) + chr(0b1 + 0o64), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1566 - 1516) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(10175 - 10064) + chr(1398 - 1348) + chr(0b110110) + chr(0b101101 + 0o7), 34653 - 34645), ehT0Px3KOsy9(chr(0b110000) + chr(5894 - 5783) + chr(51) + '\062' + chr(49), 8), ehT0Px3KOsy9('\x30' + chr(0b1010110 + 0o31) + chr(0b100011 + 0o16) + '\x36' + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(245 - 196) + '\x35' + '\065', 0b1000), ehT0Px3KOsy9(chr(1207 - 1159) + chr(0b1101111) + chr(0b1101 + 0o45) + chr(0b110000 + 0o2), 0o10), ehT0Px3KOsy9(chr(951 - 903) + chr(0b1011 + 0o144) + '\x33' + chr(0b110101) + chr(1037 - 982), 65295 - 65287), ehT0Px3KOsy9(chr(815 - 767) + chr(0b1101111) + chr(51) + '\x31' + chr(376 - 323), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + chr(0b110011) + '\063' + chr(2483 - 2432), 58926 - 58918), ehT0Px3KOsy9('\x30' + '\157' + '\061' + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100100 + 0o13) + chr(51) + '\060' + '\064', 32222 - 32214), ehT0Px3KOsy9(chr(48) + chr(4567 - 4456) + '\060', 0o10), ehT0Px3KOsy9(chr(1050 - 1002) + chr(0b1101111) + chr(742 - 691) + '\x37' + chr(1077 - 1022), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011000 + 0o27) + '\x35' + chr(606 - 551), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b11000 + 0o33) + chr(0b110010) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100001 + 0o116) + '\063' + chr(53) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + '\x35' + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(2229 - 2181) + chr(3555 - 3444) + chr(1465 - 1415) + chr(54) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\x33' + chr(55), 40191 - 40183), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x34' + chr(0b110111), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b0 + 0o65) + '\060', 54142 - 54134)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b"'"), '\x64' + '\145' + '\x63' + chr(1923 - 1812) + chr(100) + chr(101))(chr(117) + chr(0b1101111 + 0o5) + chr(102) + '\x2d' + chr(0b110011 + 0o5)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Qy2YBv2xGO3S(): n4ljua2gi1Pr = IQVaU75bOmJQ() n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9('\060' + chr(3005 - 2894) + chr(0b110110), 17474 - 17466) n4ljua2gi1Pr.deybX8NJ0oEI = ehT0Px3KOsy9('\060' + '\x6f' + '\064' + '\060' + '\060', 0o10) n4ljua2gi1Pr.MMwtQ0bPonxt = ehT0Px3KOsy9(chr(48) + '\157' + chr(1034 - 984) + '\060' + '\x30', ord("\x08")) n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(100) + chr(0b1100101) + chr(99) + chr(0b1100001 + 0o16) + chr(0b10110 + 0o116) + chr(0b1011110 + 0o7))(chr(0b1110101) + chr(116) + chr(1903 - 1801) + chr(0b101101) + chr(0b111000)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(2778 - 2678) + chr(0b11101 + 0o110) + chr(99) + '\157' + chr(0b1010000 + 0o24) + chr(0b1000101 + 0o40))(chr(0b11001 + 0o134) + '\164' + chr(102) + '\x2d' + chr(56)) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_tiny_spatial1d
def mtf_image_transformer_tiny_spatial1d(): """Small single parameters.""" hparams = mtf_image_transformer_tiny() hparams.num_decoder_layers = 6 hparams.filter_size = 128 hparams.block_height = 8 hparams.block_width = 8 hparams.attention_type = "local1d_spatial" hparams.mesh_shape = "" hparams.layout = "" return hparams
python
def mtf_image_transformer_tiny_spatial1d(): """Small single parameters.""" hparams = mtf_image_transformer_tiny() hparams.num_decoder_layers = 6 hparams.filter_size = 128 hparams.block_height = 8 hparams.block_width = 8 hparams.attention_type = "local1d_spatial" hparams.mesh_shape = "" hparams.layout = "" return hparams
[ "def", "mtf_image_transformer_tiny_spatial1d", "(", ")", ":", "hparams", "=", "mtf_image_transformer_tiny", "(", ")", "hparams", ".", "num_decoder_layers", "=", "6", "hparams", ".", "filter_size", "=", "128", "hparams", ".", "block_height", "=", "8", "hparams", ".", "block_width", "=", "8", "hparams", ".", "attention_type", "=", "\"local1d_spatial\"", "hparams", ".", "mesh_shape", "=", "\"\"", "hparams", ".", "layout", "=", "\"\"", "return", "hparams" ]
Small single parameters.
[ "Small", "single", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L465-L475
train
Small single parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h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xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(3121 - 3010) + '\062' + '\065' + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(890 - 835) + chr(1005 - 956), 32919 - 32911), ehT0Px3KOsy9(chr(75 - 27) + '\157' + chr(0b110001) + chr(55) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5513 - 5402) + chr(0b110011) + '\066' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110111) + '\060', 4469 - 4461), ehT0Px3KOsy9(chr(1756 - 1708) + '\157' + '\062' + chr(49) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(2561 - 2509), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(697 - 647) + chr(0b110011) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1101 + 0o44), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(48) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4494 - 4383) + '\062' + chr(0b101001 + 0o7) + chr(0b100101 + 0o20), 2178 - 2170), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b110001) + chr(49), 31323 - 31315), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(0b110100) + '\x33', 38826 - 38818), ehT0Px3KOsy9(chr(0b110000) + chr(2561 - 2450) + chr(0b110001) + chr(50), 53100 - 53092), ehT0Px3KOsy9(chr(1171 - 1123) + chr(8355 - 8244) + chr(0b110001) + '\x33' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(970 - 921) + '\x34' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101101 + 0o5) + chr(2245 - 2193) + chr(0b110001 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(0b1110 + 0o45) + '\x33' + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1010 + 0o50) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(0b110001) + chr(0b100101 + 0o13) + chr(0b110101), 26461 - 26453), ehT0Px3KOsy9(chr(1785 - 1737) + chr(111) + '\062' + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111 + 0o150) + chr(2002 - 1953) + chr(52) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9508 - 9397) + chr(0b110010) + chr(51) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7461 - 7350) + '\x32' + chr(0b1001 + 0o50) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(973 - 924) + chr(0b110001) + chr(2576 - 2523), ord("\x08")), ehT0Px3KOsy9(chr(405 - 357) + chr(0b11 + 0o154) + chr(1962 - 1911) + chr(388 - 333) + chr(0b100000 + 0o27), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(0b110011) + chr(0b11101 + 0o25) + chr(2001 - 1951), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(1679 - 1628) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1313 - 1265) + chr(0b1011001 + 0o26) + '\x31' + chr(0b110110), 6611 - 6603), ehT0Px3KOsy9('\x30' + '\157' + chr(2947 - 2892) + chr(94 - 40), 62215 - 62207), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b100011 + 0o16) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1192 - 1144) + chr(0b0 + 0o157) + '\062' + '\067' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100010 + 0o17) + '\064' + '\067', 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + chr(1707 - 1657) + '\061' + chr(52), 9453 - 9445), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1622 - 1573) + '\064' + '\060', 0o10), ehT0Px3KOsy9(chr(1437 - 1389) + '\x6f' + chr(0b110011) + chr(0b110010) + chr(0b100000 + 0o27), 21340 - 21332), ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + chr(1008 - 959) + '\x33' + chr(0b101011 + 0o12), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(1387 - 1338) + '\063', 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(51) + '\065' + '\x36', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + chr(0b101011 + 0o5), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x82'), '\x64' + chr(0b1100101) + chr(6465 - 6366) + chr(8734 - 8623) + chr(8753 - 8653) + '\145')(chr(0b101111 + 0o106) + chr(116) + chr(7679 - 7577) + chr(799 - 754) + chr(0b101111 + 0o11)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def K7FaiU4Xr_zI(): n4ljua2gi1Pr = dS_Afp5bSGhn() n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + chr(1132 - 1078), 0o10) n4ljua2gi1Pr.deybX8NJ0oEI = ehT0Px3KOsy9(chr(1877 - 1829) + chr(111) + '\x32' + chr(0b110000) + chr(2210 - 2162), 0o10) n4ljua2gi1Pr.eI3NJQeUY9PN = ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b10010 + 0o36), 8) n4ljua2gi1Pr.H_cF2TKAb4ed = ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b111000 + 0o67) + '\x31' + '\060', 8) n4ljua2gi1Pr.lZ1GB4L2oMeG = xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\x96\x1a\x94\x94\xbbx\xc0r\xf1i\xf1\xa0Bf'), chr(100) + chr(0b1100101) + chr(99) + chr(111) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(116) + chr(0b1100110) + '\x2d' + chr(1721 - 1665)) n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(7169 - 7069) + chr(0b100110 + 0o77) + '\x63' + chr(3439 - 3328) + '\x64' + chr(8854 - 8753))(chr(0b11 + 0o162) + chr(0b110111 + 0o75) + chr(0b1100110) + '\055' + chr(0b111000)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(0b1100000 + 0o4) + '\x65' + '\143' + chr(1291 - 1180) + '\x64' + chr(0b100011 + 0o102))('\165' + chr(3957 - 3841) + '\146' + chr(268 - 223) + '\x38') return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_cifar
def mtf_image_transformer_base_cifar(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base() hparams.mesh_shape = "batch:8" hparams.layout = "batch:batch" hparams.learning_rate_decay_steps = 13600 # one epoch hparams.batch_size = 32 hparams.num_heads = 4 hparams.num_decoder_layers = 12 hparams.block_length = 256 hparams.hidden_size = 512 hparams.d_ff = 2048 hparams.learning_rate = 0.5 hparams.layer_preprocess_sequence = "none" hparams.layer_postprocess_sequence = "dan" hparams.layer_prepostprocess_dropout = 0.3 hparams.unconditional = True return hparams
python
def mtf_image_transformer_base_cifar(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base() hparams.mesh_shape = "batch:8" hparams.layout = "batch:batch" hparams.learning_rate_decay_steps = 13600 # one epoch hparams.batch_size = 32 hparams.num_heads = 4 hparams.num_decoder_layers = 12 hparams.block_length = 256 hparams.hidden_size = 512 hparams.d_ff = 2048 hparams.learning_rate = 0.5 hparams.layer_preprocess_sequence = "none" hparams.layer_postprocess_sequence = "dan" hparams.layer_prepostprocess_dropout = 0.3 hparams.unconditional = True return hparams
[ "def", "mtf_image_transformer_base_cifar", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base", "(", ")", "hparams", ".", "mesh_shape", "=", "\"batch:8\"", "hparams", ".", "layout", "=", "\"batch:batch\"", "hparams", ".", "learning_rate_decay_steps", "=", "13600", "# one epoch", "hparams", ".", "batch_size", "=", "32", "hparams", ".", "num_heads", "=", "4", "hparams", ".", "num_decoder_layers", "=", "12", "hparams", ".", "block_length", "=", "256", "hparams", ".", "hidden_size", "=", "512", "hparams", ".", "d_ff", "=", "2048", "hparams", ".", "learning_rate", "=", "0.5", "hparams", ".", "layer_preprocess_sequence", "=", "\"none\"", "hparams", ".", "layer_postprocess_sequence", "=", "\"dan\"", "hparams", ".", "layer_prepostprocess_dropout", "=", "0.3", "hparams", ".", "unconditional", "=", "True", "return", "hparams" ]
Data parallel CIFAR parameters.
[ "Data", "parallel", "CIFAR", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L493-L510
train
Data parallel CIFAR parameters.
Pu7Z6I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4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(51 - 3) + '\x6f' + '\x32' + chr(0b110101) + chr(1346 - 1291), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(5650 - 5539) + '\062' + chr(0b110000) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110110) + chr(0b1110 + 0o42), 49487 - 49479), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + '\x33' + '\065' + chr(0b100011 + 0o22), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b110001) + '\060' + chr(1666 - 1618), 0o10), ehT0Px3KOsy9(chr(2194 - 2146) + chr(0b1011111 + 0o20) + chr(50) + chr(1202 - 1154) + chr(0b110000 + 0o6), 20371 - 20363), ehT0Px3KOsy9(chr(469 - 421) + chr(0b110111 + 0o70) + '\062' + '\064' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(112 - 64) + '\x6f' + '\x32' + chr(0b110001) + '\066', 56435 - 56427), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\x32' + chr(702 - 650), 0o10), ehT0Px3KOsy9(chr(836 - 788) + chr(0b101011 + 0o104) + '\x31' + chr(0b100001 + 0o21) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7806 - 7695) + '\x33' + '\065' + chr(1351 - 1303), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x32' + chr(52), 19216 - 19208), ehT0Px3KOsy9(chr(48) + chr(9155 - 9044) + chr(0b110011) + chr(50), 9393 - 9385), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1001 - 950) + chr(0b110000) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100100 + 0o13) + chr(554 - 500) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(1183 - 1134) + chr(0b11010 + 0o26) + chr(0b1110 + 0o50), 61646 - 61638), ehT0Px3KOsy9('\060' + '\157' + '\062', 38778 - 38770), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\061' + chr(55), 31243 - 31235), ehT0Px3KOsy9('\060' + chr(0b111110 + 0o61) + '\062' + chr(0b110 + 0o55) + '\x30', 12960 - 12952), ehT0Px3KOsy9(chr(732 - 684) + chr(0b10100 + 0o133) + '\064' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + chr(0b110010) + chr(0b110100) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(9017 - 8906) + '\x35' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1487 - 1439) + '\157' + chr(0b1001 + 0o52) + '\065' + '\x34', 56358 - 56350), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1113 - 1063) + chr(0b1000 + 0o50) + chr(774 - 721), 63572 - 63564), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\064' + chr(0b111 + 0o57), 0b1000), ehT0Px3KOsy9('\x30' + chr(6945 - 6834) + chr(1311 - 1261) + chr(2787 - 2732) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(48) + '\065', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(52) + chr(360 - 305), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\x34' + '\x34', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110000 + 0o77) + chr(172 - 123) + chr(0b110000) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1500 - 1451) + chr(0b1110 + 0o46) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + chr(51) + chr(0b110000) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + chr(0b111 + 0o54) + chr(51) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(8064 - 7953) + chr(0b101001 + 0o11) + '\064' + chr(2653 - 2601), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37' + chr(0b11010 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6167 - 6056) + chr(51) + '\060' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1946 - 1895) + '\x31' + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(1123 - 1012) + '\063' + '\061', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + '\065' + '\060', 39090 - 39082)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x81'), '\144' + '\145' + chr(0b1100011) + chr(111) + '\144' + '\145')(chr(117) + '\x74' + chr(0b110100 + 0o62) + chr(45) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def IE2MnuLuDDcE(): n4ljua2gi1Pr = IQVaU75bOmJQ() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xcd\xe1\xc4\x8e(\xbc\x99'), '\x64' + chr(0b111011 + 0o52) + chr(0b1100011) + chr(0b1000 + 0o147) + chr(100) + chr(101))('\x75' + '\x74' + '\146' + chr(0b11010 + 0o23) + '\x38') n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\xcd\xe1\xc4\x8e(\xbc\xc3u\xfa7?'), chr(2256 - 2156) + '\145' + chr(99) + chr(0b1010001 + 0o36) + chr(0b1100100) + chr(0b1011011 + 0o12))(chr(0b1110101) + chr(11513 - 11397) + '\x66' + chr(0b101101) + chr(0b0 + 0o70)) n4ljua2gi1Pr.YBAB1XyoxOc5 = ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b110010) + '\x34' + chr(0b1111 + 0o45) + '\060', ord("\x08")) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + '\060', 0b1000) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110100), 0b1000) n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(0b110100), 0o10) n4ljua2gi1Pr.MMwtQ0bPonxt = ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b110100) + '\x30' + '\060', 0b1000) n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b11111 + 0o21) + '\x30' + chr(0b110000), 0b1000) n4ljua2gi1Pr.EpyOHjLLhjxL = ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(0b110000) + chr(2092 - 2044) + '\x30', 0o10) n4ljua2gi1Pr.QGSIpd_yUNzU = 0.5 n4ljua2gi1Pr.WjY1aZ7lwLOu = xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1\xef\xde\x88'), chr(6463 - 6363) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(0b10000 + 0o124) + chr(101))(chr(117) + '\x74' + chr(6880 - 6778) + chr(0b100101 + 0o10) + chr(56)) n4ljua2gi1Pr.s6T_PoakASTI = xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xe1\xde'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(3060 - 2960) + chr(0b1100101))('\x75' + chr(116) + '\146' + chr(0b100101 + 0o10) + '\x38') n4ljua2gi1Pr.RW_xSzp18UeS = 0.3 n4ljua2gi1Pr.IcYfltg0WkcT = ehT0Px3KOsy9(chr(0b110000) + chr(3542 - 3431) + '\x31', 2475 - 2467) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_cifar_4x
def mtf_image_transformer_cifar_4x(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base_cifar() hparams.mesh_shape = "batch:32" hparams.layout = "batch:batch" hparams.batch_size = 128 return hparams
python
def mtf_image_transformer_cifar_4x(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base_cifar() hparams.mesh_shape = "batch:32" hparams.layout = "batch:batch" hparams.batch_size = 128 return hparams
[ "def", "mtf_image_transformer_cifar_4x", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_cifar", "(", ")", "hparams", ".", "mesh_shape", "=", "\"batch:32\"", "hparams", ".", "layout", "=", "\"batch:batch\"", "hparams", ".", "batch_size", "=", "128", "return", "hparams" ]
Data parallel CIFAR parameters.
[ "Data", "parallel", "CIFAR", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L514-L520
train
Data parallel CIFAR parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,s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,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1000 + 0o52) + chr(0b11 + 0o64) + chr(2234 - 2185), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110100) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8593 - 8482) + chr(1957 - 1908) + chr(661 - 608) + '\x30', 0o10), ehT0Px3KOsy9(chr(1007 - 959) + '\x6f' + chr(49) + chr(0b110010) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(121 - 10) + '\063' + '\x30' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7783 - 7672) + chr(51) + chr(0b10100 + 0o42) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110111) + chr(2381 - 2329), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110111) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(1149 - 1038) + chr(0b110011) + '\x31' + chr(0b10100 + 0o36), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\066' + chr(0b100101 + 0o15), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b10100 + 0o35) + chr(0b110011) + chr(2915 - 2861), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + chr(0b10111 + 0o34) + chr(0b110000) + chr(0b110110), 44860 - 44852), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2333 - 2280) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\x31' + chr(0b110000) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1932 - 1884) + chr(0b1101111) + '\x31' + chr(1883 - 1833), 47246 - 47238), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\x35' + '\066', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(928 - 817) + chr(51) + '\x31' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11110 + 0o23) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(7470 - 7359) + chr(51) + chr(54) + chr(0b10 + 0o57), 47629 - 47621), ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + chr(1893 - 1842) + '\063' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + chr(51) + chr(51) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110111) + chr(0b101001 + 0o15), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10666 - 10555) + '\062' + chr(0b101101 + 0o7) + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + chr(560 - 449) + '\061' + '\067' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(2095 - 2047) + chr(0b100100 + 0o113) + '\x31' + '\x37' + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\064' + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110100) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\x33' + chr(0b100001 + 0o17), 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(0b110011) + '\x30' + '\061', 0o10), ehT0Px3KOsy9(chr(2194 - 2146) + chr(0b11011 + 0o124) + chr(50) + '\062' + chr(50), 26970 - 26962), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b100100 + 0o14) + chr(0b11010 + 0o32), 50788 - 50780), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(2497 - 2446) + chr(0b100101 + 0o13) + chr(55), 8), ehT0Px3KOsy9(chr(912 - 864) + chr(8001 - 7890) + '\063' + chr(55), 47411 - 47403), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(2894 - 2839) + chr(2046 - 1992), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1000 + 0o53) + chr(2459 - 2409) + chr(1156 - 1104), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\066' + chr(2794 - 2741), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110011 + 0o74) + chr(0b1010 + 0o50) + chr(0b110001) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1782 - 1734) + '\x6f' + chr(49) + chr(1720 - 1668) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + chr(1993 - 1944) + '\060' + chr(116 - 66), 8), ehT0Px3KOsy9(chr(1348 - 1300) + '\x6f' + '\062' + chr(0b110110) + chr(50), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b100011 + 0o22) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x97'), '\144' + chr(101) + '\x63' + '\x6f' + chr(8004 - 7904) + chr(2480 - 2379))('\x75' + '\x74' + '\146' + chr(45) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def qEjIgpCwBQav(): n4ljua2gi1Pr = IE2MnuLuDDcE() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x04\x1c7\xaf\xcd\x0fL'), chr(0b1100100) + chr(101) + '\143' + chr(7452 - 7341) + chr(4522 - 4422) + chr(101))('\165' + chr(0b1010001 + 0o43) + chr(102) + chr(0b101001 + 0o4) + '\070') n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x04\x1c7\xaf\xcd^\x1f\xbeQ6'), '\x64' + chr(0b1100101) + '\x63' + '\157' + chr(3057 - 2957) + '\x65')(chr(117) + chr(116) + '\x66' + chr(300 - 255) + chr(0b111000)) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(561 - 513) + chr(0b1101111) + chr(0b110000 + 0o2) + chr(48) + chr(865 - 817), 43688 - 43680) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_cifar_mp_4x
def mtf_image_transformer_cifar_mp_4x(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base_cifar() hparams.mesh_shape = "model:4;batch:8" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 32 hparams.num_heads = 8 hparams.d_ff = 8192 return hparams
python
def mtf_image_transformer_cifar_mp_4x(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base_cifar() hparams.mesh_shape = "model:4;batch:8" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 32 hparams.num_heads = 8 hparams.d_ff = 8192 return hparams
[ "def", "mtf_image_transformer_cifar_mp_4x", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_cifar", "(", ")", "hparams", ".", "mesh_shape", "=", "\"model:4;batch:8\"", "hparams", ".", "layout", "=", "\"batch:batch;d_ff:model;heads:model\"", "hparams", ".", "batch_size", "=", "32", "hparams", ".", "num_heads", "=", "8", "hparams", ".", "d_ff", "=", "8192", "return", "hparams" ]
Data parallel CIFAR parameters.
[ "Data", "parallel", "CIFAR", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L524-L532
train
Data parallel CIFAR parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk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zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(11240 - 11129) + chr(49) + '\065' + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b110010) + '\x34', 26513 - 26505), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b1100 + 0o51) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b1000 + 0o51) + chr(54) + '\063', 32668 - 32660), ehT0Px3KOsy9(chr(2256 - 2208) + chr(0b111010 + 0o65) + chr(0b10110 + 0o37), 13556 - 13548), ehT0Px3KOsy9('\060' + chr(111) + chr(579 - 529) + chr(0b110111) + '\061', 35957 - 35949), ehT0Px3KOsy9('\x30' + chr(9007 - 8896) + chr(50) + chr(1427 - 1372) + chr(2061 - 2013), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(919 - 869) + chr(126 - 78) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(1249 - 1201) + chr(0b1101111 + 0o0) + chr(540 - 491) + chr(54) + chr(53), 16255 - 16247), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + '\063' + chr(0b110101) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(871 - 819) + chr(692 - 637), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001101 + 0o42) + '\063' + chr(48) + chr(0b1001 + 0o56), 0b1000), ehT0Px3KOsy9(chr(1909 - 1861) + chr(0b1101111) + chr(54) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(50) + '\065' + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(1345 - 1290), 20126 - 20118), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10010 + 0o37) + chr(1872 - 1819) + chr(51), 24400 - 24392), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x30' + chr(54), 0o10), ehT0Px3KOsy9(chr(1599 - 1551) + chr(9857 - 9746) + chr(0b110010) + chr(0b110110) + chr(2186 - 2138), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x31' + chr(1105 - 1051), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(1473 - 1425) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(5280 - 5169) + '\x33' + '\060', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100100 + 0o16) + chr(0b101 + 0o55) + chr(1211 - 1161), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b110001) + chr(1893 - 1840), 64146 - 64138), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(0b10111 + 0o34) + chr(0b110010) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(50) + '\x35', 18806 - 18798), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(8886 - 8775) + chr(0b10000 + 0o41) + chr(1348 - 1297) + chr(51), 12811 - 12803), ehT0Px3KOsy9('\x30' + '\x6f' + '\x34', 13775 - 13767), ehT0Px3KOsy9(chr(1007 - 959) + chr(111) + '\x33' + '\062' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(10970 - 10859) + chr(0b1000 + 0o54) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + '\062' + chr(2133 - 2080) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(10734 - 10623) + '\x33' + chr(0b110111) + chr(0b110000 + 0o6), 3326 - 3318), ehT0Px3KOsy9(chr(505 - 457) + chr(0b1100001 + 0o16) + chr(2392 - 2341) + '\063' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\066' + chr(0b100010 + 0o17), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b110001) + chr(0b101101 + 0o11), 0o10), ehT0Px3KOsy9(chr(773 - 725) + '\x6f' + chr(1001 - 952) + chr(0b110101) + chr(0b110011), 8), ehT0Px3KOsy9(chr(499 - 451) + chr(441 - 330) + '\062' + '\064' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1011001 + 0o26) + '\062' + '\066' + chr(0b110011 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11800 - 11689) + chr(0b10000 + 0o43) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101000 + 0o12) + chr(51) + '\060', 0o10), ehT0Px3KOsy9(chr(1518 - 1470) + chr(2365 - 2254) + chr(0b110010) + chr(0b101011 + 0o12) + chr(48), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(9978 - 9867) + '\x35' + chr(524 - 476), 24435 - 24427)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'A'), '\144' + chr(0b1011 + 0o132) + '\143' + '\x6f' + '\x64' + '\x65')(chr(0b1101110 + 0o7) + chr(0b1 + 0o163) + chr(102) + chr(45) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def oeZFCUMZQTT3(): n4ljua2gi1Pr = IE2MnuLuDDcE() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xfb\x8f\x16i\x83\x8c\xba\x17\x8d\xd3\xa4]\x937'), '\144' + '\x65' + chr(5026 - 4927) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b111001 + 0o73) + chr(0b1100110) + chr(45) + chr(0b111000)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\r\xf5\x9f\x10m\x83\xda\xe0\x01\x8f\xcf\xfcQ\xf6i\r|\xdd\xe1\xe2}\xfe\xb6\xb8\xf0:`\xa5\x1d\xc0\x91\xb9\x14"'), chr(0b1100000 + 0o4) + '\145' + chr(0b1011111 + 0o4) + chr(111) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(45) + chr(0b111000)) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1050 - 998) + chr(0b110000), 0b1000) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + '\x31' + chr(0b110000), ord("\x08")) n4ljua2gi1Pr.EpyOHjLLhjxL = ehT0Px3KOsy9('\x30' + '\157' + chr(2119 - 2069) + '\060' + '\x30' + chr(2233 - 2185) + chr(0b100001 + 0o17), 0o10) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_imagenet
def mtf_image_transformer_base_imagenet(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base_cifar() hparams.mesh_shape = "batch:32" hparams.layout = "batch:batch" hparams.batch_size = 128 hparams.d_ff = 2048 hparams.hidden_size = 512 hparams.num_decoder_layers = 12 hparams.learning_rate = 0.5 hparams.learning_rate_warmup_steps = 31250 hparams.layer_preprocess_sequence = "none" hparams.layer_postprocess_sequence = "dan" hparams.layer_prepostprocess_dropout = 0.1 hparams.unconditional = True return hparams
python
def mtf_image_transformer_base_imagenet(): """Data parallel CIFAR parameters.""" hparams = mtf_image_transformer_base_cifar() hparams.mesh_shape = "batch:32" hparams.layout = "batch:batch" hparams.batch_size = 128 hparams.d_ff = 2048 hparams.hidden_size = 512 hparams.num_decoder_layers = 12 hparams.learning_rate = 0.5 hparams.learning_rate_warmup_steps = 31250 hparams.layer_preprocess_sequence = "none" hparams.layer_postprocess_sequence = "dan" hparams.layer_prepostprocess_dropout = 0.1 hparams.unconditional = True return hparams
[ "def", "mtf_image_transformer_base_imagenet", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_cifar", "(", ")", "hparams", ".", "mesh_shape", "=", "\"batch:32\"", "hparams", ".", "layout", "=", "\"batch:batch\"", "hparams", ".", "batch_size", "=", "128", "hparams", ".", "d_ff", "=", "2048", "hparams", ".", "hidden_size", "=", "512", "hparams", ".", "num_decoder_layers", "=", "12", "hparams", ".", "learning_rate", "=", "0.5", "hparams", ".", "learning_rate_warmup_steps", "=", "31250", "hparams", ".", "layer_preprocess_sequence", "=", "\"none\"", "hparams", ".", "layer_postprocess_sequence", "=", "\"dan\"", "hparams", ".", "layer_prepostprocess_dropout", "=", "0.1", "hparams", ".", "unconditional", "=", "True", "return", "hparams" ]
Data parallel CIFAR parameters.
[ "Data", "parallel", "CIFAR", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L536-L551
train
Data parallel CIFAR parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03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MiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(104 - 54) + chr(1373 - 1325) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\061' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(2207 - 2158) + '\x32' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + '\x32' + chr(55) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110100) + chr(0b10011 + 0o35), 0o10), ehT0Px3KOsy9('\060' + chr(3948 - 3837) + '\x32' + '\x37' + '\066', 27871 - 27863), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b10101 + 0o132) + '\x31' + '\x35' + '\x35', 0b1000), ehT0Px3KOsy9(chr(2236 - 2188) + '\157' + chr(0b1101 + 0o46) + '\067' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1685 - 1636) + '\062' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(9126 - 9015) + '\061' + '\062' + '\x33', 41964 - 41956), ehT0Px3KOsy9('\x30' + chr(2480 - 2369) + chr(1612 - 1563) + chr(52) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + chr(0b110011) + '\065' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + '\067' + chr(51), 3399 - 3391), ehT0Px3KOsy9(chr(0b110000) + chr(5169 - 5058) + '\x37' + chr(2314 - 2263), 8), ehT0Px3KOsy9(chr(2198 - 2150) + '\x6f' + chr(0b110100) + chr(0b100101 + 0o20), 0o10), ehT0Px3KOsy9('\x30' + chr(1564 - 1453) + chr(0b110011) + chr(920 - 869) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1633 - 1585) + '\157' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(1768 - 1718) + chr(52) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\x37' + '\x31', 19605 - 19597), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + '\x37' + chr(0b111 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + chr(0b1110 + 0o46), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\x37' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9(chr(651 - 603) + chr(0b1101111) + chr(356 - 306) + '\x31' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(2066 - 2018) + '\x6f' + chr(51) + '\062' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100001 + 0o21) + chr(54) + chr(1547 - 1499), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1074 - 1022) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b110010) + chr(0b101 + 0o62) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + '\x34' + chr(53), 31578 - 31570), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(1195 - 1144) + chr(0b10101 + 0o35), 21677 - 21669), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b110111) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010 + 0o145) + chr(0b110011) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1825 - 1777) + chr(0b1001110 + 0o41) + '\063' + chr(2240 - 2192) + chr(0b101101 + 0o6), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100111 + 0o13) + '\x33' + '\062', 0o10), ehT0Px3KOsy9(chr(2133 - 2085) + chr(0b1101111) + chr(0b110010) + chr(0b110001) + chr(306 - 254), 8), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + '\x31' + chr(1423 - 1369) + chr(2205 - 2155), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\x32' + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(739 - 628) + '\066' + chr(54), 45255 - 45247), ehT0Px3KOsy9(chr(48) + chr(0b111111 + 0o60) + '\x31' + chr(1852 - 1804) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2019 - 1970) + '\x34' + '\064', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + '\065' + '\060', 42368 - 42360)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xad'), chr(4740 - 4640) + chr(101) + '\x63' + chr(111) + '\x64' + '\x65')('\x75' + chr(116) + chr(5234 - 5132) + '\x2d' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def w8pQmS6Hfpnc(): n4ljua2gi1Pr = IE2MnuLuDDcE() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xed"\xd9H\x84^\xcb'), '\x64' + chr(7736 - 7635) + chr(5766 - 5667) + chr(1986 - 1875) + '\144' + '\145')(chr(2599 - 2482) + chr(0b1110100) + '\146' + chr(1251 - 1206) + chr(2460 - 2404)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xed"\xd9H\x84\x0f\x98&0\n'), chr(5996 - 5896) + '\x65' + chr(4137 - 4038) + '\x6f' + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b1000000 + 0o64) + '\146' + '\x2d' + '\x38') n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(2078 - 2030) + chr(111) + chr(1051 - 1001) + '\x30' + chr(48), 0o10) n4ljua2gi1Pr.EpyOHjLLhjxL = ehT0Px3KOsy9('\x30' + chr(5873 - 5762) + chr(0b1100 + 0o50) + chr(1617 - 1569) + chr(48) + chr(0b100011 + 0o15), ord("\x08")) n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100111 + 0o12) + chr(0b11111 + 0o21) + '\x30' + chr(0b1011 + 0o45), 0b1000) n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9(chr(48) + chr(12182 - 12071) + chr(1702 - 1653) + '\064', ord("\x08")) n4ljua2gi1Pr.QGSIpd_yUNzU = 0.5 n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(0b110000 + 0o7) + '\x35' + chr(48) + '\x32' + chr(323 - 273), 0o10) n4ljua2gi1Pr.WjY1aZ7lwLOu = xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\xe38\xdf'), chr(0b1100100) + chr(101) + chr(0b10000 + 0o123) + chr(111) + '\144' + '\145')(chr(11121 - 11004) + chr(116) + '\x66' + chr(1053 - 1008) + chr(56)) n4ljua2gi1Pr.s6T_PoakASTI = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7\xed8'), '\x64' + chr(1178 - 1077) + chr(0b1100011) + chr(0b110 + 0o151) + chr(4081 - 3981) + chr(101))(chr(117) + '\164' + chr(102) + chr(0b101101) + chr(0b111000)) n4ljua2gi1Pr.RW_xSzp18UeS = 0.1 n4ljua2gi1Pr.IcYfltg0WkcT = ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10110 + 0o33), 0o10) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_imagenet_mp
def mtf_image_transformer_base_imagenet_mp(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:4;batch:8" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 32 hparams.num_heads = 8 hparams.d_ff = 8192 hparams.learning_rate_warmup_steps = 31250 hparams.unconditional = True return hparams
python
def mtf_image_transformer_base_imagenet_mp(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:4;batch:8" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 32 hparams.num_heads = 8 hparams.d_ff = 8192 hparams.learning_rate_warmup_steps = 31250 hparams.unconditional = True return hparams
[ "def", "mtf_image_transformer_base_imagenet_mp", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_imagenet", "(", ")", "hparams", ".", "mesh_shape", "=", "\"model:4;batch:8\"", "hparams", ".", "layout", "=", "\"batch:batch;d_ff:model;heads:model\"", "hparams", ".", "batch_size", "=", "32", "hparams", ".", "num_heads", "=", "8", "hparams", ".", "d_ff", "=", "8192", "hparams", ".", "learning_rate_warmup_steps", "=", "31250", "hparams", ".", "unconditional", "=", "True", "return", "hparams" ]
Model parallel ImageNet parameters.
[ "Model", "parallel", "ImageNet", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L555-L565
train
Model parallel ImageNet parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVV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cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\x30' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(348 - 300) + '\x6f' + '\x32' + '\064' + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110111) + chr(2130 - 2078), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101101 + 0o2) + chr(0b110010) + '\064' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1141 - 1093) + chr(6046 - 5935) + '\063' + chr(1760 - 1709), 43880 - 43872), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(589 - 538) + '\067' + chr(0b1111 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + chr(50) + '\x30' + chr(0b110 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100001 + 0o22) + chr(55) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + '\062' + chr(52) + '\064', 0o10), ehT0Px3KOsy9(chr(703 - 655) + chr(5579 - 5468) + chr(0b110011) + chr(51) + chr(0b101110 + 0o7), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(345 - 294) + '\x31' + chr(51), 9304 - 9296), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\x32' + chr(0b110110), 1955 - 1947), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b110011) + chr(50) + chr(0b110000 + 0o1), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + chr(0b100010 + 0o21), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(3423 - 3312) + chr(51) + chr(55) + '\064', 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(50) + chr(920 - 870) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11111 + 0o120) + chr(0b10001 + 0o42) + chr(52) + '\x36', 62348 - 62340), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x36' + chr(48), 44812 - 44804), ehT0Px3KOsy9(chr(48) + '\157' + '\x34', 62974 - 62966), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\061' + chr(0b1111 + 0o50), 39098 - 39090), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + '\061' + chr(832 - 784) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(1746 - 1695), 8), ehT0Px3KOsy9(chr(48) + chr(9876 - 9765) + chr(1373 - 1322) + chr(778 - 724) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001 + 0o6) + chr(1816 - 1765), 3045 - 3037), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(51) + chr(49), 4633 - 4625), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(53) + chr(2033 - 1979), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(0b100010 + 0o20) + '\x32' + chr(0b110111), 35130 - 35122), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\x32' + chr(1552 - 1503) + chr(0b110010 + 0o2), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101 + 0o152) + chr(51) + '\062' + '\061', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(1881 - 1830) + chr(0b11100 + 0o26) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(50) + chr(1121 - 1072), 8), ehT0Px3KOsy9('\060' + chr(408 - 297) + '\x31' + '\x37' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(514 - 465) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(11799 - 11688) + chr(1662 - 1611) + chr(53) + chr(0b1011 + 0o47), 47912 - 47904), ehT0Px3KOsy9('\060' + chr(0b10000 + 0o137) + chr(159 - 109) + '\x34' + chr(1351 - 1296), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1900 - 1851) + chr(0b110001) + chr(205 - 157), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(1318 - 1267), 0o10), ehT0Px3KOsy9('\060' + chr(9208 - 9097) + chr(0b11001 + 0o32) + chr(223 - 168) + chr(0b11001 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110011) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1362 - 1312) + '\060' + chr(2577 - 2523), 36842 - 36834)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b10 + 0o155) + chr(53) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xaa'), chr(7566 - 7466) + '\x65' + '\x63' + chr(111) + chr(0b1001010 + 0o32) + '\145')('\x75' + chr(5576 - 5460) + chr(0b1000000 + 0o46) + chr(0b1101 + 0o40) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def vDolq_enHGxo(): n4ljua2gi1Pr = w8pQmS6Hfpnc() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xcc\x98\xc7w\xc1\xb5\xc4\xc6\xbc\xbf\xf5\xb9\t\xc4'), chr(0b1100100) + chr(0b10100 + 0o121) + chr(0b1100011) + chr(111) + '\x64' + chr(0b110010 + 0o63))(chr(0b100101 + 0o120) + chr(2153 - 2037) + chr(0b1100110) + chr(0b11001 + 0o24) + chr(837 - 781)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6\xc2\x88\xc1s\xc1\xe3\x9e\xd0\xbe\xa3\xad\xb5l\x9a\xf2\xdc]k\xab w\xcdS|\xcf\xf3\xff\xeb\xb9\xbe\x1e/\x86'), '\x64' + chr(101) + '\x63' + chr(0b111011 + 0o64) + chr(0b100011 + 0o101) + chr(0b1100101))(chr(3366 - 3249) + chr(116) + chr(102) + '\055' + '\070') n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + chr(0b110 + 0o52), ord("\x08")) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x30', ord("\x08")) n4ljua2gi1Pr.EpyOHjLLhjxL = ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(2166 - 2055) + chr(0b110010) + chr(48) + chr(0b1000 + 0o50) + chr(0b100101 + 0o13) + '\060', 17003 - 16995) n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110111) + '\065' + chr(0b101 + 0o53) + chr(50) + '\062', 0o10) n4ljua2gi1Pr.IcYfltg0WkcT = ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10110 + 0o33), 26382 - 26374) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_imagenet_mp128
def mtf_image_transformer_base_imagenet_mp128(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 8 hparams.img_len = 128 hparams.block_length = 128 hparams.num_heads = 8 hparams.num_decoder_layers = 4 hparams.d_ff = 4096 hparams.learning_rate_warmup_steps = 31250 hparams.unconditional = True hparams.max_length = 256*256*3 return hparams
python
def mtf_image_transformer_base_imagenet_mp128(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 8 hparams.img_len = 128 hparams.block_length = 128 hparams.num_heads = 8 hparams.num_decoder_layers = 4 hparams.d_ff = 4096 hparams.learning_rate_warmup_steps = 31250 hparams.unconditional = True hparams.max_length = 256*256*3 return hparams
[ "def", "mtf_image_transformer_base_imagenet_mp128", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_imagenet", "(", ")", "hparams", ".", "mesh_shape", "=", "\"model:8;batch:4\"", "hparams", ".", "layout", "=", "\"batch:batch;d_ff:model;heads:model\"", "hparams", ".", "batch_size", "=", "8", "hparams", ".", "img_len", "=", "128", "hparams", ".", "block_length", "=", "128", "hparams", ".", "num_heads", "=", "8", "hparams", ".", "num_decoder_layers", "=", "4", "hparams", ".", "d_ff", "=", "4096", "hparams", ".", "learning_rate_warmup_steps", "=", "31250", "hparams", ".", "unconditional", "=", "True", "hparams", ".", "max_length", "=", "256", "*", "256", "*", "3", "return", "hparams" ]
Model parallel ImageNet parameters.
[ "Model", "parallel", "ImageNet", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_trans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eSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1010010 + 0o35) + chr(54) + chr(353 - 302), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100101 + 0o14) + chr(1655 - 1603) + '\061', 28508 - 28500), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100110 + 0o14) + chr(0b100 + 0o55) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(2447 - 2395) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(1506 - 1455) + chr(837 - 785) + '\x34', 9112 - 9104), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b110000) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + chr(51) + chr(1202 - 1151) + chr(0b101111 + 0o6), 53747 - 53739), ehT0Px3KOsy9('\060' + '\157' + chr(0b101110 + 0o4) + chr(1148 - 1098) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1931 - 1880) + chr(1668 - 1617) + chr(1960 - 1910), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34' + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\062' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(497 - 444) + chr(0b11101 + 0o26), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b10100 + 0o34) + chr(0b100111 + 0o13), 36001 - 35993), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + '\x37' + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b10101 + 0o35) + chr(0b110000 + 0o5) + chr(0b101011 + 0o7), 7210 - 7202), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + '\x34' + chr(1808 - 1755), ord("\x08")), ehT0Px3KOsy9('\060' + chr(3266 - 3155) + '\066' + '\x31', 58066 - 58058), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(772 - 724) + chr(0b10011 + 0o44), 11316 - 11308), ehT0Px3KOsy9(chr(2027 - 1979) + '\157' + chr(49) + '\x31' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(11573 - 11462) + '\063' + chr(0b10 + 0o60) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + chr(50) + chr(1511 - 1459) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b11110 + 0o24) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(0b100110 + 0o111) + chr(0b110011) + chr(946 - 892) + chr(0b11111 + 0o23), 51411 - 51403), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + '\063' + chr(0b110010) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(4018 - 3907) + chr(0b11110 + 0o30) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + '\063' + chr(0b11000 + 0o32) + '\061', 59126 - 59118), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101010 + 0o5) + '\x33' + chr(0b110101) + '\062', 0o10), ehT0Px3KOsy9(chr(1781 - 1733) + chr(111) + chr(0b11111 + 0o24) + chr(0b110001) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(51) + '\063', 0b1000), ehT0Px3KOsy9(chr(1730 - 1682) + chr(0b1101111) + chr(1780 - 1729) + chr(54) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(378 - 330) + chr(0b1101111) + chr(0b11 + 0o56) + '\x33' + '\x36', 0b1000), ehT0Px3KOsy9(chr(1252 - 1204) + chr(0b1101111) + '\062' + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10010 + 0o41) + '\x36' + chr(0b111 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(1278 - 1229) + chr(2893 - 2839) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(1456 - 1408) + chr(111) + chr(1543 - 1491), 8595 - 8587), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(4326 - 4215) + '\x33' + '\062' + chr(0b110000 + 0o5), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(49) + chr(49) + chr(0b110110), 22000 - 21992), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101001 + 0o10) + '\x32' + '\064', 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + chr(289 - 239) + chr(894 - 846) + '\060', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1390 - 1339) + chr(0b110111) + '\x31', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d'), chr(100) + '\145' + chr(0b1001001 + 0o32) + chr(715 - 604) + chr(100) + chr(101))(chr(0b101000 + 0o115) + chr(0b1001001 + 0o53) + '\146' + chr(45) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ZwFLKue8RDp3(): n4ljua2gi1Pr = w8pQmS6Hfpnc() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'^\x0e\xe8\xc5\x88\xba\xe5\xaa\xb8E\xa2\xc8\xaa\x05\x9e'), chr(0b1100100) + chr(4115 - 4014) + chr(0b1011110 + 0o5) + chr(111) + chr(100) + '\x65')(chr(0b1110101) + chr(0b1001001 + 0o53) + chr(102) + chr(0b11101 + 0o20) + chr(2504 - 2448)) n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'Q\x00\xf8\xc3\x8c\xba\xbf\xf0\xaeG\xbe\x90\xa6`\xcc\xc3\x0b\xea"\xb4\xc7\xfe\xc9\xbaW\xb0\x8e\xb8a\x981\xca\x96\x1e'), '\144' + '\145' + chr(6750 - 6651) + chr(0b111 + 0o150) + chr(100) + '\x65')(chr(0b1001010 + 0o53) + chr(13213 - 13097) + chr(0b1100110) + chr(0b10000 + 0o35) + chr(2238 - 2182)) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(48), 40685 - 40677) n4ljua2gi1Pr.laxD7jy5y7k1 = ehT0Px3KOsy9(chr(466 - 418) + '\x6f' + '\x32' + '\x30' + '\x30', 8) n4ljua2gi1Pr.MMwtQ0bPonxt = ehT0Px3KOsy9('\060' + '\157' + chr(0b101111 + 0o3) + '\x30' + chr(0b110000), 8) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1100101 + 0o12) + chr(1243 - 1194) + chr(2236 - 2188), 8) n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + '\064', 8) n4ljua2gi1Pr.EpyOHjLLhjxL = ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + '\060' + chr(0b110000) + chr(0b110000) + '\x30', ord("\x08")) n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9('\060' + chr(0b110000 + 0o77) + '\067' + '\x35' + chr(48) + chr(50) + '\x32', 0b1000) n4ljua2gi1Pr.IcYfltg0WkcT = ehT0Px3KOsy9(chr(1923 - 1875) + chr(0b1010010 + 0o35) + chr(1314 - 1265), 6071 - 6063) n4ljua2gi1Pr._o7pVXAdOCRy = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\064' + chr(768 - 720) + chr(0b110000), ord("\x08")) * ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110100) + chr(2275 - 2227) + chr(2068 - 2020), 8) * ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100100 + 0o17), 0b1000) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_imagenet_mp_sp
def mtf_image_transformer_base_imagenet_mp_sp(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet_mp128() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;num_wblocks:model" hparams.batch_size = 8 hparams.img_len = 128 hparams.block_length = 128 hparams.attention_type = "local1d_spatial" return hparams
python
def mtf_image_transformer_base_imagenet_mp_sp(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet_mp128() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;num_wblocks:model" hparams.batch_size = 8 hparams.img_len = 128 hparams.block_length = 128 hparams.attention_type = "local1d_spatial" return hparams
[ "def", "mtf_image_transformer_base_imagenet_mp_sp", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_imagenet_mp128", "(", ")", "hparams", ".", "mesh_shape", "=", "\"model:8;batch:4\"", "hparams", ".", "layout", "=", "\"batch:batch;d_ff:model;num_wblocks:model\"", "hparams", ".", "batch_size", "=", "8", "hparams", ".", "img_len", "=", "128", "hparams", ".", "block_length", "=", "128", "hparams", ".", "attention_type", "=", "\"local1d_spatial\"", "return", "hparams" ]
Model parallel ImageNet parameters.
[ "Model", "parallel", "ImageNet", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L587-L596
train
Model parallel ImageNet parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0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C9iu2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\061' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(0b110001) + chr(1848 - 1793), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(2505 - 2454) + '\064' + '\x34', 63559 - 63551), ehT0Px3KOsy9('\x30' + chr(0b1101101 + 0o2) + chr(0b0 + 0o61) + chr(49) + chr(0b10100 + 0o41), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1772 - 1721) + chr(49) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b11010 + 0o26) + chr(0b110101), 25712 - 25704), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(2645 - 2593) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10112 - 10001) + chr(1502 - 1453) + chr(2097 - 2044) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + chr(51) + chr(428 - 375) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(3217 - 3106) + chr(536 - 487), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2486 - 2375) + chr(0b110100) + '\067', 5170 - 5162), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(54) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x35' + '\064', 0o10), ehT0Px3KOsy9(chr(2032 - 1984) + '\x6f' + chr(51) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(64 - 15) + '\064' + chr(0b100100 + 0o22), 38597 - 38589), ehT0Px3KOsy9(chr(1732 - 1684) + '\157' + chr(519 - 469) + chr(0b110110) + chr(0b110000 + 0o5), 0o10), ehT0Px3KOsy9(chr(143 - 95) + chr(0b1101111) + chr(1586 - 1536) + chr(49) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(76 - 28) + '\x6f' + chr(1680 - 1631) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(560 - 512) + chr(0b1101111) + chr(358 - 307) + chr(1217 - 1165) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(398 - 350) + '\x6f' + chr(51) + '\065', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(53) + chr(0b101010 + 0o13), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1816 - 1765) + chr(0b110111) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(0b100 + 0o57) + chr(2492 - 2437) + '\062', 46604 - 46596), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(529 - 478) + '\064' + chr(0b110110), 49757 - 49749), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110111) + chr(1897 - 1849), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\063' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(12167 - 12056) + '\063' + '\065', 8), ehT0Px3KOsy9(chr(813 - 765) + chr(5682 - 5571) + chr(49) + '\067' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(0b110011) + '\067' + '\x34', 8), ehT0Px3KOsy9('\060' + chr(4874 - 4763) + chr(51) + chr(0b110000) + chr(0b11100 + 0o30), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + '\x33' + '\061' + chr(1853 - 1800), 41150 - 41142), ehT0Px3KOsy9('\x30' + chr(0b1101000 + 0o7) + chr(392 - 341) + chr(969 - 917) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1100100 + 0o13) + '\061' + '\064' + '\x33', 0o10), ehT0Px3KOsy9(chr(1412 - 1364) + chr(0b1000001 + 0o56) + chr(0b110001) + chr(52) + chr(0b100110 + 0o13), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(0b110001 + 0o0) + chr(0b100000 + 0o25) + chr(49), 8), ehT0Px3KOsy9(chr(1666 - 1618) + chr(0b1101111) + '\x33' + chr(2490 - 2437) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(4396 - 4285) + chr(0b10110 + 0o40) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11110 + 0o25) + chr(0b110011) + chr(0b100111 + 0o15), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1100110 + 0o11) + chr(2016 - 1965) + chr(0b10100 + 0o37) + chr(360 - 311), 16665 - 16657)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101 + 0o142) + chr(53) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0'), chr(0b1100100) + '\x65' + chr(99) + chr(0b1101111) + '\x64' + '\x65')(chr(11603 - 11486) + chr(1585 - 1469) + '\x66' + chr(45) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Am8jFCupaX6I(): n4ljua2gi1Pr = ZwFLKue8RDp3() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3 \x80(\xa3\x7fYR\x8c`S\x14D#R'), chr(9840 - 9740) + '\145' + '\143' + '\157' + chr(100) + chr(149 - 48))(chr(0b1110101) + chr(0b10011 + 0o141) + chr(2373 - 2271) + '\x2d' + '\x38') n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b'\xec.\x90.\xa7\x7f\x03\x08\x9abOLHF\x00\xd3\xb6g\x8fyH\x90!\x94\x93U\x03j\x1b\x90\xab\xae\x89\x10[\x04\x82P\xb9\xb5'), '\x64' + chr(0b1100101) + chr(696 - 597) + chr(0b1101111) + chr(0b100100 + 0o100) + '\145')('\x75' + chr(0b1110010 + 0o2) + '\146' + chr(608 - 563) + chr(0b1011 + 0o55)) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(48), ord("\x08")) n4ljua2gi1Pr.laxD7jy5y7k1 = ehT0Px3KOsy9('\x30' + chr(11325 - 11214) + '\x32' + '\x30' + chr(1624 - 1576), ord("\x08")) n4ljua2gi1Pr.MMwtQ0bPonxt = ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b110000) + '\060', 8) n4ljua2gi1Pr.lZ1GB4L2oMeG = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2 \x87,\xa3t\x056\x9dqF\x03Ex\n'), '\144' + chr(0b1100101) + '\x63' + chr(0b1010000 + 0o37) + chr(0b1100100) + '\145')(chr(5038 - 4921) + '\164' + chr(102) + chr(685 - 640) + chr(1946 - 1890)) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
mtf_image_transformer_base_imagenet_mp64
def mtf_image_transformer_base_imagenet_mp64(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 8 hparams.img_len = 64 hparams.num_decoder_layers = 8 return hparams
python
def mtf_image_transformer_base_imagenet_mp64(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 8 hparams.img_len = 64 hparams.num_decoder_layers = 8 return hparams
[ "def", "mtf_image_transformer_base_imagenet_mp64", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_imagenet", "(", ")", "hparams", ".", "mesh_shape", "=", "\"model:8;batch:4\"", "hparams", ".", "layout", "=", "\"batch:batch;d_ff:model;heads:model\"", "hparams", ".", "batch_size", "=", "8", "hparams", ".", "img_len", "=", "64", "hparams", ".", "num_decoder_layers", "=", "8", "return", "hparams" ]
Model parallel ImageNet parameters.
[ "Model", "parallel", "ImageNet", "parameters", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L600-L608
train
Model parallel ImageNet parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_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wji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b1111 + 0o43) + chr(520 - 472), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(0b110010) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(51) + chr(0b110100) + chr(2297 - 2245), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(0b10001 + 0o37) + chr(0b111 + 0o55), 28548 - 28540), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b110100) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(6052 - 5941) + '\x33' + '\067' + '\060', 16812 - 16804), ehT0Px3KOsy9('\060' + '\157' + '\065' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000 + 0o147) + '\x32' + '\x36' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1856 - 1808) + '\157' + '\x37' + '\061', 6736 - 6728), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\x31' + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\066', 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(3479 - 3368) + chr(0b101100 + 0o5) + '\061' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + '\063' + chr(719 - 667) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001 + 0o0) + chr(2565 - 2512) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + '\x33' + '\062' + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(327 - 273) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(8335 - 8224) + '\x32' + chr(52) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(1098 - 1049) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(344 - 292) + chr(1844 - 1796), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\x30' + chr(0b101011 + 0o6), 44235 - 44227), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11 + 0o56) + chr(0b110010) + chr(1925 - 1876), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + '\x32' + '\060' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\062' + chr(0b110011) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + chr(829 - 778) + chr(54) + chr(850 - 800), 7048 - 7040), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b110010) + chr(1307 - 1258), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(53) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b11111 + 0o27) + chr(1185 - 1131), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1010001 + 0o36) + chr(766 - 715) + chr(2278 - 2229) + '\x32', 0b1000), ehT0Px3KOsy9(chr(1351 - 1303) + '\157' + chr(1869 - 1814) + chr(0b100101 + 0o21), 0b1000), ehT0Px3KOsy9(chr(1419 - 1371) + '\x6f' + '\x32' + chr(1627 - 1572) + chr(0b10111 + 0o37), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(540 - 429) + chr(0b110011) + '\065' + chr(50), 18958 - 18950), ehT0Px3KOsy9(chr(628 - 580) + '\x6f' + '\x32' + '\062' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b111011 + 0o64) + chr(0b1001 + 0o50) + chr(0b101100 + 0o12) + '\062', 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + '\063' + '\067' + chr(270 - 218), 19639 - 19631), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(48) + chr(54), 55421 - 55413), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(2274 - 2225) + chr(0b11 + 0o56) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b110111) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110100) + chr(49), 10233 - 10225)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(2575 - 2522) + chr(0b11101 + 0o23), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe'), chr(0b1010110 + 0o16) + '\145' + chr(0b11101 + 0o106) + chr(0b1101111) + chr(6370 - 6270) + chr(3234 - 3133))(chr(0b1110101) + '\164' + '\146' + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def vTiiLLaQV_OK(): n4ljua2gi1Pr = w8pQmS6Hfpnc() n4ljua2gi1Pr.GnGMnRt7o0q6 = xafqLlk3kkUe(SXOLrMavuUCe(b"\xbd\xfe\x80!\x8f\xc2\x15\x8a[\x7f\xbfe'\xdd "), chr(0b0 + 0o144) + chr(0b11100 + 0o111) + chr(0b111010 + 0o51) + chr(1870 - 1759) + '\x64' + chr(0b1000110 + 0o37))('\165' + chr(0b1110100) + chr(7081 - 6979) + '\x2d' + '\070') n4ljua2gi1Pr.HDH7OEwZuDah = xafqLlk3kkUe(SXOLrMavuUCe(b"\xb2\xf0\x90'\x8b\xc2O\xd0M}\xa3=+\xb8r\x0b\xe9\xdb\xcdj\x05-j\xee\xfe\x93\xf5\xde\x8c\xa7Q\xda\x8f\xfa"), '\144' + '\145' + chr(693 - 594) + chr(111) + chr(0b1100100) + '\x65')(chr(0b1001010 + 0o53) + chr(8870 - 8754) + chr(102) + chr(0b101101) + chr(1464 - 1408)) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(1472 - 1424), 0o10) n4ljua2gi1Pr.laxD7jy5y7k1 = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1935 - 1886) + chr(0b110000) + chr(552 - 504), 37826 - 37818) n4ljua2gi1Pr.pRi6YFAYEnH4 = ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101 + 0o54) + chr(0b110000), 8) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/layers/reversible_layers.py
create_degrees
def create_degrees(input_dim, hidden_dims, input_order='left-to-right', hidden_order='left-to-right'): """Returns a list of degree vectors, one for each input and hidden layer. A unit with degree d can only receive input from units with degree < d. Output units always have the same degree as their associated input unit. Args: input_dim: Number of inputs. hidden_dims: list with the number of hidden units per layer. It does not include the output layer. Each hidden unit size must be at least the size of length (otherwise autoregressivity is not possible). input_order: Order of degrees to the input units: 'random', 'left-to-right', 'right-to-left', or an array of an explicit order. For example, 'left-to-right' builds an autoregressive model p(x) = p(x1) p(x2 | x1) ... p(xD | x<D). hidden_order: Order of degrees to the hidden units: 'random', 'left-to-right'. If 'left-to-right', hidden units are allocated equally (up to a remainder term) to each degree. """ if (isinstance(input_order, str) and input_order not in ('random', 'left-to-right', 'right-to-left')): raise ValueError('Input order is not valid.') if hidden_order not in ('random', 'left-to-right'): raise ValueError('Hidden order is not valid.') degrees = [] if isinstance(input_order, str): input_degrees = np.arange(1, input_dim + 1) if input_order == 'right-to-left': input_degrees = np.flip(input_degrees, 0) elif input_order == 'random': np.random.shuffle(input_degrees) else: input_order = np.array(input_order) if np.all(np.sort(input_order) != np.arange(1, input_dim + 1)): raise ValueError('invalid input order') input_degrees = input_order degrees.append(input_degrees) for units in hidden_dims: if hidden_order == 'random': min_prev_degree = min(np.min(degrees[-1]), input_dim - 1) hidden_degrees = np.random.randint( low=min_prev_degree, high=input_dim, size=units) elif hidden_order == 'left-to-right': hidden_degrees = (np.arange(units) % max(1, input_dim - 1) + min(1, input_dim - 1)) degrees.append(hidden_degrees) return degrees
python
def create_degrees(input_dim, hidden_dims, input_order='left-to-right', hidden_order='left-to-right'): """Returns a list of degree vectors, one for each input and hidden layer. A unit with degree d can only receive input from units with degree < d. Output units always have the same degree as their associated input unit. Args: input_dim: Number of inputs. hidden_dims: list with the number of hidden units per layer. It does not include the output layer. Each hidden unit size must be at least the size of length (otherwise autoregressivity is not possible). input_order: Order of degrees to the input units: 'random', 'left-to-right', 'right-to-left', or an array of an explicit order. For example, 'left-to-right' builds an autoregressive model p(x) = p(x1) p(x2 | x1) ... p(xD | x<D). hidden_order: Order of degrees to the hidden units: 'random', 'left-to-right'. If 'left-to-right', hidden units are allocated equally (up to a remainder term) to each degree. """ if (isinstance(input_order, str) and input_order not in ('random', 'left-to-right', 'right-to-left')): raise ValueError('Input order is not valid.') if hidden_order not in ('random', 'left-to-right'): raise ValueError('Hidden order is not valid.') degrees = [] if isinstance(input_order, str): input_degrees = np.arange(1, input_dim + 1) if input_order == 'right-to-left': input_degrees = np.flip(input_degrees, 0) elif input_order == 'random': np.random.shuffle(input_degrees) else: input_order = np.array(input_order) if np.all(np.sort(input_order) != np.arange(1, input_dim + 1)): raise ValueError('invalid input order') input_degrees = input_order degrees.append(input_degrees) for units in hidden_dims: if hidden_order == 'random': min_prev_degree = min(np.min(degrees[-1]), input_dim - 1) hidden_degrees = np.random.randint( low=min_prev_degree, high=input_dim, size=units) elif hidden_order == 'left-to-right': hidden_degrees = (np.arange(units) % max(1, input_dim - 1) + min(1, input_dim - 1)) degrees.append(hidden_degrees) return degrees
[ "def", "create_degrees", "(", "input_dim", ",", "hidden_dims", ",", "input_order", "=", "'left-to-right'", ",", "hidden_order", "=", "'left-to-right'", ")", ":", "if", "(", "isinstance", "(", "input_order", ",", "str", ")", "and", "input_order", "not", "in", "(", "'random'", ",", "'left-to-right'", ",", "'right-to-left'", ")", ")", ":", "raise", "ValueError", "(", "'Input order is not valid.'", ")", "if", "hidden_order", "not", "in", "(", "'random'", ",", "'left-to-right'", ")", ":", "raise", "ValueError", "(", "'Hidden order is not valid.'", ")", "degrees", "=", "[", "]", "if", "isinstance", "(", "input_order", ",", "str", ")", ":", "input_degrees", "=", "np", ".", "arange", "(", "1", ",", "input_dim", "+", "1", ")", "if", "input_order", "==", "'right-to-left'", ":", "input_degrees", "=", "np", ".", "flip", "(", "input_degrees", ",", "0", ")", "elif", "input_order", "==", "'random'", ":", "np", ".", "random", ".", "shuffle", "(", "input_degrees", ")", "else", ":", "input_order", "=", "np", ".", "array", "(", "input_order", ")", "if", "np", ".", "all", "(", "np", ".", "sort", "(", "input_order", ")", "!=", "np", ".", "arange", "(", "1", ",", "input_dim", "+", "1", ")", ")", ":", "raise", "ValueError", "(", "'invalid input order'", ")", "input_degrees", "=", "input_order", "degrees", ".", "append", "(", "input_degrees", ")", "for", "units", "in", "hidden_dims", ":", "if", "hidden_order", "==", "'random'", ":", "min_prev_degree", "=", "min", "(", "np", ".", "min", "(", "degrees", "[", "-", "1", "]", ")", ",", "input_dim", "-", "1", ")", "hidden_degrees", "=", "np", ".", "random", ".", "randint", "(", "low", "=", "min_prev_degree", ",", "high", "=", "input_dim", ",", "size", "=", "units", ")", "elif", "hidden_order", "==", "'left-to-right'", ":", "hidden_degrees", "=", "(", "np", ".", "arange", "(", "units", ")", "%", "max", "(", "1", ",", "input_dim", "-", "1", ")", "+", "min", "(", "1", ",", "input_dim", "-", "1", ")", ")", "degrees", ".", "append", "(", "hidden_degrees", ")", "return", "degrees" ]
Returns a list of degree vectors, one for each input and hidden layer. A unit with degree d can only receive input from units with degree < d. Output units always have the same degree as their associated input unit. Args: input_dim: Number of inputs. hidden_dims: list with the number of hidden units per layer. It does not include the output layer. Each hidden unit size must be at least the size of length (otherwise autoregressivity is not possible). input_order: Order of degrees to the input units: 'random', 'left-to-right', 'right-to-left', or an array of an explicit order. For example, 'left-to-right' builds an autoregressive model p(x) = p(x1) p(x2 | x1) ... p(xD | x<D). hidden_order: Order of degrees to the hidden units: 'random', 'left-to-right'. If 'left-to-right', hidden units are allocated equally (up to a remainder term) to each degree.
[ "Returns", "a", "list", "of", "degree", "vectors", "one", "for", "each", "input", "and", "hidden", "layer", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/reversible_layers.py#L218-L269
train
Creates a list of degree vectors for each input and hidden unit.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AV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DP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(698 - 587) + '\062' + chr(50) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b100001 + 0o24) + chr(0b10110 + 0o32), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100 + 0o153) + chr(55) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(6666 - 6555) + chr(51) + chr(0b110000) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + '\x31' + chr(49) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b101 + 0o56) + chr(2298 - 2245) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001 + 0o0) + chr(0b110000) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(450 - 400) + chr(0b11010 + 0o35) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(0b1110 + 0o42) + '\x35', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\060' + '\061', 59653 - 59645), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(2216 - 2164) + chr(48), 11806 - 11798), ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + chr(0b100001 + 0o26) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(0b1000001 + 0o56) + chr(52) + chr(1208 - 1157), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(4926 - 4815) + chr(0b110001 + 0o1) + chr(53) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(48), 26944 - 26936), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(0b101111 + 0o5) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1001100 + 0o43) + chr(2387 - 2336) + '\061' + chr(0b101 + 0o62), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(0b110011) + chr(0b1011 + 0o50) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(122 - 74) + chr(111) + chr(0b11010 + 0o30) + chr(654 - 601) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + chr(0b10111 + 0o32) + '\064' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1011100 + 0o23) + chr(811 - 760) + chr(0b110110), 37832 - 37824), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(290 - 241) + '\x30' + chr(0b111 + 0o57), 1820 - 1812), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + '\x31' + '\066', 0b1000), ehT0Px3KOsy9(chr(483 - 435) + '\x6f' + '\x32' + chr(0b10111 + 0o32) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b1010 + 0o46) + chr(380 - 331), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110010) + chr(2975 - 2920) + '\x30', 0o10), ehT0Px3KOsy9(chr(1043 - 995) + chr(111) + chr(0b110010) + chr(56 - 6) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(345 - 234) + chr(0b110100) + '\064', 0b1000), ehT0Px3KOsy9(chr(2138 - 2090) + '\157' + chr(1758 - 1706) + chr(814 - 762), 8), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + '\x35' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(168 - 120) + chr(0b11010 + 0o32), 58136 - 58128), ehT0Px3KOsy9(chr(196 - 148) + chr(6957 - 6846) + '\061' + '\x37' + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101000 + 0o107) + chr(0b100 + 0o56) + chr(0b101001 + 0o12) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + chr(0b110010) + '\061' + chr(0b110000), 41146 - 41138), ehT0Px3KOsy9('\x30' + chr(1048 - 937) + chr(51) + chr(0b110010) + chr(0b110111), 53787 - 53779), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + '\063' + chr(0b101111 + 0o1), 0o10), ehT0Px3KOsy9(chr(48) + chr(8061 - 7950) + '\x33' + chr(0b1110 + 0o45) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(55 - 6) + chr(0b110000) + '\x34', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(0b110001) + '\065', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + '\065' + chr(64 - 16), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc'), '\144' + chr(0b1000 + 0o135) + chr(99) + '\x6f' + chr(100) + '\x65')(chr(2457 - 2340) + chr(1687 - 1571) + chr(0b1100110) + '\055' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def sjp3dMA7f0LJ(O0Pt4_FWG7IN, wxx1SkROlQw7, yygMYfP8z7nx=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcd\\\xb3f\x9b*\x927(\x87V]'), chr(0b1100100) + chr(101) + chr(0b110101 + 0o56) + '\157' + chr(100) + chr(101))(chr(0b11000 + 0o135) + '\164' + chr(0b1100110) + '\x2d' + '\x38'), Yzw2xMgnD_BI=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcd\\\xb3f\x9b*\x927(\x87V]'), '\144' + chr(10150 - 10049) + '\x63' + chr(111) + '\144' + chr(0b111001 + 0o54))(chr(0b1110101) + chr(0b1110100) + chr(102) + chr(0b101101) + '\070')): if PlSM16l2KDPD(yygMYfP8z7nx, M8_cKLkHVB2V) and yygMYfP8z7nx not in (xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xc9T\xa3$\x82'), chr(0b1100100) + chr(0b110101 + 0o60) + chr(2179 - 2080) + chr(3057 - 2946) + '\x64' + chr(1497 - 1396))('\x75' + chr(0b1100101 + 0o17) + '\146' + chr(0b101101) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcd\\\xb3f\x9b*\x927(\x87V]'), chr(0b101101 + 0o67) + chr(0b1100101) + chr(0b1100011) + '\x6f' + '\x64' + chr(0b1100101))(chr(0b100111 + 0o116) + chr(7361 - 7245) + chr(4141 - 4039) + chr(367 - 322) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xc1]\xaf?\xc21\xd0h-\x85X]'), chr(0b1100100) + chr(2116 - 2015) + chr(99) + chr(11830 - 11719) + chr(100) + chr(0b10111 + 0o116))(chr(9305 - 9188) + '\164' + chr(0b1 + 0o145) + chr(45) + '\070')): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\xc6J\xb2?\xcf*\xcd!$\x92\x1e@P\x8bfH\xbb\xfa\xdf\x01r/*\xa3'), chr(0b1100 + 0o130) + chr(0b1010110 + 0o17) + '\143' + chr(0b1000100 + 0o53) + chr(0b1100010 + 0o2) + chr(0b111110 + 0o47))(chr(0b1010100 + 0o41) + chr(0b1110100) + chr(0b1001000 + 0o36) + '\055' + '\x38')) if Yzw2xMgnD_BI not in (xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xc9T\xa3$\x82'), '\x64' + chr(0b1100101) + chr(2887 - 2788) + '\x6f' + chr(1930 - 1830) + chr(2453 - 2352))('\165' + chr(0b1110100) + chr(0b1100110) + chr(1897 - 1852) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcd\\\xb3f\x9b*\x927(\x87V]'), '\x64' + chr(101) + chr(99) + chr(0b101010 + 0o105) + chr(8014 - 7914) + '\145')(chr(0b1110101) + chr(116) + '\x66' + chr(45) + '\x38')): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"\xda\xc1^\xa3.\x81e\xd07%\x85L\tJ\xd8(I\xa0\xae\x89\x16\x7f*'\xe9o"), '\144' + '\145' + chr(99) + chr(0b1100 + 0o143) + '\144' + chr(0b1100101))('\165' + chr(0b10 + 0o162) + chr(9593 - 9491) + '\x2d' + '\x38')) Nh6zqC9VijLN = [] if PlSM16l2KDPD(yygMYfP8z7nx, M8_cKLkHVB2V): Y6vGtv1N6VNC = WqUC3KWvYVup.arange(ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(0b110001), 0b1000), O0Pt4_FWG7IN + ehT0Px3KOsy9('\060' + '\157' + '\061', 8)) if yygMYfP8z7nx == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xc1]\xaf?\xc21\xd0h-\x85X]'), chr(2782 - 2682) + chr(0b1011 + 0o132) + chr(6027 - 5928) + chr(0b1101111) + chr(100) + '\145')('\165' + chr(116) + chr(8622 - 8520) + '\x2d' + chr(56)): Y6vGtv1N6VNC = WqUC3KWvYVup.mFx6gsZ1V8KW(Y6vGtv1N6VNC, ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000), 47881 - 47873)) elif yygMYfP8z7nx == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xc9T\xa3$\x82'), chr(100) + chr(101) + chr(0b1100011) + chr(111) + chr(0b1011010 + 0o12) + chr(0b10001 + 0o124))(chr(117) + chr(0b1101011 + 0o11) + chr(102) + '\055' + chr(566 - 510)): xafqLlk3kkUe(WqUC3KWvYVup.random, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xc0O\xa1-\x83 '), chr(0b1100100) + chr(0b101000 + 0o75) + '\143' + chr(0b1101111) + chr(8424 - 8324) + chr(0b11101 + 0o110))('\x75' + chr(0b101011 + 0o111) + '\x66' + '\055' + '\x38'))(Y6vGtv1N6VNC) else: yygMYfP8z7nx = WqUC3KWvYVup.B0ePDhpqxN5n(yygMYfP8z7nx) if xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b"\xd6\xc4\x0e\xff%\x85t\xcd'(\xd2\r"), '\144' + chr(0b10111 + 0o116) + chr(7652 - 7553) + chr(111) + chr(6370 - 6270) + '\145')(chr(0b1111 + 0o146) + chr(5381 - 5265) + chr(0b1100110) + chr(45) + chr(0b110 + 0o62)))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xc7H\xb3'), chr(100) + chr(349 - 248) + chr(0b1100011) + chr(111) + '\144' + chr(0b1100101))(chr(12787 - 12670) + chr(0b101010 + 0o112) + chr(102) + chr(45) + chr(56)))(yygMYfP8z7nx) != xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xda[\xa9,\x8a'), chr(0b111001 + 0o53) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(7106 - 7006) + chr(101))(chr(0b1011 + 0o152) + chr(116) + chr(2371 - 2269) + '\x2d' + chr(0b111000)))(ehT0Px3KOsy9(chr(326 - 278) + chr(111) + chr(49), 8), O0Pt4_FWG7IN + ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + '\x31', 8))): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"\xfb\xc6L\xa6'\x86!\x9f,/\x90K]\x03\xc4zC\xaa\xa8"), chr(100) + '\145' + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + chr(45) + chr(2245 - 2189))) Y6vGtv1N6VNC = yygMYfP8z7nx xafqLlk3kkUe(Nh6zqC9VijLN, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xd8J\xa2%\x8b'), chr(0b1100100) + chr(0b1100101) + '\143' + chr(11833 - 11722) + chr(4151 - 4051) + '\x65')(chr(0b1110101) + chr(527 - 411) + '\x66' + '\x2d' + '\x38'))(Y6vGtv1N6VNC) for pMSSZNED5Vsi in wxx1SkROlQw7: if Yzw2xMgnD_BI == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xc9T\xa3$\x82'), '\x64' + chr(0b110010 + 0o63) + chr(2909 - 2810) + '\x6f' + '\144' + chr(101))('\x75' + chr(0b10 + 0o162) + chr(0b1100110) + chr(0b101101) + chr(0b111000)): x38BiXK1XUi6 = Dx22bkKPdt5d(WqUC3KWvYVup.Dx22bkKPdt5d(Nh6zqC9VijLN[-ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1000 + 0o51), 8)]), O0Pt4_FWG7IN - ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\x31', 8)) ZiDV9zv6cacM = WqUC3KWvYVup.random.FXbppO8HYrND(low=x38BiXK1XUi6, high=O0Pt4_FWG7IN, size=pMSSZNED5Vsi) elif Yzw2xMgnD_BI == xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcd\\\xb3f\x9b*\x927(\x87V]'), chr(0b1100100) + chr(0b1000001 + 0o44) + chr(99) + chr(0b101001 + 0o106) + chr(100) + '\145')('\x75' + '\x74' + chr(0b100111 + 0o77) + chr(0b10000 + 0o35) + '\070'): ZiDV9zv6cacM = WqUC3KWvYVup.arange(pMSSZNED5Vsi) % tsdjvlgh9gDP(ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31', 8), O0Pt4_FWG7IN - ehT0Px3KOsy9(chr(1145 - 1097) + '\x6f' + '\061', 8)) + Dx22bkKPdt5d(ehT0Px3KOsy9('\x30' + chr(378 - 267) + chr(658 - 609), 8), O0Pt4_FWG7IN - ehT0Px3KOsy9(chr(48) + chr(3027 - 2916) + '\x31', 8)) xafqLlk3kkUe(Nh6zqC9VijLN, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xd8J\xa2%\x8b'), chr(100) + '\145' + '\x63' + chr(10418 - 10307) + chr(0b1000 + 0o134) + chr(101))('\165' + '\164' + chr(0b1001000 + 0o36) + chr(45) + chr(112 - 56)))(ZiDV9zv6cacM) return Nh6zqC9VijLN
tensorflow/tensor2tensor
tensor2tensor/layers/reversible_layers.py
create_masks
def create_masks(input_dim, hidden_dims, input_order='left-to-right', hidden_order='left-to-right'): """Returns a list of binary mask matrices respecting autoregressive ordering. Args: input_dim: Number of inputs. hidden_dims: list with the number of hidden units per layer. It does not include the output layer; those number of units will always be set to input_dim downstream. Each hidden unit size must be at least the size of length (otherwise autoregressivity is not possible). input_order: Order of degrees to the input units: 'random', 'left-to-right', 'right-to-left', or an array of an explicit order. For example, 'left-to-right' builds an autoregressive model p(x) = p(x1) p(x2 | x1) ... p(xD | x<D). hidden_order: Order of degrees to the hidden units: 'random', 'left-to-right'. If 'left-to-right', hidden units are allocated equally (up to a remainder term) to each degree. """ degrees = create_degrees(input_dim, hidden_dims, input_order, hidden_order) masks = [] # Create input-to-hidden and hidden-to-hidden masks. for input_degrees, output_degrees in zip(degrees[:-1], degrees[1:]): mask = tf.cast(input_degrees[:, np.newaxis] <= output_degrees, tf.float32) masks.append(mask) # Create hidden-to-output mask. mask = tf.cast(degrees[-1][:, np.newaxis] < degrees[0], tf.float32) masks.append(mask) return masks
python
def create_masks(input_dim, hidden_dims, input_order='left-to-right', hidden_order='left-to-right'): """Returns a list of binary mask matrices respecting autoregressive ordering. Args: input_dim: Number of inputs. hidden_dims: list with the number of hidden units per layer. It does not include the output layer; those number of units will always be set to input_dim downstream. Each hidden unit size must be at least the size of length (otherwise autoregressivity is not possible). input_order: Order of degrees to the input units: 'random', 'left-to-right', 'right-to-left', or an array of an explicit order. For example, 'left-to-right' builds an autoregressive model p(x) = p(x1) p(x2 | x1) ... p(xD | x<D). hidden_order: Order of degrees to the hidden units: 'random', 'left-to-right'. If 'left-to-right', hidden units are allocated equally (up to a remainder term) to each degree. """ degrees = create_degrees(input_dim, hidden_dims, input_order, hidden_order) masks = [] # Create input-to-hidden and hidden-to-hidden masks. for input_degrees, output_degrees in zip(degrees[:-1], degrees[1:]): mask = tf.cast(input_degrees[:, np.newaxis] <= output_degrees, tf.float32) masks.append(mask) # Create hidden-to-output mask. mask = tf.cast(degrees[-1][:, np.newaxis] < degrees[0], tf.float32) masks.append(mask) return masks
[ "def", "create_masks", "(", "input_dim", ",", "hidden_dims", ",", "input_order", "=", "'left-to-right'", ",", "hidden_order", "=", "'left-to-right'", ")", ":", "degrees", "=", "create_degrees", "(", "input_dim", ",", "hidden_dims", ",", "input_order", ",", "hidden_order", ")", "masks", "=", "[", "]", "# Create input-to-hidden and hidden-to-hidden masks.", "for", "input_degrees", ",", "output_degrees", "in", "zip", "(", "degrees", "[", ":", "-", "1", "]", ",", "degrees", "[", "1", ":", "]", ")", ":", "mask", "=", "tf", ".", "cast", "(", "input_degrees", "[", ":", ",", "np", ".", "newaxis", "]", "<=", "output_degrees", ",", "tf", ".", "float32", ")", "masks", ".", "append", "(", "mask", ")", "# Create hidden-to-output mask.", "mask", "=", "tf", ".", "cast", "(", "degrees", "[", "-", "1", "]", "[", ":", ",", "np", ".", "newaxis", "]", "<", "degrees", "[", "0", "]", ",", "tf", ".", "float32", ")", "masks", ".", "append", "(", "mask", ")", "return", "masks" ]
Returns a list of binary mask matrices respecting autoregressive ordering. Args: input_dim: Number of inputs. hidden_dims: list with the number of hidden units per layer. It does not include the output layer; those number of units will always be set to input_dim downstream. Each hidden unit size must be at least the size of length (otherwise autoregressivity is not possible). input_order: Order of degrees to the input units: 'random', 'left-to-right', 'right-to-left', or an array of an explicit order. For example, 'left-to-right' builds an autoregressive model p(x) = p(x1) p(x2 | x1) ... p(xD | x<D). hidden_order: Order of degrees to the hidden units: 'random', 'left-to-right'. If 'left-to-right', hidden units are allocated equally (up to a remainder term) to each degree.
[ "Returns", "a", "list", "of", "binary", "mask", "matrices", "respecting", "autoregressive", "ordering", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/reversible_layers.py#L272-L302
train
Creates a list of binary masks.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMC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s,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b10010 + 0o135) + chr(0b110001) + '\x33' + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(199 - 88) + chr(244 - 194) + '\066' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b100101 + 0o112) + chr(0b110011) + chr(2063 - 2015) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(2134 - 2086) + chr(0b1001 + 0o146) + '\062' + chr(0b110011) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010110 + 0o31) + chr(0b110001 + 0o1) + chr(1971 - 1922) + chr(2250 - 2199), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10509 - 10398) + chr(0b110010) + '\062' + chr(0b101110 + 0o6), 46780 - 46772), ehT0Px3KOsy9('\x30' + chr(0b110011 + 0o74) + chr(51) + '\062' + chr(52), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11110 + 0o24) + '\062' + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1815 - 1766) + chr(0b110111) + chr(1530 - 1477), 34174 - 34166), ehT0Px3KOsy9(chr(108 - 60) + chr(8167 - 8056) + '\x32' + '\061' + '\065', 54668 - 54660), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x30' + '\x36', 31503 - 31495), ehT0Px3KOsy9('\060' + chr(345 - 234) + chr(50) + '\x36' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(5071 - 4960) + '\062' + chr(0b11010 + 0o32) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100001 + 0o16) + '\x31' + chr(0b110011) + chr(0b110110), 20063 - 20055), ehT0Px3KOsy9('\060' + chr(2875 - 2764) + chr(0b1111 + 0o43) + '\x36' + chr(0b1010 + 0o54), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1669 - 1614) + chr(55), 46860 - 46852), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(0b110001) + chr(0b110011) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + '\x31' + chr(51) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2325 - 2214) + chr(0b1001 + 0o51) + chr(2893 - 2839) + '\060', 49985 - 49977), ehT0Px3KOsy9(chr(48) + chr(217 - 106) + chr(873 - 823) + chr(56 - 3) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100101 + 0o112) + chr(0b110111) + chr(2397 - 2343), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b110110) + chr(2012 - 1963), 29117 - 29109), ehT0Px3KOsy9(chr(775 - 727) + chr(0b1101111) + chr(0b110001) + chr(0b110111) + chr(0b110111), 1837 - 1829), ehT0Px3KOsy9(chr(0b110000) + chr(10607 - 10496) + '\063' + chr(0b110000) + chr(1207 - 1152), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(727 - 678) + chr(96 - 41) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(0b10101 + 0o132) + chr(0b110011) + chr(50) + chr(411 - 363), 35077 - 35069), ehT0Px3KOsy9(chr(1467 - 1419) + chr(0b1101111) + chr(0b110011) + chr(0b10001 + 0o40), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b100100 + 0o113) + chr(49) + chr(0b110010) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b110001) + chr(54) + chr(1137 - 1086), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(1242 - 1189) + '\065', 0b1000), ehT0Px3KOsy9(chr(2071 - 2023) + '\157' + chr(889 - 840) + chr(0b110000) + chr(50), 8668 - 8660), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\067' + '\x37', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b100010 + 0o16) + chr(0b100001 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\062' + chr(0b1010 + 0o52) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100101 + 0o16) + chr(1597 - 1545) + chr(53), 61024 - 61016), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(228 - 175) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111 + 0o0) + '\x31' + chr(0b1101 + 0o51) + chr(2367 - 2316), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110111) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b110011) + '\x35', 30280 - 30272), ehT0Px3KOsy9(chr(48) + chr(6160 - 6049) + chr(0b110010) + chr(2325 - 2273) + chr(0b100 + 0o55), 46808 - 46800)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(9132 - 9021) + chr(0b101 + 0o60) + chr(48), 26649 - 26641)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'r'), chr(8380 - 8280) + chr(101) + chr(3237 - 3138) + chr(10489 - 10378) + chr(100) + chr(0b1100101))(chr(117) + chr(11689 - 11573) + chr(0b1010101 + 0o21) + '\x2d' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def woe17L5PSHwg(O0Pt4_FWG7IN, wxx1SkROlQw7, yygMYfP8z7nx=xafqLlk3kkUe(SXOLrMavuUCe(b'0\xd1\xa7\xe9\xa6\xe0\xbb\xba\x0f\xe4\xa1\xdf\xd1'), chr(0b110 + 0o136) + chr(777 - 676) + chr(0b10101 + 0o116) + chr(0b1011110 + 0o21) + chr(7802 - 7702) + chr(615 - 514))(chr(117) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(0b11001 + 0o37)), Yzw2xMgnD_BI=xafqLlk3kkUe(SXOLrMavuUCe(b'0\xd1\xa7\xe9\xa6\xe0\xbb\xba\x0f\xe4\xa1\xdf\xd1'), chr(100) + '\x65' + chr(0b1100011) + chr(2089 - 1978) + chr(4971 - 4871) + chr(0b1001110 + 0o27))(chr(5509 - 5392) + chr(0b111111 + 0o65) + chr(0b101000 + 0o76) + chr(879 - 834) + chr(0b10100 + 0o44))): Nh6zqC9VijLN = sjp3dMA7f0LJ(O0Pt4_FWG7IN, wxx1SkROlQw7, yygMYfP8z7nx, Yzw2xMgnD_BI) iB_C7ejAba13 = [] for (Y6vGtv1N6VNC, S8kpQt_D5NJl) in pZ0NK2y6HRbn(Nh6zqC9VijLN[:-ehT0Px3KOsy9(chr(193 - 145) + '\x6f' + '\x31', ord("\x08"))], Nh6zqC9VijLN[ehT0Px3KOsy9('\060' + '\157' + chr(49), 8):]): Iz1jSgUKZDvt = IDJ2eXGCBCDu.cast(Y6vGtv1N6VNC[:, WqUC3KWvYVup.newaxis] <= S8kpQt_D5NJl, IDJ2eXGCBCDu.float32) xafqLlk3kkUe(iB_C7ejAba13, xafqLlk3kkUe(SXOLrMavuUCe(b'=\xc4\xb1\xf8\xe5\xf0'), chr(3838 - 3738) + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b100 + 0o140) + chr(101))('\165' + '\x74' + chr(0b1110 + 0o130) + '\x2d' + chr(2130 - 2074)))(Iz1jSgUKZDvt) Iz1jSgUKZDvt = IDJ2eXGCBCDu.cast(Nh6zqC9VijLN[-ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(0b1 + 0o60), 8)][:, WqUC3KWvYVup.newaxis] < Nh6zqC9VijLN[ehT0Px3KOsy9('\060' + '\x6f' + '\060', ord("\x08"))], IDJ2eXGCBCDu.float32) xafqLlk3kkUe(iB_C7ejAba13, xafqLlk3kkUe(SXOLrMavuUCe(b'=\xc4\xb1\xf8\xe5\xf0'), chr(100) + '\x65' + '\143' + chr(3314 - 3203) + chr(5735 - 5635) + chr(8512 - 8411))(chr(0b1110101) + chr(0b1110100) + chr(6708 - 6606) + chr(0b101101) + chr(0b111000)))(Iz1jSgUKZDvt) return iB_C7ejAba13
tensorflow/tensor2tensor
tensor2tensor/layers/reversible_layers.py
sinkhorn
def sinkhorn(inputs, n_iters=20): """Performs incomplete Sinkhorn normalization to inputs. By a theorem by Sinkhorn and Knopp [1], a sufficiently well-behaved matrix with positive entries can be turned into a doubly-stochastic matrix (i.e. its rows and columns add up to one) via the succesive row and column normalization. -To ensure positivity, the effective input to sinkhorn has to be exp(inputs) (elementwise). -However, for stability, sinkhorn works in the log-space. It is only at return time that entries are exponentiated. Code is adapted from Mena et al. [2]. [1] Richard Sinkhorn and Paul Knopp. Concerning nonnegative matrices and doubly stochastic matrices. Pacific Journal of Mathematics, 1967. [2] Gonzalo Mena, David Belanger, Scott Linderman, Jasper Snoek. Learning latent permutations with Gumbel-Sinkhorn networks. International Conference on Learning Representations, 2018. Args: inputs: A `Tensor` with shape `[..., vocab_size, vocab_size]`. n_iters: Number of sinkhorn iterations (in practice, as little as 20 iterations are needed to achieve decent convergence for `vocab_size` ~100) Returns: outputs: A `Tensor` of close-to-doubly-stochastic matrices with shape `[:, vocab_size, vocab_size]`. """ vocab_size = tf.shape(inputs)[-1] log_alpha = tf.reshape(inputs, [-1, vocab_size, vocab_size]) for _ in range(n_iters): log_alpha -= tf.reshape(tf.reduce_logsumexp(log_alpha, axis=2), [-1, vocab_size, 1]) log_alpha -= tf.reshape(tf.reduce_logsumexp(log_alpha, axis=1), [-1, 1, vocab_size]) outputs = tf.exp(log_alpha) return outputs
python
def sinkhorn(inputs, n_iters=20): """Performs incomplete Sinkhorn normalization to inputs. By a theorem by Sinkhorn and Knopp [1], a sufficiently well-behaved matrix with positive entries can be turned into a doubly-stochastic matrix (i.e. its rows and columns add up to one) via the succesive row and column normalization. -To ensure positivity, the effective input to sinkhorn has to be exp(inputs) (elementwise). -However, for stability, sinkhorn works in the log-space. It is only at return time that entries are exponentiated. Code is adapted from Mena et al. [2]. [1] Richard Sinkhorn and Paul Knopp. Concerning nonnegative matrices and doubly stochastic matrices. Pacific Journal of Mathematics, 1967. [2] Gonzalo Mena, David Belanger, Scott Linderman, Jasper Snoek. Learning latent permutations with Gumbel-Sinkhorn networks. International Conference on Learning Representations, 2018. Args: inputs: A `Tensor` with shape `[..., vocab_size, vocab_size]`. n_iters: Number of sinkhorn iterations (in practice, as little as 20 iterations are needed to achieve decent convergence for `vocab_size` ~100) Returns: outputs: A `Tensor` of close-to-doubly-stochastic matrices with shape `[:, vocab_size, vocab_size]`. """ vocab_size = tf.shape(inputs)[-1] log_alpha = tf.reshape(inputs, [-1, vocab_size, vocab_size]) for _ in range(n_iters): log_alpha -= tf.reshape(tf.reduce_logsumexp(log_alpha, axis=2), [-1, vocab_size, 1]) log_alpha -= tf.reshape(tf.reduce_logsumexp(log_alpha, axis=1), [-1, 1, vocab_size]) outputs = tf.exp(log_alpha) return outputs
[ "def", "sinkhorn", "(", "inputs", ",", "n_iters", "=", "20", ")", ":", "vocab_size", "=", "tf", ".", "shape", "(", "inputs", ")", "[", "-", "1", "]", "log_alpha", "=", "tf", ".", "reshape", "(", "inputs", ",", "[", "-", "1", ",", "vocab_size", ",", "vocab_size", "]", ")", "for", "_", "in", "range", "(", "n_iters", ")", ":", "log_alpha", "-=", "tf", ".", "reshape", "(", "tf", ".", "reduce_logsumexp", "(", "log_alpha", ",", "axis", "=", "2", ")", ",", "[", "-", "1", ",", "vocab_size", ",", "1", "]", ")", "log_alpha", "-=", "tf", ".", "reshape", "(", "tf", ".", "reduce_logsumexp", "(", "log_alpha", ",", "axis", "=", "1", ")", ",", "[", "-", "1", ",", "1", ",", "vocab_size", "]", ")", "outputs", "=", "tf", ".", "exp", "(", "log_alpha", ")", "return", "outputs" ]
Performs incomplete Sinkhorn normalization to inputs. By a theorem by Sinkhorn and Knopp [1], a sufficiently well-behaved matrix with positive entries can be turned into a doubly-stochastic matrix (i.e. its rows and columns add up to one) via the succesive row and column normalization. -To ensure positivity, the effective input to sinkhorn has to be exp(inputs) (elementwise). -However, for stability, sinkhorn works in the log-space. It is only at return time that entries are exponentiated. Code is adapted from Mena et al. [2]. [1] Richard Sinkhorn and Paul Knopp. Concerning nonnegative matrices and doubly stochastic matrices. Pacific Journal of Mathematics, 1967. [2] Gonzalo Mena, David Belanger, Scott Linderman, Jasper Snoek. Learning latent permutations with Gumbel-Sinkhorn networks. International Conference on Learning Representations, 2018. Args: inputs: A `Tensor` with shape `[..., vocab_size, vocab_size]`. n_iters: Number of sinkhorn iterations (in practice, as little as 20 iterations are needed to achieve decent convergence for `vocab_size` ~100) Returns: outputs: A `Tensor` of close-to-doubly-stochastic matrices with shape `[:, vocab_size, vocab_size]`.
[ "Performs", "incomplete", "Sinkhorn", "normalization", "to", "inputs", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/reversible_layers.py#L319-L358
train
Performs incomplete Sinkhorn normalization to inputs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin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AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b100000 + 0o117) + '\063' + chr(53) + chr(939 - 885), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2734 - 2679) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1100101 + 0o12) + chr(1848 - 1799) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(359 - 310) + chr(50) + chr(0b101111 + 0o4), 22401 - 22393), ehT0Px3KOsy9(chr(564 - 516) + chr(2971 - 2860) + chr(0b1010 + 0o50) + '\x32' + chr(0b110011), 6204 - 6196), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\067' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2302 - 2247) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\x36' + chr(49), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101000 + 0o12) + '\x32' + chr(0b10101 + 0o40), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(2570 - 2517) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100 + 0o143) + '\x31' + '\x30' + chr(0b11000 + 0o30), 0o10), ehT0Px3KOsy9('\060' + chr(0b100001 + 0o116) + chr(0b110011) + chr(0b101 + 0o61) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2134 - 2085) + chr(52) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100101 + 0o12) + '\x31' + '\063' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(1920 - 1870) + chr(53) + chr(279 - 228), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2153 - 2103) + chr(0b11010 + 0o26) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b110011) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(904 - 856) + chr(7784 - 7673) + chr(51) + '\063' + '\066', 54620 - 54612), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(10123 - 10012) + '\061' + '\066' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001100 + 0o43) + chr(0b110100) + chr(0b100 + 0o57), 0b1000), ehT0Px3KOsy9(chr(2213 - 2165) + chr(0b1101111) + chr(0b110011) + '\062' + chr(0b1000 + 0o52), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100111 + 0o13) + chr(0b110010 + 0o2), 6292 - 6284), ehT0Px3KOsy9(chr(48) + chr(4082 - 3971) + '\061' + chr(1467 - 1414) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + '\x32' + chr(0b10001 + 0o46), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + '\064' + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(2861 - 2750) + chr(0b100011 + 0o20) + chr(0b10 + 0o56) + chr(0b10011 + 0o43), 0o10), ehT0Px3KOsy9(chr(175 - 127) + chr(0b111011 + 0o64) + '\x32' + chr(1677 - 1622) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10000 + 0o43) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101 + 0o62) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + chr(0b11000 + 0o36) + chr(0b110011), 62295 - 62287), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + '\x33' + chr(1326 - 1274), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101101 + 0o7) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + '\x31' + '\x37' + chr(1873 - 1819), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7775 - 7664) + '\x33' + chr(55) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1254 - 1206) + '\x6f' + chr(0b11100 + 0o32) + chr(2389 - 2334), 34065 - 34057), ehT0Px3KOsy9('\x30' + chr(8828 - 8717) + '\x35' + chr(53), 0o10), ehT0Px3KOsy9(chr(238 - 190) + '\x6f' + '\062' + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(50) + chr(53), 35819 - 35811), ehT0Px3KOsy9('\x30' + chr(0b10100 + 0o133) + chr(867 - 817) + chr(0b1000 + 0o55) + chr(0b110100), 63881 - 63873), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + chr(1108 - 1054), 50603 - 50595)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(4866 - 4755) + chr(0b110101) + chr(1570 - 1522), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0'), chr(0b11011 + 0o111) + chr(0b101000 + 0o75) + chr(2862 - 2763) + chr(1926 - 1815) + chr(100) + chr(468 - 367))(chr(5674 - 5557) + chr(0b1011 + 0o151) + chr(0b1010010 + 0o24) + chr(0b11110 + 0o17) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def _Zo31j_7fZNq(vXoupepMtCXU, _AggySFhl2zR=ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\157' + '\062' + chr(0b10110 + 0o36), 8)): CeyMIoSyrpkQ = IDJ2eXGCBCDu.nauYfLglTpcb(vXoupepMtCXU)[-ehT0Px3KOsy9(chr(48) + chr(0b101000 + 0o107) + chr(1164 - 1115), ord("\x08"))] cIfs53r3xwcc = IDJ2eXGCBCDu.reshape(vXoupepMtCXU, [-ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b11001 + 0o30), 8), CeyMIoSyrpkQ, CeyMIoSyrpkQ]) for VNGQdHSFPrso in vQr8gNKaIaWE(_AggySFhl2zR): cIfs53r3xwcc -= IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.reduce_logsumexp(cIfs53r3xwcc, axis=ehT0Px3KOsy9('\060' + chr(8208 - 8097) + '\062', 0b1000)), [-ehT0Px3KOsy9('\060' + chr(7613 - 7502) + chr(49), 8), CeyMIoSyrpkQ, ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2153 - 2104), 8)]) cIfs53r3xwcc -= IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.reduce_logsumexp(cIfs53r3xwcc, axis=ehT0Px3KOsy9('\x30' + chr(0b110111 + 0o70) + chr(49), 8)), [-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8), CeyMIoSyrpkQ]) Dx_DllZ8uCko = IDJ2eXGCBCDu.exp(cIfs53r3xwcc) return Dx_DllZ8uCko
tensorflow/tensor2tensor
tensor2tensor/layers/reversible_layers.py
TransformedRandomVariable
def TransformedRandomVariable(random_variable, # pylint: disable=invalid-name reversible_layer, name=None, sample_shape=(), value=None): """Random variable for f(x), where x ~ p(x) and f is reversible.""" return ed.RandomVariable( distribution=TransformedDistribution(random_variable.distribution, reversible_layer, name=name), sample_shape=sample_shape, value=value)
python
def TransformedRandomVariable(random_variable, # pylint: disable=invalid-name reversible_layer, name=None, sample_shape=(), value=None): """Random variable for f(x), where x ~ p(x) and f is reversible.""" return ed.RandomVariable( distribution=TransformedDistribution(random_variable.distribution, reversible_layer, name=name), sample_shape=sample_shape, value=value)
[ "def", "TransformedRandomVariable", "(", "random_variable", ",", "# pylint: disable=invalid-name", "reversible_layer", ",", "name", "=", "None", ",", "sample_shape", "=", "(", ")", ",", "value", "=", "None", ")", ":", "return", "ed", ".", "RandomVariable", "(", "distribution", "=", "TransformedDistribution", "(", "random_variable", ".", "distribution", ",", "reversible_layer", ",", "name", "=", "name", ")", ",", "sample_shape", "=", "sample_shape", ",", "value", "=", "value", ")" ]
Random variable for f(x), where x ~ p(x) and f is reversible.
[ "Random", "variable", "for", "f", "(", "x", ")", "where", "x", "~", "p", "(", "x", ")", "and", "f", "is", "reversible", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/reversible_layers.py#L447-L458
train
Returns a new random variable with transformed distribution.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZ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8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b111010 + 0o65) + chr(0b110100) + '\x33', 10492 - 10484), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(2030 - 1919) + chr(0b11000 + 0o33) + chr(0b1 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(2752 - 2699) + chr(0b110010), 50578 - 50570), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110 + 0o55) + chr(50) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(11434 - 11323) + chr(1969 - 1920) + '\x30' + chr(0b100010 + 0o23), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(710 - 655) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110010 + 0o2) + chr(1823 - 1768), 24481 - 24473), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(0b110011) + chr(0b10010 + 0o37) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(0b110111) + chr(0b100000 + 0o22), 43630 - 43622), ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + chr(1294 - 1245) + chr(0b100101 + 0o21), 16417 - 16409), ehT0Px3KOsy9('\060' + '\157' + chr(534 - 485) + chr(1799 - 1751) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1588 - 1537) + chr(0b110111) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100100 + 0o113) + chr(50) + chr(0b10011 + 0o35) + chr(0b100100 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000111 + 0o50) + '\062' + '\062' + chr(0b110110), 51801 - 51793), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b110011) + '\063', 32173 - 32165), ehT0Px3KOsy9(chr(48) + chr(0b1011110 + 0o21) + chr(0b100001 + 0o21) + chr(51) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(9907 - 9796) + chr(0b10110 + 0o35) + chr(0b110010) + chr(0b101000 + 0o11), ord("\x08")), ehT0Px3KOsy9(chr(1656 - 1608) + chr(111) + chr(2147 - 2097) + chr(54) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(5178 - 5067) + chr(1019 - 970) + '\x34' + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(777 - 727) + '\x35' + chr(1991 - 1938), 44724 - 44716), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + chr(0b1000 + 0o53) + '\x35' + chr(1775 - 1723), 34014 - 34006), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\x37' + '\x33', 21515 - 21507), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101101 + 0o11) + chr(0b110111), 27407 - 27399), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(55) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100111 + 0o12) + chr(1900 - 1851) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(1951 - 1903) + chr(0b1101111) + chr(0b110001) + chr(732 - 683) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(10291 - 10180) + '\x32' + chr(0b1010 + 0o53) + '\061', 0b1000), ehT0Px3KOsy9(chr(2091 - 2043) + chr(111) + chr(0b110011) + chr(0b111 + 0o52) + '\063', 62037 - 62029), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1110 + 0o141) + chr(0b110011) + chr(0b100000 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + chr(49) + chr(652 - 597), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(0b110000) + chr(0b101 + 0o57), 44321 - 44313), ehT0Px3KOsy9('\060' + '\157' + chr(1753 - 1703) + chr(0b110100) + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000010 + 0o55) + '\x32' + '\x37' + chr(0b110010), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11100 + 0o25) + chr(0b10001 + 0o45) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(5407 - 5296) + '\062' + chr(51) + '\067', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + '\x31' + chr(0b11011 + 0o32) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001111 + 0o40) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x30' + chr(53), 8), ehT0Px3KOsy9(chr(456 - 408) + '\157' + chr(1650 - 1599) + '\x32' + '\x31', 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b110101), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(2392 - 2339) + chr(0b1011 + 0o45), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\r'), chr(358 - 258) + chr(101) + chr(99) + chr(11259 - 11148) + chr(0b111011 + 0o51) + '\145')(chr(11717 - 11600) + chr(0b1010110 + 0o36) + '\x66' + chr(0b101101) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def WiaX7YsTTxB_(MEs_JdiULf6R, TzUGxva7qQN0, AIvJRzLdDfgF=None, Xqm7onEd4wGH=(), QmmgWUB13VCJ=None): return xafqLlk3kkUe(dTXqLuPC2FBQ, xafqLlk3kkUe(SXOLrMavuUCe(b'q{D\xb6*T1\xad\xc8g \x9c\xeb\xf3'), chr(0b1100100) + chr(101) + '\x63' + chr(0b10011 + 0o134) + '\x64' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(353 - 251) + '\x2d' + chr(0b1100 + 0o54)))(distribution=yVM7xbUkIPxB(xafqLlk3kkUe(MEs_JdiULf6R, xafqLlk3kkUe(SXOLrMavuUCe(b'GsY\xa67P\x05\xb9\xceg.\x90'), '\144' + '\x65' + chr(1010 - 911) + chr(0b1101111) + chr(5261 - 5161) + chr(7015 - 6914))('\x75' + '\x74' + '\146' + '\x2d' + chr(0b1100 + 0o54))), TzUGxva7qQN0, name=AIvJRzLdDfgF), sample_shape=Xqm7onEd4wGH, value=QmmgWUB13VCJ)
tensorflow/tensor2tensor
tensor2tensor/layers/reversible_layers.py
ActNorm.log_det_jacobian
def log_det_jacobian(self, inputs): """Returns log det | dx / dy | = num_events * sum log | scale |.""" del inputs # unused # Number of events is number of all elements excluding the batch and # channel dimensions. num_events = tf.reduce_prod(tf.shape(inputs)[1:-1]) log_det_jacobian = num_events * tf.reduce_sum(self.log_scale) return log_det_jacobian
python
def log_det_jacobian(self, inputs): """Returns log det | dx / dy | = num_events * sum log | scale |.""" del inputs # unused # Number of events is number of all elements excluding the batch and # channel dimensions. num_events = tf.reduce_prod(tf.shape(inputs)[1:-1]) log_det_jacobian = num_events * tf.reduce_sum(self.log_scale) return log_det_jacobian
[ "def", "log_det_jacobian", "(", "self", ",", "inputs", ")", ":", "del", "inputs", "# unused", "# Number of events is number of all elements excluding the batch and", "# channel dimensions.", "num_events", "=", "tf", ".", "reduce_prod", "(", "tf", ".", "shape", "(", "inputs", ")", "[", "1", ":", "-", "1", "]", ")", "log_det_jacobian", "=", "num_events", "*", "tf", ".", "reduce_sum", "(", "self", ".", "log_scale", ")", "return", "log_det_jacobian" ]
Returns log det | dx / dy | = num_events * sum log | scale |.
[ "Returns", "log", "det", "|", "dx", "/", "dy", "|", "=", "num_events", "*", "sum", "log", "|", "scale", "|", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/reversible_layers.py#L94-L101
train
Returns log det jacobian.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcP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z9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(570 - 522) + chr(111) + '\x32' + chr(2154 - 2099) + chr(1914 - 1863), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b1010 + 0o54) + '\064', 0b1000), ehT0Px3KOsy9(chr(741 - 693) + '\157' + '\063' + chr(0b11 + 0o55), 18440 - 18432), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2001 - 1950) + chr(0b110010) + chr(0b10010 + 0o41), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(51) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1265 - 1215) + chr(0b110011) + '\x35', 35316 - 35308), ehT0Px3KOsy9('\060' + '\157' + chr(0b11100 + 0o26) + chr(52) + '\x30', 10386 - 10378), ehT0Px3KOsy9(chr(1147 - 1099) + chr(0b1101111) + '\x31' + chr(0b110100) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1111 + 0o42) + chr(48) + chr(290 - 238), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(52) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(841 - 730) + chr(0b110011) + chr(0b101111 + 0o6) + chr(51), 16731 - 16723), ehT0Px3KOsy9(chr(1663 - 1615) + '\x6f' + '\063' + chr(0b110010) + '\063', 8), ehT0Px3KOsy9(chr(1947 - 1899) + chr(9473 - 9362) + chr(0b110 + 0o54) + '\x32' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + '\x32' + chr(0b101101 + 0o3) + chr(0b110100), 14233 - 14225), ehT0Px3KOsy9(chr(842 - 794) + chr(0b1101111) + chr(1237 - 1188) + chr(0b101 + 0o57) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(233 - 185) + chr(0b1101111) + '\063' + '\x37' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\x36' + chr(1148 - 1093), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1000 + 0o52) + chr(0b100110 + 0o20) + chr(1916 - 1866), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110011) + '\067', 53840 - 53832), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(207 - 159) + chr(603 - 555), 38904 - 38896), ehT0Px3KOsy9(chr(307 - 259) + '\x6f' + '\x31' + chr(52) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(0b11000 + 0o32) + chr(0b1001 + 0o54) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b100001 + 0o17) + '\065', 43580 - 43572), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1924 - 1873) + '\064' + chr(0b101101 + 0o5), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11619 - 11508) + chr(0b10 + 0o60) + chr(0b110010 + 0o0) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8554 - 8443) + '\x32' + chr(0b10011 + 0o42) + chr(0b1 + 0o57), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100101 + 0o112) + '\062' + chr(259 - 204) + '\066', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101100 + 0o6) + chr(0b110010) + '\x30', 28816 - 28808), ehT0Px3KOsy9(chr(1955 - 1907) + chr(2319 - 2208) + '\x32' + chr(2186 - 2133) + chr(54 - 5), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10 + 0o61) + chr(48) + '\x34', 0b1000), ehT0Px3KOsy9(chr(1131 - 1083) + chr(0b1010 + 0o145) + chr(1329 - 1280) + chr(0b110111) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(910 - 861) + chr(54) + chr(398 - 350), 39610 - 39602), ehT0Px3KOsy9(chr(0b110000) + chr(3465 - 3354) + chr(51) + '\x33' + chr(0b1001 + 0o52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(0b110000), 41412 - 41404), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\064' + chr(0b1 + 0o64), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b110011) + chr(0b10000 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(112 - 57) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(819 - 771) + '\157' + chr(0b110100 + 0o3) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b10000 + 0o42) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(0b11000 + 0o36) + chr(0b110111), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x95'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(0b1110 + 0o141) + chr(2639 - 2539) + chr(0b1100101))(chr(0b1110101) + chr(0b1110001 + 0o3) + chr(0b1100110) + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ELB99iUEpyPD(oVre8I6UXc3b, vXoupepMtCXU): del vXoupepMtCXU _sqGyf08rVtQ = IDJ2eXGCBCDu.reduce_prod(IDJ2eXGCBCDu.nauYfLglTpcb(vXoupepMtCXU)[ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + chr(49), 0b1000):-ehT0Px3KOsy9(chr(48) + '\157' + '\061', 8)]) ELB99iUEpyPD = _sqGyf08rVtQ * IDJ2eXGCBCDu.reduce_sum(oVre8I6UXc3b.log_scale) return ELB99iUEpyPD
tensorflow/tensor2tensor
tensor2tensor/layers/vq_discrete.py
DiscreteBottleneck.slice_hidden
def slice_hidden(self, x): """Slice encoder hidden state into block_dim. Args: x: Encoder hidden state of shape [-1, hidden_size]. Returns: Sliced states of shape [-1, num_blocks, block_dim]. """ x_sliced = tf.reshape( x, shape=[-1, self.hparams.num_blocks, self.hparams.block_dim]) return x_sliced
python
def slice_hidden(self, x): """Slice encoder hidden state into block_dim. Args: x: Encoder hidden state of shape [-1, hidden_size]. Returns: Sliced states of shape [-1, num_blocks, block_dim]. """ x_sliced = tf.reshape( x, shape=[-1, self.hparams.num_blocks, self.hparams.block_dim]) return x_sliced
[ "def", "slice_hidden", "(", "self", ",", "x", ")", ":", "x_sliced", "=", "tf", ".", "reshape", "(", "x", ",", "shape", "=", "[", "-", "1", ",", "self", ".", "hparams", ".", "num_blocks", ",", "self", ".", "hparams", ".", "block_dim", "]", ")", "return", "x_sliced" ]
Slice encoder hidden state into block_dim. Args: x: Encoder hidden state of shape [-1, hidden_size]. Returns: Sliced states of shape [-1, num_blocks, block_dim].
[ "Slice", "encoder", "hidden", "state", "into", "block_dim", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vq_discrete.py#L61-L72
train
Slice encoder hidden state into block_dim.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFL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R0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + '\x31' + chr(2677 - 2622) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\067' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100000 + 0o21) + '\064' + '\063', 53341 - 53333), ehT0Px3KOsy9(chr(117 - 69) + chr(0b1101111) + '\x31' + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + chr(2116 - 2067) + chr(0b110100) + '\062', 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(11454 - 11343) + '\062' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10471 - 10360) + chr(0b110111) + chr(0b110110), 61236 - 61228), ehT0Px3KOsy9(chr(1740 - 1692) + '\x6f' + '\x31' + chr(0b101100 + 0o7) + chr(676 - 627), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + chr(0b110010) + chr(54) + chr(0b1110 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(1494 - 1446) + chr(0b11011 + 0o124) + '\x37' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000110 + 0o51) + '\061', 0o10), ehT0Px3KOsy9(chr(219 - 171) + chr(0b1101111) + '\063' + chr(49) + chr(1152 - 1100), 0b1000), ehT0Px3KOsy9(chr(173 - 125) + chr(0b1101111) + chr(0b10100 + 0o35) + chr(0b110101) + chr(0b11110 + 0o23), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(0b110001) + '\065' + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\061' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(341 - 293) + '\x6f' + chr(0b1011 + 0o50) + chr(0b110011 + 0o4) + '\060', 48094 - 48086), ehT0Px3KOsy9(chr(2176 - 2128) + '\x6f' + chr(0b100111 + 0o12) + chr(0b10100 + 0o42) + chr(0b100110 + 0o14), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(117 - 69) + chr(237 - 184), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x30' + chr(0b110001 + 0o5), 17488 - 17480), ehT0Px3KOsy9(chr(48) + chr(0b1010000 + 0o37) + '\062' + chr(451 - 402) + '\x36', 0o10), ehT0Px3KOsy9(chr(1879 - 1831) + chr(9249 - 9138) + '\062' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b10100 + 0o133) + '\066' + chr(0b110110), 51879 - 51871), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(50) + chr(0b110011) + chr(715 - 664), 40453 - 40445), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110110 + 0o1) + chr(49), 0o10), ehT0Px3KOsy9(chr(644 - 596) + '\157' + chr(0b101001 + 0o10) + chr(0b110000) + '\062', 19581 - 19573), ehT0Px3KOsy9(chr(0b110000) + chr(5098 - 4987) + '\061' + chr(0b110100) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x33' + chr(0b100111 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1100100 + 0o13) + chr(0b110011) + chr(0b110110) + chr(2179 - 2127), 0b1000), ehT0Px3KOsy9(chr(344 - 296) + chr(0b1011000 + 0o27) + chr(50) + chr(1360 - 1311) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b110111) + '\x34', 37110 - 37102), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + '\061' + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\063' + '\066', 29729 - 29721), ehT0Px3KOsy9(chr(48) + chr(2167 - 2056) + chr(49) + '\x30' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b101011 + 0o6) + '\x33', 8), ehT0Px3KOsy9('\060' + chr(9662 - 9551) + chr(49) + '\060' + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(49) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101101 + 0o5) + chr(0b110001 + 0o1) + chr(0b101011 + 0o13), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(719 - 671) + '\065', 30798 - 30790), ehT0Px3KOsy9('\060' + '\157' + chr(0b100000 + 0o23) + '\066', 43980 - 43972), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b110010) + '\x36', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10011 + 0o42) + chr(48), 30268 - 30260)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'U'), '\144' + '\x65' + chr(0b100111 + 0o74) + chr(0b100111 + 0o110) + chr(763 - 663) + '\145')('\165' + chr(0b10101 + 0o137) + chr(8985 - 8883) + chr(45) + chr(1140 - 1084)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def GNfWXfXMlQz5(oVre8I6UXc3b, OeWW0F1dBPRQ): cLA_Onji0yiU = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, shape=[-ehT0Px3KOsy9(chr(48) + '\157' + chr(1634 - 1585), 8), oVre8I6UXc3b.hparams.azOnMTJc4Vem, oVre8I6UXc3b.hparams.block_dim]) return cLA_Onji0yiU
tensorflow/tensor2tensor
tensor2tensor/layers/vq_discrete.py
DiscreteBottleneck.nearest_neighbor
def nearest_neighbor(self, x, means): """Find the nearest element in means to elements in x. Args: x: Batch of encoder continuous latent states sliced/projected into shape [-1, num_blocks, block_dim]. means: Embedding means of shape. Returns: Tensor with nearest element in mean encoded in one-hot notation. """ x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keep_dims=True) means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keep_dims=True) scalar_prod = tf.matmul( tf.transpose(x, perm=[1, 0, 2]), tf.transpose(means, perm=[0, 2, 1])) scalar_prod = tf.transpose(scalar_prod, perm=[1, 0, 2]) dist = x_norm_sq + tf.transpose( means_norm_sq, perm=[2, 0, 1]) - 2 * scalar_prod if self.hparams.soft_em: nearest_idx = tf.stack( [ tf.multinomial( -dist[:, i, :], num_samples=self.hparams.num_samples) for i in range(self.hparams.num_blocks) ], axis=1) nearest_hot = tf.one_hot(nearest_idx, depth=self.hparams.block_v_size) nearest_hot = tf.reduce_mean(nearest_hot, axis=-2) else: if self.hparams.random_top_k > 1: _, top_k_idx = tf.nn.top_k(-dist, k=self.hparams.random_top_k) nearest_idx = tf.gather( top_k_idx, tf.random_uniform( [1], minval=0, maxval=self.hparams.random_top_k - 1, dtype=tf.int32), axis=-1) else: if self.hparams.use_scales: dist /= tf.reshape(self.hparams.scales, [1, 1, self.hparams.moe_num_experts]) nearest_idx = tf.argmax(-dist, axis=-1) nearest_hot = tf.one_hot(nearest_idx, self.hparams.block_v_size) return nearest_hot
python
def nearest_neighbor(self, x, means): """Find the nearest element in means to elements in x. Args: x: Batch of encoder continuous latent states sliced/projected into shape [-1, num_blocks, block_dim]. means: Embedding means of shape. Returns: Tensor with nearest element in mean encoded in one-hot notation. """ x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keep_dims=True) means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keep_dims=True) scalar_prod = tf.matmul( tf.transpose(x, perm=[1, 0, 2]), tf.transpose(means, perm=[0, 2, 1])) scalar_prod = tf.transpose(scalar_prod, perm=[1, 0, 2]) dist = x_norm_sq + tf.transpose( means_norm_sq, perm=[2, 0, 1]) - 2 * scalar_prod if self.hparams.soft_em: nearest_idx = tf.stack( [ tf.multinomial( -dist[:, i, :], num_samples=self.hparams.num_samples) for i in range(self.hparams.num_blocks) ], axis=1) nearest_hot = tf.one_hot(nearest_idx, depth=self.hparams.block_v_size) nearest_hot = tf.reduce_mean(nearest_hot, axis=-2) else: if self.hparams.random_top_k > 1: _, top_k_idx = tf.nn.top_k(-dist, k=self.hparams.random_top_k) nearest_idx = tf.gather( top_k_idx, tf.random_uniform( [1], minval=0, maxval=self.hparams.random_top_k - 1, dtype=tf.int32), axis=-1) else: if self.hparams.use_scales: dist /= tf.reshape(self.hparams.scales, [1, 1, self.hparams.moe_num_experts]) nearest_idx = tf.argmax(-dist, axis=-1) nearest_hot = tf.one_hot(nearest_idx, self.hparams.block_v_size) return nearest_hot
[ "def", "nearest_neighbor", "(", "self", ",", "x", ",", "means", ")", ":", "x_norm_sq", "=", "tf", ".", "reduce_sum", "(", "tf", ".", "square", "(", "x", ")", ",", "axis", "=", "-", "1", ",", "keep_dims", "=", "True", ")", "means_norm_sq", "=", "tf", ".", "reduce_sum", "(", "tf", ".", "square", "(", "means", ")", ",", "axis", "=", "-", "1", ",", "keep_dims", "=", "True", ")", "scalar_prod", "=", "tf", ".", "matmul", "(", "tf", ".", "transpose", "(", "x", ",", "perm", "=", "[", "1", ",", "0", ",", "2", "]", ")", ",", "tf", ".", "transpose", "(", "means", ",", "perm", "=", "[", "0", ",", "2", ",", "1", "]", ")", ")", "scalar_prod", "=", "tf", ".", "transpose", "(", "scalar_prod", ",", "perm", "=", "[", "1", ",", "0", ",", "2", "]", ")", "dist", "=", "x_norm_sq", "+", "tf", ".", "transpose", "(", "means_norm_sq", ",", "perm", "=", "[", "2", ",", "0", ",", "1", "]", ")", "-", "2", "*", "scalar_prod", "if", "self", ".", "hparams", ".", "soft_em", ":", "nearest_idx", "=", "tf", ".", "stack", "(", "[", "tf", ".", "multinomial", "(", "-", "dist", "[", ":", ",", "i", ",", ":", "]", ",", "num_samples", "=", "self", ".", "hparams", ".", "num_samples", ")", "for", "i", "in", "range", "(", "self", ".", "hparams", ".", "num_blocks", ")", "]", ",", "axis", "=", "1", ")", "nearest_hot", "=", "tf", ".", "one_hot", "(", "nearest_idx", ",", "depth", "=", "self", ".", "hparams", ".", "block_v_size", ")", "nearest_hot", "=", "tf", ".", "reduce_mean", "(", "nearest_hot", ",", "axis", "=", "-", "2", ")", "else", ":", "if", "self", ".", "hparams", ".", "random_top_k", ">", "1", ":", "_", ",", "top_k_idx", "=", "tf", ".", "nn", ".", "top_k", "(", "-", "dist", ",", "k", "=", "self", ".", "hparams", ".", "random_top_k", ")", "nearest_idx", "=", "tf", ".", "gather", "(", "top_k_idx", ",", "tf", ".", "random_uniform", "(", "[", "1", "]", ",", "minval", "=", "0", ",", "maxval", "=", "self", ".", "hparams", ".", "random_top_k", "-", "1", ",", "dtype", "=", "tf", ".", "int32", ")", ",", "axis", "=", "-", "1", ")", "else", ":", "if", "self", ".", "hparams", ".", "use_scales", ":", "dist", "/=", "tf", ".", "reshape", "(", "self", ".", "hparams", ".", "scales", ",", "[", "1", ",", "1", ",", "self", ".", "hparams", ".", "moe_num_experts", "]", ")", "nearest_idx", "=", "tf", ".", "argmax", "(", "-", "dist", ",", "axis", "=", "-", "1", ")", "nearest_hot", "=", "tf", ".", "one_hot", "(", "nearest_idx", ",", "self", ".", "hparams", ".", "block_v_size", ")", "return", "nearest_hot" ]
Find the nearest element in means to elements in x. Args: x: Batch of encoder continuous latent states sliced/projected into shape [-1, num_blocks, block_dim]. means: Embedding means of shape. Returns: Tensor with nearest element in mean encoded in one-hot notation.
[ "Find", "the", "nearest", "element", "in", "means", "to", "elements", "in", "x", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vq_discrete.py#L74-L120
train
Find the nearest element in means to elements in x.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7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wYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(2800 - 2745) + '\061', 46190 - 46182), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(49) + chr(0b1111 + 0o43), 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + '\062' + chr(0b1111 + 0o46) + chr(0b10001 + 0o43), 62257 - 62249), ehT0Px3KOsy9('\060' + '\157' + chr(0b10111 + 0o35) + '\x34', 0b1000), ehT0Px3KOsy9(chr(775 - 727) + chr(3123 - 3012) + '\x33' + '\x36' + chr(0b110001 + 0o6), 34441 - 34433), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + '\061' + '\x34' + chr(0b10100 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3484 - 3373) + '\063' + chr(269 - 218) + '\x32', 39468 - 39460), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(998 - 949) + '\065' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b11001 + 0o126) + chr(476 - 426) + '\x33' + chr(1559 - 1506), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b10100 + 0o40) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b11001 + 0o126) + '\062' + chr(0b100111 + 0o14) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1485 - 1435) + chr(0b110111) + chr(2129 - 2079), 28979 - 28971), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(0b110001) + chr(55) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1347 - 1299) + '\x6f' + '\x33' + chr(0b110000) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(10693 - 10582) + '\063' + chr(594 - 546) + chr(196 - 141), 0b1000), ehT0Px3KOsy9('\x30' + chr(4961 - 4850) + chr(0b11110 + 0o25) + '\x37' + chr(0b11000 + 0o33), 64602 - 64594), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(71 - 18) + chr(405 - 357), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(709 - 656) + chr(1305 - 1253), ord("\x08")), ehT0Px3KOsy9(chr(1551 - 1503) + chr(111) + chr(0b110010) + chr(1861 - 1809) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(53) + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(448 - 399) + chr(2722 - 2669), 0b1000), ehT0Px3KOsy9(chr(603 - 555) + '\157' + '\061' + '\x30' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7160 - 7049) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10857 - 10746) + chr(1044 - 992) + chr(0b110011), 44504 - 44496), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(51) + chr(0b11010 + 0o27), 54547 - 54539), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b1001 + 0o51) + chr(0b11000 + 0o36), 0b1000), ehT0Px3KOsy9(chr(1150 - 1102) + chr(0b1011001 + 0o26) + chr(0b11010 + 0o31) + '\x37' + chr(0b110110), 47780 - 47772), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + chr(0b11110 + 0o25) + '\062' + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(48) + chr(0b101011 + 0o7), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1178 - 1126), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(545 - 434) + '\x31' + '\067' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(2564 - 2509) + chr(0b1111 + 0o42), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(0b10001 + 0o45), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011000 + 0o27) + chr(50) + '\060' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\061' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(867 - 819) + '\157' + chr(0b110011) + '\x33' + chr(2001 - 1946), 0o10), ehT0Px3KOsy9('\060' + chr(8987 - 8876) + chr(0b100110 + 0o13) + chr(54) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + chr(49) + chr(0b110100) + chr(48), 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(6366 - 6255) + '\063' + chr(1746 - 1691) + '\066', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(208 - 160) + chr(6250 - 6139) + chr(0b110101) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + chr(0b1000 + 0o147) + chr(100) + '\x65')(chr(0b11100 + 0o131) + chr(7163 - 7047) + chr(0b1100110) + chr(0b1011 + 0o42) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ynNl3vltSzzU(oVre8I6UXc3b, OeWW0F1dBPRQ, XCAIkNRdiX0I): fGB238pT2MDS = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(OeWW0F1dBPRQ), axis=-ehT0Px3KOsy9('\x30' + chr(10796 - 10685) + '\x31', 0o10), keep_dims=ehT0Px3KOsy9(chr(1938 - 1890) + chr(0b1101111) + chr(0b110001), 8)) VKkOWR9YyfoZ = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(XCAIkNRdiX0I), axis=-ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + '\061', 8), keep_dims=ehT0Px3KOsy9(chr(1317 - 1269) + chr(0b1101111) + chr(49), 8)) OsEVnTBapoxv = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(OeWW0F1dBPRQ, perm=[ehT0Px3KOsy9('\x30' + '\x6f' + chr(49), 8), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + chr(1576 - 1528), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062', 8)]), IDJ2eXGCBCDu.transpose(XCAIkNRdiX0I, perm=[ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(2641 - 2530) + chr(1273 - 1225), 8), ehT0Px3KOsy9(chr(1807 - 1759) + chr(9929 - 9818) + chr(50), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(2123 - 2074), 8)])) OsEVnTBapoxv = IDJ2eXGCBCDu.transpose(OsEVnTBapoxv, perm=[ehT0Px3KOsy9(chr(1640 - 1592) + '\x6f' + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + chr(1779 - 1668) + chr(1440 - 1392), 8), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(0b110010), 8)]) ydho_1U2EnKK = fGB238pT2MDS + IDJ2eXGCBCDu.transpose(VKkOWR9YyfoZ, perm=[ehT0Px3KOsy9(chr(1038 - 990) + '\x6f' + '\062', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000), 8), ehT0Px3KOsy9(chr(617 - 569) + chr(7600 - 7489) + '\x31', 8)]) - ehT0Px3KOsy9('\x30' + chr(0b111001 + 0o66) + '\x32', 8) * OsEVnTBapoxv if xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a\xa5\xcaP\xa8\x05\xb7'), chr(0b1100100) + chr(0b1100101) + chr(0b1001101 + 0o26) + '\157' + '\144' + '\145')(chr(0b1100101 + 0o20) + '\164' + chr(8475 - 8373) + chr(0b101101) + chr(3018 - 2962))): Dv7uUy8KB2ra = IDJ2eXGCBCDu.stack([IDJ2eXGCBCDu.multinomial(-ydho_1U2EnKK[:, WVxHKyX45z_L, :], num_samples=oVre8I6UXc3b.hparams.num_samples) for WVxHKyX45z_L in vQr8gNKaIaWE(oVre8I6UXc3b.hparams.azOnMTJc4Vem)], axis=ehT0Px3KOsy9('\060' + chr(248 - 137) + '\x31', 8)) WFCVMlXsdosn = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(Dv7uUy8KB2ra, depth=oVre8I6UXc3b.hparams.block_v_size) WFCVMlXsdosn = IDJ2eXGCBCDu.reduce_mean(WFCVMlXsdosn, axis=-ehT0Px3KOsy9('\x30' + chr(0b110111 + 0o70) + chr(50), 8)) else: if xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b\xab\xc2@\x98\r\x85X\x00\xed9\xf7'), chr(6224 - 6124) + chr(4780 - 4679) + chr(0b100010 + 0o101) + chr(111) + chr(100) + chr(2322 - 2221))('\165' + chr(11492 - 11376) + chr(102) + chr(207 - 162) + chr(286 - 230))) > ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31', 8): (VNGQdHSFPrso, Qoh6CntzWLSX) = IDJ2eXGCBCDu.nn.LQLM6CJZRTKz(-ydho_1U2EnKK, k=oVre8I6UXc3b.hparams.random_top_k) Dv7uUy8KB2ra = IDJ2eXGCBCDu.kGr_8mTaGpVE(Qoh6CntzWLSX, IDJ2eXGCBCDu.random_uniform([ehT0Px3KOsy9(chr(95 - 47) + chr(111) + '\x31', 8)], minval=ehT0Px3KOsy9(chr(1967 - 1919) + chr(0b1110 + 0o141) + chr(48), 8), maxval=oVre8I6UXc3b.hparams.random_top_k - ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2025 - 1976), 8), dtype=IDJ2eXGCBCDu.int32), axis=-ehT0Px3KOsy9('\060' + '\157' + chr(49), 8)) else: if xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\x94\xb9\xfdi\xb80\xe3\x1f_\xf3U\xaa'), chr(0b10111 + 0o115) + chr(4662 - 4561) + '\143' + chr(4810 - 4699) + chr(9654 - 9554) + chr(101))(chr(117) + chr(0b111 + 0o155) + chr(10258 - 10156) + chr(0b10010 + 0o33) + chr(56))): ydho_1U2EnKK /= IDJ2eXGCBCDu.reshape(oVre8I6UXc3b.hparams.Qii5VQxBIc9l, [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001), 8), oVre8I6UXc3b.hparams.r99iQzD4Y8i3]) Dv7uUy8KB2ra = IDJ2eXGCBCDu.argmax(-ydho_1U2EnKK, axis=-ehT0Px3KOsy9(chr(1034 - 986) + chr(0b111 + 0o150) + '\x31', 8)) WFCVMlXsdosn = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(Dv7uUy8KB2ra, oVre8I6UXc3b.hparams.block_v_size) return WFCVMlXsdosn
tensorflow/tensor2tensor
tensor2tensor/layers/vq_discrete.py
DiscreteBottleneck.embedding_lookup
def embedding_lookup(self, x, means): """Compute nearest neighbors and loss for training the embeddings. Args: x: Batch of encoder continuous latent states sliced/projected into shape [-1, num_blocks, block_dim]. means: Embedding means. Returns: The nearest neighbor in one hot form, the nearest neighbor itself, the commitment loss, embedding training loss. """ x_means_hot = self.nearest_neighbor(x, means) x_means_hot_flat = tf.reshape( x_means_hot, [-1, self.hparams.num_blocks, self.hparams.block_v_size]) x_means = tf.matmul(tf.transpose(x_means_hot_flat, perm=[1, 0, 2]), means) x_means = tf.transpose(x_means, [1, 0, 2]) q_loss = tf.reduce_mean( tf.squared_difference(tf.stop_gradient(x), x_means)) e_loss = tf.reduce_mean( tf.squared_difference(x, tf.stop_gradient(x_means))) return x_means_hot, x_means, q_loss, e_loss
python
def embedding_lookup(self, x, means): """Compute nearest neighbors and loss for training the embeddings. Args: x: Batch of encoder continuous latent states sliced/projected into shape [-1, num_blocks, block_dim]. means: Embedding means. Returns: The nearest neighbor in one hot form, the nearest neighbor itself, the commitment loss, embedding training loss. """ x_means_hot = self.nearest_neighbor(x, means) x_means_hot_flat = tf.reshape( x_means_hot, [-1, self.hparams.num_blocks, self.hparams.block_v_size]) x_means = tf.matmul(tf.transpose(x_means_hot_flat, perm=[1, 0, 2]), means) x_means = tf.transpose(x_means, [1, 0, 2]) q_loss = tf.reduce_mean( tf.squared_difference(tf.stop_gradient(x), x_means)) e_loss = tf.reduce_mean( tf.squared_difference(x, tf.stop_gradient(x_means))) return x_means_hot, x_means, q_loss, e_loss
[ "def", "embedding_lookup", "(", "self", ",", "x", ",", "means", ")", ":", "x_means_hot", "=", "self", ".", "nearest_neighbor", "(", "x", ",", "means", ")", "x_means_hot_flat", "=", "tf", ".", "reshape", "(", "x_means_hot", ",", "[", "-", "1", ",", "self", ".", "hparams", ".", "num_blocks", ",", "self", ".", "hparams", ".", "block_v_size", "]", ")", "x_means", "=", "tf", ".", "matmul", "(", "tf", ".", "transpose", "(", "x_means_hot_flat", ",", "perm", "=", "[", "1", ",", "0", ",", "2", "]", ")", ",", "means", ")", "x_means", "=", "tf", ".", "transpose", "(", "x_means", ",", "[", "1", ",", "0", ",", "2", "]", ")", "q_loss", "=", "tf", ".", "reduce_mean", "(", "tf", ".", "squared_difference", "(", "tf", ".", "stop_gradient", "(", "x", ")", ",", "x_means", ")", ")", "e_loss", "=", "tf", ".", "reduce_mean", "(", "tf", ".", "squared_difference", "(", "x", ",", "tf", ".", "stop_gradient", "(", "x_means", ")", ")", ")", "return", "x_means_hot", ",", "x_means", ",", "q_loss", ",", "e_loss" ]
Compute nearest neighbors and loss for training the embeddings. Args: x: Batch of encoder continuous latent states sliced/projected into shape [-1, num_blocks, block_dim]. means: Embedding means. Returns: The nearest neighbor in one hot form, the nearest neighbor itself, the commitment loss, embedding training loss.
[ "Compute", "nearest", "neighbors", "and", "loss", "for", "training", "the", "embeddings", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vq_discrete.py#L122-L145
train
Compute nearest neighbors and loss for training the embeddings.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYn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Nds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1087 - 1039) + chr(0b1101111) + chr(51) + '\x33' + '\060', 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + '\x32' + '\x36' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101011 + 0o104) + chr(49) + chr(878 - 830) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(2064 - 2015) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(250 - 202) + chr(0b100011 + 0o114) + '\061' + '\066' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x35' + chr(2203 - 2153), ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(49) + '\060' + chr(51), 63088 - 63080), ehT0Px3KOsy9('\x30' + chr(0b101000 + 0o107) + chr(0b101011 + 0o12) + chr(2184 - 2134), 8), ehT0Px3KOsy9(chr(514 - 466) + chr(0b1101111) + '\x34' + chr(0b101011 + 0o13), 41045 - 41037), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b11 + 0o154) + chr(0b110001) + chr(55) + chr(421 - 368), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(337 - 286) + chr(1918 - 1869) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b111001 + 0o66) + chr(0b100101 + 0o17) + chr(78 - 30), 0b1000), ehT0Px3KOsy9('\x30' + chr(4020 - 3909) + '\063' + '\067' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(1756 - 1705) + chr(472 - 418) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + '\x32' + '\x36' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + chr(49) + chr(0b1010 + 0o55), 63871 - 63863), ehT0Px3KOsy9(chr(1711 - 1663) + chr(0b1001110 + 0o41) + chr(1753 - 1702) + '\060' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11535 - 11424) + chr(0b100100 + 0o15) + '\066', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(4420 - 4309) + chr(0b110001) + chr(0b10010 + 0o40) + chr(54), 50879 - 50871), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + '\061' + '\x33' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(0b101110 + 0o7) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(54) + chr(986 - 937), 9410 - 9402), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9(chr(1036 - 988) + chr(111) + chr(50) + chr(0b110010) + '\x30', 26359 - 26351), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1461 - 1407) + '\x35', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11010 + 0o31) + '\x34' + chr(2509 - 2454), ord("\x08")), ehT0Px3KOsy9(chr(202 - 154) + chr(111) + chr(51) + chr(54) + chr(321 - 268), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b110101) + chr(345 - 296), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001 + 0o1) + chr(1256 - 1207) + chr(0b11011 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + '\061' + '\066' + chr(1160 - 1105), 0b1000), ehT0Px3KOsy9(chr(471 - 423) + '\157' + chr(0b110001) + '\x35' + chr(0b110011 + 0o3), 10037 - 10029), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(51) + chr(1309 - 1260) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(49) + chr(1548 - 1499) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x37' + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(0b110110) + chr(0b0 + 0o67), 0o10), ehT0Px3KOsy9('\060' + chr(2230 - 2119) + chr(452 - 403) + '\x35' + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(2361 - 2311) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b0 + 0o63) + '\061' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11541 - 11430) + chr(972 - 922) + '\060' + '\061', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1000100 + 0o53) + '\065' + chr(1367 - 1319), 37269 - 37261)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6'), chr(0b1000111 + 0o35) + '\145' + chr(7037 - 6938) + chr(0b1101111) + '\144' + '\x65')(chr(117) + chr(116) + '\x66' + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def _rf4aB2Cw0sq(oVre8I6UXc3b, OeWW0F1dBPRQ, XCAIkNRdiX0I): fu_DLUnq0Rui = oVre8I6UXc3b.nearest_neighbor(OeWW0F1dBPRQ, XCAIkNRdiX0I) OzTTsjtkYNjK = IDJ2eXGCBCDu.reshape(fu_DLUnq0Rui, [-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001), 11486 - 11478), oVre8I6UXc3b.hparams.azOnMTJc4Vem, oVre8I6UXc3b.hparams.block_v_size]) xPgmXL9DQrWF = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(OzTTsjtkYNjK, perm=[ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + chr(609 - 560), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(946 - 898), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010011 + 0o34) + '\x32', 57990 - 57982)]), XCAIkNRdiX0I) xPgmXL9DQrWF = IDJ2eXGCBCDu.transpose(xPgmXL9DQrWF, [ehT0Px3KOsy9(chr(0b110000) + chr(0b1100101 + 0o12) + chr(0b11011 + 0o26), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100111 + 0o13), 8)]) ZxXIFmtp9xUc = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(IDJ2eXGCBCDu.stop_gradient(OeWW0F1dBPRQ), xPgmXL9DQrWF)) bGSDGpa5hkiT = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(OeWW0F1dBPRQ, IDJ2eXGCBCDu.stop_gradient(xPgmXL9DQrWF))) return (fu_DLUnq0Rui, xPgmXL9DQrWF, ZxXIFmtp9xUc, bGSDGpa5hkiT)
tensorflow/tensor2tensor
tensor2tensor/layers/vq_discrete.py
DiscreteBottleneck.int_to_bit
def int_to_bit(self, x_int, num_bits, base=2): """Turn x_int representing numbers into a bitwise (lower-endian) tensor. Args: x_int: Tensor containing integer to be converted into base notation. num_bits: Number of bits in the representation. base: Base of the representation. Returns: Corresponding number expressed in base. """ x_l = tf.to_int32(tf.expand_dims(x_int, axis=-1)) # pylint: disable=g-complex-comprehension x_labels = [ tf.floormod( tf.floordiv(tf.to_int32(x_l), tf.to_int32(base)**i), tf.to_int32(base)) for i in range(num_bits)] res = tf.concat(x_labels, axis=-1) return tf.to_float(res)
python
def int_to_bit(self, x_int, num_bits, base=2): """Turn x_int representing numbers into a bitwise (lower-endian) tensor. Args: x_int: Tensor containing integer to be converted into base notation. num_bits: Number of bits in the representation. base: Base of the representation. Returns: Corresponding number expressed in base. """ x_l = tf.to_int32(tf.expand_dims(x_int, axis=-1)) # pylint: disable=g-complex-comprehension x_labels = [ tf.floormod( tf.floordiv(tf.to_int32(x_l), tf.to_int32(base)**i), tf.to_int32(base)) for i in range(num_bits)] res = tf.concat(x_labels, axis=-1) return tf.to_float(res)
[ "def", "int_to_bit", "(", "self", ",", "x_int", ",", "num_bits", ",", "base", "=", "2", ")", ":", "x_l", "=", "tf", ".", "to_int32", "(", "tf", ".", "expand_dims", "(", "x_int", ",", "axis", "=", "-", "1", ")", ")", "# pylint: disable=g-complex-comprehension", "x_labels", "=", "[", "tf", ".", "floormod", "(", "tf", ".", "floordiv", "(", "tf", ".", "to_int32", "(", "x_l", ")", ",", "tf", ".", "to_int32", "(", "base", ")", "**", "i", ")", ",", "tf", ".", "to_int32", "(", "base", ")", ")", "for", "i", "in", "range", "(", "num_bits", ")", "]", "res", "=", "tf", ".", "concat", "(", "x_labels", ",", "axis", "=", "-", "1", ")", "return", "tf", ".", "to_float", "(", "res", ")" ]
Turn x_int representing numbers into a bitwise (lower-endian) tensor. Args: x_int: Tensor containing integer to be converted into base notation. num_bits: Number of bits in the representation. base: Base of the representation. Returns: Corresponding number expressed in base.
[ "Turn", "x_int", "representing", "numbers", "into", "a", "bitwise", "(", "lower", "-", "endian", ")", "tensor", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vq_discrete.py#L167-L187
train
Turn x_int representing numbers into a bitwise lower - endian tensor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,h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V2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(0b110011) + chr(48) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11010 + 0o27) + '\066' + chr(0b110111), 39864 - 39856), ehT0Px3KOsy9(chr(48) + chr(7230 - 7119) + chr(0b110010) + '\061' + chr(48), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b100111 + 0o14) + chr(0b110110) + chr(0b110010 + 0o4), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(914 - 803) + chr(49) + chr(2007 - 1955) + '\060', 52128 - 52120), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(53 - 2) + chr(0b110100) + '\x30', 45381 - 45373), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(1110 - 1059) + chr(0b1111 + 0o46), 0b1000), ehT0Px3KOsy9(chr(462 - 414) + chr(4262 - 4151) + chr(0b110001) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\066' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(49) + chr(0b110111) + '\x31', 0b1000), ehT0Px3KOsy9(chr(1278 - 1230) + '\x6f' + '\x32' + chr(1075 - 1020) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(0b101 + 0o54) + chr(1177 - 1122) + chr(1858 - 1808), 17941 - 17933), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + chr(0b110110) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b101 + 0o61) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(3083 - 2972) + '\061' + chr(53) + chr(0b110000), 58991 - 58983), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b101000 + 0o107) + chr(55) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10152 - 10041) + '\x32' + chr(1827 - 1772) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\060', 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(51) + chr(982 - 934) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + chr(0b100000 + 0o21) + '\x31' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x36' + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(2561 - 2450) + '\062' + '\x32' + chr(193 - 142), 36987 - 36979), ehT0Px3KOsy9(chr(1120 - 1072) + '\x6f' + chr(0b1 + 0o60) + '\060' + '\x37', 0b1000), ehT0Px3KOsy9(chr(2055 - 2007) + chr(0b1100110 + 0o11) + chr(0b101011 + 0o11) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(48) + chr(0b100111 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(2370 - 2259) + chr(51) + chr(0b11010 + 0o33) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\x37' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(2176 - 2128) + chr(111) + chr(49) + chr(0b110101) + chr(1900 - 1847), ord("\x08")), ehT0Px3KOsy9(chr(2196 - 2148) + '\157' + chr(0b110111) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(50) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + '\062' + chr(0b11011 + 0o25) + chr(2233 - 2182), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(891 - 843) + '\x30', 25876 - 25868), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\x31' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b110001), 35043 - 35035), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(2224 - 2173) + chr(0b1011 + 0o52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1379 - 1328) + chr(0b11000 + 0o31) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(1390 - 1340) + '\x31' + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\061' + chr(1322 - 1271), 8), ehT0Px3KOsy9(chr(1215 - 1167) + chr(0b1101111) + '\x33' + chr(1290 - 1241) + chr(1780 - 1730), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(49) + '\060', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2251 - 2203) + chr(11650 - 11539) + '\x35' + chr(0b11100 + 0o24), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xee'), chr(3447 - 3347) + chr(0b1100101) + '\x63' + '\157' + chr(100) + '\145')('\165' + chr(0b1110100) + '\146' + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def yJGZvHIPIBwO(oVre8I6UXc3b, YG0IvU5zeVte, xvzt498SEA6K, XLXqkmM_0GVx=ehT0Px3KOsy9(chr(1356 - 1308) + chr(0b1101111) + chr(163 - 113), 6927 - 6919)): Pwkog3xriYf_ = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.expand_dims(YG0IvU5zeVte, axis=-ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001), 0b1000))) iEG9SFXKjXHK = [IDJ2eXGCBCDu.floormod(IDJ2eXGCBCDu.floordiv(IDJ2eXGCBCDu.to_int32(Pwkog3xriYf_), IDJ2eXGCBCDu.to_int32(XLXqkmM_0GVx) ** WVxHKyX45z_L), IDJ2eXGCBCDu.to_int32(XLXqkmM_0GVx)) for WVxHKyX45z_L in vQr8gNKaIaWE(xvzt498SEA6K)] MsbwfslwLjRO = IDJ2eXGCBCDu.concat(iEG9SFXKjXHK, axis=-ehT0Px3KOsy9('\x30' + chr(9145 - 9034) + chr(0b110001), 8)) return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a"\xc4\xc5\x0b\xa8_OgA\xec\x0f'), '\x64' + '\x65' + chr(0b1000111 + 0o34) + chr(111) + chr(0b1011 + 0o131) + chr(6255 - 6154))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(0b10011 + 0o45)))(MsbwfslwLjRO)
tensorflow/tensor2tensor
tensor2tensor/layers/vq_discrete.py
DiscreteBottleneck.embed
def embed(self, x): """Embedding function that takes discrete latent and returns embedding. Args: x: Input to the discretization bottleneck. Returns: Continuous embedding to be passed on to the decoder. Raises: ValueError: For unknown or missing arguments. """ shape_x = common_layers.shape_list(x) x_flat = tf.reshape(x, [-1, 1]) c = self.int_to_bit(x_flat, num_bits=self.hparams.z_size, base=2) shape = common_layers.shape_list(c) new_shape = shape new_shape.append(self.hparams.num_blocks) new_shape.append(int(self.hparams.z_size / self.hparams.num_blocks)) c = tf.to_int32(tf.reshape(c, shape=new_shape)) h1_shape = shape_x h1_shape.append(self.hparams.hidden_size) h1 = tf.zeros(dtype=tf.float32, shape=h1_shape) c_int = self.bit_to_int( c, num_bits=int(self.hparams.z_size / self.hparams.num_blocks), base=2) c_hot = tf.one_hot(c_int, depth=self.hparams.block_v_size, axis=-1) c_hot_flat = tf.reshape( c_hot, shape=[-1, self.hparams.num_blocks, self.hparams.block_v_size]) h1 = tf.matmul(tf.transpose(c_hot_flat, perm=[1, 0, 2]), self.means) h1 = tf.transpose(h1, perm=[1, 0, 2]) h1 = tf.reshape(h1, shape=h1_shape) h1_shape[0] = self.hparams.batch_size h2 = tf.layers.dense(tf.nn.relu(h1), self.hparams.filter_size, name="vch2") res = tf.layers.dense( tf.nn.relu(h2), self.hparams.hidden_size, name="vcfin") return res
python
def embed(self, x): """Embedding function that takes discrete latent and returns embedding. Args: x: Input to the discretization bottleneck. Returns: Continuous embedding to be passed on to the decoder. Raises: ValueError: For unknown or missing arguments. """ shape_x = common_layers.shape_list(x) x_flat = tf.reshape(x, [-1, 1]) c = self.int_to_bit(x_flat, num_bits=self.hparams.z_size, base=2) shape = common_layers.shape_list(c) new_shape = shape new_shape.append(self.hparams.num_blocks) new_shape.append(int(self.hparams.z_size / self.hparams.num_blocks)) c = tf.to_int32(tf.reshape(c, shape=new_shape)) h1_shape = shape_x h1_shape.append(self.hparams.hidden_size) h1 = tf.zeros(dtype=tf.float32, shape=h1_shape) c_int = self.bit_to_int( c, num_bits=int(self.hparams.z_size / self.hparams.num_blocks), base=2) c_hot = tf.one_hot(c_int, depth=self.hparams.block_v_size, axis=-1) c_hot_flat = tf.reshape( c_hot, shape=[-1, self.hparams.num_blocks, self.hparams.block_v_size]) h1 = tf.matmul(tf.transpose(c_hot_flat, perm=[1, 0, 2]), self.means) h1 = tf.transpose(h1, perm=[1, 0, 2]) h1 = tf.reshape(h1, shape=h1_shape) h1_shape[0] = self.hparams.batch_size h2 = tf.layers.dense(tf.nn.relu(h1), self.hparams.filter_size, name="vch2") res = tf.layers.dense( tf.nn.relu(h2), self.hparams.hidden_size, name="vcfin") return res
[ "def", "embed", "(", "self", ",", "x", ")", ":", "shape_x", "=", "common_layers", ".", "shape_list", "(", "x", ")", "x_flat", "=", "tf", ".", "reshape", "(", "x", ",", "[", "-", "1", ",", "1", "]", ")", "c", "=", "self", ".", "int_to_bit", "(", "x_flat", ",", "num_bits", "=", "self", ".", "hparams", ".", "z_size", ",", "base", "=", "2", ")", "shape", "=", "common_layers", ".", "shape_list", "(", "c", ")", "new_shape", "=", "shape", "new_shape", ".", "append", "(", "self", ".", "hparams", ".", "num_blocks", ")", "new_shape", ".", "append", "(", "int", "(", "self", ".", "hparams", ".", "z_size", "/", "self", ".", "hparams", ".", "num_blocks", ")", ")", "c", "=", "tf", ".", "to_int32", "(", "tf", ".", "reshape", "(", "c", ",", "shape", "=", "new_shape", ")", ")", "h1_shape", "=", "shape_x", "h1_shape", ".", "append", "(", "self", ".", "hparams", ".", "hidden_size", ")", "h1", "=", "tf", ".", "zeros", "(", "dtype", "=", "tf", ".", "float32", ",", "shape", "=", "h1_shape", ")", "c_int", "=", "self", ".", "bit_to_int", "(", "c", ",", "num_bits", "=", "int", "(", "self", ".", "hparams", ".", "z_size", "/", "self", ".", "hparams", ".", "num_blocks", ")", ",", "base", "=", "2", ")", "c_hot", "=", "tf", ".", "one_hot", "(", "c_int", ",", "depth", "=", "self", ".", "hparams", ".", "block_v_size", ",", "axis", "=", "-", "1", ")", "c_hot_flat", "=", "tf", ".", "reshape", "(", "c_hot", ",", "shape", "=", "[", "-", "1", ",", "self", ".", "hparams", ".", "num_blocks", ",", "self", ".", "hparams", ".", "block_v_size", "]", ")", "h1", "=", "tf", ".", "matmul", "(", "tf", ".", "transpose", "(", "c_hot_flat", ",", "perm", "=", "[", "1", ",", "0", ",", "2", "]", ")", ",", "self", ".", "means", ")", "h1", "=", "tf", ".", "transpose", "(", "h1", ",", "perm", "=", "[", "1", ",", "0", ",", "2", "]", ")", "h1", "=", "tf", ".", "reshape", "(", "h1", ",", "shape", "=", "h1_shape", ")", "h1_shape", "[", "0", "]", "=", "self", ".", "hparams", ".", "batch_size", "h2", "=", "tf", ".", "layers", ".", "dense", "(", "tf", ".", "nn", ".", "relu", "(", "h1", ")", ",", "self", ".", "hparams", ".", "filter_size", ",", "name", "=", "\"vch2\"", ")", "res", "=", "tf", ".", "layers", ".", "dense", "(", "tf", ".", "nn", ".", "relu", "(", "h2", ")", ",", "self", ".", "hparams", ".", "hidden_size", ",", "name", "=", "\"vcfin\"", ")", "return", "res" ]
Embedding function that takes discrete latent and returns embedding. Args: x: Input to the discretization bottleneck. Returns: Continuous embedding to be passed on to the decoder. Raises: ValueError: For unknown or missing arguments.
[ "Embedding", "function", "that", "takes", "discrete", "latent", "and", "returns", "embedding", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vq_discrete.py#L189-L223
train
Embedding function that takes discrete latent and returns embedding.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKo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aLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(1732 - 1682) + chr(2294 - 2246) + '\x35', 6996 - 6988), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + '\061' + '\060' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(4672 - 4561) + '\063' + '\x35' + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + '\x33' + chr(1885 - 1837), 59743 - 59735), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000 + 0o1) + chr(48) + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b110111 + 0o0) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + '\061' + '\x30' + chr(0b101101 + 0o10), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(606 - 557) + chr(52) + '\x37', 58817 - 58809), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(2154 - 2043) + chr(0b110001) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2535 - 2424) + '\063' + '\065' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(3932 - 3821) + '\063' + chr(0b110111) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(2115 - 2067) + chr(0b110000 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b11010 + 0o26) + '\x33', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101000 + 0o7) + '\063' + chr(54) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(1095 - 1047) + '\157' + '\x35' + chr(2899 - 2844), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(83 - 34) + '\065' + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + '\x34' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + '\x31' + chr(0b11101 + 0o26) + chr(48), 8), ehT0Px3KOsy9(chr(1871 - 1823) + chr(10962 - 10851) + chr(0b110010) + '\x33' + chr(402 - 352), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(6273 - 6162) + '\067' + chr(2038 - 1986), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + '\063' + chr(1473 - 1425) + '\x32', 16763 - 16755), ehT0Px3KOsy9('\x30' + chr(6506 - 6395) + chr(0b110010) + '\064' + chr(905 - 853), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(771 - 718) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b1100 + 0o51) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6415 - 6304) + chr(1722 - 1670) + chr(2630 - 2578), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x35' + chr(0b101011 + 0o7), 6337 - 6329), ehT0Px3KOsy9('\060' + '\157' + chr(180 - 131) + chr(2169 - 2121) + chr(0b110010), 46160 - 46152), ehT0Px3KOsy9(chr(48) + chr(111) + chr(760 - 711) + chr(0b110011) + chr(48), 8), ehT0Px3KOsy9(chr(48) + chr(5178 - 5067) + chr(591 - 542) + chr(269 - 216) + chr(0b11011 + 0o32), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(55) + chr(0b10101 + 0o37), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b11101 + 0o24) + '\062' + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100000 + 0o17) + chr(1227 - 1177) + chr(1751 - 1696) + chr(613 - 561), 27484 - 27476), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1000110 + 0o51) + chr(1300 - 1249) + chr(54) + chr(744 - 689), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10010 + 0o37) + chr(1699 - 1650) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1755 - 1707) + chr(111) + chr(1797 - 1748) + chr(2185 - 2135) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(5098 - 4987) + chr(50) + chr(0b11010 + 0o35) + chr(2539 - 2488), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100 + 0o57) + '\064' + chr(0b1011 + 0o51), 20935 - 20927), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(1011 - 962) + '\062' + '\061', 8), ehT0Px3KOsy9(chr(581 - 533) + chr(0b1100010 + 0o15) + '\x33' + chr(54) + chr(0b101 + 0o62), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1897 - 1849) + '\157' + chr(0b110101) + chr(0b110000), 3119 - 3111)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xab'), chr(0b110111 + 0o55) + chr(101) + chr(9578 - 9479) + '\157' + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + chr(0b11100 + 0o112) + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def DSKhI6I667G0(oVre8I6UXc3b, OeWW0F1dBPRQ): aGtbOvWfCD5N = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ) mstS6zVd22Jf = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1980 - 1932) + chr(111) + chr(49), 8)]) qzn1Ctg9WgNh = oVre8I6UXc3b.int_to_bit(mstS6zVd22Jf, num_bits=oVre8I6UXc3b.hparams.NSd4iRY6tdp8, base=ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b11011 + 0o27), 0o10)) nauYfLglTpcb = jSKPaHwSAfVv.shape_list(qzn1Ctg9WgNh) P7dVzv6_yXeE = nauYfLglTpcb xafqLlk3kkUe(P7dVzv6_yXeE, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe43\x9d=(\xdf'), '\x64' + chr(0b11101 + 0o110) + chr(0b111 + 0o134) + chr(0b1101001 + 0o6) + '\x64' + '\145')(chr(0b1110101) + '\x74' + chr(102) + chr(0b101100 + 0o1) + chr(2831 - 2775)))(xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe49\xa26\x0b\xef\x0f\x049\xbd\x9c\xa8'), '\144' + '\x65' + chr(8519 - 8420) + '\157' + '\x64' + '\145')(chr(7947 - 7830) + chr(0b1010 + 0o152) + chr(7255 - 7153) + chr(45) + chr(56)))) xafqLlk3kkUe(P7dVzv6_yXeE, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe43\x9d=(\xdf'), '\x64' + chr(0b1100101) + '\x63' + chr(0b1010011 + 0o34) + chr(0b10 + 0o142) + chr(101))(chr(0b1110101) + chr(116) + chr(102) + chr(0b101101) + '\070'))(ehT0Px3KOsy9(xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\x10\x89l/\xe9\x1cQy\x8f\x89\xfd'), chr(1355 - 1255) + '\x65' + chr(4728 - 4629) + '\x6f' + '\x64' + chr(0b1000001 + 0o44))(chr(0b1001001 + 0o54) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56))) / xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe49\xa26\x0b\xef\x0f\x049\xbd\x9c\xa8'), chr(100) + chr(0b1100101) + '\143' + '\157' + '\x64' + chr(101))(chr(0b1110101) + '\x74' + chr(0b10101 + 0o121) + chr(0b101101) + chr(56))))) qzn1Ctg9WgNh = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.reshape(qzn1Ctg9WgNh, shape=P7dVzv6_yXeE)) VA84Lbf0Xj2y = aGtbOvWfCD5N xafqLlk3kkUe(VA84Lbf0Xj2y, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe43\x9d=(\xdf'), chr(1757 - 1657) + '\145' + chr(3727 - 3628) + chr(111) + '\x64' + chr(5574 - 5473))(chr(117) + chr(0b1110100) + '\x66' + '\055' + chr(56)))(xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf49\x82!\x1e\xf5v\x0ci\x83\xbd\x89'), chr(100) + '\145' + '\x63' + chr(3068 - 2957) + chr(100) + chr(101))(chr(117) + '\164' + chr(102) + chr(0b100111 + 0o6) + '\070'))) pHCcavHAFrT_ = IDJ2eXGCBCDu.zeros(dtype=IDJ2eXGCBCDu.float32, shape=VA84Lbf0Xj2y) IzHQVhgU6VCm = oVre8I6UXc3b.bit_to_int(qzn1Ctg9WgNh, num_bits=ehT0Px3KOsy9(oVre8I6UXc3b.hparams.NSd4iRY6tdp8 / oVre8I6UXc3b.hparams.azOnMTJc4Vem), base=ehT0Px3KOsy9(chr(950 - 902) + chr(0b1101111) + '\x32', 8)) WxhLPyUpYRb5 = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(IzHQVhgU6VCm, depth=oVre8I6UXc3b.hparams.block_v_size, axis=-ehT0Px3KOsy9('\x30' + chr(111) + chr(2237 - 2188), 8)) JA2_G28zRyJ2 = IDJ2eXGCBCDu.reshape(WxhLPyUpYRb5, shape=[-ehT0Px3KOsy9('\060' + '\157' + chr(0b100011 + 0o16), 8), oVre8I6UXc3b.hparams.azOnMTJc4Vem, oVre8I6UXc3b.hparams.block_v_size]) pHCcavHAFrT_ = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(JA2_G28zRyJ2, perm=[ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(11670 - 11559) + chr(0b11110 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(0b110010), 8)]), oVre8I6UXc3b.XCAIkNRdiX0I) pHCcavHAFrT_ = IDJ2eXGCBCDu.transpose(pHCcavHAFrT_, perm=[ehT0Px3KOsy9(chr(104 - 56) + '\157' + '\061', 8), ehT0Px3KOsy9('\x30' + '\157' + '\060', 8), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\x32', 8)]) pHCcavHAFrT_ = IDJ2eXGCBCDu.reshape(pHCcavHAFrT_, shape=VA84Lbf0Xj2y) VA84Lbf0Xj2y[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000), 8)] = oVre8I6UXc3b.hparams.ix9dZyeAmUxY GGNH7JNUgs4j = IDJ2eXGCBCDu.layers.dense(IDJ2eXGCBCDu.nn.relu(pHCcavHAFrT_), oVre8I6UXc3b.hparams.deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3 \x85j'), chr(100) + chr(0b111010 + 0o53) + chr(0b1100011) + chr(0b1101111) + chr(0b11010 + 0o112) + '\x65')(chr(0b101 + 0o160) + '\164' + chr(0b1001100 + 0o32) + '\055' + chr(630 - 574))) MsbwfslwLjRO = IDJ2eXGCBCDu.layers.dense(IDJ2eXGCBCDu.nn.relu(GGNH7JNUgs4j), oVre8I6UXc3b.hparams.qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3 \x8b1('), chr(9848 - 9748) + '\x65' + chr(0b1100011) + chr(8077 - 7966) + chr(0b111110 + 0o46) + chr(0b1100011 + 0o2))('\x75' + chr(11602 - 11486) + chr(0b100001 + 0o105) + chr(0b101101) + chr(0b111000))) return MsbwfslwLjRO
tensorflow/tensor2tensor
tensor2tensor/layers/vq_discrete.py
DiscreteBottleneck.discrete_bottleneck
def discrete_bottleneck(self, x): """Discretization bottleneck for latent variables. Args: x: Input to the discretization bottleneck. Returns: Embedding to pass to the decoder, discrete latent, loss, and the embedding function. Raises: ValueError: If projection_tensors is None for reshape_method project, or ema_count or ema_means is None if we are using ema, or unknown args. """ x_reshaped = self.slice_hidden(x) x_means_hot = [] x_means = 0 loss = 0 x_means_hot, x_means, q_loss, e_loss = self.embedding_lookup( x_reshaped, self.means) if self.hparams.ema: tf.logging.info("Using EMA with beta = {}".format(self.hparams.beta)) updated_ema_count = \ moving_averages.assign_moving_average( self.ema_count, tf.reduce_sum( tf.reshape( x_means_hot, shape=[-1, self.hparams.num_blocks, self.hparams.block_v_size]), axis=0), self.hparams.decay, zero_debias=False) dw = tf.matmul( tf.transpose(x_means_hot, perm=[1, 2, 0]), tf.transpose(x_reshaped, perm=[1, 0, 2])) updated_ema_means = \ moving_averages.assign_moving_average( self.ema_means, dw, self.hparams.decay, zero_debias=False) n = tf.reduce_sum(updated_ema_count, axis=-1, keep_dims=True) updated_ema_count = ((updated_ema_count + self.hparams.epsilon) / ( n + 2**self.hparams.z_size * self.hparams.epsilon) * n) updated_ema_means = updated_ema_means / tf.expand_dims( updated_ema_count, axis=-1) with tf.control_dependencies([e_loss]): update_means = tf.assign(self.means, updated_ema_means) with tf.control_dependencies([update_means]): loss += self.hparams.beta * e_loss else: # Use a gradient based loss for learning the cluster centers loss += q_loss + self.hparams.beta * e_loss # Get the discrete latent representation x_means_idx = tf.argmax(x_means_hot, axis=-1) # Get the binary representation num_bits = int(self.hparams.z_size // self.hparams.num_blocks) x_means_bits = self.int_to_bit(x_means_idx, num_bits=num_bits, base=2) x_discrete = self.bit_to_int( tf.to_int32(x_means_bits), num_bits=self.hparams.z_size, base=2) # Reshape x_discrete shape_x = common_layers.shape_list(x) shape_discrete = shape_x[:-1] x_discrete = tf.reshape(x_discrete, shape_discrete) x_means = tf.reshape(x_means, shape=shape_x) h1 = x + tf.stop_gradient(x_means - x) h2 = tf.layers.dense(tf.nn.relu(h1), self.hparams.filter_size, name="vch2") res = tf.layers.dense( tf.nn.relu(h2), self.hparams.hidden_size, name="vcfin") embed_fn = partial(self.embed) return { "dense": res, "discrete": x_discrete, "loss": loss, "embed": embed_fn }
python
def discrete_bottleneck(self, x): """Discretization bottleneck for latent variables. Args: x: Input to the discretization bottleneck. Returns: Embedding to pass to the decoder, discrete latent, loss, and the embedding function. Raises: ValueError: If projection_tensors is None for reshape_method project, or ema_count or ema_means is None if we are using ema, or unknown args. """ x_reshaped = self.slice_hidden(x) x_means_hot = [] x_means = 0 loss = 0 x_means_hot, x_means, q_loss, e_loss = self.embedding_lookup( x_reshaped, self.means) if self.hparams.ema: tf.logging.info("Using EMA with beta = {}".format(self.hparams.beta)) updated_ema_count = \ moving_averages.assign_moving_average( self.ema_count, tf.reduce_sum( tf.reshape( x_means_hot, shape=[-1, self.hparams.num_blocks, self.hparams.block_v_size]), axis=0), self.hparams.decay, zero_debias=False) dw = tf.matmul( tf.transpose(x_means_hot, perm=[1, 2, 0]), tf.transpose(x_reshaped, perm=[1, 0, 2])) updated_ema_means = \ moving_averages.assign_moving_average( self.ema_means, dw, self.hparams.decay, zero_debias=False) n = tf.reduce_sum(updated_ema_count, axis=-1, keep_dims=True) updated_ema_count = ((updated_ema_count + self.hparams.epsilon) / ( n + 2**self.hparams.z_size * self.hparams.epsilon) * n) updated_ema_means = updated_ema_means / tf.expand_dims( updated_ema_count, axis=-1) with tf.control_dependencies([e_loss]): update_means = tf.assign(self.means, updated_ema_means) with tf.control_dependencies([update_means]): loss += self.hparams.beta * e_loss else: # Use a gradient based loss for learning the cluster centers loss += q_loss + self.hparams.beta * e_loss # Get the discrete latent representation x_means_idx = tf.argmax(x_means_hot, axis=-1) # Get the binary representation num_bits = int(self.hparams.z_size // self.hparams.num_blocks) x_means_bits = self.int_to_bit(x_means_idx, num_bits=num_bits, base=2) x_discrete = self.bit_to_int( tf.to_int32(x_means_bits), num_bits=self.hparams.z_size, base=2) # Reshape x_discrete shape_x = common_layers.shape_list(x) shape_discrete = shape_x[:-1] x_discrete = tf.reshape(x_discrete, shape_discrete) x_means = tf.reshape(x_means, shape=shape_x) h1 = x + tf.stop_gradient(x_means - x) h2 = tf.layers.dense(tf.nn.relu(h1), self.hparams.filter_size, name="vch2") res = tf.layers.dense( tf.nn.relu(h2), self.hparams.hidden_size, name="vcfin") embed_fn = partial(self.embed) return { "dense": res, "discrete": x_discrete, "loss": loss, "embed": embed_fn }
[ "def", "discrete_bottleneck", "(", "self", ",", "x", ")", ":", "x_reshaped", "=", "self", ".", "slice_hidden", "(", "x", ")", "x_means_hot", "=", "[", "]", "x_means", "=", "0", "loss", "=", "0", "x_means_hot", ",", "x_means", ",", "q_loss", ",", "e_loss", "=", "self", ".", "embedding_lookup", "(", "x_reshaped", ",", "self", ".", "means", ")", "if", "self", ".", "hparams", ".", "ema", ":", "tf", ".", "logging", ".", "info", "(", "\"Using EMA with beta = {}\"", ".", "format", "(", "self", ".", "hparams", ".", "beta", ")", ")", "updated_ema_count", "=", "moving_averages", ".", "assign_moving_average", "(", "self", ".", "ema_count", ",", "tf", ".", "reduce_sum", "(", "tf", ".", "reshape", "(", "x_means_hot", ",", "shape", "=", "[", "-", "1", ",", "self", ".", "hparams", ".", "num_blocks", ",", "self", ".", "hparams", ".", "block_v_size", "]", ")", ",", "axis", "=", "0", ")", ",", "self", ".", "hparams", ".", "decay", ",", "zero_debias", "=", "False", ")", "dw", "=", "tf", ".", "matmul", "(", "tf", ".", "transpose", "(", "x_means_hot", ",", "perm", "=", "[", "1", ",", "2", ",", "0", "]", ")", ",", "tf", ".", "transpose", "(", "x_reshaped", ",", "perm", "=", "[", "1", ",", "0", ",", "2", "]", ")", ")", "updated_ema_means", "=", "moving_averages", ".", "assign_moving_average", "(", "self", ".", "ema_means", ",", "dw", ",", "self", ".", "hparams", ".", "decay", ",", "zero_debias", "=", "False", ")", "n", "=", "tf", ".", "reduce_sum", "(", "updated_ema_count", ",", "axis", "=", "-", "1", ",", "keep_dims", "=", "True", ")", "updated_ema_count", "=", "(", "(", "updated_ema_count", "+", "self", ".", "hparams", ".", "epsilon", ")", "/", "(", "n", "+", "2", "**", "self", ".", "hparams", ".", "z_size", "*", "self", ".", "hparams", ".", "epsilon", ")", "*", "n", ")", "updated_ema_means", "=", "updated_ema_means", "/", "tf", ".", "expand_dims", "(", "updated_ema_count", ",", "axis", "=", "-", "1", ")", "with", "tf", ".", "control_dependencies", "(", "[", "e_loss", "]", ")", ":", "update_means", "=", "tf", ".", "assign", "(", "self", ".", "means", ",", "updated_ema_means", ")", "with", "tf", ".", "control_dependencies", "(", "[", "update_means", "]", ")", ":", "loss", "+=", "self", ".", "hparams", ".", "beta", "*", "e_loss", "else", ":", "# Use a gradient based loss for learning the cluster centers", "loss", "+=", "q_loss", "+", "self", ".", "hparams", ".", "beta", "*", "e_loss", "# Get the discrete latent representation", "x_means_idx", "=", "tf", ".", "argmax", "(", "x_means_hot", ",", "axis", "=", "-", "1", ")", "# Get the binary representation", "num_bits", "=", "int", "(", "self", ".", "hparams", ".", "z_size", "//", "self", ".", "hparams", ".", "num_blocks", ")", "x_means_bits", "=", "self", ".", "int_to_bit", "(", "x_means_idx", ",", "num_bits", "=", "num_bits", ",", "base", "=", "2", ")", "x_discrete", "=", "self", ".", "bit_to_int", "(", "tf", ".", "to_int32", "(", "x_means_bits", ")", ",", "num_bits", "=", "self", ".", "hparams", ".", "z_size", ",", "base", "=", "2", ")", "# Reshape x_discrete", "shape_x", "=", "common_layers", ".", "shape_list", "(", "x", ")", "shape_discrete", "=", "shape_x", "[", ":", "-", "1", "]", "x_discrete", "=", "tf", ".", "reshape", "(", "x_discrete", ",", "shape_discrete", ")", "x_means", "=", "tf", ".", "reshape", "(", "x_means", ",", "shape", "=", "shape_x", ")", "h1", "=", "x", "+", "tf", ".", "stop_gradient", "(", "x_means", "-", "x", ")", "h2", "=", "tf", ".", "layers", ".", "dense", "(", "tf", ".", "nn", ".", "relu", "(", "h1", ")", ",", "self", ".", "hparams", ".", "filter_size", ",", "name", "=", "\"vch2\"", ")", "res", "=", "tf", ".", "layers", ".", "dense", "(", "tf", ".", "nn", ".", "relu", "(", "h2", ")", ",", "self", ".", "hparams", ".", "hidden_size", ",", "name", "=", "\"vcfin\"", ")", "embed_fn", "=", "partial", "(", "self", ".", "embed", ")", "return", "{", "\"dense\"", ":", "res", ",", "\"discrete\"", ":", "x_discrete", ",", "\"loss\"", ":", "loss", ",", "\"embed\"", ":", "embed_fn", "}" ]
Discretization bottleneck for latent variables. Args: x: Input to the discretization bottleneck. Returns: Embedding to pass to the decoder, discrete latent, loss, and the embedding function. Raises: ValueError: If projection_tensors is None for reshape_method project, or ema_count or ema_means is None if we are using ema, or unknown args.
[ "Discretization", "bottleneck", "for", "latent", "variables", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vq_discrete.py#L225-L310
train
Discretization bottleneck for latent variables.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAf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_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\067' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11000 + 0o33) + chr(53) + chr(1891 - 1843), 22605 - 22597), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b110011) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(2026 - 1971) + chr(2295 - 2243), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011100 + 0o23) + '\x32' + chr(0b110011) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(1444 - 1394) + chr(1381 - 1333), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + '\x31' + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(0b110011) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(49) + '\065' + chr(1716 - 1667), 48196 - 48188), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\065' + '\x37', 15251 - 15243), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\064' + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(7521 - 7410) + chr(0b110011) + chr(50) + chr(1589 - 1541), 0o10), ehT0Px3KOsy9(chr(48) + chr(471 - 360) + '\x31' + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100100 + 0o13) + chr(2262 - 2213) + '\060' + chr(54), 54067 - 54059), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x35' + chr(0b110110), 25761 - 25753), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1100 + 0o45) + chr(2045 - 1996) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11740 - 11629) + chr(0b110011) + chr(50) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(210 - 162) + '\x6f' + chr(0b11010 + 0o31) + chr(49) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110010) + chr(0b110011) + '\061', 8), ehT0Px3KOsy9(chr(1882 - 1834) + '\x6f' + chr(49) + chr(0b11100 + 0o30) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + '\x32' + chr(0b10101 + 0o36), 0b1000), ehT0Px3KOsy9(chr(1371 - 1323) + chr(111) + chr(1759 - 1710) + chr(50) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1306 - 1255) + chr(0b101111 + 0o1) + chr(1519 - 1470), 0o10), ehT0Px3KOsy9(chr(1463 - 1415) + '\x6f' + chr(49) + chr(0b110110), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(726 - 677) + chr(0b110111) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(52) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10011 + 0o40) + '\x35' + chr(0b110010), 29935 - 29927), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\066' + chr(0b110000), 47449 - 47441), ehT0Px3KOsy9(chr(2280 - 2232) + chr(0b100101 + 0o112) + '\061' + chr(0b110110) + chr(0b101110 + 0o7), 20048 - 20040), ehT0Px3KOsy9('\060' + chr(111) + '\063' + '\x35' + chr(0b10 + 0o61), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\061' + '\x36' + '\x35', 8), ehT0Px3KOsy9('\060' + chr(111) + '\x36' + '\065', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\064' + '\063', 23098 - 23090), ehT0Px3KOsy9(chr(48) + chr(5179 - 5068) + chr(0b110010) + chr(52) + chr(0b1 + 0o61), 8), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(2246 - 2197) + chr(48) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\060' + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b100 + 0o153) + chr(0b110001) + chr(0b101001 + 0o11) + chr(0b100000 + 0o24), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1402 - 1351) + chr(0b110000) + chr(48), 0o10), ehT0Px3KOsy9(chr(1942 - 1894) + chr(0b1101111) + '\062' + chr(0b11110 + 0o25) + chr(0b10101 + 0o33), 10267 - 10259), ehT0Px3KOsy9(chr(516 - 468) + '\x6f' + chr(0b110011) + chr(51) + chr(0b10110 + 0o33), 27407 - 27399)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(4434 - 4323) + chr(0b10101 + 0o40) + chr(313 - 265), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x96'), chr(0b1000001 + 0o43) + chr(0b101111 + 0o66) + chr(0b1100010 + 0o1) + chr(111) + chr(0b1100100) + '\145')(chr(117) + chr(0b0 + 0o164) + '\x66' + chr(0b100011 + 0o12) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def MWB0DpQiwB8G(oVre8I6UXc3b, OeWW0F1dBPRQ): zsnSwTonLzpD = oVre8I6UXc3b.slice_hidden(OeWW0F1dBPRQ) fu_DLUnq0Rui = [] xPgmXL9DQrWF = ehT0Px3KOsy9('\x30' + chr(3705 - 3594) + chr(1298 - 1250), ord("\x08")) YpO0BcZ6fMsf = ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + '\060', 8) (fu_DLUnq0Rui, xPgmXL9DQrWF, ZxXIFmtp9xUc, bGSDGpa5hkiT) = oVre8I6UXc3b.embedding_lookup(zsnSwTonLzpD, oVre8I6UXc3b.XCAIkNRdiX0I) if xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\x8d\xec\xd8\xa9\xc2Y\xe06\xd7\xef\x85'), chr(0b1100100) + chr(0b110111 + 0o56) + '\x63' + chr(111) + chr(6084 - 5984) + chr(0b1100101))(chr(117) + chr(8240 - 8124) + '\x66' + chr(0b11010 + 0o23) + chr(0b111000))): xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\xdf\xd3\xc4\xef\xf3i\xae\x03\xc3\xf8\xbb'), '\x64' + chr(4048 - 3947) + chr(99) + chr(0b101100 + 0o103) + '\144' + chr(6279 - 6178))(chr(0b10111 + 0o136) + chr(0b1110100) + chr(0b1000111 + 0o37) + chr(45) + '\x38'))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\x9b\xf2\xd2\xfd\xb0K\xd4(\x8f\xd5\xb9x.\x0e/\xb2\xbc\xf8Anq\xbas'), chr(5823 - 5723) + chr(0b11 + 0o142) + '\143' + chr(111) + chr(0b1100100) + chr(8856 - 8755))(chr(0b1101101 + 0o10) + chr(3377 - 3261) + chr(102) + '\055' + chr(0b100110 + 0o22)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\xdc\xe9\xd3\xd2\xf1]\xaa9\xdf\xc7\xba'), '\144' + '\145' + chr(0b11110 + 0o105) + '\x6f' + chr(100) + '\x65')(chr(117) + '\x74' + chr(102) + chr(878 - 833) + chr(0b10 + 0o66)))(xafqLlk3kkUe(oVre8I6UXc3b.hparams, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x82\xf8\xd3\xec\xf7a\xd1$\x9e\xee\x97'), '\x64' + chr(101) + '\143' + '\x6f' + '\144' + '\x65')(chr(0b1110010 + 0o3) + chr(0b1110100) + chr(1157 - 1055) + chr(45) + chr(1762 - 1706))))) FuqutXPYitL0 = nDgFXrDqtELR.assign_moving_average(oVre8I6UXc3b.ema_count, IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.reshape(fu_DLUnq0Rui, shape=[-ehT0Px3KOsy9(chr(48) + chr(2130 - 2019) + chr(0b110001), ord("\x08")), oVre8I6UXc3b.hparams.azOnMTJc4Vem, oVre8I6UXc3b.hparams.block_v_size]), axis=ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 8)), oVre8I6UXc3b.hparams.decay, zero_debias=ehT0Px3KOsy9(chr(48) + '\157' + chr(835 - 787), 8)) UVJMTi_S70Uf = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(fu_DLUnq0Rui, perm=[ehT0Px3KOsy9(chr(313 - 265) + '\x6f' + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(4241 - 4130) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(0b101001 + 0o7), 8)]), IDJ2eXGCBCDu.transpose(zsnSwTonLzpD, perm=[ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101011 + 0o6), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(48), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + '\062', 8)])) RVkrIbasqS0L = nDgFXrDqtELR.assign_moving_average(oVre8I6UXc3b.ema_means, UVJMTi_S70Uf, oVre8I6UXc3b.hparams.decay, zero_debias=ehT0Px3KOsy9('\060' + '\x6f' + '\060', 8)) m1NkCryOw9Bx = IDJ2eXGCBCDu.reduce_sum(FuqutXPYitL0, axis=-ehT0Px3KOsy9(chr(859 - 811) + '\x6f' + chr(0b1110 + 0o43), 8), keep_dims=ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + '\061', 8)) FuqutXPYitL0 = (FuqutXPYitL0 + oVre8I6UXc3b.hparams.Xtig2zAKpR0T) / (m1NkCryOw9Bx + ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(841 - 791), 8) ** oVre8I6UXc3b.hparams.NSd4iRY6tdp8 * oVre8I6UXc3b.hparams.Xtig2zAKpR0T) * m1NkCryOw9Bx RVkrIbasqS0L = RVkrIbasqS0L / IDJ2eXGCBCDu.expand_dims(FuqutXPYitL0, axis=-ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(400 - 351), 8)) with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x87\xf5\xc8\xe8\xffb\xc6\r\xca\xd2\xb5b"K#\xb4\xa1\xfc\x12'), chr(100) + chr(0b1100101) + chr(99) + '\157' + chr(0b1101 + 0o127) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b100001 + 0o105) + chr(772 - 727) + '\070'))([bGSDGpa5hkiT]): lMKniTbgIhg2 = IDJ2eXGCBCDu.XH9bAgNQ2txV(oVre8I6UXc3b.XCAIkNRdiX0I, RVkrIbasqS0L) with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x87\xf5\xc8\xe8\xffb\xc6\r\xca\xd2\xb5b"K#\xb4\xa1\xfc\x12'), chr(0b1010101 + 0o17) + '\x65' + chr(99) + chr(111) + chr(2755 - 2655) + chr(0b1100101))(chr(117) + chr(4313 - 4197) + chr(0b111011 + 0o53) + chr(0b101101) + '\070'))([lMKniTbgIhg2]): YpO0BcZ6fMsf += oVre8I6UXc3b.hparams.FjcovgoHM1LG * bGSDGpa5hkiT else: YpO0BcZ6fMsf += ZxXIFmtp9xUc + oVre8I6UXc3b.hparams.FjcovgoHM1LG * bGSDGpa5hkiT T8BdHeA1BjOx = IDJ2eXGCBCDu.argmax(fu_DLUnq0Rui, axis=-ehT0Px3KOsy9(chr(48) + chr(598 - 487) + chr(0b110001), 8)) xvzt498SEA6K = ehT0Px3KOsy9(oVre8I6UXc3b.hparams.NSd4iRY6tdp8 // oVre8I6UXc3b.hparams.azOnMTJc4Vem) lb_w7F3T47NC = oVre8I6UXc3b.int_to_bit(T8BdHeA1BjOx, num_bits=xvzt498SEA6K, base=ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + chr(50), 8)) Gl0Qpmt_pcuX = oVre8I6UXc3b.bit_to_int(IDJ2eXGCBCDu.to_int32(lb_w7F3T47NC), num_bits=oVre8I6UXc3b.hparams.NSd4iRY6tdp8, base=ehT0Px3KOsy9(chr(1136 - 1088) + chr(11597 - 11486) + '\x32', 8)) aGtbOvWfCD5N = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ) DhgBIs357LsA = aGtbOvWfCD5N[:-ehT0Px3KOsy9('\060' + '\157' + '\x31', 8)] Gl0Qpmt_pcuX = IDJ2eXGCBCDu.reshape(Gl0Qpmt_pcuX, DhgBIs357LsA) xPgmXL9DQrWF = IDJ2eXGCBCDu.reshape(xPgmXL9DQrWF, shape=aGtbOvWfCD5N) pHCcavHAFrT_ = OeWW0F1dBPRQ + IDJ2eXGCBCDu.stop_gradient(xPgmXL9DQrWF - OeWW0F1dBPRQ) GGNH7JNUgs4j = IDJ2eXGCBCDu.layers.dense(IDJ2eXGCBCDu.nn.relu(pHCcavHAFrT_), oVre8I6UXc3b.hparams.deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\x8b\xf3\x8e'), chr(3144 - 3044) + '\x65' + chr(677 - 578) + '\157' + chr(0b110000 + 0o64) + chr(0b1100101))('\165' + '\164' + '\x66' + chr(45) + chr(0b111000))) MsbwfslwLjRO = IDJ2eXGCBCDu.layers.dense(IDJ2eXGCBCDu.nn.relu(GGNH7JNUgs4j), oVre8I6UXc3b.hparams.qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\x8b\xfd\xd5\xf4'), chr(100) + chr(5944 - 5843) + '\x63' + chr(0b1101111) + chr(6015 - 5915) + '\145')('\x75' + chr(0b1110100) + chr(6715 - 6613) + chr(1632 - 1587) + chr(0b111000))) qk7ql9buv3eD = q_kvx1iNIzrz(oVre8I6UXc3b.embed) return {xafqLlk3kkUe(SXOLrMavuUCe(b'\xdc\x8d\xf5\xcf\xff'), chr(0b1100100) + chr(101) + '\x63' + chr(111) + chr(0b1000001 + 0o43) + chr(101))('\165' + '\x74' + chr(0b1000111 + 0o37) + '\055' + chr(56)): MsbwfslwLjRO, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdc\x81\xe8\xdf\xe8\xf5z\xfc'), chr(100) + '\x65' + '\x63' + chr(0b1101111) + '\x64' + chr(101))(chr(0b1101 + 0o150) + chr(116) + chr(1066 - 964) + chr(0b11111 + 0o16) + '\x38'): Gl0Qpmt_pcuX, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\x87\xe8\xcf'), chr(100) + chr(6258 - 6157) + chr(0b11000 + 0o113) + chr(111) + '\x64' + '\x65')(chr(0b111111 + 0o66) + chr(116) + '\146' + '\055' + chr(0b111000)): YpO0BcZ6fMsf, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\x85\xf9\xd9\xfe'), '\144' + chr(101) + '\x63' + '\157' + '\144' + chr(0b1100101))('\165' + chr(116) + '\146' + '\x2d' + '\x38'): qk7ql9buv3eD}
tensorflow/tensor2tensor
tensor2tensor/models/research/adafactor_experiments.py
mimic_adam_with_adafactor
def mimic_adam_with_adafactor(hparams): """Switch from Adam to Adafactor, approximating the behavior of Adam. Some minor things may be different, like epsilon and beta1 correction. Args: hparams: model hyperparameters where "adam" in hparams.optimizer """ assert "adam" in hparams.optimizer hparams.optimizer = "adafactor" hparams.optimizer_adafactor_beta1 = hparams.optimizer_adam_beta1 hparams.optimizer_adafactor_beta2 = hparams.optimizer_adam_beta2 hparams.optimizer_adafactor_multiply_by_parameter_scale = False hparams.optimizer_adafactor_factored = False hparams.optimizer_adafactor_clipping_threshold = None hparams.optimizer_adafactor_decay_type = "adam"
python
def mimic_adam_with_adafactor(hparams): """Switch from Adam to Adafactor, approximating the behavior of Adam. Some minor things may be different, like epsilon and beta1 correction. Args: hparams: model hyperparameters where "adam" in hparams.optimizer """ assert "adam" in hparams.optimizer hparams.optimizer = "adafactor" hparams.optimizer_adafactor_beta1 = hparams.optimizer_adam_beta1 hparams.optimizer_adafactor_beta2 = hparams.optimizer_adam_beta2 hparams.optimizer_adafactor_multiply_by_parameter_scale = False hparams.optimizer_adafactor_factored = False hparams.optimizer_adafactor_clipping_threshold = None hparams.optimizer_adafactor_decay_type = "adam"
[ "def", "mimic_adam_with_adafactor", "(", "hparams", ")", ":", "assert", "\"adam\"", "in", "hparams", ".", "optimizer", "hparams", ".", "optimizer", "=", "\"adafactor\"", "hparams", ".", "optimizer_adafactor_beta1", "=", "hparams", ".", "optimizer_adam_beta1", "hparams", ".", "optimizer_adafactor_beta2", "=", "hparams", ".", "optimizer_adam_beta2", "hparams", ".", "optimizer_adafactor_multiply_by_parameter_scale", "=", "False", "hparams", ".", "optimizer_adafactor_factored", "=", "False", "hparams", ".", "optimizer_adafactor_clipping_threshold", "=", "None", "hparams", ".", "optimizer_adafactor_decay_type", "=", "\"adam\"" ]
Switch from Adam to Adafactor, approximating the behavior of Adam. Some minor things may be different, like epsilon and beta1 correction. Args: hparams: model hyperparameters where "adam" in hparams.optimizer
[ "Switch", "from", "Adam", "to", "Adafactor", "approximating", "the", "behavior", "of", "Adam", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/adafactor_experiments.py#L27-L42
train
Switch from Adam to Adafactor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcn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ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110101) + chr(0b101100 + 0o6), 0o10), ehT0Px3KOsy9(chr(48) + chr(3941 - 3830) + chr(50) + '\066' + '\064', 55300 - 55292), ehT0Px3KOsy9('\x30' + chr(0b101100 + 0o103) + '\062' + '\065' + chr(0b101110 + 0o3), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000111 + 0o50) + chr(0b110100 + 0o2), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\063' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b1101 + 0o47) + chr(0b101001 + 0o13), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(0b11001 + 0o32) + '\x32' + chr(50), 42270 - 42262), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(0b110010) + chr(294 - 242) + chr(1200 - 1149), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + chr(690 - 640) + '\x34' + '\063', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(51) + chr(55) + chr(1022 - 968), 0b1000), ehT0Px3KOsy9(chr(1969 - 1921) + '\x6f' + chr(0b11100 + 0o25) + chr(0b11000 + 0o35) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1404 - 1356) + chr(9061 - 8950) + '\x32' + chr(1991 - 1940) + chr(54), 0b1000), ehT0Px3KOsy9(chr(923 - 875) + chr(111) + chr(0b110011) + chr(0b10011 + 0o35), 29589 - 29581), ehT0Px3KOsy9(chr(2247 - 2199) + chr(0b1101111) + chr(235 - 186) + '\060' + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110100 + 0o1) + chr(52), 44982 - 44974), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(824 - 770) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + '\061' + chr(54) + chr(55), 56114 - 56106), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b110010), 62474 - 62466), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1100 + 0o46) + '\x32' + chr(0b1010 + 0o51), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(49) + chr(2265 - 2216), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(12002 - 11891) + chr(0b110010) + '\x32' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\x37' + chr(53), 0o10), ehT0Px3KOsy9(chr(689 - 641) + chr(0b111000 + 0o67) + chr(706 - 656) + '\x32' + chr(1829 - 1776), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(5990 - 5879) + chr(0b101001 + 0o11) + '\x33' + chr(1189 - 1141), 32966 - 32958), ehT0Px3KOsy9('\060' + chr(0b100111 + 0o110) + '\062' + chr(0b110010) + chr(0b100010 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(1115 - 1066) + chr(50) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(1334 - 1284) + chr(0b110101) + chr(0b110100), 32568 - 32560), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2328 - 2279) + chr(50), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\065' + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1 + 0o60) + chr(53) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b11 + 0o56) + chr(321 - 270) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1011000 + 0o27) + '\065' + chr(0b1001 + 0o52), 64316 - 64308), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(6711 - 6600) + '\x31' + '\065' + '\x32', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(140 - 88) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100101 + 0o20) + '\x31', 0b1000), ehT0Px3KOsy9(chr(816 - 768) + chr(111) + chr(0b10011 + 0o40) + '\066' + chr(1028 - 980), 0b1000), ehT0Px3KOsy9(chr(992 - 944) + chr(111) + chr(0b110 + 0o57) + '\x31', 8), ehT0Px3KOsy9(chr(1786 - 1738) + chr(7335 - 7224) + '\x34' + chr(0b11 + 0o56), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(5513 - 5402) + '\x32' + '\064' + chr(0b10001 + 0o41), 37297 - 37289)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1236 - 1188) + '\x6f' + '\065' + chr(0b110000), 21109 - 21101)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'D'), '\144' + chr(0b1001011 + 0o32) + '\143' + chr(6369 - 6258) + '\144' + chr(0b11 + 0o142))(chr(117) + '\x74' + '\x66' + chr(0b10110 + 0o27) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def E9Rsp5mQp5FM(n4ljua2gi1Pr): assert xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xd0\xc8k'), '\x64' + '\x65' + chr(99) + '\x6f' + chr(6810 - 6710) + chr(4840 - 4739))(chr(0b1110101 + 0o0) + chr(0b1110100) + chr(0b111111 + 0o47) + '\055' + chr(0b111000)) in xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'2\xd0\xe2H\xba\xbd\x80\xec\xc1B\xb5X'), '\144' + chr(6794 - 6693) + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(732 - 615) + chr(116) + chr(0b11000 + 0o116) + chr(0b11001 + 0o24) + '\070')) n4ljua2gi1Pr.XdKNcYRObPK3 = xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xd0\xc8`\xb8\x87\xa6\xcc\xd1'), '\x64' + chr(1987 - 1886) + chr(99) + '\157' + chr(0b1100100) + chr(8202 - 8101))(chr(117) + chr(0b1110100) + '\x66' + chr(45) + chr(56)) n4ljua2gi1Pr.LWTXhT337eY5 = n4ljua2gi1Pr.GcOjyd7zcDH8 n4ljua2gi1Pr.Ebzl6yQubDBv = n4ljua2gi1Pr.CBOVKNT0M9cG n4ljua2gi1Pr.V_tuBryjPtCp = ehT0Px3KOsy9(chr(2280 - 2232) + chr(0b111110 + 0o61) + chr(48), 0o10) n4ljua2gi1Pr.zAPIctl7dl0x = ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10100 + 0o34), 8) n4ljua2gi1Pr.DaqSGv9iqcWo = None n4ljua2gi1Pr.zMA0jEczhp9y = xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xd0\xc8k'), chr(2273 - 2173) + chr(5316 - 5215) + '\143' + chr(3881 - 3770) + chr(0b1100100) + chr(5541 - 5440))(chr(0b101110 + 0o107) + chr(0b1101101 + 0o7) + chr(0b111011 + 0o53) + '\x2d' + '\070')
tensorflow/tensor2tensor
tensor2tensor/models/research/adafactor_experiments.py
afx_adam
def afx_adam(): """Old version - Adam.""" hparams = transformer.transformer_base_v2() hparams.optimizer_adam_beta1 = 0.9 hparams.optimizer_adam_beta2 = 0.999 hparams.symbol_modality_num_shards = 1 hparams.batch_size = 2048 hparams.optimizer = "adam" hparams.learning_rate_schedule = ( "constant*rsqrt_decay*linear_warmup*rsqrt_hidden_size") hparams.learning_rate_constant = 2.0 return hparams
python
def afx_adam(): """Old version - Adam.""" hparams = transformer.transformer_base_v2() hparams.optimizer_adam_beta1 = 0.9 hparams.optimizer_adam_beta2 = 0.999 hparams.symbol_modality_num_shards = 1 hparams.batch_size = 2048 hparams.optimizer = "adam" hparams.learning_rate_schedule = ( "constant*rsqrt_decay*linear_warmup*rsqrt_hidden_size") hparams.learning_rate_constant = 2.0 return hparams
[ "def", "afx_adam", "(", ")", ":", "hparams", "=", "transformer", ".", "transformer_base_v2", "(", ")", "hparams", ".", "optimizer_adam_beta1", "=", "0.9", "hparams", ".", "optimizer_adam_beta2", "=", "0.999", "hparams", ".", "symbol_modality_num_shards", "=", "1", "hparams", ".", "batch_size", "=", "2048", "hparams", ".", "optimizer", "=", "\"adam\"", "hparams", ".", "learning_rate_schedule", "=", "(", "\"constant*rsqrt_decay*linear_warmup*rsqrt_hidden_size\"", ")", "hparams", ".", "learning_rate_constant", "=", "2.0", "return", "hparams" ]
Old version - Adam.
[ "Old", "version", "-", "Adam", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/adafactor_experiments.py#L46-L57
train
Hparams for Adam.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,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Error,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(737 - 689) + chr(0b10011 + 0o134) + chr(0b100001 + 0o21) + chr(0b11110 + 0o27) + chr(0b100 + 0o55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(231 - 180) + '\x30' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(0b1001 + 0o51) + '\x33' + chr(2634 - 2579), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b110111) + chr(237 - 187), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101 + 0o142) + '\066' + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x34' + chr(0b1 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7434 - 7323) + chr(1296 - 1247) + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101101 + 0o6) + '\062' + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1036 - 986) + '\x34' + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101101 + 0o4) + chr(529 - 476) + chr(1577 - 1528), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(1384 - 1332) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(49) + chr(0b110110) + chr(0b101 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100100 + 0o113) + chr(0b1000 + 0o52) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110010 + 0o2) + chr(0b1100 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + chr(53) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\061' + chr(0b110010 + 0o5), 0o10), ehT0Px3KOsy9(chr(855 - 807) + '\157' + '\x32' + chr(0b100011 + 0o20) + '\x34', 0o10), ehT0Px3KOsy9(chr(1697 - 1649) + chr(111) + chr(49) + '\062' + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8001 - 7890) + '\x32' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001 + 0o1) + chr(48) + chr(2119 - 2070), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(51) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + '\x32' + chr(49) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(1182 - 1134) + '\157' + chr(0b11111 + 0o23) + chr(1923 - 1871) + chr(548 - 494), 0o10), ehT0Px3KOsy9(chr(48) + chr(4942 - 4831) + '\x37' + chr(0b1100 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(411 - 360) + '\064', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b101001 + 0o7) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(0b110011) + chr(0b110110) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1758 - 1709) + chr(1066 - 1014) + chr(52), 15634 - 15626), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2635 - 2583) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(586 - 475) + chr(240 - 186), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1882 - 1771) + '\x32' + '\x33' + '\060', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100101 + 0o14) + chr(0b0 + 0o64) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2525 - 2474) + chr(49) + chr(0b110111), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1110 + 0o51) + chr(791 - 743), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(0b110101) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b100 + 0o153) + '\061' + chr(54) + chr(1222 - 1169), 19019 - 19011), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b11000 + 0o37) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101010 + 0o11) + chr(2374 - 2320) + chr(0b11011 + 0o26), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1031 - 981) + '\067' + '\x36', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + '\x35' + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x87'), '\144' + chr(0b1100101) + '\x63' + chr(0b101001 + 0o106) + chr(100) + '\145')(chr(117) + '\x74' + '\146' + chr(1472 - 1427) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def G5xQ9TU3gBaD(): n4ljua2gi1Pr = Nk9m9eKr4iuF.transformer_base_v2() n4ljua2gi1Pr.GcOjyd7zcDH8 = 0.9 n4ljua2gi1Pr.CBOVKNT0M9cG = 0.999 n4ljua2gi1Pr.iBYlnqUAwgIX = ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10010 + 0o37), ord("\x08")) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(1947 - 1899) + chr(111) + '\x34' + chr(0b1001 + 0o47) + '\x30' + '\060', 0b1000) n4ljua2gi1Pr.XdKNcYRObPK3 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xa4\xfe\x17'), chr(8016 - 7916) + chr(8470 - 8369) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(101))(chr(117) + chr(6300 - 6184) + '\146' + '\055' + chr(0b10101 + 0o43)) n4ljua2gi1Pr.Lz_s7neUzM5V = xafqLlk3kkUe(SXOLrMavuUCe(b'\xca\xaf\xf1\tZUN \xfc\xd0\x1a\x96\x03e<L\xaa\xff3n\xab\xf1\xe6\xc8_=\xb4\xa9\x13Gt\xf5\x12\xbf\x12\x1b\x06\xca\x83\xca\xf6\xa8\xf6\x1eJQN\x0b\xa5\xcb\x13\x82'), '\144' + chr(0b1011001 + 0o14) + '\143' + chr(10522 - 10411) + '\x64' + chr(101))(chr(0b110100 + 0o101) + chr(0b1110100) + '\x66' + '\x2d' + '\x38') n4ljua2gi1Pr.Ot9HUjnkxXA_ = 2.0 return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/research/adafactor_experiments.py
afx_adafactor
def afx_adafactor(): """Adafactor with recommended learning rate schedule.""" hparams = afx_adam() hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay" hparams.learning_rate_warmup_steps = 10000 return hparams
python
def afx_adafactor(): """Adafactor with recommended learning rate schedule.""" hparams = afx_adam() hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay" hparams.learning_rate_warmup_steps = 10000 return hparams
[ "def", "afx_adafactor", "(", ")", ":", "hparams", "=", "afx_adam", "(", ")", "hparams", ".", "optimizer", "=", "\"Adafactor\"", "hparams", ".", "learning_rate_schedule", "=", "\"rsqrt_decay\"", "hparams", ".", "learning_rate_warmup_steps", "=", "10000", "return", "hparams" ]
Adafactor with recommended learning rate schedule.
[ "Adafactor", "with", "recommended", "learning", "rate", "schedule", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/adafactor_experiments.py#L167-L173
train
Adafactor with recommended learning rate schedule.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,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zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110101) + '\x33', 2994 - 2986), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(55) + chr(0b10100 + 0o43), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1103 - 1053) + chr(0b110010) + chr(0b10111 + 0o33), 0o10), ehT0Px3KOsy9(chr(1307 - 1259) + chr(8201 - 8090) + chr(0b1010 + 0o47) + '\066' + chr(0b1101 + 0o46), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110 + 0o151) + '\063' + chr(0b101101 + 0o10), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x35', 8), ehT0Px3KOsy9('\x30' + chr(3735 - 3624) + chr(50) + '\064' + chr(0b0 + 0o62), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b11010 + 0o27) + chr(0b110010) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100111 + 0o10) + chr(0b101001 + 0o12) + chr(0b1110 + 0o51) + '\x37', 36545 - 36537), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(0b11000 + 0o33) + chr(0b110100) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2331 - 2282) + chr(0b110000) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x37' + chr(0b110 + 0o57), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b101111 + 0o6) + '\x31', 0o10), ehT0Px3KOsy9(chr(159 - 111) + '\x6f' + chr(732 - 682) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(199 - 151) + '\x6f' + '\x31' + chr(937 - 883) + '\067', 0o10), ehT0Px3KOsy9(chr(1725 - 1677) + chr(0b1100110 + 0o11) + '\063' + chr(51) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(1104 - 1050) + chr(0b110101), 34249 - 34241), ehT0Px3KOsy9(chr(48) + '\157' + chr(55) + chr(54), 63150 - 63142), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b110100) + chr(48), 54611 - 54603), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(1915 - 1860) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b110010) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(1385 - 1337) + chr(0b1101111) + '\063' + '\067' + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x36' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1011 + 0o54) + chr(210 - 155), 59540 - 59532), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1100 + 0o45) + chr(1835 - 1783) + chr(0b1110 + 0o46), 26846 - 26838), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b1111 + 0o42) + chr(969 - 917), 30613 - 30605), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + '\063' + chr(0b110000) + chr(0b1000 + 0o50), 43408 - 43400), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b11111 + 0o24) + chr(0b110110), 37625 - 37617), ehT0Px3KOsy9('\060' + chr(7144 - 7033) + chr(1464 - 1414) + chr(55) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000 + 0o2) + '\060' + chr(52), 0o10), ehT0Px3KOsy9(chr(1536 - 1488) + chr(0b111011 + 0o64) + chr(0b100110 + 0o13) + '\060' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1288 - 1239) + '\x37' + chr(1895 - 1847), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9730 - 9619) + chr(50) + chr(0b110111) + chr(58 - 4), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b110111) + chr(0b100111 + 0o17), 0o10), ehT0Px3KOsy9(chr(351 - 303) + chr(111) + '\x31' + '\061' + '\x34', 8), ehT0Px3KOsy9('\x30' + chr(0b10101 + 0o132) + '\063' + '\x37' + chr(68 - 18), 8), ehT0Px3KOsy9(chr(954 - 906) + chr(111) + chr(51) + '\060' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b100001 + 0o116) + chr(51) + '\060' + chr(53), 39673 - 39665)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1728 - 1680) + chr(111) + '\x35' + chr(0b101010 + 0o6), 18860 - 18852)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x05'), '\144' + chr(101) + chr(0b1000111 + 0o34) + chr(0b1101111) + '\x64' + chr(0b1100101))('\165' + chr(0b1110100) + chr(102) + '\055' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def _KZefWEpFa5G(): n4ljua2gi1Pr = G5xQ9TU3gBaD() n4ljua2gi1Pr.XdKNcYRObPK3 = xafqLlk3kkUe(SXOLrMavuUCe(b'j\x1b\xf3\x15|~\xd68\x8d'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(111) + '\144' + chr(0b1 + 0o144))(chr(117) + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\070') n4ljua2gi1Pr.Lz_s7neUzM5V = xafqLlk3kkUe(SXOLrMavuUCe(b'Y\x0c\xe3\x01iB\xc62\x9c\x87:'), '\x64' + '\x65' + chr(0b1001011 + 0o30) + chr(0b1001001 + 0o46) + chr(0b1100100) + '\145')('\165' + chr(0b1110100) + '\146' + '\x2d' + '\070') n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + '\x32' + chr(51) + chr(52) + chr(0b110010) + '\060', 0b1000) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/research/adafactor_experiments.py
afx_small
def afx_small(): """Small transformer model with small batch size for fast step times.""" hparams = transformer.transformer_tpu() hparams.filter_size = 1024 hparams.num_heads = 4 hparams.num_hidden_layers = 3 hparams.batch_size = 512 return hparams
python
def afx_small(): """Small transformer model with small batch size for fast step times.""" hparams = transformer.transformer_tpu() hparams.filter_size = 1024 hparams.num_heads = 4 hparams.num_hidden_layers = 3 hparams.batch_size = 512 return hparams
[ "def", "afx_small", "(", ")", ":", "hparams", "=", "transformer", ".", "transformer_tpu", "(", ")", "hparams", ".", "filter_size", "=", "1024", "hparams", ".", "num_heads", "=", "4", "hparams", ".", "num_hidden_layers", "=", "3", "hparams", ".", "batch_size", "=", "512", "return", "hparams" ]
Small transformer model with small batch size for fast step times.
[ "Small", "transformer", "model", "with", "small", "batch", "size", "for", "fast", "step", "times", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/adafactor_experiments.py#L177-L184
train
Small transformer model with small batch size for fast step times.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJ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u4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(1704 - 1593) + chr(51) + chr(0b110011) + '\x34', 58977 - 58969), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000 + 0o3) + chr(0b11011 + 0o30) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(8085 - 7974) + '\x36' + '\067', 0b1000), ehT0Px3KOsy9(chr(1549 - 1501) + '\x6f' + '\x37' + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111111 + 0o60) + chr(0b100 + 0o61) + '\x34', 4298 - 4290), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(51), 7919 - 7911), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\x35' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(2167 - 2119) + chr(8065 - 7954) + chr(0b11010 + 0o27) + chr(0b110000) + chr(481 - 431), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(1321 - 1271) + chr(0b101000 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(0b100101 + 0o16), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101111 + 0o7) + chr(0b100100 + 0o16), 20370 - 20362), ehT0Px3KOsy9(chr(1646 - 1598) + chr(0b1101111) + '\062' + chr(49) + chr(0b100 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(745 - 697) + '\157' + chr(2227 - 2178) + '\065' + chr(0b1010 + 0o55), 20325 - 20317), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(48) + '\061', 16981 - 16973), ehT0Px3KOsy9('\x30' + chr(0b1110 + 0o141) + '\061' + chr(0b110000) + chr(0b10001 + 0o46), 33997 - 33989), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + '\061' + '\061' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\065' + '\x34', 8), ehT0Px3KOsy9(chr(48) + chr(593 - 482) + '\061' + chr(0b110010) + chr(0b110011 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101011 + 0o4) + chr(0b110001) + chr(0b110010) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10316 - 10205) + '\x31' + chr(0b1111 + 0o50) + chr(2682 - 2629), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(1802 - 1750) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10100 + 0o35) + '\067' + chr(55), 5372 - 5364), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(51) + chr(775 - 723), 56388 - 56380), ehT0Px3KOsy9('\060' + chr(7661 - 7550) + '\x36' + chr(0b110100), 39434 - 39426), ehT0Px3KOsy9('\x30' + chr(0b100100 + 0o113) + '\063' + chr(0b101010 + 0o10) + '\x36', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b101111 + 0o6) + '\063', 33568 - 33560), ehT0Px3KOsy9(chr(2065 - 2017) + '\x6f' + chr(0b110010) + '\062' + chr(0b10111 + 0o40), 57320 - 57312), ehT0Px3KOsy9(chr(0b110000) + chr(0b10110 + 0o131) + chr(0b110001) + chr(0b1100 + 0o50) + '\x30', 19084 - 19076), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(413 - 363) + '\x30' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b110001 + 0o1) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(2448 - 2398) + '\062', 48265 - 48257), ehT0Px3KOsy9(chr(48) + chr(0b101110 + 0o101) + chr(1333 - 1282) + chr(52) + chr(0b10110 + 0o35), 33250 - 33242), ehT0Px3KOsy9('\x30' + '\x6f' + chr(642 - 593) + chr(0b100010 + 0o23) + chr(0b110111), 8), ehT0Px3KOsy9(chr(2204 - 2156) + chr(0b1101111) + chr(0b110011) + chr(0b110000) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + '\x31' + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1678 - 1629) + chr(54) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + '\x33' + '\x35' + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x31' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(0b110001) + chr(55) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b110111), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + '\x35' + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2'), chr(0b1100100) + chr(2641 - 2540) + chr(0b1100011) + chr(0b1010110 + 0o31) + '\144' + '\x65')('\x75' + chr(0b1111 + 0o145) + '\x66' + chr(45) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ClkMGFST8SIe(): n4ljua2gi1Pr = Nk9m9eKr4iuF.transformer_tpu() n4ljua2gi1Pr.deybX8NJ0oEI = ehT0Px3KOsy9(chr(48) + chr(0b1 + 0o156) + chr(557 - 507) + '\060' + chr(1128 - 1080) + chr(0b110000), ord("\x08")) n4ljua2gi1Pr.vRVqPOZ1hUG7 = ehT0Px3KOsy9('\060' + '\157' + '\x34', 0b1000) n4ljua2gi1Pr.jZh5_pLUoOoZ = ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + '\x33', 8) n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(77 - 29) + '\x6f' + chr(0b110000 + 0o1) + '\060' + chr(48) + chr(0b10000 + 0o40), ord("\x08")) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/models/video/emily.py
next_frame_emily
def next_frame_emily(): """Emily's model hparams.""" hparams = sv2p_params.next_frame_sv2p() hparams.video_num_input_frames = 2 hparams.video_num_target_frames = 10 hparams.learning_rate_constant = 1e-4 seq_length = hparams.video_num_input_frames + hparams.video_num_target_frames # The latent_loss_multiplier is divided by the number of frames because # the image sequence loss in t2t is averaged instead of added through # time as they do in the SVG-LP paper hparams.latent_loss_multiplier = 1e-4 / seq_length hparams.reward_prediction = False hparams.num_iterations_1st_stage = -1 hparams.num_iterations_2nd_stage = -1 hparams.optimizer_adam_beta1 = 0.9 hparams.optimizer_adam_beta2 = 0.999 hparams.optimizer_adam_epsilon = 1e-08 hparams.anneal_end = -1 hparams.clip_grad_norm = 5.0 hparams.add_hparam("learned_prior", True) hparams.add_hparam("z_dim", 64) hparams.add_hparam("g_dim", 128) hparams.add_hparam("rnn_size", 256) hparams.add_hparam("prior_rnn_layers", 1) hparams.add_hparam("posterior_rnn_layers", 1) hparams.add_hparam("predictor_rnn_layers", 2) hparams.add_hparam("has_skips", True) hparams.add_hparam("has_batchnorm", True) return hparams
python
def next_frame_emily(): """Emily's model hparams.""" hparams = sv2p_params.next_frame_sv2p() hparams.video_num_input_frames = 2 hparams.video_num_target_frames = 10 hparams.learning_rate_constant = 1e-4 seq_length = hparams.video_num_input_frames + hparams.video_num_target_frames # The latent_loss_multiplier is divided by the number of frames because # the image sequence loss in t2t is averaged instead of added through # time as they do in the SVG-LP paper hparams.latent_loss_multiplier = 1e-4 / seq_length hparams.reward_prediction = False hparams.num_iterations_1st_stage = -1 hparams.num_iterations_2nd_stage = -1 hparams.optimizer_adam_beta1 = 0.9 hparams.optimizer_adam_beta2 = 0.999 hparams.optimizer_adam_epsilon = 1e-08 hparams.anneal_end = -1 hparams.clip_grad_norm = 5.0 hparams.add_hparam("learned_prior", True) hparams.add_hparam("z_dim", 64) hparams.add_hparam("g_dim", 128) hparams.add_hparam("rnn_size", 256) hparams.add_hparam("prior_rnn_layers", 1) hparams.add_hparam("posterior_rnn_layers", 1) hparams.add_hparam("predictor_rnn_layers", 2) hparams.add_hparam("has_skips", True) hparams.add_hparam("has_batchnorm", True) return hparams
[ "def", "next_frame_emily", "(", ")", ":", "hparams", "=", "sv2p_params", ".", "next_frame_sv2p", "(", ")", "hparams", ".", "video_num_input_frames", "=", "2", "hparams", ".", "video_num_target_frames", "=", "10", "hparams", ".", "learning_rate_constant", "=", "1e-4", "seq_length", "=", "hparams", ".", "video_num_input_frames", "+", "hparams", ".", "video_num_target_frames", "# The latent_loss_multiplier is divided by the number of frames because", "# the image sequence loss in t2t is averaged instead of added through", "# time as they do in the SVG-LP paper", "hparams", ".", "latent_loss_multiplier", "=", "1e-4", "/", "seq_length", "hparams", ".", "reward_prediction", "=", "False", "hparams", ".", "num_iterations_1st_stage", "=", "-", "1", "hparams", ".", "num_iterations_2nd_stage", "=", "-", "1", "hparams", ".", "optimizer_adam_beta1", "=", "0.9", "hparams", ".", "optimizer_adam_beta2", "=", "0.999", "hparams", ".", "optimizer_adam_epsilon", "=", "1e-08", "hparams", ".", "anneal_end", "=", "-", "1", "hparams", ".", "clip_grad_norm", "=", "5.0", "hparams", ".", "add_hparam", "(", "\"learned_prior\"", ",", "True", ")", "hparams", ".", "add_hparam", "(", "\"z_dim\"", ",", "64", ")", "hparams", ".", "add_hparam", "(", "\"g_dim\"", ",", "128", ")", "hparams", ".", "add_hparam", "(", "\"rnn_size\"", ",", "256", ")", "hparams", ".", "add_hparam", "(", "\"prior_rnn_layers\"", ",", "1", ")", "hparams", ".", "add_hparam", "(", "\"posterior_rnn_layers\"", ",", "1", ")", "hparams", ".", "add_hparam", "(", "\"predictor_rnn_layers\"", ",", "2", ")", "hparams", ".", "add_hparam", "(", "\"has_skips\"", ",", "True", ")", "hparams", ".", "add_hparam", "(", "\"has_batchnorm\"", ",", "True", ")", "return", "hparams" ]
Emily's model hparams.
[ "Emily", "s", "model", "hparams", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/emily.py#L447-L475
train
Emily s model hparams.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdT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C8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(9821 - 9710) + '\x33' + '\061' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(3194 - 3083) + chr(0b110010) + '\064' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(478 - 430) + chr(0b110111 + 0o70) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1756 - 1708) + chr(0b1101111) + chr(1286 - 1236) + chr(1638 - 1584) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(50) + '\063' + '\062', 45809 - 45801), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(52) + '\061', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(55) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b11011 + 0o30) + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(48) + chr(2392 - 2340), 0b1000), ehT0Px3KOsy9('\060' + chr(11011 - 10900) + '\x33' + '\x31' + chr(51), 55551 - 55543), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + chr(2076 - 2026) + '\x33' + chr(0b1000 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(0b100100 + 0o15) + '\x37' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(49) + chr(0b1101 + 0o52) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100010 + 0o115) + '\x33' + '\064' + chr(0b101101 + 0o10), 0b1000), ehT0Px3KOsy9('\060' + chr(3556 - 3445) + chr(513 - 464) + chr(1732 - 1680) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1584 - 1536) + chr(339 - 228) + chr(50) + chr(55) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1021 - 971) + chr(50) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1046 - 997) + chr(0b110001) + chr(0b101110 + 0o6), 54678 - 54670), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\x36' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b110000) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(5628 - 5517) + chr(0b110001) + chr(0b110001) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(9131 - 9020) + chr(0b110100) + chr(0b11101 + 0o24), 0b1000), ehT0Px3KOsy9(chr(666 - 618) + chr(0b1011110 + 0o21) + '\x31' + '\067', 20903 - 20895), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110 + 0o54) + chr(55) + chr(1951 - 1898), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(1791 - 1743) + chr(1466 - 1416), 41503 - 41495), ehT0Px3KOsy9(chr(1086 - 1038) + chr(0b1101111) + chr(0b110001) + chr(641 - 588) + chr(2125 - 2070), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(12093 - 11982) + chr(762 - 713) + chr(0b100010 + 0o23) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101111 + 0o2) + chr(0b110111) + chr(0b110000 + 0o0), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(2086 - 2035) + chr(0b110 + 0o57) + '\064', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + '\061' + chr(0b110010 + 0o2) + chr(0b110010 + 0o0), 5706 - 5698), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(1213 - 1163) + chr(1661 - 1608) + chr(927 - 873), ord("\x08")), ehT0Px3KOsy9(chr(1077 - 1029) + chr(0b1011110 + 0o21) + chr(0b11000 + 0o32) + chr(0b11011 + 0o34) + chr(0b110000), 8), ehT0Px3KOsy9(chr(67 - 19) + chr(111) + chr(0b11100 + 0o26) + chr(0b110011) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x35' + '\060', 48549 - 48541), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010 + 0o0) + chr(0b110011) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b110000) + chr(52), 8), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + '\062' + chr(0b1 + 0o66) + '\x30', 8), ehT0Px3KOsy9(chr(1494 - 1446) + chr(0b1101111) + '\062' + chr(1434 - 1386) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(865 - 813) + chr(2382 - 2331), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b10000 + 0o43) + chr(1814 - 1765), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(53) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7'), chr(8360 - 8260) + '\145' + '\143' + '\157' + chr(0b101 + 0o137) + chr(0b1001000 + 0o35))(chr(0b1101101 + 0o10) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def CD60QJrfwM0S(): n4ljua2gi1Pr = Jz7IrSV0twHL.next_frame_sv2p() n4ljua2gi1Pr.UUXW9NWPZxPI = ehT0Px3KOsy9(chr(1410 - 1362) + chr(111) + chr(0b110010), 0b1000) n4ljua2gi1Pr.UxYiT0ZFW2SZ = ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10 + 0o57) + '\x32', 23753 - 23745) n4ljua2gi1Pr.Ot9HUjnkxXA_ = 0.0001 CYaOb62BkM2_ = n4ljua2gi1Pr.UUXW9NWPZxPI + n4ljua2gi1Pr.UxYiT0ZFW2SZ n4ljua2gi1Pr.ghYtMDjOY9WM = 0.0001 / CYaOb62BkM2_ n4ljua2gi1Pr.cZj9Gx_3biG9 = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(48), 0b1000) n4ljua2gi1Pr.iY_4zqKBVzZD = -ehT0Px3KOsy9(chr(1639 - 1591) + chr(4289 - 4178) + chr(49), ord("\x08")) n4ljua2gi1Pr.m_GDJNzMRp6_ = -ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8) n4ljua2gi1Pr.GcOjyd7zcDH8 = 0.9 n4ljua2gi1Pr.CBOVKNT0M9cG = 0.999 n4ljua2gi1Pr.o17O_bIptWdl = 1e-08 n4ljua2gi1Pr.LVO61cwcBk9E = -ehT0Px3KOsy9(chr(340 - 292) + '\x6f' + chr(0b10100 + 0o35), 8) n4ljua2gi1Pr.SdNSZNVkVjLh = 5.0 xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), chr(7695 - 7595) + chr(0b1100101) + '\x63' + '\x6f' + chr(100) + chr(101))(chr(0b100 + 0o161) + '\164' + chr(102) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5\xc6d\xc3\xf4\x04^\x83\xf4\xb9\xf6\x11\x08'), chr(511 - 411) + chr(6643 - 6542) + '\x63' + chr(0b111111 + 0o60) + chr(639 - 539) + '\145')(chr(3210 - 3093) + chr(0b1010100 + 0o40) + chr(0b1100110) + '\x2d' + chr(447 - 391)), ehT0Px3KOsy9('\x30' + chr(1883 - 1772) + chr(49), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), chr(5571 - 5471) + '\x65' + '\x63' + chr(2866 - 2755) + chr(100) + '\145')(chr(13371 - 13254) + chr(4703 - 4587) + '\x66' + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3\xfca\xd8\xf7'), chr(0b1100100) + chr(0b1000100 + 0o41) + chr(0b1100011) + chr(4024 - 3913) + chr(6406 - 6306) + '\145')('\x75' + chr(116) + chr(0b110000 + 0o66) + '\x2d' + '\x38'), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\x30' + chr(0b110000), 0o10)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), '\144' + chr(0b1010011 + 0o22) + chr(99) + chr(0b1101010 + 0o5) + '\144' + chr(101))(chr(117) + '\x74' + '\146' + '\055' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xae\xfca\xd8\xf7'), chr(3592 - 3492) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(9720 - 9619))('\165' + chr(116) + chr(102) + chr(0b1011 + 0o42) + chr(0b111000)), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1001 + 0o51) + '\060' + chr(831 - 783), ord("\x08"))) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), '\x64' + chr(101) + chr(0b1001101 + 0o26) + '\157' + chr(370 - 270) + chr(101))(chr(117) + chr(0b1110100) + chr(7564 - 7462) + '\055' + chr(0b0 + 0o70)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb\xcdk\xee\xe9\x08@\xb9'), chr(969 - 869) + '\145' + chr(99) + chr(0b1101111) + '\144' + '\x65')(chr(0b1010011 + 0o42) + chr(10992 - 10876) + chr(0b1010001 + 0o25) + '\x2d' + '\070'), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(52) + chr(0b100010 + 0o16) + chr(881 - 833), 41937 - 41929)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), chr(5971 - 5871) + '\145' + chr(99) + chr(111) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b101 + 0o157) + '\x66' + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xd1l\xde\xe8>H\xb2\xea\x94\xf3\x1f\x03\x80\x17\xcb'), chr(4456 - 4356) + '\x65' + chr(1240 - 1141) + chr(111) + chr(0b1001000 + 0o34) + chr(1343 - 1242))(chr(117) + chr(0b1000001 + 0o63) + chr(102) + '\x2d' + chr(1683 - 1627)), ehT0Px3KOsy9(chr(1145 - 1097) + '\157' + chr(1119 - 1070), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), '\144' + chr(0b111011 + 0o52) + chr(99) + '\x6f' + '\144' + '\145')(chr(0b100001 + 0o124) + chr(0b1110100) + chr(102) + '\055' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xccv\xc5\xff\x13S\xb3\xf6\x94\xed\x10\x14\xba\t\xd9\xe8)\x05\xb4'), chr(0b1010000 + 0o24) + chr(8668 - 8567) + chr(0b1100011) + chr(0b1001001 + 0o46) + '\144' + chr(4829 - 4728))(chr(0b1110101) + chr(0b1011101 + 0o27) + '\x66' + chr(0b101101) + chr(0b111000)), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), chr(1303 - 1203) + chr(8814 - 8713) + '\x63' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(1112 - 995) + '\x74' + '\x66' + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xd1`\xd5\xf3\x02N\xb3\xf6\x94\xed\x10\x14\xba\t\xd9\xe8)\x05\xb4'), chr(100) + chr(101) + '\143' + chr(0b1101111) + '\x64' + chr(0b100 + 0o141))('\165' + '\164' + '\x66' + chr(994 - 949) + chr(56)), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000 + 0o2), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), chr(0b1000000 + 0o44) + chr(101) + '\x63' + '\x6f' + chr(100) + '\x65')(chr(12156 - 12039) + chr(0b1110100) + chr(2669 - 2567) + '\055' + chr(2447 - 2391)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1\xc2v\xee\xe9\nS\xac\xf7'), '\144' + chr(0b111111 + 0o46) + '\143' + chr(0b1101111) + chr(0b1100100) + '\145')('\x75' + '\x74' + chr(0b1010110 + 0o20) + chr(1239 - 1194) + '\x38'), ehT0Px3KOsy9(chr(392 - 344) + '\x6f' + chr(0b110001), 8)) xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8\xc7a\xee\xf2\x11[\xae\xe5\xa6'), chr(0b1100100) + chr(5978 - 5877) + chr(427 - 328) + chr(111) + '\x64' + chr(0b11001 + 0o114))(chr(0b100111 + 0o116) + chr(0b1101 + 0o147) + '\x66' + chr(1844 - 1799) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1\xc2v\xee\xf8\x00N\xbf\xec\xa5\xf0\x0c\x17'), chr(0b11 + 0o141) + chr(0b110010 + 0o63) + '\143' + chr(0b1000001 + 0o56) + chr(5863 - 5763) + chr(101))(chr(0b1110101) + chr(0b110100 + 0o100) + chr(0b1100110) + chr(45) + chr(0b111000)), ehT0Px3KOsy9('\x30' + '\157' + chr(1698 - 1649), 8)) return n4ljua2gi1Pr
tensorflow/tensor2tensor
tensor2tensor/data_generators/inspect_tfrecord.py
main
def main(_): """Convert a file to examples.""" if FLAGS.subword_text_encoder_filename: encoder = text_encoder.SubwordTextEncoder( FLAGS.subword_text_encoder_filename) elif FLAGS.token_text_encoder_filename: encoder = text_encoder.TokenTextEncoder(FLAGS.token_text_encoder_filename) elif FLAGS.byte_text_encoder: encoder = text_encoder.ByteTextEncoder() else: encoder = None reader = tf.python_io.tf_record_iterator(FLAGS.input_filename) total_sequences = 0 total_input_tokens = 0 total_target_tokens = 0 nonpadding_input_tokens = 0 nonpadding_target_tokens = 0 max_input_length = 0 max_target_length = 0 for record in reader: x = tf.train.Example() x.ParseFromString(record) inputs = [int(i) for i in x.features.feature["inputs"].int64_list.value] targets = [int(i) for i in x.features.feature["targets"].int64_list.value] if FLAGS.print_inputs: print("INPUTS:\n" + encoder.decode(inputs) if encoder else inputs) if FLAGS.print_targets: print("TARGETS:\n" + encoder.decode(targets) if encoder else targets) nonpadding_input_tokens += len(inputs) - inputs.count(0) nonpadding_target_tokens += len(targets) - targets.count(0) total_input_tokens += len(inputs) total_target_tokens += len(targets) total_sequences += 1 max_input_length = max(max_input_length, len(inputs)) max_target_length = max(max_target_length, len(targets)) if FLAGS.print_all: for k, v in six.iteritems(x.features.feature): print("%s: %s" % (k, v.int64_list.value)) print("total_sequences: %d" % total_sequences) print("total_input_tokens: %d" % total_input_tokens) print("total_target_tokens: %d" % total_target_tokens) print("nonpadding_input_tokens: %d" % nonpadding_input_tokens) print("nonpadding_target_tokens: %d" % nonpadding_target_tokens) print("max_input_length: %d" % max_input_length) print("max_target_length: %d" % max_target_length)
python
def main(_): """Convert a file to examples.""" if FLAGS.subword_text_encoder_filename: encoder = text_encoder.SubwordTextEncoder( FLAGS.subword_text_encoder_filename) elif FLAGS.token_text_encoder_filename: encoder = text_encoder.TokenTextEncoder(FLAGS.token_text_encoder_filename) elif FLAGS.byte_text_encoder: encoder = text_encoder.ByteTextEncoder() else: encoder = None reader = tf.python_io.tf_record_iterator(FLAGS.input_filename) total_sequences = 0 total_input_tokens = 0 total_target_tokens = 0 nonpadding_input_tokens = 0 nonpadding_target_tokens = 0 max_input_length = 0 max_target_length = 0 for record in reader: x = tf.train.Example() x.ParseFromString(record) inputs = [int(i) for i in x.features.feature["inputs"].int64_list.value] targets = [int(i) for i in x.features.feature["targets"].int64_list.value] if FLAGS.print_inputs: print("INPUTS:\n" + encoder.decode(inputs) if encoder else inputs) if FLAGS.print_targets: print("TARGETS:\n" + encoder.decode(targets) if encoder else targets) nonpadding_input_tokens += len(inputs) - inputs.count(0) nonpadding_target_tokens += len(targets) - targets.count(0) total_input_tokens += len(inputs) total_target_tokens += len(targets) total_sequences += 1 max_input_length = max(max_input_length, len(inputs)) max_target_length = max(max_target_length, len(targets)) if FLAGS.print_all: for k, v in six.iteritems(x.features.feature): print("%s: %s" % (k, v.int64_list.value)) print("total_sequences: %d" % total_sequences) print("total_input_tokens: %d" % total_input_tokens) print("total_target_tokens: %d" % total_target_tokens) print("nonpadding_input_tokens: %d" % nonpadding_input_tokens) print("nonpadding_target_tokens: %d" % nonpadding_target_tokens) print("max_input_length: %d" % max_input_length) print("max_target_length: %d" % max_target_length)
[ "def", "main", "(", "_", ")", ":", "if", "FLAGS", ".", "subword_text_encoder_filename", ":", "encoder", "=", "text_encoder", ".", "SubwordTextEncoder", "(", "FLAGS", ".", "subword_text_encoder_filename", ")", "elif", "FLAGS", ".", "token_text_encoder_filename", ":", "encoder", "=", "text_encoder", ".", "TokenTextEncoder", "(", "FLAGS", ".", "token_text_encoder_filename", ")", "elif", "FLAGS", ".", "byte_text_encoder", ":", "encoder", "=", "text_encoder", ".", "ByteTextEncoder", "(", ")", "else", ":", "encoder", "=", "None", "reader", "=", "tf", ".", "python_io", ".", "tf_record_iterator", "(", "FLAGS", ".", "input_filename", ")", "total_sequences", "=", "0", "total_input_tokens", "=", "0", "total_target_tokens", "=", "0", "nonpadding_input_tokens", "=", "0", "nonpadding_target_tokens", "=", "0", "max_input_length", "=", "0", "max_target_length", "=", "0", "for", "record", "in", "reader", ":", "x", "=", "tf", ".", "train", ".", "Example", "(", ")", "x", ".", "ParseFromString", "(", "record", ")", "inputs", "=", "[", "int", "(", "i", ")", "for", "i", "in", "x", ".", "features", ".", "feature", "[", "\"inputs\"", "]", ".", "int64_list", ".", "value", "]", "targets", "=", "[", "int", "(", "i", ")", "for", "i", "in", "x", ".", "features", ".", "feature", "[", "\"targets\"", "]", ".", "int64_list", ".", "value", "]", "if", "FLAGS", ".", "print_inputs", ":", "print", "(", "\"INPUTS:\\n\"", "+", "encoder", ".", "decode", "(", "inputs", ")", "if", "encoder", "else", "inputs", ")", "if", "FLAGS", ".", "print_targets", ":", "print", "(", "\"TARGETS:\\n\"", "+", "encoder", ".", "decode", "(", "targets", ")", "if", "encoder", "else", "targets", ")", "nonpadding_input_tokens", "+=", "len", "(", "inputs", ")", "-", "inputs", ".", "count", "(", "0", ")", "nonpadding_target_tokens", "+=", "len", "(", "targets", ")", "-", "targets", ".", "count", "(", "0", ")", "total_input_tokens", "+=", "len", "(", "inputs", ")", "total_target_tokens", "+=", "len", "(", "targets", ")", "total_sequences", "+=", "1", "max_input_length", "=", "max", "(", "max_input_length", ",", "len", "(", "inputs", ")", ")", "max_target_length", "=", "max", "(", "max_target_length", ",", "len", "(", "targets", ")", ")", "if", "FLAGS", ".", "print_all", ":", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "x", ".", "features", ".", "feature", ")", ":", "print", "(", "\"%s: %s\"", "%", "(", "k", ",", "v", ".", "int64_list", ".", "value", ")", ")", "print", "(", "\"total_sequences: %d\"", "%", "total_sequences", ")", "print", "(", "\"total_input_tokens: %d\"", "%", "total_input_tokens", ")", "print", "(", "\"total_target_tokens: %d\"", "%", "total_target_tokens", ")", "print", "(", "\"nonpadding_input_tokens: %d\"", "%", "nonpadding_input_tokens", ")", "print", "(", "\"nonpadding_target_tokens: %d\"", "%", "nonpadding_target_tokens", ")", "print", "(", "\"max_input_length: %d\"", "%", "max_input_length", ")", "print", "(", "\"max_target_length: %d\"", "%", "max_target_length", ")" ]
Convert a file to examples.
[ "Convert", "a", "file", "to", "examples", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/inspect_tfrecord.py#L48-L93
train
Convert a file to examples.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BM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kSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(53) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + '\063' + '\064' + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\x34' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2425 - 2374) + chr(0b10101 + 0o42) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(3774 - 3663) + '\066' + chr(1529 - 1476), 0o10), ehT0Px3KOsy9(chr(1010 - 962) + chr(0b1101111) + chr(0b11000 + 0o32) + '\x32' + '\067', 47931 - 47923), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(0b11010 + 0o33) + chr(0b110101), 34651 - 34643), ehT0Px3KOsy9('\060' + chr(111) + chr(1733 - 1683) + chr(0b110001 + 0o1) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(694 - 646) + '\157' + chr(49) + chr(51) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4421 - 4310) + '\062' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010011 + 0o34) + '\x32' + chr(52) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(78 - 27) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4685 - 4574) + '\x31' + '\x34' + chr(48), 2089 - 2081), ehT0Px3KOsy9(chr(48) + chr(10003 - 9892) + chr(0b110011) + chr(50) + chr(0b100101 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(1020 - 972) + chr(111) + '\061' + '\x31' + chr(388 - 337), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(0b110101) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(1366 - 1316) + chr(0b11000 + 0o33) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1963 - 1915) + '\x6f' + chr(1167 - 1117) + chr(55) + chr(0b110011), 18268 - 18260), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + chr(0b1000 + 0o51) + chr(0b10111 + 0o40) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(940 - 892) + '\x6f' + chr(0b100001 + 0o21) + '\063' + chr(2614 - 2562), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b110100) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(1737 - 1626) + chr(0b110010) + '\066' + chr(2502 - 2450), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3495 - 3384) + chr(1303 - 1253) + chr(0b100011 + 0o20) + '\x33', 0b1000), ehT0Px3KOsy9(chr(978 - 930) + chr(0b1101111) + chr(1812 - 1761) + chr(0b110000 + 0o3) + chr(2022 - 1970), 4195 - 4187), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110111) + chr(0b110011 + 0o4), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(0b100111 + 0o12) + chr(49) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + chr(826 - 777) + chr(52) + chr(0b101000 + 0o17), 8340 - 8332), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110 + 0o55) + chr(0b10100 + 0o34) + chr(1686 - 1635), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1011 + 0o50) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(55) + '\065', 0b1000), ehT0Px3KOsy9(chr(1607 - 1559) + chr(0b1101110 + 0o1) + chr(0b110101) + chr(0b110100), 36048 - 36040), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(0b101 + 0o55) + '\x34' + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + chr(2754 - 2643) + '\x33' + '\x34' + chr(991 - 938), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(76 - 23) + chr(103 - 53), 53526 - 53518), ehT0Px3KOsy9(chr(0b110000) + chr(4587 - 4476) + chr(0b110100) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(2918 - 2807) + chr(0b110001) + '\063' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b100110 + 0o111) + '\061' + chr(55) + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + '\063' + '\065' + '\065', 46246 - 46238), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1429 - 1381), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + chr(0b110011) + chr(500 - 447) + chr(0b1011 + 0o46), 64478 - 64470)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(0b110101) + chr(0b101011 + 0o5), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6'), '\144' + chr(4176 - 4075) + chr(99) + '\157' + chr(0b1011010 + 0o12) + chr(101))(chr(414 - 297) + chr(0b1100111 + 0o15) + chr(0b1100110) + '\x2d' + chr(0b110 + 0o62)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def PGNrezus7XpS(VNGQdHSFPrso): if xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b"\x9b\x93\xc3\x8bZ\xe5\xc9\xcb+p\xdd\xeb?\xb3%L\xf3\xdf\x19\xee?\xd2\xf2\xb0\x9a'\x06\xae{"), '\x64' + '\x65' + chr(0b10000 + 0o123) + chr(0b1101001 + 0o6) + chr(0b1010010 + 0o22) + '\x65')(chr(12707 - 12590) + '\x74' + chr(5008 - 4906) + chr(45) + chr(688 - 632))): hoK3K1TwFlkr = nCRDzZ_Is9fz.SubwordTextEncoder(vUTZFbqN0o8F.subword_text_encoder_filename) elif xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b"\x9c\x89\xca\x99[\xc8\xd9\xf1'a\xfa\xfa\x0e\xb5$K\xf9\xc9#\xfa\t\xd8\xfe\xb2\x9e$\x02"), chr(0b1100100) + chr(2685 - 2584) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(3827 - 3726))('\165' + '\164' + chr(0b110010 + 0o64) + '\x2d' + chr(56))): hoK3K1TwFlkr = nCRDzZ_Is9fz.TokenTextEncoder(vUTZFbqN0o8F.token_text_encoder_filename) elif xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a\x9f\xd5\x99j\xe3\xc8\xec+J\xc0\xf1\x03\xb9/J\xee'), chr(100) + chr(6466 - 6365) + '\x63' + chr(10982 - 10871) + chr(0b1001110 + 0o26) + '\145')(chr(0b1110101) + '\164' + chr(0b1001101 + 0o31) + '\x2d' + chr(999 - 943))): hoK3K1TwFlkr = nCRDzZ_Is9fz.ByteTextEncoder() else: hoK3K1TwFlkr = None Yt95jqiXKpBv = IDJ2eXGCBCDu.python_io.tf_record_iterator(vUTZFbqN0o8F.input_filename) mLr90LDTsXtO = ehT0Px3KOsy9(chr(48) + chr(787 - 676) + '\x30', ord("\x08")) ZmNhmdT1DVYA = ehT0Px3KOsy9('\x30' + '\x6f' + chr(1055 - 1007), 8) yeWjmyuNInD3 = ehT0Px3KOsy9(chr(48) + chr(111) + '\060', 8) McCbqhhu0phe = ehT0Px3KOsy9(chr(1121 - 1073) + '\157' + chr(1222 - 1174), 8) zIq2OSpfiWYv = ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + chr(0b10000 + 0o40), 8) hX_7BMNobORJ = ehT0Px3KOsy9(chr(48) + chr(6744 - 6633) + chr(48), 8) _93hATE4geR3 = ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + '\x30', 8) for SIWbn6wzltxD in Yt95jqiXKpBv: OeWW0F1dBPRQ = IDJ2eXGCBCDu.train.Example() xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8\x87\xd3\x8fP\xd1\xdf\xfb2F\xd1\xed\t\xb8,'), chr(100) + '\145' + chr(0b10100 + 0o117) + chr(111) + chr(0b1100100) + '\x65')('\165' + chr(0b101101 + 0o107) + chr(102) + '\x2d' + '\070'))(SIWbn6wzltxD) vXoupepMtCXU = [ehT0Px3KOsy9(WVxHKyX45z_L) for WVxHKyX45z_L in OeWW0F1dBPRQ.features.feature[xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\x88\xd1\x89A\xe4'), '\x64' + '\145' + chr(0b10110 + 0o115) + '\x6f' + chr(0b1010110 + 0o16) + '\x65')('\165' + chr(116) + chr(0b1100110) + chr(45) + chr(0b111000))].int64_list.QmmgWUB13VCJ] xIEmRseySp3z = [ehT0Px3KOsy9(WVxHKyX45z_L) for WVxHKyX45z_L in OeWW0F1dBPRQ.features.feature[xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x87\xd3\x9bP\xe3\xde'), chr(0b1100100) + chr(0b111 + 0o136) + '\143' + chr(0b1000111 + 0o50) + chr(100) + chr(0b1000010 + 0o43))(chr(117) + chr(0b11 + 0o161) + '\146' + chr(1432 - 1387) + '\070')].int64_list.QmmgWUB13VCJ] if xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x94\xc8\x92A\xc8\xc4\xfa/`\xd1\xec'), chr(100) + chr(101) + chr(7711 - 7612) + chr(0b1101111) + chr(0b11011 + 0o111) + '\x65')('\165' + chr(0b1110100) + chr(102) + chr(45) + chr(1074 - 1018))): zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1\xa8\xf1\xa9a\xc4\x97\x9e'), '\x64' + '\x65' + chr(0b1100011) + '\157' + chr(9318 - 9218) + '\145')(chr(0b1110101) + chr(0b1001010 + 0o52) + chr(0b1010000 + 0o26) + chr(45) + chr(382 - 326)) + xafqLlk3kkUe(hoK3K1TwFlkr, '\144' + chr(7254 - 7153) + chr(99) + chr(5233 - 5122) + chr(6449 - 6349) + chr(8021 - 7920))(vXoupepMtCXU) if hoK3K1TwFlkr else vXoupepMtCXU) if xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x94\xc8\x92A\xc8\xd9\xf5-r\xc0\xeb\x13'), '\144' + chr(101) + chr(0b111 + 0o134) + chr(8018 - 7907) + chr(100) + chr(101))(chr(11859 - 11742) + chr(116) + '\146' + chr(45) + chr(3061 - 3005))): zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc\xa7\xf3\xbbp\xc3\xfe\xaeU'), chr(0b1000000 + 0o44) + '\145' + '\143' + chr(4867 - 4756) + chr(0b1010001 + 0o23) + chr(5907 - 5806))('\165' + '\164' + chr(102) + chr(0b101101) + chr(0b110010 + 0o6)) + xafqLlk3kkUe(hoK3K1TwFlkr, chr(0b110101 + 0o57) + chr(0b11010 + 0o113) + '\x63' + '\x6f' + chr(555 - 455) + chr(0b1011110 + 0o7))(xIEmRseySp3z) if hoK3K1TwFlkr else xIEmRseySp3z) McCbqhhu0phe += c2A0yzQpDQB3(vXoupepMtCXU) - vXoupepMtCXU.ualWdDeXJEGO(ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x30', 8)) zIq2OSpfiWYv += c2A0yzQpDQB3(xIEmRseySp3z) - xIEmRseySp3z.ualWdDeXJEGO(ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + chr(0b110000), 8)) ZmNhmdT1DVYA += c2A0yzQpDQB3(vXoupepMtCXU) yeWjmyuNInD3 += c2A0yzQpDQB3(xIEmRseySp3z) mLr90LDTsXtO += ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(610 - 561), 6353 - 6345) hX_7BMNobORJ = tsdjvlgh9gDP(hX_7BMNobORJ, c2A0yzQpDQB3(vXoupepMtCXU)) _93hATE4geR3 = tsdjvlgh9gDP(_93hATE4geR3, c2A0yzQpDQB3(xIEmRseySp3z)) if xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\x94\xc8\x92A\xc8\xcc\xf83'), '\x64' + chr(0b1010001 + 0o24) + chr(99) + chr(0b1101111) + '\144' + '\145')(chr(9600 - 9483) + chr(0b100010 + 0o122) + chr(5658 - 5556) + chr(45) + chr(0b111000))): for (OolUPRJhRaJd, cMbll0QYhULo) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\x92\xc4\x8e\\\xe3\xc8\xf9,'), '\x64' + chr(0b11001 + 0o114) + '\143' + chr(111) + '\144' + '\145')('\165' + '\164' + '\146' + '\x2d' + '\070'))(xafqLlk3kkUe(OeWW0F1dBPRQ.features, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e\x83\xc0\x88@\xe5\xc8'), chr(582 - 482) + '\x65' + chr(1283 - 1184) + '\157' + chr(0b1100100) + '\145')(chr(3685 - 3568) + chr(0b1110100) + chr(102) + chr(0b101101) + chr(0b1101 + 0o53)))): zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcd\x95\x9b\xdc\x10\xe4'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\157' + '\x64' + chr(8865 - 8764))('\x75' + chr(0b1110100) + chr(102) + chr(0b101101) + chr(0b100000 + 0o30)) % (OolUPRJhRaJd, xafqLlk3kkUe(cMbll0QYhULo.int64_list, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\x8b\xcc\x9bb\xc2\xef\xa5lC\xe6\xd5'), '\144' + chr(0b1100101) + chr(0b101 + 0o136) + chr(5459 - 5348) + chr(0b10 + 0o142) + chr(0b11010 + 0o113))('\165' + chr(590 - 474) + chr(102) + chr(0b101101) + chr(866 - 810))))) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x89\xd5\x9dY\xc8\xde\xf1.`\xc0\xf1\x03\xb38\x15\xbc\x9e\x18'), chr(5685 - 5585) + chr(7622 - 7521) + '\143' + chr(111) + '\x64' + '\x65')('\x75' + chr(5328 - 5212) + chr(4969 - 4867) + chr(1843 - 1798) + '\x38') % mLr90LDTsXtO) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x89\xd5\x9dY\xc8\xc4\xfa/`\xd1\xc0\x14\xb9 J\xf2\xc8F\xbcE\xd0'), chr(7819 - 7719) + '\145' + chr(99) + chr(0b1101111) + '\144' + '\x65')(chr(117) + '\x74' + '\x66' + '\055' + chr(1655 - 1599)) % ZmNhmdT1DVYA) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x89\xd5\x9dY\xc8\xd9\xf5-r\xc0\xeb?\xa2$D\xf9\xd5\x0f\xa6@\x91\xff'), '\144' + chr(101) + chr(0b1100011) + chr(12026 - 11915) + chr(491 - 391) + '\145')(chr(0b111011 + 0o72) + chr(116) + chr(7303 - 7201) + chr(45) + '\x38') % yeWjmyuNInD3) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x86\x89\xcf\x8cT\xf3\xc9\xfd1r\xfa\xf6\x0e\xa6>[\xc3\xcf\x13\xf7\x05\xda\xe8\xe6\xdfl\x03'), chr(0b1100100) + chr(101) + chr(99) + '\x6f' + '\x64' + chr(101))('\165' + chr(0b11000 + 0o134) + chr(0b1100110) + chr(247 - 202) + chr(0b111000)) % McCbqhhu0phe) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x86\x89\xcf\x8cT\xf3\xc9\xfd1r\xfa\xeb\x01\xa4,J\xe8\xe4\x08\xf3\x0b\xd1\xf5\xaf\xc5iB\xa7'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1101111) + chr(0b10011 + 0o121) + '\145')(chr(9770 - 9653) + '\164' + chr(0b1011000 + 0o16) + '\055' + '\x38') % zIq2OSpfiWYv) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x87\xd9\xa3\\\xf9\xdd\xe1+J\xc9\xfa\x0e\xb1?G\xa6\x9bY\xf8'), '\x64' + '\x65' + chr(0b100001 + 0o102) + chr(7353 - 7242) + chr(0b1010010 + 0o22) + '\145')(chr(0b1 + 0o164) + chr(9348 - 9232) + chr(102) + chr(45) + '\x38') % hX_7BMNobORJ) zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x87\xd9\xa3A\xf6\xdf\xf3:a\xfa\xf3\x05\xb8,[\xf4\x81\\\xb9\x04'), chr(0b1100000 + 0o4) + chr(101) + chr(5375 - 5276) + chr(0b1111 + 0o140) + chr(419 - 319) + chr(0b1100101))(chr(117) + '\x74' + chr(0b1100110) + chr(0b11100 + 0o21) + '\x38') % _93hATE4geR3)
tensorflow/tensor2tensor
tensor2tensor/envs/rendered_env_problem.py
RenderedEnvProblem.example_reading_spec
def example_reading_spec(self): """Return a mix of env and video data fields and decoders.""" video_fields, video_decoders = ( video_utils.VideoProblem.example_reading_spec(self)) env_fields, env_decoders = env_problem.EnvProblem.example_reading_spec(self) # Remove raw observations field since we want to capture them as videos. env_fields.pop(env_problem.OBSERVATION_FIELD) env_decoders.pop(env_problem.OBSERVATION_FIELD) # Add frame number spec and decoder. env_fields[_FRAME_NUMBER_FIELD] = tf.FixedLenFeature((1,), tf.int64) env_decoders[ _FRAME_NUMBER_FIELD] = tf.contrib.slim.tfexample_decoder.Tensor( _FRAME_NUMBER_FIELD) # Add video fields and decoders env_fields.update(video_fields) env_decoders.update(video_decoders) return env_fields, env_decoders
python
def example_reading_spec(self): """Return a mix of env and video data fields and decoders.""" video_fields, video_decoders = ( video_utils.VideoProblem.example_reading_spec(self)) env_fields, env_decoders = env_problem.EnvProblem.example_reading_spec(self) # Remove raw observations field since we want to capture them as videos. env_fields.pop(env_problem.OBSERVATION_FIELD) env_decoders.pop(env_problem.OBSERVATION_FIELD) # Add frame number spec and decoder. env_fields[_FRAME_NUMBER_FIELD] = tf.FixedLenFeature((1,), tf.int64) env_decoders[ _FRAME_NUMBER_FIELD] = tf.contrib.slim.tfexample_decoder.Tensor( _FRAME_NUMBER_FIELD) # Add video fields and decoders env_fields.update(video_fields) env_decoders.update(video_decoders) return env_fields, env_decoders
[ "def", "example_reading_spec", "(", "self", ")", ":", "video_fields", ",", "video_decoders", "=", "(", "video_utils", ".", "VideoProblem", ".", "example_reading_spec", "(", "self", ")", ")", "env_fields", ",", "env_decoders", "=", "env_problem", ".", "EnvProblem", ".", "example_reading_spec", "(", "self", ")", "# Remove raw observations field since we want to capture them as videos.", "env_fields", ".", "pop", "(", "env_problem", ".", "OBSERVATION_FIELD", ")", "env_decoders", ".", "pop", "(", "env_problem", ".", "OBSERVATION_FIELD", ")", "# Add frame number spec and decoder.", "env_fields", "[", "_FRAME_NUMBER_FIELD", "]", "=", "tf", ".", "FixedLenFeature", "(", "(", "1", ",", ")", ",", "tf", ".", "int64", ")", "env_decoders", "[", "_FRAME_NUMBER_FIELD", "]", "=", "tf", ".", "contrib", ".", "slim", ".", "tfexample_decoder", ".", "Tensor", "(", "_FRAME_NUMBER_FIELD", ")", "# Add video fields and decoders", "env_fields", ".", "update", "(", "video_fields", ")", "env_decoders", ".", "update", "(", "video_decoders", ")", "return", "env_fields", ",", "env_decoders" ]
Return a mix of env and video data fields and decoders.
[ "Return", "a", "mix", "of", "env", "and", "video", "data", "fields", "and", "decoders", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/envs/rendered_env_problem.py#L66-L85
train
Return a mix of env and video data fields and decoders.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3Qd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aC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b101010 + 0o15) + chr(1128 - 1080), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + '\x33' + chr(1217 - 1167) + chr(1221 - 1172), ord("\x08")), ehT0Px3KOsy9(chr(371 - 323) + '\x6f' + chr(0b10 + 0o61) + chr(54), 20857 - 20849), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110111) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(2234 - 2182) + chr(0b100110 + 0o14), 32426 - 32418), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(8472 - 8361) + chr(55) + '\x37', 33341 - 33333), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101010 + 0o10) + chr(0b110101) + chr(0b101101 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2388 - 2339) + chr(0b11 + 0o60) + chr(693 - 640), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + chr(0b100000 + 0o22) + chr(2345 - 2294) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(8146 - 8035) + chr(50) + chr(0b101001 + 0o7) + chr(942 - 894), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b110110) + '\x30', 40315 - 40307), ehT0Px3KOsy9(chr(393 - 345) + chr(0b1101111) + chr(70 - 19) + '\x34' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1321 - 1273) + '\157' + chr(0b101100 + 0o5) + '\x31' + chr(54), 17644 - 17636), ehT0Px3KOsy9(chr(1605 - 1557) + '\157' + chr(0b110001) + chr(50) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10100 + 0o40) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(8474 - 8363) + chr(49) + chr(54) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + '\x34' + chr(2526 - 2471), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(1445 - 1393) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(0b10000 + 0o47) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + chr(0b110011) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b1101 + 0o51) + chr(0b1010 + 0o52), 47815 - 47807), ehT0Px3KOsy9(chr(1825 - 1777) + '\x6f' + '\063' + chr(344 - 289) + '\x37', 8 - 0), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100011 + 0o17) + chr(0b11101 + 0o30) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\x32' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1624 - 1574) + chr(0b110100) + '\x32', 3015 - 3007), ehT0Px3KOsy9('\x30' + chr(792 - 681) + chr(0b101000 + 0o13) + chr(0b110011) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(757 - 707) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1381 - 1333) + '\x6f' + chr(0b110011) + chr(1586 - 1533) + chr(1648 - 1598), 0o10), ehT0Px3KOsy9(chr(48) + chr(10320 - 10209) + chr(2220 - 2171) + chr(0b101 + 0o60) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(53) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(2285 - 2237) + chr(111) + chr(49) + chr(0b110000) + chr(50), 0b1000), ehT0Px3KOsy9(chr(1151 - 1103) + chr(0b1101111) + chr(49) + chr(0b110010) + chr(0b10111 + 0o36), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b110111) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + chr(49) + chr(1440 - 1390) + chr(0b100011 + 0o15), 61495 - 61487), ehT0Px3KOsy9(chr(48) + chr(1119 - 1008) + '\061' + chr(0b11100 + 0o25), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(52) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101110 + 0o5) + chr(0b0 + 0o67) + chr(403 - 353), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(2043 - 1994) + '\062', 0b1000), ehT0Px3KOsy9(chr(1422 - 1374) + chr(0b1000010 + 0o55) + chr(53) + '\062', 34066 - 34058), ehT0Px3KOsy9(chr(48) + chr(0b1001111 + 0o40) + chr(492 - 443) + '\x37', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(11695 - 11584) + chr(0b1 + 0o64) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6'), '\x64' + '\145' + chr(99) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(116) + chr(4904 - 4802) + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def aQvXV6y6L2zO(oVre8I6UXc3b): (m5_Cm5WXpPSe, FGdhee0KCgt2) = rx0r8JF64Zxv.VideoProblem.example_reading_spec(oVre8I6UXc3b) (_Ok2nbZsBPr4, YUPEb4BWJf5N) = ABBY257KUJZK.EnvProblem.example_reading_spec(oVre8I6UXc3b) xafqLlk3kkUe(_Ok2nbZsBPr4, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\xben'), '\x64' + chr(101) + chr(0b100010 + 0o101) + chr(0b1100001 + 0o16) + chr(100) + '\x65')(chr(117) + chr(116) + '\x66' + chr(45) + chr(0b110110 + 0o2)))(xafqLlk3kkUe(ABBY257KUJZK, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7\x93M>0i\xed\t\xd2\xcf\xfe\xbe\x08\x18d;c'), '\144' + chr(0b1100101) + '\143' + chr(0b1101111) + chr(100) + chr(3622 - 3521))('\x75' + chr(0b101100 + 0o110) + '\146' + chr(1686 - 1641) + '\070'))) xafqLlk3kkUe(YUPEb4BWJf5N, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\xben'), chr(1444 - 1344) + chr(0b1100100 + 0o1) + '\143' + chr(0b1011110 + 0o21) + '\x64' + '\145')('\165' + chr(0b1110100) + chr(0b111110 + 0o50) + chr(0b101101) + chr(924 - 868)))(xafqLlk3kkUe(ABBY257KUJZK, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7\x93M>0i\xed\t\xd2\xcf\xfe\xbe\x08\x18d;c'), chr(100) + chr(0b110011 + 0o62) + chr(0b1000000 + 0o43) + '\x6f' + chr(5700 - 5600) + '\145')('\x75' + chr(116) + '\146' + chr(45) + chr(56)))) _Ok2nbZsBPr4[ztcpLhtrAObz] = IDJ2eXGCBCDu.FixedLenFeature((ehT0Px3KOsy9(chr(48) + chr(111) + '\x31', 24600 - 24592),), IDJ2eXGCBCDu.int64) YUPEb4BWJf5N[ztcpLhtrAObz] = IDJ2eXGCBCDu.contrib.slim.tfexample_decoder.Tensor(ztcpLhtrAObz) xafqLlk3kkUe(_Ok2nbZsBPr4, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa2\xa5_>\x0bq\xe63\xe2\xb4\xd5\xd1'), '\144' + chr(0b1010110 + 0o17) + '\x63' + chr(2826 - 2715) + chr(0b1010111 + 0o15) + '\145')(chr(117) + chr(6016 - 5900) + chr(8966 - 8864) + chr(0b10000 + 0o35) + chr(0b1100 + 0o54)))(m5_Cm5WXpPSe) xafqLlk3kkUe(YUPEb4BWJf5N, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa2\xa5_>\x0bq\xe63\xe2\xb4\xd5\xd1'), chr(0b101011 + 0o71) + '\145' + chr(1439 - 1340) + chr(5756 - 5645) + '\x64' + '\x65')(chr(0b1110101) + chr(0b1000011 + 0o61) + chr(102) + '\x2d' + chr(0b111000)))(FGdhee0KCgt2) return (_Ok2nbZsBPr4, YUPEb4BWJf5N)
tensorflow/tensor2tensor
tensor2tensor/envs/rendered_env_problem.py
RenderedEnvProblem._generate_time_steps
def _generate_time_steps(self, trajectory_list): """Transforms time step observations to frames of a video.""" for time_step in env_problem.EnvProblem._generate_time_steps( self, trajectory_list): # Convert the rendered observations from numpy to png format. frame_np = np.array(time_step.pop(env_problem.OBSERVATION_FIELD)) frame_np = frame_np.reshape( [self.frame_height, self.frame_width, self.num_channels]) # TODO(msaffar) Add support for non RGB rendered environments frame = png.from_array(frame_np, "RGB", info={"bitdepth": 8}) frame_buffer = six.BytesIO() frame.save(frame_buffer) # Put the encoded frame back. time_step[_IMAGE_ENCODED_FIELD] = [frame_buffer.getvalue()] time_step[_IMAGE_FORMAT_FIELD] = [_FORMAT] time_step[_IMAGE_HEIGHT_FIELD] = [self.frame_height] time_step[_IMAGE_WIDTH_FIELD] = [self.frame_width] # Add the frame number time_step[_FRAME_NUMBER_FIELD] = time_step[env_problem.TIMESTEP_FIELD] yield time_step
python
def _generate_time_steps(self, trajectory_list): """Transforms time step observations to frames of a video.""" for time_step in env_problem.EnvProblem._generate_time_steps( self, trajectory_list): # Convert the rendered observations from numpy to png format. frame_np = np.array(time_step.pop(env_problem.OBSERVATION_FIELD)) frame_np = frame_np.reshape( [self.frame_height, self.frame_width, self.num_channels]) # TODO(msaffar) Add support for non RGB rendered environments frame = png.from_array(frame_np, "RGB", info={"bitdepth": 8}) frame_buffer = six.BytesIO() frame.save(frame_buffer) # Put the encoded frame back. time_step[_IMAGE_ENCODED_FIELD] = [frame_buffer.getvalue()] time_step[_IMAGE_FORMAT_FIELD] = [_FORMAT] time_step[_IMAGE_HEIGHT_FIELD] = [self.frame_height] time_step[_IMAGE_WIDTH_FIELD] = [self.frame_width] # Add the frame number time_step[_FRAME_NUMBER_FIELD] = time_step[env_problem.TIMESTEP_FIELD] yield time_step
[ "def", "_generate_time_steps", "(", "self", ",", "trajectory_list", ")", ":", "for", "time_step", "in", "env_problem", ".", "EnvProblem", ".", "_generate_time_steps", "(", "self", ",", "trajectory_list", ")", ":", "# Convert the rendered observations from numpy to png format.", "frame_np", "=", "np", ".", "array", "(", "time_step", ".", "pop", "(", "env_problem", ".", "OBSERVATION_FIELD", ")", ")", "frame_np", "=", "frame_np", ".", "reshape", "(", "[", "self", ".", "frame_height", ",", "self", ".", "frame_width", ",", "self", ".", "num_channels", "]", ")", "# TODO(msaffar) Add support for non RGB rendered environments", "frame", "=", "png", ".", "from_array", "(", "frame_np", ",", "\"RGB\"", ",", "info", "=", "{", "\"bitdepth\"", ":", "8", "}", ")", "frame_buffer", "=", "six", ".", "BytesIO", "(", ")", "frame", ".", "save", "(", "frame_buffer", ")", "# Put the encoded frame back.", "time_step", "[", "_IMAGE_ENCODED_FIELD", "]", "=", "[", "frame_buffer", ".", "getvalue", "(", ")", "]", "time_step", "[", "_IMAGE_FORMAT_FIELD", "]", "=", "[", "_FORMAT", "]", "time_step", "[", "_IMAGE_HEIGHT_FIELD", "]", "=", "[", "self", ".", "frame_height", "]", "time_step", "[", "_IMAGE_WIDTH_FIELD", "]", "=", "[", "self", ".", "frame_width", "]", "# Add the frame number", "time_step", "[", "_FRAME_NUMBER_FIELD", "]", "=", "time_step", "[", "env_problem", ".", "TIMESTEP_FIELD", "]", "yield", "time_step" ]
Transforms time step observations to frames of a video.
[ "Transforms", "time", "step", "observations", "to", "frames", "of", "a", "video", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/envs/rendered_env_problem.py#L87-L108
train
Transforms time step observations to frames of a video.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,G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mS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11110 + 0o23) + chr(0b110110) + chr(0b11010 + 0o26), 24553 - 24545), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1111 + 0o42) + chr(0b11101 + 0o30) + chr(0b100 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(180 - 130) + chr(53) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1011 + 0o46) + '\x30' + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(6466 - 6355) + chr(644 - 594) + '\x34' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9118 - 9007) + '\062' + '\065' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3064 - 2953) + '\x33' + '\x36' + chr(0b101101 + 0o12), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(0b110011) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(644 - 595) + chr(1112 - 1064) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5655 - 5544) + chr(49) + chr(0b100001 + 0o20) + chr(0b1011 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + '\062' + chr(48) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(1486 - 1438) + chr(0b1101111) + chr(52) + chr(0b110110), 36172 - 36164), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + chr(0b110010 + 0o1) + chr(0b110000) + chr(0b100101 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + '\x33' + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(0b110 + 0o151) + chr(49) + chr(0b11110 + 0o31) + chr(486 - 437), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10011 + 0o37) + chr(0b110011) + chr(0b110010), 35951 - 35943), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100101 + 0o14) + chr(55) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(5137 - 5026) + chr(2506 - 2455) + chr(1783 - 1735), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(1290 - 1241) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(1132 - 1082) + chr(50) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(1757 - 1703) + '\066', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b1111 + 0o42) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2265 - 2154) + chr(679 - 629) + chr(0b110000) + chr(0b100100 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(1091 - 1043) + '\157' + '\x34' + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + chr(2013 - 1963) + chr(51) + chr(0b111 + 0o57), 8), ehT0Px3KOsy9('\060' + chr(2638 - 2527) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(573 - 462) + chr(49) + '\x31' + chr(2304 - 2254), ord("\x08")), ehT0Px3KOsy9(chr(1126 - 1078) + chr(111) + chr(0b11110 + 0o25) + chr(635 - 583) + chr(0b0 + 0o63), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b110110) + '\067', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(511 - 462) + chr(2275 - 2227) + chr(2359 - 2307), 34987 - 34979), ehT0Px3KOsy9(chr(187 - 139) + '\157' + '\x31' + chr(0b100010 + 0o16) + chr(0b101 + 0o53), 0b1000), ehT0Px3KOsy9(chr(398 - 350) + '\157' + chr(2034 - 1985) + chr(0b1110 + 0o47) + chr(0b10001 + 0o43), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2384 - 2333) + '\x31' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(87 - 39) + chr(0b1101 + 0o142) + chr(0b10001 + 0o41) + chr(50) + '\065', 8), ehT0Px3KOsy9(chr(244 - 196) + chr(111) + chr(0b110001) + '\067' + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(48) + '\x30', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1970 - 1920) + chr(2243 - 2193) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(0b10010 + 0o42) + chr(0b101000 + 0o15), 53771 - 53763), ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + '\x31' + '\x35' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(540 - 492) + '\x6f' + chr(0b110010) + chr(0b110111) + '\061', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + chr(2081 - 2033), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'^'), chr(0b0 + 0o144) + chr(0b1001010 + 0o33) + '\143' + '\157' + chr(100) + chr(174 - 73))(chr(0b1110101) + chr(0b1011010 + 0o32) + chr(3712 - 3610) + chr(1320 - 1275) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def KjRRMz75iZjo(oVre8I6UXc3b, pbil2iYlib4a): for zVXIFxIBf7Io in xafqLlk3kkUe(ABBY257KUJZK.EnvProblem, xafqLlk3kkUe(SXOLrMavuUCe(b'/\t\xce/\xc4\xdc\x96\xea"\x10\xf7O\xa9y&\xe9\r}\xbc\xe6'), '\x64' + chr(8523 - 8422) + '\143' + '\157' + '\144' + '\145')('\165' + '\164' + chr(102) + chr(419 - 374) + '\070'))(oVre8I6UXc3b, pbil2iYlib4a): GUTAG_IllKcc = WqUC3KWvYVup.B0ePDhpqxN5n(zVXIFxIBf7Io.pop(ABBY257KUJZK.OBSERVATION_FIELD)) GUTAG_IllKcc = GUTAG_IllKcc.reshape([oVre8I6UXc3b.frame_height, oVre8I6UXc3b.frame_width, oVre8I6UXc3b.X1ZpHSxyKbHn]) C4IqNNmLfHXB = sAqo53UeLgoo.from_array(GUTAG_IllKcc, xafqLlk3kkUe(SXOLrMavuUCe(b'")\xe9'), chr(0b1100100) + '\x65' + chr(0b100110 + 0o75) + chr(111) + '\144' + '\x65')(chr(0b1110101) + '\164' + chr(0b1110 + 0o130) + '\x2d' + '\x38'), info={xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\x07\xdf%\xc4\xde\x83\xf6'), '\144' + chr(0b1100101) + '\143' + chr(111) + '\x64' + chr(3610 - 3509))(chr(117) + chr(0b1101010 + 0o12) + chr(0b1100110) + '\x2d' + chr(0b111000)): ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(2297 - 2249), 31835 - 31827)}) fcXy_9gXj6ao = sYby0kpfssd4.BytesIO() xafqLlk3kkUe(C4IqNNmLfHXB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x0f\xdd$'), '\144' + chr(2348 - 2247) + chr(99) + '\157' + chr(5711 - 5611) + chr(0b1010101 + 0o20))(chr(3775 - 3658) + chr(116) + '\146' + chr(0b11 + 0o52) + chr(2168 - 2112)))(fcXy_9gXj6ao) zVXIFxIBf7Io[NZmBYrIY_3nV] = [fcXy_9gXj6ao.getvalue()] zVXIFxIBf7Io[NqU5eUOBZQUx] = [fSIS3WCGHz6R] zVXIFxIBf7Io[FI3YO2Gur6yV] = [oVre8I6UXc3b.frame_height] zVXIFxIBf7Io[LvqVBtDOYReu] = [oVre8I6UXc3b.frame_width] zVXIFxIBf7Io[ztcpLhtrAObz] = zVXIFxIBf7Io[ABBY257KUJZK.TIMESTEP_FIELD] yield zVXIFxIBf7Io
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
txt_line_iterator
def txt_line_iterator(txt_path): """Iterate through lines of file.""" with tf.gfile.Open(txt_path) as f: for line in f: yield line.strip()
python
def txt_line_iterator(txt_path): """Iterate through lines of file.""" with tf.gfile.Open(txt_path) as f: for line in f: yield line.strip()
[ "def", "txt_line_iterator", "(", "txt_path", ")", ":", "with", "tf", ".", "gfile", ".", "Open", "(", "txt_path", ")", "as", "f", ":", "for", "line", "in", "f", ":", "yield", "line", ".", "strip", "(", ")" ]
Iterate through lines of file.
[ "Iterate", "through", "lines", "of", "file", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L607-L611
train
Iterate through lines of file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prt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l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(52) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(54) + '\061', 25810 - 25802), ehT0Px3KOsy9(chr(48) + '\157' + chr(328 - 277) + '\062' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1440 - 1392) + chr(0b101100 + 0o103) + '\062' + '\x35', 30218 - 30210), ehT0Px3KOsy9('\060' + '\x6f' + chr(1963 - 1914) + chr(180 - 132) + chr(0b110000), 40620 - 40612), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(0b110000 + 0o1) + chr(0b11110 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1131 - 1083) + chr(0b1101111) + '\066' + '\061', 60678 - 60670), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\x31' + chr(2350 - 2301) + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\x37' + '\062', 22152 - 22144), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100111 + 0o13) + '\063' + chr(0b1100 + 0o46), 0o10), ehT0Px3KOsy9(chr(1329 - 1281) + chr(0b1101111) + '\x37' + '\x33', 0b1000), ehT0Px3KOsy9(chr(61 - 13) + '\157' + chr(0b101101 + 0o5) + chr(2828 - 2773), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1896 - 1846) + chr(499 - 451) + chr(1067 - 1013), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1 + 0o65) + chr(0b1011 + 0o47), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10001 + 0o42) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(2147 - 2097) + '\x35' + chr(0b1001 + 0o47), 25602 - 25594), ehT0Px3KOsy9(chr(1548 - 1500) + '\x6f' + '\x32' + chr(0b110010) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + '\x36' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b111 + 0o53) + '\x31' + chr(1409 - 1356), 56481 - 56473), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\061' + chr(51) + chr(1859 - 1811), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\060' + chr(605 - 553), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(139 - 84) + chr(2521 - 2466), 45747 - 45739), ehT0Px3KOsy9('\x30' + chr(0b111110 + 0o61) + chr(0b111 + 0o54) + chr(0b110111) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x37' + '\065', 6332 - 6324), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\060', 18191 - 18183), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(408 - 359) + chr(963 - 911) + chr(1291 - 1241), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b110000 + 0o3) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10000 - 9889) + chr(2121 - 2071) + chr(48) + chr(2175 - 2120), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\062' + chr(590 - 541), 30317 - 30309), ehT0Px3KOsy9('\x30' + chr(6217 - 6106) + '\063' + chr(52) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2492 - 2441) + chr(72 - 24) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + '\062' + '\065' + '\060', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(790 - 740) + chr(0b110100) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b1001 + 0o52) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1011 + 0o144) + chr(0b100000 + 0o23) + chr(0b110110) + chr(0b11111 + 0o25), 9521 - 9513), ehT0Px3KOsy9(chr(2152 - 2104) + chr(111) + chr(0b110001) + '\x37' + chr(544 - 494), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(11316 - 11205) + chr(0b110011) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10100 + 0o37) + chr(54) + chr(54), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'O'), chr(100) + '\x65' + chr(2863 - 2764) + '\157' + '\x64' + chr(5915 - 5814))(chr(0b1110101) + chr(116) + '\146' + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def CsIeUcDbF3ix(NHVQiBSt5lUv): with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'.\x01\xb1{'), '\144' + '\x65' + chr(8570 - 8471) + chr(0b110100 + 0o73) + chr(0b11 + 0o141) + chr(4007 - 3906))('\165' + '\164' + chr(102) + '\x2d' + '\x38'))(NHVQiBSt5lUv) as EGyt1xfPT1P6: for LycYkDpyelF6 in EGyt1xfPT1P6: yield xafqLlk3kkUe(LycYkDpyelF6, xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\x05\xa6|0'), '\144' + chr(0b1100101) + '\143' + chr(0b1101001 + 0o6) + chr(0b1100100) + chr(101))('\165' + chr(12910 - 12794) + '\x66' + chr(51 - 6) + chr(0b111000)))()
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
text2text_txt_iterator
def text2text_txt_iterator(source_txt_path, target_txt_path): """Yield dicts for Text2TextProblem.generate_samples from lines of files.""" for inputs, targets in zip( txt_line_iterator(source_txt_path), txt_line_iterator(target_txt_path)): yield {"inputs": inputs, "targets": targets}
python
def text2text_txt_iterator(source_txt_path, target_txt_path): """Yield dicts for Text2TextProblem.generate_samples from lines of files.""" for inputs, targets in zip( txt_line_iterator(source_txt_path), txt_line_iterator(target_txt_path)): yield {"inputs": inputs, "targets": targets}
[ "def", "text2text_txt_iterator", "(", "source_txt_path", ",", "target_txt_path", ")", ":", "for", "inputs", ",", "targets", "in", "zip", "(", "txt_line_iterator", "(", "source_txt_path", ")", ",", "txt_line_iterator", "(", "target_txt_path", ")", ")", ":", "yield", "{", "\"inputs\"", ":", "inputs", ",", "\"targets\"", ":", "targets", "}" ]
Yield dicts for Text2TextProblem.generate_samples from lines of files.
[ "Yield", "dicts", "for", "Text2TextProblem", ".", "generate_samples", "from", "lines", "of", "files", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L614-L618
train
Yield dicts for Text2TextProblem. generate_samples from lines of files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf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,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(5309 - 5198) + chr(0b1111 + 0o50) + chr(319 - 271), ord("\x08")), ehT0Px3KOsy9(chr(2015 - 1967) + '\x6f' + '\062' + chr(0b110111) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(2111 - 2056) + chr(1555 - 1503), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + chr(50) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1262 - 1151) + chr(915 - 865) + '\062' + chr(1194 - 1139), 34624 - 34616), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110 + 0o61) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110110) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(8885 - 8774) + chr(0b110010) + chr(1300 - 1245), 21400 - 21392), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(0b110010) + chr(53) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(55) + chr(0b101110 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(154 - 43) + chr(50) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11110 + 0o121) + chr(498 - 448) + '\x31' + chr(52), 53956 - 53948), ehT0Px3KOsy9(chr(877 - 829) + chr(12114 - 12003) + chr(0b110011) + chr(0b110111) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(0b11111 + 0o22) + '\x32' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + '\x31' + '\062' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53), 37391 - 37383), ehT0Px3KOsy9('\x30' + chr(0b1100111 + 0o10) + chr(49) + chr(0b1011 + 0o47), 0o10), ehT0Px3KOsy9('\060' + chr(3080 - 2969) + chr(51) + chr(718 - 666) + chr(0b100101 + 0o22), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2667 - 2612) + chr(0b100010 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b110010) + chr(0b101101 + 0o3) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(384 - 273) + chr(0b110011) + chr(1644 - 1589) + chr(0b100011 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(0b110111) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\064' + chr(1515 - 1466), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b100100 + 0o17) + chr(0b110100) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b110011) + chr(0b101111 + 0o1), ord("\x08")), ehT0Px3KOsy9(chr(1386 - 1338) + '\157' + '\062' + chr(48) + chr(1267 - 1216), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2402 - 2352) + chr(0b110001), 28900 - 28892), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b101110 + 0o10) + chr(287 - 237), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(851 - 800) + chr(0b110010 + 0o2), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\x33' + chr(0b100011 + 0o23), 46844 - 46836), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1001100 + 0o43) + chr(0b110010) + chr(318 - 268) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + chr(50) + chr(0b100110 + 0o17) + chr(1955 - 1900), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b101 + 0o60) + chr(0b1110 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(393 - 282) + '\x33' + chr(0b110100) + chr(2156 - 2103), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101101 + 0o5) + chr(53) + chr(0b110101), 60250 - 60242), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x35' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(85 - 37) + chr(111) + '\064' + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000101 + 0o52) + chr(0b101010 + 0o7) + chr(0b101010 + 0o7) + chr(0b110100), 44967 - 44959), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100000 + 0o21) + chr(0b110101) + '\063', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(0b110101) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x16'), '\144' + chr(7943 - 7842) + '\143' + '\157' + chr(4011 - 3911) + chr(0b1100101))(chr(0b1001001 + 0o54) + chr(116) + chr(0b1100110) + chr(1292 - 1247) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def mnAkKHeTPADi(wRZ2ifVObIR9, sgGPh1KMZ5IO): for (vXoupepMtCXU, xIEmRseySp3z) in pZ0NK2y6HRbn(CsIeUcDbF3ix(wRZ2ifVObIR9), CsIeUcDbF3ix(sgGPh1KMZ5IO)): yield {xafqLlk3kkUe(SXOLrMavuUCe(b'Q\xd6\xccg\xe3I'), chr(0b1100 + 0o130) + chr(101) + '\x63' + chr(11342 - 11231) + chr(1814 - 1714) + '\x65')(chr(3390 - 3273) + chr(1510 - 1394) + chr(0b1100110) + chr(0b11 + 0o52) + '\070'): vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'L\xd9\xceu\xf2N\xc5'), '\144' + '\x65' + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(8696 - 8579) + chr(116) + chr(0b1100110) + chr(45) + chr(1772 - 1716)): xIEmRseySp3z}
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
text2text_distill_iterator
def text2text_distill_iterator(source_txt_path, target_txt_path, distill_txt_path): """Yield dicts for Text2TextProblem.generate_samples from lines of files.""" for inputs, targets, dist_targets in zip( txt_line_iterator(source_txt_path), txt_line_iterator(target_txt_path), txt_line_iterator(distill_txt_path)): yield {"inputs": inputs, "targets": targets, "dist_targets": dist_targets}
python
def text2text_distill_iterator(source_txt_path, target_txt_path, distill_txt_path): """Yield dicts for Text2TextProblem.generate_samples from lines of files.""" for inputs, targets, dist_targets in zip( txt_line_iterator(source_txt_path), txt_line_iterator(target_txt_path), txt_line_iterator(distill_txt_path)): yield {"inputs": inputs, "targets": targets, "dist_targets": dist_targets}
[ "def", "text2text_distill_iterator", "(", "source_txt_path", ",", "target_txt_path", ",", "distill_txt_path", ")", ":", "for", "inputs", ",", "targets", ",", "dist_targets", "in", "zip", "(", "txt_line_iterator", "(", "source_txt_path", ")", ",", "txt_line_iterator", "(", "target_txt_path", ")", ",", "txt_line_iterator", "(", "distill_txt_path", ")", ")", ":", "yield", "{", "\"inputs\"", ":", "inputs", ",", "\"targets\"", ":", "targets", ",", "\"dist_targets\"", ":", "dist_targets", "}" ]
Yield dicts for Text2TextProblem.generate_samples from lines of files.
[ "Yield", "dicts", "for", "Text2TextProblem", ".", "generate_samples", "from", "lines", "of", "files", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L621-L627
train
Yield dicts for Text2TextProblem. generate_samples from lines of files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznF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2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(3484 - 3373) + chr(285 - 236) + chr(887 - 839) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1202 - 1152) + '\066' + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(1983 - 1931), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b110011) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\063' + chr(0b1000 + 0o55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b0 + 0o63) + chr(54) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2229 - 2178) + '\x33' + chr(52), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1002 - 950), 61880 - 61872), ehT0Px3KOsy9(chr(1040 - 992) + chr(11155 - 11044) + chr(51) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(1237 - 1187) + chr(0b11100 + 0o30), 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(1648 - 1599) + chr(0b110100) + chr(0b110000), 53006 - 52998), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(259 - 211) + chr(743 - 694), 53131 - 53123), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b10010 + 0o37) + chr(1110 - 1056), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + '\066' + chr(1938 - 1889), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(51) + chr(51), 61107 - 61099), ehT0Px3KOsy9(chr(724 - 676) + chr(6280 - 6169) + '\x31' + chr(2251 - 2201) + chr(0b1110 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1011001 + 0o26) + chr(54) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(591 - 540) + chr(1236 - 1186) + chr(49), 0o10), ehT0Px3KOsy9(chr(1621 - 1573) + '\x6f' + chr(0b101010 + 0o7) + chr(55) + chr(1908 - 1860), 61582 - 61574), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x36' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8600 - 8489) + chr(0b110010) + '\063' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(876 - 826) + chr(1497 - 1446) + '\062', 41048 - 41040), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b110100) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11101 + 0o24) + chr(0b101110 + 0o3) + chr(0b11000 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1806 - 1756) + '\067' + chr(49), 41917 - 41909), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\067' + '\x31', 8), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(1287 - 1176) + '\x37' + chr(1984 - 1930), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b101100 + 0o103) + '\x33' + chr(49) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11101 + 0o25) + chr(50) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(807 - 696) + '\x31' + chr(0b110000) + chr(0b1100 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(51) + chr(2286 - 2235), 47748 - 47740), ehT0Px3KOsy9(chr(48) + chr(111) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(1310 - 1260) + chr(0b110111), 28402 - 28394), ehT0Px3KOsy9('\x30' + chr(6824 - 6713) + chr(0b110010) + '\x36' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(939 - 888) + '\x36' + '\065', 57712 - 57704), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x37' + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100 + 0o143) + '\065' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + '\x32' + '\063' + '\061', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1032 - 984) + chr(0b1101111) + chr(0b101100 + 0o11) + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'i'), chr(100) + '\x65' + chr(0b10010 + 0o121) + chr(0b1101111) + '\144' + chr(6991 - 6890))(chr(0b1110101) + '\164' + chr(0b10001 + 0o125) + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def l3_zuaZaegQv(wRZ2ifVObIR9, sgGPh1KMZ5IO, FGnZbZpG5fDP): for (vXoupepMtCXU, xIEmRseySp3z, op02E5dobHnq) in pZ0NK2y6HRbn(CsIeUcDbF3ix(wRZ2ifVObIR9), CsIeUcDbF3ix(sgGPh1KMZ5IO), CsIeUcDbF3ix(FGnZbZpG5fDP)): yield {xafqLlk3kkUe(SXOLrMavuUCe(b'.\xded/\xe9\x83'), chr(0b100110 + 0o76) + '\x65' + chr(0b1100011) + chr(3478 - 3367) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(0b1011000 + 0o16) + chr(45) + chr(308 - 252)): vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'3\xd1f=\xf8\x84\xaf'), chr(0b10101 + 0o117) + '\x65' + '\143' + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(1755 - 1638) + chr(116) + chr(0b1100110) + chr(45) + '\070'): xIEmRseySp3z, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xd9g.\xc2\x84\xbd}c{\xe0\x13'), chr(0b1010001 + 0o23) + '\145' + '\143' + '\157' + chr(0b1101 + 0o127) + chr(0b1100101))(chr(0b111110 + 0o67) + chr(0b1110100) + '\146' + chr(0b11000 + 0o25) + chr(56)): op02E5dobHnq}
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
text2class_txt_iterator
def text2class_txt_iterator(source_txt_path, label_txt_path, class_strs=None): """Yield dicts for Text2ClassProblem.generate_samples from lines of files. Args: source_txt_path: txt file with record per line. label_txt_path: txt file with label per line, either as int or str. If string, must provide class_strs. class_strs: list<str> of class label names. Must be in correct order (i.e. ["a", "b", "c"] means that "a" will get class ID 0, "b" ID 1, etc.). Yields: {"inputs": inputs, "label": label} """ if class_strs: class_strs = dict([(s, i) for i, s in enumerate(class_strs)]) for inputs, label in zip( txt_line_iterator(source_txt_path), txt_line_iterator(label_txt_path)): label = label.strip() if class_strs: label = class_strs[label] else: label = int(label) yield {"inputs": inputs, "label": label}
python
def text2class_txt_iterator(source_txt_path, label_txt_path, class_strs=None): """Yield dicts for Text2ClassProblem.generate_samples from lines of files. Args: source_txt_path: txt file with record per line. label_txt_path: txt file with label per line, either as int or str. If string, must provide class_strs. class_strs: list<str> of class label names. Must be in correct order (i.e. ["a", "b", "c"] means that "a" will get class ID 0, "b" ID 1, etc.). Yields: {"inputs": inputs, "label": label} """ if class_strs: class_strs = dict([(s, i) for i, s in enumerate(class_strs)]) for inputs, label in zip( txt_line_iterator(source_txt_path), txt_line_iterator(label_txt_path)): label = label.strip() if class_strs: label = class_strs[label] else: label = int(label) yield {"inputs": inputs, "label": label}
[ "def", "text2class_txt_iterator", "(", "source_txt_path", ",", "label_txt_path", ",", "class_strs", "=", "None", ")", ":", "if", "class_strs", ":", "class_strs", "=", "dict", "(", "[", "(", "s", ",", "i", ")", "for", "i", ",", "s", "in", "enumerate", "(", "class_strs", ")", "]", ")", "for", "inputs", ",", "label", "in", "zip", "(", "txt_line_iterator", "(", "source_txt_path", ")", ",", "txt_line_iterator", "(", "label_txt_path", ")", ")", ":", "label", "=", "label", ".", "strip", "(", ")", "if", "class_strs", ":", "label", "=", "class_strs", "[", "label", "]", "else", ":", "label", "=", "int", "(", "label", ")", "yield", "{", "\"inputs\"", ":", "inputs", ",", "\"label\"", ":", "label", "}" ]
Yield dicts for Text2ClassProblem.generate_samples from lines of files. Args: source_txt_path: txt file with record per line. label_txt_path: txt file with label per line, either as int or str. If string, must provide class_strs. class_strs: list<str> of class label names. Must be in correct order (i.e. ["a", "b", "c"] means that "a" will get class ID 0, "b" ID 1, etc.). Yields: {"inputs": inputs, "label": label}
[ "Yield", "dicts", "for", "Text2ClassProblem", ".", "generate_samples", "from", "lines", "of", "files", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L635-L657
train
Generator function for Text2ClassProblem. generate_samples from lines of files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGF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jMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b10001 + 0o45) + chr(0b1011 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b11010 + 0o35) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + chr(53) + '\x32', 35380 - 35372), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36' + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(2635 - 2583) + chr(0b1001 + 0o51), 20779 - 20771), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + '\x31' + '\x31' + chr(54), 0b1000), ehT0Px3KOsy9(chr(2176 - 2128) + chr(111) + '\062' + chr(54) + chr(0b100101 + 0o13), 32153 - 32145), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(0b10011 + 0o36) + '\064', 0o10), ehT0Px3KOsy9(chr(2177 - 2129) + chr(0b1011010 + 0o25) + chr(50) + '\067' + chr(0b110111), 64480 - 64472), ehT0Px3KOsy9(chr(48) + chr(7393 - 7282) + chr(671 - 622) + chr(53) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3249 - 3138) + chr(51) + chr(49) + chr(0b10100 + 0o37), 0b1000), ehT0Px3KOsy9(chr(1481 - 1433) + chr(111) + chr(50) + '\x34' + '\067', 23570 - 23562), ehT0Px3KOsy9(chr(48) + chr(0b1000011 + 0o54) + '\063' + chr(54) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(1927 - 1879) + chr(2505 - 2394) + '\x31' + '\065' + chr(0b110001), 17315 - 17307), ehT0Px3KOsy9('\x30' + chr(111) + chr(1433 - 1383) + '\x37' + '\066', 33926 - 33918), ehT0Px3KOsy9('\060' + chr(0b1000000 + 0o57) + '\x32' + '\x37' + chr(0b101111 + 0o6), 41062 - 41054), ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b111 + 0o52) + chr(0b110001) + chr(0b110111), 9168 - 9160), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b110010) + '\x34' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(844 - 796) + chr(0b1000100 + 0o53) + '\061' + '\061' + chr(0b110110), 8), ehT0Px3KOsy9('\060' + chr(7127 - 7016) + '\061' + chr(2515 - 2460) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(0b110011 + 0o3) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\061' + '\066', 2601 - 2593), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + chr(2102 - 2052) + chr(49) + chr(0b110011), 45 - 37), ehT0Px3KOsy9(chr(1066 - 1018) + '\157' + '\061' + chr(0b1101 + 0o45) + chr(0b1 + 0o61), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1096 - 1046) + chr(0b1010 + 0o51) + '\x35', 12215 - 12207), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + '\062' + chr(0b1111 + 0o45) + chr(0b101111 + 0o1), 0b1000), ehT0Px3KOsy9('\x30' + chr(4807 - 4696) + chr(0b100001 + 0o20) + '\x30' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(51) + chr(2498 - 2447), 0b1000), ehT0Px3KOsy9(chr(2035 - 1987) + chr(4277 - 4166) + chr(2649 - 2594) + chr(0b101000 + 0o12), 51777 - 51769), ehT0Px3KOsy9('\x30' + '\157' + chr(2472 - 2417) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\063' + chr(52), 190 - 182), ehT0Px3KOsy9('\x30' + chr(111) + chr(544 - 495) + '\x33' + chr(0b1110 + 0o51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110100) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10010 + 0o40) + chr(0b110011) + chr(0b1101 + 0o50), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(1577 - 1528) + chr(52), 34232 - 34224), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + chr(0b110010) + chr(1896 - 1844) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + '\066' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(671 - 623) + '\157' + chr(1605 - 1551) + chr(0b10 + 0o57), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1111 + 0o43) + '\060' + chr(0b11101 + 0o26), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(3576 - 3465) + '\x35' + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a'), chr(218 - 118) + chr(7111 - 7010) + chr(0b1001101 + 0o26) + '\157' + chr(0b1011 + 0o131) + chr(9257 - 9156))('\165' + chr(0b10011 + 0o141) + chr(511 - 409) + chr(0b1100 + 0o41) + chr(1201 - 1145)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def N5pJ9WvN0nL_(wRZ2ifVObIR9, LwE7weccgC92, JTKmHxMQhSAr=None): if JTKmHxMQhSAr: JTKmHxMQhSAr = wLqBDw8l0eIm([(vGrByMSYMp9h, WVxHKyX45z_L) for (WVxHKyX45z_L, vGrByMSYMp9h) in YlkZvXL8qwsX(JTKmHxMQhSAr)]) for (vXoupepMtCXU, TRUOLFLuD08x) in pZ0NK2y6HRbn(CsIeUcDbF3ix(wRZ2ifVObIR9), CsIeUcDbF3ix(LwE7weccgC92)): TRUOLFLuD08x = TRUOLFLuD08x.strip() if JTKmHxMQhSAr: TRUOLFLuD08x = JTKmHxMQhSAr[TRUOLFLuD08x] else: TRUOLFLuD08x = ehT0Px3KOsy9(TRUOLFLuD08x) yield {xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\x16ZD\xd6='), '\x64' + '\145' + chr(99) + chr(871 - 760) + chr(7479 - 7379) + '\x65')(chr(117) + chr(5638 - 5522) + chr(0b1100110) + '\055' + '\x38'): vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd8\x19HT\xce'), '\x64' + chr(101) + chr(99) + '\157' + chr(0b1100100) + chr(0b1001110 + 0o27))(chr(8367 - 8250) + chr(0b1110100) + chr(102) + chr(0b101101) + chr(0b111000)): TRUOLFLuD08x}
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
text2text_txt_tab_iterator
def text2text_txt_tab_iterator(txt_path): """Yield dicts for Text2TextProblem.generate_samples from lines of txt_path. Args: txt_path: path to txt file with a record per line, source and target are tab-separated. Yields: {"inputs": inputs, "targets": targets} """ for line in txt_line_iterator(txt_path): if line and "\t" in line: parts = line.split("\t", 1) inputs, targets = parts[:2] yield {"inputs": inputs.strip(), "targets": targets.strip()}
python
def text2text_txt_tab_iterator(txt_path): """Yield dicts for Text2TextProblem.generate_samples from lines of txt_path. Args: txt_path: path to txt file with a record per line, source and target are tab-separated. Yields: {"inputs": inputs, "targets": targets} """ for line in txt_line_iterator(txt_path): if line and "\t" in line: parts = line.split("\t", 1) inputs, targets = parts[:2] yield {"inputs": inputs.strip(), "targets": targets.strip()}
[ "def", "text2text_txt_tab_iterator", "(", "txt_path", ")", ":", "for", "line", "in", "txt_line_iterator", "(", "txt_path", ")", ":", "if", "line", "and", "\"\\t\"", "in", "line", ":", "parts", "=", "line", ".", "split", "(", "\"\\t\"", ",", "1", ")", "inputs", ",", "targets", "=", "parts", "[", ":", "2", "]", "yield", "{", "\"inputs\"", ":", "inputs", ".", "strip", "(", ")", ",", "\"targets\"", ":", "targets", ".", "strip", "(", ")", "}" ]
Yield dicts for Text2TextProblem.generate_samples from lines of txt_path. Args: txt_path: path to txt file with a record per line, source and target are tab-separated. Yields: {"inputs": inputs, "targets": targets}
[ "Yield", "dicts", "for", "Text2TextProblem", ".", "generate_samples", "from", "lines", "of", "txt_path", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L660-L674
train
Yields dicts for Text2TextProblem. generate_samples from lines of txt_path.
Pu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,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11110 + 0o24) + '\060' + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(6357 - 6246) + chr(49) + '\066' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1000011 + 0o54) + '\x33' + chr(0b110101) + chr(527 - 475), 21322 - 21314), ehT0Px3KOsy9(chr(681 - 633) + chr(111) + chr(0b100110 + 0o13) + '\x33' + chr(508 - 453), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110110) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\062' + '\x32', 11963 - 11955), ehT0Px3KOsy9(chr(0b110000) + chr(1493 - 1382) + chr(53) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b10110 + 0o131) + chr(49) + chr(1198 - 1149) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + '\x34' + chr(0b10011 + 0o40), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11001 + 0o30) + '\067' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b111 + 0o150) + chr(0b100 + 0o56) + '\066' + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + '\x32', 0o10), ehT0Px3KOsy9(chr(1496 - 1448) + chr(111) + chr(0b1110 + 0o43) + '\x36' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\060' + chr(0b110110), 49453 - 49445), ehT0Px3KOsy9(chr(1053 - 1005) + '\157' + chr(0b110010) + chr(52) + chr(0b1000 + 0o56), 59937 - 59929), ehT0Px3KOsy9(chr(130 - 82) + chr(10893 - 10782) + chr(0b11000 + 0o31) + chr(0b100101 + 0o17) + chr(1159 - 1108), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + '\062' + chr(0b101110 + 0o6) + chr(0b10101 + 0o36), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(0b11001 + 0o30) + '\065', 57908 - 57900), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010001 + 0o36) + '\061' + chr(1429 - 1379) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(1904 - 1856) + '\x6f' + '\x32' + chr(1711 - 1657) + '\x35', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(2691 - 2637) + '\x32', 0b1000), ehT0Px3KOsy9(chr(1008 - 960) + '\157' + chr(1464 - 1413) + chr(0b10010 + 0o45) + chr(0b11 + 0o64), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(735 - 686) + '\061', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + '\067' + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b110001) + chr(50) + chr(290 - 237), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101100 + 0o103) + chr(1878 - 1828) + '\064' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\x30' + chr(386 - 338), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b110110) + chr(0b10001 + 0o43), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(0b110011) + chr(2197 - 2147) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(53) + '\x35', 31304 - 31296), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100101 + 0o16) + chr(0b10001 + 0o43) + chr(49), 12665 - 12657), ehT0Px3KOsy9(chr(1307 - 1259) + chr(0b1101111) + chr(0b110001) + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(0b110111) + chr(0b1100 + 0o47), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(0b101011 + 0o6) + chr(0b10100 + 0o37) + '\067', 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(50) + chr(0b11101 + 0o30) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1784 - 1734) + '\x31' + chr(1186 - 1135), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10000 + 0o41) + '\063' + '\x37', 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + '\x33' + chr(0b110000) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11010 + 0o34) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(0b101101 + 0o4) + '\x37' + chr(0b10100 + 0o41), 40966 - 40958)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(360 - 312) + '\157' + '\x35' + '\x30', 36857 - 36849)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xac'), chr(4806 - 4706) + chr(101) + chr(99) + '\157' + chr(0b1100100) + chr(0b100100 + 0o101))('\x75' + chr(0b1110001 + 0o3) + '\146' + chr(0b1100 + 0o41) + chr(0b10 + 0o66)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def gzx0XGcFcm26(NHVQiBSt5lUv): for LycYkDpyelF6 in CsIeUcDbF3ix(NHVQiBSt5lUv): if LycYkDpyelF6 and xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), chr(100) + '\145' + chr(99) + chr(2590 - 2479) + '\144' + '\x65')('\x75' + chr(0b10011 + 0o141) + chr(8500 - 8398) + chr(0b101101) + chr(0b111000)) in LycYkDpyelF6: gIfWK5W_pmM4 = LycYkDpyelF6.split(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), '\x64' + '\145' + chr(0b1100011) + '\x6f' + '\144' + chr(0b1100101))(chr(0b110111 + 0o76) + chr(0b11010 + 0o132) + chr(0b111000 + 0o56) + chr(1131 - 1086) + '\x38'), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 0b1000)) (vXoupepMtCXU, xIEmRseySp3z) = gIfWK5W_pmM4[:ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + chr(50), 0b1000)] yield {xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\x19\x9c*B\xe1'), chr(4130 - 4030) + chr(0b11010 + 0o113) + '\143' + '\157' + chr(0b111011 + 0o51) + chr(101))('\165' + chr(0b100011 + 0o121) + chr(3131 - 3029) + '\055' + chr(0b111000)): xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1\x03\x9e6F'), chr(0b10011 + 0o121) + chr(101) + '\143' + '\x6f' + chr(464 - 364) + '\145')(chr(9125 - 9008) + chr(116) + chr(5900 - 5798) + chr(460 - 415) + '\x38'))(), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x16\x9e8S\xe6X'), chr(100) + '\145' + '\143' + chr(0b1101111) + '\144' + '\x65')(chr(0b1110101) + chr(6166 - 6050) + chr(727 - 625) + chr(45) + '\x38'): xafqLlk3kkUe(xIEmRseySp3z, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1\x03\x9e6F'), '\x64' + chr(0b1100101) + '\x63' + chr(0b11000 + 0o127) + chr(0b1100100) + chr(6797 - 6696))(chr(11932 - 11815) + chr(0b1110100 + 0o0) + '\146' + '\x2d' + chr(56)))()}
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
text2text_generate_encoded
def text2text_generate_encoded(sample_generator, vocab, targets_vocab=None, has_inputs=True, inputs_prefix="", targets_prefix=""): """Encode Text2Text samples from the generator with the vocab.""" targets_vocab = targets_vocab or vocab for sample in sample_generator: if has_inputs: sample["inputs"] = vocab.encode(inputs_prefix + sample["inputs"]) sample["inputs"].append(text_encoder.EOS_ID) sample["targets"] = targets_vocab.encode(targets_prefix + sample["targets"]) sample["targets"].append(text_encoder.EOS_ID) yield sample
python
def text2text_generate_encoded(sample_generator, vocab, targets_vocab=None, has_inputs=True, inputs_prefix="", targets_prefix=""): """Encode Text2Text samples from the generator with the vocab.""" targets_vocab = targets_vocab or vocab for sample in sample_generator: if has_inputs: sample["inputs"] = vocab.encode(inputs_prefix + sample["inputs"]) sample["inputs"].append(text_encoder.EOS_ID) sample["targets"] = targets_vocab.encode(targets_prefix + sample["targets"]) sample["targets"].append(text_encoder.EOS_ID) yield sample
[ "def", "text2text_generate_encoded", "(", "sample_generator", ",", "vocab", ",", "targets_vocab", "=", "None", ",", "has_inputs", "=", "True", ",", "inputs_prefix", "=", "\"\"", ",", "targets_prefix", "=", "\"\"", ")", ":", "targets_vocab", "=", "targets_vocab", "or", "vocab", "for", "sample", "in", "sample_generator", ":", "if", "has_inputs", ":", "sample", "[", "\"inputs\"", "]", "=", "vocab", ".", "encode", "(", "inputs_prefix", "+", "sample", "[", "\"inputs\"", "]", ")", "sample", "[", "\"inputs\"", "]", ".", "append", "(", "text_encoder", ".", "EOS_ID", ")", "sample", "[", "\"targets\"", "]", "=", "targets_vocab", ".", "encode", "(", "targets_prefix", "+", "sample", "[", "\"targets\"", "]", ")", "sample", "[", "\"targets\"", "]", ".", "append", "(", "text_encoder", ".", "EOS_ID", ")", "yield", "sample" ]
Encode Text2Text samples from the generator with the vocab.
[ "Encode", "Text2Text", "samples", "from", "the", "generator", "with", "the", "vocab", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L677-L691
train
Encode Text2Text samples from the generator with the vocab.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7Z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iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(152 - 104) + '\157' + chr(49) + chr(0b110100) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + '\063' + chr(0b11010 + 0o31) + chr(1216 - 1168), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\062' + chr(466 - 413), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100001 + 0o20) + '\x30' + chr(0b101111 + 0o7), 31131 - 31123), ehT0Px3KOsy9('\x30' + '\x6f' + '\066' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1763 - 1715) + '\157' + chr(54) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(53) + chr(0b11100 + 0o31), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + '\x31' + chr(186 - 138), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1349 - 1300) + chr(0b110101 + 0o1) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1548 - 1437) + chr(0b110010) + chr(1070 - 1016) + chr(51), 63061 - 63053), ehT0Px3KOsy9(chr(396 - 348) + '\157' + '\x31', 50658 - 50650), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b10111 + 0o36) + chr(0b101110 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(0b100101 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x30' + chr(1452 - 1403), ord("\x08")), ehT0Px3KOsy9(chr(2012 - 1964) + '\157' + '\x33' + '\x35' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\067' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(270 - 222) + chr(0b1101111) + chr(0b0 + 0o64), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(1238 - 1188) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(7668 - 7557) + chr(49) + chr(52) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + '\062' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(524 - 476) + chr(0b101110 + 0o101) + chr(2264 - 2215) + chr(0b110101), 7250 - 7242), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + '\063' + chr(0b100011 + 0o24) + chr(1909 - 1855), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b111 + 0o52) + '\x31' + chr(0b110110), 7039 - 7031), ehT0Px3KOsy9(chr(48) + chr(2274 - 2163) + chr(0b101101 + 0o11) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(9553 - 9442) + chr(51) + '\x33' + chr(0b110101), 36396 - 36388), ehT0Px3KOsy9(chr(709 - 661) + chr(4433 - 4322) + '\062' + '\x36' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(2956 - 2845) + chr(0b110010) + chr(54) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110010) + chr(0b11 + 0o63), 8), ehT0Px3KOsy9(chr(1147 - 1099) + chr(0b100001 + 0o116) + chr(0b110011) + chr(55) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(9603 - 9492) + chr(0b1000 + 0o51) + chr(50) + chr(51), 524 - 516), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(1904 - 1849) + chr(749 - 701), 31191 - 31183), ehT0Px3KOsy9('\060' + chr(0b10 + 0o155) + chr(2456 - 2406) + chr(0b11110 + 0o31) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101011 + 0o4) + chr(51) + '\060' + chr(700 - 646), ord("\x08")), ehT0Px3KOsy9(chr(802 - 754) + chr(0b1101111) + chr(0b110110) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2538 - 2427) + '\061' + chr(0b110101) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b110001) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110010) + chr(1806 - 1752), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + chr(301 - 248) + chr(0b110 + 0o52), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'J'), '\x64' + chr(0b1000 + 0o135) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(4950 - 4849))('\x75' + '\164' + '\146' + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def udEQqaGv74oS(DGZLyTBpnwEV, mSU6gEqYPk2T, GpnyPjDizdlO=None, qu4HiXSHnlzD=ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(1172 - 1123), 8), GMGYjQRboN8I=xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(2137 - 2037) + chr(101) + chr(0b1001101 + 0o26) + chr(0b1101111) + chr(4392 - 4292) + '\x65')(chr(0b1110101) + chr(0b111001 + 0o73) + chr(0b1100110) + chr(45) + '\x38'), N8eD4IErOFrM=xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(9364 - 9264) + chr(0b1100101) + chr(8243 - 8144) + '\x6f' + chr(100) + chr(0b11000 + 0o115))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b11101 + 0o20) + '\x38')): GpnyPjDizdlO = GpnyPjDizdlO or mSU6gEqYPk2T for aBu4gMMQp6Jg in DGZLyTBpnwEV: if qu4HiXSHnlzD: aBu4gMMQp6Jg[xafqLlk3kkUe(SXOLrMavuUCe(b'\r\xb6\xe53FG'), chr(0b1100100) + chr(101) + '\x63' + '\x6f' + '\144' + '\x65')(chr(117) + chr(0b1000101 + 0o57) + chr(0b1100110) + '\x2d' + chr(0b111000))] = mSU6gEqYPk2T.encode(GMGYjQRboN8I + aBu4gMMQp6Jg[xafqLlk3kkUe(SXOLrMavuUCe(b'\r\xb6\xe53FG'), chr(0b110001 + 0o63) + chr(0b1000 + 0o135) + chr(99) + '\x6f' + '\x64' + chr(8897 - 8796))(chr(6895 - 6778) + '\x74' + '\x66' + chr(0b11010 + 0o23) + chr(84 - 28))]) xafqLlk3kkUe(aBu4gMMQp6Jg[xafqLlk3kkUe(SXOLrMavuUCe(b'\r\xb6\xe53FG'), chr(100) + chr(9437 - 9336) + '\143' + '\x6f' + chr(100) + chr(101))(chr(117) + '\x74' + chr(102) + chr(0b11001 + 0o24) + chr(56))], xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xa8\xe5#\\P'), chr(0b1010110 + 0o16) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(0b1011101 + 0o7) + chr(0b100111 + 0o76))(chr(0b1000011 + 0o62) + chr(116) + '\x66' + '\055' + chr(0b100110 + 0o22)))(xafqLlk3kkUe(nCRDzZ_Is9fz, xafqLlk3kkUe(SXOLrMavuUCe(b'!\x97\xc6\x19{p'), chr(0b1110 + 0o126) + '\x65' + '\x63' + '\x6f' + chr(2642 - 2542) + chr(6490 - 6389))(chr(117) + chr(0b1100001 + 0o23) + chr(0b1100110) + chr(0b101101) + chr(56)))) aBu4gMMQp6Jg[xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xb9\xe7!W@^'), '\x64' + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b1001011 + 0o31) + chr(493 - 392))(chr(0b1001111 + 0o46) + '\164' + chr(4598 - 4496) + chr(0b101101) + '\x38')] = GpnyPjDizdlO.encode(N8eD4IErOFrM + aBu4gMMQp6Jg[xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xb9\xe7!W@^'), chr(3168 - 3068) + '\145' + chr(0b1011111 + 0o4) + chr(0b1101111) + '\144' + chr(101))(chr(0b1110101) + '\x74' + '\146' + chr(1857 - 1812) + chr(0b110110 + 0o2))]) xafqLlk3kkUe(aBu4gMMQp6Jg[xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xb9\xe7!W@^'), '\144' + '\x65' + chr(99) + chr(0b10010 + 0o135) + chr(100) + chr(4688 - 4587))(chr(8582 - 8465) + '\164' + chr(7189 - 7087) + '\055' + chr(0b111000))], xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xa8\xe5#\\P'), '\x64' + chr(9271 - 9170) + chr(99) + chr(7824 - 7713) + '\x64' + chr(0b1001011 + 0o32))(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(1963 - 1918) + chr(0b111000)))(xafqLlk3kkUe(nCRDzZ_Is9fz, xafqLlk3kkUe(SXOLrMavuUCe(b'!\x97\xc6\x19{p'), chr(6954 - 6854) + chr(0b1100 + 0o131) + '\143' + chr(111) + chr(0b1100100) + chr(7612 - 7511))(chr(0b1110101) + chr(1497 - 1381) + chr(0b1100110) + chr(45) + chr(0b10100 + 0o44)))) yield aBu4gMMQp6Jg
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
Text2TextProblem._pack_fn
def _pack_fn(self): """For packed datasets, returns a function to pack examples. Returns: None or a function from list of TFRecords to list of TFRecords """ if not self.packed_length: return None def my_fn(records): """Function from list of TFRecords to list of TFRecords.""" examples = [] for record in records: x = tf.train.Example() x.ParseFromString(record) example_dict = {} if self.has_inputs: example_dict["inputs"] = [ int(i) for i in x.features.feature["inputs"].int64_list.value] example_dict["targets"] = [ int(i) for i in x.features.feature["targets"].int64_list.value] examples.append(example_dict) examples = list(self._maybe_pack_examples(examples)) return [ generator_utils.to_example(x).SerializeToString() for x in examples] return my_fn
python
def _pack_fn(self): """For packed datasets, returns a function to pack examples. Returns: None or a function from list of TFRecords to list of TFRecords """ if not self.packed_length: return None def my_fn(records): """Function from list of TFRecords to list of TFRecords.""" examples = [] for record in records: x = tf.train.Example() x.ParseFromString(record) example_dict = {} if self.has_inputs: example_dict["inputs"] = [ int(i) for i in x.features.feature["inputs"].int64_list.value] example_dict["targets"] = [ int(i) for i in x.features.feature["targets"].int64_list.value] examples.append(example_dict) examples = list(self._maybe_pack_examples(examples)) return [ generator_utils.to_example(x).SerializeToString() for x in examples] return my_fn
[ "def", "_pack_fn", "(", "self", ")", ":", "if", "not", "self", ".", "packed_length", ":", "return", "None", "def", "my_fn", "(", "records", ")", ":", "\"\"\"Function from list of TFRecords to list of TFRecords.\"\"\"", "examples", "=", "[", "]", "for", "record", "in", "records", ":", "x", "=", "tf", ".", "train", ".", "Example", "(", ")", "x", ".", "ParseFromString", "(", "record", ")", "example_dict", "=", "{", "}", "if", "self", ".", "has_inputs", ":", "example_dict", "[", "\"inputs\"", "]", "=", "[", "int", "(", "i", ")", "for", "i", "in", "x", ".", "features", ".", "feature", "[", "\"inputs\"", "]", ".", "int64_list", ".", "value", "]", "example_dict", "[", "\"targets\"", "]", "=", "[", "int", "(", "i", ")", "for", "i", "in", "x", ".", "features", ".", "feature", "[", "\"targets\"", "]", ".", "int64_list", ".", "value", "]", "examples", ".", "append", "(", "example_dict", ")", "examples", "=", "list", "(", "self", ".", "_maybe_pack_examples", "(", "examples", ")", ")", "return", "[", "generator_utils", ".", "to_example", "(", "x", ")", ".", "SerializeToString", "(", ")", "for", "x", "in", "examples", "]", "return", "my_fn" ]
For packed datasets, returns a function to pack examples. Returns: None or a function from list of TFRecords to list of TFRecords
[ "For", "packed", "datasets", "returns", "a", "function", "to", "pack", "examples", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L263-L287
train
Returns a function to pack examples.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1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dIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1213 - 1165) + chr(111) + chr(1091 - 1039) + chr(0b101101 + 0o6), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\x30' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(2057 - 2009) + chr(0b110010 + 0o75) + '\x33' + chr(0b110100) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(2273 - 2225) + chr(111) + chr(0b11001 + 0o30) + chr(0b101110 + 0o2) + chr(650 - 602), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(50) + chr(0b11111 + 0o23), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\065' + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101111 + 0o100) + chr(1605 - 1555) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(2872 - 2761) + chr(49) + chr(1045 - 993) + chr(0b110100), 11729 - 11721), ehT0Px3KOsy9('\060' + chr(111) + chr(54) + chr(1200 - 1147), 0o10), ehT0Px3KOsy9(chr(1806 - 1758) + '\x6f' + '\063' + chr(0b110011) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(6456 - 6345) + '\x32' + '\064' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1270 - 1222) + '\x6f' + chr(49) + '\067' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(52) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b110111) + '\x34', 49354 - 49346), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11110 + 0o23) + '\x32' + chr(2172 - 2122), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + '\064' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100111 + 0o12) + chr(52) + chr(0b101000 + 0o14), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x30' + chr(1748 - 1695), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(6965 - 6854) + '\063' + '\062' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b101111 + 0o1) + chr(0b101100 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(51) + chr(48) + chr(0b110000), 4307 - 4299), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + '\x32' + chr(51) + chr(392 - 344), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\x32' + '\065', 17108 - 17100), ehT0Px3KOsy9('\x30' + chr(3542 - 3431) + chr(2241 - 2191) + chr(0b110010) + '\x33', 64688 - 64680), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110001) + chr(954 - 905), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(1942 - 1893) + '\065' + chr(54), 0b1000), ehT0Px3KOsy9(chr(730 - 682) + '\x6f' + chr(0b10 + 0o61) + chr(52) + chr(0b1111 + 0o46), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(1532 - 1482) + chr(0b100010 + 0o24), 23613 - 23605), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x32' + chr(1280 - 1230), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10000 + 0o47) + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(55) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(318 - 207) + chr(0b1000 + 0o53) + '\x35' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1500 - 1452) + chr(0b111001 + 0o66) + chr(1051 - 1001) + chr(0b11011 + 0o34), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1001 + 0o52) + chr(671 - 617) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3239 - 3128) + chr(51) + '\x30' + '\x31', 0o10), ehT0Px3KOsy9(chr(2139 - 2091) + '\157' + chr(0b110011) + '\x34' + chr(0b110100), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(55) + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + '\061' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(11531 - 11420) + chr(0b101001 + 0o11) + chr(1770 - 1718) + chr(1049 - 999), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + '\063' + chr(0b110000) + '\x32', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(53) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\r'), chr(0b1100100) + '\145' + '\x63' + '\157' + '\144' + chr(0b1 + 0o144))(chr(0b111011 + 0o72) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(2425 - 2369)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TLj3bLxkl7lb(oVre8I6UXc3b): if not xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'S\xe4\x83+\xb7HK\x08P\xb2\xc2\x0e\x8d'), '\144' + '\145' + chr(0b1100011) + chr(0b1100101 + 0o12) + chr(5848 - 5748) + chr(0b1100010 + 0o3))(chr(0b1111 + 0o146) + chr(0b1110100) + chr(0b1110 + 0o130) + chr(1605 - 1560) + '\x38')): return None def Vbv2x2o0I6xb(mov_6OW2Bcur): uyAR7jUe1VQb = [] for SIWbn6wzltxD in mov_6OW2Bcur: OeWW0F1dBPRQ = IDJ2eXGCBCDu.train.Example() xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b's\xe4\x923\xb7jf\x0bX\x8f\xd1\x08\x8c\x925'), chr(8600 - 8500) + '\x65' + chr(0b10110 + 0o115) + '\x6f' + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(0b1000111 + 0o37) + '\055' + '\070'))(SIWbn6wzltxD) p4j1OeKQeIIo = {} if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'K\xe4\x93\x1f\xbbBd\x11A\xaf'), chr(9086 - 8986) + '\145' + chr(99) + '\157' + chr(5089 - 4989) + '\x65')(chr(0b1110101) + chr(0b1001010 + 0o52) + chr(0b1100110) + chr(0b101101) + chr(56))): p4j1OeKQeIIo[xafqLlk3kkUe(SXOLrMavuUCe(b'J\xeb\x905\xa6_'), chr(0b1100100) + chr(0b101111 + 0o66) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b1001000 + 0o55) + '\164' + '\146' + '\x2d' + '\x38')] = [ehT0Px3KOsy9(WVxHKyX45z_L) for WVxHKyX45z_L in OeWW0F1dBPRQ.features.feature[xafqLlk3kkUe(SXOLrMavuUCe(b'J\xeb\x905\xa6_'), chr(100) + '\145' + chr(7314 - 7215) + chr(1835 - 1724) + chr(7171 - 7071) + '\x65')('\x75' + chr(0b1001001 + 0o53) + chr(0b1100110) + chr(0b100100 + 0o11) + chr(0b10000 + 0o50))].int64_list.QmmgWUB13VCJ] p4j1OeKQeIIo[xafqLlk3kkUe(SXOLrMavuUCe(b"W\xe4\x92'\xb7Xg"), chr(100) + chr(0b1100101) + chr(0b10100 + 0o117) + '\x6f' + '\x64' + chr(8420 - 8319))(chr(0b1011010 + 0o33) + '\x74' + '\x66' + chr(45) + chr(0b111 + 0o61))] = [ehT0Px3KOsy9(WVxHKyX45z_L) for WVxHKyX45z_L in OeWW0F1dBPRQ.features.feature[xafqLlk3kkUe(SXOLrMavuUCe(b"W\xe4\x92'\xb7Xg"), chr(9503 - 9403) + '\145' + chr(0b1100011) + chr(1581 - 1470) + chr(0b1100100) + chr(7215 - 7114))('\165' + chr(0b1101000 + 0o14) + chr(0b1100110) + '\055' + chr(152 - 96))].int64_list.QmmgWUB13VCJ] xafqLlk3kkUe(uyAR7jUe1VQb, xafqLlk3kkUe(SXOLrMavuUCe(b'B\xf5\x90%\xbcH'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(1090 - 979) + chr(0b110100 + 0o60) + chr(3928 - 3827))(chr(0b1110101) + '\164' + '\x66' + '\055' + chr(0b1 + 0o67)))(p4j1OeKQeIIo) uyAR7jUe1VQb = YyaZ4tpXu4lf(oVre8I6UXc3b._maybe_pack_examples(uyAR7jUe1VQb)) return [xafqLlk3kkUe(g1Z_RG9zP4cD.to_example(OeWW0F1dBPRQ), xafqLlk3kkUe(SXOLrMavuUCe(b'p\xe0\x92)\xb3@}\x1eP\x88\xca)\x91\x8e;\x8a\x03'), '\144' + '\x65' + '\143' + chr(0b1101111) + chr(100) + chr(0b10010 + 0o123))(chr(0b110010 + 0o103) + chr(0b111101 + 0o67) + '\x66' + chr(820 - 775) + chr(0b111000)))() for OeWW0F1dBPRQ in uyAR7jUe1VQb] return Vbv2x2o0I6xb
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
Text2TextProblem._maybe_pack_examples
def _maybe_pack_examples(self, generator): """Wraps generator with packer if self.packed_length.""" if not self.packed_length: return generator return generator_utils.pack_examples( generator, self.has_inputs, self.packed_length, spacing=self.packed_spacing, chop_long_sequences=not self.has_inputs)
python
def _maybe_pack_examples(self, generator): """Wraps generator with packer if self.packed_length.""" if not self.packed_length: return generator return generator_utils.pack_examples( generator, self.has_inputs, self.packed_length, spacing=self.packed_spacing, chop_long_sequences=not self.has_inputs)
[ "def", "_maybe_pack_examples", "(", "self", ",", "generator", ")", ":", "if", "not", "self", ".", "packed_length", ":", "return", "generator", "return", "generator_utils", ".", "pack_examples", "(", "generator", ",", "self", ".", "has_inputs", ",", "self", ".", "packed_length", ",", "spacing", "=", "self", ".", "packed_spacing", ",", "chop_long_sequences", "=", "not", "self", ".", "has_inputs", ")" ]
Wraps generator with packer if self.packed_length.
[ "Wraps", "generator", "with", "packer", "if", "self", ".", "packed_length", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L289-L298
train
Wraps generator with packer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKf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ProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + chr(0b100010 + 0o20) + '\061' + '\x33', 40380 - 40372), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(51) + chr(0b11111 + 0o21), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(5946 - 5835) + chr(0b110001) + chr(865 - 814) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\064' + chr(0b100 + 0o54), 21239 - 21231), ehT0Px3KOsy9(chr(0b110000) + chr(0b111011 + 0o64) + '\065' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1598 - 1548) + '\067' + chr(0b110011), 61612 - 61604), ehT0Px3KOsy9(chr(1522 - 1474) + chr(0b1011100 + 0o23) + '\x32' + chr(48) + chr(0b101100 + 0o10), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(1310 - 1258) + '\061', 0o10), ehT0Px3KOsy9(chr(1342 - 1294) + '\157' + chr(0b10001 + 0o46) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(6866 - 6755) + chr(872 - 821) + chr(0b110010) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(468 - 417) + '\060' + chr(0b100111 + 0o12), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100 + 0o143) + chr(1639 - 1590) + chr(0b11000 + 0o33) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(8593 - 8482) + '\063' + chr(1342 - 1288) + chr(49), 0o10), ehT0Px3KOsy9(chr(2237 - 2189) + '\157' + chr(0b11011 + 0o31) + chr(49), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b10110 + 0o40) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100110 + 0o13) + chr(0b110001) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x36' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1758 - 1710) + chr(0b1101111) + chr(53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1605 - 1555) + chr(50) + '\x35', 20243 - 20235), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(0b0 + 0o62) + chr(51) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(68 - 17) + chr(2955 - 2900) + chr(746 - 695), 10901 - 10893), ehT0Px3KOsy9(chr(0b110000) + chr(4039 - 3928) + chr(1001 - 946) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1915 - 1867) + chr(0b1101111) + chr(0b110110) + chr(0b101111 + 0o4), 8), ehT0Px3KOsy9(chr(1842 - 1794) + chr(0b1000001 + 0o56) + '\062' + '\x35' + '\x32', 45198 - 45190), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b10111 + 0o130) + chr(0b110001) + chr(2338 - 2285) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9878 - 9767) + '\x33' + chr(0b110001 + 0o6), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110001) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1526 - 1476) + chr(1969 - 1921) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(438 - 385) + chr(0b10000 + 0o44), 0o10), ehT0Px3KOsy9('\x30' + chr(8117 - 8006) + chr(50) + chr(0b110010 + 0o1) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(140 - 91) + chr(0b110 + 0o55) + chr(52), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\x35' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(9392 - 9281) + '\x33' + chr(0b110001 + 0o0) + chr(52), 22985 - 22977), ehT0Px3KOsy9('\x30' + chr(6858 - 6747) + chr(49) + chr(1507 - 1457) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(53) + chr(53), 8), ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + chr(2316 - 2267) + chr(0b110011) + chr(659 - 608), 36780 - 36772), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\x34' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100100 + 0o13) + chr(1401 - 1352) + '\066' + chr(0b110010), 18269 - 18261), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x31' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1420 - 1370) + chr(51) + chr(704 - 655), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(53) + chr(1579 - 1531), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5'), chr(0b1010100 + 0o20) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(1859 - 1814) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def YdPBl4lpJSX7(oVre8I6UXc3b, bTFcxMKbQoFz): if not xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb99\x0bN\xdf\xdbM\\\xbb\xa6(\x99'), '\144' + chr(0b101010 + 0o73) + '\x63' + chr(111) + chr(7320 - 7220) + chr(0b11110 + 0o107))(chr(0b1011100 + 0o31) + '\164' + '\x66' + chr(0b101101) + chr(240 - 184))): return bTFcxMKbQoFz return xafqLlk3kkUe(g1Z_RG9zP4cD, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb99\x0bt\xde\xfc@T\xa5\xad9\x82'), chr(0b1100100) + chr(101) + '\143' + chr(111) + chr(100) + chr(101))('\165' + chr(0b110110 + 0o76) + chr(102) + '\055' + chr(0b10 + 0o66)))(bTFcxMKbQoFz, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe39)?B\xd5\xf4TM\xa6'), chr(0b1100100) + '\145' + '\143' + '\157' + chr(100) + '\145')(chr(0b1100001 + 0o24) + '\x74' + chr(0b101011 + 0o73) + '\055' + '\070')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb99\x0bN\xdf\xdbM\\\xbb\xa6(\x99'), chr(100) + chr(101) + chr(99) + '\x6f' + chr(0b1100100) + chr(9102 - 9001))('\165' + '\164' + chr(0b1100110) + chr(0b100001 + 0o14) + chr(56))), spacing=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb99\x0bN\xdf\xdbRI\xb4\xa25\x9fF'), chr(100) + chr(0b1100101) + '\x63' + chr(0b1000110 + 0o51) + '\144' + '\145')(chr(0b1110101) + chr(116) + '\146' + '\x2d' + chr(1736 - 1680))), chop_long_sequences=not xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe39)?B\xd5\xf4TM\xa6'), chr(100) + chr(101) + '\x63' + '\157' + chr(100) + chr(9196 - 9095))(chr(12570 - 12453) + chr(0b1011110 + 0o26) + '\x66' + chr(0b101101) + chr(56))))
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
ChoppedTextProblem.text_filepaths_for_task
def text_filepaths_for_task(self, tmp_dir, task_id): """List of input filepaths for a particular training or dev shard. Args: tmp_dir: a string task_id: an integer less than self.num_shards Returns: a list of tuples (filepath, start_pos, num_bytes) """ assert task_id >= 0 assert task_id < self.num_train_shards + self.num_dev_shards if task_id < self.num_train_shards: return [ f for i, f in enumerate(self.train_text_filepaths(tmp_dir)) if i % self.num_train_shards == task_id ] else: return [ f for i, f in enumerate(self.dev_text_filepaths(tmp_dir)) if i % self.num_dev_shards == task_id - self.num_train_shards ]
python
def text_filepaths_for_task(self, tmp_dir, task_id): """List of input filepaths for a particular training or dev shard. Args: tmp_dir: a string task_id: an integer less than self.num_shards Returns: a list of tuples (filepath, start_pos, num_bytes) """ assert task_id >= 0 assert task_id < self.num_train_shards + self.num_dev_shards if task_id < self.num_train_shards: return [ f for i, f in enumerate(self.train_text_filepaths(tmp_dir)) if i % self.num_train_shards == task_id ] else: return [ f for i, f in enumerate(self.dev_text_filepaths(tmp_dir)) if i % self.num_dev_shards == task_id - self.num_train_shards ]
[ "def", "text_filepaths_for_task", "(", "self", ",", "tmp_dir", ",", "task_id", ")", ":", "assert", "task_id", ">=", "0", "assert", "task_id", "<", "self", ".", "num_train_shards", "+", "self", ".", "num_dev_shards", "if", "task_id", "<", "self", ".", "num_train_shards", ":", "return", "[", "f", "for", "i", ",", "f", "in", "enumerate", "(", "self", ".", "train_text_filepaths", "(", "tmp_dir", ")", ")", "if", "i", "%", "self", ".", "num_train_shards", "==", "task_id", "]", "else", ":", "return", "[", "f", "for", "i", ",", "f", "in", "enumerate", "(", "self", ".", "dev_text_filepaths", "(", "tmp_dir", ")", ")", "if", "i", "%", "self", ".", "num_dev_shards", "==", "task_id", "-", "self", ".", "num_train_shards", "]" ]
List of input filepaths for a particular training or dev shard. Args: tmp_dir: a string task_id: an integer less than self.num_shards Returns: a list of tuples (filepath, start_pos, num_bytes)
[ "List", "of", "input", "filepaths", "for", "a", "particular", "training", "or", "dev", "shard", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L831-L851
train
Returns a list of input filepaths for a particular training or dev shard.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,o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IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b110110) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(53) + chr(0b110100 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b0 + 0o63) + chr(0b10000 + 0o47) + '\065', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + '\065' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(10502 - 10391) + chr(624 - 573) + '\062' + '\065', 25592 - 25584), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(52) + chr(0b10110 + 0o32), 55915 - 55907), ehT0Px3KOsy9(chr(48) + chr(3999 - 3888) + chr(0b1101 + 0o46) + chr(55) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + chr(745 - 691) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1110 + 0o45) + chr(0b110011) + '\x34', 19677 - 19669), ehT0Px3KOsy9(chr(2232 - 2184) + chr(738 - 627) + chr(0b110010) + chr(0b110101) + chr(0b11001 + 0o31), 56038 - 56030), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(53) + chr(856 - 806), 7025 - 7017), ehT0Px3KOsy9(chr(542 - 494) + '\157' + '\061' + '\060' + chr(1119 - 1065), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1876 - 1765) + chr(1270 - 1221) + chr(51) + chr(0b1111 + 0o46), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(573 - 522) + '\066', 47981 - 47973), ehT0Px3KOsy9(chr(1623 - 1575) + '\157' + '\062' + chr(52) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101 + 0o55) + chr(209 - 155) + chr(51), 51145 - 51137), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + '\x31' + chr(1874 - 1826) + chr(54), 8), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(0b110001 + 0o1) + '\063', 38267 - 38259), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11000 + 0o31) + chr(48) + chr(2112 - 2057), 9618 - 9610), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(50) + chr(0b110010) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(7046 - 6935) + chr(0b11 + 0o60) + chr(51) + chr(0b101001 + 0o10), 0b1000), ehT0Px3KOsy9(chr(2228 - 2180) + chr(111) + chr(50) + chr(0b101 + 0o62) + '\063', 53233 - 53225), ehT0Px3KOsy9(chr(1206 - 1158) + '\157' + chr(0b110011) + chr(1599 - 1551) + chr(55), 29253 - 29245), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100011 + 0o22) + chr(54), 45667 - 45659), ehT0Px3KOsy9(chr(596 - 548) + '\157' + chr(1816 - 1767) + chr(0b110 + 0o60) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(0b110101) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110100) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011000 + 0o27) + chr(0b101001 + 0o11) + chr(0b11010 + 0o30) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(50) + '\x37' + chr(0b100100 + 0o17), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(52) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1383 - 1333) + chr(52) + '\064', 578 - 570), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(0b1101 + 0o44) + chr(49) + '\066', 30213 - 30205), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(1835 - 1784) + chr(0b101001 + 0o11) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100011 + 0o114) + chr(0b110001) + chr(51), 51230 - 51222), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + chr(50) + chr(2788 - 2733) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1142 - 1094) + chr(0b1101111) + chr(0b110010 + 0o0) + chr(836 - 785) + chr(0b10101 + 0o37), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(69 - 14) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + '\061' + chr(0b1111 + 0o41) + chr(384 - 331), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(0b101000 + 0o14) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(2053 - 2005) + chr(8983 - 8872) + chr(2796 - 2743), 12946 - 12938)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b11 + 0o154) + chr(0b10111 + 0o36) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xdc'), chr(2293 - 2193) + chr(6031 - 5930) + chr(0b1100011) + '\x6f' + chr(0b1001100 + 0o30) + '\x65')('\165' + '\164' + chr(102) + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def uunjNu3giRKg(oVre8I6UXc3b, JsZ36NJUqtml, h_MwKIdeQ6Ce): assert h_MwKIdeQ6Ce >= ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + '\x30', 0o10) assert h_MwKIdeQ6Ce < xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x1b\x90\xf0\xa1\x12\x9dX\xb2\xf5\x19.<\xac\xc4\xc0'), '\x64' + chr(101) + '\x63' + chr(111) + chr(100) + '\x65')(chr(117) + '\164' + '\x66' + '\x2d' + chr(56))) + xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x1b\x90\xf0\xb1\x05\x8an\xaf\xc2\x0b49\xad'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(7183 - 7072) + '\144' + chr(9527 - 9426))('\x75' + '\164' + chr(0b10000 + 0o126) + chr(921 - 876) + chr(0b100111 + 0o21))) if h_MwKIdeQ6Ce < xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x1b\x90\xf0\xa1\x12\x9dX\xb2\xf5\x19.<\xac\xc4\xc0'), chr(9200 - 9100) + chr(2286 - 2185) + chr(3468 - 3369) + chr(633 - 522) + '\x64' + chr(0b100101 + 0o100))(chr(11840 - 11723) + chr(0b11000 + 0o134) + chr(0b1100110) + '\x2d' + chr(0b110010 + 0o6))): return [EGyt1xfPT1P6 for (WVxHKyX45z_L, EGyt1xfPT1P6) in YlkZvXL8qwsX(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"\x86\x1c\x9c\xc6\xbb?\x88T\xa4\xde5 4\xb2\xc5\xc3'g/\xe2"), chr(0b1100100) + chr(5005 - 4904) + chr(0b111111 + 0o44) + '\157' + chr(0b1100100) + chr(5641 - 5540))(chr(0b110110 + 0o77) + '\164' + chr(102) + '\055' + '\070'))(JsZ36NJUqtml)) if WVxHKyX45z_L % xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x1b\x90\xf0\xa1\x12\x9dX\xb2\xf5\x19.<\xac\xc4\xc0'), chr(0b1100100) + '\x65' + chr(99) + '\157' + '\144' + chr(101))(chr(12362 - 12245) + chr(0b1110100) + chr(0b11101 + 0o111) + chr(0b101101) + '\x38')) == h_MwKIdeQ6Ce] else: return [EGyt1xfPT1P6 for (WVxHKyX45z_L, EGyt1xfPT1P6) in YlkZvXL8qwsX(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x96\x0b\x8b\xf0\xa1\x05\x84E\x83\xcc\x03*8\xae\xc1\xc7.`'), chr(0b1011111 + 0o5) + chr(6495 - 6394) + chr(0b110011 + 0o60) + chr(0b1101111) + '\x64' + '\145')(chr(0b1101101 + 0o10) + chr(12129 - 12013) + chr(102) + '\055' + chr(0b111000)))(JsZ36NJUqtml)) if WVxHKyX45z_L % xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x1b\x90\xf0\xb1\x05\x8an\xaf\xc2\x0b49\xad'), chr(100) + '\145' + chr(99) + '\x6f' + chr(100) + chr(0b1100101))(chr(7132 - 7015) + chr(0b1110100) + chr(0b1001101 + 0o31) + chr(1048 - 1003) + chr(56))) == h_MwKIdeQ6Ce - xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x1b\x90\xf0\xa1\x12\x9dX\xb2\xf5\x19.<\xac\xc4\xc0'), chr(100) + '\145' + '\x63' + '\157' + chr(0b101001 + 0o73) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(102) + chr(0b101101) + '\x38'))]
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
ChoppedTextProblem.filepath_to_unicode_strings
def filepath_to_unicode_strings(self, filepath): """Read text out of an input file. The default just reads the text, converts to unicode and yields one unicode string. Subclasses can override this function in order to preprocess, and can yield any number of strings. Args: filepath: a string Yields: unicode strings. """ f = tf.gfile.Open(filepath) b = f.read() yield text_encoder.to_unicode_ignore_errors(b)
python
def filepath_to_unicode_strings(self, filepath): """Read text out of an input file. The default just reads the text, converts to unicode and yields one unicode string. Subclasses can override this function in order to preprocess, and can yield any number of strings. Args: filepath: a string Yields: unicode strings. """ f = tf.gfile.Open(filepath) b = f.read() yield text_encoder.to_unicode_ignore_errors(b)
[ "def", "filepath_to_unicode_strings", "(", "self", ",", "filepath", ")", ":", "f", "=", "tf", ".", "gfile", ".", "Open", "(", "filepath", ")", "b", "=", "f", ".", "read", "(", ")", "yield", "text_encoder", ".", "to_unicode_ignore_errors", "(", "b", ")" ]
Read text out of an input file. The default just reads the text, converts to unicode and yields one unicode string. Subclasses can override this function in order to preprocess, and can yield any number of strings. Args: filepath: a string Yields: unicode strings.
[ "Read", "text", "out", "of", "an", "input", "file", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L853-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zwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(8323 - 8212) + chr(50) + chr(55) + chr(1653 - 1598), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101101 + 0o102) + chr(50) + chr(1520 - 1469) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + chr(2891 - 2836) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x37' + chr(48), 41014 - 41006), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(6471 - 6360) + chr(0b110011) + chr(0b110010), 59272 - 59264), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(0b11111 + 0o24) + chr(52) + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110100) + chr(307 - 254), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3326 - 3215) + chr(0b101101 + 0o4) + '\065', 7327 - 7319), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\064' + chr(53), 0b1000), ehT0Px3KOsy9(chr(84 - 36) + chr(111) + chr(51) + chr(0b110001) + chr(0b110000 + 0o0), 15247 - 15239), ehT0Px3KOsy9('\x30' + chr(11698 - 11587) + '\061' + '\063' + chr(55), 44066 - 44058), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(0b110001) + chr(0b110100) + chr(1044 - 991), 34878 - 34870), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(0b110011) + chr(0b11110 + 0o24), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(7947 - 7836) + '\062' + '\063' + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(5218 - 5107) + chr(960 - 911) + chr(1347 - 1297) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(64 - 13) + chr(49) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b110010) + chr(0b101111 + 0o4), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101 + 0o54) + '\066' + chr(50), 63232 - 63224), ehT0Px3KOsy9(chr(2237 - 2189) + chr(10694 - 10583) + '\065' + chr(2537 - 2482), 17302 - 17294), ehT0Px3KOsy9(chr(0b110000) + chr(8364 - 8253) + chr(49) + '\066' + '\067', 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(0b110001) + chr(2051 - 2003) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1010010 + 0o35) + chr(52) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100011 + 0o16) + chr(0b110010) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1942 - 1891) + chr(0b110101) + chr(0b110001 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b101001 + 0o106) + chr(1616 - 1566) + '\062', 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(50) + chr(0b110110 + 0o1) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\x32' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b101010 + 0o10) + chr(0b110001 + 0o5) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\x36' + chr(0b101 + 0o54), 53175 - 53167), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(55) + '\067', 8878 - 8870), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100000 + 0o21) + chr(0b110111) + chr(930 - 882), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(821 - 771) + chr(2330 - 2275) + '\x34', 28689 - 28681), ehT0Px3KOsy9(chr(48) + chr(500 - 389) + '\x33' + chr(1330 - 1276) + chr(0b11110 + 0o27), 5039 - 5031), ehT0Px3KOsy9(chr(1253 - 1205) + chr(111) + chr(0b110010) + '\067' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101110 + 0o1) + chr(0b110000 + 0o2) + chr(0b11111 + 0o24) + chr(802 - 754), 17360 - 17352), ehT0Px3KOsy9(chr(48) + chr(9788 - 9677) + '\062' + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110 + 0o55) + chr(0b101110 + 0o6) + '\065', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110010) + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b1 + 0o64) + chr(0b1000 + 0o51), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + '\065' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x91'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(0b1000000 + 0o57) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1110100) + '\x66' + chr(0b10010 + 0o33) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Sxt2fFIL3KH2(oVre8I6UXc3b, D3zslhgxMHWQ): EGyt1xfPT1P6 = IDJ2eXGCBCDu.gfile.Open(D3zslhgxMHWQ) wmN3dvez4qzC = EGyt1xfPT1P6.U6MiWrhuCi2Y() yield xafqLlk3kkUe(nCRDzZ_Is9fz, xafqLlk3kkUe(SXOLrMavuUCe(b"\xcb\xf6`\x8dt\x8f\xc6b\x81\xad\x00\x0c`4\xf1'\xac\x8c\x17]\x05+V$"), '\144' + '\x65' + '\x63' + '\157' + '\144' + chr(101))(chr(0b1110101) + chr(2610 - 2494) + chr(0b1100110) + chr(953 - 908) + chr(1521 - 1465)))(wmN3dvez4qzC)
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
ChoppedTextProblem.file_generator
def file_generator(self, filepaths, max_chars_per_file=None, max_chars_total=None): """Read complete text of input files and yield unicode strings. By default, one unicode string is produced per file, but this is not guaranteed, since subclasses can override filepath_to_unicode_strings(). max_chars_per_file and max_chars_total can also be specified, in which case some strings may be truncated or dropped to limit the total amount of output. Args: filepaths: a list of strings max_chars_per_file: an optional integer max_chars_total: an optional integer Yields: unicode strings """ chars_total = 0 for fname in filepaths: chars_this_file = 0 tf.logging.info("reading file %s" % fname) for text in self.filepath_to_unicode_strings(fname): if (max_chars_per_file and chars_this_file + len(text) > max_chars_per_file): text = text[:max_chars_per_file - chars_this_file] if max_chars_total and chars_total + len(text) > max_chars_total: text = text[:max_chars_total - chars_total] chars_total += len(text) chars_this_file += len(text) if text: yield text if max_chars_total and chars_total >= max_chars_total: return if max_chars_per_file and chars_this_file >= max_chars_per_file: break
python
def file_generator(self, filepaths, max_chars_per_file=None, max_chars_total=None): """Read complete text of input files and yield unicode strings. By default, one unicode string is produced per file, but this is not guaranteed, since subclasses can override filepath_to_unicode_strings(). max_chars_per_file and max_chars_total can also be specified, in which case some strings may be truncated or dropped to limit the total amount of output. Args: filepaths: a list of strings max_chars_per_file: an optional integer max_chars_total: an optional integer Yields: unicode strings """ chars_total = 0 for fname in filepaths: chars_this_file = 0 tf.logging.info("reading file %s" % fname) for text in self.filepath_to_unicode_strings(fname): if (max_chars_per_file and chars_this_file + len(text) > max_chars_per_file): text = text[:max_chars_per_file - chars_this_file] if max_chars_total and chars_total + len(text) > max_chars_total: text = text[:max_chars_total - chars_total] chars_total += len(text) chars_this_file += len(text) if text: yield text if max_chars_total and chars_total >= max_chars_total: return if max_chars_per_file and chars_this_file >= max_chars_per_file: break
[ "def", "file_generator", "(", "self", ",", "filepaths", ",", "max_chars_per_file", "=", "None", ",", "max_chars_total", "=", "None", ")", ":", "chars_total", "=", "0", "for", "fname", "in", "filepaths", ":", "chars_this_file", "=", "0", "tf", ".", "logging", ".", "info", "(", "\"reading file %s\"", "%", "fname", ")", "for", "text", "in", "self", ".", "filepath_to_unicode_strings", "(", "fname", ")", ":", "if", "(", "max_chars_per_file", "and", "chars_this_file", "+", "len", "(", "text", ")", ">", "max_chars_per_file", ")", ":", "text", "=", "text", "[", ":", "max_chars_per_file", "-", "chars_this_file", "]", "if", "max_chars_total", "and", "chars_total", "+", "len", "(", "text", ")", ">", "max_chars_total", ":", "text", "=", "text", "[", ":", "max_chars_total", "-", "chars_total", "]", "chars_total", "+=", "len", "(", "text", ")", "chars_this_file", "+=", "len", "(", "text", ")", "if", "text", ":", "yield", "text", "if", "max_chars_total", "and", "chars_total", ">=", "max_chars_total", ":", "return", "if", "max_chars_per_file", "and", "chars_this_file", ">=", "max_chars_per_file", ":", "break" ]
Read complete text of input files and yield unicode strings. By default, one unicode string is produced per file, but this is not guaranteed, since subclasses can override filepath_to_unicode_strings(). max_chars_per_file and max_chars_total can also be specified, in which case some strings may be truncated or dropped to limit the total amount of output. Args: filepaths: a list of strings max_chars_per_file: an optional integer max_chars_total: an optional integer Yields: unicode strings
[ "Read", "complete", "text", "of", "input", "files", "and", "yield", "unicode", "strings", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L871-L909
train
This is a generator function that returns unicode strings.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvso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vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\x32', 3079 - 3071), ehT0Px3KOsy9(chr(718 - 670) + chr(111) + '\x37' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\066' + chr(0b11010 + 0o30), 15247 - 15239), ehT0Px3KOsy9(chr(498 - 450) + '\x6f' + '\063' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(11405 - 11294) + chr(51) + chr(54) + chr(52), 9669 - 9661), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b110001) + chr(53), 0o10), ehT0Px3KOsy9(chr(946 - 898) + chr(0b1101111) + chr(0b10011 + 0o43) + chr(0b11111 + 0o27), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2143 - 2093) + '\x37' + '\x31', 35972 - 35964), ehT0Px3KOsy9(chr(316 - 268) + '\x6f' + chr(0b110001) + '\064' + chr(0b1110 + 0o44), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(1376 - 1322), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(746 - 696) + chr(54) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100101 + 0o15) + chr(53) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(161 - 113) + chr(111) + chr(0b110010) + chr(51) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100010 + 0o17) + chr(55) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1001001 + 0o46) + chr(0b110011) + chr(0b100001 + 0o24) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(572 - 524) + chr(0b11111 + 0o120) + chr(0b1101 + 0o44) + chr(0b110111) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b1001 + 0o53) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11366 - 11255) + chr(1590 - 1541) + chr(0b110011) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1005 - 956) + chr(611 - 558) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(0b110111) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(930 - 880) + chr(52) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(84 - 33) + chr(2423 - 2373), 14553 - 14545), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b11011 + 0o32), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101000 + 0o13) + '\x31' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(670 - 615) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(1666 - 1616) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1833 - 1785) + chr(0b1101111) + chr(1352 - 1301) + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110111 + 0o70) + chr(0b110010) + chr(0b1100 + 0o51) + chr(51), 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b11110 + 0o121) + chr(0b1001 + 0o50) + chr(0b1 + 0o65) + chr(51), 43845 - 43837), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101101 + 0o2) + chr(0b1100 + 0o46) + chr(1489 - 1435) + chr(0b100001 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(0b110011) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b10111 + 0o130) + chr(0b110001) + '\063' + chr(0b11111 + 0o23), 8), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(386 - 335) + chr(1999 - 1946) + chr(0b110 + 0o56), 9142 - 9134), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(0b110010) + chr(0b110 + 0o54) + chr(2053 - 1999), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(207 - 157) + '\060' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(49) + chr(53), 0b1000), ehT0Px3KOsy9(chr(1672 - 1624) + chr(111) + '\x33' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(2226 - 2178) + chr(8029 - 7918) + '\x37' + chr(1569 - 1519), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b110111 + 0o70) + chr(49) + '\060' + chr(0b1110 + 0o43), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(0b110101) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'<'), '\144' + chr(6067 - 5966) + '\x63' + '\x6f' + '\144' + chr(0b1100101))(chr(3514 - 3397) + chr(116) + '\x66' + chr(45) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def NljFTTMdWaKO(oVre8I6UXc3b, rBVWXSgCDxnr, T_mSslnBJv8J=None, diCCEXT78b1Q=None): iJI3GfB6ohVF = ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(5750 - 5639) + '\060', 0b1000) for t3WbF0Ae42Pu in rBVWXSgCDxnr: m6lBJF8nTsAN = ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110000), 8) xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'A\x0e:f\x81nQ\x8e\x08z\xea\xc0'), '\144' + chr(0b1100101) + '\x63' + '\157' + chr(0b1100100) + '\x65')(chr(5332 - 5215) + '\x74' + '\146' + '\x2d' + chr(0b10010 + 0o46)))(xafqLlk3kkUe(SXOLrMavuUCe(b'`\\\x13z\x9dcQ\x99\x04\x7f\xdc\xce\xbf^\x9c'), chr(0b1100100) + chr(6442 - 6341) + chr(6438 - 6339) + chr(6851 - 6740) + '\x64' + '\145')(chr(3830 - 3713) + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(56)) % t3WbF0Ae42Pu) for Ah1rInvg48Hb in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'tP\x1e{\x84lB\xd1=b\xdf\xf4\xea\x15\x86\x1c\xce>\t&\xd5vh|\xa3\x9e`'), chr(4838 - 4738) + chr(101) + chr(99) + chr(0b1101111) + chr(2034 - 1934) + '\x65')(chr(117) + '\164' + chr(0b111000 + 0o56) + '\x2d' + chr(0b111000)))(t3WbF0Ae42Pu): if T_mSslnBJv8J and m6lBJF8nTsAN + c2A0yzQpDQB3(Ah1rInvg48Hb) > T_mSslnBJv8J: Ah1rInvg48Hb = Ah1rInvg48Hb[:T_mSslnBJv8J - m6lBJF8nTsAN] if diCCEXT78b1Q and iJI3GfB6ohVF + c2A0yzQpDQB3(Ah1rInvg48Hb) > diCCEXT78b1Q: Ah1rInvg48Hb = Ah1rInvg48Hb[:diCCEXT78b1Q - iJI3GfB6ohVF] iJI3GfB6ohVF += c2A0yzQpDQB3(Ah1rInvg48Hb) m6lBJF8nTsAN += c2A0yzQpDQB3(Ah1rInvg48Hb) if Ah1rInvg48Hb: yield Ah1rInvg48Hb if diCCEXT78b1Q and iJI3GfB6ohVF >= diCCEXT78b1Q: return if T_mSslnBJv8J and m6lBJF8nTsAN >= T_mSslnBJv8J: break
tensorflow/tensor2tensor
tensor2tensor/data_generators/text_problems.py
ChoppedTextProblem.example_generator
def example_generator(self, encoder, tmp_dir, task_id): """Generator for examples. Args: encoder: a TextEncoder tmp_dir: a string task_id: an integer Yields: feature dictionaries """ filepaths = self.text_filepaths_for_task(tmp_dir, task_id) if task_id >= self.num_train_shards: # this is dev data - limit the total length. max_chars_per_file = self.max_dev_chars // ( self.num_dev_shards * len(filepaths)) else: max_chars_per_file = None tokens = [] for ftext in self.file_generator( filepaths, max_chars_per_file=max_chars_per_file): tokens.extend(encoder.encode(ftext)) pos = 0 while pos + self.sequence_length <= len(tokens): yield {"targets": tokens[pos:pos + self.sequence_length]} pos += self.sequence_length if pos > 0: tokens = tokens[pos:] if self.remainder_policy == "pad": if tokens: targets = tokens + [0] * (self.sequence_length - len(tokens)) yield {"targets": targets} else: assert self.remainder_policy == "drop"
python
def example_generator(self, encoder, tmp_dir, task_id): """Generator for examples. Args: encoder: a TextEncoder tmp_dir: a string task_id: an integer Yields: feature dictionaries """ filepaths = self.text_filepaths_for_task(tmp_dir, task_id) if task_id >= self.num_train_shards: # this is dev data - limit the total length. max_chars_per_file = self.max_dev_chars // ( self.num_dev_shards * len(filepaths)) else: max_chars_per_file = None tokens = [] for ftext in self.file_generator( filepaths, max_chars_per_file=max_chars_per_file): tokens.extend(encoder.encode(ftext)) pos = 0 while pos + self.sequence_length <= len(tokens): yield {"targets": tokens[pos:pos + self.sequence_length]} pos += self.sequence_length if pos > 0: tokens = tokens[pos:] if self.remainder_policy == "pad": if tokens: targets = tokens + [0] * (self.sequence_length - len(tokens)) yield {"targets": targets} else: assert self.remainder_policy == "drop"
[ "def", "example_generator", "(", "self", ",", "encoder", ",", "tmp_dir", ",", "task_id", ")", ":", "filepaths", "=", "self", ".", "text_filepaths_for_task", "(", "tmp_dir", ",", "task_id", ")", "if", "task_id", ">=", "self", ".", "num_train_shards", ":", "# this is dev data - limit the total length.", "max_chars_per_file", "=", "self", ".", "max_dev_chars", "//", "(", "self", ".", "num_dev_shards", "*", "len", "(", "filepaths", ")", ")", "else", ":", "max_chars_per_file", "=", "None", "tokens", "=", "[", "]", "for", "ftext", "in", "self", ".", "file_generator", "(", "filepaths", ",", "max_chars_per_file", "=", "max_chars_per_file", ")", ":", "tokens", ".", "extend", "(", "encoder", ".", "encode", "(", "ftext", ")", ")", "pos", "=", "0", "while", "pos", "+", "self", ".", "sequence_length", "<=", "len", "(", "tokens", ")", ":", "yield", "{", "\"targets\"", ":", "tokens", "[", "pos", ":", "pos", "+", "self", ".", "sequence_length", "]", "}", "pos", "+=", "self", ".", "sequence_length", "if", "pos", ">", "0", ":", "tokens", "=", "tokens", "[", "pos", ":", "]", "if", "self", ".", "remainder_policy", "==", "\"pad\"", ":", "if", "tokens", ":", "targets", "=", "tokens", "+", "[", "0", "]", "*", "(", "self", ".", "sequence_length", "-", "len", "(", "tokens", ")", ")", "yield", "{", "\"targets\"", ":", "targets", "}", "else", ":", "assert", "self", ".", "remainder_policy", "==", "\"drop\"" ]
Generator for examples. Args: encoder: a TextEncoder tmp_dir: a string task_id: an integer Yields: feature dictionaries
[ "Generator", "for", "examples", "." ]
272500b6efe353aeb638d2745ed56e519462ca31
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/text_problems.py#L911-L943
train
Generator for examples.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qL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t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1000 + 0o51) + chr(0b11011 + 0o33) + '\062', 0o10), ehT0Px3KOsy9(chr(1428 - 1380) + chr(0b1111 + 0o140) + chr(49) + chr(0b100010 + 0o16) + chr(0b110100 + 0o0), 31848 - 31840), ehT0Px3KOsy9(chr(0b110000) + chr(4479 - 4368) + chr(1260 - 1210) + '\x36' + chr(949 - 895), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100011 + 0o16) + chr(49) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1805 - 1694) + chr(0b101000 + 0o13) + chr(0b11000 + 0o30) + chr(0b1110 + 0o44), ord("\x08")), ehT0Px3KOsy9('\060' + chr(9228 - 9117) + chr(0b110010) + '\064', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100100 + 0o15) + chr(0b110100) + chr(0b1010 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(11620 - 11509) + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b1110 + 0o42) + chr(171 - 122), ord("\x08")), ehT0Px3KOsy9(chr(341 - 293) + chr(0b1010010 + 0o35) + '\062' + '\x30' + chr(50), 8722 - 8714), ehT0Px3KOsy9(chr(1040 - 992) + chr(111) + chr(879 - 830) + '\x37' + chr(0b100001 + 0o22), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(55) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110111) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(954 - 904) + chr(0b110001) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(479 - 424) + chr(0b110011), 8), ehT0Px3KOsy9(chr(48) + chr(1528 - 1417) + chr(50) + chr(2019 - 1969), 0o10), ehT0Px3KOsy9('\060' + chr(902 - 791) + '\x33' + chr(0b110101) + chr(55), 52112 - 52104), ehT0Px3KOsy9('\060' + chr(11665 - 11554) + chr(50) + '\066' + '\x36', 8), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\x35' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010 + 0o145) + '\x32' + chr(48) + chr(50), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\063' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(10445 - 10334) + chr(51) + '\x32' + chr(2667 - 2613), 44615 - 44607), ehT0Px3KOsy9(chr(1780 - 1732) + chr(0b1011111 + 0o20) + chr(0b1110 + 0o44) + chr(0b110000), 15926 - 15918), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(435 - 324) + chr(0b101001 + 0o12) + chr(821 - 767) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b111 + 0o150) + chr(0b100110 + 0o15) + chr(52) + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2407 - 2355) + chr(55), 36518 - 36510), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(50) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101110 + 0o5) + chr(2361 - 2311) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x34', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010 + 0o1) + chr(51) + '\x34', 62 - 54), ehT0Px3KOsy9('\060' + '\157' + chr(0b101110 + 0o4) + '\x33' + chr(0b11101 + 0o31), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100010 + 0o17) + chr(0b101 + 0o55) + chr(1458 - 1407), 58755 - 58747), ehT0Px3KOsy9('\x30' + chr(4771 - 4660) + chr(0b100100 + 0o15) + chr(0b110101) + '\x33', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(153 - 104) + chr(1982 - 1930) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8473 - 8362) + chr(0b110011) + chr(0b101101 + 0o10) + chr(2079 - 2029), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(48) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b11011 + 0o27) + chr(1305 - 1254) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100110 + 0o13) + chr(48) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(54) + chr(0b110001), 14819 - 14811)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + '\065' + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\\'), chr(2277 - 2177) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(6867 - 6766))(chr(0b1010011 + 0o42) + chr(0b110110 + 0o76) + chr(10127 - 10025) + '\x2d' + chr(2761 - 2705)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def nZtIZFekDpdL(oVre8I6UXc3b, hoK3K1TwFlkr, JsZ36NJUqtml, h_MwKIdeQ6Ce): rBVWXSgCDxnr = oVre8I6UXc3b.text_filepaths_for_task(JsZ36NJUqtml, h_MwKIdeQ6Ce) if h_MwKIdeQ6Ce >= xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c1\xdb\x16\xb6f\x07i/\xdd\x08QbI\xec\x08'), '\144' + chr(2886 - 2785) + chr(99) + chr(4558 - 4447) + '\x64' + '\145')(chr(0b110001 + 0o104) + '\x74' + chr(0b11111 + 0o107) + chr(75 - 30) + chr(0b11101 + 0o33))): T_mSslnBJv8J = oVre8I6UXc3b.max_dev_chars // (oVre8I6UXc3b.num_dev_shards * c2A0yzQpDQB3(rBVWXSgCDxnr)) else: T_mSslnBJv8J = None Sz7tXxaCGqJ1 = [] for BLfj5SHeDHkR in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14-\xda,\x9ds\x03n$\xf0\x1aMlI'), chr(0b1100100) + '\145' + chr(0b1100011) + '\x6f' + '\x64' + chr(3208 - 3107))(chr(0b1001010 + 0o53) + chr(0b11010 + 0o132) + chr(102) + chr(45) + '\x38'))(rBVWXSgCDxnr, max_chars_per_file=T_mSslnBJv8J): xafqLlk3kkUe(Sz7tXxaCGqJ1, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17<\xc2,\xacp'), chr(0b0 + 0o144) + chr(0b10010 + 0o123) + chr(0b1100011) + chr(5521 - 5410) + '\144' + chr(0b1100101))('\x75' + '\164' + chr(5998 - 5896) + '\x2d' + chr(1123 - 1067)))(xafqLlk3kkUe(hoK3K1TwFlkr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17*\xd5&\xa6q'), '\x64' + chr(0b1000100 + 0o41) + chr(0b11 + 0o140) + '\x6f' + chr(0b110111 + 0o55) + chr(0b1011001 + 0o14))(chr(0b1110101) + chr(0b1000111 + 0o55) + '\x66' + chr(0b101101) + chr(56)))(BLfj5SHeDHkR)) NXd0aqYJd4lK = ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8) while NXd0aqYJd4lK + xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01!\xc7<\xa7z\x05e\x1e\xee\x1eWdO\xe0'), '\144' + chr(101) + chr(0b1010100 + 0o17) + chr(0b10011 + 0o134) + chr(0b1100100) + chr(10049 - 9948))(chr(0b111011 + 0o72) + chr(10431 - 10315) + chr(102) + '\x2d' + chr(0b10101 + 0o43))) <= c2A0yzQpDQB3(Sz7tXxaCGqJ1): yield {xafqLlk3kkUe(SXOLrMavuUCe(b'\x06%\xc4.\xa7`\x15'), '\x64' + chr(0b1100101) + chr(0b101001 + 0o72) + chr(0b1001001 + 0o46) + chr(100) + chr(6718 - 6617))('\x75' + '\x74' + chr(0b1000010 + 0o44) + chr(45) + chr(0b111000)): Sz7tXxaCGqJ1[NXd0aqYJd4lK:NXd0aqYJd4lK + xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01!\xc7<\xa7z\x05e\x1e\xee\x1eWdO\xe0'), chr(4949 - 4849) + '\x65' + chr(0b1100011) + chr(4227 - 4116) + chr(0b1011 + 0o131) + chr(4682 - 4581))(chr(117) + chr(116) + '\146' + '\055' + chr(0b101 + 0o63)))]} NXd0aqYJd4lK += oVre8I6UXc3b.sequence_length if NXd0aqYJd4lK > ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(48), 8): Sz7tXxaCGqJ1 = Sz7tXxaCGqJ1[NXd0aqYJd4lK:] if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x00!\xdb(\xabz\x02e3\xdd\x0bVoR\xeb\x02'), chr(0b10010 + 0o122) + chr(101) + '\x63' + chr(0b11000 + 0o127) + '\x64' + chr(0b10 + 0o143))(chr(0b1110101) + chr(0b1110100) + chr(102) + chr(45) + chr(2556 - 2500))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\x02%\xd2'), chr(2386 - 2286) + chr(101) + '\143' + chr(111) + chr(9037 - 8937) + chr(101))('\x75' + chr(116) + chr(102) + chr(0b101101) + '\070'): if Sz7tXxaCGqJ1: xIEmRseySp3z = Sz7tXxaCGqJ1 + [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(48), 8)] * (oVre8I6UXc3b.sequence_length - c2A0yzQpDQB3(Sz7tXxaCGqJ1)) yield {xafqLlk3kkUe(SXOLrMavuUCe(b'\x06%\xc4.\xa7`\x15'), chr(0b1000011 + 0o41) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(100) + chr(7426 - 7325))(chr(13010 - 12893) + '\x74' + chr(6342 - 6240) + '\x2d' + '\070'): xIEmRseySp3z} else: assert xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x00!\xdb(\xabz\x02e3\xdd\x0bVoR\xeb\x02'), chr(0b110100 + 0o60) + '\145' + '\143' + chr(111) + chr(0b1011011 + 0o11) + '\145')(chr(0b1110101) + chr(0b110100 + 0o100) + chr(102) + '\055' + chr(56))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\x166\xd99'), chr(0b1100100) + chr(101) + chr(99) + chr(0b100100 + 0o113) + chr(100) + '\x65')(chr(0b1110101) + '\164' + '\146' + chr(1744 - 1699) + chr(0b100 + 0o64))