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/models/research/rl.py
|
ppo_atari_base
|
def ppo_atari_base():
"""Pong base parameters."""
hparams = ppo_discrete_action_base()
hparams.learning_rate_constant = 1e-4
hparams.epoch_length = 200
hparams.gae_gamma = 0.985
hparams.gae_lambda = 0.985
hparams.entropy_loss_coef = 0.003
hparams.value_loss_coef = 1
hparams.optimization_epochs = 3
hparams.epochs_num = 1000
hparams.policy_network = "feed_forward_cnn_small_categorical_policy"
hparams.clipping_coef = 0.2
hparams.optimization_batch_size = 20
hparams.clip_grad_norm = 0.5
return hparams
|
python
|
def ppo_atari_base():
"""Pong base parameters."""
hparams = ppo_discrete_action_base()
hparams.learning_rate_constant = 1e-4
hparams.epoch_length = 200
hparams.gae_gamma = 0.985
hparams.gae_lambda = 0.985
hparams.entropy_loss_coef = 0.003
hparams.value_loss_coef = 1
hparams.optimization_epochs = 3
hparams.epochs_num = 1000
hparams.policy_network = "feed_forward_cnn_small_categorical_policy"
hparams.clipping_coef = 0.2
hparams.optimization_batch_size = 20
hparams.clip_grad_norm = 0.5
return hparams
|
[
"def",
"ppo_atari_base",
"(",
")",
":",
"hparams",
"=",
"ppo_discrete_action_base",
"(",
")",
"hparams",
".",
"learning_rate_constant",
"=",
"1e-4",
"hparams",
".",
"epoch_length",
"=",
"200",
"hparams",
".",
"gae_gamma",
"=",
"0.985",
"hparams",
".",
"gae_lambda",
"=",
"0.985",
"hparams",
".",
"entropy_loss_coef",
"=",
"0.003",
"hparams",
".",
"value_loss_coef",
"=",
"1",
"hparams",
".",
"optimization_epochs",
"=",
"3",
"hparams",
".",
"epochs_num",
"=",
"1000",
"hparams",
".",
"policy_network",
"=",
"\"feed_forward_cnn_small_categorical_policy\"",
"hparams",
".",
"clipping_coef",
"=",
"0.2",
"hparams",
".",
"optimization_batch_size",
"=",
"20",
"hparams",
".",
"clip_grad_norm",
"=",
"0.5",
"return",
"hparams"
] |
Pong base parameters.
|
[
"Pong",
"base",
"parameters",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L100-L115
|
train
|
Pong base 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,hr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2riMOClNT,_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(0b1100010 + 0o15) + '\x33' + '\061' + chr(2491 - 2440), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1010000 + 0o37) + chr(0b110001) + chr(2543 - 2492) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + '\x31' + '\060' + chr(54), 8822 - 8814), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + '\x33' + chr(1809 - 1761) + chr(0b11010 + 0o35), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\061' + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010 + 0o145) + '\x33' + chr(1272 - 1222) + chr(0b1000 + 0o51), 0o10), ehT0Px3KOsy9('\060' + chr(551 - 440) + chr(0b110001) + chr(904 - 852) + '\064', 0o10), ehT0Px3KOsy9('\060' + chr(11074 - 10963) + chr(2080 - 2031) + chr(0b101011 + 0o14) + '\065', 10408 - 10400), ehT0Px3KOsy9('\x30' + chr(1692 - 1581) + chr(502 - 452) + '\x34' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + '\x34' + chr(2141 - 2091), 0o10), ehT0Px3KOsy9(chr(1310 - 1262) + chr(0b1101111) + '\x36' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1001011 + 0o44) + chr(0b11 + 0o57) + '\065' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(0b10010 + 0o41) + '\x33' + chr(54), 5735 - 5727), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(0b110010) + chr(2113 - 2060) + chr(55), 0o10), ehT0Px3KOsy9(chr(1620 - 1572) + '\x6f' + chr(51) + chr(2029 - 1978) + chr(0b1100 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(366 - 317) + chr(693 - 644) + chr(750 - 699), 55596 - 55588), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(0b10000 + 0o42) + '\x36' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(231 - 180) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(392 - 344) + '\x6f' + '\067' + '\x35', 19515 - 19507), ehT0Px3KOsy9(chr(328 - 280) + chr(11874 - 11763) + '\063' + chr(0b110101) + chr(1422 - 1373), 52449 - 52441), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110011) + '\x33' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(0b100111 + 0o12) + '\x33' + chr(560 - 507), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b1010 + 0o46) + chr(2433 - 2381), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\x36' + '\x30', 36435 - 36427), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\x31' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3168 - 3057) + '\061' + '\x34' + chr(0b110111), 6858 - 6850), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(7249 - 7138) + chr(0b110001) + chr(0b110110) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8674 - 8563) + chr(0b1100 + 0o47) + '\060' + chr(53), 33090 - 33082), ehT0Px3KOsy9('\x30' + chr(6805 - 6694) + '\061' + chr(0b100111 + 0o20) + '\x32', 18875 - 18867), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + '\063' + chr(0b110001) + '\x34', 64376 - 64368), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(1341 - 1291) + '\065', 20920 - 20912), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + '\x33' + chr(0b110100) + chr(2402 - 2348), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10001 + 0o136) + '\x31' + chr(1128 - 1077) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(380 - 269) + chr(0b101111 + 0o6) + '\x34', 64458 - 64450), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\063' + chr(54), 8), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(0b110001 + 0o6) + '\066', 0b1000), ehT0Px3KOsy9(chr(834 - 786) + '\x6f' + '\x32' + chr(1197 - 1148) + chr(0b101100 + 0o5), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000 + 0o3) + '\060' + '\x37', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b10010 + 0o44) + chr(0b1110 + 0o50), 37033 - 37025)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101101 + 0o2) + chr(0b110101) + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe5'), chr(0b111100 + 0o50) + chr(0b111100 + 0o51) + chr(99) + '\157' + chr(0b1100100) + '\145')(chr(0b1110101) + '\164' + chr(8214 - 8112) + chr(0b101011 + 0o2) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def foY5yMP6Uy_X():
n4ljua2gi1Pr = j8537JQNnnZn()
n4ljua2gi1Pr.Ot9HUjnkxXA_ = 0.0001
n4ljua2gi1Pr.oDj4OD6jdt6s = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + chr(336 - 285) + chr(0b110001) + chr(340 - 292), 0o10)
n4ljua2gi1Pr.ECOF_vbN9tg4 = 0.985
n4ljua2gi1Pr.iX5fk20f2I6I = 0.985
n4ljua2gi1Pr.UaBm_QU7rsDQ = 0.003
n4ljua2gi1Pr.una4dD52xM_E = ehT0Px3KOsy9(chr(48) + chr(11616 - 11505) + '\x31', 0b1000)
n4ljua2gi1Pr.t16G_2zNG6_i = ehT0Px3KOsy9(chr(48) + chr(111) + '\063', 10660 - 10652)
n4ljua2gi1Pr.bmKj4pIdOoua = ehT0Px3KOsy9(chr(48) + chr(5854 - 5743) + chr(2008 - 1959) + chr(0b101100 + 0o13) + chr(2748 - 2695) + chr(520 - 472), ord("\x08"))
n4ljua2gi1Pr.c2VHuW1Ajc2l = xafqLlk3kkUe(SXOLrMavuUCe(b'\xad;#\xa3\xd6\xb7\x0b\x0f\xd7\x03A\xcc\x81\xcc\xb3%\xecnP\x88\xb71\x1b\xd3\xe9\x13\x16\xa2\x15\xbef\xb6\x873s\xae\xd1\xe5\xae\xd5\xb2'), chr(100) + chr(8356 - 8255) + '\x63' + chr(0b1010001 + 0o36) + chr(100) + '\145')('\x75' + chr(116) + '\146' + chr(401 - 356) + '\070')
n4ljua2gi1Pr.tR7oxut_DDUa = 0.2
n4ljua2gi1Pr.ruHyNXMdY5lX = ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b11000 + 0o34), 0b1000)
n4ljua2gi1Pr.SdNSZNVkVjLh = 0.5
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
ppo_original_params
|
def ppo_original_params():
"""Parameters based on the original PPO paper."""
hparams = ppo_atari_base()
hparams.learning_rate_constant = 2.5e-4
hparams.gae_gamma = 0.99
hparams.gae_lambda = 0.95
hparams.clipping_coef = 0.1
hparams.value_loss_coef = 1
hparams.entropy_loss_coef = 0.01
hparams.eval_every_epochs = 200
hparams.dropout_ppo = 0.1
# The parameters below are modified to accommodate short epoch_length (which
# is needed for model based rollouts).
hparams.epoch_length = 50
hparams.optimization_batch_size = 20
return hparams
|
python
|
def ppo_original_params():
"""Parameters based on the original PPO paper."""
hparams = ppo_atari_base()
hparams.learning_rate_constant = 2.5e-4
hparams.gae_gamma = 0.99
hparams.gae_lambda = 0.95
hparams.clipping_coef = 0.1
hparams.value_loss_coef = 1
hparams.entropy_loss_coef = 0.01
hparams.eval_every_epochs = 200
hparams.dropout_ppo = 0.1
# The parameters below are modified to accommodate short epoch_length (which
# is needed for model based rollouts).
hparams.epoch_length = 50
hparams.optimization_batch_size = 20
return hparams
|
[
"def",
"ppo_original_params",
"(",
")",
":",
"hparams",
"=",
"ppo_atari_base",
"(",
")",
"hparams",
".",
"learning_rate_constant",
"=",
"2.5e-4",
"hparams",
".",
"gae_gamma",
"=",
"0.99",
"hparams",
".",
"gae_lambda",
"=",
"0.95",
"hparams",
".",
"clipping_coef",
"=",
"0.1",
"hparams",
".",
"value_loss_coef",
"=",
"1",
"hparams",
".",
"entropy_loss_coef",
"=",
"0.01",
"hparams",
".",
"eval_every_epochs",
"=",
"200",
"hparams",
".",
"dropout_ppo",
"=",
"0.1",
"# The parameters below are modified to accommodate short epoch_length (which",
"# is needed for model based rollouts).",
"hparams",
".",
"epoch_length",
"=",
"50",
"hparams",
".",
"optimization_batch_size",
"=",
"20",
"return",
"hparams"
] |
Parameters based on the original PPO paper.
|
[
"Parameters",
"based",
"on",
"the",
"original",
"PPO",
"paper",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745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1XdVEe,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(6238 - 6127) + chr(50) + chr(2110 - 2056) + chr(1023 - 973), 41206 - 41198), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + '\061' + chr(48) + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(2071 - 2021) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + '\065' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\x34' + chr(52), 63129 - 63121), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1001011 + 0o44) + chr(49) + chr(1768 - 1719) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + '\061' + chr(0b11 + 0o56), 15224 - 15216), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + chr(0b110010) + chr(0b110010) + '\x37', 25136 - 25128), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(376 - 322) + chr(49), 56687 - 56679), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11001 + 0o126) + chr(2254 - 2204) + chr(0b1010 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(0b10111 + 0o33) + chr(2659 - 2604), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + '\065' + chr(0b1101 + 0o44), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(1257 - 1146) + chr(49) + chr(52) + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(1081 - 1033) + '\064', 15042 - 15034), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(1395 - 1344) + chr(2369 - 2320), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(1255 - 1207) + chr(0b1101111) + '\062' + chr(0b110110) + chr(0b110101), 56232 - 56224), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(216 - 166) + chr(0b110001) + chr(54), 25135 - 25127), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(0b110100) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(1710 - 1599) + chr(0b110101) + chr(0b101000 + 0o14), 34870 - 34862), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\x33' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(2103 - 2053) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(903 - 855) + chr(111) + '\x31' + chr(49) + chr(0b101 + 0o60), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7373 - 7262) + chr(52) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(55) + chr(49), 42908 - 42900), ehT0Px3KOsy9('\x30' + chr(7885 - 7774) + '\062' + '\066' + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(0b111111 + 0o60) + '\067' + '\066', 8), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(1974 - 1863) + '\x32' + chr(55), 52946 - 52938), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b101100 + 0o7) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1001 + 0o52) + chr(49), 65426 - 65418), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(985 - 936) + chr(1001 - 947), 0b1000), ehT0Px3KOsy9(chr(1091 - 1043) + '\157' + '\x31' + chr(49) + '\064', 57277 - 57269), ehT0Px3KOsy9('\060' + '\x6f' + chr(2598 - 2547) + chr(2321 - 2267) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(370 - 322) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(0b100100 + 0o16) + chr(0b110010) + chr(0b100110 + 0o16), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + '\x33' + chr(50), 0o10), ehT0Px3KOsy9(chr(809 - 761) + '\157' + chr(53) + '\062', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + '\x35' + '\x30', 38839 - 38831)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c'), chr(100) + chr(101) + chr(0b1100011) + chr(0b1100011 + 0o14) + chr(100) + '\x65')('\x75' + chr(8188 - 8072) + chr(0b1101 + 0o131) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Gw8osM0senvk():
n4ljua2gi1Pr = foY5yMP6Uy_X()
n4ljua2gi1Pr.Ot9HUjnkxXA_ = 0.00025
n4ljua2gi1Pr.ECOF_vbN9tg4 = 0.99
n4ljua2gi1Pr.iX5fk20f2I6I = 0.95
n4ljua2gi1Pr.tR7oxut_DDUa = 0.1
n4ljua2gi1Pr.una4dD52xM_E = ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100 + 0o55), 27858 - 27850)
n4ljua2gi1Pr.UaBm_QU7rsDQ = 0.01
n4ljua2gi1Pr.N8BvhB87aVkD = ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(7130 - 7019) + chr(51) + chr(0b110001) + chr(48), 35919 - 35911)
n4ljua2gi1Pr.plWu1L7iHeXb = 0.1
n4ljua2gi1Pr.oDj4OD6jdt6s = ehT0Px3KOsy9(chr(48) + chr(111) + chr(1730 - 1676) + '\062', 0b1000)
n4ljua2gi1Pr.ruHyNXMdY5lX = ehT0Px3KOsy9(chr(258 - 210) + '\x6f' + '\x32' + chr(0b110100), 8)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
ppo_original_world_model
|
def ppo_original_world_model():
"""Atari parameters with world model as policy."""
hparams = ppo_original_params()
hparams.policy_network = "next_frame_basic_deterministic"
hparams_keys = hparams.values().keys()
video_hparams = basic_deterministic_params.next_frame_basic_deterministic()
for (name, value) in six.iteritems(video_hparams.values()):
if name in hparams_keys:
hparams.set_hparam(name, value)
else:
hparams.add_hparam(name, value)
# Mostly to avoid decaying WM params when training the policy.
hparams.weight_decay = 0
return hparams
|
python
|
def ppo_original_world_model():
"""Atari parameters with world model as policy."""
hparams = ppo_original_params()
hparams.policy_network = "next_frame_basic_deterministic"
hparams_keys = hparams.values().keys()
video_hparams = basic_deterministic_params.next_frame_basic_deterministic()
for (name, value) in six.iteritems(video_hparams.values()):
if name in hparams_keys:
hparams.set_hparam(name, value)
else:
hparams.add_hparam(name, value)
# Mostly to avoid decaying WM params when training the policy.
hparams.weight_decay = 0
return hparams
|
[
"def",
"ppo_original_world_model",
"(",
")",
":",
"hparams",
"=",
"ppo_original_params",
"(",
")",
"hparams",
".",
"policy_network",
"=",
"\"next_frame_basic_deterministic\"",
"hparams_keys",
"=",
"hparams",
".",
"values",
"(",
")",
".",
"keys",
"(",
")",
"video_hparams",
"=",
"basic_deterministic_params",
".",
"next_frame_basic_deterministic",
"(",
")",
"for",
"(",
"name",
",",
"value",
")",
"in",
"six",
".",
"iteritems",
"(",
"video_hparams",
".",
"values",
"(",
")",
")",
":",
"if",
"name",
"in",
"hparams_keys",
":",
"hparams",
".",
"set_hparam",
"(",
"name",
",",
"value",
")",
"else",
":",
"hparams",
".",
"add_hparam",
"(",
"name",
",",
"value",
")",
"# Mostly to avoid decaying WM params when training the policy.",
"hparams",
".",
"weight_decay",
"=",
"0",
"return",
"hparams"
] |
Atari parameters with world model as policy.
|
[
"Atari",
"parameters",
"with",
"world",
"model",
"as",
"policy",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L172-L185
|
train
|
Atari parameters with world model as policy.
|
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,yg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iEdDQ,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) + '\062' + chr(0b110111) + chr(463 - 409), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b101011 + 0o10) + '\064' + '\064', 0o10), ehT0Px3KOsy9(chr(1845 - 1797) + chr(5331 - 5220) + chr(50) + chr(2095 - 2047) + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\x30' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + '\062' + '\066' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b100000 + 0o117) + '\062' + '\x34' + chr(611 - 559), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001 + 0o146) + chr(0b110001) + chr(2382 - 2328) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1430 - 1382) + chr(0b1101111) + '\062' + chr(1178 - 1128) + chr(0b110001), 11079 - 11071), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100110 + 0o14) + chr(0b1 + 0o57) + '\066', 0b1000), ehT0Px3KOsy9(chr(1798 - 1750) + chr(111) + chr(0b110011) + chr(54) + chr(1224 - 1176), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + '\x33' + '\x31' + chr(2258 - 2206), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(52) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b10101 + 0o41) + '\063', 0b1000), ehT0Px3KOsy9(chr(264 - 216) + '\157' + chr(50) + '\066' + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100001 + 0o116) + chr(0b10100 + 0o37) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(503 - 455) + '\157' + chr(0b10110 + 0o33) + '\x34' + chr(0b110001), 32886 - 32878), ehT0Px3KOsy9('\060' + chr(1566 - 1455) + chr(50) + '\062' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(762 - 711) + chr(0b10111 + 0o33), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(12312 - 12201) + '\062' + chr(70 - 17) + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\060' + chr(0b11110 + 0o27), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\064' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(7277 - 7166) + chr(0b10011 + 0o36) + '\062' + chr(0b101010 + 0o6), 0o10), ehT0Px3KOsy9(chr(447 - 399) + '\x6f' + chr(1955 - 1905) + chr(2000 - 1948) + chr(0b110000 + 0o3), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + '\x33' + '\x33' + chr(0b11010 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101100 + 0o6) + chr(0b11101 + 0o31) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b111 + 0o57) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11001 + 0o30) + chr(0b110010) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(1094 - 983) + chr(1932 - 1883) + chr(0b100000 + 0o22) + chr(0b100001 + 0o22), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(1676 - 1621) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110 + 0o151) + chr(0b110011) + '\x33' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11010 + 0o31) + chr(1944 - 1892) + chr(233 - 178), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\065' + chr(0b1111 + 0o45), 52740 - 52732), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10011 + 0o37) + chr(0b110100) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b11100 + 0o123) + '\x31' + chr(49) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10001 + 0o42) + '\x37', 8), ehT0Px3KOsy9(chr(2172 - 2124) + '\x6f' + chr(50) + chr(2091 - 2038) + chr(2474 - 2423), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\x37' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(2269 - 2220) + chr(55) + chr(0b110111), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(8878 - 8767) + chr(53) + chr(0b11010 + 0o26), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x90'), '\144' + '\145' + chr(0b1100011) + chr(0b1101111) + chr(100) + '\145')(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def yRsJtX1BekzQ():
n4ljua2gi1Pr = Gw8osM0senvk()
n4ljua2gi1Pr.c2VHuW1Ajc2l = xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\x81\xf9\xb7}\xd2\xd6\x17\xfc\xe3\xaf\xae\x01\xc0\xdb|>\xf3\x7f\xda\xa0W=\xca\xb1\xdb@Z?0'), chr(4021 - 3921) + chr(101) + '\x63' + chr(738 - 627) + chr(100) + chr(0b1011111 + 0o6))(chr(0b111100 + 0o71) + chr(0b1001001 + 0o53) + '\146' + '\055' + chr(360 - 304))
lEb1ohN4ChE8 = n4ljua2gi1Pr.values().keys()
TdvzF4IW2D8Q = Gw_gMrmFHoKr.next_frame_basic_deterministic()
for (AIvJRzLdDfgF, QmmgWUB13VCJ) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7\x90\xe4\xb1K\xc0\xc1\x1b\xe2'), '\144' + chr(101) + chr(3306 - 3207) + chr(8579 - 8468) + chr(0b1100010 + 0o2) + chr(9115 - 9014))('\165' + chr(116) + chr(102) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(TdvzF4IW2D8Q, xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\xb4\xef\x80l\xc1\x91B\xd9\xb7\x94\xae'), '\144' + '\x65' + '\143' + chr(0b11011 + 0o124) + chr(0b1010111 + 0o15) + '\145')(chr(117) + chr(0b1011011 + 0o31) + chr(0b1100110) + chr(45) + chr(604 - 548)))()):
if AIvJRzLdDfgF in lEb1ohN4ChE8:
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcd\x81\xf5\x9cJ\xc4\xc5\x04\xf0\xeb'), chr(0b1 + 0o143) + chr(6989 - 6888) + '\143' + chr(0b1101111) + '\144' + chr(101))('\165' + '\x74' + '\x66' + chr(1635 - 1590) + chr(1750 - 1694)))(AIvJRzLdDfgF, QmmgWUB13VCJ)
else:
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf\x80\xe5\x9cJ\xc4\xc5\x04\xf0\xeb'), chr(0b1100100) + chr(0b1011100 + 0o11) + '\143' + '\x6f' + chr(0b1010010 + 0o22) + chr(0b1100101))('\x75' + '\x74' + chr(3800 - 3698) + '\055' + '\x38'))(AIvJRzLdDfgF, QmmgWUB13VCJ)
n4ljua2gi1Pr.eB4rJl6fUxw9 = ehT0Px3KOsy9('\x30' + '\x6f' + chr(553 - 505), 0o10)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
ppo_tiny_world_model
|
def ppo_tiny_world_model():
"""Atari parameters with world model as policy."""
hparams = ppo_original_params()
hparams.policy_network = "next_frame_basic_deterministic"
hparams_keys = hparams.values().keys()
video_hparams = basic_deterministic_params.next_frame_tiny()
for (name, value) in six.iteritems(video_hparams.values()):
if name in hparams_keys:
hparams.set_hparam(name, value)
else:
hparams.add_hparam(name, value)
hparams.weight_decay = 0
return hparams
|
python
|
def ppo_tiny_world_model():
"""Atari parameters with world model as policy."""
hparams = ppo_original_params()
hparams.policy_network = "next_frame_basic_deterministic"
hparams_keys = hparams.values().keys()
video_hparams = basic_deterministic_params.next_frame_tiny()
for (name, value) in six.iteritems(video_hparams.values()):
if name in hparams_keys:
hparams.set_hparam(name, value)
else:
hparams.add_hparam(name, value)
hparams.weight_decay = 0
return hparams
|
[
"def",
"ppo_tiny_world_model",
"(",
")",
":",
"hparams",
"=",
"ppo_original_params",
"(",
")",
"hparams",
".",
"policy_network",
"=",
"\"next_frame_basic_deterministic\"",
"hparams_keys",
"=",
"hparams",
".",
"values",
"(",
")",
".",
"keys",
"(",
")",
"video_hparams",
"=",
"basic_deterministic_params",
".",
"next_frame_tiny",
"(",
")",
"for",
"(",
"name",
",",
"value",
")",
"in",
"six",
".",
"iteritems",
"(",
"video_hparams",
".",
"values",
"(",
")",
")",
":",
"if",
"name",
"in",
"hparams_keys",
":",
"hparams",
".",
"set_hparam",
"(",
"name",
",",
"value",
")",
"else",
":",
"hparams",
".",
"add_hparam",
"(",
"name",
",",
"value",
")",
"hparams",
".",
"weight_decay",
"=",
"0",
"return",
"hparams"
] |
Atari parameters with world model as policy.
|
[
"Atari",
"parameters",
"with",
"world",
"model",
"as",
"policy",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2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O1XdVEe,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(1693 - 1645) + '\x6f' + chr(805 - 754) + chr(1211 - 1158) + chr(1638 - 1590), 0b1000), ehT0Px3KOsy9(chr(1268 - 1220) + chr(0b100101 + 0o112) + chr(0b11011 + 0o27) + chr(49) + chr(51), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(51) + chr(1796 - 1746), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + '\062' + chr(48), 12367 - 12359), ehT0Px3KOsy9(chr(1464 - 1416) + '\x6f' + chr(0b101111 + 0o2) + '\x35' + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b101110 + 0o10) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6809 - 6698) + '\x33' + chr(0b101110 + 0o4) + chr(183 - 132), 50128 - 50120), ehT0Px3KOsy9(chr(2219 - 2171) + chr(0b100 + 0o153) + '\061' + '\x37' + '\066', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x37', 0o10), ehT0Px3KOsy9(chr(211 - 163) + chr(5001 - 4890) + '\x33' + chr(0b11101 + 0o32) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(1397 - 1349) + chr(2276 - 2222), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(50) + chr(2688 - 2634) + chr(0b100000 + 0o21), 54203 - 54195), ehT0Px3KOsy9('\x30' + chr(11381 - 11270) + chr(0b100000 + 0o21) + chr(0b110100) + chr(50), 35799 - 35791), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\x35' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(165 - 117) + chr(0b1101111) + chr(1667 - 1615) + chr(1822 - 1771), 51655 - 51647), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(136 - 87) + chr(0b100110 + 0o21) + chr(0b1011 + 0o54), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x32' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\067' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(70 - 22) + '\157' + chr(0b10001 + 0o40) + chr(0b110100) + '\063', 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(2383 - 2332) + '\062' + chr(916 - 868), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b101100 + 0o103) + '\062' + '\064' + chr(0b11010 + 0o30), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(757 - 707) + chr(0b1111 + 0o44), 0b1000), ehT0Px3KOsy9(chr(48) + chr(12299 - 12188) + chr(50) + '\063' + chr(0b1100 + 0o44), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(439 - 390) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + '\x33' + chr(0b110010), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x35' + chr(0b111 + 0o55), 526 - 518), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\064' + chr(0b110000 + 0o7), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001011 + 0o44) + chr(0b110001) + '\x33' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + '\x31' + chr(1750 - 1701) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(2198 - 2150) + '\x6f' + '\062' + '\065' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(0b10101 + 0o37) + '\066', 2454 - 2446), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1001110 + 0o41) + chr(0b1001 + 0o52) + chr(0b100111 + 0o20) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7021 - 6910) + '\x31' + '\x37' + '\062', 0o10), ehT0Px3KOsy9(chr(1837 - 1789) + chr(111) + chr(0b110010), 3126 - 3118), ehT0Px3KOsy9('\x30' + chr(5941 - 5830) + chr(0b110011) + chr(48) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1646 - 1598) + chr(0b1101111) + '\061' + '\x32' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\x30' + '\060', 14908 - 14900), ehT0Px3KOsy9(chr(1724 - 1676) + chr(0b1101111) + '\x32' + '\x33' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + '\063' + chr(450 - 397) + chr(0b110100 + 0o3), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + chr(810 - 757) + chr(0b11 + 0o55), 28007 - 27999)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6'), chr(0b1010111 + 0o15) + chr(0b101000 + 0o75) + '\x63' + chr(0b1101110 + 0o1) + chr(0b1100100) + '\145')('\x75' + chr(0b11001 + 0o133) + chr(102) + chr(1953 - 1908) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mljDogGhifJn():
n4ljua2gi1Pr = Gw8osM0senvk()
n4ljua2gi1Pr.c2VHuW1Ajc2l = xafqLlk3kkUe(SXOLrMavuUCe(b'\x86\xee\xa2d6\x11\xa1\x1fgb\xa5\xe4\xd0\x11\x04@ 3\xdf\x17\xb5\xd0\xfe\xf1c\xb3\x1f\xd36.'), chr(100) + chr(9379 - 9278) + chr(0b100111 + 0o74) + chr(111) + '\x64' + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b1001100 + 0o32) + chr(1669 - 1624) + chr(0b110111 + 0o1))
lEb1ohN4ChE8 = n4ljua2gi1Pr.values().keys()
TdvzF4IW2D8Q = Gw_gMrmFHoKr.next_frame_tiny()
for (AIvJRzLdDfgF, QmmgWUB13VCJ) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\xff\xbfb\x00\x03\xb6\x13y'), chr(100) + chr(0b1011011 + 0o12) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(101))(chr(3721 - 3604) + '\x74' + '\146' + chr(0b101101) + chr(56)))(xafqLlk3kkUe(TdvzF4IW2D8Q, xafqLlk3kkUe(SXOLrMavuUCe(b"\xbb\xdb\xb4S'\x02\xe6JB6\x9e\xe4"), chr(0b1100100) + chr(8655 - 8554) + chr(0b11 + 0o140) + '\x6f' + '\144' + chr(434 - 333))(chr(117) + chr(9279 - 9163) + chr(6327 - 6225) + chr(0b101101) + chr(0b11110 + 0o32)))()):
if AIvJRzLdDfgF in lEb1ohN4ChE8:
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\xee\xaeO\x01\x07\xb2\x0ckj'), chr(0b111010 + 0o52) + chr(101) + '\x63' + '\x6f' + chr(100) + '\x65')(chr(117) + chr(5923 - 5807) + chr(0b111110 + 0o50) + chr(1100 - 1055) + chr(0b10011 + 0o45)))(AIvJRzLdDfgF, QmmgWUB13VCJ)
else:
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x89\xef\xbeO\x01\x07\xb2\x0ckj'), chr(0b1001010 + 0o32) + chr(0b10 + 0o143) + chr(99) + '\157' + '\144' + chr(0b1100101))(chr(117) + '\x74' + '\146' + '\055' + chr(1578 - 1522)))(AIvJRzLdDfgF, QmmgWUB13VCJ)
n4ljua2gi1Pr.eB4rJl6fUxw9 = ehT0Px3KOsy9('\060' + '\x6f' + chr(48), 0b1000)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
ppo_original_world_model_stochastic_discrete
|
def ppo_original_world_model_stochastic_discrete():
"""Atari parameters with stochastic discrete world model as policy."""
hparams = ppo_original_params()
hparams.policy_network = "next_frame_basic_stochastic_discrete"
hparams_keys = hparams.values().keys()
video_hparams = basic_stochastic.next_frame_basic_stochastic_discrete()
for (name, value) in six.iteritems(video_hparams.values()):
if name in hparams_keys:
hparams.set_hparam(name, value)
else:
hparams.add_hparam(name, value)
# To avoid OOM. Probably way to small.
hparams.optimization_batch_size = 1
hparams.weight_decay = 0
return hparams
|
python
|
def ppo_original_world_model_stochastic_discrete():
"""Atari parameters with stochastic discrete world model as policy."""
hparams = ppo_original_params()
hparams.policy_network = "next_frame_basic_stochastic_discrete"
hparams_keys = hparams.values().keys()
video_hparams = basic_stochastic.next_frame_basic_stochastic_discrete()
for (name, value) in six.iteritems(video_hparams.values()):
if name in hparams_keys:
hparams.set_hparam(name, value)
else:
hparams.add_hparam(name, value)
# To avoid OOM. Probably way to small.
hparams.optimization_batch_size = 1
hparams.weight_decay = 0
return hparams
|
[
"def",
"ppo_original_world_model_stochastic_discrete",
"(",
")",
":",
"hparams",
"=",
"ppo_original_params",
"(",
")",
"hparams",
".",
"policy_network",
"=",
"\"next_frame_basic_stochastic_discrete\"",
"hparams_keys",
"=",
"hparams",
".",
"values",
"(",
")",
".",
"keys",
"(",
")",
"video_hparams",
"=",
"basic_stochastic",
".",
"next_frame_basic_stochastic_discrete",
"(",
")",
"for",
"(",
"name",
",",
"value",
")",
"in",
"six",
".",
"iteritems",
"(",
"video_hparams",
".",
"values",
"(",
")",
")",
":",
"if",
"name",
"in",
"hparams_keys",
":",
"hparams",
".",
"set_hparam",
"(",
"name",
",",
"value",
")",
"else",
":",
"hparams",
".",
"add_hparam",
"(",
"name",
",",
"value",
")",
"# To avoid OOM. Probably way to small.",
"hparams",
".",
"optimization_batch_size",
"=",
"1",
"hparams",
".",
"weight_decay",
"=",
"0",
"return",
"hparams"
] |
Atari parameters with stochastic discrete world model as policy.
|
[
"Atari",
"parameters",
"with",
"stochastic",
"discrete",
"world",
"model",
"as",
"policy",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L205-L219
|
train
|
Atari parameters with stochastic discrete world model as policy.
|
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,hOkX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DCn,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(0b11101 + 0o23) + '\x6f' + chr(0b110001 + 0o1) + '\x33' + '\x34', 60129 - 60121), ehT0Px3KOsy9(chr(48) + '\157' + chr(1788 - 1739) + chr(0b11 + 0o57) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101000 + 0o13) + chr(0b110111) + '\063', 45999 - 45991), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\x36' + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b110001) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(50) + chr(2267 - 2218), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(2300 - 2189) + chr(0b110 + 0o53) + '\x30' + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(6638 - 6527) + '\067' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(1767 - 1656) + '\x31' + chr(143 - 92) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10111 + 0o33) + '\065' + chr(0b110000 + 0o3), 11480 - 11472), ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + '\x31' + chr(0b100001 + 0o21) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\063' + chr(0b110000) + chr(0b110001), 1821 - 1813), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + '\063' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101 + 0o54) + '\x34' + '\x36', 33329 - 33321), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + chr(0b100110 + 0o15) + chr(0b11111 + 0o24) + chr(0b110101), 63753 - 63745), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100000 + 0o23) + '\x35' + '\061', 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + '\x31' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(477 - 429) + '\157' + chr(1302 - 1251) + chr(0b101001 + 0o15) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(272 - 224) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(2140 - 2092) + chr(5651 - 5540) + chr(0b11111 + 0o24) + chr(0b110110) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + '\063' + '\060' + chr(2351 - 2297), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(131 - 82) + chr(772 - 723), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(627 - 577) + '\x32' + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(6683 - 6572) + chr(0b110011) + chr(0b100101 + 0o21) + chr(48), 47299 - 47291), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(1453 - 1401) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100111 + 0o110) + chr(50) + '\061' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + '\x31' + '\x35' + chr(2250 - 2201), 55759 - 55751), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(49) + '\x31' + chr(0b1001 + 0o52), 23796 - 23788), ehT0Px3KOsy9(chr(722 - 674) + chr(111) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(1997 - 1945) + chr(0b110100), 44861 - 44853), ehT0Px3KOsy9(chr(0b110000) + chr(9024 - 8913) + '\x32' + chr(2350 - 2298) + chr(0b111 + 0o52), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b100001 + 0o23) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b100 + 0o62) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b10000 + 0o42) + chr(339 - 289) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b111000 + 0o67) + chr(90 - 41) + chr(0b10001 + 0o44) + chr(0b11000 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1110 + 0o141) + '\x37' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(52) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b110001) + chr(0b100011 + 0o17) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2014 - 1964) + '\063' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b11101 + 0o122) + '\x33' + chr(947 - 895) + chr(0b110001), 16233 - 16225)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(53) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2'), chr(0b1100100 + 0o0) + chr(2352 - 2251) + chr(0b1100011) + chr(0b1001000 + 0o47) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + '\164' + '\146' + chr(409 - 364) + chr(2078 - 2022)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ERV8JaNecN5N():
n4ljua2gi1Pr = Gw8osM0senvk()
n4ljua2gi1Pr.c2VHuW1Ajc2l = xafqLlk3kkUe(SXOLrMavuUCe(b'\xf25\x83\x06\x9777Z6\xce\r\xa3{\x15\xb4\x8aQ\x82\xb0\x98\xa5a\xf7\x83\x10\xe5\n\x14c\xcd\xd2\xc5\x05\xf2\x1b_'), chr(7126 - 7026) + '\145' + chr(99) + chr(0b1010011 + 0o34) + '\x64' + chr(0b1100101))('\x75' + chr(0b1110100) + chr(102) + chr(0b101101) + chr(56))
lEb1ohN4ChE8 = n4ljua2gi1Pr.values().keys()
TdvzF4IW2D8Q = RvMzMhQ9W7ZW.next_frame_basic_stochastic_discrete()
for (AIvJRzLdDfgF, QmmgWUB13VCJ) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5$\x9e\x00\xa1% V('), chr(0b1100100) + chr(101) + chr(0b11100 + 0o107) + chr(4825 - 4714) + chr(0b1100100) + chr(0b0 + 0o145))('\165' + chr(8795 - 8679) + chr(102) + chr(138 - 93) + chr(56)))(xafqLlk3kkUe(TdvzF4IW2D8Q, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf\x00\x951\x86$p\x0f\x13\x9a6\xa3'), chr(0b1100100) + chr(0b1010001 + 0o24) + '\143' + chr(0b110110 + 0o71) + '\x64' + '\x65')('\x75' + chr(116) + chr(0b1100100 + 0o2) + chr(0b101101) + '\070'))()):
if AIvJRzLdDfgF in lEb1ohN4ChE8:
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xef5\x8f-\xa0!$I:\xc6'), chr(0b1001011 + 0o31) + chr(101) + chr(0b1000001 + 0o42) + chr(0b1001000 + 0o47) + '\144' + '\x65')(chr(13273 - 13156) + chr(116) + chr(0b1011100 + 0o12) + chr(45) + '\x38'))(AIvJRzLdDfgF, QmmgWUB13VCJ)
else:
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd4\x9f-\xa0!$I:\xc6'), '\144' + '\x65' + chr(5166 - 5067) + chr(111) + '\x64' + chr(575 - 474))(chr(13424 - 13307) + chr(116) + chr(0b1011100 + 0o12) + '\055' + chr(56)))(AIvJRzLdDfgF, QmmgWUB13VCJ)
n4ljua2gi1Pr.ruHyNXMdY5lX = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(382 - 333), 0b1000)
n4ljua2gi1Pr.eB4rJl6fUxw9 = ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x30', ord("\x08"))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
make_simulated_env_fn
|
def make_simulated_env_fn(**env_kwargs):
"""Returns a function creating a simulated env, in or out of graph.
Args:
**env_kwargs: kwargs to pass to the simulated env constructor.
Returns:
Function in_graph -> env.
"""
def env_fn(in_graph):
class_ = SimulatedBatchEnv if in_graph else SimulatedBatchGymEnv
return class_(**env_kwargs)
return env_fn
|
python
|
def make_simulated_env_fn(**env_kwargs):
"""Returns a function creating a simulated env, in or out of graph.
Args:
**env_kwargs: kwargs to pass to the simulated env constructor.
Returns:
Function in_graph -> env.
"""
def env_fn(in_graph):
class_ = SimulatedBatchEnv if in_graph else SimulatedBatchGymEnv
return class_(**env_kwargs)
return env_fn
|
[
"def",
"make_simulated_env_fn",
"(",
"*",
"*",
"env_kwargs",
")",
":",
"def",
"env_fn",
"(",
"in_graph",
")",
":",
"class_",
"=",
"SimulatedBatchEnv",
"if",
"in_graph",
"else",
"SimulatedBatchGymEnv",
"return",
"class_",
"(",
"*",
"*",
"env_kwargs",
")",
"return",
"env_fn"
] |
Returns a function creating a simulated env, in or out of graph.
Args:
**env_kwargs: kwargs to pass to the simulated env constructor.
Returns:
Function in_graph -> env.
|
[
"Returns",
"a",
"function",
"creating",
"a",
"simulated",
"env",
"in",
"or",
"out",
"of",
"graph",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L234-L246
|
train
|
Returns a function creating a simulated env.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICj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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' + '\x32' + '\x32' + chr(1022 - 974), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3563 - 3452) + '\x32' + chr(1242 - 1192) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1898 - 1850) + chr(7950 - 7839) + '\066' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(191 - 143) + '\x6f' + chr(166 - 114) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\063' + chr(0b1 + 0o62), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8209 - 8098) + chr(55) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(48) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101100 + 0o6) + chr(281 - 232) + chr(0b10000 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(595 - 547) + chr(111) + chr(616 - 561) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1860 - 1812) + chr(2996 - 2885) + chr(51) + chr(0b110000) + chr(0b10 + 0o62), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + '\x31' + '\x35' + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(1916 - 1805) + '\x33' + chr(48) + chr(50), 0b1000), ehT0Px3KOsy9(chr(869 - 821) + chr(0b1011000 + 0o27) + chr(0b110011) + chr(0b100110 + 0o14) + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(0b10000 + 0o43) + '\x36', 0b1000), ehT0Px3KOsy9(chr(726 - 678) + chr(111) + chr(0b110011) + chr(0b110110) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110111) + chr(0b110111), 22325 - 22317), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + chr(1127 - 1078) + '\x34' + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100100 + 0o113) + '\x32' + chr(54) + chr(51), 29988 - 29980), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + '\065' + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9725 - 9614) + chr(51) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1010 + 0o145) + chr(51) + '\x34' + chr(2457 - 2402), 44420 - 44412), ehT0Px3KOsy9('\060' + chr(111) + chr(574 - 523) + '\061' + chr(2012 - 1959), 19487 - 19479), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(9979 - 9868) + chr(0b110101) + '\060', 55293 - 55285), ehT0Px3KOsy9(chr(48) + chr(111) + chr(419 - 369) + '\x34' + '\x32', 17913 - 17905), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11100 + 0o26) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\x33' + chr(113 - 65), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + '\x31' + '\x37' + chr(1301 - 1248), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b1000 + 0o57) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(689 - 636) + '\060', 7370 - 7362), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000000 + 0o57) + chr(0b10010 + 0o40) + chr(52) + chr(1253 - 1205), ord("\x08")), ehT0Px3KOsy9(chr(1240 - 1192) + chr(6312 - 6201) + chr(1417 - 1366) + chr(0b110000) + chr(0b10000 + 0o42), 8), ehT0Px3KOsy9(chr(1064 - 1016) + '\x6f' + '\061' + chr(53) + '\061', 8), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\x36' + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1702 - 1653) + '\x33' + '\x31', 35980 - 35972), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(0b110001) + chr(53) + '\061', 8), ehT0Px3KOsy9(chr(879 - 831) + chr(0b1101111) + chr(0b110111) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(7597 - 7486) + chr(0b110001 + 0o0) + chr(0b100101 + 0o17), 6917 - 6909), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(2094 - 2043) + chr(0b110011) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(2409 - 2298) + chr(51) + chr(0b110010) + chr(0b110110), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b101100 + 0o103) + '\x35' + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe'), chr(7530 - 7430) + chr(7904 - 7803) + chr(99) + chr(0b1100000 + 0o17) + chr(4739 - 4639) + chr(0b1011101 + 0o10))('\165' + '\164' + chr(0b10011 + 0o123) + chr(0b101000 + 0o5) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xqTgCCkXn6QS(**oy1EL4XJ70rz):
def LwGmvHQYXm7c(MFCzL4QqlabU):
PP81Xh5bKXUp = hNcQwWm6UpsD if MFCzL4QqlabU else tQgCIiOGp99X
return PP81Xh5bKXUp(**oy1EL4XJ70rz)
return LwGmvHQYXm7c
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
make_simulated_env_kwargs
|
def make_simulated_env_kwargs(real_env, hparams, **extra_kwargs):
"""Extracts simulated env kwargs from real_env and loop hparams."""
objs_and_attrs = [
(real_env, [
"reward_range", "observation_space", "action_space", "frame_height",
"frame_width"
]),
(hparams, ["frame_stack_size", "intrinsic_reward_scale"])
]
kwargs = {
attr: getattr(obj, attr) # pylint: disable=g-complex-comprehension
for (obj, attrs) in objs_and_attrs for attr in attrs
}
kwargs["model_name"] = hparams.generative_model
kwargs["model_hparams"] = trainer_lib.create_hparams(
hparams.generative_model_params
)
if hparams.wm_policy_param_sharing:
kwargs["model_hparams"].optimizer_zero_grads = True
kwargs.update(extra_kwargs)
return kwargs
|
python
|
def make_simulated_env_kwargs(real_env, hparams, **extra_kwargs):
"""Extracts simulated env kwargs from real_env and loop hparams."""
objs_and_attrs = [
(real_env, [
"reward_range", "observation_space", "action_space", "frame_height",
"frame_width"
]),
(hparams, ["frame_stack_size", "intrinsic_reward_scale"])
]
kwargs = {
attr: getattr(obj, attr) # pylint: disable=g-complex-comprehension
for (obj, attrs) in objs_and_attrs for attr in attrs
}
kwargs["model_name"] = hparams.generative_model
kwargs["model_hparams"] = trainer_lib.create_hparams(
hparams.generative_model_params
)
if hparams.wm_policy_param_sharing:
kwargs["model_hparams"].optimizer_zero_grads = True
kwargs.update(extra_kwargs)
return kwargs
|
[
"def",
"make_simulated_env_kwargs",
"(",
"real_env",
",",
"hparams",
",",
"*",
"*",
"extra_kwargs",
")",
":",
"objs_and_attrs",
"=",
"[",
"(",
"real_env",
",",
"[",
"\"reward_range\"",
",",
"\"observation_space\"",
",",
"\"action_space\"",
",",
"\"frame_height\"",
",",
"\"frame_width\"",
"]",
")",
",",
"(",
"hparams",
",",
"[",
"\"frame_stack_size\"",
",",
"\"intrinsic_reward_scale\"",
"]",
")",
"]",
"kwargs",
"=",
"{",
"attr",
":",
"getattr",
"(",
"obj",
",",
"attr",
")",
"# pylint: disable=g-complex-comprehension",
"for",
"(",
"obj",
",",
"attrs",
")",
"in",
"objs_and_attrs",
"for",
"attr",
"in",
"attrs",
"}",
"kwargs",
"[",
"\"model_name\"",
"]",
"=",
"hparams",
".",
"generative_model",
"kwargs",
"[",
"\"model_hparams\"",
"]",
"=",
"trainer_lib",
".",
"create_hparams",
"(",
"hparams",
".",
"generative_model_params",
")",
"if",
"hparams",
".",
"wm_policy_param_sharing",
":",
"kwargs",
"[",
"\"model_hparams\"",
"]",
".",
"optimizer_zero_grads",
"=",
"True",
"kwargs",
".",
"update",
"(",
"extra_kwargs",
")",
"return",
"kwargs"
] |
Extracts simulated env kwargs from real_env and loop hparams.
|
[
"Extracts",
"simulated",
"env",
"kwargs",
"from",
"real_env",
"and",
"loop",
"hparams",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L250-L270
|
train
|
Extracts simulated env kwargs from real_env and loop 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,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,ygAzbDz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,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) + '\x31' + '\x32' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b111 + 0o52) + chr(0b101000 + 0o17) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(4086 - 3975) + chr(1360 - 1309) + chr(54) + chr(0b101010 + 0o11), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11349 - 11238) + chr(308 - 259) + '\067' + chr(1286 - 1234), 0b1000), ehT0Px3KOsy9('\x30' + chr(6806 - 6695) + '\x32' + chr(0b110011) + chr(0b100110 + 0o17), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11110 + 0o24) + '\063' + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(9689 - 9578) + chr(1246 - 1197) + chr(2744 - 2689) + '\x33', 8), ehT0Px3KOsy9(chr(1687 - 1639) + chr(0b1101111) + '\063' + chr(49) + chr(0b10101 + 0o33), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + chr(0b110011) + chr(0b100011 + 0o16) + chr(0b10111 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b1011 + 0o50) + chr(2101 - 2047), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + '\063' + chr(103 - 55) + '\067', 47487 - 47479), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(49) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\x35' + chr(0b110010), 16242 - 16234), ehT0Px3KOsy9('\060' + chr(7535 - 7424) + '\063' + chr(1408 - 1357), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1367 - 1317) + chr(1273 - 1218), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(665 - 616) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(10475 - 10364) + chr(0b110001) + '\x31' + chr(0b1010 + 0o54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(51) + chr(2089 - 2037), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x37' + '\066', 0b1000), ehT0Px3KOsy9(chr(2157 - 2109) + chr(0b1101111) + '\061' + chr(49) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(93 - 44) + '\x37', 50051 - 50043), ehT0Px3KOsy9(chr(280 - 232) + chr(0b1101111) + chr(0b101010 + 0o15) + chr(0b11010 + 0o33), 31404 - 31396), ehT0Px3KOsy9(chr(1282 - 1234) + '\157' + '\062' + '\062' + chr(0b100 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1678 - 1627) + '\060' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(50) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b111 + 0o56) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + chr(1940 - 1890) + '\x30' + chr(0b101010 + 0o14), 20688 - 20680), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + '\062' + chr(0b110010) + '\x32', 26666 - 26658), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1101 + 0o46) + '\061' + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(50) + chr(744 - 693), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + chr(52) + chr(0b111 + 0o53), 18067 - 18059), ehT0Px3KOsy9(chr(1292 - 1244) + chr(0b1101111) + chr(0b110011) + '\x36' + chr(0b110011), 8), ehT0Px3KOsy9('\060' + '\157' + chr(485 - 434) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\065' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(1201 - 1152), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11100 + 0o26) + chr(0b100111 + 0o11) + chr(175 - 125), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x34' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\x33' + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\064' + '\065', 18985 - 18977)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'}'), chr(0b101100 + 0o70) + chr(8151 - 8050) + '\x63' + chr(0b101101 + 0o102) + '\x64' + chr(4806 - 4705))('\165' + '\x74' + chr(102) + chr(0b100110 + 0o7) + chr(1793 - 1737)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def uPABQqB7PIyn(EgS9dR_BAieQ, n4ljua2gi1Pr, **oBzhYCd3pS3F):
U1yWsg18CyLK = [(EgS9dR_BAieQ, [xafqLlk3kkUe(SXOLrMavuUCe(b'!\x1e\x84\x1d\xef\xfa$\xba\xabp\xa0/'), '\x64' + chr(101) + chr(0b1001011 + 0o30) + chr(0b1110 + 0o141) + chr(100) + '\x65')(chr(0b1110101) + '\164' + chr(1990 - 1888) + chr(0b100 + 0o51) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'<\x19\x80\x19\xef\xe8\x1a\xbc\xa3q\xa9\x15\x19kvm+'), '\x64' + chr(4521 - 4420) + chr(99) + chr(12077 - 11966) + chr(0b1100100) + chr(0b1001 + 0o134))(chr(0b1011110 + 0o27) + chr(0b1110100 + 0o0) + '\146' + chr(0b101101) + chr(2171 - 2115)), xafqLlk3kkUe(SXOLrMavuUCe(b'2\x18\x87\x15\xf2\xf0$\xbb\xba\x7f\xa4/'), '\144' + chr(101) + chr(0b10011 + 0o120) + chr(0b1101111) + chr(100) + chr(5109 - 5008))(chr(0b11100 + 0o131) + '\164' + '\146' + chr(0b10011 + 0o32) + chr(0b1110 + 0o52)), xafqLlk3kkUe(SXOLrMavuUCe(b'5\t\x92\x11\xf8\xc1\x13\xad\xa3y\xaf>'), chr(6831 - 6731) + chr(101) + chr(0b1100011) + '\157' + '\144' + '\x65')('\165' + '\x74' + chr(102) + chr(0b101101) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'5\t\x92\x11\xf8\xc1\x0c\xa1\xaej\xaf'), chr(0b1010100 + 0o20) + chr(0b1011101 + 0o10) + chr(1191 - 1092) + chr(111) + chr(3970 - 3870) + '\145')(chr(0b1110101) + chr(116) + chr(0b1011010 + 0o14) + '\x2d' + chr(56))]), (n4ljua2gi1Pr, [xafqLlk3kkUe(SXOLrMavuUCe(b'5\t\x92\x11\xf8\xc1\x08\xbc\xab}\xac\x15\x19rmk'), chr(0b11000 + 0o114) + chr(0b110011 + 0o62) + chr(0b1100011) + chr(10130 - 10019) + '\144' + chr(0b1 + 0o144))('\165' + chr(2949 - 2833) + chr(3165 - 3063) + '\x2d' + chr(2195 - 2139)), xafqLlk3kkUe(SXOLrMavuUCe(b':\x15\x87\x0e\xf4\xf0\x08\xa1\xa9A\xb5/\x1dzej\x11/q\x9f j'), chr(0b110100 + 0o60) + '\145' + chr(0b100000 + 0o103) + '\157' + chr(0b111100 + 0o50) + chr(0b1011110 + 0o7))(chr(117) + chr(116) + chr(102) + '\055' + chr(0b111000))])]
M8EIoTs2GJXE = {uwnd9_euJYKT: xafqLlk3kkUe(mDuDykdz0pcm, uwnd9_euJYKT) for (mDuDykdz0pcm, oIhwMA96NShQ) in U1yWsg18CyLK for uwnd9_euJYKT in oIhwMA96NShQ}
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'>\x14\x97\x19\xf1\xc1\x15\xa9\xa7{'), chr(0b1100100) + chr(101) + chr(3263 - 3164) + chr(111) + chr(0b1100100) + chr(0b1100101))('\x75' + '\164' + chr(0b101010 + 0o74) + chr(0b101101) + chr(56))] = n4ljua2gi1Pr.uVIiffPeN7yA
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b">\x14\x97\x19\xf1\xc1\x13\xb8\xabl\xa6'\x19"), '\144' + '\145' + chr(99) + chr(0b101000 + 0o107) + chr(5481 - 5381) + '\145')(chr(11740 - 11623) + chr(0b1011 + 0o151) + chr(102) + chr(0b101101) + chr(56))] = KvtIAVGi33Ty.create_hparams(n4ljua2gi1Pr.YBEkVLgqMiCU)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'$\x16\xac\x0c\xf2\xf2\x12\xab\xb3A\xb7+\x18zzQ=4s\x8c%aZ'), '\144' + '\145' + chr(0b1001100 + 0o27) + chr(0b1101111) + chr(100) + chr(0b1001101 + 0o30))(chr(0b1110101) + chr(0b110101 + 0o77) + chr(102) + chr(0b100100 + 0o11) + '\070')):
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b">\x14\x97\x19\xf1\xc1\x13\xb8\xabl\xa6'\x19"), chr(0b1100100) + chr(0b1100101) + chr(396 - 297) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + chr(5739 - 5623) + '\146' + chr(0b101101) + chr(0b111000))].KM32JV3e0qHG = ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + '\061', 8)
xafqLlk3kkUe(M8EIoTs2GJXE, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\x0f\xb29\xf4\xd01\xa6\xb3*\xa2z'), '\144' + '\x65' + chr(0b11101 + 0o106) + '\157' + '\144' + chr(2503 - 2402))(chr(117) + chr(0b1011001 + 0o33) + chr(0b1100110) + chr(0b11000 + 0o25) + chr(883 - 827)))(oBzhYCd3pS3F)
return M8EIoTs2GJXE
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
get_policy
|
def get_policy(observations, hparams, action_space):
"""Get a policy network.
Args:
observations: observations
hparams: parameters
action_space: action space
Returns:
Tuple (action logits, value).
"""
if not isinstance(action_space, gym.spaces.Discrete):
raise ValueError("Expecting discrete action space.")
obs_shape = common_layers.shape_list(observations)
(frame_height, frame_width) = obs_shape[2:4]
# TODO(afrozm): We have these dummy problems mainly for hparams, so cleanup
# when possible and do this properly.
if hparams.policy_problem_name == "dummy_policy_problem_ttt":
tf.logging.info("Using DummyPolicyProblemTTT for the policy.")
policy_problem = tic_tac_toe_env.DummyPolicyProblemTTT()
else:
tf.logging.info("Using DummyPolicyProblem for the policy.")
policy_problem = DummyPolicyProblem(action_space, frame_height, frame_width)
trainer_lib.add_problem_hparams(hparams, policy_problem)
hparams.force_full_predict = True
model = registry.model(hparams.policy_network)(
hparams, tf.estimator.ModeKeys.TRAIN
)
try:
num_target_frames = hparams.video_num_target_frames
except AttributeError:
num_target_frames = 1
features = {
"inputs": observations,
"input_action": tf.zeros(obs_shape[:2] + [1], dtype=tf.int32),
"input_reward": tf.zeros(obs_shape[:2] + [1], dtype=tf.int32),
"targets": tf.zeros(obs_shape[:1] + [num_target_frames] + obs_shape[2:]),
"target_action": tf.zeros(
obs_shape[:1] + [num_target_frames, 1], dtype=tf.int32),
"target_reward": tf.zeros(
obs_shape[:1] + [num_target_frames, 1], dtype=tf.int32),
"target_policy": tf.zeros(
obs_shape[:1] + [num_target_frames] + [action_space.n]),
"target_value": tf.zeros(
obs_shape[:1] + [num_target_frames])
}
with tf.variable_scope(tf.get_variable_scope(), reuse=tf.AUTO_REUSE):
t2t_model.create_dummy_vars()
(targets, _) = model(features)
return (targets["target_policy"][:, 0, :], targets["target_value"][:, 0])
|
python
|
def get_policy(observations, hparams, action_space):
"""Get a policy network.
Args:
observations: observations
hparams: parameters
action_space: action space
Returns:
Tuple (action logits, value).
"""
if not isinstance(action_space, gym.spaces.Discrete):
raise ValueError("Expecting discrete action space.")
obs_shape = common_layers.shape_list(observations)
(frame_height, frame_width) = obs_shape[2:4]
# TODO(afrozm): We have these dummy problems mainly for hparams, so cleanup
# when possible and do this properly.
if hparams.policy_problem_name == "dummy_policy_problem_ttt":
tf.logging.info("Using DummyPolicyProblemTTT for the policy.")
policy_problem = tic_tac_toe_env.DummyPolicyProblemTTT()
else:
tf.logging.info("Using DummyPolicyProblem for the policy.")
policy_problem = DummyPolicyProblem(action_space, frame_height, frame_width)
trainer_lib.add_problem_hparams(hparams, policy_problem)
hparams.force_full_predict = True
model = registry.model(hparams.policy_network)(
hparams, tf.estimator.ModeKeys.TRAIN
)
try:
num_target_frames = hparams.video_num_target_frames
except AttributeError:
num_target_frames = 1
features = {
"inputs": observations,
"input_action": tf.zeros(obs_shape[:2] + [1], dtype=tf.int32),
"input_reward": tf.zeros(obs_shape[:2] + [1], dtype=tf.int32),
"targets": tf.zeros(obs_shape[:1] + [num_target_frames] + obs_shape[2:]),
"target_action": tf.zeros(
obs_shape[:1] + [num_target_frames, 1], dtype=tf.int32),
"target_reward": tf.zeros(
obs_shape[:1] + [num_target_frames, 1], dtype=tf.int32),
"target_policy": tf.zeros(
obs_shape[:1] + [num_target_frames] + [action_space.n]),
"target_value": tf.zeros(
obs_shape[:1] + [num_target_frames])
}
with tf.variable_scope(tf.get_variable_scope(), reuse=tf.AUTO_REUSE):
t2t_model.create_dummy_vars()
(targets, _) = model(features)
return (targets["target_policy"][:, 0, :], targets["target_value"][:, 0])
|
[
"def",
"get_policy",
"(",
"observations",
",",
"hparams",
",",
"action_space",
")",
":",
"if",
"not",
"isinstance",
"(",
"action_space",
",",
"gym",
".",
"spaces",
".",
"Discrete",
")",
":",
"raise",
"ValueError",
"(",
"\"Expecting discrete action space.\"",
")",
"obs_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"observations",
")",
"(",
"frame_height",
",",
"frame_width",
")",
"=",
"obs_shape",
"[",
"2",
":",
"4",
"]",
"# TODO(afrozm): We have these dummy problems mainly for hparams, so cleanup",
"# when possible and do this properly.",
"if",
"hparams",
".",
"policy_problem_name",
"==",
"\"dummy_policy_problem_ttt\"",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Using DummyPolicyProblemTTT for the policy.\"",
")",
"policy_problem",
"=",
"tic_tac_toe_env",
".",
"DummyPolicyProblemTTT",
"(",
")",
"else",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Using DummyPolicyProblem for the policy.\"",
")",
"policy_problem",
"=",
"DummyPolicyProblem",
"(",
"action_space",
",",
"frame_height",
",",
"frame_width",
")",
"trainer_lib",
".",
"add_problem_hparams",
"(",
"hparams",
",",
"policy_problem",
")",
"hparams",
".",
"force_full_predict",
"=",
"True",
"model",
"=",
"registry",
".",
"model",
"(",
"hparams",
".",
"policy_network",
")",
"(",
"hparams",
",",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
")",
"try",
":",
"num_target_frames",
"=",
"hparams",
".",
"video_num_target_frames",
"except",
"AttributeError",
":",
"num_target_frames",
"=",
"1",
"features",
"=",
"{",
"\"inputs\"",
":",
"observations",
",",
"\"input_action\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"2",
"]",
"+",
"[",
"1",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
",",
"\"input_reward\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"2",
"]",
"+",
"[",
"1",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
",",
"\"targets\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"1",
"]",
"+",
"[",
"num_target_frames",
"]",
"+",
"obs_shape",
"[",
"2",
":",
"]",
")",
",",
"\"target_action\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"1",
"]",
"+",
"[",
"num_target_frames",
",",
"1",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
",",
"\"target_reward\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"1",
"]",
"+",
"[",
"num_target_frames",
",",
"1",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
",",
"\"target_policy\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"1",
"]",
"+",
"[",
"num_target_frames",
"]",
"+",
"[",
"action_space",
".",
"n",
"]",
")",
",",
"\"target_value\"",
":",
"tf",
".",
"zeros",
"(",
"obs_shape",
"[",
":",
"1",
"]",
"+",
"[",
"num_target_frames",
"]",
")",
"}",
"with",
"tf",
".",
"variable_scope",
"(",
"tf",
".",
"get_variable_scope",
"(",
")",
",",
"reuse",
"=",
"tf",
".",
"AUTO_REUSE",
")",
":",
"t2t_model",
".",
"create_dummy_vars",
"(",
")",
"(",
"targets",
",",
"_",
")",
"=",
"model",
"(",
"features",
")",
"return",
"(",
"targets",
"[",
"\"target_policy\"",
"]",
"[",
":",
",",
"0",
",",
":",
"]",
",",
"targets",
"[",
"\"target_value\"",
"]",
"[",
":",
",",
"0",
"]",
")"
] |
Get a policy network.
Args:
observations: observations
hparams: parameters
action_space: action space
Returns:
Tuple (action logits, value).
|
[
"Get",
"a",
"policy",
"network",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L280-L332
|
train
|
Get a policy network.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSK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,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(0b11101 + 0o23) + chr(111) + chr(0b11010 + 0o30) + '\x34' + chr(351 - 302), 7807 - 7799), ehT0Px3KOsy9(chr(48) + chr(5038 - 4927) + chr(50) + chr(0b1100 + 0o47) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1100 + 0o52) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\066' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(51) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\x32' + chr(49), 23938 - 23930), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + chr(0b110011) + chr(2422 - 2368) + chr(48), 59659 - 59651), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b100101 + 0o16) + chr(915 - 862), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b10111 + 0o31) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\064', 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1010111 + 0o30) + chr(1948 - 1893) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1092 - 981) + chr(51) + chr(51) + '\061', 0b1000), ehT0Px3KOsy9(chr(281 - 233) + '\x6f' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000 + 0o3) + chr(0b110110) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b110110) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1152 - 1103) + '\061' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(613 - 565) + chr(0b101001 + 0o106) + chr(0b110010) + chr(52) + chr(54), 0b1000), ehT0Px3KOsy9(chr(282 - 234) + chr(0b10001 + 0o136) + chr(50) + chr(0b110010) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + chr(0b1001 + 0o52) + '\x31' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + '\061' + chr(0b1100 + 0o44) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1521 - 1410) + chr(999 - 949) + chr(0b1111 + 0o43) + chr(0b101001 + 0o14), 0o10), ehT0Px3KOsy9('\x30' + chr(6369 - 6258) + '\x32' + '\062' + '\066', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + '\x33' + chr(0b10000 + 0o47) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11011 + 0o124) + chr(639 - 587) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(7736 - 7625) + chr(0b110111) + chr(0b100110 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(59 - 9) + '\x35' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(6596 - 6485) + chr(53) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(2694 - 2639) + chr(1614 - 1563), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2538 - 2427) + '\063' + chr(0b110010) + chr(0b110011), 29106 - 29098), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + '\x31' + chr(453 - 403) + chr(55), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x37' + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\064' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + chr(0b110010) + '\063' + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(9054 - 8943) + '\062' + '\066', 34592 - 34584), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b10111 + 0o34), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(55) + chr(54), 8), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + '\x33' + chr(0b110010) + chr(0b110001), 23628 - 23620), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b10011 + 0o36) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b111011 + 0o64) + chr(0b110001) + '\x37' + chr(0b110101), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + '\065' + chr(0b100010 + 0o16), 40477 - 40469)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f'), chr(3434 - 3334) + chr(101) + chr(99) + chr(0b1101111) + chr(0b1001111 + 0o25) + '\x65')(chr(0b1110101) + chr(0b1010001 + 0o43) + chr(9348 - 9246) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def zh9fX_r7dhfA(uswa0rn3Tb4L, n4ljua2gi1Pr, yiKBhCVj2bwE):
if not PlSM16l2KDPD(yiKBhCVj2bwE, xafqLlk3kkUe(mZyhk1NGHEBF.spaces, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe5\xf0B\x96h4\x84\xf8'), '\x64' + chr(101) + chr(99) + '\157' + '\x64' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(1593 - 1491) + chr(0b101101) + '\x38'))):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4\xe1A\x90y%\x99\xf3&,]\xb0t\x97\xc2,\xd2\xf5\xee%\xf6\xe2\x91JP0\xdfY\xda\xb02\x15'), '\144' + chr(101) + chr(0b1100011) + chr(111) + chr(9921 - 9821) + '\x65')(chr(117) + chr(116) + chr(0b1100110) + '\055' + chr(0b100111 + 0o21)))
ZOxGtswZWoAi = jSKPaHwSAfVv.shape_list(uswa0rn3Tb4L)
(jbr7zSbizJ6Y, ffKlypcIngl_) = ZOxGtswZWoAi[ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(4222 - 4111) + chr(0b110010), 0b1000):ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100), 0o10)]
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b"\xd1\xf6]\x9cy(\xaf\xed3c[\xb5b\x99\xef'\xc7\xfd\xab"), chr(100) + chr(101) + chr(0b10100 + 0o117) + '\x6f' + chr(1076 - 976) + chr(0b1100101))(chr(6602 - 6485) + '\164' + chr(0b1001101 + 0o31) + chr(0b100 + 0o51) + chr(56))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xec\\\x98c\x0e\x80\xf2-eZ\xa0X\x84\xc2&\xc4\xfc\xab)\xca\xe2\x8cQ'), chr(0b1100100) + chr(8424 - 8323) + chr(0b1011000 + 0o13) + chr(0b11100 + 0o123) + chr(6383 - 6283) + chr(0b1100101))('\165' + chr(116) + chr(3855 - 3753) + '\x2d' + '\070'):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\xaey\x8do2\x97\xaa+`c\xb2'), chr(100) + chr(101) + chr(99) + chr(0b1100 + 0o143) + '\x64' + chr(101))(chr(117) + '\x74' + '\x66' + '\055' + chr(0b11011 + 0o35)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\xeaX\x9b}q\xb4\xe8,a@\x89h\x98\xd9*\xdf\xc0\xbc+\xf7\xfa\x9dHjD\xf8\t\xdd\xbc%\x1bT\xf4s+N\xbe \x14\xc2\xe0\x1f'), chr(0b1100100) + chr(0b101111 + 0o66) + chr(0b1100011) + chr(3331 - 3220) + '\144' + chr(101))(chr(11121 - 11004) + chr(0b1110100) + chr(0b1100011 + 0o3) + chr(0b100011 + 0o12) + '\x38'))
DO8YGEHopnAA = nbWrDlsJtklA.DummyPolicyProblemTTT()
else:
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\xaey\x8do2\x97\xaa+`c\xb2'), '\x64' + chr(101) + '\x63' + chr(0b1101111) + chr(100) + chr(0b100010 + 0o103))('\165' + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\xeaX\x9b}q\xb4\xe8,a@\x89h\x98\xd9*\xdf\xc0\xbc+\xf7\xfa\x9dH\x1ev\xc3[\x9b\xa7?^\x00\xecygW\xb25S'), '\144' + '\x65' + chr(264 - 165) + chr(0b1101111) + '\x64' + chr(101))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(56)))
DO8YGEHopnAA = VPYOScxxvw7A(yiKBhCVj2bwE, jbr7zSbizJ6Y, ffKlypcIngl_)
xafqLlk3kkUe(KvtIAVGi33Ty, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\xfdU\xaaj#\x9f\xff-iT\x86o\x84\xd1;\xc7\xfd\xbd'), chr(100) + chr(101) + '\x63' + chr(10163 - 10052) + chr(0b110101 + 0o57) + '\145')(chr(0b1110101) + '\x74' + '\146' + '\x2d' + '\x38'))(n4ljua2gi1Pr, DO8YGEHopnAA)
n4ljua2gi1Pr.FmdIbDrE7jNj = ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101110 + 0o1) + chr(0b110000 + 0o1), ord("\x08"))
FK0vqzZ5gPN6 = U24OBsRcVqkJ.FK0vqzZ5gPN6(n4ljua2gi1Pr.c2VHuW1Ajc2l)(n4ljua2gi1Pr, IDJ2eXGCBCDu.estimator.ModeKeys.TRAIN)
try:
NLjEwYh4xGut = n4ljua2gi1Pr.UxYiT0ZFW2SZ
except sHOWSIAKtU58:
NLjEwYh4xGut = ehT0Px3KOsy9(chr(77 - 29) + chr(10448 - 10337) + chr(49), 8)
EEf4r9nUvta_ = {xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xf7A\x80n"'), '\x64' + '\145' + chr(0b1100011) + chr(3937 - 3826) + chr(0b1100100) + '\x65')('\165' + '\x74' + chr(4082 - 3980) + chr(45) + chr(330 - 274)): uswa0rn3Tb4L, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xf7A\x80n\x0e\x91\xfe5eV\xb7'), '\144' + chr(0b1100101) + '\x63' + chr(0b1000001 + 0o56) + chr(2375 - 2275) + chr(3102 - 3001))(chr(11384 - 11267) + chr(0b0 + 0o164) + chr(0b1100 + 0o132) + chr(0b101101) + '\x38'): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + chr(0b110001 + 0o1), 8)] + [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), 8)], dtype=IDJ2eXGCBCDu.int32), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xf7A\x80n\x0e\x82\xf86mK\xbd'), chr(0b101101 + 0o67) + chr(101) + chr(4367 - 4268) + chr(0b11111 + 0o120) + chr(8428 - 8328) + '\x65')('\x75' + chr(0b1110100) + '\x66' + chr(45) + chr(0b111000)): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + chr(0b110010), 8)] + [ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8)], dtype=IDJ2eXGCBCDu.int32), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\x83'), '\x64' + '\x65' + '\143' + chr(0b1101111) + chr(0b1001001 + 0o33) + chr(0b1100101))(chr(7215 - 7098) + '\164' + chr(0b1100110) + chr(45) + '\x38'): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\061', 8)] + [NLjEwYh4xGut] + ZOxGtswZWoAi[ehT0Px3KOsy9(chr(499 - 451) + chr(111) + '\062', 8):]), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\xaf\xfc"xP\xb6i'), chr(6920 - 6820) + '\x65' + chr(0b1100011) + '\157' + '\144' + chr(0b100101 + 0o100))(chr(0b1001101 + 0o50) + chr(552 - 436) + chr(2837 - 2735) + chr(0b101101) + chr(0b100111 + 0o21)): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + '\x31', 8)] + [NLjEwYh4xGut, ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8)], dtype=IDJ2eXGCBCDu.int32), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\xaf\xef${X\xabc'), '\x64' + chr(101) + chr(832 - 733) + '\x6f' + chr(0b1100100) + chr(0b101110 + 0o67))('\165' + chr(0b1101 + 0o147) + chr(4799 - 4697) + '\055' + chr(0b111000)): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9(chr(48) + chr(6371 - 6260) + '\x31', 8)] + [NLjEwYh4xGut, ehT0Px3KOsy9('\x30' + chr(111) + chr(95 - 46), 8)], dtype=IDJ2eXGCBCDu.int32), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\xaf\xed.`P\xba~'), '\x64' + chr(0b1111 + 0o126) + '\143' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + '\x66' + '\x2d' + chr(2825 - 2769)): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9('\x30' + '\x6f' + '\x31', 8)] + [NLjEwYh4xGut] + [yiKBhCVj2bwE.m1NkCryOw9Bx]), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\xaf\xeb `L\xbc'), '\144' + chr(0b1100101) + chr(4156 - 4057) + chr(7427 - 7316) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(920 - 818) + '\055' + '\070'): IDJ2eXGCBCDu.zeros(ZOxGtswZWoAi[:ehT0Px3KOsy9('\x30' + '\157' + chr(49), 8)] + [NLjEwYh4xGut])}
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7\xf8C\x9c{3\x9c\xf8\x1e\x7fZ\xb6w\x91'), chr(4409 - 4309) + chr(101) + chr(0b101001 + 0o72) + chr(0b100111 + 0o110) + chr(0b1000011 + 0o41) + chr(2249 - 2148))(chr(0b1110101) + '\x74' + chr(102) + chr(1320 - 1275) + chr(0b110111 + 0o1)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6\xfcE\xaal0\x82\xf4 nU\xbcX\x87\xd3&\xd6\xf5'), '\144' + chr(4497 - 4396) + chr(99) + chr(0b1010 + 0o145) + chr(8996 - 8896) + chr(9147 - 9046))(chr(10279 - 10162) + chr(0b1110100) + chr(102) + '\x2d' + chr(0b1100 + 0o54)))(), reuse=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xcce\xbaE\x03\xb5\xc8\x12I'), chr(0b110 + 0o136) + chr(0b101101 + 0o70) + '\143' + '\157' + '\x64' + chr(101))(chr(117) + chr(10683 - 10567) + '\146' + chr(905 - 860) + chr(56)))):
xafqLlk3kkUe(BeAyCOlpGTfm, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2\xebT\x94n4\xaf\xf94aT\xa0X\x82\xd1;\xd5'), '\x64' + '\x65' + '\x63' + '\157' + '\x64' + chr(3079 - 2978))(chr(117) + chr(9968 - 9852) + chr(0b1010110 + 0o20) + '\055' + '\x38'))()
(xIEmRseySp3z, VNGQdHSFPrso) = FK0vqzZ5gPN6(EEf4r9nUvta_)
return (xIEmRseySp3z[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\xaf\xed.`P\xba~'), chr(100) + chr(0b101 + 0o140) + chr(99) + '\157' + '\x64' + '\x65')('\165' + chr(0b1110100) + '\x66' + '\x2d' + chr(0b111000))][:, ehT0Px3KOsy9(chr(48) + '\157' + chr(48), 0b1000), :], xIEmRseySp3z[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xf8C\x92\x7f%\xaf\xeb `L\xbc'), chr(318 - 218) + chr(6292 - 6191) + chr(772 - 673) + chr(6702 - 6591) + '\144' + '\x65')('\165' + '\x74' + chr(5659 - 5557) + chr(0b101101) + chr(1800 - 1744))][:, ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + chr(48), 8)])
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
rlmf_tictactoe
|
def rlmf_tictactoe():
"""Base set of hparams for model-free PPO."""
hparams = rlmf_original()
hparams.game = "tictactoe"
hparams.rl_env_name = "T2TEnv-TicTacToeEnv-v0"
# Since we don't have any no-op actions, otherwise we have to have an
# attribute called `get_action_meanings`.
hparams.eval_max_num_noops = 0
hparams.max_num_noops = 0
hparams.rl_should_derive_observation_space = False
hparams.policy_network = "feed_forward_categorical_policy"
hparams.base_algo_params = "ppo_ttt_params"
# Number of last observations to feed to the agent
hparams.frame_stack_size = 1
return hparams
|
python
|
def rlmf_tictactoe():
"""Base set of hparams for model-free PPO."""
hparams = rlmf_original()
hparams.game = "tictactoe"
hparams.rl_env_name = "T2TEnv-TicTacToeEnv-v0"
# Since we don't have any no-op actions, otherwise we have to have an
# attribute called `get_action_meanings`.
hparams.eval_max_num_noops = 0
hparams.max_num_noops = 0
hparams.rl_should_derive_observation_space = False
hparams.policy_network = "feed_forward_categorical_policy"
hparams.base_algo_params = "ppo_ttt_params"
# Number of last observations to feed to the agent
hparams.frame_stack_size = 1
return hparams
|
[
"def",
"rlmf_tictactoe",
"(",
")",
":",
"hparams",
"=",
"rlmf_original",
"(",
")",
"hparams",
".",
"game",
"=",
"\"tictactoe\"",
"hparams",
".",
"rl_env_name",
"=",
"\"T2TEnv-TicTacToeEnv-v0\"",
"# Since we don't have any no-op actions, otherwise we have to have an",
"# attribute called `get_action_meanings`.",
"hparams",
".",
"eval_max_num_noops",
"=",
"0",
"hparams",
".",
"max_num_noops",
"=",
"0",
"hparams",
".",
"rl_should_derive_observation_space",
"=",
"False",
"hparams",
".",
"policy_network",
"=",
"\"feed_forward_categorical_policy\"",
"hparams",
".",
"base_algo_params",
"=",
"\"ppo_ttt_params\"",
"# Number of last observations to feed to the agent",
"hparams",
".",
"frame_stack_size",
"=",
"1",
"return",
"hparams"
] |
Base set of hparams for model-free PPO.
|
[
"Base",
"set",
"of",
"hparams",
"for",
"model",
"-",
"free",
"PPO",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L427-L443
|
train
|
Base set of hparams for model - free PPO.
|
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,hr2QaoivbFQ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_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(0b1100110 + 0o11) + chr(0b110011) + chr(0b110000) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(50) + '\060', 186 - 178), ehT0Px3KOsy9(chr(2266 - 2218) + chr(0b11010 + 0o125) + chr(51) + chr(211 - 157) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + chr(0b110001 + 0o1) + chr(1401 - 1351) + chr(0b110001), 34185 - 34177), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(2365 - 2254) + '\x31' + '\x36' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(623 - 574) + chr(0b10000 + 0o47) + chr(0b1001 + 0o54), 27689 - 27681), ehT0Px3KOsy9(chr(1358 - 1310) + chr(0b1101111) + '\061' + chr(51) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1881 - 1833) + chr(0b1101111) + chr(0b10011 + 0o36) + chr(0b1100 + 0o47) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1010 + 0o47) + chr(0b11111 + 0o27) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + chr(2266 - 2217) + '\x32' + chr(637 - 589), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110 + 0o54) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2481 - 2430) + chr(2595 - 2541) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\066' + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(552 - 441) + chr(0b110011) + chr(49) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b110101) + chr(0b100000 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10001 + 0o41) + chr(48), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(1408 - 1359) + '\x34' + '\064', 52270 - 52262), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(2499 - 2447) + chr(1130 - 1077), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(51) + chr(0b100010 + 0o23), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(0b110000) + chr(673 - 621), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + '\x32' + chr(51) + '\064', 59683 - 59675), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(55) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(287 - 238), 0o10), ehT0Px3KOsy9(chr(766 - 718) + '\x6f' + '\x36' + '\x35', 8), ehT0Px3KOsy9('\x30' + chr(620 - 509) + chr(1695 - 1646) + chr(48) + chr(0b11 + 0o63), 44638 - 44630), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(665 - 615) + chr(0b11011 + 0o34) + chr(1573 - 1525), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6395 - 6284) + chr(0b10001 + 0o41) + chr(52) + chr(0b110100), 8046 - 8038), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + '\x33' + '\x37' + '\x35', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\x35' + chr(2452 - 2401), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(53), 51382 - 51374), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + chr(607 - 557) + chr(676 - 623), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b110010) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(0b1000100 + 0o53) + chr(49) + chr(0b100010 + 0o16) + chr(50), 0b1000), ehT0Px3KOsy9(chr(1844 - 1796) + chr(111) + chr(0b101111 + 0o3) + '\063' + chr(0b1001 + 0o53), 8), ehT0Px3KOsy9(chr(1453 - 1405) + chr(111) + chr(49) + '\x30' + '\065', 0o10), ehT0Px3KOsy9(chr(2025 - 1977) + chr(0b1011000 + 0o27) + chr(50) + chr(0b1 + 0o65), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(12097 - 11986) + chr(1318 - 1268) + '\x34' + chr(648 - 593), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(51) + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\063' + '\x36' + chr(1305 - 1251), 26851 - 26843)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xee'), '\144' + '\x65' + chr(4460 - 4361) + chr(2933 - 2822) + chr(0b1010001 + 0o23) + '\x65')(chr(1659 - 1542) + chr(0b10101 + 0o137) + chr(5430 - 5328) + chr(0b100001 + 0o14) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def zUbLc0REJmU6():
n4ljua2gi1Pr = rzIXxQ9pg3sZ()
n4ljua2gi1Pr.HeBgEuhWIg0z = xafqLlk3kkUe(SXOLrMavuUCe(b'\xb49\x97\xe5\x15\x1e)6\x15'), chr(0b1100100) + chr(6313 - 6212) + chr(4828 - 4729) + '\157' + '\x64' + chr(0b1100101))(chr(0b100101 + 0o120) + '\164' + chr(7876 - 7774) + '\x2d' + chr(0b111000))
n4ljua2gi1Pr.bi7asw5xatkK = xafqLlk3kkUe(SXOLrMavuUCe(b'\x94b\xa0\xd4\x1a\x0bp\r\x193D\x93V\x99\x86WU\n\x93p2\xac'), '\144' + chr(101) + '\x63' + chr(0b1101111) + '\144' + '\x65')('\165' + chr(0b1110100 + 0o0) + chr(0b10000 + 0o126) + chr(0b101101) + chr(56))
n4ljua2gi1Pr.OwVsnpOOrOZC = ehT0Px3KOsy9(chr(0b110000) + chr(7743 - 7632) + chr(48), 0o10)
n4ljua2gi1Pr.PNkPtpEftL3Z = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1533 - 1485), 8)
n4ljua2gi1Pr.SORSmAeTEyRZ = ehT0Px3KOsy9(chr(2139 - 2091) + chr(0b1101111) + '\060', 8)
n4ljua2gi1Pr.c2VHuW1Ajc2l = xafqLlk3kkUe(SXOLrMavuUCe(b'\xa65\x91\xf5+\x1b2+\x071b\x96j\xae\x88Fu\x03\x8a/-\xff\x9cuj6\xd7\xc8\x94\x88|'), chr(0b1100100) + chr(5804 - 5703) + '\143' + '\157' + chr(100) + chr(0b1100101))('\165' + chr(0b1101111 + 0o5) + '\x66' + '\x2d' + chr(56))
n4ljua2gi1Pr.eNhPLh6cTW8q = xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0 \x9b\xce\x00\t)\x06\x001b\x93X\xbe'), chr(2957 - 2857) + chr(0b101010 + 0o73) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(45) + chr(1925 - 1869))
n4ljua2gi1Pr.YYpMgs8WK8M7 = ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + '\x31', ord("\x08"))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
rlmf_tiny
|
def rlmf_tiny():
"""Tiny set of hparams for model-free PPO."""
hparams = rlmf_original()
hparams = hparams.override_from_dict(rlmf_tiny_overrides())
hparams.batch_size = 2
hparams.base_algo_params = "ppo_original_tiny"
hparams.add_hparam("ppo_epochs_num", 3)
hparams.add_hparam("ppo_epoch_length", 2)
return hparams
|
python
|
def rlmf_tiny():
"""Tiny set of hparams for model-free PPO."""
hparams = rlmf_original()
hparams = hparams.override_from_dict(rlmf_tiny_overrides())
hparams.batch_size = 2
hparams.base_algo_params = "ppo_original_tiny"
hparams.add_hparam("ppo_epochs_num", 3)
hparams.add_hparam("ppo_epoch_length", 2)
return hparams
|
[
"def",
"rlmf_tiny",
"(",
")",
":",
"hparams",
"=",
"rlmf_original",
"(",
")",
"hparams",
"=",
"hparams",
".",
"override_from_dict",
"(",
"rlmf_tiny_overrides",
"(",
")",
")",
"hparams",
".",
"batch_size",
"=",
"2",
"hparams",
".",
"base_algo_params",
"=",
"\"ppo_original_tiny\"",
"hparams",
".",
"add_hparam",
"(",
"\"ppo_epochs_num\"",
",",
"3",
")",
"hparams",
".",
"add_hparam",
"(",
"\"ppo_epoch_length\"",
",",
"2",
")",
"return",
"hparams"
] |
Tiny set of hparams for model-free PPO.
|
[
"Tiny",
"set",
"of",
"hparams",
"for",
"model",
"-",
"free",
"PPO",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L456-L464
|
train
|
Tiny set of hparams for model - free PPO.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjA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Q_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(1814 - 1766) + '\157' + chr(1961 - 1912), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100000 + 0o23) + chr(1499 - 1445) + '\066', 1038 - 1030), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + '\063' + '\x36' + chr(0b101 + 0o54), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(2365 - 2316) + chr(0b110010), 20026 - 20018), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(48) + chr(2303 - 2250), 0o10), ehT0Px3KOsy9(chr(771 - 723) + '\x6f' + chr(0b1001 + 0o51) + chr(1120 - 1070) + chr(0b101100 + 0o7), 44358 - 44350), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11111 + 0o24) + chr(0b110100) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110111) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(241 - 193) + chr(0b1100111 + 0o10) + chr(2058 - 2007) + '\x35' + chr(1234 - 1185), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11111 + 0o120) + chr(0b110110) + '\064', 20711 - 20703), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\x33' + '\x35' + chr(2280 - 2231), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b111 + 0o53) + '\065' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1689 - 1641) + chr(0b1101111) + chr(663 - 612) + chr(0b110011) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + '\063' + chr(1303 - 1249) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(10099 - 9988) + chr(63 - 14) + '\x33' + chr(0b101010 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + chr(49), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11010 + 0o30) + chr(0b1111 + 0o43) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2287 - 2238) + chr(0b100001 + 0o23) + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10101 + 0o35) + chr(0b100100 + 0o16) + chr(372 - 323), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + '\x33' + chr(51) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\067' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(1668 - 1619), 12148 - 12140), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100011 + 0o22) + '\061', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(55) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1338 - 1290) + chr(111) + '\x32' + chr(53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + '\x33' + chr(50) + chr(135 - 87), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2142 - 2091) + chr(50) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\x36', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b10111 + 0o33) + '\060', 0b1000), ehT0Px3KOsy9(chr(380 - 332) + chr(0b1100011 + 0o14) + '\063' + chr(551 - 498) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + chr(49) + chr(1776 - 1722) + chr(0b101100 + 0o4), 4453 - 4445), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(0b10100 + 0o35) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1956 - 1908) + chr(0b1001011 + 0o44) + '\x33' + chr(0b1101 + 0o47) + '\x30', 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b110011) + '\062' + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\064' + chr(0b10 + 0o62), 0o10), ehT0Px3KOsy9('\x30' + chr(3948 - 3837) + '\x33' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b10110 + 0o131) + '\x33' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(1172 - 1121) + chr(0b110111) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + '\062' + chr(0b110100) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\x30' + '\063', 51970 - 51962)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1651 - 1603) + '\x6f' + '\x35' + chr(501 - 453), 20003 - 19995)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'/'), chr(0b1100100) + chr(0b100 + 0o141) + '\143' + chr(11020 - 10909) + chr(4544 - 4444) + chr(3522 - 3421))('\x75' + chr(0b1110100) + chr(2301 - 2199) + chr(0b1111 + 0o36) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def YSOlQdoYe5_G():
n4ljua2gi1Pr = rzIXxQ9pg3sZ()
n4ljua2gi1Pr = n4ljua2gi1Pr.override_from_dict(FCaPoVC966WW())
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\x32', 0o10)
n4ljua2gi1Pr.eNhPLh6cTW8q = xafqLlk3kkUe(SXOLrMavuUCe(b'q\x86\x9e\x15\xea\xe1\x89\x1c\x80Z\x88\xc3\x83\x841o\xec'), '\x64' + '\x65' + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1100101))('\x75' + chr(116) + chr(9919 - 9817) + '\055' + chr(0b111000))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'`\x92\x95\x15\xed\xe3\x81\t\x88Y'), chr(0b111011 + 0o51) + '\x65' + chr(8213 - 8114) + chr(9555 - 9444) + chr(4519 - 4419) + '\145')('\x75' + '\x74' + '\x66' + chr(0b100110 + 0o7) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'q\x86\x9e\x15\xe0\xe3\x8f\x18\x81G\xb6\xc1\xa9\x9d'), chr(3980 - 3880) + chr(0b1100000 + 0o5) + chr(99) + chr(0b1101111) + '\x64' + chr(0b10000 + 0o125))(chr(8898 - 8781) + chr(116) + chr(0b1100001 + 0o5) + chr(0b101101) + '\070'), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33', 0o10))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'`\x92\x95\x15\xed\xe3\x81\t\x88Y'), chr(0b1100100) + chr(0b1001 + 0o134) + chr(0b101010 + 0o71) + '\157' + chr(100) + chr(8726 - 8625))(chr(0b1110101) + chr(0b1110100) + chr(102) + '\x2d' + chr(3080 - 3024)))(xafqLlk3kkUe(SXOLrMavuUCe(b'q\x86\x9e\x15\xe0\xe3\x8f\x18\x81k\x85\xca\xb2\x97,i'), chr(5486 - 5386) + chr(0b1100101) + '\143' + '\x6f' + chr(0b111000 + 0o54) + chr(101))('\x75' + chr(0b1110100) + chr(3329 - 3227) + chr(0b101101) + '\070'), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(10259 - 10148) + chr(2398 - 2348), 8))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
rlmf_dqn_tiny
|
def rlmf_dqn_tiny():
"""Tiny DQN params."""
hparams = rlmf_original()
hparams = hparams.override_from_dict(rlmf_tiny_overrides())
hparams.batch_size = 1
hparams.base_algo = "dqn"
hparams.base_algo_params = "dqn_original_params"
hparams.add_hparam("dqn_num_frames", 128)
hparams.add_hparam("dqn_save_every_steps", 128)
hparams.add_hparam("dqn_replay_buffer_replay_capacity", 100)
hparams.add_hparam("dqn_agent_min_replay_history", 10)
return hparams
|
python
|
def rlmf_dqn_tiny():
"""Tiny DQN params."""
hparams = rlmf_original()
hparams = hparams.override_from_dict(rlmf_tiny_overrides())
hparams.batch_size = 1
hparams.base_algo = "dqn"
hparams.base_algo_params = "dqn_original_params"
hparams.add_hparam("dqn_num_frames", 128)
hparams.add_hparam("dqn_save_every_steps", 128)
hparams.add_hparam("dqn_replay_buffer_replay_capacity", 100)
hparams.add_hparam("dqn_agent_min_replay_history", 10)
return hparams
|
[
"def",
"rlmf_dqn_tiny",
"(",
")",
":",
"hparams",
"=",
"rlmf_original",
"(",
")",
"hparams",
"=",
"hparams",
".",
"override_from_dict",
"(",
"rlmf_tiny_overrides",
"(",
")",
")",
"hparams",
".",
"batch_size",
"=",
"1",
"hparams",
".",
"base_algo",
"=",
"\"dqn\"",
"hparams",
".",
"base_algo_params",
"=",
"\"dqn_original_params\"",
"hparams",
".",
"add_hparam",
"(",
"\"dqn_num_frames\"",
",",
"128",
")",
"hparams",
".",
"add_hparam",
"(",
"\"dqn_save_every_steps\"",
",",
"128",
")",
"hparams",
".",
"add_hparam",
"(",
"\"dqn_replay_buffer_replay_capacity\"",
",",
"100",
")",
"hparams",
".",
"add_hparam",
"(",
"\"dqn_agent_min_replay_history\"",
",",
"10",
")",
"return",
"hparams"
] |
Tiny DQN params.
|
[
"Tiny",
"DQN",
"params",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L468-L479
|
train
|
Tiny DQN params.
|
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,j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V0ySZcNds,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(10607 - 10496) + '\061' + chr(0b110001) + chr(0b101011 + 0o10), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110101) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1294 - 1246) + '\157' + '\063' + chr(0b10110 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000111 + 0o50) + chr(49) + chr(0b1110 + 0o44) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b110101) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2030 - 1979) + '\x32' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(55) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(1852 - 1798) + chr(1849 - 1797), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3400 - 3289) + chr(0b100011 + 0o23) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(3439 - 3328) + chr(0b110011) + chr(0b110101 + 0o0) + chr(1784 - 1736), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b11 + 0o63) + chr(52), 0o10), ehT0Px3KOsy9(chr(801 - 753) + chr(111) + '\062' + chr(0b101110 + 0o7) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(663 - 615) + chr(0b1010011 + 0o34) + chr(50) + chr(1516 - 1463), 0b1000), ehT0Px3KOsy9(chr(48) + chr(891 - 780) + chr(50) + '\x30' + chr(0b1111 + 0o46), 56486 - 56478), ehT0Px3KOsy9(chr(1345 - 1297) + chr(111) + chr(50) + chr(705 - 654) + chr(553 - 504), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(52) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(0b110010) + chr(2701 - 2648) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(928 - 817) + chr(0b101001 + 0o12) + chr(969 - 918) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(11983 - 11872) + chr(53) + chr(0b110001 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11011 + 0o124) + '\061' + chr(0b11010 + 0o32) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(4699 - 4588) + '\063' + '\x35', 0b1000), ehT0Px3KOsy9(chr(448 - 400) + chr(0b1101111) + '\x32' + '\067', 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\157' + '\061', 0o10), ehT0Px3KOsy9(chr(748 - 700) + '\157' + chr(0b110 + 0o54) + '\065' + chr(1408 - 1357), 19678 - 19670), ehT0Px3KOsy9(chr(1605 - 1557) + chr(0b1101111) + chr(2920 - 2865) + chr(0b1001 + 0o53), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(2377 - 2326) + '\x36' + chr(52), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b11111 + 0o22) + chr(1681 - 1626) + chr(0b101010 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(1802 - 1754) + '\157' + chr(0b10100 + 0o35) + chr(0b110010 + 0o2) + chr(1330 - 1278), 2372 - 2364), ehT0Px3KOsy9(chr(2050 - 2002) + chr(0b11010 + 0o125) + '\063' + chr(0b110101) + chr(0b10 + 0o65), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11100 + 0o25) + chr(0b110001) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(1721 - 1672) + chr(1664 - 1611), 22417 - 22409), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(8502 - 8391) + chr(2004 - 1955), 8), ehT0Px3KOsy9(chr(0b110000) + chr(3864 - 3753) + chr(51) + '\062' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(904 - 855) + chr(0b110110) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + chr(2296 - 2245) + chr(1970 - 1916) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b11010 + 0o30) + chr(2725 - 2671), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b1100 + 0o50) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(938 - 884) + chr(55), 8607 - 8599), ehT0Px3KOsy9('\x30' + '\x6f' + chr(466 - 416) + chr(0b110111) + '\x35', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1100100 + 0o13) + '\065' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'e'), chr(100) + '\145' + chr(4091 - 3992) + chr(0b111011 + 0o64) + '\144' + chr(0b110110 + 0o57))(chr(263 - 146) + chr(0b1110100) + chr(102) + chr(0b1011 + 0o42) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def eXp_ekshuPJR():
n4ljua2gi1Pr = rzIXxQ9pg3sZ()
n4ljua2gi1Pr = n4ljua2gi1Pr.override_from_dict(FCaPoVC966WW())
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(537 - 489) + '\157' + '\061', 8)
n4ljua2gi1Pr.fuZMZiRkIYJT = xafqLlk3kkUe(SXOLrMavuUCe(b'/\\p'), chr(6773 - 6673) + chr(3300 - 3199) + chr(0b1001001 + 0o32) + chr(0b1010010 + 0o35) + chr(0b10000 + 0o124) + '\145')(chr(0b100111 + 0o116) + chr(8588 - 8472) + chr(0b1100110) + chr(0b101101) + chr(56))
n4ljua2gi1Pr.eNhPLh6cTW8q = xafqLlk3kkUe(SXOLrMavuUCe(b'/\\pC?\x9d\xbc\xda\x1d]\x89\x98\xf1e\xe4\xeb\xc6\xc0\xaf'), chr(100) + chr(1646 - 1545) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(5152 - 5051))(chr(1302 - 1185) + chr(116) + chr(4157 - 4055) + '\055' + '\x38')
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'*IzC8\x9f\xb4\xcf\x15^'), '\x64' + '\x65' + chr(950 - 851) + chr(0b1101111) + chr(100) + chr(101))(chr(0b101000 + 0o115) + '\x74' + chr(0b101010 + 0o74) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'/\\pC>\x9a\xb8\xe2\x12A\x89\x99\xcbf'), chr(100) + chr(101) + chr(0b100 + 0o137) + chr(0b1000110 + 0o51) + chr(0b11011 + 0o111) + chr(0b11111 + 0o106))(chr(117) + chr(11420 - 11304) + chr(102) + '\x2d' + chr(2050 - 1994)), ehT0Px3KOsy9('\x30' + '\157' + chr(1302 - 1252) + '\060' + chr(536 - 488), 0o10))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'*IzC8\x9f\xb4\xcf\x15^'), chr(0b1100100) + chr(101) + chr(0b1011111 + 0o4) + chr(3019 - 2908) + '\x64' + chr(3746 - 3645))(chr(2432 - 2315) + chr(6774 - 6658) + chr(0b1100110) + chr(0b101101) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'/\\pC#\x8e\xa3\xd8+V\x9e\x91\xdcl\xda\xea\xd3\xc8\xacY'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + chr(2145 - 2045) + '\x65')(chr(12973 - 12856) + chr(116) + chr(5098 - 4996) + '\055' + '\x38'), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(142 - 94) + chr(1730 - 1682), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'*IzC8\x9f\xb4\xcf\x15^'), chr(100) + '\x65' + '\x63' + chr(10446 - 10335) + chr(0b100000 + 0o104) + chr(0b100100 + 0o101))('\165' + chr(116) + chr(0b1100110) + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'/\\pC"\x8a\xa5\xd1\x15J\xb7\x96\xdbs\xe3\xfc\xd5\xf2\xaeO\x10qvx\xf4_\x95\x0c\x05\x8c&\xb9x'), chr(0b10100 + 0o120) + chr(0b1100101) + chr(1345 - 1246) + '\x6f' + chr(0b1000001 + 0o43) + '\145')('\x75' + chr(0b1011110 + 0o26) + chr(0b11010 + 0o114) + chr(0b101101) + chr(0b111000)), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100000 + 0o21) + chr(52) + chr(0b110100), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'*IzC8\x9f\xb4\xcf\x15^'), '\144' + chr(0b101101 + 0o70) + '\x63' + chr(3363 - 3252) + chr(0b10000 + 0o124) + '\145')('\x75' + '\164' + chr(3849 - 3747) + '\055' + chr(1287 - 1231)))(xafqLlk3kkUe(SXOLrMavuUCe(b'/\\pC1\x88\xb0\xd3\x00l\x85\x9d\xc0J\xf7\xfc\xd7\xc1\xbdS?u~r\xdfS\x86\x05'), chr(8048 - 7948) + chr(1241 - 1140) + chr(0b1100011) + chr(9136 - 9025) + chr(0b110001 + 0o63) + '\145')(chr(9070 - 8953) + '\164' + '\146' + chr(45) + chr(56)), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1010 + 0o47) + '\x32', 55056 - 55048))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
rlmf_eval
|
def rlmf_eval():
"""Eval set of hparams for model-free PPO."""
hparams = rlmf_original()
hparams.batch_size = 8
hparams.eval_sampling_temps = [0.0, 0.5, 1.0]
hparams.eval_rl_env_max_episode_steps = -1
hparams.add_hparam("ppo_epoch_length", 128)
hparams.add_hparam("ppo_optimization_batch_size", 32)
hparams.add_hparam("ppo_epochs_num", 10000)
hparams.add_hparam("ppo_eval_every_epochs", 500)
hparams.add_hparam("attempt", 0)
hparams.add_hparam("moe_loss_coef", 0)
return hparams
|
python
|
def rlmf_eval():
"""Eval set of hparams for model-free PPO."""
hparams = rlmf_original()
hparams.batch_size = 8
hparams.eval_sampling_temps = [0.0, 0.5, 1.0]
hparams.eval_rl_env_max_episode_steps = -1
hparams.add_hparam("ppo_epoch_length", 128)
hparams.add_hparam("ppo_optimization_batch_size", 32)
hparams.add_hparam("ppo_epochs_num", 10000)
hparams.add_hparam("ppo_eval_every_epochs", 500)
hparams.add_hparam("attempt", 0)
hparams.add_hparam("moe_loss_coef", 0)
return hparams
|
[
"def",
"rlmf_eval",
"(",
")",
":",
"hparams",
"=",
"rlmf_original",
"(",
")",
"hparams",
".",
"batch_size",
"=",
"8",
"hparams",
".",
"eval_sampling_temps",
"=",
"[",
"0.0",
",",
"0.5",
",",
"1.0",
"]",
"hparams",
".",
"eval_rl_env_max_episode_steps",
"=",
"-",
"1",
"hparams",
".",
"add_hparam",
"(",
"\"ppo_epoch_length\"",
",",
"128",
")",
"hparams",
".",
"add_hparam",
"(",
"\"ppo_optimization_batch_size\"",
",",
"32",
")",
"hparams",
".",
"add_hparam",
"(",
"\"ppo_epochs_num\"",
",",
"10000",
")",
"hparams",
".",
"add_hparam",
"(",
"\"ppo_eval_every_epochs\"",
",",
"500",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attempt\"",
",",
"0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"moe_loss_coef\"",
",",
"0",
")",
"return",
"hparams"
] |
Eval set of hparams for model-free PPO.
|
[
"Eval",
"set",
"of",
"hparams",
"for",
"model",
"-",
"free",
"PPO",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/rl.py#L483-L495
|
train
|
Eval set of hparams for model - free PPO.
|
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,yROw0HWB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wo4,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(0b1100000 + 0o17) + '\x33' + chr(0b110100) + chr(1930 - 1880), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\x30' + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + '\062' + '\x33' + chr(2333 - 2279), 35846 - 35838), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\067' + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(1059 - 1009) + '\067', 25242 - 25234), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b110110), 48325 - 48317), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b110000) + chr(0b110010), 60928 - 60920), ehT0Px3KOsy9('\060' + '\157' + chr(1894 - 1845) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(4274 - 4163) + chr(50) + chr(1713 - 1658) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(168 - 119) + chr(2451 - 2397) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4671 - 4560) + '\x36' + '\x37', 48711 - 48703), ehT0Px3KOsy9(chr(1446 - 1398) + chr(111) + '\x31' + '\x35' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + '\x32' + chr(0b10111 + 0o33) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(801 - 753) + '\x6f' + '\x35' + chr(2686 - 2633), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\066' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(2135 - 2087) + chr(111) + chr(692 - 643) + chr(50) + chr(942 - 894), 33540 - 33532), ehT0Px3KOsy9(chr(48) + chr(0b1100010 + 0o15) + chr(51) + chr(0b110111) + '\063', 0b1000), ehT0Px3KOsy9(chr(54 - 6) + '\x6f' + chr(0b11 + 0o60) + chr(1584 - 1536), ord("\x08")), ehT0Px3KOsy9(chr(961 - 913) + chr(9181 - 9070) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(748 - 700) + '\157' + chr(52) + '\x32', 7597 - 7589), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110011) + chr(0b1011 + 0o54), 38696 - 38688), ehT0Px3KOsy9(chr(755 - 707) + chr(111) + chr(1180 - 1130) + '\061' + '\x33', 43697 - 43689), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(0b101010 + 0o11) + chr(48) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3533 - 3422) + '\062' + chr(386 - 331) + chr(0b110101), 3721 - 3713), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100010 + 0o24) + chr(0b10000 + 0o46), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b110011 + 0o1) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(53) + chr(0b10100 + 0o43), 63307 - 63299), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1 + 0o63) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(54) + '\x31', 38483 - 38475), ehT0Px3KOsy9(chr(2187 - 2139) + chr(0b0 + 0o157) + chr(0b10101 + 0o34) + chr(2065 - 2011) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(893 - 845) + '\157' + chr(51) + chr(54) + chr(0b101110 + 0o11), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100000 + 0o21) + chr(55) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\065' + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7088 - 6977) + '\x32' + chr(54) + chr(646 - 597), 47852 - 47844), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + '\063' + '\x37' + chr(0b100001 + 0o24), 0o10), ehT0Px3KOsy9('\x30' + chr(3071 - 2960) + chr(0b11111 + 0o23) + chr(0b110101) + chr(686 - 638), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4889 - 4778) + chr(2140 - 2091) + '\060' + chr(784 - 732), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + '\061' + '\066' + chr(1717 - 1664), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1346 - 1298) + '\x6f' + chr(53) + chr(1697 - 1649), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc'), chr(0b100000 + 0o104) + chr(6366 - 6265) + chr(99) + chr(0b1101111) + '\x64' + '\145')('\165' + chr(0b1110100) + '\146' + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def yfC8EQv_vpTc():
n4ljua2gi1Pr = rzIXxQ9pg3sZ()
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(1482 - 1434) + chr(0b10 + 0o155) + '\061' + chr(534 - 486), ord("\x08"))
n4ljua2gi1Pr.dXdg5YsfUP4x = [0.0, 0.5, 1.0]
n4ljua2gi1Pr.LwzbW31WHi53 = -ehT0Px3KOsy9(chr(1235 - 1187) + chr(5062 - 4951) + chr(49), ord("\x08"))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83!\xfa!\xbf~\xe3x\xde\x1b'), '\144' + '\x65' + chr(5042 - 4943) + chr(111) + chr(100) + chr(0b1000001 + 0o44))('\165' + '\x74' + chr(0b10000 + 0o126) + chr(0b11 + 0o52) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x925\xf1!\xb2~\xedi\xd7)[\x0c\xf9J\x848'), '\144' + chr(1636 - 1535) + '\143' + '\157' + chr(0b1100100) + chr(4768 - 4667))('\165' + '\x74' + '\146' + chr(0b101101) + chr(0b100001 + 0o27)), ehT0Px3KOsy9(chr(62 - 14) + chr(111) + chr(0b1100 + 0o46) + chr(0b100100 + 0o14) + chr(0b110000), 0b1000))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83!\xfa!\xbf~\xe3x\xde\x1b'), '\144' + chr(1396 - 1295) + chr(99) + '\157' + '\x64' + '\145')(chr(6996 - 6879) + '\164' + chr(102) + chr(205 - 160) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x925\xf1!\xb8~\xf6c\xd2\x1fM\x08\xe3D\x9f>\xa4zeV\xfc\xe3\x9a\xce_\x1e\n'), chr(9654 - 9554) + chr(0b1100000 + 0o5) + chr(444 - 345) + '\x6f' + chr(0b1100100 + 0o0) + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(0b11001 + 0o115) + '\x2d' + '\070'), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(0b1100 + 0o44), ord("\x08")))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83!\xfa!\xbf~\xe3x\xde\x1b'), chr(3417 - 3317) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b11 + 0o141) + '\145')(chr(0b1110101) + '\164' + chr(0b1001101 + 0o31) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x925\xf1!\xb2~\xedi\xd7\x05h\x07\xe2@'), chr(5021 - 4921) + chr(101) + chr(0b1100011) + chr(111) + '\144' + '\145')(chr(4900 - 4783) + '\164' + chr(0b101001 + 0o75) + chr(0b101101) + '\x38'), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + chr(50) + chr(51) + chr(0b11011 + 0o31) + '\062' + chr(48), 43064 - 43056))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83!\xfa!\xbf~\xe3x\xde\x1b'), chr(100) + '\145' + '\143' + chr(8701 - 8590) + chr(0b1100100) + '\145')('\x75' + chr(116) + chr(0b1100110) + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x925\xf1!\xb2x\xe3f\xe0\x13A\x0c\xe5T\xaf5\x8bwgJ\xec'), chr(0b1001110 + 0o26) + '\145' + chr(0b110100 + 0o57) + chr(10387 - 10276) + chr(2926 - 2826) + '\x65')('\165' + chr(8662 - 8546) + chr(102) + chr(0b11101 + 0o20) + '\070'), ehT0Px3KOsy9('\x30' + chr(8062 - 7951) + '\x37' + chr(54) + chr(0b110100), 0b1000))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83!\xfa!\xbf~\xe3x\xde\x1b'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(0b100101 + 0o112) + chr(100) + '\x65')(chr(0b101001 + 0o114) + chr(0b1110100) + chr(102) + chr(0b101101) + chr(2801 - 2745)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x831\xea\x1b\xba~\xf6'), chr(0b1100100) + '\x65' + '\143' + chr(0b1011101 + 0o22) + chr(530 - 430) + chr(101))(chr(117) + chr(2276 - 2160) + chr(0b1010011 + 0o23) + chr(961 - 916) + '\x38'), ehT0Px3KOsy9('\x30' + '\157' + '\x30', 49040 - 49032))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83!\xfa!\xbf~\xe3x\xde\x1b'), chr(2795 - 2695) + '\x65' + chr(99) + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(6374 - 6258) + chr(0b1100110) + chr(0b101101) + chr(1633 - 1577)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f*\xfb!\xbba\xf1y\xe0\x15X\x0c\xf1'), chr(0b1100100) + chr(0b11111 + 0o106) + chr(0b100110 + 0o75) + chr(0b1101111) + chr(2413 - 2313) + chr(101))('\165' + '\x74' + chr(4278 - 4176) + chr(1066 - 1021) + chr(0b111000)), ehT0Px3KOsy9(chr(48) + chr(2077 - 1966) + '\x30', 8))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/rl.py
|
feed_forward_gaussian_fun
|
def feed_forward_gaussian_fun(action_space, config, observations):
"""Feed-forward Gaussian."""
if not isinstance(action_space, gym.spaces.box.Box):
raise ValueError("Expecting continuous action space.")
mean_weights_initializer = tf.initializers.variance_scaling(
scale=config.init_mean_factor)
logstd_initializer = tf.random_normal_initializer(config.init_logstd, 1e-10)
flat_observations = tf.reshape(observations, [
tf.shape(observations)[0], tf.shape(observations)[1],
functools.reduce(operator.mul, observations.shape.as_list()[2:], 1)])
with tf.variable_scope("network_parameters"):
with tf.variable_scope("policy"):
x = flat_observations
for size in config.policy_layers:
x = tf.layers.dense(x, size, activation=tf.nn.relu)
mean = tf.layers.dense(
x, action_space.shape[0], activation=tf.tanh,
kernel_initializer=mean_weights_initializer)
logstd = tf.get_variable(
"logstd", mean.shape[2:], tf.float32, logstd_initializer)
logstd = tf.tile(
logstd[None, None],
[tf.shape(mean)[0], tf.shape(mean)[1]] + [1] * (mean.shape.ndims - 2))
with tf.variable_scope("value"):
x = flat_observations
for size in config.value_layers:
x = tf.layers.dense(x, size, activation=tf.nn.relu)
value = tf.layers.dense(x, 1)[..., 0]
mean = tf.check_numerics(mean, "mean")
logstd = tf.check_numerics(logstd, "logstd")
value = tf.check_numerics(value, "value")
policy = tfp.distributions.MultivariateNormalDiag(mean, tf.exp(logstd))
return NetworkOutput(policy, value, lambda a: tf.clip_by_value(a, -2., 2))
|
python
|
def feed_forward_gaussian_fun(action_space, config, observations):
"""Feed-forward Gaussian."""
if not isinstance(action_space, gym.spaces.box.Box):
raise ValueError("Expecting continuous action space.")
mean_weights_initializer = tf.initializers.variance_scaling(
scale=config.init_mean_factor)
logstd_initializer = tf.random_normal_initializer(config.init_logstd, 1e-10)
flat_observations = tf.reshape(observations, [
tf.shape(observations)[0], tf.shape(observations)[1],
functools.reduce(operator.mul, observations.shape.as_list()[2:], 1)])
with tf.variable_scope("network_parameters"):
with tf.variable_scope("policy"):
x = flat_observations
for size in config.policy_layers:
x = tf.layers.dense(x, size, activation=tf.nn.relu)
mean = tf.layers.dense(
x, action_space.shape[0], activation=tf.tanh,
kernel_initializer=mean_weights_initializer)
logstd = tf.get_variable(
"logstd", mean.shape[2:], tf.float32, logstd_initializer)
logstd = tf.tile(
logstd[None, None],
[tf.shape(mean)[0], tf.shape(mean)[1]] + [1] * (mean.shape.ndims - 2))
with tf.variable_scope("value"):
x = flat_observations
for size in config.value_layers:
x = tf.layers.dense(x, size, activation=tf.nn.relu)
value = tf.layers.dense(x, 1)[..., 0]
mean = tf.check_numerics(mean, "mean")
logstd = tf.check_numerics(logstd, "logstd")
value = tf.check_numerics(value, "value")
policy = tfp.distributions.MultivariateNormalDiag(mean, tf.exp(logstd))
return NetworkOutput(policy, value, lambda a: tf.clip_by_value(a, -2., 2))
|
[
"def",
"feed_forward_gaussian_fun",
"(",
"action_space",
",",
"config",
",",
"observations",
")",
":",
"if",
"not",
"isinstance",
"(",
"action_space",
",",
"gym",
".",
"spaces",
".",
"box",
".",
"Box",
")",
":",
"raise",
"ValueError",
"(",
"\"Expecting continuous action space.\"",
")",
"mean_weights_initializer",
"=",
"tf",
".",
"initializers",
".",
"variance_scaling",
"(",
"scale",
"=",
"config",
".",
"init_mean_factor",
")",
"logstd_initializer",
"=",
"tf",
".",
"random_normal_initializer",
"(",
"config",
".",
"init_logstd",
",",
"1e-10",
")",
"flat_observations",
"=",
"tf",
".",
"reshape",
"(",
"observations",
",",
"[",
"tf",
".",
"shape",
"(",
"observations",
")",
"[",
"0",
"]",
",",
"tf",
".",
"shape",
"(",
"observations",
")",
"[",
"1",
"]",
",",
"functools",
".",
"reduce",
"(",
"operator",
".",
"mul",
",",
"observations",
".",
"shape",
".",
"as_list",
"(",
")",
"[",
"2",
":",
"]",
",",
"1",
")",
"]",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"\"network_parameters\"",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"policy\"",
")",
":",
"x",
"=",
"flat_observations",
"for",
"size",
"in",
"config",
".",
"policy_layers",
":",
"x",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"size",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
")",
"mean",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"action_space",
".",
"shape",
"[",
"0",
"]",
",",
"activation",
"=",
"tf",
".",
"tanh",
",",
"kernel_initializer",
"=",
"mean_weights_initializer",
")",
"logstd",
"=",
"tf",
".",
"get_variable",
"(",
"\"logstd\"",
",",
"mean",
".",
"shape",
"[",
"2",
":",
"]",
",",
"tf",
".",
"float32",
",",
"logstd_initializer",
")",
"logstd",
"=",
"tf",
".",
"tile",
"(",
"logstd",
"[",
"None",
",",
"None",
"]",
",",
"[",
"tf",
".",
"shape",
"(",
"mean",
")",
"[",
"0",
"]",
",",
"tf",
".",
"shape",
"(",
"mean",
")",
"[",
"1",
"]",
"]",
"+",
"[",
"1",
"]",
"*",
"(",
"mean",
".",
"shape",
".",
"ndims",
"-",
"2",
")",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"\"value\"",
")",
":",
"x",
"=",
"flat_observations",
"for",
"size",
"in",
"config",
".",
"value_layers",
":",
"x",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"size",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
")",
"value",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"1",
")",
"[",
"...",
",",
"0",
"]",
"mean",
"=",
"tf",
".",
"check_numerics",
"(",
"mean",
",",
"\"mean\"",
")",
"logstd",
"=",
"tf",
".",
"check_numerics",
"(",
"logstd",
",",
"\"logstd\"",
")",
"value",
"=",
"tf",
".",
"check_numerics",
"(",
"value",
",",
"\"value\"",
")",
"policy",
"=",
"tfp",
".",
"distributions",
".",
"MultivariateNormalDiag",
"(",
"mean",
",",
"tf",
".",
"exp",
"(",
"logstd",
")",
")",
"return",
"NetworkOutput",
"(",
"policy",
",",
"value",
",",
"lambda",
"a",
":",
"tf",
".",
"clip_by_value",
"(",
"a",
",",
"-",
"2.",
",",
"2",
")",
")"
] |
Feed-forward Gaussian.
|
[
"Feed",
"-",
"forward",
"Gaussian",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2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Iy8j,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) + '\061' + chr(0b101010 + 0o14) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2194 - 2144) + chr(49) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10000 + 0o43) + chr(0b11000 + 0o33) + '\066', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(2458 - 2406) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + chr(0b11111 + 0o30) + chr(50), 8063 - 8055), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(53) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(6551 - 6440) + chr(0b110001) + chr(62 - 9) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\066' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(657 - 609) + chr(1848 - 1737) + chr(0b110101) + '\x37', 646 - 638), ehT0Px3KOsy9('\x30' + chr(2014 - 1903) + '\063' + '\x30' + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + '\062' + chr(2275 - 2220) + chr(0b10010 + 0o45), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1792 - 1681) + '\x37', 33290 - 33282), ehT0Px3KOsy9(chr(99 - 51) + chr(6383 - 6272) + chr(50) + chr(2478 - 2426) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(51) + chr(0b110000), 27164 - 27156), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53) + chr(824 - 775), 49456 - 49448), ehT0Px3KOsy9(chr(48) + chr(6250 - 6139) + '\x35' + '\x32', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b10011 + 0o43) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\060' + chr(48), 43240 - 43232), ehT0Px3KOsy9('\x30' + '\157' + chr(1663 - 1612) + chr(1616 - 1566) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5500 - 5389) + '\x35' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + '\063' + '\x36' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + '\x32' + chr(0b110001 + 0o4) + chr(1297 - 1248), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b101010 + 0o12) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(87 - 39) + chr(0b1101111) + '\x31' + chr(0b100100 + 0o14) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + chr(0b10110 + 0o34) + chr(0b10110 + 0o37) + chr(1651 - 1597), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(52) + chr(48), 18083 - 18075), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + '\x31', 8), ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + chr(1720 - 1668) + chr(0b110011), 41154 - 41146), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + '\063' + chr(53) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b11110 + 0o23) + chr(0b100000 + 0o24) + '\062', 0b1000), ehT0Px3KOsy9(chr(1689 - 1641) + chr(111) + chr(51) + chr(0b100 + 0o62) + chr(0b110111), 44666 - 44658), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x36' + chr(0b110001 + 0o2), 50887 - 50879), ehT0Px3KOsy9(chr(1360 - 1312) + chr(6493 - 6382) + '\x32' + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(832 - 783) + chr(1845 - 1795), 4877 - 4869), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1011 + 0o51) + chr(55), 53791 - 53783), ehT0Px3KOsy9(chr(48) + chr(11097 - 10986) + chr(0b11001 + 0o32) + chr(0b110000) + chr(2162 - 2112), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(53) + chr(602 - 551), 39917 - 39909), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(469 - 420) + chr(2201 - 2152), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4073 - 3962) + '\x32' + chr(55) + chr(0b11100 + 0o32), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(452 - 399) + chr(48), 5313 - 5305)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b']'), chr(0b1100100) + chr(101) + '\143' + chr(111) + chr(0b100110 + 0o76) + chr(7090 - 6989))('\165' + chr(116) + chr(0b100100 + 0o102) + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def pe9j4xslPyCf(yiKBhCVj2bwE, jAj7S20Ct06o, uswa0rn3Tb4L):
if not PlSM16l2KDPD(yiKBhCVj2bwE, xafqLlk3kkUe(mZyhk1NGHEBF.spaces.box, xafqLlk3kkUe(SXOLrMavuUCe(b'1\xe7\xa6'), '\x64' + '\145' + chr(3106 - 3007) + chr(111) + chr(100) + chr(0b1100101))(chr(11623 - 11506) + chr(116) + chr(3535 - 3433) + chr(1375 - 1330) + '\x38'))):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'6\xf0\xae\xc4Y\xdd\x07\x1bH\xe1\xdch\xce\xac@D\x05\xaf\xa4A\x0e\x90\xca\x90/\xc1\x0e\tP\x9d\x03\x94\xd6;'), chr(8768 - 8668) + chr(0b1100101) + '\143' + chr(1402 - 1291) + chr(0b1100100) + chr(101))(chr(0b101010 + 0o113) + '\164' + chr(102) + chr(0b1110 + 0o37) + '\070'))
sZa3DJYgqqhv = IDJ2eXGCBCDu.initializers.variance_scaling(scale=jAj7S20Ct06o.init_mean_factor)
ydLI56y2Hcyg = IDJ2eXGCBCDu.random_normal_initializer(jAj7S20Ct06o.init_logstd, 1e-10)
HMFAhDXJLBb7 = IDJ2eXGCBCDu.reshape(uswa0rn3Tb4L, [IDJ2eXGCBCDu.nauYfLglTpcb(uswa0rn3Tb4L)[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x30', ord("\x08"))], IDJ2eXGCBCDu.nauYfLglTpcb(uswa0rn3Tb4L)[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), 0o10)], E6ula8_Zv1yl.reduce(xJShi6yitBWy.mul, uswa0rn3Tb4L.shape.as_list()[ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010), 52347 - 52339):], ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + chr(0b110001), 8))])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xe9\xac\xc8[\xcb\x02\x10p\xb2\xdch\xd0\xbd'), '\144' + chr(1295 - 1194) + chr(99) + '\x6f' + '\144' + '\145')('\165' + chr(12739 - 12623) + chr(0b1100110) + chr(610 - 565) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\xed\xaa\xd6U\xdb\x05*_\xa0\xcdf\xcd\xbd]O\x02\xb3'), chr(0b1010100 + 0o20) + chr(5452 - 5351) + chr(99) + chr(0b1101111) + '\144' + chr(0b110000 + 0o65))(chr(0b1110101) + '\164' + chr(0b11 + 0o143) + chr(151 - 106) + chr(0b1101 + 0o53))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xe9\xac\xc8[\xcb\x02\x10p\xb2\xdch\xd0\xbd'), '\144' + chr(101) + '\143' + chr(7705 - 7594) + chr(0b1011000 + 0o14) + chr(2567 - 2466))(chr(0b1110101) + chr(0b1110100) + chr(798 - 696) + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xe7\xb2\xc8Y\xd0'), chr(8789 - 8689) + '\145' + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(4830 - 4729))(chr(3935 - 3818) + chr(116) + chr(102) + '\x2d' + chr(0b111000))):
OeWW0F1dBPRQ = HMFAhDXJLBb7
for NLcc3BCJnQka in xafqLlk3kkUe(jAj7S20Ct06o, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xe7\xb2\xc8Y\xd01\x19N\xb8\xdau\xd3'), chr(0b1100100) + chr(0b1000111 + 0o36) + chr(0b101 + 0o136) + chr(0b111110 + 0o61) + '\144' + chr(0b1001100 + 0o31))(chr(0b1011110 + 0o27) + '\164' + chr(0b100111 + 0o77) + '\055' + chr(0b10111 + 0o41))):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, NLcc3BCJnQka, activation=IDJ2eXGCBCDu.nn.relu)
aJhItC_Vawlw = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, yiKBhCVj2bwE.nauYfLglTpcb[ehT0Px3KOsy9('\060' + chr(0b110000 + 0o77) + chr(0b110000), 8)], activation=IDJ2eXGCBCDu.tanh, kernel_initializer=sZa3DJYgqqhv)
DL7GWI2HO6nZ = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xe7\xb9\xd2N\xcd'), chr(0b1010010 + 0o22) + '\145' + '\x63' + chr(111) + '\x64' + '\145')(chr(117) + chr(0b1110100) + chr(4257 - 4155) + chr(0b0 + 0o55) + '\070'), aJhItC_Vawlw.nauYfLglTpcb[ehT0Px3KOsy9(chr(48) + '\157' + '\x32', 8):], IDJ2eXGCBCDu.float32, ydLI56y2Hcyg)
DL7GWI2HO6nZ = IDJ2eXGCBCDu.tile(DL7GWI2HO6nZ[None, None], [IDJ2eXGCBCDu.nauYfLglTpcb(aJhItC_Vawlw)[ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + chr(0b11110 + 0o22), 8)], IDJ2eXGCBCDu.nauYfLglTpcb(aJhItC_Vawlw)[ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10110 + 0o33), 8)]] + [ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1110 + 0o43), 8)] * (aJhItC_Vawlw.shape.ndims - ehT0Px3KOsy9('\060' + chr(3428 - 3317) + '\062', 8)))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xe9\xac\xc8[\xcb\x02\x10p\xb2\xdch\xd0\xbd'), chr(6365 - 6265) + '\x65' + '\143' + '\x6f' + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(3984 - 3868) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xe9\xb2\xd4_'), chr(0b101100 + 0o70) + chr(837 - 736) + chr(99) + chr(0b100011 + 0o114) + chr(100) + '\145')(chr(2396 - 2279) + '\164' + chr(0b1100110) + chr(0b101101) + chr(56))):
OeWW0F1dBPRQ = HMFAhDXJLBb7
for NLcc3BCJnQka in xafqLlk3kkUe(jAj7S20Ct06o, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xe9\xb2\xd4_\xf6\x02\x14V\xa4\xcdt'), chr(0b11110 + 0o106) + chr(0b1100101) + chr(0b10 + 0o141) + '\157' + chr(0b1100100) + chr(0b1000010 + 0o43))('\165' + '\x74' + chr(0b1100110) + chr(2006 - 1961) + '\070')):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, NLcc3BCJnQka, activation=IDJ2eXGCBCDu.nn.relu)
QmmgWUB13VCJ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, ehT0Px3KOsy9(chr(48) + chr(0b110011 + 0o74) + chr(49), 8))[..., ehT0Px3KOsy9(chr(1822 - 1774) + chr(2867 - 2756) + chr(0b100 + 0o54), 8)]
aJhItC_Vawlw = IDJ2eXGCBCDu.check_numerics(aJhItC_Vawlw, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e\xed\xbf\xcf'), '\144' + '\x65' + '\x63' + chr(0b111000 + 0o67) + chr(100) + chr(0b1000 + 0o135))(chr(0b1110101) + chr(7731 - 7615) + chr(0b1100110) + '\x2d' + chr(2237 - 2181)))
DL7GWI2HO6nZ = IDJ2eXGCBCDu.check_numerics(DL7GWI2HO6nZ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xe7\xb9\xd2N\xcd'), '\x64' + '\145' + '\x63' + '\x6f' + chr(0b111101 + 0o47) + '\145')(chr(0b1110101) + chr(0b100 + 0o160) + chr(0b1100110) + '\055' + chr(0b111000)))
QmmgWUB13VCJ = IDJ2eXGCBCDu.check_numerics(QmmgWUB13VCJ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xe9\xb2\xd4_'), chr(2476 - 2376) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(101))('\x75' + chr(0b101000 + 0o114) + '\146' + chr(0b1111 + 0o36) + chr(0b10010 + 0o46)))
s617wIX8Hbiy = Ys555qziAbad.distributions.MultivariateNormalDiag(aJhItC_Vawlw, IDJ2eXGCBCDu.exp(DL7GWI2HO6nZ))
return I8VwsjDwOERz(s617wIX8Hbiy, QmmgWUB13VCJ, lambda XPh1qbAgrPgG: xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xe4\xb7\xd1e\xcb\x17*Y\xa0\xd3r\xc5'), chr(4275 - 4175) + '\x65' + '\143' + chr(0b110101 + 0o72) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(3899 - 3797) + '\x2d' + '\x38'))(XPh1qbAgrPgG, -2.0, ehT0Px3KOsy9('\x30' + '\x6f' + chr(1733 - 1683), 8)))
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._curvature_range
|
def _curvature_range(self):
"""Curvature range.
Returns:
h_max_t, h_min_t ops
"""
self._curv_win = tf.get_variable("curv_win",
dtype=tf.float32,
trainable=False,
shape=[self.curvature_window_width,],
initializer=tf.zeros_initializer)
# We use log smoothing for curvature range
self._curv_win = tf.scatter_update(self._curv_win,
self._step % self.curvature_window_width,
tf.log(self._grad_norm_squared))
# Note here the iterations start from iteration 0
valid_window = tf.slice(self._curv_win,
tf.constant([0,]),
tf.expand_dims(
tf.minimum(
tf.constant(self.curvature_window_width),
self._step + 1), dim=0))
self._h_min_t = tf.reduce_min(valid_window)
self._h_max_t = tf.reduce_max(valid_window)
curv_range_ops = []
with tf.control_dependencies([self._h_min_t, self._h_max_t]):
avg_op = self._moving_averager.apply([self._h_min_t, self._h_max_t])
with tf.control_dependencies([avg_op]):
self._h_min = tf.exp(
tf.identity(self._moving_averager.average(self._h_min_t)))
self._h_max = tf.exp(
tf.identity(self._moving_averager.average(self._h_max_t)))
if self._sparsity_debias:
self._h_min *= self._sparsity_avg
self._h_max *= self._sparsity_avg
curv_range_ops.append(avg_op)
return curv_range_ops
|
python
|
def _curvature_range(self):
"""Curvature range.
Returns:
h_max_t, h_min_t ops
"""
self._curv_win = tf.get_variable("curv_win",
dtype=tf.float32,
trainable=False,
shape=[self.curvature_window_width,],
initializer=tf.zeros_initializer)
# We use log smoothing for curvature range
self._curv_win = tf.scatter_update(self._curv_win,
self._step % self.curvature_window_width,
tf.log(self._grad_norm_squared))
# Note here the iterations start from iteration 0
valid_window = tf.slice(self._curv_win,
tf.constant([0,]),
tf.expand_dims(
tf.minimum(
tf.constant(self.curvature_window_width),
self._step + 1), dim=0))
self._h_min_t = tf.reduce_min(valid_window)
self._h_max_t = tf.reduce_max(valid_window)
curv_range_ops = []
with tf.control_dependencies([self._h_min_t, self._h_max_t]):
avg_op = self._moving_averager.apply([self._h_min_t, self._h_max_t])
with tf.control_dependencies([avg_op]):
self._h_min = tf.exp(
tf.identity(self._moving_averager.average(self._h_min_t)))
self._h_max = tf.exp(
tf.identity(self._moving_averager.average(self._h_max_t)))
if self._sparsity_debias:
self._h_min *= self._sparsity_avg
self._h_max *= self._sparsity_avg
curv_range_ops.append(avg_op)
return curv_range_ops
|
[
"def",
"_curvature_range",
"(",
"self",
")",
":",
"self",
".",
"_curv_win",
"=",
"tf",
".",
"get_variable",
"(",
"\"curv_win\"",
",",
"dtype",
"=",
"tf",
".",
"float32",
",",
"trainable",
"=",
"False",
",",
"shape",
"=",
"[",
"self",
".",
"curvature_window_width",
",",
"]",
",",
"initializer",
"=",
"tf",
".",
"zeros_initializer",
")",
"# We use log smoothing for curvature range",
"self",
".",
"_curv_win",
"=",
"tf",
".",
"scatter_update",
"(",
"self",
".",
"_curv_win",
",",
"self",
".",
"_step",
"%",
"self",
".",
"curvature_window_width",
",",
"tf",
".",
"log",
"(",
"self",
".",
"_grad_norm_squared",
")",
")",
"# Note here the iterations start from iteration 0",
"valid_window",
"=",
"tf",
".",
"slice",
"(",
"self",
".",
"_curv_win",
",",
"tf",
".",
"constant",
"(",
"[",
"0",
",",
"]",
")",
",",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"minimum",
"(",
"tf",
".",
"constant",
"(",
"self",
".",
"curvature_window_width",
")",
",",
"self",
".",
"_step",
"+",
"1",
")",
",",
"dim",
"=",
"0",
")",
")",
"self",
".",
"_h_min_t",
"=",
"tf",
".",
"reduce_min",
"(",
"valid_window",
")",
"self",
".",
"_h_max_t",
"=",
"tf",
".",
"reduce_max",
"(",
"valid_window",
")",
"curv_range_ops",
"=",
"[",
"]",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"self",
".",
"_h_min_t",
",",
"self",
".",
"_h_max_t",
"]",
")",
":",
"avg_op",
"=",
"self",
".",
"_moving_averager",
".",
"apply",
"(",
"[",
"self",
".",
"_h_min_t",
",",
"self",
".",
"_h_max_t",
"]",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"avg_op",
"]",
")",
":",
"self",
".",
"_h_min",
"=",
"tf",
".",
"exp",
"(",
"tf",
".",
"identity",
"(",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"self",
".",
"_h_min_t",
")",
")",
")",
"self",
".",
"_h_max",
"=",
"tf",
".",
"exp",
"(",
"tf",
".",
"identity",
"(",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"self",
".",
"_h_max_t",
")",
")",
")",
"if",
"self",
".",
"_sparsity_debias",
":",
"self",
".",
"_h_min",
"*=",
"self",
".",
"_sparsity_avg",
"self",
".",
"_h_max",
"*=",
"self",
".",
"_sparsity_avg",
"curv_range_ops",
".",
"append",
"(",
"avg_op",
")",
"return",
"curv_range_ops"
] |
Curvature range.
Returns:
h_max_t, h_min_t ops
|
[
"Curvature",
"range",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L193-L230
|
train
|
Internal function that creates the curvature range.
|
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,V5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EhBlYI2Bx4,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(111) + chr(0b110001) + '\x32' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2566 - 2455) + chr(2068 - 2018) + chr(2470 - 2419) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(599 - 544) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(706 - 655) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b110011) + chr(77 - 28), 4045 - 4037), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + chr(2353 - 2303) + chr(519 - 470) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101 + 0o55) + '\067' + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(48) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + '\063' + chr(0b110101) + chr(0b11010 + 0o27), 0b1000), ehT0Px3KOsy9(chr(688 - 640) + chr(6385 - 6274) + chr(0b100011 + 0o16) + chr(0b1111 + 0o44) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b100011 + 0o17) + '\064', 61327 - 61319), ehT0Px3KOsy9(chr(177 - 129) + '\157' + chr(49) + chr(49) + chr(0b110010 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1740 - 1629) + '\x31' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1370 - 1259) + '\x32' + chr(53) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7522 - 7411) + chr(139 - 91), 6462 - 6454), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(474 - 423) + chr(55) + chr(49), 8), ehT0Px3KOsy9(chr(1160 - 1112) + chr(111) + '\x32' + chr(0b10110 + 0o35) + '\x32', 60199 - 60191), ehT0Px3KOsy9('\060' + chr(168 - 57) + '\x31' + '\067' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + '\061' + chr(1365 - 1314) + chr(0b110001), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001 + 0o0) + '\062' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b110110) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000101 + 0o52) + chr(0b111 + 0o53) + chr(0b10110 + 0o35) + '\065', 56367 - 56359), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\x30' + '\x31', 0o10), ehT0Px3KOsy9(chr(1933 - 1885) + chr(111) + '\062' + chr(2349 - 2298), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\x37' + chr(0b101000 + 0o15), 19057 - 19049), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1110 + 0o43) + chr(52) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(975 - 864) + chr(51) + chr(54) + '\062', 20229 - 20221), ehT0Px3KOsy9(chr(1538 - 1490) + chr(6551 - 6440) + '\061' + '\066' + chr(1958 - 1905), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100100 + 0o17) + chr(0b110010) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(0b110000 + 0o7) + chr(1515 - 1466), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11100 + 0o123) + chr(2127 - 2078) + chr(0b110101) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11723 - 11612) + '\x31' + chr(0b110010), 33662 - 33654), ehT0Px3KOsy9('\x30' + chr(11061 - 10950) + '\x32' + chr(49) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(902 - 854) + '\157' + '\x31' + '\x31' + chr(696 - 647), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x36' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(51) + chr(0b1101 + 0o45), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000 + 0o1) + '\x32' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + '\x33' + chr(0b100100 + 0o22) + chr(0b110110), 7595 - 7587), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\x33' + chr(0b101010 + 0o6), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2097 - 2045) + chr(50), 2284 - 2276)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101110 + 0o7) + chr(1110 - 1062), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'x'), '\x64' + chr(101) + chr(0b111101 + 0o46) + chr(9967 - 9856) + chr(0b1100100 + 0o0) + chr(0b110010 + 0o63))(chr(3923 - 3806) + '\164' + '\x66' + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def oWMQvUjTpSop(oVre8I6UXc3b):
oVre8I6UXc3b.fDPPqqt_w0aX = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'5\xec\x8b-\x06\xfb\xd1\xae'), chr(100) + chr(0b1100101) + chr(3968 - 3869) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1100 + 0o151) + chr(0b1101101 + 0o7) + chr(4083 - 3981) + chr(0b100100 + 0o11) + chr(2144 - 2088)), dtype=IDJ2eXGCBCDu.float32, trainable=ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110 + 0o52), 8), shape=[oVre8I6UXc3b.curvature_window_width], initializer=IDJ2eXGCBCDu.zeros_initializer)
oVre8I6UXc3b.fDPPqqt_w0aX = IDJ2eXGCBCDu.scatter_update(oVre8I6UXc3b.fDPPqqt_w0aX, oVre8I6UXc3b._step % oVre8I6UXc3b.curvature_window_width, IDJ2eXGCBCDu.log(oVre8I6UXc3b._grad_norm_squared))
w5ginJMwl8p_ = IDJ2eXGCBCDu.slice(oVre8I6UXc3b.fDPPqqt_w0aX, IDJ2eXGCBCDu.constant([ehT0Px3KOsy9(chr(1317 - 1269) + '\x6f' + chr(48), 8)]), IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.minimum(IDJ2eXGCBCDu.constant(oVre8I6UXc3b.curvature_window_width), oVre8I6UXc3b._step + ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110 + 0o53), 0o10)), dim=ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100101 + 0o13), 8)))
oVre8I6UXc3b.vwFSYSqvDW8H = IDJ2eXGCBCDu.reduce_min(w5ginJMwl8p_)
oVre8I6UXc3b.lbInU1eBypJd = IDJ2eXGCBCDu.reduce_max(w5ginJMwl8p_)
eRByNTtcjEtj = []
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'5\xf6\x97/+\xe3\xd4\x9f\x8d?$(e\xcbe\x97\xf9\x12<$'), chr(100) + '\145' + '\143' + '\157' + chr(100) + chr(9335 - 9234))(chr(117) + chr(116) + chr(102) + chr(0b111 + 0o46) + '\x38'))([xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b' \xee\xbf\x08\x00\xdf\xc9\xb6\xad\rl\x05'), '\x64' + chr(0b1100101) + chr(99) + chr(111) + chr(0b1100100) + '\145')('\165' + chr(116) + '\146' + '\x2d' + '\070')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b':\xfb\xb05\x0c\xbd\xdd\x82\x90*\x1e)'), '\144' + '\145' + chr(0b1100011) + chr(0b101 + 0o152) + chr(0b10 + 0o142) + '\x65')(chr(4251 - 4134) + chr(0b1001100 + 0o50) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))]):
mdaLt3Lic5wF = oVre8I6UXc3b._moving_averager.apply([oVre8I6UXc3b.vwFSYSqvDW8H, oVre8I6UXc3b.lbInU1eBypJd])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'5\xf6\x97/+\xe3\xd4\x9f\x8d?$(e\xcbe\x97\xf9\x12<$'), '\144' + chr(0b1011001 + 0o14) + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(0b111111 + 0o66) + chr(0b101111 + 0o105) + chr(5769 - 5667) + '\x2d' + '\x38'))([mdaLt3Lic5wF]):
oVre8I6UXc3b.xTlOSLMi4gPB = IDJ2eXGCBCDu.exp(IDJ2eXGCBCDu.identity(oVre8I6UXc3b._moving_averager.average(oVre8I6UXc3b.vwFSYSqvDW8H)))
oVre8I6UXc3b.h0Goq0PWBSS4 = IDJ2eXGCBCDu.exp(IDJ2eXGCBCDu.identity(oVre8I6UXc3b._moving_averager.average(oVre8I6UXc3b.lbInU1eBypJd)))
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xea\x89:+\xff\xd1\xb4\x90\x050(i\xc6a\x8a'), chr(100) + chr(8339 - 8238) + chr(4560 - 4461) + '\157' + chr(0b1011010 + 0o12) + chr(0b101000 + 0o75))(chr(4965 - 4848) + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000))):
oVre8I6UXc3b.xTlOSLMi4gPB *= oVre8I6UXc3b._sparsity_avg
oVre8I6UXc3b.h0Goq0PWBSS4 *= oVre8I6UXc3b._sparsity_avg
xafqLlk3kkUe(eRByNTtcjEtj, xafqLlk3kkUe(SXOLrMavuUCe(b'7\xe9\x89>7\xe8'), chr(0b1100100) + '\x65' + chr(3522 - 3423) + chr(7897 - 7786) + chr(9190 - 9090) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b101101) + '\070'))(mdaLt3Lic5wF)
return eRByNTtcjEtj
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._grad_variance
|
def _grad_variance(self):
"""Estimate of gradient Variance.
Returns:
C_t ops.
"""
grad_var_ops = []
tensor_to_avg = []
for t, g in zip(self._vars, self._grad):
if isinstance(g, tf.IndexedSlices):
tensor_to_avg.append(
tf.reshape(tf.unsorted_segment_sum(g.values,
g.indices,
g.dense_shape[0]),
shape=t.get_shape()))
else:
tensor_to_avg.append(g)
avg_op = self._moving_averager.apply(tensor_to_avg)
grad_var_ops.append(avg_op)
with tf.control_dependencies([avg_op]):
self._grad_avg = [self._moving_averager.average(val)
for val in tensor_to_avg]
self._grad_avg_squared = [tf.square(val) for val in self._grad_avg]
# Compute Variance
self._grad_var = tf.maximum(
tf.constant(1e-6, dtype=self._grad_norm_squared_avg.dtype),
self._grad_norm_squared_avg
- tf.add_n([tf.reduce_sum(val) for val in self._grad_avg_squared]))
if self._sparsity_debias:
self._grad_var *= self._sparsity_avg
return grad_var_ops
|
python
|
def _grad_variance(self):
"""Estimate of gradient Variance.
Returns:
C_t ops.
"""
grad_var_ops = []
tensor_to_avg = []
for t, g in zip(self._vars, self._grad):
if isinstance(g, tf.IndexedSlices):
tensor_to_avg.append(
tf.reshape(tf.unsorted_segment_sum(g.values,
g.indices,
g.dense_shape[0]),
shape=t.get_shape()))
else:
tensor_to_avg.append(g)
avg_op = self._moving_averager.apply(tensor_to_avg)
grad_var_ops.append(avg_op)
with tf.control_dependencies([avg_op]):
self._grad_avg = [self._moving_averager.average(val)
for val in tensor_to_avg]
self._grad_avg_squared = [tf.square(val) for val in self._grad_avg]
# Compute Variance
self._grad_var = tf.maximum(
tf.constant(1e-6, dtype=self._grad_norm_squared_avg.dtype),
self._grad_norm_squared_avg
- tf.add_n([tf.reduce_sum(val) for val in self._grad_avg_squared]))
if self._sparsity_debias:
self._grad_var *= self._sparsity_avg
return grad_var_ops
|
[
"def",
"_grad_variance",
"(",
"self",
")",
":",
"grad_var_ops",
"=",
"[",
"]",
"tensor_to_avg",
"=",
"[",
"]",
"for",
"t",
",",
"g",
"in",
"zip",
"(",
"self",
".",
"_vars",
",",
"self",
".",
"_grad",
")",
":",
"if",
"isinstance",
"(",
"g",
",",
"tf",
".",
"IndexedSlices",
")",
":",
"tensor_to_avg",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"tf",
".",
"unsorted_segment_sum",
"(",
"g",
".",
"values",
",",
"g",
".",
"indices",
",",
"g",
".",
"dense_shape",
"[",
"0",
"]",
")",
",",
"shape",
"=",
"t",
".",
"get_shape",
"(",
")",
")",
")",
"else",
":",
"tensor_to_avg",
".",
"append",
"(",
"g",
")",
"avg_op",
"=",
"self",
".",
"_moving_averager",
".",
"apply",
"(",
"tensor_to_avg",
")",
"grad_var_ops",
".",
"append",
"(",
"avg_op",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"avg_op",
"]",
")",
":",
"self",
".",
"_grad_avg",
"=",
"[",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"val",
")",
"for",
"val",
"in",
"tensor_to_avg",
"]",
"self",
".",
"_grad_avg_squared",
"=",
"[",
"tf",
".",
"square",
"(",
"val",
")",
"for",
"val",
"in",
"self",
".",
"_grad_avg",
"]",
"# Compute Variance",
"self",
".",
"_grad_var",
"=",
"tf",
".",
"maximum",
"(",
"tf",
".",
"constant",
"(",
"1e-6",
",",
"dtype",
"=",
"self",
".",
"_grad_norm_squared_avg",
".",
"dtype",
")",
",",
"self",
".",
"_grad_norm_squared_avg",
"-",
"tf",
".",
"add_n",
"(",
"[",
"tf",
".",
"reduce_sum",
"(",
"val",
")",
"for",
"val",
"in",
"self",
".",
"_grad_avg_squared",
"]",
")",
")",
"if",
"self",
".",
"_sparsity_debias",
":",
"self",
".",
"_grad_var",
"*=",
"self",
".",
"_sparsity_avg",
"return",
"grad_var_ops"
] |
Estimate of gradient Variance.
Returns:
C_t ops.
|
[
"Estimate",
"of",
"gradient",
"Variance",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L232-L263
|
train
|
Estimate of gradient Variance.
|
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,j9rjMY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cNds,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(0b100010 + 0o16) + chr(111) + chr(0b100111 + 0o13) + '\060' + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x33' + chr(0b100001 + 0o22), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(891 - 841) + chr(50) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b110010) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b1010 + 0o50) + '\063', 49243 - 49235), ehT0Px3KOsy9(chr(0b110000) + chr(0b110 + 0o151) + chr(0b100111 + 0o12) + chr(2075 - 2025), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101001 + 0o6) + '\x33' + '\x33' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1141 - 1093) + '\x6f' + '\064' + '\x32', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(49) + chr(0b101101 + 0o10), 60525 - 60517), ehT0Px3KOsy9('\x30' + chr(4588 - 4477) + chr(82 - 31) + chr(0b110100) + chr(0b11001 + 0o34), 42833 - 42825), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110110) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11111 + 0o23) + chr(51) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2383 - 2332) + chr(0b101101 + 0o4) + '\x31', 27858 - 27850), ehT0Px3KOsy9(chr(48) + chr(8460 - 8349) + '\062' + chr(53) + '\065', 41836 - 41828), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + chr(0b110001) + chr(0b1001 + 0o47) + '\x34', 59909 - 59901), ehT0Px3KOsy9('\060' + '\157' + chr(2594 - 2543) + chr(0b100110 + 0o21) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x34' + '\x32', 46041 - 46033), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(2656 - 2603) + chr(49), 25117 - 25109), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b11110 + 0o23) + chr(0b1001 + 0o56) + chr(1446 - 1396), 64696 - 64688), ehT0Px3KOsy9(chr(1246 - 1198) + '\157' + chr(0b10001 + 0o41) + chr(2253 - 2198) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1000100 + 0o53) + chr(1782 - 1731) + '\x34' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(51) + chr(0b10110 + 0o40), 16759 - 16751), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(734 - 684) + '\x37' + chr(0b110111), 35410 - 35402), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(0b110110) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b11110 + 0o31) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(2256 - 2208) + '\157' + chr(1527 - 1478) + chr(49) + chr(0b11101 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(49) + '\065' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(53) + chr(53), 8), ehT0Px3KOsy9(chr(48) + chr(7977 - 7866) + chr(0b110001) + chr(2276 - 2225) + chr(0b110000 + 0o2), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(50) + '\067' + chr(2015 - 1966), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(52) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + '\063' + chr(243 - 191) + chr(1762 - 1714), 63615 - 63607), ehT0Px3KOsy9('\x30' + chr(10221 - 10110) + '\063' + '\061' + '\067', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b11001 + 0o126) + chr(50) + chr(0b100 + 0o62) + chr(1005 - 951), 0b1000), ehT0Px3KOsy9(chr(1495 - 1447) + chr(0b1101111) + chr(2138 - 2087) + chr(0b100011 + 0o21) + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b110100) + '\x31', 2493 - 2485), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + '\061' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\x31' + chr(0b11110 + 0o26) + chr(1569 - 1516), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8'), chr(100) + '\145' + '\143' + chr(0b1010 + 0o145) + '\144' + chr(0b1100101))(chr(7070 - 6953) + chr(9007 - 8891) + chr(0b1001001 + 0o35) + '\055' + chr(117 - 61)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def qoMxxXR2sfB9(oVre8I6UXc3b):
LeO6DmwdnX6g = []
Y8kKrYjXax3F = []
for (YeT3l7JgTbWR, RWHpzFEeviFP) in pZ0NK2y6HRbn(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9-\xf7\xe0 '), '\x64' + chr(0b1100101) + chr(2092 - 1993) + chr(0b100101 + 0o112) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(4903 - 4787) + chr(0b1000011 + 0o43) + '\055' + '\x38')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9<\xe4\xf37'), '\x64' + '\x65' + chr(0b1100011) + chr(792 - 681) + chr(0b11100 + 0o110) + '\145')(chr(0b1110101) + '\x74' + chr(102) + chr(45) + chr(56)))):
if PlSM16l2KDPD(RWHpzFEeviFP, xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf5\xf2\xf7+o\xb8q\xa1\x8cQ\xfb\\'), chr(100) + '\x65' + chr(99) + '\x6f' + chr(100) + chr(101))(chr(117) + '\x74' + '\146' + chr(0b11101 + 0o20) + chr(56)))):
xafqLlk3kkUe(Y8kKrYjXax3F, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7+\xe6\xf7=n'), chr(5968 - 5868) + '\x65' + chr(99) + '\157' + chr(4313 - 4213) + chr(0b1100101))(chr(117) + chr(0b111010 + 0o72) + '\x66' + '\055' + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4>\xe5\xfa2z\xb9'), '\144' + chr(0b110000 + 0o65) + chr(0b1100011) + chr(4684 - 4573) + '\144' + chr(0b1010101 + 0o20))('\x75' + chr(5819 - 5703) + '\x66' + '\055' + chr(0b11110 + 0o32)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf35\xe5\xfd!~\xb9F\x92\x96W\xf9B\xac\xc30\xa0\x97\x17\x84'), '\144' + '\145' + '\x63' + chr(6921 - 6810) + chr(0b1100100) + '\145')('\165' + chr(116) + '\146' + chr(688 - 643) + '\070'))(xafqLlk3kkUe(RWHpzFEeviFP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\x0b\xf8\xd1\x1d\x7f\xe9\x16\x85\xd4V\xfc'), chr(0b1011110 + 0o6) + chr(0b1100101) + chr(99) + chr(0b1101110 + 0o1) + chr(2148 - 2048) + '\145')(chr(117) + chr(9749 - 9633) + '\146' + chr(45) + chr(0b111000))), xafqLlk3kkUe(RWHpzFEeviFP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6\x12\xf5\xfd2R\x99l\xa1\xd0b\xe9'), '\x64' + chr(0b10110 + 0o117) + '\143' + chr(0b1101111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(45) + chr(56))), xafqLlk3kkUe(RWHpzFEeviFP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2>\xf8\xe16U\xafJ\xac\x95W'), chr(0b111101 + 0o47) + chr(101) + chr(0b1100011) + '\157' + chr(100) + chr(101))(chr(0b1110101) + chr(11508 - 11392) + chr(0b1100110) + chr(0b101101) + chr(1181 - 1125)))[ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x30', 42232 - 42224)]), shape=xafqLlk3kkUe(YeT3l7JgTbWR, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1>\xe2\xcd b\xbdR\xa8'), '\x64' + '\145' + '\143' + '\x6f' + chr(0b101110 + 0o66) + chr(0b1000101 + 0o40))(chr(7170 - 7053) + chr(0b1011100 + 0o30) + chr(102) + chr(248 - 203) + '\070'))()))
else:
xafqLlk3kkUe(Y8kKrYjXax3F, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7+\xe6\xf7=n'), '\144' + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(732 - 632) + chr(8824 - 8723))('\165' + chr(0b10111 + 0o135) + chr(7335 - 7233) + chr(0b101101) + chr(0b111000)))(RWHpzFEeviFP)
mdaLt3Lic5wF = oVre8I6UXc3b._moving_averager.apply(Y8kKrYjXax3F)
xafqLlk3kkUe(LeO6DmwdnX6g, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7+\xe6\xf7=n'), chr(100) + chr(0b1100101) + '\143' + chr(0b1101111) + '\144' + chr(10143 - 10042))('\x75' + '\x74' + '\x66' + chr(0b101101) + '\070'))(mdaLt3Lic5wF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe54\xf8\xe6!e\xb0}\xa9\x80B\xfbA\xad\xc8*\x9c\x8d\x07\x9a'), '\x64' + '\x65' + chr(0b111000 + 0o53) + chr(3252 - 3141) + chr(100) + '\x65')('\x75' + '\164' + '\x66' + '\x2d' + '\x38'))([mdaLt3Lic5wF]):
oVre8I6UXc3b.GNpPDdUZBG73 = [oVre8I6UXc3b._moving_averager.average(pQxH2D_k9sXQ) for pQxH2D_k9sXQ in Y8kKrYjXax3F]
oVre8I6UXc3b.QLUS9FY6E0Oa = [IDJ2eXGCBCDu.square(pQxH2D_k9sXQ) for pQxH2D_k9sXQ in oVre8I6UXc3b.GNpPDdUZBG73]
oVre8I6UXc3b.IvX3ku2a2AA8 = IDJ2eXGCBCDu.maximum(IDJ2eXGCBCDu.constant(1e-06, dtype=oVre8I6UXc3b._grad_norm_squared_avg.jSV9IKnemH7K), oVre8I6UXc3b._grad_norm_squared_avg - IDJ2eXGCBCDu.add_n([IDJ2eXGCBCDu.reduce_sum(pQxH2D_k9sXQ) for pQxH2D_k9sXQ in oVre8I6UXc3b.QLUS9FY6E0Oa]))
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9(\xe6\xf3!y\xb5V\xb4\xbaV\xfbM\xa0\xcc7'), chr(7940 - 7840) + chr(0b1000000 + 0o45) + '\x63' + '\x6f' + chr(100) + '\145')(chr(426 - 309) + '\164' + chr(4496 - 4394) + chr(0b101101) + chr(0b1000 + 0o60))):
oVre8I6UXc3b.IvX3ku2a2AA8 *= oVre8I6UXc3b._sparsity_avg
return LeO6DmwdnX6g
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._dist_to_opt
|
def _dist_to_opt(self):
"""Distance to optimum.
Returns:
D_t ops
"""
dist_to_opt_ops = []
# Running average of the norm of gradient
self._grad_norm = tf.sqrt(self._grad_norm_squared)
avg_op = self._moving_averager.apply([self._grad_norm,])
dist_to_opt_ops.append(avg_op)
with tf.control_dependencies([avg_op]):
self._grad_norm_avg = self._moving_averager.average(self._grad_norm)
# Single iteration distance estimation, note here
# self._grad_norm_avg is per variable
self._d_t = self._grad_norm_avg / self._grad_norm_squared_avg
# Running average of distance
avg_op = self._moving_averager.apply([self._d_t])
dist_to_opt_ops.append(avg_op)
with tf.control_dependencies([avg_op]):
self._dist_to_opt_avg = tf.identity(
self._moving_averager.average(self._d_t))
if self._sparsity_debias:
self._dist_to_opt_avg /= tf.sqrt(self._sparsity_avg)
return dist_to_opt_ops
|
python
|
def _dist_to_opt(self):
"""Distance to optimum.
Returns:
D_t ops
"""
dist_to_opt_ops = []
# Running average of the norm of gradient
self._grad_norm = tf.sqrt(self._grad_norm_squared)
avg_op = self._moving_averager.apply([self._grad_norm,])
dist_to_opt_ops.append(avg_op)
with tf.control_dependencies([avg_op]):
self._grad_norm_avg = self._moving_averager.average(self._grad_norm)
# Single iteration distance estimation, note here
# self._grad_norm_avg is per variable
self._d_t = self._grad_norm_avg / self._grad_norm_squared_avg
# Running average of distance
avg_op = self._moving_averager.apply([self._d_t])
dist_to_opt_ops.append(avg_op)
with tf.control_dependencies([avg_op]):
self._dist_to_opt_avg = tf.identity(
self._moving_averager.average(self._d_t))
if self._sparsity_debias:
self._dist_to_opt_avg /= tf.sqrt(self._sparsity_avg)
return dist_to_opt_ops
|
[
"def",
"_dist_to_opt",
"(",
"self",
")",
":",
"dist_to_opt_ops",
"=",
"[",
"]",
"# Running average of the norm of gradient",
"self",
".",
"_grad_norm",
"=",
"tf",
".",
"sqrt",
"(",
"self",
".",
"_grad_norm_squared",
")",
"avg_op",
"=",
"self",
".",
"_moving_averager",
".",
"apply",
"(",
"[",
"self",
".",
"_grad_norm",
",",
"]",
")",
"dist_to_opt_ops",
".",
"append",
"(",
"avg_op",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"avg_op",
"]",
")",
":",
"self",
".",
"_grad_norm_avg",
"=",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"self",
".",
"_grad_norm",
")",
"# Single iteration distance estimation, note here",
"# self._grad_norm_avg is per variable",
"self",
".",
"_d_t",
"=",
"self",
".",
"_grad_norm_avg",
"/",
"self",
".",
"_grad_norm_squared_avg",
"# Running average of distance",
"avg_op",
"=",
"self",
".",
"_moving_averager",
".",
"apply",
"(",
"[",
"self",
".",
"_d_t",
"]",
")",
"dist_to_opt_ops",
".",
"append",
"(",
"avg_op",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"avg_op",
"]",
")",
":",
"self",
".",
"_dist_to_opt_avg",
"=",
"tf",
".",
"identity",
"(",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"self",
".",
"_d_t",
")",
")",
"if",
"self",
".",
"_sparsity_debias",
":",
"self",
".",
"_dist_to_opt_avg",
"/=",
"tf",
".",
"sqrt",
"(",
"self",
".",
"_sparsity_avg",
")",
"return",
"dist_to_opt_ops"
] |
Distance to optimum.
Returns:
D_t ops
|
[
"Distance",
"to",
"optimum",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L265-L289
|
train
|
Distance to optimum.
|
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,ZsDPvpP4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ie6,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(0b101 + 0o53) + chr(0b1101111) + chr(0b1001 + 0o50) + '\064' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(289 - 241) + chr(4643 - 4532) + '\x32' + chr(127 - 75) + chr(0b100000 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1854 - 1804) + chr(0b101110 + 0o7) + '\x33', 349 - 341), ehT0Px3KOsy9(chr(0b110000) + chr(0b10000 + 0o137) + chr(0b101100 + 0o7) + chr(0b110000) + chr(927 - 873), 36161 - 36153), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101101 + 0o2) + chr(54) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1010100 + 0o33) + '\x33' + chr(50) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b101001 + 0o12) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(701 - 653) + '\157' + chr(0b110010 + 0o4) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + '\x33' + '\065' + chr(1529 - 1474), 0b1000), ehT0Px3KOsy9(chr(867 - 819) + chr(0b1101111) + '\061' + chr(0b110000) + chr(527 - 479), 0b1000), ehT0Px3KOsy9(chr(1981 - 1933) + chr(111) + chr(0b110001) + chr(54), 6555 - 6547), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(951 - 901) + chr(209 - 161) + chr(0b110101), 59178 - 59170), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\062' + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(86 - 35) + '\x32' + '\x32', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10110 + 0o34) + chr(49) + chr(0b110010), 25703 - 25695), ehT0Px3KOsy9('\x30' + chr(8570 - 8459) + chr(51) + chr(0b110001) + chr(0b110 + 0o60), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(1176 - 1121) + chr(0b101000 + 0o11), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1100 + 0o47) + '\061' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2528 - 2417) + chr(182 - 128) + chr(50), 18149 - 18141), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(48) + chr(1755 - 1707), 0b1000), ehT0Px3KOsy9('\x30' + chr(6511 - 6400) + '\x32' + chr(2107 - 2058) + chr(50), 8), ehT0Px3KOsy9(chr(1982 - 1934) + chr(111) + chr(49) + '\x34' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10944 - 10833) + chr(0b100011 + 0o20) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110111) + chr(0b110101), 18185 - 18177), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + '\063' + chr(143 - 88) + chr(0b101011 + 0o14), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(52) + chr(232 - 177), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1011 + 0o46) + '\x35' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x37' + chr(837 - 784), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1415 - 1361) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(1186 - 1137) + chr(0b110101), 32096 - 32088), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + '\063' + chr(1346 - 1291) + '\061', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(802 - 751) + '\x32' + '\x32', 8), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\060' + chr(0b110001), 56152 - 56144), ehT0Px3KOsy9(chr(48) + '\157' + chr(937 - 886) + chr(2234 - 2179) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(12190 - 12079) + chr(0b110111) + chr(709 - 659), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(49) + chr(48) + '\x35', 0b1000), ehT0Px3KOsy9(chr(1802 - 1754) + '\157' + chr(0b110010 + 0o1) + chr(0b11 + 0o55) + '\067', 33529 - 33521), ehT0Px3KOsy9(chr(722 - 674) + '\x6f' + '\062' + chr(0b110100) + chr(1654 - 1603), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(0b110011) + chr(0b11 + 0o64) + '\064', 52394 - 52386)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + '\x35' + chr(0b10111 + 0o31), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'L'), chr(0b1011001 + 0o13) + '\x65' + chr(99) + '\157' + chr(2449 - 2349) + '\x65')(chr(3934 - 3817) + chr(3831 - 3715) + '\146' + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Q7_UrhIutWxU(oVre8I6UXc3b):
g0eo0bbQhycQ = []
oVre8I6UXc3b.z7LdQT8sHZxU = IDJ2eXGCBCDu.sqrt(oVre8I6UXc3b._grad_norm_squared)
mdaLt3Lic5wF = oVre8I6UXc3b._moving_averager.apply([oVre8I6UXc3b.z7LdQT8sHZxU])
xafqLlk3kkUe(g0eo0bbQhycQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xd2\xdb\xa3_@'), chr(0b1100100) + chr(101) + chr(99) + '\157' + chr(0b1100100) + chr(0b10101 + 0o120))('\x75' + chr(116) + chr(102) + '\x2d' + '\x38'))(mdaLt3Lic5wF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\xcd\xc5\xb2CK\xbe\xc6T\x8a0k\xeb\xff\xb7\xe4\xad\x90\xacA'), chr(0b1011 + 0o131) + chr(101) + chr(99) + chr(0b110110 + 0o71) + chr(4736 - 4636) + chr(8636 - 8535))('\x75' + chr(0b1100000 + 0o24) + '\146' + chr(45) + chr(56)))([mdaLt3Lic5wF]):
oVre8I6UXc3b.GY48GM_P4TMd = oVre8I6UXc3b._moving_averager.average(oVre8I6UXc3b.z7LdQT8sHZxU)
oVre8I6UXc3b.lEz1KzD0qjfL = oVre8I6UXc3b.GY48GM_P4TMd / oVre8I6UXc3b._grad_norm_squared_avg
mdaLt3Lic5wF = oVre8I6UXc3b._moving_averager.apply([oVre8I6UXc3b.lEz1KzD0qjfL])
xafqLlk3kkUe(g0eo0bbQhycQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xd2\xdb\xa3_@'), chr(0b1100100) + chr(9351 - 9250) + chr(0b1011100 + 0o7) + '\x6f' + '\144' + '\x65')('\165' + '\164' + chr(102) + chr(0b100100 + 0o11) + '\070'))(mdaLt3Lic5wF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\xcd\xc5\xb2CK\xbe\xc6T\x8a0k\xeb\xff\xb7\xe4\xad\x90\xacA'), '\x64' + '\x65' + chr(6406 - 6307) + '\x6f' + '\x64' + chr(1982 - 1881))(chr(117) + chr(9199 - 9083) + '\146' + chr(1229 - 1184) + '\x38'))([mdaLt3Lic5wF]):
oVre8I6UXc3b.nVSpS0hzhTva = IDJ2eXGCBCDu.identity(oVre8I6UXc3b._moving_averager.average(oVre8I6UXc3b.lEz1KzD0qjfL))
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'=\xd1\xdb\xa7CW\xbb\xedI\xb0$k\xe7\xf2\xb3\xf9'), '\x64' + chr(0b1100101) + chr(99) + '\157' + '\144' + chr(101))(chr(117) + chr(3100 - 2984) + chr(102) + chr(45) + chr(56))):
oVre8I6UXc3b.nVSpS0hzhTva /= IDJ2eXGCBCDu.sqrt(oVre8I6UXc3b._sparsity_avg)
return g0eo0bbQhycQ
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._grad_sparsity
|
def _grad_sparsity(self):
"""Gradient sparsity."""
# If the sparse minibatch gradient has 10 percent of its entries
# non-zero, its sparsity is 0.1.
# The norm of dense gradient averaged from full dataset
# are roughly estimated norm of minibatch
# sparse gradient norm * sqrt(sparsity)
# An extension maybe only correct the sparse blob.
non_zero_cnt = tf.add_n([tf.count_nonzero(g) for g in self._grad])
all_entry_cnt = tf.add_n([tf.size(g) for g in self._grad])
self._sparsity = tf.cast(non_zero_cnt, self._grad[0].dtype)
self._sparsity /= tf.cast(all_entry_cnt, self._grad[0].dtype)
avg_op = self._moving_averager.apply([self._sparsity,])
with tf.control_dependencies([avg_op]):
self._sparsity_avg = self._moving_averager.average(self._sparsity)
return avg_op
|
python
|
def _grad_sparsity(self):
"""Gradient sparsity."""
# If the sparse minibatch gradient has 10 percent of its entries
# non-zero, its sparsity is 0.1.
# The norm of dense gradient averaged from full dataset
# are roughly estimated norm of minibatch
# sparse gradient norm * sqrt(sparsity)
# An extension maybe only correct the sparse blob.
non_zero_cnt = tf.add_n([tf.count_nonzero(g) for g in self._grad])
all_entry_cnt = tf.add_n([tf.size(g) for g in self._grad])
self._sparsity = tf.cast(non_zero_cnt, self._grad[0].dtype)
self._sparsity /= tf.cast(all_entry_cnt, self._grad[0].dtype)
avg_op = self._moving_averager.apply([self._sparsity,])
with tf.control_dependencies([avg_op]):
self._sparsity_avg = self._moving_averager.average(self._sparsity)
return avg_op
|
[
"def",
"_grad_sparsity",
"(",
"self",
")",
":",
"# If the sparse minibatch gradient has 10 percent of its entries",
"# non-zero, its sparsity is 0.1.",
"# The norm of dense gradient averaged from full dataset",
"# are roughly estimated norm of minibatch",
"# sparse gradient norm * sqrt(sparsity)",
"# An extension maybe only correct the sparse blob.",
"non_zero_cnt",
"=",
"tf",
".",
"add_n",
"(",
"[",
"tf",
".",
"count_nonzero",
"(",
"g",
")",
"for",
"g",
"in",
"self",
".",
"_grad",
"]",
")",
"all_entry_cnt",
"=",
"tf",
".",
"add_n",
"(",
"[",
"tf",
".",
"size",
"(",
"g",
")",
"for",
"g",
"in",
"self",
".",
"_grad",
"]",
")",
"self",
".",
"_sparsity",
"=",
"tf",
".",
"cast",
"(",
"non_zero_cnt",
",",
"self",
".",
"_grad",
"[",
"0",
"]",
".",
"dtype",
")",
"self",
".",
"_sparsity",
"/=",
"tf",
".",
"cast",
"(",
"all_entry_cnt",
",",
"self",
".",
"_grad",
"[",
"0",
"]",
".",
"dtype",
")",
"avg_op",
"=",
"self",
".",
"_moving_averager",
".",
"apply",
"(",
"[",
"self",
".",
"_sparsity",
",",
"]",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"avg_op",
"]",
")",
":",
"self",
".",
"_sparsity_avg",
"=",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"self",
".",
"_sparsity",
")",
"return",
"avg_op"
] |
Gradient sparsity.
|
[
"Gradient",
"sparsity",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L291-L306
|
train
|
Gradient sparsity.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAt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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(1573 - 1525) + '\x6f' + '\x33' + chr(0b10000 + 0o43) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(51) + chr(0b100110 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b110100) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11100 + 0o31) + chr(0b1010 + 0o54), 41476 - 41468), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(48) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(0b110000 + 0o1) + chr(602 - 549), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\066' + chr(0b100001 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(1947 - 1899) + chr(0b1101111) + chr(0b111 + 0o52) + '\067' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111111 + 0o60) + chr(0b101000 + 0o11) + '\061' + chr(0b110011), 19005 - 18997), ehT0Px3KOsy9(chr(52 - 4) + '\x6f' + chr(0b10010 + 0o41) + '\x34' + chr(0b11011 + 0o32), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110110) + chr(52), 8), ehT0Px3KOsy9(chr(48) + chr(3930 - 3819) + chr(0b100100 + 0o16) + chr(680 - 626) + chr(748 - 698), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + '\066' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(51) + chr(414 - 365), 58444 - 58436), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(7255 - 7144) + chr(312 - 262) + chr(1842 - 1787), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(49) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b110010) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(2231 - 2182) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110101) + chr(1772 - 1718), 8), ehT0Px3KOsy9(chr(1787 - 1739) + '\157' + chr(1836 - 1785) + chr(0b1111 + 0o47) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(7411 - 7300) + chr(0b110010) + chr(52) + '\060', 12808 - 12800), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11001 + 0o32) + '\x37' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1100010 + 0o15) + '\062' + '\067' + chr(0b110101), 17380 - 17372), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\x34' + chr(1355 - 1302), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + chr(674 - 625) + chr(53) + chr(0b101111 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101101 + 0o102) + chr(50) + chr(50) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(906 - 858) + chr(0b1101111) + chr(50) + chr(1892 - 1843) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11001 + 0o35) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(0b110011) + '\x30' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\060' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2488 - 2437) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\x35' + chr(0b110000), 21088 - 21080), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(50) + chr(51), 0o10), ehT0Px3KOsy9(chr(1001 - 953) + chr(111) + chr(1610 - 1561) + chr(48) + chr(2155 - 2100), 0b1000), ehT0Px3KOsy9(chr(1262 - 1214) + '\157' + chr(179 - 128) + chr(50) + chr(0b100001 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(2292 - 2244) + chr(2166 - 2055) + chr(53) + chr(0b110000), 64207 - 64199), ehT0Px3KOsy9(chr(670 - 622) + chr(4360 - 4249) + chr(0b10 + 0o61) + chr(0b110 + 0o53) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b100010 + 0o17), 4120 - 4112), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(2262 - 2212) + chr(543 - 494), 64389 - 64381), ehT0Px3KOsy9('\x30' + '\157' + '\x35' + chr(1702 - 1654), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + '\x35' + chr(134 - 86), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0'), '\144' + '\x65' + '\143' + chr(0b110110 + 0o71) + chr(100) + chr(101))('\165' + '\x74' + '\146' + chr(0b11010 + 0o23) + chr(0b100100 + 0o24)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def v4kAiD8g_ldC(oVre8I6UXc3b):
AB1pm8BQkNIl = IDJ2eXGCBCDu.add_n([IDJ2eXGCBCDu.count_nonzero(RWHpzFEeviFP) for RWHpzFEeviFP in oVre8I6UXc3b._grad])
zKafEXgafR7w = IDJ2eXGCBCDu.add_n([IDJ2eXGCBCDu.NLcc3BCJnQka(RWHpzFEeviFP) for RWHpzFEeviFP in oVre8I6UXc3b._grad])
oVre8I6UXc3b.lIPWQdHrnIFr = IDJ2eXGCBCDu.cast(AB1pm8BQkNIl, oVre8I6UXc3b._grad[ehT0Px3KOsy9('\x30' + '\157' + '\x30', 0o10)].jSV9IKnemH7K)
oVre8I6UXc3b.lIPWQdHrnIFr /= IDJ2eXGCBCDu.cast(zKafEXgafR7w, oVre8I6UXc3b._grad[ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b110010 + 0o75) + chr(440 - 392), 8)].jSV9IKnemH7K)
mdaLt3Lic5wF = oVre8I6UXc3b._moving_averager.apply([oVre8I6UXc3b.lIPWQdHrnIFr])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"\xbd\xb3\rZ6bX$/\x80D\xd7Y}r'\xb6\xa2K\x86"), chr(9628 - 9528) + chr(6546 - 6445) + '\x63' + '\157' + chr(8370 - 8270) + chr(0b1100101))(chr(0b1010000 + 0o45) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56)))([mdaLt3Lic5wF]):
oVre8I6UXc3b.enlavMiWuqnW = oVre8I6UXc3b._moving_averager.average(oVre8I6UXc3b.lIPWQdHrnIFr)
return mdaLt3Lic5wF
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._prepare_variables
|
def _prepare_variables(self):
"""Prepare Variables for YellowFin.
Returns:
Grad**2, Norm, Norm**2, Mean(Norm**2) ops
"""
self._moving_averager = tf.train.ExponentialMovingAverage(
decay=self._beta, zero_debias=self._zero_debias)
# assert self._grad is not None and len(self._grad) > 0
# List for the returned Operations
prepare_variables_op = []
# Get per var g**2 and norm**2
self._grad_squared = []
self._grad_norm_squared = []
# Gradient squared
for v, g in zip(self._vars, self._grad):
if g is None: continue
with tf.colocate_with(v):
self._grad_squared.append(tf.square(g))
# Norm squared.
self._grad_norm_squared = [tf.reduce_sum(g_sq)
for g_sq in self._grad_squared]
if self._sparsity_debias:
avg_op_sparsity = self._grad_sparsity()
prepare_variables_op.append(avg_op_sparsity)
# The following running average on squared norm of gradient
# is shared by grad_var and dist_to_opt
avg_op = self._moving_averager.apply(self._grad_norm_squared)
with tf.control_dependencies([avg_op]):
self._grad_norm_squared_avg = [self._moving_averager.average(val)
for val in self._grad_norm_squared]
self._grad_norm_squared = tf.add_n(self._grad_norm_squared)
self._grad_norm_squared_avg = tf.add_n(self._grad_norm_squared_avg)
prepare_variables_op.append(avg_op)
return tf.group(*prepare_variables_op)
|
python
|
def _prepare_variables(self):
"""Prepare Variables for YellowFin.
Returns:
Grad**2, Norm, Norm**2, Mean(Norm**2) ops
"""
self._moving_averager = tf.train.ExponentialMovingAverage(
decay=self._beta, zero_debias=self._zero_debias)
# assert self._grad is not None and len(self._grad) > 0
# List for the returned Operations
prepare_variables_op = []
# Get per var g**2 and norm**2
self._grad_squared = []
self._grad_norm_squared = []
# Gradient squared
for v, g in zip(self._vars, self._grad):
if g is None: continue
with tf.colocate_with(v):
self._grad_squared.append(tf.square(g))
# Norm squared.
self._grad_norm_squared = [tf.reduce_sum(g_sq)
for g_sq in self._grad_squared]
if self._sparsity_debias:
avg_op_sparsity = self._grad_sparsity()
prepare_variables_op.append(avg_op_sparsity)
# The following running average on squared norm of gradient
# is shared by grad_var and dist_to_opt
avg_op = self._moving_averager.apply(self._grad_norm_squared)
with tf.control_dependencies([avg_op]):
self._grad_norm_squared_avg = [self._moving_averager.average(val)
for val in self._grad_norm_squared]
self._grad_norm_squared = tf.add_n(self._grad_norm_squared)
self._grad_norm_squared_avg = tf.add_n(self._grad_norm_squared_avg)
prepare_variables_op.append(avg_op)
return tf.group(*prepare_variables_op)
|
[
"def",
"_prepare_variables",
"(",
"self",
")",
":",
"self",
".",
"_moving_averager",
"=",
"tf",
".",
"train",
".",
"ExponentialMovingAverage",
"(",
"decay",
"=",
"self",
".",
"_beta",
",",
"zero_debias",
"=",
"self",
".",
"_zero_debias",
")",
"# assert self._grad is not None and len(self._grad) > 0",
"# List for the returned Operations",
"prepare_variables_op",
"=",
"[",
"]",
"# Get per var g**2 and norm**2",
"self",
".",
"_grad_squared",
"=",
"[",
"]",
"self",
".",
"_grad_norm_squared",
"=",
"[",
"]",
"# Gradient squared",
"for",
"v",
",",
"g",
"in",
"zip",
"(",
"self",
".",
"_vars",
",",
"self",
".",
"_grad",
")",
":",
"if",
"g",
"is",
"None",
":",
"continue",
"with",
"tf",
".",
"colocate_with",
"(",
"v",
")",
":",
"self",
".",
"_grad_squared",
".",
"append",
"(",
"tf",
".",
"square",
"(",
"g",
")",
")",
"# Norm squared.",
"self",
".",
"_grad_norm_squared",
"=",
"[",
"tf",
".",
"reduce_sum",
"(",
"g_sq",
")",
"for",
"g_sq",
"in",
"self",
".",
"_grad_squared",
"]",
"if",
"self",
".",
"_sparsity_debias",
":",
"avg_op_sparsity",
"=",
"self",
".",
"_grad_sparsity",
"(",
")",
"prepare_variables_op",
".",
"append",
"(",
"avg_op_sparsity",
")",
"# The following running average on squared norm of gradient",
"# is shared by grad_var and dist_to_opt",
"avg_op",
"=",
"self",
".",
"_moving_averager",
".",
"apply",
"(",
"self",
".",
"_grad_norm_squared",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"avg_op",
"]",
")",
":",
"self",
".",
"_grad_norm_squared_avg",
"=",
"[",
"self",
".",
"_moving_averager",
".",
"average",
"(",
"val",
")",
"for",
"val",
"in",
"self",
".",
"_grad_norm_squared",
"]",
"self",
".",
"_grad_norm_squared",
"=",
"tf",
".",
"add_n",
"(",
"self",
".",
"_grad_norm_squared",
")",
"self",
".",
"_grad_norm_squared_avg",
"=",
"tf",
".",
"add_n",
"(",
"self",
".",
"_grad_norm_squared_avg",
")",
"prepare_variables_op",
".",
"append",
"(",
"avg_op",
")",
"return",
"tf",
".",
"group",
"(",
"*",
"prepare_variables_op",
")"
] |
Prepare Variables for YellowFin.
Returns:
Grad**2, Norm, Norm**2, Mean(Norm**2) ops
|
[
"Prepare",
"Variables",
"for",
"YellowFin",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L308-L349
|
train
|
Prepare Variables for YellowFin.
|
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(0b100011 + 0o15) + chr(0b1011 + 0o144) + '\061' + '\062' + chr(0b110001), 33055 - 33047), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + '\061' + chr(48) + '\x35', 0o10), ehT0Px3KOsy9(chr(1538 - 1490) + '\157' + chr(0b101001 + 0o10) + chr(54) + '\x36', 41794 - 41786), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b110100) + chr(731 - 678), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(1909 - 1859) + chr(0b110010), 165 - 157), ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + chr(49) + chr(0b1011 + 0o47) + chr(345 - 293), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + '\x31' + chr(51) + chr(55), 12560 - 12552), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b10000 + 0o45) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(53) + '\x30', 2400 - 2392), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + '\062' + chr(1577 - 1523) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6654 - 6543) + '\061' + '\x37' + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\x33' + chr(0b101110 + 0o5), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2024 - 1973) + '\x32' + chr(48), 0o10), ehT0Px3KOsy9(chr(1731 - 1683) + '\x6f' + chr(1028 - 978) + chr(0b100101 + 0o16), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\x32' + '\x31', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(2145 - 2094) + chr(0b110110) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(385 - 337) + chr(0b1101111) + '\062' + chr(48) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1100010 + 0o15) + '\061' + chr(50) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9005 - 8894) + '\067' + chr(0b1110 + 0o51), 31020 - 31012), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(868 - 757) + chr(0b111 + 0o53) + chr(0b110000) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1380 - 1329) + '\x31' + chr(0b101011 + 0o6), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(51) + chr(0b101101 + 0o6) + chr(0b101 + 0o54), 0b1000), ehT0Px3KOsy9(chr(193 - 145) + '\157' + chr(0b1001 + 0o50) + chr(0b110001 + 0o3) + '\061', 0o10), ehT0Px3KOsy9(chr(1577 - 1529) + chr(0b1101111) + '\062' + chr(208 - 160) + chr(0b100010 + 0o22), 50198 - 50190), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(53) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(50) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + '\x31' + chr(0b110101) + '\063', 44501 - 44493), ehT0Px3KOsy9(chr(48) + chr(0b1010101 + 0o32) + chr(49) + chr(0b11100 + 0o27) + '\x33', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\066' + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001011 + 0o44) + chr(0b110001) + chr(52), 0b1000), ehT0Px3KOsy9(chr(1076 - 1028) + chr(0b1101111) + '\x32' + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11 + 0o57) + chr(0b110011) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2221 - 2170), 50878 - 50870), ehT0Px3KOsy9(chr(1985 - 1937) + '\157' + chr(1161 - 1110) + chr(53) + chr(51), 8), ehT0Px3KOsy9(chr(48) + chr(0b10111 + 0o130) + chr(0b110011) + chr(2043 - 1989) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(2302 - 2254) + chr(111) + chr(0b11000 + 0o33) + chr(53) + '\x34', 60103 - 60095), ehT0Px3KOsy9(chr(207 - 159) + '\x6f' + '\066', 5067 - 5059), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + '\065', 10039 - 10031), ehT0Px3KOsy9(chr(48) + chr(11146 - 11035) + chr(0b110000 + 0o3) + chr(52) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(786 - 737) + '\064', 51745 - 51737)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1480 - 1432) + chr(0b110101 + 0o72) + chr(53) + chr(0b101111 + 0o1), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f'), '\x64' + '\x65' + chr(0b111000 + 0o53) + chr(111) + '\x64' + chr(9118 - 9017))(chr(0b1110101) + '\164' + chr(102) + chr(45) + chr(1565 - 1509)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def r1mVXWuxi_JL(oVre8I6UXc3b):
oVre8I6UXc3b.TiwYtN8Ho7Kt = IDJ2eXGCBCDu.train.ExponentialMovingAverage(decay=oVre8I6UXc3b.SUK1x3ZRbDDY, zero_debias=oVre8I6UXc3b._zero_debias)
sLagDyaDFGJY = []
oVre8I6UXc3b.mwKaZYLG0HLq = []
oVre8I6UXc3b.L0_fQbQC6unS = []
for (cMbll0QYhULo, RWHpzFEeviFP) in pZ0NK2y6HRbn(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e3\x17\xd7\xe1'), chr(325 - 225) + chr(0b1100101) + chr(99) + chr(0b11 + 0o154) + '\x64' + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(0b100101 + 0o101) + chr(0b101101) + '\070')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e"\x04\xc4\xf6'), '\144' + chr(1667 - 1566) + '\x63' + chr(6253 - 6142) + chr(0b1100100) + '\145')(chr(0b10 + 0o163) + chr(12288 - 12172) + chr(6045 - 5943) + '\x2d' + chr(56)))):
if RWHpzFEeviFP is None:
continue
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'2*\x1a\xca\xf15+\x8e\xb7\xc2\x15/\xb8'), chr(0b1100100) + '\x65' + '\x63' + chr(0b1101111) + chr(100) + '\145')(chr(0b1110101) + '\x74' + '\x66' + '\055' + '\070'))(cMbll0QYhULo):
xafqLlk3kkUe(oVre8I6UXc3b._grad_squared, xafqLlk3kkUe(SXOLrMavuUCe(b'05\x06\xc0\xfc0'), chr(4628 - 4528) + '\x65' + chr(6696 - 6597) + chr(111) + chr(100) + chr(101))(chr(0b111001 + 0o74) + chr(13131 - 13015) + chr(2958 - 2856) + chr(0b101001 + 0o4) + chr(1619 - 1563)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'"4\x03\xc4\xe01'), chr(0b1100100) + chr(0b1100101) + '\143' + '\157' + chr(2169 - 2069) + '\x65')(chr(117) + chr(116) + chr(102) + '\055' + chr(2131 - 2075)))(RWHpzFEeviFP))
oVre8I6UXc3b.L0_fQbQC6unS = [IDJ2eXGCBCDu.reduce_sum(EXpRHoMIeEac) for EXpRHoMIeEac in oVre8I6UXc3b.mwKaZYLG0HLq]
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"\x0e6\x06\xc4\xe0'6\x9f\x91\xea\x18>\xb2z0\x84"), chr(0b1001000 + 0o34) + chr(0b11000 + 0o115) + '\143' + chr(0b1101111) + chr(0b111101 + 0o47) + '\x65')('\x75' + '\x74' + chr(0b1100110) + chr(0b101010 + 0o3) + '\x38')):
Bd4iAgDlJvXt = oVre8I6UXc3b._grad_sparsity()
xafqLlk3kkUe(sLagDyaDFGJY, xafqLlk3kkUe(SXOLrMavuUCe(b'05\x06\xc0\xfc0'), '\x64' + chr(0b1100101) + chr(0b10110 + 0o115) + chr(111) + chr(100) + chr(0b1100101))(chr(117) + chr(0b10110 + 0o136) + chr(0b1100110) + chr(0b10011 + 0o32) + chr(0b111000)))(Bd4iAgDlJvXt)
mdaLt3Lic5wF = oVre8I6UXc3b._moving_averager.apply(oVre8I6UXc3b.L0_fQbQC6unS)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'2*\x18\xd1\xe0;3\xb4\x8c\xd0\x0c>\xbew4\x99\xe5?Z\xf6'), chr(0b1100100) + chr(983 - 882) + chr(0b1100011) + chr(0b111001 + 0o66) + chr(0b1100100) + chr(6687 - 6586))('\x75' + '\x74' + '\x66' + chr(273 - 228) + chr(0b1001 + 0o57)))([mdaLt3Lic5wF]):
oVre8I6UXc3b.oMUQ7i3JvSHm = [oVre8I6UXc3b._moving_averager.average(pQxH2D_k9sXQ) for pQxH2D_k9sXQ in oVre8I6UXc3b.L0_fQbQC6unS]
oVre8I6UXc3b.L0_fQbQC6unS = IDJ2eXGCBCDu.add_n(oVre8I6UXc3b.L0_fQbQC6unS)
oVre8I6UXc3b.oMUQ7i3JvSHm = IDJ2eXGCBCDu.add_n(oVre8I6UXc3b.oMUQ7i3JvSHm)
xafqLlk3kkUe(sLagDyaDFGJY, xafqLlk3kkUe(SXOLrMavuUCe(b'05\x06\xc0\xfc0'), chr(0b1100100) + chr(101) + chr(0b101011 + 0o70) + '\157' + chr(0b1100100) + chr(1005 - 904))(chr(117) + '\164' + chr(0b1010101 + 0o21) + chr(1140 - 1095) + chr(3061 - 3005)))(mdaLt3Lic5wF)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f|#\xcb\xff\r)\x8a\xbf\x84\x0c\x14'), '\144' + chr(0b1100101) + chr(99) + chr(2783 - 2672) + chr(1381 - 1281) + chr(9756 - 9655))('\165' + chr(13392 - 13276) + '\x66' + chr(45) + '\070'))(*sLagDyaDFGJY)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._get_cubic_root
|
def _get_cubic_root(self):
"""Get the cubic root."""
# We have the equation x^2 D^2 + (1-x)^4 * C / h_min^2
# where x = sqrt(mu).
# We substitute x, which is sqrt(mu), with x = y + 1.
# It gives y^3 + py = q
# where p = (D^2 h_min^2)/(2*C) and q = -p.
# We use the Vieta's substitution to compute the root.
# There is only one real solution y (which is in [0, 1] ).
# http://mathworld.wolfram.com/VietasSubstitution.html
assert_array = [
tf.Assert(
tf.logical_not(tf.is_nan(self._dist_to_opt_avg)),
[self._dist_to_opt_avg,]),
tf.Assert(
tf.logical_not(tf.is_nan(self._h_min)),
[self._h_min,]),
tf.Assert(
tf.logical_not(tf.is_nan(self._grad_var)),
[self._grad_var,]),
tf.Assert(
tf.logical_not(tf.is_inf(self._dist_to_opt_avg)),
[self._dist_to_opt_avg,]),
tf.Assert(
tf.logical_not(tf.is_inf(self._h_min)),
[self._h_min,]),
tf.Assert(
tf.logical_not(tf.is_inf(self._grad_var)),
[self._grad_var,])
]
with tf.control_dependencies(assert_array):
p = self._dist_to_opt_avg**2 * self._h_min**2 / 2 / self._grad_var
w3 = (-tf.sqrt(p**2 + 4.0 / 27.0 * p**3) - p) / 2.0
w = tf.sign(w3) * tf.pow(tf.abs(w3), 1.0/3.0)
y = w - p / 3.0 / w
x = y + 1
return x
|
python
|
def _get_cubic_root(self):
"""Get the cubic root."""
# We have the equation x^2 D^2 + (1-x)^4 * C / h_min^2
# where x = sqrt(mu).
# We substitute x, which is sqrt(mu), with x = y + 1.
# It gives y^3 + py = q
# where p = (D^2 h_min^2)/(2*C) and q = -p.
# We use the Vieta's substitution to compute the root.
# There is only one real solution y (which is in [0, 1] ).
# http://mathworld.wolfram.com/VietasSubstitution.html
assert_array = [
tf.Assert(
tf.logical_not(tf.is_nan(self._dist_to_opt_avg)),
[self._dist_to_opt_avg,]),
tf.Assert(
tf.logical_not(tf.is_nan(self._h_min)),
[self._h_min,]),
tf.Assert(
tf.logical_not(tf.is_nan(self._grad_var)),
[self._grad_var,]),
tf.Assert(
tf.logical_not(tf.is_inf(self._dist_to_opt_avg)),
[self._dist_to_opt_avg,]),
tf.Assert(
tf.logical_not(tf.is_inf(self._h_min)),
[self._h_min,]),
tf.Assert(
tf.logical_not(tf.is_inf(self._grad_var)),
[self._grad_var,])
]
with tf.control_dependencies(assert_array):
p = self._dist_to_opt_avg**2 * self._h_min**2 / 2 / self._grad_var
w3 = (-tf.sqrt(p**2 + 4.0 / 27.0 * p**3) - p) / 2.0
w = tf.sign(w3) * tf.pow(tf.abs(w3), 1.0/3.0)
y = w - p / 3.0 / w
x = y + 1
return x
|
[
"def",
"_get_cubic_root",
"(",
"self",
")",
":",
"# We have the equation x^2 D^2 + (1-x)^4 * C / h_min^2",
"# where x = sqrt(mu).",
"# We substitute x, which is sqrt(mu), with x = y + 1.",
"# It gives y^3 + py = q",
"# where p = (D^2 h_min^2)/(2*C) and q = -p.",
"# We use the Vieta's substitution to compute the root.",
"# There is only one real solution y (which is in [0, 1] ).",
"# http://mathworld.wolfram.com/VietasSubstitution.html",
"assert_array",
"=",
"[",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"is_nan",
"(",
"self",
".",
"_dist_to_opt_avg",
")",
")",
",",
"[",
"self",
".",
"_dist_to_opt_avg",
",",
"]",
")",
",",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"is_nan",
"(",
"self",
".",
"_h_min",
")",
")",
",",
"[",
"self",
".",
"_h_min",
",",
"]",
")",
",",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"is_nan",
"(",
"self",
".",
"_grad_var",
")",
")",
",",
"[",
"self",
".",
"_grad_var",
",",
"]",
")",
",",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"is_inf",
"(",
"self",
".",
"_dist_to_opt_avg",
")",
")",
",",
"[",
"self",
".",
"_dist_to_opt_avg",
",",
"]",
")",
",",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"is_inf",
"(",
"self",
".",
"_h_min",
")",
")",
",",
"[",
"self",
".",
"_h_min",
",",
"]",
")",
",",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"is_inf",
"(",
"self",
".",
"_grad_var",
")",
")",
",",
"[",
"self",
".",
"_grad_var",
",",
"]",
")",
"]",
"with",
"tf",
".",
"control_dependencies",
"(",
"assert_array",
")",
":",
"p",
"=",
"self",
".",
"_dist_to_opt_avg",
"**",
"2",
"*",
"self",
".",
"_h_min",
"**",
"2",
"/",
"2",
"/",
"self",
".",
"_grad_var",
"w3",
"=",
"(",
"-",
"tf",
".",
"sqrt",
"(",
"p",
"**",
"2",
"+",
"4.0",
"/",
"27.0",
"*",
"p",
"**",
"3",
")",
"-",
"p",
")",
"/",
"2.0",
"w",
"=",
"tf",
".",
"sign",
"(",
"w3",
")",
"*",
"tf",
".",
"pow",
"(",
"tf",
".",
"abs",
"(",
"w3",
")",
",",
"1.0",
"/",
"3.0",
")",
"y",
"=",
"w",
"-",
"p",
"/",
"3.0",
"/",
"w",
"x",
"=",
"y",
"+",
"1",
"return",
"x"
] |
Get the cubic root.
|
[
"Get",
"the",
"cubic",
"root",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L351-L387
|
train
|
Get the cubic root.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYv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0Vq,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(836 - 786) + '\065' + chr(0b101101 + 0o10), 57226 - 57218), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b110000 + 0o0) + '\062', 57731 - 57723), ehT0Px3KOsy9('\x30' + chr(8307 - 8196) + '\061' + chr(0b11001 + 0o30) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\066' + chr(1458 - 1409), 9902 - 9894), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\066' + chr(928 - 877), 0b1000), ehT0Px3KOsy9('\060' + chr(10665 - 10554) + chr(0b110111) + chr(0b1100 + 0o50), 26998 - 26990), ehT0Px3KOsy9(chr(0b110000) + chr(0b11100 + 0o123) + '\x31' + chr(1283 - 1231) + chr(2334 - 2280), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000011 + 0o54) + chr(1659 - 1608) + '\064' + '\x30', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\061' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(674 - 626) + '\x6f' + '\062' + chr(1415 - 1360) + '\065', 11997 - 11989), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11101 + 0o24) + chr(49) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x37' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(512 - 461) + chr(55) + chr(0b100100 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10352 - 10241) + chr(0b110011) + '\061' + chr(1620 - 1569), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101111 + 0o3) + chr(0b110110) + chr(768 - 716), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\x30' + '\066', 0o10), ehT0Px3KOsy9(chr(1197 - 1149) + chr(2599 - 2488) + chr(0b10011 + 0o36) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(193 - 145) + '\x6f' + chr(0b101001 + 0o11) + chr(48) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\067' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(11107 - 10996) + chr(50) + chr(2046 - 1998) + chr(80 - 25), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100010 + 0o115) + '\x33' + chr(49) + chr(1327 - 1273), 52678 - 52670), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1 + 0o60) + chr(54) + chr(49), 18748 - 18740), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101001 + 0o12) + chr(0b101111 + 0o3) + chr(1380 - 1329), 0b1000), ehT0Px3KOsy9(chr(446 - 398) + '\157' + '\061' + chr(48) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2962 - 2851) + '\061' + '\060' + chr(0b1101 + 0o47), 39793 - 39785), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1001110 + 0o41) + '\061' + chr(2537 - 2482) + chr(299 - 250), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7234 - 7123) + '\x31' + '\062', 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + '\061' + '\x35' + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(2291 - 2180) + chr(49) + chr(0b11000 + 0o31), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(54) + '\x37', 0o10), ehT0Px3KOsy9(chr(1490 - 1442) + chr(0b1101111) + '\061' + chr(708 - 659) + chr(1189 - 1141), 59432 - 59424), ehT0Px3KOsy9(chr(471 - 423) + chr(0b1010 + 0o145) + chr(1423 - 1372) + '\x35' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(0b101111 + 0o3) + chr(602 - 553) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(1852 - 1804) + chr(0b1101111) + '\x33' + '\x33' + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110000) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(1542 - 1494) + chr(111) + '\066' + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(8014 - 7903) + '\x33' + '\x32' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x36' + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b110101) + chr(0b1011 + 0o53), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x83'), '\144' + chr(0b1010100 + 0o21) + '\x63' + '\157' + chr(100) + chr(7368 - 7267))(chr(0b1110101) + '\x74' + chr(0b1111 + 0o127) + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def TbXk1lxehOA5(oVre8I6UXc3b):
bu7cmKIrNLEG = [IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.is_nan(oVre8I6UXc3b.nVSpS0hzhTva)), [oVre8I6UXc3b.nVSpS0hzhTva]), IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.is_nan(oVre8I6UXc3b.xTlOSLMi4gPB)), [oVre8I6UXc3b.xTlOSLMi4gPB]), IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.is_nan(oVre8I6UXc3b.IvX3ku2a2AA8)), [oVre8I6UXc3b.IvX3ku2a2AA8]), IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.is_inf(oVre8I6UXc3b.nVSpS0hzhTva)), [oVre8I6UXc3b.nVSpS0hzhTva]), IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.is_inf(oVre8I6UXc3b.xTlOSLMi4gPB)), [oVre8I6UXc3b.xTlOSLMi4gPB]), IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.is_inf(oVre8I6UXc3b.IvX3ku2a2AA8)), [oVre8I6UXc3b.IvX3ku2a2AA8])]
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\xad"E\xc1S\n\xbf-\xd8?_\x97\xaf\xd1\xa8n\xe8\x18\xf4'), chr(819 - 719) + chr(101) + chr(0b10 + 0o141) + chr(0b1101111) + chr(0b1010111 + 0o15) + chr(0b1100001 + 0o4))(chr(117) + chr(0b1110100) + '\x66' + chr(45) + '\070'))(bu7cmKIrNLEG):
UyakMW2IMFEj = oVre8I6UXc3b.nVSpS0hzhTva ** ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(50), ord("\x08")) * oVre8I6UXc3b.xTlOSLMi4gPB ** ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101010 + 0o10), 8) / ehT0Px3KOsy9(chr(48) + '\157' + '\062', 8) / oVre8I6UXc3b.IvX3ku2a2AA8
gC_f4TBR1VcY = (-IDJ2eXGCBCDu.sqrt(UyakMW2IMFEj ** ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101000 + 0o12), 8) + 4.0 / 27.0 * UyakMW2IMFEj ** ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(51), 0o10)) - UyakMW2IMFEj) / 2.0
AOfzRywRzEXp = IDJ2eXGCBCDu.sign(gC_f4TBR1VcY) * IDJ2eXGCBCDu.pow(IDJ2eXGCBCDu.abs(gC_f4TBR1VcY), 1.0 / 3.0)
SqiSOtYOqOJH = AOfzRywRzEXp - UyakMW2IMFEj / 3.0 / AOfzRywRzEXp
OeWW0F1dBPRQ = SqiSOtYOqOJH + ehT0Px3KOsy9('\060' + '\157' + '\x31', 5191 - 5183)
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._get_lr_tensor
|
def _get_lr_tensor(self):
"""Get lr minimizing the surrogate.
Returns:
The lr_t.
"""
lr = tf.squared_difference(1.0, tf.sqrt(self._mu)) / self._h_min
return lr
|
python
|
def _get_lr_tensor(self):
"""Get lr minimizing the surrogate.
Returns:
The lr_t.
"""
lr = tf.squared_difference(1.0, tf.sqrt(self._mu)) / self._h_min
return lr
|
[
"def",
"_get_lr_tensor",
"(",
"self",
")",
":",
"lr",
"=",
"tf",
".",
"squared_difference",
"(",
"1.0",
",",
"tf",
".",
"sqrt",
"(",
"self",
".",
"_mu",
")",
")",
"/",
"self",
".",
"_h_min",
"return",
"lr"
] |
Get lr minimizing the surrogate.
Returns:
The lr_t.
|
[
"Get",
"lr",
"minimizing",
"the",
"surrogate",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L389-L396
|
train
|
Get lr minimizing the surrogate.
|
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,I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VCGgtAN,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(0b110011) + '\x32' + chr(0b11011 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(49) + '\060' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(142 - 94) + '\157' + '\x33' + chr(50) + '\x37', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(52), 31888 - 31880), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + '\061' + '\062' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110 + 0o55) + '\062' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11980 - 11869) + '\x32' + chr(51) + chr(0b10111 + 0o32), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b110111 + 0o70) + '\x33' + '\063' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11378 - 11267) + chr(1443 - 1394) + chr(49) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1011011 + 0o24) + '\x31' + chr(50) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + '\x33' + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + '\063' + '\x30' + chr(0b1111 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\063' + chr(0b11000 + 0o35), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b11101 + 0o26) + '\065', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2324 - 2273) + chr(49) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(8179 - 8068) + '\061' + chr(50) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(2061 - 1950) + chr(804 - 755) + chr(0b1011 + 0o45) + '\067', 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(7141 - 7030) + '\063' + chr(0b110101) + '\060', 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(1394 - 1345) + chr(53) + chr(0b110100), 45608 - 45600), ehT0Px3KOsy9('\x30' + chr(5626 - 5515) + chr(2081 - 2031) + chr(2291 - 2237) + chr(647 - 592), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(54) + '\062', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(148 - 98) + chr(0b10001 + 0o41) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10945 - 10834) + chr(0b100111 + 0o12) + chr(54) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\065' + chr(0b1010 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2302 - 2252) + chr(0b101000 + 0o13) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\066' + chr(53), 8), ehT0Px3KOsy9(chr(2051 - 2003) + chr(10603 - 10492) + chr(49) + chr(0b110001) + chr(1421 - 1367), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\067' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(6849 - 6738) + chr(0b101 + 0o55) + chr(0b110100) + chr(2208 - 2157), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\065' + chr(53), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1101 + 0o44) + '\065' + chr(1558 - 1509), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2082 - 1971) + chr(0b101001 + 0o10) + '\066' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + '\063' + chr(0b110001) + chr(1083 - 1034), 13194 - 13186), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10110 + 0o33) + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(269 - 221) + '\157' + '\062' + '\066' + chr(1830 - 1776), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b110010) + chr(0b101101 + 0o7), 8), ehT0Px3KOsy9('\x30' + chr(9183 - 9072) + '\x31' + chr(49) + '\062', 0o10), ehT0Px3KOsy9(chr(756 - 708) + chr(2474 - 2363) + '\062' + chr(2078 - 2026) + '\063', 8), ehT0Px3KOsy9(chr(0b110000) + chr(2187 - 2076) + chr(51) + '\x31' + chr(0b100011 + 0o23), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(631 - 520) + '\x35' + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9'), '\144' + '\x65' + '\143' + chr(0b1101111) + chr(100) + chr(101))(chr(117) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def HqHKm_hlPuB1(oVre8I6UXc3b):
Zzs55KO_HKfp = IDJ2eXGCBCDu.squared_difference(1.0, IDJ2eXGCBCDu.sqrt(oVre8I6UXc3b._mu)) / oVre8I6UXc3b.xTlOSLMi4gPB
return Zzs55KO_HKfp
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._get_mu_tensor
|
def _get_mu_tensor(self):
"""Get the min mu which minimize the surrogate.
Returns:
The mu_t.
"""
root = self._get_cubic_root()
dr = self._h_max / self._h_min
mu = tf.maximum(
root**2, ((tf.sqrt(dr) - 1) / (tf.sqrt(dr) + 1))**2)
return mu
|
python
|
def _get_mu_tensor(self):
"""Get the min mu which minimize the surrogate.
Returns:
The mu_t.
"""
root = self._get_cubic_root()
dr = self._h_max / self._h_min
mu = tf.maximum(
root**2, ((tf.sqrt(dr) - 1) / (tf.sqrt(dr) + 1))**2)
return mu
|
[
"def",
"_get_mu_tensor",
"(",
"self",
")",
":",
"root",
"=",
"self",
".",
"_get_cubic_root",
"(",
")",
"dr",
"=",
"self",
".",
"_h_max",
"/",
"self",
".",
"_h_min",
"mu",
"=",
"tf",
".",
"maximum",
"(",
"root",
"**",
"2",
",",
"(",
"(",
"tf",
".",
"sqrt",
"(",
"dr",
")",
"-",
"1",
")",
"/",
"(",
"tf",
".",
"sqrt",
"(",
"dr",
")",
"+",
"1",
")",
")",
"**",
"2",
")",
"return",
"mu"
] |
Get the min mu which minimize the surrogate.
Returns:
The mu_t.
|
[
"Get",
"the",
"min",
"mu",
"which",
"minimize",
"the",
"surrogate",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L398-L408
|
train
|
Get the min mu which minimize the surrogate.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQE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SmY,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(49) + '\x31' + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(135 - 84) + chr(0b110010) + chr(880 - 832), 0b1000), ehT0Px3KOsy9(chr(313 - 265) + chr(111) + chr(0b100100 + 0o17) + '\x37' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x31' + chr(569 - 517), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + chr(0b101001 + 0o11) + chr(49) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110011 + 0o74) + chr(0b110010) + '\x34' + chr(55), 41311 - 41303), ehT0Px3KOsy9(chr(1298 - 1250) + chr(2616 - 2505) + chr(0b100000 + 0o21) + '\x30' + '\x36', 49659 - 49651), ehT0Px3KOsy9(chr(1266 - 1218) + '\157' + chr(51) + '\x37' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110110) + '\064', 3043 - 3035), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + '\x32' + chr(0b11110 + 0o25) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(54) + chr(792 - 744), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(3464 - 3353) + chr(0b1100 + 0o45) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(547 - 498) + chr(0b10101 + 0o40), 47715 - 47707), ehT0Px3KOsy9('\x30' + chr(3392 - 3281) + chr(2384 - 2335) + chr(672 - 618) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(1470 - 1420) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100110 + 0o111) + '\061' + chr(0b110000) + '\066', 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(743 - 632) + chr(0b110010) + chr(219 - 166) + chr(1318 - 1268), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101110 + 0o101) + chr(0b100001 + 0o24) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100111 + 0o12) + chr(0b110000) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(0b110001) + chr(1205 - 1157) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(6114 - 6003) + chr(0b11010 + 0o30) + chr(975 - 921) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(5785 - 5674) + '\x31' + chr(53) + chr(1759 - 1709), 0o10), ehT0Px3KOsy9('\060' + chr(0b1000011 + 0o54) + chr(0b110001) + '\067' + chr(2450 - 2396), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + chr(51) + chr(0b111 + 0o57) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(377 - 329) + chr(11628 - 11517) + chr(0b10011 + 0o36) + chr(0b110101) + '\x32', 8), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + chr(1810 - 1759) + chr(51) + chr(2182 - 2133), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b11000 + 0o31) + '\063', 37961 - 37953), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(0b11010 + 0o30) + chr(0b110111) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(0b11000 + 0o32) + chr(0b1101 + 0o50) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101 + 0o54) + chr(0b110010), 4314 - 4306), ehT0Px3KOsy9(chr(592 - 544) + chr(324 - 213) + chr(0b110001) + '\x30' + '\062', 39986 - 39978), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(0b100010 + 0o17) + chr(0b10010 + 0o40) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4672 - 4561) + chr(50) + '\x35' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4280 - 4169) + chr(0b1 + 0o61) + chr(49) + chr(0b110110), 65059 - 65051), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\062' + chr(0b110001), 49203 - 49195), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(291 - 180) + chr(49) + '\x32' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + '\x31' + chr(0b110010) + chr(49), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + '\064' + chr(0b11100 + 0o25), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b1001 + 0o50) + '\063', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(1031 - 978) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'`'), '\144' + '\x65' + chr(0b110110 + 0o55) + chr(0b1001110 + 0o41) + chr(100) + chr(0b101 + 0o140))(chr(9023 - 8906) + chr(9462 - 9346) + chr(4783 - 4681) + chr(1200 - 1155) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def leypjShln7Cl(oVre8I6UXc3b):
FiL2Xt3u2AMN = oVre8I6UXc3b._get_cubic_root()
eIuN7D7SftLf = oVre8I6UXc3b.h0Goq0PWBSS4 / oVre8I6UXc3b.xTlOSLMi4gPB
hOLPUi_G8xuS = IDJ2eXGCBCDu.maximum(FiL2Xt3u2AMN ** ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\x32', 0b1000), ((IDJ2eXGCBCDu.sqrt(eIuN7D7SftLf) - ehT0Px3KOsy9(chr(48) + chr(1424 - 1313) + chr(0b10101 + 0o34), 0o10)) / (IDJ2eXGCBCDu.sqrt(eIuN7D7SftLf) + ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31', 8))) ** ehT0Px3KOsy9('\060' + '\157' + chr(50), 8))
return hOLPUi_G8xuS
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer._yellowfin
|
def _yellowfin(self):
"""YellowFin auto-tuning optimizer based on momentum SGD.
Returns:
YF ops
(Curvature range,
Grad_variance,
Dist_to_opt,
Single-Step,
Auto-Tuning)
"""
# List for the returned Operations.
yellowfin_ops = []
# Curvature range ops.
curv_range_ops = self._curvature_range()
yellowfin_ops += curv_range_ops
# Estimate of gradient Variance ops.
grad_var_ops = self._grad_variance()
yellowfin_ops += grad_var_ops
# Distance to optimum ops.
dist_to_opt_ops = self._dist_to_opt()
yellowfin_ops += dist_to_opt_ops
# Single-Step: minimizes the surrogate for the expected
# squared distance from the optimum of a local quadratic
# approximation after a single step while keeping all directions in the
# robust region.
self._mu = tf.identity(tf.cond(self._do_tune,
self._get_mu_tensor,
lambda: self._mu_var))
with tf.control_dependencies([self._mu]):
self._lr = tf.identity(tf.cond(self._do_tune,
self._get_lr_tensor,
lambda: self._lr_var))
# Tune learning rate and momentum.
with tf.control_dependencies([self._mu, self._lr]):
self._mu = self._beta * self._mu_var + (1 - self._beta) * self._mu
self._lr = self._beta * self._lr_var + (1 - self._beta) * self._lr
yellowfin_ops.append(tf.assign(self._mu_var, self._mu))
yellowfin_ops.append(tf.assign(self._lr_var, self._lr))
yellowfin_ops = tf.group(*yellowfin_ops)
return yellowfin_ops
|
python
|
def _yellowfin(self):
"""YellowFin auto-tuning optimizer based on momentum SGD.
Returns:
YF ops
(Curvature range,
Grad_variance,
Dist_to_opt,
Single-Step,
Auto-Tuning)
"""
# List for the returned Operations.
yellowfin_ops = []
# Curvature range ops.
curv_range_ops = self._curvature_range()
yellowfin_ops += curv_range_ops
# Estimate of gradient Variance ops.
grad_var_ops = self._grad_variance()
yellowfin_ops += grad_var_ops
# Distance to optimum ops.
dist_to_opt_ops = self._dist_to_opt()
yellowfin_ops += dist_to_opt_ops
# Single-Step: minimizes the surrogate for the expected
# squared distance from the optimum of a local quadratic
# approximation after a single step while keeping all directions in the
# robust region.
self._mu = tf.identity(tf.cond(self._do_tune,
self._get_mu_tensor,
lambda: self._mu_var))
with tf.control_dependencies([self._mu]):
self._lr = tf.identity(tf.cond(self._do_tune,
self._get_lr_tensor,
lambda: self._lr_var))
# Tune learning rate and momentum.
with tf.control_dependencies([self._mu, self._lr]):
self._mu = self._beta * self._mu_var + (1 - self._beta) * self._mu
self._lr = self._beta * self._lr_var + (1 - self._beta) * self._lr
yellowfin_ops.append(tf.assign(self._mu_var, self._mu))
yellowfin_ops.append(tf.assign(self._lr_var, self._lr))
yellowfin_ops = tf.group(*yellowfin_ops)
return yellowfin_ops
|
[
"def",
"_yellowfin",
"(",
"self",
")",
":",
"# List for the returned Operations.",
"yellowfin_ops",
"=",
"[",
"]",
"# Curvature range ops.",
"curv_range_ops",
"=",
"self",
".",
"_curvature_range",
"(",
")",
"yellowfin_ops",
"+=",
"curv_range_ops",
"# Estimate of gradient Variance ops.",
"grad_var_ops",
"=",
"self",
".",
"_grad_variance",
"(",
")",
"yellowfin_ops",
"+=",
"grad_var_ops",
"# Distance to optimum ops.",
"dist_to_opt_ops",
"=",
"self",
".",
"_dist_to_opt",
"(",
")",
"yellowfin_ops",
"+=",
"dist_to_opt_ops",
"# Single-Step: minimizes the surrogate for the expected",
"# squared distance from the optimum of a local quadratic",
"# approximation after a single step while keeping all directions in the",
"# robust region.",
"self",
".",
"_mu",
"=",
"tf",
".",
"identity",
"(",
"tf",
".",
"cond",
"(",
"self",
".",
"_do_tune",
",",
"self",
".",
"_get_mu_tensor",
",",
"lambda",
":",
"self",
".",
"_mu_var",
")",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"self",
".",
"_mu",
"]",
")",
":",
"self",
".",
"_lr",
"=",
"tf",
".",
"identity",
"(",
"tf",
".",
"cond",
"(",
"self",
".",
"_do_tune",
",",
"self",
".",
"_get_lr_tensor",
",",
"lambda",
":",
"self",
".",
"_lr_var",
")",
")",
"# Tune learning rate and momentum.",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"self",
".",
"_mu",
",",
"self",
".",
"_lr",
"]",
")",
":",
"self",
".",
"_mu",
"=",
"self",
".",
"_beta",
"*",
"self",
".",
"_mu_var",
"+",
"(",
"1",
"-",
"self",
".",
"_beta",
")",
"*",
"self",
".",
"_mu",
"self",
".",
"_lr",
"=",
"self",
".",
"_beta",
"*",
"self",
".",
"_lr_var",
"+",
"(",
"1",
"-",
"self",
".",
"_beta",
")",
"*",
"self",
".",
"_lr",
"yellowfin_ops",
".",
"append",
"(",
"tf",
".",
"assign",
"(",
"self",
".",
"_mu_var",
",",
"self",
".",
"_mu",
")",
")",
"yellowfin_ops",
".",
"append",
"(",
"tf",
".",
"assign",
"(",
"self",
".",
"_lr_var",
",",
"self",
".",
"_lr",
")",
")",
"yellowfin_ops",
"=",
"tf",
".",
"group",
"(",
"*",
"yellowfin_ops",
")",
"return",
"yellowfin_ops"
] |
YellowFin auto-tuning optimizer based on momentum SGD.
Returns:
YF ops
(Curvature range,
Grad_variance,
Dist_to_opt,
Single-Step,
Auto-Tuning)
|
[
"YellowFin",
"auto",
"-",
"tuning",
"optimizer",
"based",
"on",
"momentum",
"SGD",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L410-L454
|
train
|
YellowFin auto - tuning optimizer based on momentum SGD.
|
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,h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4ccExqw4,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' + chr(51) + '\x35' + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x36' + chr(0b1110 + 0o42), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101011 + 0o104) + chr(1413 - 1363) + chr(699 - 649) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(610 - 560) + chr(1048 - 994) + chr(0b11111 + 0o21), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + chr(0b110011) + '\x34' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2437 - 2386) + chr(51) + chr(0b101110 + 0o2), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(3040 - 2929) + chr(0b110001) + '\062' + chr(1952 - 1901), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(975 - 927) + chr(0b110010), 62941 - 62933), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(2259 - 2207) + chr(0b110001), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(1653 - 1603) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11 + 0o57) + chr(0b10011 + 0o44) + chr(0b100010 + 0o24), 0o10), ehT0Px3KOsy9(chr(304 - 256) + '\x6f' + '\x32' + chr(0b1111 + 0o44) + chr(0b101111 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100100 + 0o15) + '\x37' + chr(256 - 201), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + '\062' + '\x35' + chr(0b101110 + 0o5), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(49) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101100 + 0o7) + chr(1210 - 1159) + chr(246 - 195), 56916 - 56908), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100100 + 0o13) + '\x31' + chr(0b110100) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110100) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(50) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(0b1110 + 0o46), 8), ehT0Px3KOsy9('\x30' + chr(0b100101 + 0o112) + chr(49) + chr(50) + chr(2112 - 2064), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + chr(409 - 359) + chr(1914 - 1862) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1305 - 1257) + '\x6f' + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b101010 + 0o10), 53504 - 53496), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + chr(49) + chr(0b110111) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(2231 - 2183) + chr(0b1101111) + chr(311 - 261) + chr(0b110100) + chr(2001 - 1953), 8), ehT0Px3KOsy9(chr(1070 - 1022) + chr(0b11101 + 0o122) + '\x31' + chr(558 - 510) + '\x33', 0o10), ehT0Px3KOsy9(chr(1843 - 1795) + chr(0b101100 + 0o103) + '\x32' + '\063' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1000001 + 0o56) + chr(50) + chr(51) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110101) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4210 - 4099) + chr(0b10110 + 0o34) + '\x35' + chr(2080 - 2029), 8), ehT0Px3KOsy9('\060' + '\157' + chr(73 - 18) + chr(0b11000 + 0o33), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3523 - 3412) + chr(922 - 871) + '\x32' + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b110101) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101101 + 0o2) + chr(49) + chr(1038 - 984) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2724 - 2613) + chr(0b110001) + '\x37', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1917 - 1864) + chr(2215 - 2167), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7'), '\x64' + chr(101) + chr(99) + chr(11899 - 11788) + '\x64' + '\145')('\165' + chr(116) + chr(0b1100110) + chr(2019 - 1974) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def juIRhIw1BQbo(oVre8I6UXc3b):
zMs4swEywQGV = []
eRByNTtcjEtj = oVre8I6UXc3b._curvature_range()
zMs4swEywQGV += eRByNTtcjEtj
LeO6DmwdnX6g = oVre8I6UXc3b._grad_variance()
zMs4swEywQGV += LeO6DmwdnX6g
g0eo0bbQhycQ = oVre8I6UXc3b._dist_to_opt()
zMs4swEywQGV += g0eo0bbQhycQ
oVre8I6UXc3b.VIhjrC1j_rQY = IDJ2eXGCBCDu.identity(IDJ2eXGCBCDu.cond(oVre8I6UXc3b._do_tune, oVre8I6UXc3b._get_mu_tensor, lambda : oVre8I6UXc3b._mu_var))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a_\xff\xc4\x93n\xb4\x0c\xe6\x84c\xdb\xf2\x1bef\xc8\xe5\xbe\x10'), '\x64' + '\x65' + chr(4920 - 4821) + chr(2312 - 2201) + '\x64' + '\x65')(chr(562 - 445) + '\164' + '\x66' + chr(0b101101) + chr(0b111000)))([xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbfy\xf9\xda\x93B\xe99\xdd\x93B\xe7'), chr(2375 - 2275) + chr(7879 - 7778) + chr(0b1100011) + '\157' + chr(0b1111 + 0o125) + '\145')(chr(7860 - 7743) + '\164' + '\x66' + '\055' + '\070'))]):
oVre8I6UXc3b.YNfvw_xEds_y = IDJ2eXGCBCDu.identity(IDJ2eXGCBCDu.cond(oVre8I6UXc3b._do_tune, oVre8I6UXc3b._get_lr_tensor, lambda : oVre8I6UXc3b._lr_var))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a_\xff\xc4\x93n\xb4\x0c\xe6\x84c\xdb\xf2\x1bef\xc8\xe5\xbe\x10'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(5097 - 4996))('\x75' + chr(0b1110100) + chr(102) + chr(384 - 339) + chr(0b111000)))([xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbfy\xf9\xda\x93B\xe99\xdd\x93B\xe7'), '\x64' + chr(0b1100101) + '\143' + chr(111) + chr(0b1100100) + chr(0b111 + 0o136))(chr(117) + '\x74' + '\x66' + chr(45) + '\x38')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0~\xf7\xc6\x96^\xa0\x16\xe6\x92L\xc7'), '\144' + chr(101) + chr(5621 - 5522) + chr(1344 - 1233) + '\144' + chr(0b100101 + 0o100))(chr(0b0 + 0o165) + chr(116) + '\146' + '\055' + '\070'))]):
oVre8I6UXc3b.VIhjrC1j_rQY = oVre8I6UXc3b.SUK1x3ZRbDDY * oVre8I6UXc3b._mu_var + (ehT0Px3KOsy9(chr(2012 - 1964) + chr(1081 - 970) + chr(1556 - 1507), 8) - oVre8I6UXc3b.SUK1x3ZRbDDY) * oVre8I6UXc3b.VIhjrC1j_rQY
oVre8I6UXc3b.YNfvw_xEds_y = oVre8I6UXc3b.SUK1x3ZRbDDY * oVre8I6UXc3b._lr_var + (ehT0Px3KOsy9(chr(48) + '\157' + '\061', 8) - oVre8I6UXc3b.SUK1x3ZRbDDY) * oVre8I6UXc3b.YNfvw_xEds_y
xafqLlk3kkUe(zMs4swEywQGV, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88@\xe1\xd5\x8fe'), '\x64' + chr(101) + chr(0b1100011) + chr(0b1101 + 0o142) + '\x64' + '\145')('\x75' + chr(0b1010100 + 0o40) + '\146' + chr(0b1 + 0o54) + chr(334 - 278)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88C\xe2\xd9\x86o'), '\x64' + '\145' + chr(0b1101 + 0o126) + '\x6f' + chr(0b1011101 + 0o7) + '\x65')(chr(703 - 586) + chr(116) + '\146' + '\055' + '\x38'))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6]\xe4\xef\x97`\xaa'), chr(0b1011011 + 0o11) + chr(6057 - 5956) + '\x63' + '\157' + chr(0b10000 + 0o124) + '\145')(chr(117) + '\164' + chr(0b1011101 + 0o11) + chr(250 - 205) + '\x38')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbfy\xf9\xda\x93B\xe99\xdd\x93B\xe7'), chr(0b1100100) + chr(101) + chr(99) + chr(111) + '\x64' + '\x65')('\x75' + chr(0b1110100) + '\146' + chr(45) + '\x38'))))
xafqLlk3kkUe(zMs4swEywQGV, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88@\xe1\xd5\x8fe'), chr(6052 - 5952) + '\x65' + chr(99) + chr(4622 - 4511) + chr(0b1100100) + '\x65')(chr(0b1111 + 0o146) + '\164' + chr(0b1100110) + chr(0b11000 + 0o25) + '\x38'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x88C\xe2\xd9\x86o'), chr(100) + chr(8919 - 8818) + '\x63' + '\x6f' + chr(8954 - 8854) + chr(0b101010 + 0o73))('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6\\\xe3\xef\x97`\xaa'), chr(0b1001 + 0o133) + '\x65' + chr(99) + '\157' + chr(5998 - 5898) + '\145')('\x75' + chr(0b1011100 + 0o30) + '\x66' + chr(0b101101) + chr(2381 - 2325))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0~\xf7\xc6\x96^\xa0\x16\xe6\x92L\xc7'), chr(0b1100100) + chr(0b100101 + 0o100) + chr(0b1100011) + chr(1323 - 1212) + chr(100) + '\145')(chr(0b1110101) + chr(6331 - 6215) + chr(102) + chr(1451 - 1406) + '\x38'))))
zMs4swEywQGV = IDJ2eXGCBCDu.N9UnmYvaW1pO(*zMs4swEywQGV)
return zMs4swEywQGV
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer.apply_gradients
|
def apply_gradients(self, grads_and_vars, global_step=None, name=None):
"""Applying gradients and tune hyperparams with YellowFin.
Args:
grads_and_vars: List of (gradient, variable) pairs as returned by
compute_gradients().
global_step: Optional Variable to increment by one after the
variables have been updated.
name: Optional name for the returned operation. Default to the
name passed to the Optimizer constructor.
Returns:
(A group of operations)
Variable Update with Momentum ops,
YellowFin ops(Curvature, Variance, Distance) ops,
SingleStep and lr_mu tuning ops,
Step increment ops.
"""
self._grad, self._vars = zip(*[(g, t)
for g, t in grads_and_vars if g is not None])
# Var update with Momentum.
with tf.variable_scope("apply_updates"):
# Gradient Clipping?
if self._clip_thresh_var is not None:
self._grad, _ = tf.clip_by_global_norm(
self._grad, self._clip_thresh_var)
apply_grad_op = self._momentum_optimizer.apply_gradients(
zip(self._grad, self._vars),
global_step=global_step,
name=name)
else:
apply_grad_op = self._momentum_optimizer.apply_gradients(
zip(self._grad, self._vars),
global_step=global_step,
name=name)
# Begin lr and mu tuning.
with tf.variable_scope("prepare_yellowFin_variables"):
# the dependencies ideally only need to be after clip is done,
# i.e. depends on self._grads. However, the control_dependencies
# does not support indexed slice for sparse gradients.
# The alternative dependencies here might be slightly slower due
# to less parallelization.
with tf.control_dependencies([apply_grad_op,]):
prepare_variables_op = self._prepare_variables()
with tf.variable_scope("yellowfin"):
with tf.control_dependencies([prepare_variables_op]):
yellowfin_op = self._yellowfin()
# Update YellowFin step variable.
with tf.control_dependencies([yellowfin_op]):
self._increment_step_op = tf.assign_add(self._step, 1).op
return tf.group(apply_grad_op,
prepare_variables_op,
yellowfin_op,
self._increment_step_op)
|
python
|
def apply_gradients(self, grads_and_vars, global_step=None, name=None):
"""Applying gradients and tune hyperparams with YellowFin.
Args:
grads_and_vars: List of (gradient, variable) pairs as returned by
compute_gradients().
global_step: Optional Variable to increment by one after the
variables have been updated.
name: Optional name for the returned operation. Default to the
name passed to the Optimizer constructor.
Returns:
(A group of operations)
Variable Update with Momentum ops,
YellowFin ops(Curvature, Variance, Distance) ops,
SingleStep and lr_mu tuning ops,
Step increment ops.
"""
self._grad, self._vars = zip(*[(g, t)
for g, t in grads_and_vars if g is not None])
# Var update with Momentum.
with tf.variable_scope("apply_updates"):
# Gradient Clipping?
if self._clip_thresh_var is not None:
self._grad, _ = tf.clip_by_global_norm(
self._grad, self._clip_thresh_var)
apply_grad_op = self._momentum_optimizer.apply_gradients(
zip(self._grad, self._vars),
global_step=global_step,
name=name)
else:
apply_grad_op = self._momentum_optimizer.apply_gradients(
zip(self._grad, self._vars),
global_step=global_step,
name=name)
# Begin lr and mu tuning.
with tf.variable_scope("prepare_yellowFin_variables"):
# the dependencies ideally only need to be after clip is done,
# i.e. depends on self._grads. However, the control_dependencies
# does not support indexed slice for sparse gradients.
# The alternative dependencies here might be slightly slower due
# to less parallelization.
with tf.control_dependencies([apply_grad_op,]):
prepare_variables_op = self._prepare_variables()
with tf.variable_scope("yellowfin"):
with tf.control_dependencies([prepare_variables_op]):
yellowfin_op = self._yellowfin()
# Update YellowFin step variable.
with tf.control_dependencies([yellowfin_op]):
self._increment_step_op = tf.assign_add(self._step, 1).op
return tf.group(apply_grad_op,
prepare_variables_op,
yellowfin_op,
self._increment_step_op)
|
[
"def",
"apply_gradients",
"(",
"self",
",",
"grads_and_vars",
",",
"global_step",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"_grad",
",",
"self",
".",
"_vars",
"=",
"zip",
"(",
"*",
"[",
"(",
"g",
",",
"t",
")",
"for",
"g",
",",
"t",
"in",
"grads_and_vars",
"if",
"g",
"is",
"not",
"None",
"]",
")",
"# Var update with Momentum.",
"with",
"tf",
".",
"variable_scope",
"(",
"\"apply_updates\"",
")",
":",
"# Gradient Clipping?",
"if",
"self",
".",
"_clip_thresh_var",
"is",
"not",
"None",
":",
"self",
".",
"_grad",
",",
"_",
"=",
"tf",
".",
"clip_by_global_norm",
"(",
"self",
".",
"_grad",
",",
"self",
".",
"_clip_thresh_var",
")",
"apply_grad_op",
"=",
"self",
".",
"_momentum_optimizer",
".",
"apply_gradients",
"(",
"zip",
"(",
"self",
".",
"_grad",
",",
"self",
".",
"_vars",
")",
",",
"global_step",
"=",
"global_step",
",",
"name",
"=",
"name",
")",
"else",
":",
"apply_grad_op",
"=",
"self",
".",
"_momentum_optimizer",
".",
"apply_gradients",
"(",
"zip",
"(",
"self",
".",
"_grad",
",",
"self",
".",
"_vars",
")",
",",
"global_step",
"=",
"global_step",
",",
"name",
"=",
"name",
")",
"# Begin lr and mu tuning.",
"with",
"tf",
".",
"variable_scope",
"(",
"\"prepare_yellowFin_variables\"",
")",
":",
"# the dependencies ideally only need to be after clip is done,",
"# i.e. depends on self._grads. However, the control_dependencies",
"# does not support indexed slice for sparse gradients.",
"# The alternative dependencies here might be slightly slower due",
"# to less parallelization.",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"apply_grad_op",
",",
"]",
")",
":",
"prepare_variables_op",
"=",
"self",
".",
"_prepare_variables",
"(",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"\"yellowfin\"",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"prepare_variables_op",
"]",
")",
":",
"yellowfin_op",
"=",
"self",
".",
"_yellowfin",
"(",
")",
"# Update YellowFin step variable.",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"yellowfin_op",
"]",
")",
":",
"self",
".",
"_increment_step_op",
"=",
"tf",
".",
"assign_add",
"(",
"self",
".",
"_step",
",",
"1",
")",
".",
"op",
"return",
"tf",
".",
"group",
"(",
"apply_grad_op",
",",
"prepare_variables_op",
",",
"yellowfin_op",
",",
"self",
".",
"_increment_step_op",
")"
] |
Applying gradients and tune hyperparams with YellowFin.
Args:
grads_and_vars: List of (gradient, variable) pairs as returned by
compute_gradients().
global_step: Optional Variable to increment by one after the
variables have been updated.
name: Optional name for the returned operation. Default to the
name passed to the Optimizer constructor.
Returns:
(A group of operations)
Variable Update with Momentum ops,
YellowFin ops(Curvature, Variance, Distance) ops,
SingleStep and lr_mu tuning ops,
Step increment ops.
|
[
"Applying",
"gradients",
"and",
"tune",
"hyperparams",
"with",
"YellowFin",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L460-L519
|
train
|
Applies gradients and tune hyperparams with YellowFin.
|
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('\x30' + chr(111) + chr(0b110001) + chr(0b110011) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + '\x32' + '\x36' + chr(0b100011 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\060' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1001010 + 0o45) + '\061' + chr(0b101110 + 0o7) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101100 + 0o6) + '\067' + '\067', 20641 - 20633), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001101 + 0o42) + '\x32' + '\x34' + chr(0b101101 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\063' + chr(190 - 140), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10100 + 0o41) + '\067', 0b1000), ehT0Px3KOsy9(chr(936 - 888) + chr(0b1001011 + 0o44) + chr(51) + '\x33' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11111 + 0o24) + '\x35' + chr(0b101111 + 0o6), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b111000 + 0o67) + chr(570 - 520) + '\061' + chr(848 - 797), 0b1000), ehT0Px3KOsy9(chr(2004 - 1956) + '\x6f' + chr(1563 - 1513) + chr(52) + chr(215 - 162), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + '\066' + chr(0b101111 + 0o2), 40999 - 40991), ehT0Px3KOsy9(chr(1006 - 958) + chr(11878 - 11767) + chr(0b10101 + 0o35) + chr(126 - 78), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x34' + chr(0b1 + 0o57), 54397 - 54389), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\x35' + chr(1774 - 1723), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b10010 + 0o37) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b11 + 0o154) + '\061' + chr(1030 - 978) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(1386 - 1275) + chr(0b11011 + 0o34) + chr(55), 13059 - 13051), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(1938 - 1889) + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x34' + '\x30', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(180 - 131) + chr(0b0 + 0o62) + chr(54), 62150 - 62142), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(1279 - 1228) + chr(0b110101) + '\064', 1908 - 1900), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b11011 + 0o31) + chr(0b110 + 0o54), 0b1000), ehT0Px3KOsy9(chr(1689 - 1641) + chr(0b1101111) + chr(51) + chr(1999 - 1950) + chr(0b1101 + 0o43), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4688 - 4577) + '\063' + chr(0b110000) + chr(0b100010 + 0o22), 46905 - 46897), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b101011 + 0o7) + chr(0b110011 + 0o4), 57300 - 57292), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(51) + chr(0b101001 + 0o7) + chr(50), 64450 - 64442), ehT0Px3KOsy9(chr(0b110000) + chr(0b10011 + 0o134) + chr(49) + chr(51) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11130 - 11019) + '\061' + chr(0b110100 + 0o1) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(2285 - 2234) + chr(1444 - 1391), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(953 - 842) + chr(49) + chr(788 - 739) + chr(987 - 935), 0o10), ehT0Px3KOsy9(chr(421 - 373) + chr(111) + '\063' + chr(53) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(0b11000 + 0o33) + chr(50) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101000 + 0o11) + chr(50) + '\x34', 48703 - 48695), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + '\062' + chr(0b110101) + '\064', 37884 - 37876), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1767 - 1716) + chr(0b111 + 0o56) + chr(50), 43181 - 43173), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(54) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(53) + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110), 18495 - 18487)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(1411 - 1358) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'v'), '\x64' + chr(0b110 + 0o137) + '\143' + chr(0b1101111) + chr(5466 - 5366) + chr(0b1100101))(chr(117) + '\164' + '\146' + chr(0b101000 + 0o5) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def K3_9CkyL0FTk(oVre8I6UXc3b, w3RYIellNwW7, tnqEWmPx71Oj=None, AIvJRzLdDfgF=None):
(oVre8I6UXc3b.dNM_VSzUcYmD, oVre8I6UXc3b.scip4hzKGuta) = pZ0NK2y6HRbn(*[(RWHpzFEeviFP, YeT3l7JgTbWR) for (RWHpzFEeviFP, YeT3l7JgTbWR) in w3RYIellNwW7 if RWHpzFEeviFP is not None])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'.\xd4\xf0\x02\xde\xc56J\x80\x9e\xe8\xcaAu'), '\x64' + chr(0b1110 + 0o127) + chr(0b101001 + 0o72) + chr(0b1101011 + 0o4) + chr(0b1100100) + '\145')(chr(7821 - 7704) + chr(0b10110 + 0o136) + chr(0b10 + 0o144) + chr(0b11110 + 0o17) + chr(904 - 848)))(xafqLlk3kkUe(SXOLrMavuUCe(b'9\xc5\xf2\x07\xc6\xf8/_\xbb\x8c\xff\xc0B'), '\x64' + chr(8026 - 7925) + '\143' + chr(1540 - 1429) + chr(9757 - 9657) + chr(0b1100101))(chr(0b1110101) + chr(0b1101101 + 0o7) + chr(102) + chr(0b1101 + 0o40) + '\x38')):
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\xd6\xee\x02\xcf\xf8.G\xad\x88\xf8\xcdnfA\xd9'), chr(0b1001 + 0o133) + '\x65' + chr(0b1011100 + 0o7) + '\x6f' + chr(1028 - 928) + chr(101))('\x75' + chr(0b1000001 + 0o63) + chr(0b1100110) + chr(0b101101) + chr(56))) is not None:
(oVre8I6UXc3b.dNM_VSzUcYmD, VNGQdHSFPrso) = IDJ2eXGCBCDu.clip_by_global_norm(oVre8I6UXc3b.dNM_VSzUcYmD, oVre8I6UXc3b._clip_thresh_var)
JGX1zzJR9bqG = oVre8I6UXc3b._momentum_optimizer.apply_gradients(pZ0NK2y6HRbn(oVre8I6UXc3b.dNM_VSzUcYmD, oVre8I6UXc3b.scip4hzKGuta), global_step=tnqEWmPx71Oj, name=AIvJRzLdDfgF)
else:
JGX1zzJR9bqG = oVre8I6UXc3b._momentum_optimizer.apply_gradients(pZ0NK2y6HRbn(oVre8I6UXc3b.dNM_VSzUcYmD, oVre8I6UXc3b.scip4hzKGuta), global_step=tnqEWmPx71Oj, name=AIvJRzLdDfgF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'.\xd4\xf0\x02\xde\xc56J\x80\x9e\xe8\xcaAu'), '\144' + chr(101) + '\143' + chr(4953 - 4842) + '\x64' + '\145')(chr(4031 - 3914) + chr(0b11011 + 0o131) + '\x66' + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'(\xc7\xe7\x1b\xde\xd5?p\xa6\x88\xe7\xc9^gf\xc2\xe48I\xe8R?\x8d\x00\xa4\xa1\xa4'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1100010 + 0o15) + '\x64' + '\x65')('\165' + chr(2500 - 2384) + '\x66' + chr(45) + '\070')):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b';\xda\xec\x1f\xcd\xc86p\xbb\x88\xfb\xc0_tE\xc5\xe9\x0eZ\xfa'), '\144' + '\x65' + chr(99) + '\157' + '\x64' + chr(0b110000 + 0o65))(chr(0b1101101 + 0o10) + chr(116) + chr(0b1100110) + '\055' + chr(56)))([JGX1zzJR9bqG]):
sLagDyaDFGJY = oVre8I6UXc3b._prepare_variables()
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'.\xd4\xf0\x02\xde\xc56J\x80\x9e\xe8\xcaAu'), '\x64' + '\145' + '\143' + chr(0b1101111) + chr(0b101000 + 0o74) + chr(5038 - 4937))('\x75' + '\164' + chr(5264 - 5162) + chr(0b1101 + 0o40) + chr(1832 - 1776)))(xafqLlk3kkUe(SXOLrMavuUCe(b'!\xd0\xee\x07\xd0\xd0<F\xb1'), chr(5879 - 5779) + chr(0b111001 + 0o54) + '\143' + '\x6f' + chr(0b1100100) + chr(7124 - 7023))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(215 - 159))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b';\xda\xec\x1f\xcd\xc86p\xbb\x88\xfb\xc0_tE\xc5\xe9\x0eZ\xfa'), chr(0b111 + 0o135) + chr(101) + chr(0b110 + 0o135) + chr(4368 - 4257) + '\144' + chr(0b1100101))(chr(0b100010 + 0o123) + '\x74' + chr(102) + chr(0b101101) + chr(0b111000)))([sLagDyaDFGJY]):
bXZ7CfArQnre = oVre8I6UXc3b._yellowfin()
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b';\xda\xec\x1f\xcd\xc86p\xbb\x88\xfb\xc0_tE\xc5\xe9\x0eZ\xfa'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(9398 - 9287) + chr(0b1100100) + '\x65')(chr(8134 - 8017) + chr(0b101100 + 0o110) + '\146' + chr(45) + chr(2560 - 2504)))([bXZ7CfArQnre]):
oVre8I6UXc3b.OVD7i5iz3aX0 = IDJ2eXGCBCDu.assign_add(oVre8I6UXc3b._step, ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49), 0o10)).C8dAr6Ujq2Tn
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x16\x8c\xd7\x05\xd2\xfe,N\x88\xdc\xfb\xea'), '\144' + chr(0b1000011 + 0o42) + chr(0b1100011) + '\x6f' + chr(4334 - 4234) + chr(0b1100000 + 0o5))('\x75' + chr(7506 - 7390) + chr(0b1010101 + 0o21) + chr(45) + chr(0b111000)))(JGX1zzJR9bqG, sLagDyaDFGJY, bXZ7CfArQnre, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\xe3\xc6\\\xd6\x923U\xec\x8c\xd3\x95'), chr(100) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b111111 + 0o45) + '\x65')(chr(0b1110101) + '\x74' + chr(102) + '\x2d' + chr(2399 - 2343))))
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer.compute_gradients
|
def compute_gradients(self,
loss,
var_list,
global_step=None,
gate_gradients=GATE_OP,
aggregation_method=None,
colocate_gradients_with_ops=False,
name=None,
grad_loss=None):
"""Compute gradients through momentum optimizer.
Args:
loss: A Tensor containing the value to minimize.
var_list: Optional list or tuple of tf.Variable to update
to minimize loss. Defaults to the list of variables collected
in the graph under the key GraphKey.TRAINABLE_VARIABLES.
global_step: Optional Variable to increment by one after the
variables have been updated.
gate_gradients: How to gate the computation of gradients.
Can be GATE_NONE, GATE_OP, or GATE_GRAPH.
aggregation_method: Specifies the method used to combine
gradient terms. Valid values are defined in the class AggregationMethod.
colocate_gradients_with_ops: If True, try collocating gradients with
the corresponding op.
name: Optional name for the returned operation. Default to the name
passed to the Optimizer constructor.
grad_loss: Optional. A Tensor holding the gradient computed for loss.
Returns:
A list of (gradient, variable) pairs. Variable is always present,
but gradient can be None.
"""
del global_step, name # Unused for now.
return self._momentum_optimizer.compute_gradients(
loss,
var_list=var_list,
gate_gradients=gate_gradients,
aggregation_method=aggregation_method,
colocate_gradients_with_ops=colocate_gradients_with_ops,
grad_loss=grad_loss)
|
python
|
def compute_gradients(self,
loss,
var_list,
global_step=None,
gate_gradients=GATE_OP,
aggregation_method=None,
colocate_gradients_with_ops=False,
name=None,
grad_loss=None):
"""Compute gradients through momentum optimizer.
Args:
loss: A Tensor containing the value to minimize.
var_list: Optional list or tuple of tf.Variable to update
to minimize loss. Defaults to the list of variables collected
in the graph under the key GraphKey.TRAINABLE_VARIABLES.
global_step: Optional Variable to increment by one after the
variables have been updated.
gate_gradients: How to gate the computation of gradients.
Can be GATE_NONE, GATE_OP, or GATE_GRAPH.
aggregation_method: Specifies the method used to combine
gradient terms. Valid values are defined in the class AggregationMethod.
colocate_gradients_with_ops: If True, try collocating gradients with
the corresponding op.
name: Optional name for the returned operation. Default to the name
passed to the Optimizer constructor.
grad_loss: Optional. A Tensor holding the gradient computed for loss.
Returns:
A list of (gradient, variable) pairs. Variable is always present,
but gradient can be None.
"""
del global_step, name # Unused for now.
return self._momentum_optimizer.compute_gradients(
loss,
var_list=var_list,
gate_gradients=gate_gradients,
aggregation_method=aggregation_method,
colocate_gradients_with_ops=colocate_gradients_with_ops,
grad_loss=grad_loss)
|
[
"def",
"compute_gradients",
"(",
"self",
",",
"loss",
",",
"var_list",
",",
"global_step",
"=",
"None",
",",
"gate_gradients",
"=",
"GATE_OP",
",",
"aggregation_method",
"=",
"None",
",",
"colocate_gradients_with_ops",
"=",
"False",
",",
"name",
"=",
"None",
",",
"grad_loss",
"=",
"None",
")",
":",
"del",
"global_step",
",",
"name",
"# Unused for now.",
"return",
"self",
".",
"_momentum_optimizer",
".",
"compute_gradients",
"(",
"loss",
",",
"var_list",
"=",
"var_list",
",",
"gate_gradients",
"=",
"gate_gradients",
",",
"aggregation_method",
"=",
"aggregation_method",
",",
"colocate_gradients_with_ops",
"=",
"colocate_gradients_with_ops",
",",
"grad_loss",
"=",
"grad_loss",
")"
] |
Compute gradients through momentum optimizer.
Args:
loss: A Tensor containing the value to minimize.
var_list: Optional list or tuple of tf.Variable to update
to minimize loss. Defaults to the list of variables collected
in the graph under the key GraphKey.TRAINABLE_VARIABLES.
global_step: Optional Variable to increment by one after the
variables have been updated.
gate_gradients: How to gate the computation of gradients.
Can be GATE_NONE, GATE_OP, or GATE_GRAPH.
aggregation_method: Specifies the method used to combine
gradient terms. Valid values are defined in the class AggregationMethod.
colocate_gradients_with_ops: If True, try collocating gradients with
the corresponding op.
name: Optional name for the returned operation. Default to the name
passed to the Optimizer constructor.
grad_loss: Optional. A Tensor holding the gradient computed for loss.
Returns:
A list of (gradient, variable) pairs. Variable is always present,
but gradient can be None.
|
[
"Compute",
"gradients",
"through",
"momentum",
"optimizer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L521-L560
|
train
|
Compute gradients through the momentum optimizer.
|
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,ko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Z6mjyZZT,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) + '\x6f' + '\062' + chr(2034 - 1985), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(0b110010) + chr(0b100001 + 0o20) + chr(0b100001 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b11001 + 0o34) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10 + 0o60) + chr(0b110110), 50037 - 50029), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\064' + chr(1667 - 1617), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110100) + chr(55), 0o10), ehT0Px3KOsy9(chr(2087 - 2039) + '\157' + '\063' + '\x31' + '\061', 63042 - 63034), ehT0Px3KOsy9(chr(292 - 244) + chr(0b1101111) + chr(49) + '\x36' + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(4120 - 4009) + '\x31' + '\063', 0b1000), ehT0Px3KOsy9(chr(1838 - 1790) + chr(111) + chr(0b110011) + chr(0b10 + 0o61) + chr(50), 45789 - 45781), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(744 - 693) + chr(0b10000 + 0o43) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2113 - 2002) + chr(0b10100 + 0o35) + chr(0b1110 + 0o50) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100011 + 0o22) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1100100 + 0o13) + chr(498 - 443) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(287 - 239) + chr(111) + chr(1556 - 1504) + chr(0b110001), 9982 - 9974), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101001 + 0o6) + chr(50) + chr(0b110010) + '\064', 13680 - 13672), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\x36' + chr(0b100000 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(50) + chr(0b110 + 0o52), 39156 - 39148), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + '\x33' + chr(0b110010) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(55) + chr(0b110111), 15489 - 15481), ehT0Px3KOsy9('\060' + chr(4656 - 4545) + '\x31' + '\061' + chr(685 - 633), 0b1000), ehT0Px3KOsy9(chr(1216 - 1168) + '\x6f' + '\x32' + chr(0b110100) + chr(0b100110 + 0o16), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b101011 + 0o10) + chr(0b110110) + chr(0b11111 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10 + 0o62) + chr(646 - 598), 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + '\062' + '\x30' + '\065', 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(2614 - 2561), ord("\x08")), ehT0Px3KOsy9(chr(770 - 722) + chr(0b110100 + 0o73) + chr(0b110011) + chr(55) + chr(0b101000 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\063' + '\066', 8), ehT0Px3KOsy9('\x30' + chr(11042 - 10931) + chr(0b11000 + 0o33) + '\065' + chr(1853 - 1799), 28998 - 28990), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(2015 - 1962) + chr(0b100001 + 0o22), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\067' + chr(727 - 673), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101110 + 0o5) + chr(0b110100 + 0o3) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + chr(2486 - 2435) + '\064' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + '\063' + chr(1680 - 1630) + chr(1804 - 1749), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b110110) + chr(2150 - 2095), 17617 - 17609), ehT0Px3KOsy9(chr(1040 - 992) + chr(0b1011100 + 0o23) + chr(49) + chr(0b110001 + 0o3) + chr(50), 8), ehT0Px3KOsy9(chr(0b110000) + chr(1781 - 1670) + chr(0b110011) + chr(0b110000) + chr(476 - 423), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(54) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111101 + 0o62) + chr(0b110 + 0o60) + '\x33', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b11010 + 0o125) + chr(0b10011 + 0o42) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'?'), chr(7179 - 7079) + chr(957 - 856) + chr(0b1100011) + chr(1210 - 1099) + '\x64' + chr(101))(chr(13635 - 13518) + '\x74' + chr(102) + chr(408 - 363) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def E5LgqcNEchGa(oVre8I6UXc3b, YpO0BcZ6fMsf, WjzhQmqLR1lh, tnqEWmPx71Oj=None, P1fQz18e5asu=vno8zqOIiNPd, eE9QnZEOnT7H=None, VQooTdxj_kY1=ehT0Px3KOsy9('\060' + '\x6f' + chr(0b111 + 0o51), 49685 - 49677), AIvJRzLdDfgF=None, uwTg_OFZTBED=None):
del tnqEWmPx71Oj, AIvJRzLdDfgF
return xafqLlk3kkUe(oVre8I6UXc3b._momentum_optimizer, xafqLlk3kkUe(SXOLrMavuUCe(b'r\xe0\x82f\x17\x13\xac.l\xa8\xbf\x17AZO\xe0\xc7'), chr(0b1100100) + chr(101) + '\143' + chr(0b1101111) + '\x64' + '\x65')('\x75' + chr(12000 - 11884) + '\146' + chr(45) + chr(2306 - 2250)))(YpO0BcZ6fMsf, var_list=WjzhQmqLR1lh, gate_gradients=P1fQz18e5asu, aggregation_method=eE9QnZEOnT7H, colocate_gradients_with_ops=VQooTdxj_kY1, grad_loss=uwTg_OFZTBED)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/yellowfin.py
|
YellowFinOptimizer.minimize
|
def minimize(self,
loss,
global_step=None,
var_list=None,
gate_gradients=GATE_OP,
aggregation_method=None,
colocate_gradients_with_ops=False,
name=None,
grad_loss=None):
"""Adapted from TensorFlow Optimizer base class member function.
Add operations to minimize `loss` by updating `var_list`.
This method simply combines calls `compute_gradients()` and
`apply_gradients()`. If you want to process the gradient before applying
them call `tf.gradients()` and `self.apply_gradients()` explicitly instead
of using this function.
Args:
loss: A Tensor containing the value to minimize.
global_step: Optional Variable to increment by one after the variables
have been updated.
var_list: Optional list or tuple of Variable objects to update to
minimize loss. Defaults to the list of variables collected in
the graph under the key GraphKeys.TRAINABLE_VARIABLES.
gate_gradients: How to gate the computation of gradients.
Can be GATE_NONE, GATE_OP, or GATE_GRAPH.
aggregation_method: Specifies the method used to combine gradient terms.
Valid values are defined in the class AggregationMethod.
colocate_gradients_with_ops: If True, try collocating gradients with
the corresponding op.
name: Optional name for the returned operation.
grad_loss: Optional. A Tensor holding the gradient computed for loss.
Returns:
An Operation that updates the variables in var_list.
If global_step was not None, that operation also increments global_step.
Raises:
ValueError: if no gradients are provided for any variable.
"""
grads_and_vars = self._momentum_optimizer.compute_gradients(
loss,
var_list=var_list,
gate_gradients=gate_gradients,
aggregation_method=aggregation_method,
colocate_gradients_with_ops=colocate_gradients_with_ops,
grad_loss=grad_loss)
vars_with_grad = [v for g, v in grads_and_vars if g is not None]
if not vars_with_grad:
raise ValueError(
"No gradients provided for any variable, check your graph for ops"
" that do not support gradients, between variables %s and loss %s." %
([str(v) for _, v in grads_and_vars], loss))
for g, v in grads_and_vars:
print("g ", g)
print("v ", v)
return self.apply_gradients(grads_and_vars,
global_step=global_step,
name=name)
|
python
|
def minimize(self,
loss,
global_step=None,
var_list=None,
gate_gradients=GATE_OP,
aggregation_method=None,
colocate_gradients_with_ops=False,
name=None,
grad_loss=None):
"""Adapted from TensorFlow Optimizer base class member function.
Add operations to minimize `loss` by updating `var_list`.
This method simply combines calls `compute_gradients()` and
`apply_gradients()`. If you want to process the gradient before applying
them call `tf.gradients()` and `self.apply_gradients()` explicitly instead
of using this function.
Args:
loss: A Tensor containing the value to minimize.
global_step: Optional Variable to increment by one after the variables
have been updated.
var_list: Optional list or tuple of Variable objects to update to
minimize loss. Defaults to the list of variables collected in
the graph under the key GraphKeys.TRAINABLE_VARIABLES.
gate_gradients: How to gate the computation of gradients.
Can be GATE_NONE, GATE_OP, or GATE_GRAPH.
aggregation_method: Specifies the method used to combine gradient terms.
Valid values are defined in the class AggregationMethod.
colocate_gradients_with_ops: If True, try collocating gradients with
the corresponding op.
name: Optional name for the returned operation.
grad_loss: Optional. A Tensor holding the gradient computed for loss.
Returns:
An Operation that updates the variables in var_list.
If global_step was not None, that operation also increments global_step.
Raises:
ValueError: if no gradients are provided for any variable.
"""
grads_and_vars = self._momentum_optimizer.compute_gradients(
loss,
var_list=var_list,
gate_gradients=gate_gradients,
aggregation_method=aggregation_method,
colocate_gradients_with_ops=colocate_gradients_with_ops,
grad_loss=grad_loss)
vars_with_grad = [v for g, v in grads_and_vars if g is not None]
if not vars_with_grad:
raise ValueError(
"No gradients provided for any variable, check your graph for ops"
" that do not support gradients, between variables %s and loss %s." %
([str(v) for _, v in grads_and_vars], loss))
for g, v in grads_and_vars:
print("g ", g)
print("v ", v)
return self.apply_gradients(grads_and_vars,
global_step=global_step,
name=name)
|
[
"def",
"minimize",
"(",
"self",
",",
"loss",
",",
"global_step",
"=",
"None",
",",
"var_list",
"=",
"None",
",",
"gate_gradients",
"=",
"GATE_OP",
",",
"aggregation_method",
"=",
"None",
",",
"colocate_gradients_with_ops",
"=",
"False",
",",
"name",
"=",
"None",
",",
"grad_loss",
"=",
"None",
")",
":",
"grads_and_vars",
"=",
"self",
".",
"_momentum_optimizer",
".",
"compute_gradients",
"(",
"loss",
",",
"var_list",
"=",
"var_list",
",",
"gate_gradients",
"=",
"gate_gradients",
",",
"aggregation_method",
"=",
"aggregation_method",
",",
"colocate_gradients_with_ops",
"=",
"colocate_gradients_with_ops",
",",
"grad_loss",
"=",
"grad_loss",
")",
"vars_with_grad",
"=",
"[",
"v",
"for",
"g",
",",
"v",
"in",
"grads_and_vars",
"if",
"g",
"is",
"not",
"None",
"]",
"if",
"not",
"vars_with_grad",
":",
"raise",
"ValueError",
"(",
"\"No gradients provided for any variable, check your graph for ops\"",
"\" that do not support gradients, between variables %s and loss %s.\"",
"%",
"(",
"[",
"str",
"(",
"v",
")",
"for",
"_",
",",
"v",
"in",
"grads_and_vars",
"]",
",",
"loss",
")",
")",
"for",
"g",
",",
"v",
"in",
"grads_and_vars",
":",
"print",
"(",
"\"g \"",
",",
"g",
")",
"print",
"(",
"\"v \"",
",",
"v",
")",
"return",
"self",
".",
"apply_gradients",
"(",
"grads_and_vars",
",",
"global_step",
"=",
"global_step",
",",
"name",
"=",
"name",
")"
] |
Adapted from TensorFlow Optimizer base class member function.
Add operations to minimize `loss` by updating `var_list`.
This method simply combines calls `compute_gradients()` and
`apply_gradients()`. If you want to process the gradient before applying
them call `tf.gradients()` and `self.apply_gradients()` explicitly instead
of using this function.
Args:
loss: A Tensor containing the value to minimize.
global_step: Optional Variable to increment by one after the variables
have been updated.
var_list: Optional list or tuple of Variable objects to update to
minimize loss. Defaults to the list of variables collected in
the graph under the key GraphKeys.TRAINABLE_VARIABLES.
gate_gradients: How to gate the computation of gradients.
Can be GATE_NONE, GATE_OP, or GATE_GRAPH.
aggregation_method: Specifies the method used to combine gradient terms.
Valid values are defined in the class AggregationMethod.
colocate_gradients_with_ops: If True, try collocating gradients with
the corresponding op.
name: Optional name for the returned operation.
grad_loss: Optional. A Tensor holding the gradient computed for loss.
Returns:
An Operation that updates the variables in var_list.
If global_step was not None, that operation also increments global_step.
Raises:
ValueError: if no gradients are provided for any variable.
|
[
"Adapted",
"from",
"TensorFlow",
"Optimizer",
"base",
"class",
"member",
"function",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/yellowfin.py#L562-L622
|
train
|
Adapted from TensorFlow Optimizer base class member function.
|
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,FXUco0R3m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NS,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(0b100011 + 0o15) + '\x6f' + chr(0b110010) + '\061' + chr(979 - 925), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b101101 + 0o7) + chr(2014 - 1965), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(49) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + '\067' + chr(53), 0o10), ehT0Px3KOsy9(chr(1270 - 1222) + chr(0b111101 + 0o62) + chr(0b10101 + 0o36) + chr(1197 - 1144) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(130 - 82) + '\157' + chr(0b100110 + 0o13) + chr(0b101001 + 0o11) + chr(0b100110 + 0o15), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\x36' + chr(0b100110 + 0o16), 10955 - 10947), ehT0Px3KOsy9(chr(48) + chr(0b101100 + 0o103) + chr(1790 - 1741) + chr(2096 - 2043) + chr(0b101011 + 0o5), 18580 - 18572), ehT0Px3KOsy9(chr(0b110000) + chr(7334 - 7223) + chr(0b110010) + chr(1274 - 1222) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + '\x32' + chr(1003 - 951) + chr(0b110110), 8), ehT0Px3KOsy9('\060' + chr(8902 - 8791) + '\062' + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + '\061' + chr(796 - 747) + chr(0b110 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(2061 - 2013) + chr(111) + chr(0b101000 + 0o13) + chr(2428 - 2377) + chr(0b100111 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(1020 - 972) + chr(4973 - 4862) + chr(0b110010) + chr(1827 - 1776) + '\x32', 0b1000), ehT0Px3KOsy9(chr(806 - 758) + '\x6f' + chr(0b110001) + '\066' + chr(0b110100), 8), ehT0Px3KOsy9(chr(755 - 707) + chr(0b100111 + 0o110) + '\061' + chr(2253 - 2201) + chr(53), 14294 - 14286), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(10714 - 10603) + chr(989 - 938) + '\x32', 0o10), ehT0Px3KOsy9(chr(1066 - 1018) + chr(111) + chr(0b10010 + 0o40) + '\x33' + chr(0b110010), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11001 + 0o32) + '\067' + '\065', 32508 - 32500), ehT0Px3KOsy9(chr(791 - 743) + chr(111) + chr(0b10 + 0o60) + chr(51) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(49 - 1) + '\x6f' + chr(50) + chr(0b100000 + 0o24) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100100 + 0o13) + chr(0b110110) + chr(0b101001 + 0o11), 33379 - 33371), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(0b101011 + 0o11) + '\x30', 0b1000), ehT0Px3KOsy9(chr(781 - 733) + chr(6861 - 6750) + chr(531 - 480) + chr(0b1110 + 0o46) + '\060', 0o10), ehT0Px3KOsy9(chr(1000 - 952) + chr(111) + chr(0b100011 + 0o16) + '\x30' + chr(0b1110 + 0o50), 0b1000), ehT0Px3KOsy9(chr(918 - 870) + chr(0b1101111) + chr(49) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2751 - 2640) + chr(0b110011) + chr(2174 - 2121) + chr(2596 - 2545), 155 - 147), ehT0Px3KOsy9(chr(2032 - 1984) + chr(111) + chr(717 - 668) + chr(1491 - 1440) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001101 + 0o42) + chr(0b10110 + 0o35) + chr(0b110011) + chr(0b1110 + 0o45), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(3400 - 3289) + chr(0b110010) + chr(1814 - 1766) + chr(0b101010 + 0o12), 0b1000), ehT0Px3KOsy9(chr(729 - 681) + '\157' + '\x31' + '\x37' + chr(1445 - 1396), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(4966 - 4855) + '\061' + chr(0b110110), 14359 - 14351), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x30' + chr(325 - 272), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(49) + chr(2261 - 2206), 8), ehT0Px3KOsy9('\x30' + chr(7310 - 7199) + chr(0b110001) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(917 - 865) + chr(2007 - 1959), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110110) + '\062', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(1819 - 1765) + chr(0b10110 + 0o34), 4971 - 4963), ehT0Px3KOsy9('\060' + chr(6746 - 6635) + '\061' + '\066' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1007 - 959) + chr(111) + '\x34' + chr(0b10100 + 0o36), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(5662 - 5551) + chr(2721 - 2668) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0'), chr(0b100101 + 0o77) + chr(101) + chr(2210 - 2111) + chr(111) + '\x64' + '\x65')(chr(8324 - 8207) + '\164' + chr(0b1100110) + chr(225 - 180) + chr(0b1011 + 0o55)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def L5WYxmyJZHRN(oVre8I6UXc3b, YpO0BcZ6fMsf, tnqEWmPx71Oj=None, WjzhQmqLR1lh=None, P1fQz18e5asu=vno8zqOIiNPd, eE9QnZEOnT7H=None, VQooTdxj_kY1=ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(5435 - 5324) + chr(48), 0b1000), AIvJRzLdDfgF=None, uwTg_OFZTBED=None):
w3RYIellNwW7 = oVre8I6UXc3b._momentum_optimizer.compute_gradients(YpO0BcZ6fMsf, var_list=WjzhQmqLR1lh, gate_gradients=P1fQz18e5asu, aggregation_method=eE9QnZEOnT7H, colocate_gradients_with_ops=VQooTdxj_kY1, grad_loss=uwTg_OFZTBED)
H32o69pSvp1c = [cMbll0QYhULo for (RWHpzFEeviFP, cMbll0QYhULo) in w3RYIellNwW7 if RWHpzFEeviFP is not None]
if not H32o69pSvp1c:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\x8ejZ\x9e2\x10\x01\xc3\xc8\xc7<\xf9\xea\x06\nl\xf3\x99\xfb\xc0\x12F\x8f4)\x8a7\xa2\xa4\x0fo\xf7&mB^\x97Z\x02\xed\x89/^\x87s\r\x07\xd3\xd4\x93(\xab\xfb\x04\r:\xfc\x92\xec\x84]P\x93f}\x838\xaf\xa4\x1da\xa5!cT\x12\x81\x03R\xfe\x8e8I\xcc4\x06\t\xc2\xcf\xd6!\xad\xe9XEx\xff\x89\xe9\xc1WN\xc00h\x990\xba\xe6\x15k\xf6o)S\x12\x93\x18F\xae\x8d%N\x9fsQ\x1b\x88'), '\x64' + '\145' + chr(0b1100011) + '\157' + chr(0b1011 + 0o131) + '\145')(chr(117) + chr(0b10111 + 0o135) + chr(102) + chr(0b101101) + chr(0b100110 + 0o22)) % ([M8_cKLkHVB2V(cMbll0QYhULo) for (VNGQdHSFPrso, cMbll0QYhULo) in w3RYIellNwW7], YpO0BcZ6fMsf))
for (RWHpzFEeviFP, cMbll0QYhULo) in w3RYIellNwW7:
zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xc1'), '\x64' + chr(3825 - 3724) + chr(0b1100011) + chr(1266 - 1155) + chr(0b1100100) + '\145')('\165' + '\x74' + '\146' + chr(45) + chr(0b111000)), RWHpzFEeviFP)
zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\xc1'), chr(5307 - 5207) + '\145' + chr(0b1100011) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + chr(116) + chr(102) + '\x2d' + chr(0b10111 + 0o41)), cMbll0QYhULo)
return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xef\x91:Q\x95\x0c\x13\x1a\xc7\xc2\xda*\xb7\xee\x07'), '\144' + chr(101) + chr(1699 - 1600) + chr(111) + '\x64' + '\145')('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b1000 + 0o45) + '\x38'))(w3RYIellNwW7, global_step=tnqEWmPx71Oj, name=AIvJRzLdDfgF)
|
tensorflow/tensor2tensor
|
tensor2tensor/models/bytenet.py
|
residual_dilated_conv
|
def residual_dilated_conv(x, repeat, padding, name, hparams):
"""A stack of convolution blocks with residual connections."""
with tf.variable_scope(name):
k = (hparams.kernel_height, hparams.kernel_width)
dilations_and_kernels = [((2**i, 1), k)
for i in range(hparams.num_hidden_layers)]
for i in range(repeat):
with tf.variable_scope("repeat_%d" % i):
y = common_layers.conv_block(
common_layers.layer_norm(x, hparams.hidden_size, name="lnorm"),
hparams.hidden_size,
dilations_and_kernels,
padding=padding,
name="residual_conv")
y = tf.nn.dropout(y, 1.0 - hparams.dropout)
x += y
return x
|
python
|
def residual_dilated_conv(x, repeat, padding, name, hparams):
"""A stack of convolution blocks with residual connections."""
with tf.variable_scope(name):
k = (hparams.kernel_height, hparams.kernel_width)
dilations_and_kernels = [((2**i, 1), k)
for i in range(hparams.num_hidden_layers)]
for i in range(repeat):
with tf.variable_scope("repeat_%d" % i):
y = common_layers.conv_block(
common_layers.layer_norm(x, hparams.hidden_size, name="lnorm"),
hparams.hidden_size,
dilations_and_kernels,
padding=padding,
name="residual_conv")
y = tf.nn.dropout(y, 1.0 - hparams.dropout)
x += y
return x
|
[
"def",
"residual_dilated_conv",
"(",
"x",
",",
"repeat",
",",
"padding",
",",
"name",
",",
"hparams",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
")",
":",
"k",
"=",
"(",
"hparams",
".",
"kernel_height",
",",
"hparams",
".",
"kernel_width",
")",
"dilations_and_kernels",
"=",
"[",
"(",
"(",
"2",
"**",
"i",
",",
"1",
")",
",",
"k",
")",
"for",
"i",
"in",
"range",
"(",
"hparams",
".",
"num_hidden_layers",
")",
"]",
"for",
"i",
"in",
"range",
"(",
"repeat",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"repeat_%d\"",
"%",
"i",
")",
":",
"y",
"=",
"common_layers",
".",
"conv_block",
"(",
"common_layers",
".",
"layer_norm",
"(",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"name",
"=",
"\"lnorm\"",
")",
",",
"hparams",
".",
"hidden_size",
",",
"dilations_and_kernels",
",",
"padding",
"=",
"padding",
",",
"name",
"=",
"\"residual_conv\"",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"y",
",",
"1.0",
"-",
"hparams",
".",
"dropout",
")",
"x",
"+=",
"y",
"return",
"x"
] |
A stack of convolution blocks with residual connections.
|
[
"A",
"stack",
"of",
"convolution",
"blocks",
"with",
"residual",
"connections",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/bytenet.py#L31-L47
|
train
|
A stack of convolution blocks with residual connections.
|
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,SBRjvOU1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,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(0b100001 + 0o116) + chr(0b11000 + 0o33) + chr(48) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(2084 - 1973) + '\x33' + chr(506 - 452) + chr(0b10100 + 0o36), 59929 - 59921), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + chr(1068 - 1018) + '\064' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10 + 0o60) + chr(2227 - 2179), 45771 - 45763), ehT0Px3KOsy9(chr(645 - 597) + chr(111) + '\x31' + '\064' + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(49) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(0b110001) + chr(1458 - 1410) + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(1965 - 1911) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(5208 - 5097) + chr(50) + '\062' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + '\062' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + '\x32' + chr(0b1111 + 0o42) + chr(0b110011 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + '\067' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111101 + 0o62) + chr(1088 - 1039) + chr(0b110010) + chr(0b100001 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(672 - 624) + chr(0b1101111) + chr(1531 - 1480) + chr(0b110110) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\x36' + chr(0b110011 + 0o3), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + '\066' + '\x31', 38993 - 38985), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2113 - 2064) + chr(0b10100 + 0o35) + chr(506 - 454), 17224 - 17216), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b100010 + 0o25) + chr(0b11 + 0o60), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100 + 0o56) + '\066', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(55) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8925 - 8814) + '\x32' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\067' + chr(184 - 135), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11 + 0o60) + '\x35' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110111 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\063' + chr(0b101001 + 0o15), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(128 - 79), 14897 - 14889), ehT0Px3KOsy9(chr(123 - 75) + chr(0b1100010 + 0o15) + '\x33' + '\062' + '\x35', 21240 - 21232), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\x32' + chr(0b110011), 21599 - 21591), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b101111 + 0o100) + chr(0b10111 + 0o34) + chr(0b110110) + chr(0b11101 + 0o25), 8), ehT0Px3KOsy9(chr(759 - 711) + chr(3598 - 3487) + chr(0b10010 + 0o37) + '\060' + chr(0b10011 + 0o43), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101011 + 0o10) + chr(48) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b11001 + 0o30) + chr(1948 - 1897), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10 + 0o57) + chr(0b110000) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\066' + '\x31', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b1110 + 0o51), 59901 - 59893), ehT0Px3KOsy9('\x30' + '\157' + chr(52) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\x32' + chr(48), 8), ehT0Px3KOsy9(chr(1351 - 1303) + '\157' + '\x31' + chr(0b0 + 0o63) + chr(0b110110), 46989 - 46981)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xec'), chr(100) + '\x65' + '\143' + chr(0b1010001 + 0o36) + chr(0b10000 + 0o124) + chr(0b1100101))('\x75' + '\164' + chr(4201 - 4099) + chr(0b101101) + chr(0b1110 + 0o52)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ZFad6X5ZTTOS(OeWW0F1dBPRQ, hpyK9c505LBh, TFLseEYASEKG, AIvJRzLdDfgF, n4ljua2gi1Pr):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\x93\xd5y\x07\xab+\x10v\xe7u\xe0L4'), chr(0b100101 + 0o77) + '\x65' + chr(0b1100011) + chr(0b100101 + 0o112) + chr(0b11010 + 0o112) + '\x65')('\x75' + chr(0b1110100) + '\146' + chr(0b11000 + 0o25) + chr(0b111000)))(AIvJRzLdDfgF):
OolUPRJhRaJd = (n4ljua2gi1Pr.kernel_height, n4ljua2gi1Pr.kernel_width)
HfyTWMMIvuNz = [((ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010), 0o10) ** WVxHKyX45z_L, ehT0Px3KOsy9(chr(326 - 278) + chr(0b1000101 + 0o52) + chr(0b110001), 0o10)), OolUPRJhRaJd) for WVxHKyX45z_L in vQr8gNKaIaWE(n4ljua2gi1Pr.jZh5_pLUoOoZ)]
for WVxHKyX45z_L in vQr8gNKaIaWE(hpyK9c505LBh):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\x93\xd5y\x07\xab+\x10v\xe7u\xe0L4'), chr(0b101011 + 0o71) + chr(6469 - 6368) + chr(5008 - 4909) + '\x6f' + chr(0b1001 + 0o133) + '\x65')('\x75' + chr(116) + chr(0b1100110) + '\x2d' + chr(0b100100 + 0o24)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\x97\xd7u\x07\xbd\x18PM'), chr(4603 - 4503) + '\145' + '\143' + chr(5151 - 5040) + chr(8713 - 8613) + chr(101))(chr(0b111101 + 0o70) + chr(0b1110100) + chr(3630 - 3528) + chr(0b1011 + 0o42) + chr(0b11011 + 0o35)) % WVxHKyX45z_L):
SqiSOtYOqOJH = jSKPaHwSAfVv.conv_block(jSKPaHwSAfVv.layer_norm(OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xae\x9c\xc8b\x0b'), chr(0b100 + 0o140) + chr(0b1100101) + chr(99) + chr(111) + '\x64' + '\x65')('\x75' + '\x74' + chr(2224 - 2122) + '\x2d' + '\x38')), n4ljua2gi1Pr.qzoyXN3kdhDL, HfyTWMMIvuNz, padding=TFLseEYASEKG, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\x97\xd4y\x02\xbc&\x19v\xf7y\xe1J'), chr(0b1011111 + 0o5) + chr(10083 - 9982) + '\143' + '\157' + chr(100) + chr(957 - 856))(chr(0b110110 + 0o77) + chr(9244 - 9128) + chr(0b100001 + 0o105) + '\x2d' + chr(56)))
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(SqiSOtYOqOJH, 1.0 - n4ljua2gi1Pr.ag0mwEgWzjYv)
OeWW0F1dBPRQ += SqiSOtYOqOJH
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/models/bytenet.py
|
bytenet_internal
|
def bytenet_internal(inputs, targets, hparams):
"""ByteNet, main step used for training."""
with tf.variable_scope("bytenet"):
# Flatten inputs and extend length by 50%.
inputs = tf.expand_dims(common_layers.flatten4d3d(inputs), axis=2)
extend_length = tf.to_int32(0.5 * tf.to_float(tf.shape(inputs)[1]))
inputs_shape = inputs.shape.as_list()
inputs = tf.pad(inputs, [[0, 0], [0, extend_length], [0, 0], [0, 0]])
inputs_shape[1] = None
inputs.set_shape(inputs_shape) # Don't lose the other shapes when padding.
# Pad inputs and targets to be the same length, divisible by 50.
inputs, targets = common_layers.pad_to_same_length(
inputs, targets, final_length_divisible_by=50)
final_encoder = residual_dilated_conv(inputs, hparams.num_block_repeat,
"SAME", "encoder", hparams)
shifted_targets = common_layers.shift_right(targets)
kernel = (hparams.kernel_height, hparams.kernel_width)
decoder_start = common_layers.conv_block(
tf.concat([final_encoder, shifted_targets], axis=3),
hparams.hidden_size, [((1, 1), kernel)],
padding="LEFT")
return residual_dilated_conv(decoder_start, hparams.num_block_repeat,
"LEFT", "decoder", hparams)
|
python
|
def bytenet_internal(inputs, targets, hparams):
"""ByteNet, main step used for training."""
with tf.variable_scope("bytenet"):
# Flatten inputs and extend length by 50%.
inputs = tf.expand_dims(common_layers.flatten4d3d(inputs), axis=2)
extend_length = tf.to_int32(0.5 * tf.to_float(tf.shape(inputs)[1]))
inputs_shape = inputs.shape.as_list()
inputs = tf.pad(inputs, [[0, 0], [0, extend_length], [0, 0], [0, 0]])
inputs_shape[1] = None
inputs.set_shape(inputs_shape) # Don't lose the other shapes when padding.
# Pad inputs and targets to be the same length, divisible by 50.
inputs, targets = common_layers.pad_to_same_length(
inputs, targets, final_length_divisible_by=50)
final_encoder = residual_dilated_conv(inputs, hparams.num_block_repeat,
"SAME", "encoder", hparams)
shifted_targets = common_layers.shift_right(targets)
kernel = (hparams.kernel_height, hparams.kernel_width)
decoder_start = common_layers.conv_block(
tf.concat([final_encoder, shifted_targets], axis=3),
hparams.hidden_size, [((1, 1), kernel)],
padding="LEFT")
return residual_dilated_conv(decoder_start, hparams.num_block_repeat,
"LEFT", "decoder", hparams)
|
[
"def",
"bytenet_internal",
"(",
"inputs",
",",
"targets",
",",
"hparams",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"bytenet\"",
")",
":",
"# Flatten inputs and extend length by 50%.",
"inputs",
"=",
"tf",
".",
"expand_dims",
"(",
"common_layers",
".",
"flatten4d3d",
"(",
"inputs",
")",
",",
"axis",
"=",
"2",
")",
"extend_length",
"=",
"tf",
".",
"to_int32",
"(",
"0.5",
"*",
"tf",
".",
"to_float",
"(",
"tf",
".",
"shape",
"(",
"inputs",
")",
"[",
"1",
"]",
")",
")",
"inputs_shape",
"=",
"inputs",
".",
"shape",
".",
"as_list",
"(",
")",
"inputs",
"=",
"tf",
".",
"pad",
"(",
"inputs",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"extend_length",
"]",
",",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"inputs_shape",
"[",
"1",
"]",
"=",
"None",
"inputs",
".",
"set_shape",
"(",
"inputs_shape",
")",
"# Don't lose the other shapes when padding.",
"# Pad inputs and targets to be the same length, divisible by 50.",
"inputs",
",",
"targets",
"=",
"common_layers",
".",
"pad_to_same_length",
"(",
"inputs",
",",
"targets",
",",
"final_length_divisible_by",
"=",
"50",
")",
"final_encoder",
"=",
"residual_dilated_conv",
"(",
"inputs",
",",
"hparams",
".",
"num_block_repeat",
",",
"\"SAME\"",
",",
"\"encoder\"",
",",
"hparams",
")",
"shifted_targets",
"=",
"common_layers",
".",
"shift_right",
"(",
"targets",
")",
"kernel",
"=",
"(",
"hparams",
".",
"kernel_height",
",",
"hparams",
".",
"kernel_width",
")",
"decoder_start",
"=",
"common_layers",
".",
"conv_block",
"(",
"tf",
".",
"concat",
"(",
"[",
"final_encoder",
",",
"shifted_targets",
"]",
",",
"axis",
"=",
"3",
")",
",",
"hparams",
".",
"hidden_size",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"padding",
"=",
"\"LEFT\"",
")",
"return",
"residual_dilated_conv",
"(",
"decoder_start",
",",
"hparams",
".",
"num_block_repeat",
",",
"\"LEFT\"",
",",
"\"decoder\"",
",",
"hparams",
")"
] |
ByteNet, main step used for training.
|
[
"ByteNet",
"main",
"step",
"used",
"for",
"training",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/bytenet.py#L50-L74
|
train
|
ByteNet main step used for training.
|
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,jIl9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BOH72k,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' + '\x6f' + '\067' + chr(0b100100 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + chr(0b110010) + chr(2842 - 2787) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\065' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(2793 - 2739) + chr(1394 - 1339), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000011 + 0o54) + '\x32' + '\x33' + chr(0b11110 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10987 - 10876) + chr(50) + '\x34' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(6742 - 6631) + chr(0b10101 + 0o42) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\061' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(522 - 411) + '\062' + chr(0b11101 + 0o23) + '\x35', 35619 - 35611), ehT0Px3KOsy9('\x30' + chr(8884 - 8773) + chr(1942 - 1892) + '\067' + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(978 - 929) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1630 - 1582) + '\157' + chr(51) + chr(0b110110 + 0o0) + chr(2359 - 2308), 0b1000), ehT0Px3KOsy9(chr(2085 - 2037) + chr(111) + chr(0b110010) + '\066' + '\x36', 12994 - 12986), ehT0Px3KOsy9(chr(48) + chr(2513 - 2402) + chr(2896 - 2842), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\x34' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\061' + '\061' + '\x33', 18846 - 18838), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101100 + 0o6) + '\066' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(52) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b0 + 0o60) + chr(0b110110), 54427 - 54419), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(0b110010) + chr(1531 - 1483) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(51) + chr(1671 - 1623), 15680 - 15672), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + '\061' + chr(0b110001) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(53) + chr(0b10111 + 0o33), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(0b110001) + chr(0b10100 + 0o34) + chr(1824 - 1771), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\060' + chr(0b11100 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(10844 - 10733) + chr(0b1010 + 0o51) + '\x33' + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100000 + 0o21) + chr(0b110011) + chr(1105 - 1051), 51896 - 51888), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + chr(0b110101) + chr(1976 - 1928), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + '\x33' + chr(1020 - 971) + '\066', 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1011 + 0o144) + chr(412 - 362) + '\060' + chr(54), 33623 - 33615), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + chr(1885 - 1836) + chr(628 - 574) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(0b110001) + chr(405 - 353) + chr(2679 - 2625), 18430 - 18422), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + '\x35' + chr(0b101000 + 0o10), 47175 - 47167), ehT0Px3KOsy9(chr(0b110000) + chr(10980 - 10869) + '\x32' + chr(0b101101 + 0o12) + '\064', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(706 - 657) + chr(1854 - 1802), 9399 - 9391), ehT0Px3KOsy9(chr(1283 - 1235) + chr(3085 - 2974) + chr(0b11001 + 0o27), 0o10), ehT0Px3KOsy9(chr(1657 - 1609) + chr(0b1000 + 0o147) + chr(49) + chr(640 - 592) + chr(0b110101), 8), ehT0Px3KOsy9(chr(412 - 364) + '\x6f' + chr(0b110100) + chr(0b110000 + 0o7), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\060' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1011011 + 0o24) + chr(0b110011) + '\063' + '\061', 24063 - 24055)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2017 - 1969) + chr(0b100 + 0o153) + chr(2679 - 2626) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x15'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\157' + chr(2729 - 2629) + '\x65')(chr(117) + chr(0b1110100) + chr(4512 - 4410) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def MVt7ZrROdBmy(vXoupepMtCXU, xIEmRseySp3z, n4ljua2gi1Pr):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'M\xd9\xd9\xde\xfb\xc5S\xab\xda\xcfl\x9c\xc6c'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b110111 + 0o70) + '\144' + chr(101))(chr(117) + chr(2999 - 2883) + '\x66' + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'Y\xc1\xdf\xd2\xf4\xc2K'), chr(0b100000 + 0o104) + '\145' + chr(3333 - 3234) + chr(111) + chr(100) + chr(0b101110 + 0o67))('\165' + chr(0b1110011 + 0o1) + chr(754 - 652) + chr(0b101101) + '\x38')):
vXoupepMtCXU = IDJ2eXGCBCDu.expand_dims(jSKPaHwSAfVv.flatten4d3d(vXoupepMtCXU), axis=ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + '\x32', 0b1000))
Zijpbk0p8lRj = IDJ2eXGCBCDu.to_int32(0.5 * IDJ2eXGCBCDu.to_float(IDJ2eXGCBCDu.nauYfLglTpcb(vXoupepMtCXU)[ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(49), 0o10)]))
VgP_McURhCb5 = vXoupepMtCXU.shape.as_list()
vXoupepMtCXU = IDJ2eXGCBCDu.pad(vXoupepMtCXU, [[ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + '\x30', 8), ehT0Px3KOsy9('\060' + chr(0b1000 + 0o147) + chr(48), 8)], [ehT0Px3KOsy9(chr(688 - 640) + chr(111) + '\x30', 8), Zijpbk0p8lRj], [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1948 - 1900), 8), ehT0Px3KOsy9(chr(2154 - 2106) + '\x6f' + chr(777 - 729), 8)], [ehT0Px3KOsy9(chr(48) + '\x6f' + '\060', 8), ehT0Px3KOsy9(chr(2225 - 2177) + chr(111) + chr(0b100101 + 0o13), 8)]])
VgP_McURhCb5[ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + chr(0b110001), 8)] = None
xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'H\xdd\xdf\xe8\xe9\xcf^\xbe\xe0'), chr(0b1011101 + 0o7) + chr(3902 - 3801) + chr(6077 - 5978) + chr(0b1101110 + 0o1) + chr(0b1100100) + chr(0b1100000 + 0o5))('\x75' + chr(12830 - 12714) + chr(102) + '\x2d' + chr(0b111000)))(VgP_McURhCb5)
(vXoupepMtCXU, xIEmRseySp3z) = jSKPaHwSAfVv.pad_to_same_length(vXoupepMtCXU, xIEmRseySp3z, final_length_divisible_by=ehT0Px3KOsy9('\060' + '\157' + chr(0b110110) + chr(0b110010), 0b1000))
xXpoLojlYasd = ZFad6X5ZTTOS(vXoupepMtCXU, n4ljua2gi1Pr.num_block_repeat, xafqLlk3kkUe(SXOLrMavuUCe(b'h\xf9\xe6\xf2'), chr(4845 - 4745) + chr(101) + chr(0b1100 + 0o127) + chr(111) + chr(100) + '\x65')('\x75' + chr(7995 - 7879) + chr(0b1100110) + '\x2d' + chr(0b100100 + 0o24)), xafqLlk3kkUe(SXOLrMavuUCe(b'^\xd6\xc8\xd8\xfe\xc2M'), '\x64' + '\x65' + chr(0b100011 + 0o100) + '\x6f' + '\144' + '\145')(chr(5620 - 5503) + chr(0b1010 + 0o152) + chr(0b10 + 0o144) + chr(45) + chr(2421 - 2365)), n4ljua2gi1Pr)
oyK7XSnTOkEL = jSKPaHwSAfVv.shift_right(xIEmRseySp3z)
iaILEoszmqXb = (n4ljua2gi1Pr.kernel_height, n4ljua2gi1Pr.kernel_width)
Ey0WQbk_26y1 = jSKPaHwSAfVv.conv_block(IDJ2eXGCBCDu.concat([xXpoLojlYasd, oyK7XSnTOkEL], axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + '\063', 9535 - 9527)), n4ljua2gi1Pr.qzoyXN3kdhDL, [((ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 8)), iaILEoszmqXb)], padding=xafqLlk3kkUe(SXOLrMavuUCe(b'w\xfd\xed\xe3'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(111) + chr(2916 - 2816) + '\145')('\x75' + '\164' + '\146' + '\055' + chr(0b111000)))
return ZFad6X5ZTTOS(Ey0WQbk_26y1, xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'U\xcd\xc6\xe8\xf8\xcbP\xad\xee\xe3}\x96\xc6c\xc4?'), chr(100) + '\x65' + chr(0b11001 + 0o112) + chr(0b1101111) + chr(100) + '\145')('\x75' + chr(0b1110100) + '\x66' + '\x2d' + '\x38')), xafqLlk3kkUe(SXOLrMavuUCe(b'w\xfd\xed\xe3'), chr(0b1100100) + chr(0b110100 + 0o61) + chr(0b101110 + 0o65) + chr(4664 - 4553) + chr(3606 - 3506) + chr(0b1100101))(chr(0b1110101) + chr(116) + '\146' + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'_\xdd\xc8\xd8\xfe\xc2M'), chr(0b10 + 0o142) + chr(101) + chr(99) + '\157' + chr(0b10011 + 0o121) + chr(101))('\165' + '\164' + chr(0b1100110) + chr(0b11111 + 0o16) + chr(0b111000)), n4ljua2gi1Pr)
|
tensorflow/tensor2tensor
|
tensor2tensor/models/bytenet.py
|
bytenet_base
|
def bytenet_base():
"""Set of hyperparameters."""
hparams = common_hparams.basic_params1()
hparams.batch_size = 2048
hparams.hidden_size = 768
hparams.dropout = 0.2
hparams.symbol_dropout = 0.2
hparams.label_smoothing = 0.1
hparams.clip_grad_norm = 2.0
hparams.num_hidden_layers = 4
hparams.kernel_height = 3
hparams.kernel_width = 1
hparams.learning_rate_decay_scheme = "exp"
hparams.learning_rate = 0.05
hparams.learning_rate_warmup_steps = 3000
hparams.initializer_gain = 1.0
hparams.weight_decay = 3.0
hparams.num_sampled_classes = 0
hparams.sampling_method = "argmax"
hparams.optimizer_adam_epsilon = 1e-6
hparams.optimizer_adam_beta1 = 0.85
hparams.optimizer_adam_beta2 = 0.997
hparams.add_hparam("num_block_repeat", 4)
return hparams
|
python
|
def bytenet_base():
"""Set of hyperparameters."""
hparams = common_hparams.basic_params1()
hparams.batch_size = 2048
hparams.hidden_size = 768
hparams.dropout = 0.2
hparams.symbol_dropout = 0.2
hparams.label_smoothing = 0.1
hparams.clip_grad_norm = 2.0
hparams.num_hidden_layers = 4
hparams.kernel_height = 3
hparams.kernel_width = 1
hparams.learning_rate_decay_scheme = "exp"
hparams.learning_rate = 0.05
hparams.learning_rate_warmup_steps = 3000
hparams.initializer_gain = 1.0
hparams.weight_decay = 3.0
hparams.num_sampled_classes = 0
hparams.sampling_method = "argmax"
hparams.optimizer_adam_epsilon = 1e-6
hparams.optimizer_adam_beta1 = 0.85
hparams.optimizer_adam_beta2 = 0.997
hparams.add_hparam("num_block_repeat", 4)
return hparams
|
[
"def",
"bytenet_base",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"hparams",
".",
"batch_size",
"=",
"2048",
"hparams",
".",
"hidden_size",
"=",
"768",
"hparams",
".",
"dropout",
"=",
"0.2",
"hparams",
".",
"symbol_dropout",
"=",
"0.2",
"hparams",
".",
"label_smoothing",
"=",
"0.1",
"hparams",
".",
"clip_grad_norm",
"=",
"2.0",
"hparams",
".",
"num_hidden_layers",
"=",
"4",
"hparams",
".",
"kernel_height",
"=",
"3",
"hparams",
".",
"kernel_width",
"=",
"1",
"hparams",
".",
"learning_rate_decay_scheme",
"=",
"\"exp\"",
"hparams",
".",
"learning_rate",
"=",
"0.05",
"hparams",
".",
"learning_rate_warmup_steps",
"=",
"3000",
"hparams",
".",
"initializer_gain",
"=",
"1.0",
"hparams",
".",
"weight_decay",
"=",
"3.0",
"hparams",
".",
"num_sampled_classes",
"=",
"0",
"hparams",
".",
"sampling_method",
"=",
"\"argmax\"",
"hparams",
".",
"optimizer_adam_epsilon",
"=",
"1e-6",
"hparams",
".",
"optimizer_adam_beta1",
"=",
"0.85",
"hparams",
".",
"optimizer_adam_beta2",
"=",
"0.997",
"hparams",
".",
"add_hparam",
"(",
"\"num_block_repeat\"",
",",
"4",
")",
"return",
"hparams"
] |
Set of hyperparameters.
|
[
"Set",
"of",
"hyperparameters",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/bytenet.py#L86-L109
|
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,bdL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kCViZiX,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(1504 - 1456) + chr(10178 - 10067) + chr(49) + chr(2020 - 1970) + '\067', 23977 - 23969), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\x34' + '\062', 56740 - 56732), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(4811 - 4700) + chr(51) + '\063' + chr(0b10 + 0o56), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b1010 + 0o47) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x36' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1100011 + 0o14) + '\063' + chr(0b110110) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b110001) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(51) + '\065' + '\061', 42644 - 42636), ehT0Px3KOsy9(chr(1009 - 961) + chr(9399 - 9288) + chr(755 - 704) + chr(0b1101 + 0o50) + chr(140 - 90), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(282 - 232), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001 + 0o146) + chr(804 - 752) + chr(0b100110 + 0o15), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100000 + 0o117) + '\062' + chr(50) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\066' + '\x32', 0b1000), ehT0Px3KOsy9(chr(1844 - 1796) + chr(0b1001000 + 0o47) + chr(51) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1338 - 1290) + chr(0b1101111) + chr(0b100100 + 0o17) + '\067' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10 + 0o60) + '\x31' + chr(0b101 + 0o53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1188 - 1077) + chr(0b10110 + 0o33) + chr(2048 - 1998) + chr(0b110011 + 0o4), 8), ehT0Px3KOsy9(chr(0b110000) + chr(8560 - 8449) + '\x32' + chr(2123 - 2070), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(50) + chr(1452 - 1399) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100100 + 0o15) + chr(0b100101 + 0o21) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1101 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(0b10100 + 0o36) + chr(0b101011 + 0o7) + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(2407 - 2355) + '\067', 17113 - 17105), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + chr(0b110011) + chr(50) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(6821 - 6710) + chr(1479 - 1427) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10 + 0o57) + chr(0b110101) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(0b110010) + chr(0b110100) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1983 - 1928) + chr(0b110011), 22849 - 22841), ehT0Px3KOsy9(chr(0b110000) + chr(4946 - 4835) + chr(1016 - 964) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + '\064' + chr(53), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(425 - 376) + chr(51), 45888 - 45880), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(0b1 + 0o62) + chr(0b110111) + chr(0b101 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b100000 + 0o21) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11110 + 0o24) + chr(55) + chr(0b110010), 5191 - 5183), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(54) + chr(55 - 1), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8604 - 8493) + chr(51) + '\060' + '\060', 0b1000)][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'y'), chr(100) + chr(101) + chr(99) + chr(111) + '\x64' + chr(0b1100101))('\165' + chr(0b1011010 + 0o32) + chr(0b1100110) + chr(0b101101) + chr(0b1011 + 0o55)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def foWrOBsYsrON():
n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1()
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(52) + chr(1264 - 1216) + chr(0b110000) + '\x30', 0o10)
n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\x34' + '\x30' + '\060', 2973 - 2965)
n4ljua2gi1Pr.ag0mwEgWzjYv = 0.2
n4ljua2gi1Pr.ycYLHKnRG3mu = 0.2
n4ljua2gi1Pr.FSjUgdaczzRk = 0.1
n4ljua2gi1Pr.SdNSZNVkVjLh = 2.0
n4ljua2gi1Pr.jZh5_pLUoOoZ = ehT0Px3KOsy9(chr(48) + '\x6f' + '\x34', 8)
n4ljua2gi1Pr.aWtpZRO3JbHj = ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(0b110011), ord("\x08"))
n4ljua2gi1Pr.xCDNMTg51zI4 = ehT0Px3KOsy9(chr(1349 - 1301) + chr(0b1101111) + chr(1789 - 1740), 0b1000)
n4ljua2gi1Pr.v3ZnJE9Hdub1 = xafqLlk3kkUe(SXOLrMavuUCe(b'2\xda\xa8'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\x6f' + chr(0b1100001 + 0o3) + chr(101))(chr(982 - 865) + '\x74' + '\146' + chr(0b10101 + 0o30) + chr(56))
n4ljua2gi1Pr.QGSIpd_yUNzU = 0.05
n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1048 - 995) + chr(54) + '\x37' + chr(0b10101 + 0o33), 0b1000)
n4ljua2gi1Pr.S1SbCBXLapw8 = 1.0
n4ljua2gi1Pr.eB4rJl6fUxw9 = 3.0
n4ljua2gi1Pr.Syf38YGTPvuw = ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2189 - 2141), 8)
n4ljua2gi1Pr.Ud1InQ7hapop = xafqLlk3kkUe(SXOLrMavuUCe(b'6\xd0\xbf#U\x8b'), chr(0b11001 + 0o113) + chr(0b1100101) + chr(5321 - 5222) + '\157' + chr(2136 - 2036) + chr(101))(chr(5144 - 5027) + '\x74' + chr(102) + '\055' + '\070')
n4ljua2gi1Pr.o17O_bIptWdl = 1e-06
n4ljua2gi1Pr.GcOjyd7zcDH8 = 0.85
n4ljua2gi1Pr.CBOVKNT0M9cG = 0.997
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'6\xc6\xbc\x11\\\x83\xa8\x9b\x8bw'), chr(100) + chr(0b1010010 + 0o23) + chr(2845 - 2746) + chr(0b1100100 + 0o13) + chr(0b1100011 + 0o1) + '\145')(chr(117) + chr(0b1110100) + chr(0b1010011 + 0o23) + chr(0b101101) + chr(0b11111 + 0o31)))(xafqLlk3kkUe(SXOLrMavuUCe(b'9\xd7\xb5\x11V\x9f\xa6\x8a\x81EQ\xf6u\x17~\x8c'), chr(8455 - 8355) + chr(101) + chr(435 - 336) + chr(111) + chr(0b1100100) + chr(0b1000111 + 0o36))('\x75' + '\164' + chr(0b1100110) + chr(0b101101) + '\x38'), ehT0Px3KOsy9(chr(933 - 885) + chr(111) + '\064', 8))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/snli.py
|
_download_and_parse_dataset
|
def _download_and_parse_dataset(tmp_dir, train):
"""Downloads and prepairs the dataset to be parsed by the data_generator."""
file_path = generator_utils.maybe_download(tmp_dir, _SNLI_ZIP, _SNLI_URL)
zip_ref = zipfile.ZipFile(file_path, 'r')
zip_ref.extractall(tmp_dir)
zip_ref.close()
file_name = 'train' if train else 'dev'
dataset_file_path = os.path.join(tmp_dir, _SNLI_DATA_PATH % file_name)
_parse_dataset(dataset_file_path, tmp_dir, train)
|
python
|
def _download_and_parse_dataset(tmp_dir, train):
"""Downloads and prepairs the dataset to be parsed by the data_generator."""
file_path = generator_utils.maybe_download(tmp_dir, _SNLI_ZIP, _SNLI_URL)
zip_ref = zipfile.ZipFile(file_path, 'r')
zip_ref.extractall(tmp_dir)
zip_ref.close()
file_name = 'train' if train else 'dev'
dataset_file_path = os.path.join(tmp_dir, _SNLI_DATA_PATH % file_name)
_parse_dataset(dataset_file_path, tmp_dir, train)
|
[
"def",
"_download_and_parse_dataset",
"(",
"tmp_dir",
",",
"train",
")",
":",
"file_path",
"=",
"generator_utils",
".",
"maybe_download",
"(",
"tmp_dir",
",",
"_SNLI_ZIP",
",",
"_SNLI_URL",
")",
"zip_ref",
"=",
"zipfile",
".",
"ZipFile",
"(",
"file_path",
",",
"'r'",
")",
"zip_ref",
".",
"extractall",
"(",
"tmp_dir",
")",
"zip_ref",
".",
"close",
"(",
")",
"file_name",
"=",
"'train'",
"if",
"train",
"else",
"'dev'",
"dataset_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"_SNLI_DATA_PATH",
"%",
"file_name",
")",
"_parse_dataset",
"(",
"dataset_file_path",
",",
"tmp_dir",
",",
"train",
")"
] |
Downloads and prepairs the dataset to be parsed by the data_generator.
|
[
"Downloads",
"and",
"prepairs",
"the",
"dataset",
"to",
"be",
"parsed",
"by",
"the",
"data_generator",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/snli.py#L51-L60
|
train
|
Downloads and prepairs the dataset to be parsed by the data_generator.
|
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('\x30' + chr(0b1101111) + chr(0b1 + 0o61) + chr(0b101010 + 0o11) + chr(52), 42352 - 42344), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\x32' + chr(0b110 + 0o56), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011000 + 0o27) + '\061' + '\060' + chr(0b10101 + 0o33), 17404 - 17396), ehT0Px3KOsy9(chr(48) + chr(9733 - 9622) + '\061' + '\x32' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1004 - 956) + '\157' + chr(759 - 710) + chr(0b110000) + chr(423 - 373), 0b1000), ehT0Px3KOsy9('\x30' + chr(4034 - 3923) + chr(1934 - 1883) + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b101111 + 0o2) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11450 - 11339) + chr(0b100100 + 0o20) + chr(53), 29491 - 29483), ehT0Px3KOsy9('\060' + chr(111) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b11001 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8572 - 8461) + chr(0b110011 + 0o0) + chr(53) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11010 + 0o27) + '\060' + chr(0b110011), 645 - 637), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + chr(1873 - 1823) + chr(502 - 450) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(0b11010 + 0o30) + chr(53) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(466 - 418) + '\x6f' + chr(0b111 + 0o52) + '\x35' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110110), 24030 - 24022), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(1348 - 1299) + chr(0b110111) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(507 - 459) + '\157' + chr(0b10100 + 0o37) + chr(0b110011) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(0b1 + 0o60) + chr(0b110111) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\x33' + chr(48), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(432 - 379) + chr(51), 8), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + '\x34' + chr(380 - 327), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10111 + 0o32) + chr(0b110101) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + '\062' + '\061' + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(5958 - 5847) + chr(0b100001 + 0o22) + '\065' + chr(997 - 944), 0b1000), ehT0Px3KOsy9('\x30' + chr(10765 - 10654) + chr(50) + chr(0b110100) + chr(0b10111 + 0o32), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\067' + '\066', 47336 - 47328), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(297 - 248) + '\x36' + chr(0b110100), 12324 - 12316), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(754 - 705) + chr(0b1101 + 0o44) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100001 + 0o20) + chr(334 - 283) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1493 - 1445) + '\157' + chr(2442 - 2390), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100111 + 0o16), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(52) + chr(0b110110), 9388 - 9380), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\066' + chr(0b110011 + 0o1), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b11 + 0o154) + '\063' + chr(0b110100) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11111 + 0o23) + chr(0b110100) + chr(685 - 633), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(220 - 171) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b100000 + 0o117) + chr(51) + chr(528 - 478) + chr(52), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2'), chr(0b1001000 + 0o34) + chr(0b1100101) + '\x63' + chr(111) + chr(0b1111 + 0o125) + chr(0b1100101))('\165' + chr(0b1100101 + 0o17) + chr(102) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def tsVesCbts1qo(JsZ36NJUqtml, e80gRioCjdat):
Ti9e_bxaCVyu = g1Z_RG9zP4cD.maybe_download(JsZ36NJUqtml, JSlYSdUNNkST, EkRoYMQXG93K)
Beno10LPAbTt = PFu838VwaBva.ZipFile(Ti9e_bxaCVyu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xee'), '\144' + chr(101) + '\143' + chr(0b1101111) + chr(100) + chr(0b1011110 + 0o7))(chr(0b1110101) + '\164' + chr(0b1100110) + '\x2d' + chr(0b10000 + 0o50)))
xafqLlk3kkUe(Beno10LPAbTt, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9,4%#{\xb9Dnq'), chr(0b11111 + 0o105) + chr(101) + chr(0b100101 + 0o76) + chr(0b1101111) + chr(100) + chr(9042 - 8941))(chr(0b1110101) + chr(0b1110100) + chr(5935 - 5833) + chr(691 - 646) + chr(56)))(JsZ36NJUqtml)
xafqLlk3kkUe(Beno10LPAbTt, xafqLlk3kkUe(SXOLrMavuUCe(b"\xff8/$'"), chr(0b1100100) + chr(0b1100101) + chr(4293 - 4194) + chr(151 - 40) + chr(888 - 788) + chr(0b1100101))(chr(117) + chr(116) + '\146' + chr(636 - 591) + '\070'))()
OK327sCYstzB = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8&!>,'), chr(0b101011 + 0o71) + chr(0b1100100 + 0o1) + chr(0b1100011) + chr(7053 - 6942) + '\144' + chr(0b1010000 + 0o25))(chr(0b1110101) + chr(11345 - 11229) + '\x66' + chr(0b101011 + 0o2) + '\070') if e80gRioCjdat else xafqLlk3kkUe(SXOLrMavuUCe(b'\xf816'), chr(100) + '\x65' + chr(7098 - 6999) + chr(0b1101111) + '\144' + '\x65')('\x75' + '\x74' + chr(0b1011011 + 0o13) + chr(45) + chr(2095 - 2039))
A3JsV5RNwUqV = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, FZQI9X8PIh2H % OK327sCYstzB)
BdaJIeJaHl9F(A3JsV5RNwUqV, JsZ36NJUqtml, e80gRioCjdat)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/snli.py
|
_get_tokens_and_tags
|
def _get_tokens_and_tags(parse_str):
"""Parse str to tokens and pos tags."""
tokens = []
parse_split = parse_str.split(' ')
for p in parse_split:
assert p.startswith('(') or p.endswith(')')
if p.endswith(')'):
token = p.replace(')', '')
tokens.append(token)
return tokens
|
python
|
def _get_tokens_and_tags(parse_str):
"""Parse str to tokens and pos tags."""
tokens = []
parse_split = parse_str.split(' ')
for p in parse_split:
assert p.startswith('(') or p.endswith(')')
if p.endswith(')'):
token = p.replace(')', '')
tokens.append(token)
return tokens
|
[
"def",
"_get_tokens_and_tags",
"(",
"parse_str",
")",
":",
"tokens",
"=",
"[",
"]",
"parse_split",
"=",
"parse_str",
".",
"split",
"(",
"' '",
")",
"for",
"p",
"in",
"parse_split",
":",
"assert",
"p",
".",
"startswith",
"(",
"'('",
")",
"or",
"p",
".",
"endswith",
"(",
"')'",
")",
"if",
"p",
".",
"endswith",
"(",
"')'",
")",
":",
"token",
"=",
"p",
".",
"replace",
"(",
"')'",
",",
"''",
")",
"tokens",
".",
"append",
"(",
"token",
")",
"return",
"tokens"
] |
Parse str to tokens and pos tags.
|
[
"Parse",
"str",
"to",
"tokens",
"and",
"pos",
"tags",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/snli.py#L63-L73
|
train
|
Parse str to tokens and pos tags.
|
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,NE1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C7R_,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) + '\062' + chr(0b110110) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(504 - 456) + '\x6f' + '\061' + chr(0b1101 + 0o45) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + '\x37' + chr(1586 - 1534), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(830 - 719) + '\064' + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\065', 49058 - 49050), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + '\061' + chr(0b11010 + 0o30) + chr(0b10010 + 0o42), 25782 - 25774), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\x36' + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(0b11110 + 0o121) + chr(2160 - 2111) + chr(0b110110) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(892 - 843) + '\x33' + chr(1810 - 1758), 0b1000), ehT0Px3KOsy9('\x30' + chr(9588 - 9477) + '\063' + chr(0b110100) + chr(55), 44539 - 44531), ehT0Px3KOsy9(chr(169 - 121) + chr(111) + chr(0b11001 + 0o32) + chr(0b110010) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110011) + chr(0b101001 + 0o16), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(49) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1 + 0o63), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(3012 - 2957) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(49) + chr(0b110011) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x35' + '\060', 22410 - 22402), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + '\066' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\063', 28835 - 28827), ehT0Px3KOsy9(chr(0b110000) + chr(8034 - 7923) + chr(0b110010) + chr(0b110011) + chr(0b1010 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(1152 - 1104) + '\x6f' + chr(0b110011) + '\x30' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(12009 - 11898) + chr(0b10111 + 0o32) + chr(0b110110) + '\x34', 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\061' + chr(50) + chr(0b10010 + 0o40), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(0b110011 + 0o0) + chr(51), 31467 - 31459), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\x31' + chr(1558 - 1508), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(0b110011 + 0o0) + '\063' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\x31' + chr(0b1011 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\067' + chr(0b100010 + 0o20), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3668 - 3557) + '\x35' + '\063', 46872 - 46864), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\062' + '\x30', 52163 - 52155), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10111 + 0o37), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1612 - 1561) + chr(902 - 851) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(6633 - 6522) + chr(0b110100) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110100) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1101 + 0o45) + chr(0b110111) + chr(1927 - 1872), ord("\x08")), ehT0Px3KOsy9(chr(572 - 524) + chr(0b1101111) + chr(50) + '\x36', 31772 - 31764), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(816 - 762) + chr(53), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(5732 - 5621) + chr(0b110101) + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f'), chr(4338 - 4238) + chr(2567 - 2466) + chr(0b1100011) + chr(10074 - 9963) + '\144' + '\x65')(chr(117) + '\164' + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ieKeV5Zd6lVY(J4XLw92X96CD):
Sz7tXxaCGqJ1 = []
Uhs10X6hV_Hh = J4XLw92X96CD.split(xafqLlk3kkUe(SXOLrMavuUCe(b'\x91'), chr(5553 - 5453) + chr(101) + chr(0b1100011) + chr(5777 - 5666) + chr(1407 - 1307) + chr(0b1100101))(chr(0b1110101) + chr(0b1000 + 0o154) + chr(3788 - 3686) + chr(0b100011 + 0o12) + chr(0b10010 + 0o46)))
for UyakMW2IMFEj in Uhs10X6hV_Hh:
assert xafqLlk3kkUe(UyakMW2IMFEj, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2#]gUn#\x1d\x064'), chr(0b1100100) + chr(101) + '\x63' + chr(12127 - 12016) + chr(0b1011 + 0o131) + '\145')('\x75' + chr(116) + chr(102) + '\055' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x99'), chr(0b1100100) + chr(0b101101 + 0o70) + chr(185 - 86) + chr(0b1111 + 0o140) + chr(100) + '\x65')(chr(0b1110101) + chr(7944 - 7828) + '\x66' + chr(0b101101) + chr(0b111000))) or xafqLlk3kkUe(UyakMW2IMFEj, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd49XfVt \x1c'), '\144' + '\145' + '\x63' + chr(111) + chr(5018 - 4918) + chr(0b111000 + 0o55))(chr(0b1110101) + '\164' + '\x66' + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x98'), chr(7490 - 7390) + '\x65' + '\x63' + chr(0b100110 + 0o111) + chr(100) + chr(0b1100101))(chr(117) + '\x74' + chr(0b1100110) + chr(1910 - 1865) + chr(531 - 475)))
if xafqLlk3kkUe(UyakMW2IMFEj, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd49XfVt \x1c'), '\144' + '\x65' + '\x63' + chr(0b1000110 + 0o51) + chr(0b1100100) + '\145')(chr(0b1101 + 0o150) + '\164' + chr(0b1100110) + chr(0b101011 + 0o2) + chr(881 - 825)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x98'), chr(100) + '\x65' + '\x63' + chr(111) + '\x64' + chr(0b1100101))(chr(0b1110011 + 0o2) + chr(116) + chr(0b1100110) + chr(1695 - 1650) + chr(56))):
mTy3fac_AqJ5 = UyakMW2IMFEj.replace(xafqLlk3kkUe(SXOLrMavuUCe(b'\x98'), chr(0b0 + 0o144) + chr(0b1100101) + chr(8206 - 8107) + '\x6f' + chr(0b111001 + 0o53) + '\x65')(chr(117) + '\164' + chr(0b1100110) + '\x2d' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(100) + '\145' + chr(0b1100011) + '\157' + '\x64' + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + chr(0b100101 + 0o10) + chr(0b11101 + 0o33)))
xafqLlk3kkUe(Sz7tXxaCGqJ1, xafqLlk3kkUe(SXOLrMavuUCe(b"\xd0'LpOy"), chr(100) + '\145' + '\143' + chr(7416 - 7305) + chr(0b1100100) + chr(0b1100101))(chr(8526 - 8409) + chr(3628 - 3512) + chr(0b1100110) + '\x2d' + '\x38'))(mTy3fac_AqJ5)
return Sz7tXxaCGqJ1
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/snli.py
|
_parse_dataset
|
def _parse_dataset(file_path, tmp_dir, train):
"""Convert the dataset in to a simpler format.
This function creates two files. One for being processed to produce a vocab
and another to generate the data.
Args:
file_path: string, path to the file to parse.
tmp_dir: string, path to the directory to output the files.
train: bool, indicating if we are parsing the training set.
"""
input_path = file_path
file_name = 'train' if train else 'dev'
gen_output_path = os.path.join(tmp_dir, file_name + '.txt')
example_output_path = os.path.join(tmp_dir, _EXAMPLES_FILE)
print('input path: ' + input_path)
print('gen_output_path: ' + gen_output_path)
print('example_output_path: ' + example_output_path)
input_file = tf.gfile.Open(input_path, mode='r')
examples = []
for counter, line in enumerate(input_file):
if counter == 0: # Ignore first line since its a header.
continue
# Get the token and embedding vector.
line_split = line.split('\t')
parse1 = line_split[_PARSE1_INDEX]
parse2 = line_split[_PARSE2_INDEX]
consensus_label = line_split[_LABEL_INDEX]
tokens1 = _get_tokens_and_tags(parse1)
tokens2 = _get_tokens_and_tags(parse2)
tokens1_str = ' '.join(tokens1)
tokens2_str = ' '.join(tokens2)
if consensus_label != '-':
examples.append([tokens1_str, tokens2_str, consensus_label])
input_file.close()
# Output tab delimited file of lines of examples (sentence1, sentence2, label)
with tf.gfile.GFile(gen_output_path, 'w') as f:
for tokens1_str, tokens2_str, consensus_label in examples:
f.write('%s\t%s\t%s\n' % (tokens1_str, tokens2_str, consensus_label))
if train:
# Output file containing all the sentences for generating the vocab from.
with tf.gfile.GFile(example_output_path, 'w') as f:
for tokens1_str, tokens2_str, consensus_label in examples:
f.write('%s %s\n' % (tokens1_str, tokens2_str))
|
python
|
def _parse_dataset(file_path, tmp_dir, train):
"""Convert the dataset in to a simpler format.
This function creates two files. One for being processed to produce a vocab
and another to generate the data.
Args:
file_path: string, path to the file to parse.
tmp_dir: string, path to the directory to output the files.
train: bool, indicating if we are parsing the training set.
"""
input_path = file_path
file_name = 'train' if train else 'dev'
gen_output_path = os.path.join(tmp_dir, file_name + '.txt')
example_output_path = os.path.join(tmp_dir, _EXAMPLES_FILE)
print('input path: ' + input_path)
print('gen_output_path: ' + gen_output_path)
print('example_output_path: ' + example_output_path)
input_file = tf.gfile.Open(input_path, mode='r')
examples = []
for counter, line in enumerate(input_file):
if counter == 0: # Ignore first line since its a header.
continue
# Get the token and embedding vector.
line_split = line.split('\t')
parse1 = line_split[_PARSE1_INDEX]
parse2 = line_split[_PARSE2_INDEX]
consensus_label = line_split[_LABEL_INDEX]
tokens1 = _get_tokens_and_tags(parse1)
tokens2 = _get_tokens_and_tags(parse2)
tokens1_str = ' '.join(tokens1)
tokens2_str = ' '.join(tokens2)
if consensus_label != '-':
examples.append([tokens1_str, tokens2_str, consensus_label])
input_file.close()
# Output tab delimited file of lines of examples (sentence1, sentence2, label)
with tf.gfile.GFile(gen_output_path, 'w') as f:
for tokens1_str, tokens2_str, consensus_label in examples:
f.write('%s\t%s\t%s\n' % (tokens1_str, tokens2_str, consensus_label))
if train:
# Output file containing all the sentences for generating the vocab from.
with tf.gfile.GFile(example_output_path, 'w') as f:
for tokens1_str, tokens2_str, consensus_label in examples:
f.write('%s %s\n' % (tokens1_str, tokens2_str))
|
[
"def",
"_parse_dataset",
"(",
"file_path",
",",
"tmp_dir",
",",
"train",
")",
":",
"input_path",
"=",
"file_path",
"file_name",
"=",
"'train'",
"if",
"train",
"else",
"'dev'",
"gen_output_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"file_name",
"+",
"'.txt'",
")",
"example_output_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"_EXAMPLES_FILE",
")",
"print",
"(",
"'input path: '",
"+",
"input_path",
")",
"print",
"(",
"'gen_output_path: '",
"+",
"gen_output_path",
")",
"print",
"(",
"'example_output_path: '",
"+",
"example_output_path",
")",
"input_file",
"=",
"tf",
".",
"gfile",
".",
"Open",
"(",
"input_path",
",",
"mode",
"=",
"'r'",
")",
"examples",
"=",
"[",
"]",
"for",
"counter",
",",
"line",
"in",
"enumerate",
"(",
"input_file",
")",
":",
"if",
"counter",
"==",
"0",
":",
"# Ignore first line since its a header.",
"continue",
"# Get the token and embedding vector.",
"line_split",
"=",
"line",
".",
"split",
"(",
"'\\t'",
")",
"parse1",
"=",
"line_split",
"[",
"_PARSE1_INDEX",
"]",
"parse2",
"=",
"line_split",
"[",
"_PARSE2_INDEX",
"]",
"consensus_label",
"=",
"line_split",
"[",
"_LABEL_INDEX",
"]",
"tokens1",
"=",
"_get_tokens_and_tags",
"(",
"parse1",
")",
"tokens2",
"=",
"_get_tokens_and_tags",
"(",
"parse2",
")",
"tokens1_str",
"=",
"' '",
".",
"join",
"(",
"tokens1",
")",
"tokens2_str",
"=",
"' '",
".",
"join",
"(",
"tokens2",
")",
"if",
"consensus_label",
"!=",
"'-'",
":",
"examples",
".",
"append",
"(",
"[",
"tokens1_str",
",",
"tokens2_str",
",",
"consensus_label",
"]",
")",
"input_file",
".",
"close",
"(",
")",
"# Output tab delimited file of lines of examples (sentence1, sentence2, label)",
"with",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"gen_output_path",
",",
"'w'",
")",
"as",
"f",
":",
"for",
"tokens1_str",
",",
"tokens2_str",
",",
"consensus_label",
"in",
"examples",
":",
"f",
".",
"write",
"(",
"'%s\\t%s\\t%s\\n'",
"%",
"(",
"tokens1_str",
",",
"tokens2_str",
",",
"consensus_label",
")",
")",
"if",
"train",
":",
"# Output file containing all the sentences for generating the vocab from.",
"with",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"example_output_path",
",",
"'w'",
")",
"as",
"f",
":",
"for",
"tokens1_str",
",",
"tokens2_str",
",",
"consensus_label",
"in",
"examples",
":",
"f",
".",
"write",
"(",
"'%s %s\\n'",
"%",
"(",
"tokens1_str",
",",
"tokens2_str",
")",
")"
] |
Convert the dataset in to a simpler format.
This function creates two files. One for being processed to produce a vocab
and another to generate the data.
Args:
file_path: string, path to the file to parse.
tmp_dir: string, path to the directory to output the files.
train: bool, indicating if we are parsing the training set.
|
[
"Convert",
"the",
"dataset",
"in",
"to",
"a",
"simpler",
"format",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/snli.py#L76-L128
|
train
|
Convert the dataset in to simpler format.
|
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,n0Zkato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t5d,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(0b101011 + 0o5) + chr(111) + chr(0b1100 + 0o52) + chr(1529 - 1474), 38613 - 38605), ehT0Px3KOsy9(chr(0b110000) + chr(5158 - 5047) + '\x31' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(12146 - 12035) + '\063' + chr(0b100111 + 0o16) + '\064', 20675 - 20667), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x37' + chr(777 - 723), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100001 + 0o20) + '\x31' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(8620 - 8509) + chr(0b110011) + chr(49) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11000 + 0o33) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110011) + chr(1247 - 1199), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(1461 - 1408) + chr(0b11100 + 0o24), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(51) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(52) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101001 + 0o106) + chr(0b110001) + '\x32' + chr(0b110011), 38389 - 38381), ehT0Px3KOsy9(chr(0b110000) + chr(9450 - 9339) + chr(0b110001) + chr(53) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + chr(0b110011) + chr(54) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b101001 + 0o15) + chr(0b100011 + 0o17), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(0b110 + 0o53) + '\x31' + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(7601 - 7490) + '\062' + chr(0b110111) + '\x32', 0b1000), ehT0Px3KOsy9(chr(702 - 654) + chr(0b1010100 + 0o33) + chr(0b110011) + '\062' + chr(2256 - 2206), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b111 + 0o54) + chr(0b101111 + 0o1) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001011 + 0o44) + chr(51) + chr(0b110 + 0o55) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(412 - 364) + chr(111) + chr(51) + chr(0b110110) + '\x37', 25234 - 25226), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\061' + chr(1957 - 1907), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000111 + 0o50) + '\x31' + chr(0b110110) + chr(133 - 83), 0b1000), ehT0Px3KOsy9(chr(48) + chr(6738 - 6627) + chr(2336 - 2284), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1000 + 0o54) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(553 - 502) + chr(54) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(1245 - 1196) + chr(0b110000 + 0o4) + '\x36', 35706 - 35698), ehT0Px3KOsy9('\060' + chr(697 - 586) + chr(50) + '\x30' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1665 - 1616) + '\x35' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1678 - 1630) + chr(9014 - 8903) + '\x33' + chr(813 - 761) + chr(748 - 699), 23828 - 23820), ehT0Px3KOsy9(chr(2164 - 2116) + '\x6f' + chr(49) + '\067' + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1061 - 1010) + '\066' + chr(50), 8), ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + '\x32' + chr(0b1100 + 0o46) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1648 - 1600) + chr(0b1101111) + chr(50) + '\x31' + chr(2327 - 2276), 0b1000), ehT0Px3KOsy9(chr(328 - 280) + chr(2965 - 2854) + chr(0b110010) + '\063' + chr(0b100011 + 0o22), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b100100 + 0o23) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + '\063' + chr(0b110101) + chr(0b110101), 60683 - 60675), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(0b100100 + 0o17) + chr(55) + chr(54), 0b1000), ehT0Px3KOsy9(chr(2074 - 2026) + chr(5829 - 5718) + '\061' + '\060' + chr(54), 33640 - 33632)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(0b101000 + 0o15) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x19'), chr(0b1010010 + 0o22) + chr(0b11000 + 0o115) + chr(8136 - 8037) + chr(111) + '\144' + chr(9839 - 9738))('\165' + chr(9714 - 9598) + chr(8919 - 8817) + chr(0b100 + 0o51) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def BdaJIeJaHl9F(Ti9e_bxaCVyu, JsZ36NJUqtml, e80gRioCjdat):
f4VmsQ86qYDJ = Ti9e_bxaCVyu
OK327sCYstzB = xafqLlk3kkUe(SXOLrMavuUCe(b'C{\x8d\x17#'), '\144' + chr(3845 - 3744) + chr(0b11010 + 0o111) + chr(3586 - 3475) + chr(6717 - 6617) + chr(0b11111 + 0o106))('\165' + chr(0b100110 + 0o116) + chr(0b111110 + 0o50) + chr(45) + chr(0b100 + 0o64)) if e80gRioCjdat else xafqLlk3kkUe(SXOLrMavuUCe(b'Sl\x9a'), chr(9443 - 9343) + chr(0b1011010 + 0o13) + chr(0b111100 + 0o47) + chr(111) + chr(0b11010 + 0o112) + '\x65')(chr(117) + '\x74' + '\x66' + chr(128 - 83) + '\070')
lTik7Tf5b4gY = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, OK327sCYstzB + xafqLlk3kkUe(SXOLrMavuUCe(b'\x19}\x94\n'), chr(0b1011000 + 0o14) + '\x65' + chr(0b1100011) + '\x6f' + chr(0b111100 + 0o50) + chr(101))(chr(11582 - 11465) + chr(1672 - 1556) + chr(0b1100110) + chr(0b101000 + 0o5) + chr(56)))
nDBLQgewY3Vl = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, oqE7nakzHdwS)
zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'^g\x9c\x0b9\xeamL,\x00a\x05'), '\x64' + '\x65' + chr(6729 - 6630) + chr(11253 - 11142) + '\144' + chr(734 - 633))(chr(0b1110101) + chr(0b100000 + 0o124) + chr(0b1100110) + chr(463 - 418) + chr(0b10010 + 0o46)) + f4VmsQ86qYDJ)
zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'Pl\x82!"\xbfi]-\x1c\x04U2\x1a\x98\xc8n'), chr(100) + chr(7091 - 6990) + chr(99) + '\157' + chr(100) + '\145')('\165' + chr(0b1011111 + 0o25) + chr(0b1100110) + '\x2d' + chr(1383 - 1327)) + lTik7Tf5b4gY)
zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'Rq\x8d\x13=\xa6xr7\x1d/U&\x1a\xaf\x82/\xce\xba\xf9\xfd'), chr(100) + chr(0b1100101) + chr(0b1100011) + '\x6f' + '\144' + '\x65')('\165' + '\164' + chr(0b1100110) + chr(0b101101) + '\x38') + nDBLQgewY3Vl)
ZS43hVvGhK4C = IDJ2eXGCBCDu.gfile.Open(f4VmsQ86qYDJ, mode=xafqLlk3kkUe(SXOLrMavuUCe(b'E'), '\x64' + chr(0b111 + 0o136) + chr(99) + chr(0b1010001 + 0o36) + chr(4431 - 4331) + '\145')(chr(117) + chr(10129 - 10013) + '\146' + chr(0b1 + 0o54) + '\070'))
uyAR7jUe1VQb = []
for (pD5Ye7vZLivj, LycYkDpyelF6) in YlkZvXL8qwsX(ZS43hVvGhK4C):
if pD5Ye7vZLivj == ehT0Px3KOsy9(chr(0b110000) + chr(6860 - 6749) + chr(0b110000), 0b1000):
continue
WJkuBDcsUd1a = LycYkDpyelF6.split(xafqLlk3kkUe(SXOLrMavuUCe(b'>'), chr(0b1001011 + 0o31) + '\x65' + chr(99) + '\157' + '\x64' + chr(101))(chr(0b1110101) + '\x74' + chr(531 - 429) + chr(978 - 933) + chr(0b111000)))
iOvB1KuWZvz1 = WJkuBDcsUd1a[DrYuxUkgYXdr]
xFCcniNMNCLn = WJkuBDcsUd1a[FoUz09khpkvD]
yRtdT3hPVtzS = WJkuBDcsUd1a[mtX9xRYQeDe6]
M_LQH47d9rzN = ieKeV5Zd6lVY(iOvB1KuWZvz1)
u0rTHIfiTyBf = ieKeV5Zd6lVY(xFCcniNMNCLn)
Kh2zvqANE92v = xafqLlk3kkUe(SXOLrMavuUCe(b'\x17'), '\x64' + chr(2556 - 2455) + chr(8805 - 8706) + chr(0b1110 + 0o141) + '\x64' + '\145')(chr(0b1000111 + 0o56) + '\164' + chr(0b111001 + 0o55) + chr(0b1011 + 0o42) + '\070').join(M_LQH47d9rzN)
qo7_X6cEHUlM = xafqLlk3kkUe(SXOLrMavuUCe(b'\x17'), chr(100) + chr(0b1100101) + '\143' + chr(111) + chr(1772 - 1672) + chr(0b1100000 + 0o5))(chr(0b101000 + 0o115) + chr(0b1000100 + 0o60) + chr(7663 - 7561) + '\055' + chr(1032 - 976)).join(u0rTHIfiTyBf)
if yRtdT3hPVtzS != xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a'), chr(100) + chr(579 - 478) + chr(0b1100011) + chr(4879 - 4768) + chr(7343 - 7243) + chr(101))('\165' + chr(0b1110100) + '\x66' + '\x2d' + chr(0b101000 + 0o20)):
xafqLlk3kkUe(uyAR7jUe1VQb, xafqLlk3kkUe(SXOLrMavuUCe(b'Vy\x9c\x1b#\xae'), '\144' + chr(0b1100101) + chr(99) + '\x6f' + '\144' + chr(101))(chr(117) + '\164' + chr(0b100100 + 0o102) + chr(0b100110 + 0o7) + chr(0b111000)))([Kh2zvqANE92v, qo7_X6cEHUlM, yRtdT3hPVtzS])
xafqLlk3kkUe(ZS43hVvGhK4C, xafqLlk3kkUe(SXOLrMavuUCe(b'Te\x83\r('), chr(0b1100100) + '\x65' + '\143' + '\157' + '\x64' + '\x65')(chr(10963 - 10846) + chr(116) + chr(0b111111 + 0o47) + '\055' + '\070'))()
with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'pO\x85\x12('), chr(0b1010100 + 0o20) + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(4278 - 4178) + '\145')(chr(3241 - 3124) + '\x74' + '\146' + chr(45) + '\070'))(lTik7Tf5b4gY, xafqLlk3kkUe(SXOLrMavuUCe(b'@'), chr(0b1100100) + chr(0b1100101) + chr(4821 - 4722) + '\157' + chr(100) + chr(0b1100101))(chr(5663 - 5546) + '\x74' + '\x66' + chr(776 - 731) + chr(0b111000))) as EGyt1xfPT1P6:
for (Kh2zvqANE92v, qo7_X6cEHUlM, yRtdT3hPVtzS) in uyAR7jUe1VQb:
xafqLlk3kkUe(EGyt1xfPT1P6, xafqLlk3kkUe(SXOLrMavuUCe(b'@{\x85\n('), chr(0b1100001 + 0o3) + chr(0b101 + 0o140) + '\143' + '\x6f' + chr(0b1100100) + chr(0b10111 + 0o116))(chr(10844 - 10727) + '\164' + chr(102) + '\055' + chr(0b110011 + 0o5)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x12z\xe5[>\xc38^R'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(3415 - 3304) + chr(0b1 + 0o143) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(0b11001 + 0o37)) % (Kh2zvqANE92v, qo7_X6cEHUlM, yRtdT3hPVtzS))
if e80gRioCjdat:
with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'pO\x85\x12('), chr(0b1110 + 0o126) + chr(0b101 + 0o140) + chr(0b110011 + 0o60) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + '\x74' + chr(0b1111 + 0o127) + chr(45) + chr(0b110011 + 0o5)))(nDBLQgewY3Vl, xafqLlk3kkUe(SXOLrMavuUCe(b'@'), '\144' + chr(101) + chr(2635 - 2536) + chr(0b1101111) + chr(100) + '\145')(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(0b100100 + 0o11) + chr(56))) as EGyt1xfPT1P6:
for (Kh2zvqANE92v, qo7_X6cEHUlM, yRtdT3hPVtzS) in uyAR7jUe1VQb:
xafqLlk3kkUe(EGyt1xfPT1P6, xafqLlk3kkUe(SXOLrMavuUCe(b'@{\x85\n('), '\x64' + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b1001101 + 0o27) + '\145')('\165' + chr(0b10000 + 0o144) + chr(0b1010111 + 0o17) + '\x2d' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x12z\xcc[>\xc0'), chr(0b1100100) + '\145' + chr(0b100100 + 0o77) + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(9788 - 9671) + chr(0b10000 + 0o144) + chr(102) + '\x2d' + chr(0b111000)) % (Kh2zvqANE92v, qo7_X6cEHUlM))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/snli.py
|
_get_or_generate_vocab
|
def _get_or_generate_vocab(tmp_dir, vocab_filename, vocab_size):
"""Read or create vocabulary."""
vocab_filepath = os.path.join(tmp_dir, vocab_filename)
print('Vocab file written to: ' + vocab_filepath)
if tf.gfile.Exists(vocab_filepath):
gs = text_encoder.SubwordTextEncoder(vocab_filepath)
return gs
example_file = os.path.join(tmp_dir, _EXAMPLES_FILE)
gs = text_encoder.SubwordTextEncoder()
token_counts = tokenizer.corpus_token_counts(
example_file, corpus_max_lines=1000000)
gs = gs.build_to_target_size(
vocab_size, token_counts, min_val=1, max_val=1e3)
gs.store_to_file(vocab_filepath)
return gs
|
python
|
def _get_or_generate_vocab(tmp_dir, vocab_filename, vocab_size):
"""Read or create vocabulary."""
vocab_filepath = os.path.join(tmp_dir, vocab_filename)
print('Vocab file written to: ' + vocab_filepath)
if tf.gfile.Exists(vocab_filepath):
gs = text_encoder.SubwordTextEncoder(vocab_filepath)
return gs
example_file = os.path.join(tmp_dir, _EXAMPLES_FILE)
gs = text_encoder.SubwordTextEncoder()
token_counts = tokenizer.corpus_token_counts(
example_file, corpus_max_lines=1000000)
gs = gs.build_to_target_size(
vocab_size, token_counts, min_val=1, max_val=1e3)
gs.store_to_file(vocab_filepath)
return gs
|
[
"def",
"_get_or_generate_vocab",
"(",
"tmp_dir",
",",
"vocab_filename",
",",
"vocab_size",
")",
":",
"vocab_filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"vocab_filename",
")",
"print",
"(",
"'Vocab file written to: '",
"+",
"vocab_filepath",
")",
"if",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"vocab_filepath",
")",
":",
"gs",
"=",
"text_encoder",
".",
"SubwordTextEncoder",
"(",
"vocab_filepath",
")",
"return",
"gs",
"example_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"_EXAMPLES_FILE",
")",
"gs",
"=",
"text_encoder",
".",
"SubwordTextEncoder",
"(",
")",
"token_counts",
"=",
"tokenizer",
".",
"corpus_token_counts",
"(",
"example_file",
",",
"corpus_max_lines",
"=",
"1000000",
")",
"gs",
"=",
"gs",
".",
"build_to_target_size",
"(",
"vocab_size",
",",
"token_counts",
",",
"min_val",
"=",
"1",
",",
"max_val",
"=",
"1e3",
")",
"gs",
".",
"store_to_file",
"(",
"vocab_filepath",
")",
"return",
"gs"
] |
Read or create vocabulary.
|
[
"Read",
"or",
"create",
"vocabulary",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/snli.py#L131-L146
|
train
|
Read or create vocabulary.
|
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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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(0b100 + 0o153) + '\x32' + chr(51) + '\062', 32630 - 32622), ehT0Px3KOsy9('\x30' + chr(0b101110 + 0o101) + '\063' + '\065' + '\063', 61825 - 61817), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(7915 - 7804) + chr(725 - 675) + '\x33' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(362 - 313), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110110) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9841 - 9730) + chr(0b1101 + 0o44) + '\x32' + chr(0b110011), 46257 - 46249), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\063' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(10474 - 10363) + chr(0b110101) + chr(0b10001 + 0o37), 63110 - 63102), ehT0Px3KOsy9(chr(1820 - 1772) + chr(5043 - 4932) + chr(0b101 + 0o54) + chr(0b0 + 0o61) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + chr(0b111 + 0o54) + chr(51) + chr(0b110010), 47157 - 47149), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(0b11110 + 0o24) + '\062' + chr(985 - 935), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111100 + 0o63) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101 + 0o142) + chr(51) + chr(1906 - 1855) + chr(1278 - 1230), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(5354 - 5243) + '\063' + chr(52) + '\x33', 10828 - 10820), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x34' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + chr(10077 - 9966) + chr(2167 - 2116) + '\067' + chr(1602 - 1554), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\063' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(48) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(918 - 869) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b110011) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(5246 - 5135) + chr(50) + chr(0b110000) + chr(0b110101), 51547 - 51539), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(0b110010) + '\x36' + chr(0b101101 + 0o5), 21635 - 21627), ehT0Px3KOsy9(chr(1379 - 1331) + '\157' + chr(51) + chr(0b110101) + chr(1334 - 1281), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1001 + 0o52) + chr(0b10110 + 0o34) + chr(1777 - 1723), 0b1000), ehT0Px3KOsy9('\x30' + chr(11781 - 11670) + '\062' + chr(0b110000) + chr(49), 15757 - 15749), ehT0Px3KOsy9('\060' + '\157' + '\064' + chr(0b100011 + 0o21), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + chr(1414 - 1364) + chr(905 - 857) + chr(1159 - 1109), 56845 - 56837), ehT0Px3KOsy9(chr(48) + chr(1239 - 1128) + chr(149 - 99) + '\x32' + chr(1819 - 1766), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + '\x33' + chr(0b11011 + 0o32), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + chr(58 - 8) + chr(54) + chr(572 - 518), 35094 - 35086), ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + '\061' + chr(52) + chr(2244 - 2195), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b101111 + 0o3) + chr(0b11010 + 0o30), 50921 - 50913), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(53) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(11633 - 11522) + '\x31' + '\063' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1167 - 1116) + chr(1821 - 1773) + chr(0b101001 + 0o10), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8854 - 8743) + '\x32' + chr(53) + chr(853 - 801), 43673 - 43665), ehT0Px3KOsy9('\060' + '\157' + chr(2459 - 2409) + chr(1182 - 1131) + chr(2062 - 2008), 61603 - 61595), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + '\062' + chr(50) + chr(0b0 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001101 + 0o42) + '\062' + '\x36', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(9783 - 9672) + chr(0b10111 + 0o36) + chr(1373 - 1325), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4'), chr(6301 - 6201) + chr(4285 - 4184) + '\143' + '\157' + chr(100) + '\x65')(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(593 - 548) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def YMrVhxUN0cmJ(JsZ36NJUqtml, EwmY7ynOlhiF, CeyMIoSyrpkQ):
fZzpj6eSosQ9 = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, EwmY7ynOlhiF)
zLUzGokYBM2Z(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc\x84\xfex\x11s\xbbA#\xbf\xb2p\xaa\x8a\xd7\x8c\xbc)R\xef\xea\x88\xcd'), chr(100) + chr(0b1011110 + 0o7) + chr(0b1110 + 0o125) + chr(111) + '\144' + chr(101))(chr(0b1000010 + 0o63) + chr(0b1101 + 0o147) + '\x66' + chr(547 - 502) + '\x38') + fZzpj6eSosQ9)
if xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf\x93\xf4j\x07 '), chr(6628 - 6528) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(100) + chr(1951 - 1850))('\165' + chr(0b1101100 + 0o10) + chr(0b1100110) + chr(0b10110 + 0o27) + chr(0b100001 + 0o27)))(fZzpj6eSosQ9):
gae7UFz2w6XP = nCRDzZ_Is9fz.SubwordTextEncoder(fZzpj6eSosQ9)
return gae7UFz2w6XP
Jn7XIUeFJqKX = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, oqE7nakzHdwS)
gae7UFz2w6XP = nCRDzZ_Is9fz.SubwordTextEncoder()
rcKmA0XXnkeL = v6ZI_vRSLpRb.corpus_token_counts(Jn7XIUeFJqKX, corpus_max_lines=ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(54) + chr(0b100000 + 0o24) + chr(0b110001) + '\061' + '\060' + chr(0b110000), 0o10))
gae7UFz2w6XP = gae7UFz2w6XP.build_to_target_size(CeyMIoSyrpkQ, rcKmA0XXnkeL, min_val=ehT0Px3KOsy9(chr(48) + chr(0b111 + 0o150) + chr(0b100111 + 0o12), ord("\x08")), max_val=1000.0)
xafqLlk3kkUe(gae7UFz2w6XP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x9f\xf2k\x16\x0c\xa9G\x10\xbc\xfbk\xbd'), chr(0b1100100) + chr(0b1000010 + 0o43) + chr(0b1100011) + chr(11690 - 11579) + chr(4786 - 4686) + '\145')(chr(12128 - 12011) + chr(0b1110100) + chr(102) + '\055' + '\070'))(fZzpj6eSosQ9)
return gae7UFz2w6XP
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/snli.py
|
snli_token_generator
|
def snli_token_generator(tmp_dir, train, vocab_size):
"""Generate example dicts."""
_download_and_parse_dataset(tmp_dir, train)
symbolizer_vocab = _get_or_generate_vocab(
tmp_dir, 'vocab.subword_text_encoder', vocab_size)
file_name = 'train' if train else 'dev'
data_file = os.path.join(tmp_dir, file_name + '.txt')
with tf.gfile.GFile(data_file, mode='r') as f:
for line in f:
sent1, sent2, label = line.strip().split('\t')
sent1_enc = symbolizer_vocab.encode(sent1)
sent2_enc = symbolizer_vocab.encode(sent2)
inputs = sent1_enc + [_SEP] + sent2_enc + [_EOS]
yield {
'inputs': inputs,
'targets': [_LABEL_TO_ID[label]],
}
|
python
|
def snli_token_generator(tmp_dir, train, vocab_size):
"""Generate example dicts."""
_download_and_parse_dataset(tmp_dir, train)
symbolizer_vocab = _get_or_generate_vocab(
tmp_dir, 'vocab.subword_text_encoder', vocab_size)
file_name = 'train' if train else 'dev'
data_file = os.path.join(tmp_dir, file_name + '.txt')
with tf.gfile.GFile(data_file, mode='r') as f:
for line in f:
sent1, sent2, label = line.strip().split('\t')
sent1_enc = symbolizer_vocab.encode(sent1)
sent2_enc = symbolizer_vocab.encode(sent2)
inputs = sent1_enc + [_SEP] + sent2_enc + [_EOS]
yield {
'inputs': inputs,
'targets': [_LABEL_TO_ID[label]],
}
|
[
"def",
"snli_token_generator",
"(",
"tmp_dir",
",",
"train",
",",
"vocab_size",
")",
":",
"_download_and_parse_dataset",
"(",
"tmp_dir",
",",
"train",
")",
"symbolizer_vocab",
"=",
"_get_or_generate_vocab",
"(",
"tmp_dir",
",",
"'vocab.subword_text_encoder'",
",",
"vocab_size",
")",
"file_name",
"=",
"'train'",
"if",
"train",
"else",
"'dev'",
"data_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"file_name",
"+",
"'.txt'",
")",
"with",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"data_file",
",",
"mode",
"=",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"sent1",
",",
"sent2",
",",
"label",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
"'\\t'",
")",
"sent1_enc",
"=",
"symbolizer_vocab",
".",
"encode",
"(",
"sent1",
")",
"sent2_enc",
"=",
"symbolizer_vocab",
".",
"encode",
"(",
"sent2",
")",
"inputs",
"=",
"sent1_enc",
"+",
"[",
"_SEP",
"]",
"+",
"sent2_enc",
"+",
"[",
"_EOS",
"]",
"yield",
"{",
"'inputs'",
":",
"inputs",
",",
"'targets'",
":",
"[",
"_LABEL_TO_ID",
"[",
"label",
"]",
"]",
",",
"}"
] |
Generate example dicts.
|
[
"Generate",
"example",
"dicts",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/snli.py#L149-L168
|
train
|
Generate example dicts.
|
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('\x30' + '\x6f' + chr(54) + chr(0b1011 + 0o47), 28884 - 28876), ehT0Px3KOsy9(chr(203 - 155) + chr(0b1101111) + chr(2476 - 2426) + chr(0b110111) + chr(0b100100 + 0o20), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(53) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110111 + 0o70) + '\063' + '\063' + chr(1451 - 1401), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1435 - 1386) + chr(55) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + '\063' + chr(1032 - 983) + chr(136 - 85), 0o10), ehT0Px3KOsy9('\x30' + chr(4868 - 4757) + '\067' + '\060', 2529 - 2521), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1010 + 0o50), 58911 - 58903), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000 + 0o1) + chr(0b110101 + 0o0) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(5064 - 4953) + chr(0b111 + 0o54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9333 - 9222) + chr(0b0 + 0o62) + chr(51) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x35' + '\x32', 57085 - 57077), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(4005 - 3894) + chr(49) + chr(1988 - 1934) + chr(0b10000 + 0o45), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\x37' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\157' + '\x33' + '\067' + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(5064 - 4953) + '\x32' + chr(0b100011 + 0o15) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(3324 - 3213) + chr(2064 - 2014) + chr(427 - 376) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100011 + 0o14) + chr(0b11101 + 0o32) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000100 + 0o53) + chr(1532 - 1482) + chr(0b1000 + 0o52) + chr(0b110000), 39828 - 39820), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(67 - 16) + '\064' + chr(1665 - 1616), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\064' + chr(52), 27031 - 27023), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + '\x32' + chr(208 - 153) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + '\063' + chr(0b110010) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110 + 0o54) + chr(51) + chr(1263 - 1213), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\x35' + chr(50), 31391 - 31383), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(515 - 466) + chr(2009 - 1957), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(52) + chr(0b1110 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(704 - 656) + chr(0b1101111) + chr(0b110001) + '\063' + chr(0b111 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b110011 + 0o2) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b100010 + 0o115) + chr(0b110010) + chr(51) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(1077 - 966) + chr(1445 - 1396) + '\064' + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(54) + chr(0b100000 + 0o27), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37', 0o10), ehT0Px3KOsy9(chr(2145 - 2097) + chr(111) + '\063' + '\067' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + '\061' + chr(0b110110) + chr(53), 8), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(5088 - 4977) + '\x31' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b100011 + 0o23) + chr(55), 14143 - 14135), ehT0Px3KOsy9(chr(48) + chr(12164 - 12053) + '\062' + chr(0b110011) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(0b11110 + 0o25) + '\067' + chr(0b1111 + 0o50), 12655 - 12647)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b11000 + 0o35) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c'), chr(0b1100100) + chr(9182 - 9081) + chr(99) + '\x6f' + chr(0b1100100) + '\145')(chr(11952 - 11835) + chr(0b1110100) + chr(7484 - 7382) + '\055' + chr(3103 - 3047)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def it0VFi_dNnKW(JsZ36NJUqtml, e80gRioCjdat, CeyMIoSyrpkQ):
tsVesCbts1qo(JsZ36NJUqtml, e80gRioCjdat)
cHuUAX6kKm1M = YMrVhxUN0cmJ(JsZ36NJUqtml, xafqLlk3kkUe(SXOLrMavuUCe(b'D\xd3\x8c\xbbpQ\xb8M`\x18s\xeaN*\x8d\x9b\xfa\xeff\xf5\x8fG\xd4\xb2\xff\x18'), '\144' + chr(0b101101 + 0o70) + '\x63' + chr(0b100100 + 0o113) + chr(100) + chr(101))(chr(612 - 495) + chr(116) + chr(0b10110 + 0o120) + '\055' + '\x38'), CeyMIoSyrpkQ)
OK327sCYstzB = xafqLlk3kkUe(SXOLrMavuUCe(b'F\xce\x8e\xb3|'), chr(0b1100100) + chr(6790 - 6689) + chr(5097 - 4998) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56)) if e80gRioCjdat else xafqLlk3kkUe(SXOLrMavuUCe(b'V\xd9\x99'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(0b1001011 + 0o31) + '\x65')(chr(117) + chr(0b1110100) + chr(5949 - 5847) + '\x2d' + chr(0b1 + 0o67))
CRm8xD274Xgy = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, OK327sCYstzB + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xc8\x97\xae'), chr(0b1100100) + '\145' + chr(99) + chr(111) + chr(100) + chr(0b11001 + 0o114))(chr(117) + '\164' + chr(0b1011000 + 0o16) + chr(45) + chr(2823 - 2767)))
with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'u\xfa\x86\xb6w'), '\144' + '\145' + chr(6274 - 6175) + chr(0b1000000 + 0o57) + chr(100) + chr(7594 - 7493))('\x75' + chr(0b1110100) + chr(102) + chr(1200 - 1155) + chr(0b110001 + 0o7)))(CRm8xD274Xgy, mode=xafqLlk3kkUe(SXOLrMavuUCe(b'@'), chr(0b101100 + 0o70) + chr(5859 - 5758) + chr(0b1100011) + chr(6536 - 6425) + chr(0b1011101 + 0o7) + chr(0b1100101))(chr(0b100 + 0o161) + chr(5400 - 5284) + chr(2400 - 2298) + '\x2d' + chr(0b111000))) as EGyt1xfPT1P6:
for LycYkDpyelF6 in EGyt1xfPT1P6:
(kcaobXrqhWdB, _yMNqgcbsknG, TRUOLFLuD08x) = LycYkDpyelF6.strip().split(xafqLlk3kkUe(SXOLrMavuUCe(b';'), chr(100) + '\145' + chr(0b1100011) + '\157' + chr(100) + chr(0b1000010 + 0o43))(chr(0b1110101) + chr(0b1110100) + chr(6844 - 6742) + chr(0b101101) + '\x38'))
Ax6NcWE4gi60 = cHuUAX6kKm1M.encode(kcaobXrqhWdB)
M9nXSFTDmV5S = cHuUAX6kKm1M.encode(_yMNqgcbsknG)
vXoupepMtCXU = Ax6NcWE4gi60 + [M0Yd7D3zH7qv] + M9nXSFTDmV5S + [e97590bNB0ed]
yield {xafqLlk3kkUe(SXOLrMavuUCe(b'[\xd2\x9f\xaff\x0c'), '\x64' + '\145' + '\143' + chr(0b1101111) + chr(0b101111 + 0o65) + chr(0b1100 + 0o131))(chr(7533 - 7416) + '\x74' + '\146' + '\055' + '\x38'): vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'F\xdd\x9d\xbdw\x0b\xb8'), chr(0b1100100) + chr(2556 - 2455) + chr(0b1011110 + 0o5) + '\x6f' + chr(1960 - 1860) + '\x65')(chr(117) + chr(0b1110100) + chr(0b11 + 0o143) + chr(0b10010 + 0o33) + chr(0b1111 + 0o51)): [uaWBujVqgrjp[TRUOLFLuD08x]]}
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/wikisum/get_references_web_single_group.py
|
shard
|
def shard(items, num_shards):
"""Split items into num_shards groups."""
sharded = []
num_per_shard = len(items) // num_shards
start = 0
for _ in range(num_shards):
sharded.append(items[start:start + num_per_shard])
start += num_per_shard
remainder = len(items) % num_shards
start = len(items) - remainder
for i in range(remainder):
sharded[i].append(items[start + i])
assert sum([len(fs) for fs in sharded]) == len(items)
return sharded
|
python
|
def shard(items, num_shards):
"""Split items into num_shards groups."""
sharded = []
num_per_shard = len(items) // num_shards
start = 0
for _ in range(num_shards):
sharded.append(items[start:start + num_per_shard])
start += num_per_shard
remainder = len(items) % num_shards
start = len(items) - remainder
for i in range(remainder):
sharded[i].append(items[start + i])
assert sum([len(fs) for fs in sharded]) == len(items)
return sharded
|
[
"def",
"shard",
"(",
"items",
",",
"num_shards",
")",
":",
"sharded",
"=",
"[",
"]",
"num_per_shard",
"=",
"len",
"(",
"items",
")",
"//",
"num_shards",
"start",
"=",
"0",
"for",
"_",
"in",
"range",
"(",
"num_shards",
")",
":",
"sharded",
".",
"append",
"(",
"items",
"[",
"start",
":",
"start",
"+",
"num_per_shard",
"]",
")",
"start",
"+=",
"num_per_shard",
"remainder",
"=",
"len",
"(",
"items",
")",
"%",
"num_shards",
"start",
"=",
"len",
"(",
"items",
")",
"-",
"remainder",
"for",
"i",
"in",
"range",
"(",
"remainder",
")",
":",
"sharded",
"[",
"i",
"]",
".",
"append",
"(",
"items",
"[",
"start",
"+",
"i",
"]",
")",
"assert",
"sum",
"(",
"[",
"len",
"(",
"fs",
")",
"for",
"fs",
"in",
"sharded",
"]",
")",
"==",
"len",
"(",
"items",
")",
"return",
"sharded"
] |
Split items into num_shards groups.
|
[
"Split",
"items",
"into",
"num_shards",
"groups",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/wikisum/get_references_web_single_group.py#L87-L102
|
train
|
Split items into num_shards groups.
|
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,_bik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aIaWE,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(55 - 7) + chr(0b110101 + 0o72) + chr(0b110001) + '\x33' + chr(0b11000 + 0o34), 2787 - 2779), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110100) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + '\063' + '\x36' + '\x35', 31601 - 31593), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(50) + chr(1607 - 1557), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(2357 - 2308) + '\x31' + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(52) + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(5649 - 5538) + chr(51) + chr(55) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(51) + chr(1081 - 1031), 19132 - 19124), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(0b110 + 0o55) + chr(49), 57636 - 57628), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\061' + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(0b110011 + 0o74) + '\066' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\060' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\064' + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110 + 0o151) + chr(55) + chr(55), 13702 - 13694), ehT0Px3KOsy9('\x30' + chr(5626 - 5515) + chr(781 - 731) + chr(1881 - 1826) + chr(1591 - 1539), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8450 - 8339) + chr(0b10111 + 0o32) + chr(0b101110 + 0o11), 30787 - 30779), ehT0Px3KOsy9(chr(2054 - 2006) + chr(0b1100110 + 0o11) + chr(579 - 528) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110 + 0o53) + '\x33' + chr(726 - 671), 11536 - 11528), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2118 - 2068) + chr(50) + chr(2299 - 2245), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(1828 - 1780) + '\157' + chr(0b100 + 0o56) + '\066' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b111 + 0o52) + chr(0b110011) + chr(1234 - 1182), 8), ehT0Px3KOsy9('\060' + chr(4419 - 4308) + '\066' + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(623 - 575) + chr(8770 - 8659) + chr(133 - 82) + chr(967 - 918) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b110100) + '\x34', 0b1000), ehT0Px3KOsy9(chr(2071 - 2023) + chr(111) + '\063' + '\x37' + chr(1554 - 1506), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b100000 + 0o25) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(495 - 446) + '\063' + chr(2014 - 1960), ord("\x08")), ehT0Px3KOsy9(chr(213 - 165) + chr(7652 - 7541) + chr(54) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110100) + chr(0b11000 + 0o30), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(0b110 + 0o53) + chr(574 - 521) + chr(53), 4831 - 4823), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b10011 + 0o41) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(5309 - 5198) + '\x32' + chr(50) + chr(0b111 + 0o57), 8), ehT0Px3KOsy9(chr(776 - 728) + '\157' + chr(1968 - 1917) + chr(1306 - 1257) + chr(358 - 305), 6664 - 6656), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\066' + chr(0b1000 + 0o54), 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(6796 - 6685) + chr(321 - 268) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1735 - 1624) + '\062' + chr(2751 - 2697) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101000 + 0o13) + chr(0b110100) + chr(0b10001 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(0b110100) + chr(0b110001), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + chr(0b10 + 0o56), 30800 - 30792)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'r'), chr(100) + chr(0b111 + 0o136) + chr(99) + chr(111) + chr(9801 - 9701) + chr(0b110111 + 0o56))(chr(0b1110101) + '\164' + '\x66' + chr(0b1100 + 0o41) + chr(2050 - 1994)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def pn2mJYbTTPyv(NzveIZ3IlSH9, WJU3qUPk_Uro):
M1YHIKMxknQu = []
LZ34lTZ6llgS = c2A0yzQpDQB3(NzveIZ3IlSH9) // WJU3qUPk_Uro
avRbFsnfJxQj = ehT0Px3KOsy9(chr(1564 - 1516) + chr(9529 - 9418) + '\x30', 0o10)
for VNGQdHSFPrso in vQr8gNKaIaWE(WJU3qUPk_Uro):
xafqLlk3kkUe(M1YHIKMxknQu, xafqLlk3kkUe(SXOLrMavuUCe(b'=\xd7\x85\xf7 \xc3'), '\144' + chr(0b110000 + 0o65) + '\x63' + chr(111) + '\144' + chr(5241 - 5140))(chr(0b1110101) + chr(0b1110100) + chr(0b1010111 + 0o17) + '\055' + '\x38'))(NzveIZ3IlSH9[avRbFsnfJxQj:avRbFsnfJxQj + LZ34lTZ6llgS])
avRbFsnfJxQj += LZ34lTZ6llgS
H4A5NixHRl2l = c2A0yzQpDQB3(NzveIZ3IlSH9) % WJU3qUPk_Uro
avRbFsnfJxQj = c2A0yzQpDQB3(NzveIZ3IlSH9) - H4A5NixHRl2l
for WVxHKyX45z_L in vQr8gNKaIaWE(H4A5NixHRl2l):
xafqLlk3kkUe(M1YHIKMxknQu[WVxHKyX45z_L], xafqLlk3kkUe(SXOLrMavuUCe(b'=\xd7\x85\xf7 \xc3'), chr(0b1100100) + chr(9556 - 9455) + chr(99) + '\x6f' + chr(6665 - 6565) + chr(7212 - 7111))(chr(0b1110101) + chr(0b100100 + 0o120) + chr(102) + '\x2d' + chr(0b111000)))(NzveIZ3IlSH9[avRbFsnfJxQj + WVxHKyX45z_L])
assert xkxBmo49x2An([c2A0yzQpDQB3(jkwf8u192XHr) for jkwf8u192XHr in M1YHIKMxknQu]) == c2A0yzQpDQB3(NzveIZ3IlSH9)
return M1YHIKMxknQu
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
RandomNormalInitializer
|
def RandomNormalInitializer(stddev=1e-2):
"""An initializer function for random normal coefficients."""
def init(shape, rng):
return (stddev * backend.random.normal(rng, shape)).astype('float32')
return init
|
python
|
def RandomNormalInitializer(stddev=1e-2):
"""An initializer function for random normal coefficients."""
def init(shape, rng):
return (stddev * backend.random.normal(rng, shape)).astype('float32')
return init
|
[
"def",
"RandomNormalInitializer",
"(",
"stddev",
"=",
"1e-2",
")",
":",
"def",
"init",
"(",
"shape",
",",
"rng",
")",
":",
"return",
"(",
"stddev",
"*",
"backend",
".",
"random",
".",
"normal",
"(",
"rng",
",",
"shape",
")",
")",
".",
"astype",
"(",
"'float32'",
")",
"return",
"init"
] |
An initializer function for random normal coefficients.
|
[
"An",
"initializer",
"function",
"for",
"random",
"normal",
"coefficients",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L42-L46
|
train
|
An initializer function for random normal coefficients.
|
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,pz9Flf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BM2Z,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(111) + '\x31' + chr(53) + chr(52), 40045 - 40037), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b1010 + 0o55) + chr(927 - 877), 5960 - 5952), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11 + 0o60) + chr(0b110101) + chr(1433 - 1382), 0b1000), ehT0Px3KOsy9('\x30' + chr(6922 - 6811) + '\x31' + chr(2164 - 2110) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(846 - 798) + '\157' + '\x34' + chr(0b10001 + 0o45), 0o10), ehT0Px3KOsy9(chr(48) + chr(8915 - 8804) + chr(0b11001 + 0o32) + chr(52) + '\063', 0b1000), ehT0Px3KOsy9(chr(1186 - 1138) + '\x6f' + chr(0b110011) + chr(51) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + '\x32' + chr(51) + chr(542 - 494), ord("\x08")), ehT0Px3KOsy9(chr(1192 - 1144) + chr(0b10 + 0o155) + chr(486 - 436) + '\x36' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x35' + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1570 - 1519) + chr(57 - 7) + chr(0b110 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(336 - 287) + chr(0b100001 + 0o26) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b110010) + '\063', 0o10), ehT0Px3KOsy9(chr(1103 - 1055) + chr(8292 - 8181) + chr(0b1111 + 0o46) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1899 - 1848) + chr(1525 - 1471) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10011 + 0o36) + '\061' + chr(2023 - 1970), 0o10), ehT0Px3KOsy9('\x30' + chr(9113 - 9002) + chr(0b10010 + 0o40) + chr(0b110101) + chr(1454 - 1404), 0b1000), ehT0Px3KOsy9(chr(275 - 227) + chr(11227 - 11116) + chr(232 - 182) + chr(55) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101101 + 0o2) + '\062' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\064' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\067' + chr(0b100000 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101110 + 0o1) + chr(0b11001 + 0o36) + '\x34', 0o10), ehT0Px3KOsy9(chr(115 - 67) + chr(111) + chr(0b1 + 0o62) + chr(0b100100 + 0o14) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(48) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(0b101100 + 0o6) + chr(1745 - 1697) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + '\062' + chr(0b110111) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1465 - 1416) + '\063', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + '\x31' + chr(0b100111 + 0o17) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110100) + chr(1590 - 1540), ord("\x08")), ehT0Px3KOsy9(chr(673 - 625) + '\157' + chr(0b110001) + chr(1379 - 1326), 0b1000), ehT0Px3KOsy9(chr(1294 - 1246) + chr(111) + chr(1305 - 1255) + '\065' + chr(0b11110 + 0o24), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(50) + chr(53) + chr(55), 60890 - 60882), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(0b110010) + chr(232 - 179) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2011 - 1957), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(0b110010) + '\x37' + chr(701 - 652), ord("\x08")), ehT0Px3KOsy9(chr(475 - 427) + '\x6f' + chr(0b10100 + 0o37) + chr(167 - 114), 0b1000), ehT0Px3KOsy9('\060' + chr(9747 - 9636) + chr(454 - 405) + chr(1183 - 1131) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(478 - 430) + chr(111) + '\061' + chr(544 - 493) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(1861 - 1809) + '\x31', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(139 - 91) + chr(1937 - 1826) + chr(2767 - 2714) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'B'), chr(0b110101 + 0o57) + chr(0b11110 + 0o107) + chr(0b1100011) + chr(0b11011 + 0o124) + '\x64' + chr(7923 - 7822))('\x75' + '\164' + '\x66' + chr(0b10 + 0o53) + chr(1693 - 1637)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Vvq0Pu9EBwC3(D1riUsWffEJl=0.01):
def A5GIpkDsgP4U(nauYfLglTpcb, OKPXzuZwN61O):
return xafqLlk3kkUe(D1riUsWffEJl * bwojgsUvRJpy.random.normal(OKPXzuZwN61O, nauYfLglTpcb), xafqLlk3kkUe(SXOLrMavuUCe(b'\r\t\x9f\x0bV\x86'), '\x64' + chr(101) + chr(3367 - 3268) + chr(111) + chr(8158 - 8058) + chr(2605 - 2504))(chr(1585 - 1468) + chr(0b111101 + 0o67) + chr(102) + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\n\x16\x84\x13R\xd0\xeb'), '\x64' + chr(101) + chr(8221 - 8122) + chr(8348 - 8237) + chr(0b0 + 0o144) + chr(101))(chr(117) + '\x74' + chr(102) + chr(0b101101) + chr(0b111000)))
return A5GIpkDsgP4U
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
GlorotNormalInitializer
|
def GlorotNormalInitializer(out_dim=0, in_dim=1, scale=onp.sqrt(2)):
"""An initializer function for random Glorot-scaled coefficients."""
def init(shape, rng):
fan_in, fan_out = shape[in_dim], shape[out_dim]
size = onp.prod(onp.delete(shape, [in_dim, out_dim]))
std = scale / np.sqrt((fan_in + fan_out) / 2. * size)
return (std * backend.random.normal(rng, shape)).astype('float32')
return init
|
python
|
def GlorotNormalInitializer(out_dim=0, in_dim=1, scale=onp.sqrt(2)):
"""An initializer function for random Glorot-scaled coefficients."""
def init(shape, rng):
fan_in, fan_out = shape[in_dim], shape[out_dim]
size = onp.prod(onp.delete(shape, [in_dim, out_dim]))
std = scale / np.sqrt((fan_in + fan_out) / 2. * size)
return (std * backend.random.normal(rng, shape)).astype('float32')
return init
|
[
"def",
"GlorotNormalInitializer",
"(",
"out_dim",
"=",
"0",
",",
"in_dim",
"=",
"1",
",",
"scale",
"=",
"onp",
".",
"sqrt",
"(",
"2",
")",
")",
":",
"def",
"init",
"(",
"shape",
",",
"rng",
")",
":",
"fan_in",
",",
"fan_out",
"=",
"shape",
"[",
"in_dim",
"]",
",",
"shape",
"[",
"out_dim",
"]",
"size",
"=",
"onp",
".",
"prod",
"(",
"onp",
".",
"delete",
"(",
"shape",
",",
"[",
"in_dim",
",",
"out_dim",
"]",
")",
")",
"std",
"=",
"scale",
"/",
"np",
".",
"sqrt",
"(",
"(",
"fan_in",
"+",
"fan_out",
")",
"/",
"2.",
"*",
"size",
")",
"return",
"(",
"std",
"*",
"backend",
".",
"random",
".",
"normal",
"(",
"rng",
",",
"shape",
")",
")",
".",
"astype",
"(",
"'float32'",
")",
"return",
"init"
] |
An initializer function for random Glorot-scaled coefficients.
|
[
"An",
"initializer",
"function",
"for",
"random",
"Glorot",
"-",
"scaled",
"coefficients",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L49-L56
|
train
|
An initializer function for random Glorot - scaled coefficients.
|
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,OTstrxJf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4lf,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(0b11110 + 0o22) + chr(0b1000100 + 0o53) + '\061' + chr(53), 19691 - 19683), ehT0Px3KOsy9('\x30' + chr(6963 - 6852) + chr(2311 - 2262) + chr(873 - 821) + chr(0b110110 + 0o0), 22889 - 22881), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + '\064' + chr(895 - 843), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(0b10110 + 0o35) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(7439 - 7328) + chr(0b110011) + chr(0b100011 + 0o21) + chr(1434 - 1382), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11737 - 11626) + chr(51) + chr(0b110100) + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b11000 + 0o36) + chr(0b101001 + 0o7), 21993 - 21985), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b10 + 0o65) + chr(0b110010), 21125 - 21117), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b110100) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(5454 - 5343) + chr(0b1000 + 0o52) + chr(0b110101) + '\065', 50917 - 50909), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\x32' + chr(2547 - 2492) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(64 - 16) + chr(0b1101111) + chr(49) + '\x36' + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(146 - 97) + '\064' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\064' + chr(54), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(682 - 632) + chr(75 - 21) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101 + 0o54) + chr(0b1000 + 0o56) + chr(0b101011 + 0o7), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(1153 - 1102) + '\066' + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101101 + 0o2) + chr(445 - 395) + chr(1841 - 1791) + chr(1398 - 1346), 36256 - 36248), ehT0Px3KOsy9('\060' + chr(11875 - 11764) + chr(0b10010 + 0o40) + chr(322 - 273) + chr(52), 59356 - 59348), ehT0Px3KOsy9(chr(291 - 243) + chr(0b1001111 + 0o40) + '\x31' + chr(0b110001) + chr(0b11101 + 0o25), 63093 - 63085), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2363 - 2308) + chr(0b110010), 47310 - 47302), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(2289 - 2239) + chr(470 - 422), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5664 - 5553) + chr(1154 - 1105) + chr(0b11000 + 0o34) + chr(55), 47154 - 47146), ehT0Px3KOsy9('\x30' + '\157' + '\065' + chr(0b11011 + 0o30), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x34' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b101100 + 0o10) + chr(2416 - 2365), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b10011 + 0o44) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(0b110011) + chr(0b100000 + 0o26) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1081 - 1032) + chr(50) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + chr(0b101011 + 0o6) + chr(2359 - 2304) + chr(53), 25488 - 25480), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100110 + 0o15) + chr(0b110111) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b110000 + 0o1) + '\x37', 44648 - 44640), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110010) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\x32' + '\x35' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\066' + chr(0b11001 + 0o32), 0o10), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + '\062' + '\064' + chr(51), 8), ehT0Px3KOsy9('\x30' + chr(0b1011100 + 0o23) + chr(50) + chr(0b100010 + 0o25) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101100 + 0o7) + chr(0b110000) + chr(51), 0o10), ehT0Px3KOsy9(chr(882 - 834) + chr(9372 - 9261) + '\061' + chr(50) + chr(0b110111), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b110101) + chr(0b1110 + 0o42), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'#'), '\x64' + chr(0b1 + 0o144) + chr(0b1001000 + 0o33) + chr(0b1101111) + chr(2765 - 2665) + '\x65')('\x75' + '\164' + '\146' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def LOWPVrzZLWRA(Zc8z0oj6o037=ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(0b101110 + 0o2), ord("\x08")), Nn8AAiiVwU2r=ehT0Px3KOsy9('\x30' + '\157' + chr(1740 - 1691), 0b1000), xjPLimsZRgb9=xafqLlk3kkUe(E84IQ9WvC5Je, xafqLlk3kkUe(SXOLrMavuUCe(b'~\x17\xd6i'), '\x64' + chr(101) + '\143' + chr(11857 - 11746) + '\144' + '\145')('\165' + chr(116) + '\x66' + chr(0b101101) + chr(154 - 98)))(ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1679 - 1629), 29548 - 29540))):
def A5GIpkDsgP4U(nauYfLglTpcb, OKPXzuZwN61O):
(kYjP5QHf1hbW, U9oyJbhKVteb) = (nauYfLglTpcb[Nn8AAiiVwU2r], nauYfLglTpcb[Zc8z0oj6o037])
NLcc3BCJnQka = E84IQ9WvC5Je.lBYk79l4Nk8h(E84IQ9WvC5Je.delete(nauYfLglTpcb, [Nn8AAiiVwU2r, Zc8z0oj6o037]))
o3E_VFExiNOk = xjPLimsZRgb9 / WqUC3KWvYVup.sqrt((kYjP5QHf1hbW + U9oyJbhKVteb) / 2.0 * NLcc3BCJnQka)
return xafqLlk3kkUe(o3E_VFExiNOk * bwojgsUvRJpy.random.normal(OKPXzuZwN61O, nauYfLglTpcb), xafqLlk3kkUe(SXOLrMavuUCe(b'l\x15\xd0d\x94\x83'), chr(0b1100100) + chr(6635 - 6534) + chr(0b1111 + 0o124) + chr(0b1101111) + chr(5899 - 5799) + chr(101))(chr(13360 - 13243) + chr(0b1110100) + chr(0b10110 + 0o120) + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'k\n\xcb|\x90\xd5\x82'), chr(100) + chr(0b1100101) + '\x63' + '\x6f' + chr(1279 - 1179) + chr(0b1100101))(chr(0b1110101) + '\164' + '\x66' + chr(0b100 + 0o51) + chr(0b110010 + 0o6)))
return A5GIpkDsgP4U
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
GlorotUniformInitializer
|
def GlorotUniformInitializer(out_dim=0, in_dim=1):
"""An initializer function for random uniform Glorot-scaled coefficients."""
def init(shape, rng):
fan_in, fan_out = shape[in_dim], shape[out_dim]
std = np.sqrt(2.0 / (fan_in + fan_out))
a = np.sqrt(3.0) * std
return backend.random.uniform(rng, shape, minval=-a, maxval=a)
return init
|
python
|
def GlorotUniformInitializer(out_dim=0, in_dim=1):
"""An initializer function for random uniform Glorot-scaled coefficients."""
def init(shape, rng):
fan_in, fan_out = shape[in_dim], shape[out_dim]
std = np.sqrt(2.0 / (fan_in + fan_out))
a = np.sqrt(3.0) * std
return backend.random.uniform(rng, shape, minval=-a, maxval=a)
return init
|
[
"def",
"GlorotUniformInitializer",
"(",
"out_dim",
"=",
"0",
",",
"in_dim",
"=",
"1",
")",
":",
"def",
"init",
"(",
"shape",
",",
"rng",
")",
":",
"fan_in",
",",
"fan_out",
"=",
"shape",
"[",
"in_dim",
"]",
",",
"shape",
"[",
"out_dim",
"]",
"std",
"=",
"np",
".",
"sqrt",
"(",
"2.0",
"/",
"(",
"fan_in",
"+",
"fan_out",
")",
")",
"a",
"=",
"np",
".",
"sqrt",
"(",
"3.0",
")",
"*",
"std",
"return",
"backend",
".",
"random",
".",
"uniform",
"(",
"rng",
",",
"shape",
",",
"minval",
"=",
"-",
"a",
",",
"maxval",
"=",
"a",
")",
"return",
"init"
] |
An initializer function for random uniform Glorot-scaled coefficients.
|
[
"An",
"initializer",
"function",
"for",
"random",
"uniform",
"Glorot",
"-",
"scaled",
"coefficients",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L59-L66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ZYzwAeSQh7N,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(2284 - 2234) + chr(0b101110 + 0o3) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\x30' + chr(1182 - 1128), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000000 + 0o57) + '\x32' + chr(1500 - 1450), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(1076 - 1023), 64626 - 64618), ehT0Px3KOsy9('\x30' + chr(1501 - 1390) + chr(2177 - 2126) + '\065' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100011 + 0o20) + chr(0b100 + 0o63) + chr(2379 - 2330), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\063' + chr(0b100001 + 0o17) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(121 - 73) + chr(111) + '\063' + chr(0b1000 + 0o51) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + '\062' + chr(1711 - 1660) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + '\061' + chr(1187 - 1136), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\067' + chr(0b100 + 0o55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110011 + 0o2) + '\060', 38366 - 38358), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\064' + '\066', 0o10), ehT0Px3KOsy9(chr(1730 - 1682) + chr(111) + chr(1682 - 1631) + chr(0b110101) + '\x33', 37945 - 37937), ehT0Px3KOsy9(chr(1018 - 970) + chr(0b100000 + 0o117) + chr(49) + chr(0b110110) + chr(0b110110), 23899 - 23891), ehT0Px3KOsy9(chr(0b110000) + chr(0b10000 + 0o137) + '\062' + chr(0b101110 + 0o10) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + '\066' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1268 - 1220) + '\157' + '\061' + chr(0b110011) + chr(0b100011 + 0o20), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1194 - 1141), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(0b100 + 0o63) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(739 - 690) + chr(0b101101 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b1010 + 0o46) + '\067', 47408 - 47400), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49), 14271 - 14263), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b11010 + 0o26) + '\x35', 59629 - 59621), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11010 + 0o27) + '\066' + '\x37', 49086 - 49078), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\x32' + '\061', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b100 + 0o56) + '\062', 49863 - 49855), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x31' + '\x35', 8475 - 8467), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(55) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10011 + 0o35), 0b1000), ehT0Px3KOsy9('\060' + chr(4413 - 4302) + chr(0b11000 + 0o37) + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x37' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(369 - 316) + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b110011) + chr(0b110111), 17305 - 17297), ehT0Px3KOsy9(chr(159 - 111) + chr(1195 - 1084) + chr(0b101101 + 0o6) + chr(0b110001) + chr(0b110011), 55940 - 55932), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(2462 - 2407) + '\060', 19133 - 19125), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b11110 + 0o27) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1311 - 1263) + chr(0b1101111) + '\x32' + chr(2265 - 2212), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\065' + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3'), '\x64' + chr(101) + chr(6191 - 6092) + '\157' + '\144' + chr(2178 - 2077))(chr(1119 - 1002) + chr(409 - 293) + '\x66' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def R0YlpnIRUeZ4(Zc8z0oj6o037=ehT0Px3KOsy9('\060' + chr(0b100001 + 0o116) + chr(48), 8), Nn8AAiiVwU2r=ehT0Px3KOsy9('\x30' + chr(111) + '\061', 8)):
def A5GIpkDsgP4U(nauYfLglTpcb, OKPXzuZwN61O):
(kYjP5QHf1hbW, U9oyJbhKVteb) = (nauYfLglTpcb[Nn8AAiiVwU2r], nauYfLglTpcb[Zc8z0oj6o037])
o3E_VFExiNOk = WqUC3KWvYVup.sqrt(2.0 / (kYjP5QHf1hbW + U9oyJbhKVteb))
XPh1qbAgrPgG = WqUC3KWvYVup.sqrt(3.0) * o3E_VFExiNOk
return xafqLlk3kkUe(bwojgsUvRJpy.random, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8({k\x81\x8b\xaf'), '\x64' + chr(5875 - 5774) + chr(99) + chr(5845 - 5734) + '\144' + chr(5089 - 4988))('\x75' + chr(0b1110100) + '\146' + '\055' + chr(56)))(OKPXzuZwN61O, nauYfLglTpcb, minval=-XPh1qbAgrPgG, maxval=XPh1qbAgrPgG)
return A5GIpkDsgP4U
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
one_hot
|
def one_hot(x, size, dtype=np.float32):
"""Make a n+1 dim one-hot array from n dim int-categorical array."""
return np.array(x[..., np.newaxis] == np.arange(size), dtype)
|
python
|
def one_hot(x, size, dtype=np.float32):
"""Make a n+1 dim one-hot array from n dim int-categorical array."""
return np.array(x[..., np.newaxis] == np.arange(size), dtype)
|
[
"def",
"one_hot",
"(",
"x",
",",
"size",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
":",
"return",
"np",
".",
"array",
"(",
"x",
"[",
"...",
",",
"np",
".",
"newaxis",
"]",
"==",
"np",
".",
"arange",
"(",
"size",
")",
",",
"dtype",
")"
] |
Make a n+1 dim one-hot array from n dim int-categorical array.
|
[
"Make",
"a",
"n",
"+",
"1",
"dim",
"one",
"-",
"hot",
"array",
"from",
"n",
"dim",
"int",
"-",
"categorical",
"array",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L69-L71
|
train
|
Make a n + 1 dim one - hot array from n dim int - categorical array.
|
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,o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voPw8ep3k,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' + chr(0b1101111) + chr(0b1000 + 0o53) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1823 - 1775) + chr(111) + '\061' + chr(1075 - 1023) + chr(1111 - 1062), 0b1000), ehT0Px3KOsy9('\x30' + chr(9686 - 9575) + chr(0b110010) + chr(379 - 331) + '\061', 26799 - 26791), ehT0Px3KOsy9('\060' + chr(10823 - 10712) + '\062' + chr(55) + chr(1460 - 1407), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x30' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(1485 - 1431) + chr(2092 - 2040), 0o10), ehT0Px3KOsy9(chr(48) + chr(7660 - 7549) + chr(49) + chr(0b100 + 0o60) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110111) + chr(1030 - 982), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100101 + 0o112) + chr(602 - 553) + '\066' + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b111 + 0o52), 0o10), ehT0Px3KOsy9(chr(897 - 849) + chr(111) + chr(0b101110 + 0o3) + '\062' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(217 - 169) + chr(6746 - 6635) + chr(693 - 640), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(2215 - 2166) + chr(806 - 758) + chr(0b110000 + 0o0), 37101 - 37093), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + '\x33' + '\061', 8), ehT0Px3KOsy9(chr(1936 - 1888) + chr(2776 - 2665) + '\x32' + chr(0b110100) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + chr(1281 - 1231) + chr(1351 - 1302) + chr(0b1110 + 0o46), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b1011 + 0o51), 0o10), ehT0Px3KOsy9(chr(1810 - 1762) + '\157' + chr(55), 12484 - 12476), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b110001) + '\065', 58645 - 58637), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b110111) + chr(0b11101 + 0o27), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\066' + chr(0b100110 + 0o15), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\062', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9(chr(502 - 454) + chr(0b110 + 0o151) + chr(532 - 483) + chr(49), 8), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + chr(0b110010) + chr(0b110 + 0o53) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(358 - 307) + chr(0b110010) + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1343 - 1292) + chr(228 - 176), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(0b110011) + '\x32' + '\066', 8), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\x32' + chr(0b110011), 57294 - 57286), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(49) + '\060', 8), ehT0Px3KOsy9(chr(2290 - 2242) + chr(0b1101111) + chr(49) + chr(0b110011) + chr(51), 63620 - 63612), ehT0Px3KOsy9(chr(48) + '\157' + chr(890 - 840), 31891 - 31883), ehT0Px3KOsy9(chr(400 - 352) + chr(0b1101111) + chr(0b10101 + 0o37), 0b1000), ehT0Px3KOsy9(chr(869 - 821) + chr(0b1101111) + '\063' + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101010 + 0o105) + chr(50) + chr(805 - 756) + chr(0b11110 + 0o31), 0b1000), ehT0Px3KOsy9(chr(48) + chr(2686 - 2575) + chr(1494 - 1441) + '\061', 7647 - 7639), ehT0Px3KOsy9(chr(1880 - 1832) + chr(9075 - 8964) + '\x33' + chr(53) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110001), 19284 - 19276), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10110 + 0o37) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(2620 - 2509) + chr(1320 - 1270) + chr(0b1001 + 0o56) + chr(54), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(661 - 608) + chr(861 - 813), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'7'), '\144' + '\x65' + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\x65')(chr(117) + chr(0b1110100) + chr(0b1100110 + 0o0) + chr(0b101101) + chr(984 - 928)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Hq3fv4Yp0EhD(OeWW0F1dBPRQ, NLcc3BCJnQka, jSV9IKnemH7K=xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\r\xee\xdc\xb3\x87T'), chr(932 - 832) + chr(101) + chr(99) + '\x6f' + chr(0b1100100) + chr(101))(chr(11140 - 11023) + chr(7460 - 7344) + chr(259 - 157) + chr(45) + chr(0b110100 + 0o4)))):
return xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'[Q\xe4\xed\x83\xdc\x16\t\tG`k'), '\x64' + chr(101) + chr(0b101100 + 0o67) + '\x6f' + '\144' + chr(2918 - 2817))(chr(0b1110101) + '\x74' + '\x66' + chr(0b100 + 0o51) + chr(0b1100 + 0o54)))(OeWW0F1dBPRQ[..., xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'w\x04\xf6\xdc\xbf\xdd\x15'), chr(100) + chr(9034 - 8933) + chr(0b10110 + 0o115) + '\x6f' + chr(0b1010000 + 0o24) + chr(0b100110 + 0o77))(chr(0b1 + 0o164) + '\x74' + chr(0b1100 + 0o132) + chr(0b101101) + '\x38'))] == xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'x\x13\xe0\xd3\xa0\xd1'), chr(0b1010100 + 0o20) + chr(5430 - 5329) + chr(0b101 + 0o136) + chr(1570 - 1459) + '\x64' + chr(0b1100101))(chr(0b100000 + 0o125) + chr(116) + '\x66' + chr(45) + chr(1973 - 1917)))(NLcc3BCJnQka), jSV9IKnemH7K)
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
LogSoftmax
|
def LogSoftmax(x, params, axis=-1, **kwargs):
"""Apply log softmax to x: log-normalize along the given axis."""
del params, kwargs
return x - backend.logsumexp(x, axis, keepdims=True)
|
python
|
def LogSoftmax(x, params, axis=-1, **kwargs):
"""Apply log softmax to x: log-normalize along the given axis."""
del params, kwargs
return x - backend.logsumexp(x, axis, keepdims=True)
|
[
"def",
"LogSoftmax",
"(",
"x",
",",
"params",
",",
"axis",
"=",
"-",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"del",
"params",
",",
"kwargs",
"return",
"x",
"-",
"backend",
".",
"logsumexp",
"(",
"x",
",",
"axis",
",",
"keepdims",
"=",
"True",
")"
] |
Apply log softmax to x: log-normalize along the given axis.
|
[
"Apply",
"log",
"softmax",
"to",
"x",
":",
"log",
"-",
"normalize",
"along",
"the",
"given",
"axis",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L116-L119
|
train
|
Apply log softmax to 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,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4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PD,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(9310 - 9199) + '\061' + chr(1745 - 1695) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1567 - 1519) + chr(111) + '\x31' + '\x34' + chr(0b101110 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + '\062' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1100111 + 0o10) + chr(49) + '\x32' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1345 - 1296) + '\x33' + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(949 - 897) + chr(1807 - 1753), 49058 - 49050), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(1008 - 954) + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + chr(8966 - 8855) + chr(49), 0o10), ehT0Px3KOsy9(chr(755 - 707) + '\157' + chr(0b100100 + 0o15) + '\x37' + '\063', 0o10), ehT0Px3KOsy9(chr(1872 - 1824) + chr(0b1000000 + 0o57) + '\x31' + chr(0b110110) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(9610 - 9499) + chr(0b110010) + '\x36' + '\064', 49941 - 49933), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + '\x33' + chr(48) + '\060', 61375 - 61367), ehT0Px3KOsy9('\060' + chr(0b1011110 + 0o21) + chr(0b11001 + 0o31) + chr(0b1011 + 0o53) + '\x30', 34230 - 34222), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(1509 - 1458), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(579 - 468) + chr(0b101011 + 0o7) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(0b110001) + '\064' + chr(0b100 + 0o55), 5131 - 5123), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(3695 - 3584) + '\063' + chr(54) + chr(0b110000), 24799 - 24791), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(10771 - 10660) + '\x32' + chr(0b11010 + 0o33), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1969 - 1918) + chr(1372 - 1320) + chr(889 - 837), 57990 - 57982), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1342 - 1292) + '\x36', 42328 - 42320), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\063' + chr(706 - 656), 0b1000), ehT0Px3KOsy9(chr(2165 - 2117) + chr(111) + chr(0b11001 + 0o30) + chr(0b101111 + 0o3) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1001 + 0o52) + chr(0b101111 + 0o1) + chr(0b110111), 1890 - 1882), ehT0Px3KOsy9(chr(696 - 648) + '\157' + chr(0b111 + 0o54) + chr(1705 - 1655), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b110001) + chr(1836 - 1783), 0o10), ehT0Px3KOsy9(chr(1649 - 1601) + chr(0b1100101 + 0o12) + chr(0b10011 + 0o37) + chr(0b110001) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(11174 - 11063) + '\x31' + chr(52) + chr(0b11 + 0o61), 16835 - 16827), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\157' + '\061' + chr(0b110110) + '\x34', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + '\065' + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(2714 - 2660) + chr(0b1100 + 0o51), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + '\x31' + chr(49) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(0b100101 + 0o15) + chr(0b101001 + 0o15) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(637 - 586) + chr(0b110111) + chr(0b11110 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + chr(8888 - 8777) + chr(2402 - 2351) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b10 + 0o65) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(52) + chr(2419 - 2364), 53407 - 53399), ehT0Px3KOsy9(chr(1061 - 1013) + chr(0b1100110 + 0o11) + chr(49) + '\x36' + chr(54), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + '\x35' + '\060', 35951 - 35943)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'z'), chr(0b111101 + 0o47) + '\145' + '\143' + chr(0b1101111) + chr(0b1100100) + chr(101))('\x75' + chr(0b1110100) + '\146' + '\055' + chr(0b101000 + 0o20)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hOkrN8riVCMj(OeWW0F1dBPRQ, nEbJZ4wfte2w, cRTh61qyvi24=-ehT0Px3KOsy9('\x30' + '\x6f' + '\x31', 8), **M8EIoTs2GJXE):
del nEbJZ4wfte2w, M8EIoTs2GJXE
return OeWW0F1dBPRQ - xafqLlk3kkUe(bwojgsUvRJpy, xafqLlk3kkUe(SXOLrMavuUCe(b'8\rr#)\xcb\x90y\x0b'), '\144' + '\x65' + chr(2510 - 2411) + '\157' + chr(0b1000110 + 0o36) + chr(0b1100101))('\165' + chr(116) + '\x66' + chr(222 - 177) + chr(56)))(OeWW0F1dBPRQ, cRTh61qyvi24, keepdims=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061', 8))
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
Softmax
|
def Softmax(x, params, axis=-1, **kwargs):
"""Apply softmax to x: exponentiate and normalize along the given axis."""
del params, kwargs
return np.exp(x - backend.logsumexp(x, axis, keepdims=True))
|
python
|
def Softmax(x, params, axis=-1, **kwargs):
"""Apply softmax to x: exponentiate and normalize along the given axis."""
del params, kwargs
return np.exp(x - backend.logsumexp(x, axis, keepdims=True))
|
[
"def",
"Softmax",
"(",
"x",
",",
"params",
",",
"axis",
"=",
"-",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"del",
"params",
",",
"kwargs",
"return",
"np",
".",
"exp",
"(",
"x",
"-",
"backend",
".",
"logsumexp",
"(",
"x",
",",
"axis",
",",
"keepdims",
"=",
"True",
")",
")"
] |
Apply softmax to x: exponentiate and normalize along the given axis.
|
[
"Apply",
"softmax",
"to",
"x",
":",
"exponentiate",
"and",
"normalize",
"along",
"the",
"given",
"axis",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6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n,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(11370 - 11259) + chr(0b110010) + chr(1694 - 1639) + chr(918 - 863), 40128 - 40120), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(49) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(55) + chr(0b100000 + 0o20), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b110111) + chr(48), 18185 - 18177), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1602 - 1553) + '\064' + chr(0b10100 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(628 - 578), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\065' + '\x36', 31503 - 31495), ehT0Px3KOsy9(chr(1312 - 1264) + chr(111) + chr(0b110011) + chr(0b101001 + 0o7) + '\061', 48610 - 48602), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(0b110001) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101010 + 0o11) + '\x33' + chr(0b100101 + 0o15), 0b1000), ehT0Px3KOsy9('\x30' + chr(9473 - 9362) + '\x31' + chr(1612 - 1562) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(181 - 130) + chr(1095 - 1045) + chr(0b110001), 10363 - 10355), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b101111 + 0o100) + '\x31' + chr(0b110000) + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(48) + '\x31', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110110) + chr(0b101010 + 0o14), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1850 - 1799) + '\x37' + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8287 - 8176) + '\062' + chr(48) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x37' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8069 - 7958) + chr(0b110010) + chr(2610 - 2558) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + '\061' + '\x32' + chr(0b1101 + 0o43), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(7108 - 6997) + chr(271 - 220) + '\x33', 0b1000), ehT0Px3KOsy9(chr(2049 - 2001) + chr(5778 - 5667) + chr(0b101100 + 0o7) + chr(0b110 + 0o52) + chr(0b11110 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(0b100001 + 0o22) + chr(0b110000) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b110111) + chr(352 - 298), 8), ehT0Px3KOsy9('\x30' + chr(0b110011 + 0o74) + '\x32' + '\x34' + '\x30', 32409 - 32401), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(1309 - 1260) + chr(55), 26140 - 26132), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + '\065' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(50) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x30' + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(758 - 707) + chr(1799 - 1746), 38060 - 38052), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b110010) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7074 - 6963) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b11001 + 0o27) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b110100) + chr(0b1100 + 0o47), 0o10), ehT0Px3KOsy9('\x30' + chr(10605 - 10494) + chr(49) + chr(54) + chr(1492 - 1442), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10438 - 10327) + chr(51) + '\x30' + chr(0b110100), 8), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(2402 - 2352) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(0b110010) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2339 - 2288) + '\x33' + '\x35', 0b1000), ehT0Px3KOsy9(chr(59 - 11) + chr(915 - 804) + '\x35' + chr(0b110111), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(2925 - 2814) + '\x35' + chr(2008 - 1960), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x91'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\157' + '\x64' + chr(101))('\x75' + chr(0b1010111 + 0o35) + '\x66' + chr(661 - 616) + chr(1476 - 1420)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def acMJPFhBKQg8(OeWW0F1dBPRQ, nEbJZ4wfte2w, cRTh61qyvi24=-ehT0Px3KOsy9(chr(0b110000) + chr(1909 - 1798) + '\x31', 0o10), **M8EIoTs2GJXE):
del nEbJZ4wfte2w, M8EIoTs2GJXE
return xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdauH'), chr(100) + chr(7281 - 7180) + '\x63' + chr(9020 - 8909) + chr(5567 - 5467) + chr(0b1100101))('\165' + chr(3571 - 3455) + chr(102) + chr(1356 - 1311) + chr(0b111000)))(OeWW0F1dBPRQ - xafqLlk3kkUe(bwojgsUvRJpy, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3b_\xcb\x12\x7f\x8b\xb9{'), '\144' + chr(5863 - 5762) + chr(0b1100011) + '\x6f' + chr(100) + chr(4396 - 4295))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b1 + 0o54) + chr(0b111000)))(OeWW0F1dBPRQ, cRTh61qyvi24, keepdims=ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(0b100010 + 0o17), 8)))
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
padtype_to_pads
|
def padtype_to_pads(in_shape, window_shape, window_strides, padding):
"""Convert padding string to list of pairs of pad values."""
padding = padding.upper()
if padding == 'SAME':
out_shape = onp.ceil(
onp.true_divide(in_shape, window_strides)).astype(int)
pad_sizes = [max((out_size - 1) * stride + window_shape - in_size, 0)
for out_size, stride, window_shape, in_size
in zip(out_shape, window_strides, window_shape, in_shape)]
return [(pad_size // 2, pad_size - pad_size // 2)
for pad_size in pad_sizes]
elif padding == 'VALID':
return [(0, 0)] * len(in_shape)
else:
msg = 'Unknown padding type: {}.'
raise TypeError(msg.format(padding))
|
python
|
def padtype_to_pads(in_shape, window_shape, window_strides, padding):
"""Convert padding string to list of pairs of pad values."""
padding = padding.upper()
if padding == 'SAME':
out_shape = onp.ceil(
onp.true_divide(in_shape, window_strides)).astype(int)
pad_sizes = [max((out_size - 1) * stride + window_shape - in_size, 0)
for out_size, stride, window_shape, in_size
in zip(out_shape, window_strides, window_shape, in_shape)]
return [(pad_size // 2, pad_size - pad_size // 2)
for pad_size in pad_sizes]
elif padding == 'VALID':
return [(0, 0)] * len(in_shape)
else:
msg = 'Unknown padding type: {}.'
raise TypeError(msg.format(padding))
|
[
"def",
"padtype_to_pads",
"(",
"in_shape",
",",
"window_shape",
",",
"window_strides",
",",
"padding",
")",
":",
"padding",
"=",
"padding",
".",
"upper",
"(",
")",
"if",
"padding",
"==",
"'SAME'",
":",
"out_shape",
"=",
"onp",
".",
"ceil",
"(",
"onp",
".",
"true_divide",
"(",
"in_shape",
",",
"window_strides",
")",
")",
".",
"astype",
"(",
"int",
")",
"pad_sizes",
"=",
"[",
"max",
"(",
"(",
"out_size",
"-",
"1",
")",
"*",
"stride",
"+",
"window_shape",
"-",
"in_size",
",",
"0",
")",
"for",
"out_size",
",",
"stride",
",",
"window_shape",
",",
"in_size",
"in",
"zip",
"(",
"out_shape",
",",
"window_strides",
",",
"window_shape",
",",
"in_shape",
")",
"]",
"return",
"[",
"(",
"pad_size",
"//",
"2",
",",
"pad_size",
"-",
"pad_size",
"//",
"2",
")",
"for",
"pad_size",
"in",
"pad_sizes",
"]",
"elif",
"padding",
"==",
"'VALID'",
":",
"return",
"[",
"(",
"0",
",",
"0",
")",
"]",
"*",
"len",
"(",
"in_shape",
")",
"else",
":",
"msg",
"=",
"'Unknown padding type: {}.'",
"raise",
"TypeError",
"(",
"msg",
".",
"format",
"(",
"padding",
")",
")"
] |
Convert padding string to list of pairs of pad values.
|
[
"Convert",
"padding",
"string",
"to",
"list",
"of",
"pairs",
"of",
"pad",
"values",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L181-L196
|
train
|
Convert padding string to list of pairs of pad values.
|
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,RQ6CSRrFAr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,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) + '\x32' + chr(1566 - 1516) + chr(509 - 456), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1296 - 1185) + '\063' + chr(50) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b101111 + 0o1), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\060' + '\x35', 3104 - 3096), ehT0Px3KOsy9(chr(1073 - 1025) + chr(8658 - 8547) + '\x33' + '\x30' + chr(0b100100 + 0o23), 45100 - 45092), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(50) + chr(1889 - 1834) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1100101 + 0o12) + chr(2122 - 2072) + '\060' + chr(53), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(733 - 684) + chr(0b110100) + '\063', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x34' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101111 + 0o4) + chr(0b110000), 65032 - 65024), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(2487 - 2437) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(1827 - 1777), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11519 - 11408) + chr(0b10111 + 0o32) + chr(0b110110) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110101) + chr(0b10011 + 0o40), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x37' + chr(0b10001 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + '\x32' + chr(0b110111) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1895 - 1847) + chr(111) + chr(0b100111 + 0o14) + chr(0b110100 + 0o1) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(893 - 845) + '\061', 0o10), ehT0Px3KOsy9(chr(442 - 394) + chr(111) + chr(0b110010) + '\063' + '\062', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(52) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\062' + chr(1998 - 1949) + '\x36', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110101) + chr(0b11100 + 0o24), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x35' + chr(0b110111), 53972 - 53964), ehT0Px3KOsy9(chr(48) + chr(111) + '\x34' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(314 - 264) + chr(48) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(0b110010 + 0o5) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(8440 - 8329) + chr(2387 - 2336) + chr(49) + chr(2362 - 2307), ord("\x08")), ehT0Px3KOsy9(chr(1610 - 1562) + '\x6f' + chr(0b110011) + chr(50), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11000 + 0o36) + '\x33', 0b1000), ehT0Px3KOsy9(chr(1589 - 1541) + chr(0b11100 + 0o123) + chr(1597 - 1547) + chr(0b11 + 0o56) + chr(1649 - 1597), ord("\x08")), ehT0Px3KOsy9(chr(521 - 473) + '\x6f' + chr(51) + chr(0b10010 + 0o44) + chr(1368 - 1316), 0b1000), ehT0Px3KOsy9(chr(1824 - 1776) + chr(6933 - 6822) + chr(53) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\067' + '\x32', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(222 - 174) + '\157' + '\x31' + '\065' + '\x35', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\x32' + '\062', 56410 - 56402), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(1556 - 1507) + '\065' + '\065', 8), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(3617 - 3506) + chr(51) + '\062' + chr(50), 8), ehT0Px3KOsy9(chr(1714 - 1666) + chr(111) + chr(0b110010) + chr(0b1111 + 0o42) + '\x37', 15014 - 15006), ehT0Px3KOsy9(chr(48) + chr(9471 - 9360) + '\x31' + '\063' + chr(54), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(946 - 898) + '\157' + chr(0b110101) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb'), chr(0b1100100) + chr(0b1000011 + 0o42) + chr(0b1100011) + chr(8054 - 7943) + '\x64' + chr(0b0 + 0o145))('\165' + chr(10924 - 10808) + chr(2511 - 2409) + '\055' + chr(0b110010 + 0o6)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def O2j2jw2NUyNq(kXXT6PT111uG, jG7hnBP9EqQW, NRJwWnad4cQH, TFLseEYASEKG):
TFLseEYASEKG = TFLseEYASEKG.upper()
if TFLseEYASEKG == xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6\x96]\xc0'), chr(0b1100100) + '\x65' + '\143' + chr(3485 - 3374) + chr(2857 - 2757) + chr(0b1100101))(chr(0b101111 + 0o106) + chr(0b1110100) + chr(0b1100110) + chr(1635 - 1590) + '\x38'):
wjefSqyQUekw = E84IQ9WvC5Je.ceil(E84IQ9WvC5Je.true_divide(kXXT6PT111uG, NRJwWnad4cQH)).astype(ehT0Px3KOsy9)
QQDVmlAbwgAq = [tsdjvlgh9gDP((wQKChWwQ_w0Q - ehT0Px3KOsy9(chr(48) + chr(0b1010010 + 0o35) + '\061', 8)) * VKQ5wcD30goF + jG7hnBP9EqQW - qg4WGpkmRztf, ehT0Px3KOsy9(chr(48) + chr(5776 - 5665) + chr(0b10000 + 0o40), 0o10)) for (wQKChWwQ_w0Q, VKQ5wcD30goF, jG7hnBP9EqQW, qg4WGpkmRztf) in pZ0NK2y6HRbn(wjefSqyQUekw, NRJwWnad4cQH, jG7hnBP9EqQW, kXXT6PT111uG)]
return [(yxAL8FP9pyGe // ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11110 + 0o24), 39559 - 39551), yxAL8FP9pyGe - yxAL8FP9pyGe // ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(1027 - 977), 8)) for yxAL8FP9pyGe in QQDVmlAbwgAq]
elif TFLseEYASEKG == xafqLlk3kkUe(SXOLrMavuUCe(b'\xc3\x96\\\xcc\x83'), chr(0b100 + 0o140) + '\x65' + chr(0b1100011) + '\x6f' + '\x64' + chr(0b1100101))(chr(117) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b101010 + 0o16)):
return [(ehT0Px3KOsy9('\x30' + chr(111) + '\060', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(48), 8))] * c2A0yzQpDQB3(kXXT6PT111uG)
else:
jtbovtaIYjRB = xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\xb9{\xeb\xa8\xce\xebCPy\xb5~\x19\x05_\x9f\x9d\xb8\xea\x83\xb4\xc8\x94^\xad'), chr(100) + '\145' + chr(0b1100011) + '\x6f' + '\x64' + chr(0b101100 + 0o71))(chr(4519 - 4402) + chr(0b111 + 0o155) + '\146' + chr(164 - 119) + '\x38')
raise sznFqDbNBHlx(xafqLlk3kkUe(jtbovtaIYjRB, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc3\xe3b\xea\x8f\xd8\xd6Pph\xb4p'), chr(3233 - 3133) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(0b1000101 + 0o40))(chr(117) + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000)))(TFLseEYASEKG))
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
_flatten_output_shape
|
def _flatten_output_shape(input_shape, num_axis_to_keep=1):
"""Output shape of a flatten layer."""
if num_axis_to_keep >= len(input_shape):
raise ValueError(
"num_axis_to_keep[%d] should be less than input's rank[%d]" %
(num_axis_to_keep, len(input_shape)))
return tuple(input_shape[:num_axis_to_keep]) + (
reduce(op.mul, input_shape[num_axis_to_keep:], 1),)
|
python
|
def _flatten_output_shape(input_shape, num_axis_to_keep=1):
"""Output shape of a flatten layer."""
if num_axis_to_keep >= len(input_shape):
raise ValueError(
"num_axis_to_keep[%d] should be less than input's rank[%d]" %
(num_axis_to_keep, len(input_shape)))
return tuple(input_shape[:num_axis_to_keep]) + (
reduce(op.mul, input_shape[num_axis_to_keep:], 1),)
|
[
"def",
"_flatten_output_shape",
"(",
"input_shape",
",",
"num_axis_to_keep",
"=",
"1",
")",
":",
"if",
"num_axis_to_keep",
">=",
"len",
"(",
"input_shape",
")",
":",
"raise",
"ValueError",
"(",
"\"num_axis_to_keep[%d] should be less than input's rank[%d]\"",
"%",
"(",
"num_axis_to_keep",
",",
"len",
"(",
"input_shape",
")",
")",
")",
"return",
"tuple",
"(",
"input_shape",
"[",
":",
"num_axis_to_keep",
"]",
")",
"+",
"(",
"reduce",
"(",
"op",
".",
"mul",
",",
"input_shape",
"[",
"num_axis_to_keep",
":",
"]",
",",
"1",
")",
",",
")"
] |
Output shape of a flatten layer.
|
[
"Output",
"shape",
"of",
"a",
"flatten",
"layer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L304-L311
|
train
|
Output shape of a flatten layer.
|
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,OTstr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pXu4lf,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) + '\157' + chr(0b1100 + 0o46) + chr(55) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(0b110010) + chr(54) + '\x35', 60356 - 60348), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10100 + 0o37) + chr(0b110101) + '\067', 23732 - 23724), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(1986 - 1937) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + '\061' + '\064' + chr(2659 - 2604), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101101 + 0o2) + '\x31' + chr(645 - 596), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + '\063' + chr(49) + chr(0b110101), 27993 - 27985), ehT0Px3KOsy9('\x30' + chr(0b110000 + 0o77) + '\x33' + chr(48) + chr(256 - 205), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x35' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + '\x36' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b11101 + 0o122) + chr(0b1011 + 0o50) + chr(0b110110) + chr(527 - 479), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(1714 - 1664) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(7458 - 7347) + chr(0b11001 + 0o31) + chr(0b1111 + 0o43) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b110001) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1935 - 1887) + '\x6f' + chr(1926 - 1874), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(2469 - 2418) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + chr(0b10011 + 0o40) + chr(48) + chr(51), 8), ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + '\062' + chr(52) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(9232 - 9121) + '\061' + chr(1501 - 1452) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x36' + chr(0b11000 + 0o30), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + '\x31' + '\062' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(130 - 19) + '\061' + chr(0b110000) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101111 + 0o3) + chr(1238 - 1189) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\064', 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\x31' + chr(0b100111 + 0o15) + '\061', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(64 - 16) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\x36' + chr(458 - 408), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(12116 - 12005) + '\063' + '\063' + '\x30', 36366 - 36358), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(1118 - 1068) + '\x37' + chr(0b110101 + 0o0), 0o10), ehT0Px3KOsy9(chr(1318 - 1270) + chr(111) + chr(0b10010 + 0o40) + '\061' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(1672 - 1624) + '\x34', 40606 - 40598), ehT0Px3KOsy9('\x30' + chr(872 - 761) + chr(0b110010) + chr(54) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(2153 - 2105) + '\157' + chr(0b110010 + 0o1) + chr(2712 - 2657) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(0b110011 + 0o0) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(223 - 173) + '\064' + chr(50), 49298 - 49290), ehT0Px3KOsy9(chr(1660 - 1612) + '\157' + chr(49) + chr(0b10010 + 0o40) + chr(2131 - 2077), 38453 - 38445), ehT0Px3KOsy9(chr(1595 - 1547) + chr(2815 - 2704) + chr(0b11110 + 0o25) + chr(0b10010 + 0o42) + chr(2074 - 2023), ord("\x08")), ehT0Px3KOsy9(chr(164 - 116) + chr(111) + '\x34' + chr(0b110000 + 0o0), 55005 - 54997), ehT0Px3KOsy9('\060' + chr(5884 - 5773) + '\x32' + chr(0b110110) + '\x37', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(9321 - 9210) + '\x35' + chr(1771 - 1723), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x97'), chr(0b10001 + 0o123) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(1447 - 1347) + '\145')(chr(0b1110101) + '\164' + chr(102) + '\055' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
(RSYsB9TMxo_y,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf\xc0\x81\xab\x13f\xa2\xaf_'), chr(100) + chr(0b10010 + 0o123) + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))('\165' + '\x74' + chr(102) + chr(0b101101) + chr(0b1001 + 0o57)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xd0\x8b\xbd\x04l'), '\144' + '\x65' + chr(0b10000 + 0o123) + chr(0b1101111) + chr(8038 - 7938) + chr(101))('\165' + '\x74' + '\146' + '\055' + chr(0b111000))), xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xd0\x8b\xbd\x04l'), chr(0b1100100) + '\145' + chr(1477 - 1378) + chr(0b1101111) + '\144' + chr(0b0 + 0o145))(chr(0b1110101) + chr(0b1110100) + chr(7046 - 6944) + chr(1982 - 1937) + chr(0b111000))),)
def x_C6RTwdUXCG(tANyZeuTfu5y, bynjd7PusoHt=ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061', 0o10)):
if bynjd7PusoHt >= c2A0yzQpDQB3(tANyZeuTfu5y):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7\xc0\x82\x97\x06q\xa4\xb0sA\x9f\x0b\xfb\xeca/\x98\x83,\xadu4\xe2k\x14\xec\x162\xba\xd8\xab\xa8\xd3\x8d\xa8\x82"\x8bA\xd9\x99\xdc\x81\xb8\x12}\xea\xb0\x0cG\x91:\xfb\xd2!;\x9e'), chr(100) + '\145' + '\x63' + chr(7147 - 7036) + '\144' + chr(0b1100101))(chr(0b1011 + 0o152) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(2540 - 2484)) % (bynjd7PusoHt, c2A0yzQpDQB3(tANyZeuTfu5y)))
return KNyTy8rYcwji(tANyZeuTfu5y[:bynjd7PusoHt]) + (RSYsB9TMxo_y(xafqLlk3kkUe(C8dAr6Ujq2Tn, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\xc0\x83'), chr(0b1100100) + '\145' + chr(5178 - 5079) + chr(0b1000000 + 0o57) + '\144' + chr(101))(chr(117) + '\164' + chr(0b100000 + 0o106) + '\055' + chr(0b111000))), tANyZeuTfu5y[bynjd7PusoHt:], ehT0Px3KOsy9(chr(48) + chr(111) + chr(484 - 435), 8)),)
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
_batch_norm_new_params
|
def _batch_norm_new_params(input_shape, rng, axis=(0, 1, 2),
center=True, scale=True, **kwargs):
"""Helper to initialize batch norm params."""
del rng, kwargs
axis = (axis,) if np.isscalar(axis) else axis
shape = tuple(d for i, d in enumerate(input_shape) if i not in axis)
beta = np.zeros(shape, dtype='float32') if center else ()
gamma = np.ones(shape, dtype='float32') if scale else ()
return (beta, gamma)
|
python
|
def _batch_norm_new_params(input_shape, rng, axis=(0, 1, 2),
center=True, scale=True, **kwargs):
"""Helper to initialize batch norm params."""
del rng, kwargs
axis = (axis,) if np.isscalar(axis) else axis
shape = tuple(d for i, d in enumerate(input_shape) if i not in axis)
beta = np.zeros(shape, dtype='float32') if center else ()
gamma = np.ones(shape, dtype='float32') if scale else ()
return (beta, gamma)
|
[
"def",
"_batch_norm_new_params",
"(",
"input_shape",
",",
"rng",
",",
"axis",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"center",
"=",
"True",
",",
"scale",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"del",
"rng",
",",
"kwargs",
"axis",
"=",
"(",
"axis",
",",
")",
"if",
"np",
".",
"isscalar",
"(",
"axis",
")",
"else",
"axis",
"shape",
"=",
"tuple",
"(",
"d",
"for",
"i",
",",
"d",
"in",
"enumerate",
"(",
"input_shape",
")",
"if",
"i",
"not",
"in",
"axis",
")",
"beta",
"=",
"np",
".",
"zeros",
"(",
"shape",
",",
"dtype",
"=",
"'float32'",
")",
"if",
"center",
"else",
"(",
")",
"gamma",
"=",
"np",
".",
"ones",
"(",
"shape",
",",
"dtype",
"=",
"'float32'",
")",
"if",
"scale",
"else",
"(",
")",
"return",
"(",
"beta",
",",
"gamma",
")"
] |
Helper to initialize batch norm params.
|
[
"Helper",
"to",
"initialize",
"batch",
"norm",
"params",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L321-L329
|
train
|
Helper to initialize batch norm params.
|
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,NL8dt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ammpH,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(1512 - 1464) + chr(111) + '\x31' + chr(0b110001) + '\067', 18613 - 18605), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\062' + chr(0b110 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(1374 - 1324) + '\063' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(0b101111 + 0o7) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111110 + 0o61) + chr(0b100 + 0o56) + chr(0b110011) + chr(0b101101 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\061' + chr(51), 5367 - 5359), ehT0Px3KOsy9(chr(1464 - 1416) + '\157' + chr(0b1000 + 0o51) + chr(2232 - 2184) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1472 - 1424), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(55) + chr(2206 - 2157), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1000110 + 0o51) + chr(51) + chr(0b10100 + 0o43) + chr(1983 - 1935), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11001 + 0o126) + chr(0b1110 + 0o43) + chr(0b101100 + 0o12), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\065' + chr(2652 - 2599), 0o10), ehT0Px3KOsy9(chr(2159 - 2111) + chr(0b11100 + 0o123) + '\x35' + chr(2103 - 2048), 23613 - 23605), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(0b1000 + 0o52) + '\x33' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(10529 - 10418) + chr(0b110011) + chr(0b101 + 0o60) + '\x32', 47866 - 47858), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(989 - 939) + chr(0b110101) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b101100 + 0o4) + chr(0b110011 + 0o0), 40826 - 40818), ehT0Px3KOsy9('\060' + '\157' + chr(0b11 + 0o60) + chr(1302 - 1252) + chr(2068 - 2017), 38073 - 38065), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(8570 - 8459) + chr(0b110111) + '\x37', 32143 - 32135), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(6528 - 6417) + chr(0b110010) + '\x37' + chr(1712 - 1657), 61354 - 61346), ehT0Px3KOsy9('\x30' + chr(4329 - 4218) + '\x33' + '\x33' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10100 + 0o37) + '\060' + chr(0b100100 + 0o15), 49380 - 49372), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + chr(51) + chr(1409 - 1354) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(49), 30766 - 30758), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11010 + 0o30) + '\x30' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(2052 - 2004) + chr(9721 - 9610) + chr(0b110001) + chr(1331 - 1278) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b100000 + 0o27) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(6965 - 6854) + '\x32' + chr(49) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101101 + 0o2) + chr(0b110011) + chr(275 - 222) + chr(50), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100111 + 0o14) + '\x35' + chr(51), 15529 - 15521), ehT0Px3KOsy9(chr(1953 - 1905) + chr(0b1100111 + 0o10) + chr(0b110010) + chr(0b110001) + chr(2178 - 2128), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(272 - 221) + chr(1291 - 1240), 0o10), ehT0Px3KOsy9('\x30' + chr(11021 - 10910) + chr(0b11001 + 0o32) + '\x34' + '\x34', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\067' + chr(0b1000 + 0o50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7334 - 7223) + '\x33' + chr(0b110001 + 0o5) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(2828 - 2774) + '\066', 41114 - 41106), ehT0Px3KOsy9('\x30' + '\x6f' + '\066' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\x37', 48111 - 48103), ehT0Px3KOsy9(chr(0b110000) + chr(8977 - 8866) + chr(0b110001 + 0o1) + chr(2361 - 2307) + chr(0b11101 + 0o24), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b110100), 8286 - 8278)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(2032 - 1921) + chr(53) + chr(0b11001 + 0o27), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'a'), chr(1295 - 1195) + '\x65' + chr(0b111111 + 0o44) + chr(0b100001 + 0o116) + chr(0b1011101 + 0o7) + '\145')(chr(0b1110101) + chr(9152 - 9036) + '\x66' + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mzA0xqNk9EGP(tANyZeuTfu5y, OKPXzuZwN61O, cRTh61qyvi24=(ehT0Px3KOsy9(chr(1958 - 1910) + '\157' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2643 - 2532) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + '\062', ord("\x08"))), qkYxsmydG0V_=ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1011111 + 0o20) + '\x31', 8), xjPLimsZRgb9=ehT0Px3KOsy9('\060' + chr(0b100110 + 0o111) + chr(0b11001 + 0o30), 8), **M8EIoTs2GJXE):
del OKPXzuZwN61O, M8EIoTs2GJXE
cRTh61qyvi24 = (cRTh61qyvi24,) if WqUC3KWvYVup.isscalar(cRTh61qyvi24) else cRTh61qyvi24
nauYfLglTpcb = KNyTy8rYcwji((pd3lxn9vqWxp for (WVxHKyX45z_L, pd3lxn9vqWxp) in YlkZvXL8qwsX(tANyZeuTfu5y) if WVxHKyX45z_L not in cRTh61qyvi24))
FjcovgoHM1LG = WqUC3KWvYVup.zeros(nauYfLglTpcb, dtype=xafqLlk3kkUe(SXOLrMavuUCe(b')\xf9\xf6\xd2\xeb\xb8s'), chr(0b1100100 + 0o0) + chr(0b10001 + 0o124) + '\143' + chr(0b1101111) + chr(6260 - 6160) + chr(3008 - 2907))(chr(0b111010 + 0o73) + chr(116) + chr(0b1010011 + 0o23) + chr(857 - 812) + chr(2482 - 2426))) if qkYxsmydG0V_ else ()
nfeH4ZtvQXsW = WqUC3KWvYVup.ones(nauYfLglTpcb, dtype=xafqLlk3kkUe(SXOLrMavuUCe(b')\xf9\xf6\xd2\xeb\xb8s'), '\x64' + chr(0b1100101) + '\x63' + '\x6f' + chr(0b1100100) + chr(101))(chr(0b1100011 + 0o22) + '\164' + '\146' + '\055' + chr(0b111000))) if xjPLimsZRgb9 else ()
return (FjcovgoHM1LG, nfeH4ZtvQXsW)
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
BatchNorm
|
def BatchNorm(x, params, axis=(0, 1, 2), epsilon=1e-5,
center=True, scale=True, **unused_kwargs):
"""Layer construction function for a batch normalization layer."""
mean = np.mean(x, axis, keepdims=True)
# Fast but less numerically-stable variance calculation than np.var.
m1 = np.mean(x**2, axis, keepdims=True)
var = m1 - mean**2
z = (x - mean) / np.sqrt(var + epsilon)
# Expand the parameters to have the right axes.
beta, gamma = params
# TODO(phawkins): np.expand_dims should accept an axis tuple.
# (https://github.com/numpy/numpy/issues/12290)
ed = tuple(None if i in axis else slice(None) for i in range(np.ndim(x)))
beta = beta[ed]
gamma = gamma[ed]
# Return the z rescaled by the parameters if requested.
if center and scale:
return gamma * z + beta
if center:
return z + beta
if scale:
return gamma * z
return z
|
python
|
def BatchNorm(x, params, axis=(0, 1, 2), epsilon=1e-5,
center=True, scale=True, **unused_kwargs):
"""Layer construction function for a batch normalization layer."""
mean = np.mean(x, axis, keepdims=True)
# Fast but less numerically-stable variance calculation than np.var.
m1 = np.mean(x**2, axis, keepdims=True)
var = m1 - mean**2
z = (x - mean) / np.sqrt(var + epsilon)
# Expand the parameters to have the right axes.
beta, gamma = params
# TODO(phawkins): np.expand_dims should accept an axis tuple.
# (https://github.com/numpy/numpy/issues/12290)
ed = tuple(None if i in axis else slice(None) for i in range(np.ndim(x)))
beta = beta[ed]
gamma = gamma[ed]
# Return the z rescaled by the parameters if requested.
if center and scale:
return gamma * z + beta
if center:
return z + beta
if scale:
return gamma * z
return z
|
[
"def",
"BatchNorm",
"(",
"x",
",",
"params",
",",
"axis",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"epsilon",
"=",
"1e-5",
",",
"center",
"=",
"True",
",",
"scale",
"=",
"True",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"mean",
"=",
"np",
".",
"mean",
"(",
"x",
",",
"axis",
",",
"keepdims",
"=",
"True",
")",
"# Fast but less numerically-stable variance calculation than np.var.",
"m1",
"=",
"np",
".",
"mean",
"(",
"x",
"**",
"2",
",",
"axis",
",",
"keepdims",
"=",
"True",
")",
"var",
"=",
"m1",
"-",
"mean",
"**",
"2",
"z",
"=",
"(",
"x",
"-",
"mean",
")",
"/",
"np",
".",
"sqrt",
"(",
"var",
"+",
"epsilon",
")",
"# Expand the parameters to have the right axes.",
"beta",
",",
"gamma",
"=",
"params",
"# TODO(phawkins): np.expand_dims should accept an axis tuple.",
"# (https://github.com/numpy/numpy/issues/12290)",
"ed",
"=",
"tuple",
"(",
"None",
"if",
"i",
"in",
"axis",
"else",
"slice",
"(",
"None",
")",
"for",
"i",
"in",
"range",
"(",
"np",
".",
"ndim",
"(",
"x",
")",
")",
")",
"beta",
"=",
"beta",
"[",
"ed",
"]",
"gamma",
"=",
"gamma",
"[",
"ed",
"]",
"# Return the z rescaled by the parameters if requested.",
"if",
"center",
"and",
"scale",
":",
"return",
"gamma",
"*",
"z",
"+",
"beta",
"if",
"center",
":",
"return",
"z",
"+",
"beta",
"if",
"scale",
":",
"return",
"gamma",
"*",
"z",
"return",
"z"
] |
Layer construction function for a batch normalization layer.
|
[
"Layer",
"construction",
"function",
"for",
"a",
"batch",
"normalization",
"layer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L333-L357
|
train
|
Batch normalization layer.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTb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yYhLtLC,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' + chr(0b1101111) + chr(0b101001 + 0o12) + chr(2458 - 2406), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b110101) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(0b10000 + 0o137) + chr(51) + chr(48) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(1121 - 1073) + chr(0b110001 + 0o6), 8), ehT0Px3KOsy9('\060' + chr(5617 - 5506) + chr(53) + chr(0b110011), 48937 - 48929), ehT0Px3KOsy9(chr(1139 - 1091) + chr(111) + chr(53) + chr(0b100001 + 0o20), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(546 - 435) + '\067' + '\067', 0b1000), ehT0Px3KOsy9(chr(1155 - 1107) + chr(111) + chr(0b110011) + chr(0b110110) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(4935 - 4824) + '\x32' + chr(1404 - 1352), 32837 - 32829), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + chr(0b110010) + chr(2237 - 2187) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(307 - 256) + chr(53), 13963 - 13955), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1701 - 1651) + '\061' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(0b110110) + '\x35', 0o10), ehT0Px3KOsy9(chr(711 - 663) + '\x6f' + '\x32' + chr(0b110110) + chr(1165 - 1114), ord("\x08")), ehT0Px3KOsy9(chr(1671 - 1623) + chr(0b1010 + 0o145) + chr(53) + chr(0b11011 + 0o25), 48602 - 48594), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(2373 - 2319) + chr(0b110101 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + '\x31' + '\062' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10 + 0o155) + chr(0b100 + 0o55) + chr(0b1 + 0o63) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(73 - 25) + chr(0b1111 + 0o140) + chr(0b100010 + 0o21) + '\064' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + '\x35' + '\x33', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(803 - 754) + chr(49), 54808 - 54800), ehT0Px3KOsy9('\x30' + chr(0b1101110 + 0o1) + '\063' + '\067' + chr(0b10110 + 0o33), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(2973 - 2918) + chr(0b11010 + 0o26), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(11503 - 11392) + chr(51) + chr(0b11100 + 0o30), 8), ehT0Px3KOsy9(chr(679 - 631) + '\x6f' + '\063' + '\x36' + chr(0b110010 + 0o0), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b10111 + 0o33), 0o10), ehT0Px3KOsy9('\x30' + chr(8941 - 8830) + chr(50) + '\066' + '\x33', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(64 - 9) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\061' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(53) + chr(1958 - 1905), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110111) + '\061', 39702 - 39694), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b111111 + 0o60) + chr(0b100011 + 0o17) + '\x36' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(3033 - 2922) + chr(0b101111 + 0o4) + chr(0b110011) + chr(0b100011 + 0o16), 50559 - 50551), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(854 - 743) + '\061' + chr(52) + '\062', 8), ehT0Px3KOsy9(chr(1813 - 1765) + chr(1272 - 1161) + '\062' + chr(0b110110) + chr(49), 10527 - 10519), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\x37' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b111 + 0o53) + chr(52) + chr(0b100100 + 0o21), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2615 - 2560) + chr(0b110100), 60536 - 60528), ehT0Px3KOsy9(chr(135 - 87) + chr(111) + '\062' + '\x34' + chr(2246 - 2191), 0o10), ehT0Px3KOsy9(chr(1182 - 1134) + chr(0b1101111) + chr(0b10001 + 0o41) + chr(0b110011 + 0o0) + '\060', 25775 - 25767)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2033 - 1985) + chr(111) + chr(1466 - 1413) + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'2'), '\144' + chr(0b1100101) + '\143' + chr(8959 - 8848) + chr(0b1100100) + '\x65')(chr(117) + chr(116) + chr(0b1100110) + chr(1866 - 1821) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RrBcgXiX7EfE(OeWW0F1dBPRQ, nEbJZ4wfte2w, cRTh61qyvi24=(ehT0Px3KOsy9(chr(48) + chr(8123 - 8012) + chr(0b11111 + 0o21), 0o10), ehT0Px3KOsy9(chr(865 - 817) + chr(6507 - 6396) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(0b110010), ord("\x08"))), Xtig2zAKpR0T=1e-05, qkYxsmydG0V_=ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1101 + 0o44), 8), xjPLimsZRgb9=ehT0Px3KOsy9(chr(2209 - 2161) + chr(9377 - 9266) + '\x31', 8), **Dl7jGuYToI93):
aJhItC_Vawlw = WqUC3KWvYVup.aJhItC_Vawlw(OeWW0F1dBPRQ, cRTh61qyvi24, keepdims=ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8))
m18o3UZhMi7n = WqUC3KWvYVup.aJhItC_Vawlw(OeWW0F1dBPRQ ** ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50), 8), cRTh61qyvi24, keepdims=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061', 8))
l38lb8xQZNsE = m18o3UZhMi7n - aJhItC_Vawlw ** ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50), 8)
AFGBo4BePxZi = (OeWW0F1dBPRQ - aJhItC_Vawlw) / WqUC3KWvYVup.sqrt(l38lb8xQZNsE + Xtig2zAKpR0T)
(FjcovgoHM1LG, nfeH4ZtvQXsW) = nEbJZ4wfte2w
dTXqLuPC2FBQ = KNyTy8rYcwji((None if WVxHKyX45z_L in cRTh61qyvi24 else W3g84rNiEdDQ(None) for WVxHKyX45z_L in vQr8gNKaIaWE(WqUC3KWvYVup.gompHBiTsfJT(OeWW0F1dBPRQ))))
FjcovgoHM1LG = FjcovgoHM1LG[dTXqLuPC2FBQ]
nfeH4ZtvQXsW = nfeH4ZtvQXsW[dTXqLuPC2FBQ]
if qkYxsmydG0V_ and xjPLimsZRgb9:
return nfeH4ZtvQXsW * AFGBo4BePxZi + FjcovgoHM1LG
if qkYxsmydG0V_:
return AFGBo4BePxZi + FjcovgoHM1LG
if xjPLimsZRgb9:
return nfeH4ZtvQXsW * AFGBo4BePxZi
return AFGBo4BePxZi
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
_pooling_output_shape
|
def _pooling_output_shape(input_shape, pool_size=(2, 2),
strides=None, padding='VALID'):
"""Helper: compute the output shape for the pooling layer."""
dims = (1,) + pool_size + (1,) # NHWC
spatial_strides = strides or (1,) * len(pool_size)
strides = (1,) + spatial_strides + (1,)
pads = padtype_to_pads(input_shape, dims, strides, padding)
operand_padded = onp.add(input_shape, onp.add(*zip(*pads)))
t = onp.floor_divide(onp.subtract(operand_padded, dims), strides) + 1
return tuple(t)
|
python
|
def _pooling_output_shape(input_shape, pool_size=(2, 2),
strides=None, padding='VALID'):
"""Helper: compute the output shape for the pooling layer."""
dims = (1,) + pool_size + (1,) # NHWC
spatial_strides = strides or (1,) * len(pool_size)
strides = (1,) + spatial_strides + (1,)
pads = padtype_to_pads(input_shape, dims, strides, padding)
operand_padded = onp.add(input_shape, onp.add(*zip(*pads)))
t = onp.floor_divide(onp.subtract(operand_padded, dims), strides) + 1
return tuple(t)
|
[
"def",
"_pooling_output_shape",
"(",
"input_shape",
",",
"pool_size",
"=",
"(",
"2",
",",
"2",
")",
",",
"strides",
"=",
"None",
",",
"padding",
"=",
"'VALID'",
")",
":",
"dims",
"=",
"(",
"1",
",",
")",
"+",
"pool_size",
"+",
"(",
"1",
",",
")",
"# NHWC",
"spatial_strides",
"=",
"strides",
"or",
"(",
"1",
",",
")",
"*",
"len",
"(",
"pool_size",
")",
"strides",
"=",
"(",
"1",
",",
")",
"+",
"spatial_strides",
"+",
"(",
"1",
",",
")",
"pads",
"=",
"padtype_to_pads",
"(",
"input_shape",
",",
"dims",
",",
"strides",
",",
"padding",
")",
"operand_padded",
"=",
"onp",
".",
"add",
"(",
"input_shape",
",",
"onp",
".",
"add",
"(",
"*",
"zip",
"(",
"*",
"pads",
")",
")",
")",
"t",
"=",
"onp",
".",
"floor_divide",
"(",
"onp",
".",
"subtract",
"(",
"operand_padded",
",",
"dims",
")",
",",
"strides",
")",
"+",
"1",
"return",
"tuple",
"(",
"t",
")"
] |
Helper: compute the output shape for the pooling layer.
|
[
"Helper",
":",
"compute",
"the",
"output",
"shape",
"for",
"the",
"pooling",
"layer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L361-L370
|
train
|
Helper function to compute the output shape for the pooling layer.
|
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,o0CgT5HP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3k,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(799 - 688) + chr(0b110001) + chr(0b110110) + chr(0b100111 + 0o17), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(898 - 846) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + '\061' + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1967 - 1917) + chr(0b110101) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x34' + '\x35', 56274 - 56266), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b110001) + chr(507 - 457) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011 + 0o0) + chr(54) + chr(53), 50639 - 50631), ehT0Px3KOsy9('\060' + chr(10490 - 10379) + chr(2153 - 2104) + chr(54) + '\x36', 8), ehT0Px3KOsy9(chr(789 - 741) + chr(0b1101111) + chr(0b110011) + chr(53) + chr(0b110101), 34353 - 34345), ehT0Px3KOsy9('\060' + chr(10437 - 10326) + '\x32' + chr(0b1 + 0o66) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(789 - 741) + chr(4106 - 3995) + chr(2165 - 2115) + chr(2073 - 2024) + chr(2734 - 2679), 16227 - 16219), ehT0Px3KOsy9(chr(0b110000) + chr(5025 - 4914) + chr(1742 - 1691) + chr(53) + chr(0b110000 + 0o5), 8), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(51) + chr(53) + chr(977 - 928), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101110 + 0o11) + chr(0b100101 + 0o13), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b101100 + 0o6) + chr(51) + '\060', 47777 - 47769), ehT0Px3KOsy9(chr(1588 - 1540) + '\157' + chr(50) + chr(55) + chr(0b101011 + 0o5), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(983 - 932) + '\x31', 34506 - 34498), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(54) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\061' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2509 - 2458) + '\x33' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + '\x32' + chr(2000 - 1945), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(2422 - 2370) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101000 + 0o13) + chr(55) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(257 - 146) + chr(0b11 + 0o56) + '\x37' + chr(0b101001 + 0o7), 15550 - 15542), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b1101 + 0o52) + chr(0b10101 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + '\x32' + chr(0b1110 + 0o47) + '\x35', 6912 - 6904), ehT0Px3KOsy9(chr(1721 - 1673) + chr(0b101001 + 0o106) + '\x31' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(7124 - 7013) + chr(0b110010) + chr(2181 - 2133) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(50) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(149 - 101) + '\x6f' + chr(49) + '\062' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + '\061' + '\x33' + chr(2281 - 2232), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\060' + '\061', 36469 - 36461), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\062' + chr(874 - 820), 38136 - 38128), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(54) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(170 - 117), 43018 - 43010), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b10001 + 0o42) + chr(0b1100 + 0o47) + chr(0b110111), 11400 - 11392), ehT0Px3KOsy9(chr(2085 - 2037) + '\157' + '\065' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(52) + chr(53), 8), ehT0Px3KOsy9(chr(1712 - 1664) + chr(0b1101111) + chr(481 - 431) + chr(54) + chr(0b110011), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + '\x35' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'X'), chr(0b10001 + 0o123) + chr(101) + '\x63' + chr(9353 - 9242) + chr(0b1100100) + chr(8150 - 8049))(chr(0b110000 + 0o105) + chr(7674 - 7558) + chr(0b11010 + 0o114) + chr(45) + chr(174 - 118)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def t8POUF7Xns6L(tANyZeuTfu5y, Cfgsn8VU7m6s=(ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062', 8)), r8knJmMTTKwv=None, TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b' V@\xeb'), chr(3049 - 2949) + '\x65' + '\143' + chr(0b11001 + 0o126) + chr(100) + '\145')('\165' + chr(0b1110100) + chr(102) + chr(0b101101) + chr(1221 - 1165))):
RbZ6GZw6Nz_V = (ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 20787 - 20779),) + Cfgsn8VU7m6s + (ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8),)
lPVc1n3o1YWa = r8knJmMTTKwv or (ehT0Px3KOsy9('\x30' + chr(9463 - 9352) + chr(49), 8),) * c2A0yzQpDQB3(Cfgsn8VU7m6s)
r8knJmMTTKwv = (ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100 + 0o55), 8),) + lPVc1n3o1YWa + (ehT0Px3KOsy9('\060' + chr(111) + chr(0b11111 + 0o22), 8),)
ClVKbku7IAE0 = O2j2jw2NUyNq(tANyZeuTfu5y, RbZ6GZw6Nz_V, r8knJmMTTKwv, TFLseEYASEKG)
CZ8qTqItLiRd = E84IQ9WvC5Je.add(tANyZeuTfu5y, E84IQ9WvC5Je.add(*pZ0NK2y6HRbn(*ClVKbku7IAE0)))
YeT3l7JgTbWR = E84IQ9WvC5Je.floor_divide(E84IQ9WvC5Je.subtract(CZ8qTqItLiRd, RbZ6GZw6Nz_V), r8knJmMTTKwv) + ehT0Px3KOsy9(chr(48) + chr(111) + chr(1554 - 1505), 8)
return KNyTy8rYcwji(YeT3l7JgTbWR)
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
_pooling_general
|
def _pooling_general(inputs, reducer, init_val, rescaler=None,
pool_size=(2, 2), strides=None, padding='VALID'):
"""Helper: general pooling computation used in pooling layers later."""
spatial_strides = strides or (1,) * len(pool_size)
rescale = rescaler(pool_size, spatial_strides, padding) if rescaler else None
dims = (1,) + pool_size + (1,) # NHWC
strides = (1,) + spatial_strides + (1,)
out = lax.reduce_window(inputs, init_val, reducer, dims, strides, padding)
return rescale(out, inputs) if rescale else out
|
python
|
def _pooling_general(inputs, reducer, init_val, rescaler=None,
pool_size=(2, 2), strides=None, padding='VALID'):
"""Helper: general pooling computation used in pooling layers later."""
spatial_strides = strides or (1,) * len(pool_size)
rescale = rescaler(pool_size, spatial_strides, padding) if rescaler else None
dims = (1,) + pool_size + (1,) # NHWC
strides = (1,) + spatial_strides + (1,)
out = lax.reduce_window(inputs, init_val, reducer, dims, strides, padding)
return rescale(out, inputs) if rescale else out
|
[
"def",
"_pooling_general",
"(",
"inputs",
",",
"reducer",
",",
"init_val",
",",
"rescaler",
"=",
"None",
",",
"pool_size",
"=",
"(",
"2",
",",
"2",
")",
",",
"strides",
"=",
"None",
",",
"padding",
"=",
"'VALID'",
")",
":",
"spatial_strides",
"=",
"strides",
"or",
"(",
"1",
",",
")",
"*",
"len",
"(",
"pool_size",
")",
"rescale",
"=",
"rescaler",
"(",
"pool_size",
",",
"spatial_strides",
",",
"padding",
")",
"if",
"rescaler",
"else",
"None",
"dims",
"=",
"(",
"1",
",",
")",
"+",
"pool_size",
"+",
"(",
"1",
",",
")",
"# NHWC",
"strides",
"=",
"(",
"1",
",",
")",
"+",
"spatial_strides",
"+",
"(",
"1",
",",
")",
"out",
"=",
"lax",
".",
"reduce_window",
"(",
"inputs",
",",
"init_val",
",",
"reducer",
",",
"dims",
",",
"strides",
",",
"padding",
")",
"return",
"rescale",
"(",
"out",
",",
"inputs",
")",
"if",
"rescale",
"else",
"out"
] |
Helper: general pooling computation used in pooling layers later.
|
[
"Helper",
":",
"general",
"pooling",
"computation",
"used",
"in",
"pooling",
"layers",
"later",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L373-L381
|
train
|
General pooling computation used in pooling layers later.
|
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,s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9M2g7fO0,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(0b1001011 + 0o44) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(853 - 805) + chr(0b1100000 + 0o17) + chr(0b110110) + chr(0b110001), 29026 - 29018), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(55) + chr(1225 - 1176), 452 - 444), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(0b110001) + chr(1018 - 970) + chr(0b10100 + 0o43), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(52) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b1011 + 0o47) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(8087 - 7976) + chr(49) + '\x37' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(1536 - 1486) + chr(0b110100) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(1986 - 1937) + chr(0b110110) + chr(0b110101), 3297 - 3289), ehT0Px3KOsy9('\x30' + chr(0b101000 + 0o107) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2742 - 2631) + chr(0b110001) + chr(275 - 221) + chr(0b110001), 19995 - 19987), ehT0Px3KOsy9('\060' + '\157' + '\x35' + chr(52), 7739 - 7731), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(53) + chr(0b110111 + 0o0), 63033 - 63025), ehT0Px3KOsy9('\x30' + chr(1503 - 1392) + chr(50) + '\064' + '\x37', 27664 - 27656), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2365 - 2316) + chr(48) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(53) + '\x30', 18440 - 18432), ehT0Px3KOsy9(chr(48) + chr(3167 - 3056) + '\062' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1488 - 1440) + '\157' + chr(49) + '\x35' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\064' + chr(0b100011 + 0o20), 8), ehT0Px3KOsy9(chr(0b110000) + chr(4887 - 4776) + chr(0b10111 + 0o32) + '\063' + chr(303 - 253), ord("\x08")), ehT0Px3KOsy9('\060' + chr(946 - 835) + chr(49) + chr(0b110011) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110110) + chr(0b1111 + 0o50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + '\063' + chr(0b1111 + 0o50) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(942 - 894) + '\157' + '\x32' + chr(0b110100) + chr(0b11111 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(0b10000 + 0o43) + chr(0b110011) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(51), 0o10), ehT0Px3KOsy9(chr(1540 - 1492) + '\157' + chr(49) + chr(51) + chr(0b110010), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(1130 - 1080) + chr(52) + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b1011 + 0o47) + chr(0b110010), 62079 - 62071), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b1010 + 0o53) + chr(0b110011), 33025 - 33017), ehT0Px3KOsy9('\x30' + '\157' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b101000 + 0o107) + chr(0b1100 + 0o45) + '\x33' + chr(2336 - 2286), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\060' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(458 - 410) + chr(0b100011 + 0o114) + chr(0b110 + 0o54) + '\x34' + chr(0b110011), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b101000 + 0o17) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10552 - 10441) + chr(0b11 + 0o60) + chr(0b110010 + 0o2) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + '\x32' + '\x34' + chr(0b101 + 0o56), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\064' + chr(0b0 + 0o63), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x31' + chr(54), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(0b110101) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b','), chr(0b1100100) + '\x65' + chr(9077 - 8978) + '\157' + '\x64' + chr(0b100100 + 0o101))('\x75' + chr(116) + chr(0b1011011 + 0o13) + chr(0b101101) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def TkazCUvq6BHN(vXoupepMtCXU, WWyM7qMMo1Lk, cXYCkhtJUEub, gP88CCCYUOdw=None, Cfgsn8VU7m6s=(ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1110 + 0o44), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062', 8)), r8knJmMTTKwv=None, TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b'Tp\xb5\x0e"'), chr(0b11001 + 0o113) + '\x65' + chr(99) + '\157' + chr(1008 - 908) + chr(0b10001 + 0o124))(chr(0b11000 + 0o135) + chr(0b1011011 + 0o31) + '\x66' + '\055' + chr(0b111000))):
lPVc1n3o1YWa = r8knJmMTTKwv or (ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 8),) * c2A0yzQpDQB3(Cfgsn8VU7m6s)
wcl967p_xgl3 = gP88CCCYUOdw(Cfgsn8VU7m6s, lPVc1n3o1YWa, TFLseEYASEKG) if gP88CCCYUOdw else None
RbZ6GZw6Nz_V = (ehT0Px3KOsy9(chr(48) + chr(7591 - 7480) + chr(2357 - 2308), 8),) + Cfgsn8VU7m6s + (ehT0Px3KOsy9(chr(966 - 918) + chr(0b1000110 + 0o51) + '\061', 8),)
r8knJmMTTKwv = (ehT0Px3KOsy9('\x30' + chr(4285 - 4174) + '\x31', 8),) + lPVc1n3o1YWa + (ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31', 8),)
UkrMp_I0RDmo = j2vHIidTbj13.reduce_window(vXoupepMtCXU, cXYCkhtJUEub, WWyM7qMMo1Lk, RbZ6GZw6Nz_V, r8knJmMTTKwv, TFLseEYASEKG)
return wcl967p_xgl3(UkrMp_I0RDmo, vXoupepMtCXU) if wcl967p_xgl3 else UkrMp_I0RDmo
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
Dropout
|
def Dropout(x, params, rate=0.0, mode='train', rng=None, **kwargs):
"""Layer construction function for a dropout layer with given rate."""
del params, kwargs
if rng is None:
msg = ('Dropout layer requires apply_fun to be called with a rng keyword '
'argument. That is, instead of `Dropout(params, inputs)`, call '
'it like `Dropout(params, inputs, rng=key)`.')
raise ValueError(msg)
if rate >= 1.0:
raise ValueError('Dropout rate (%f) must be lower than 1.' % rate)
if mode == 'train' and rate > 0.0:
keep = backend.random.bernoulli(rng, 1.0 - rate, x.shape)
return np.where(keep, x / (1.0 - rate), 0)
else:
return x
|
python
|
def Dropout(x, params, rate=0.0, mode='train', rng=None, **kwargs):
"""Layer construction function for a dropout layer with given rate."""
del params, kwargs
if rng is None:
msg = ('Dropout layer requires apply_fun to be called with a rng keyword '
'argument. That is, instead of `Dropout(params, inputs)`, call '
'it like `Dropout(params, inputs, rng=key)`.')
raise ValueError(msg)
if rate >= 1.0:
raise ValueError('Dropout rate (%f) must be lower than 1.' % rate)
if mode == 'train' and rate > 0.0:
keep = backend.random.bernoulli(rng, 1.0 - rate, x.shape)
return np.where(keep, x / (1.0 - rate), 0)
else:
return x
|
[
"def",
"Dropout",
"(",
"x",
",",
"params",
",",
"rate",
"=",
"0.0",
",",
"mode",
"=",
"'train'",
",",
"rng",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"del",
"params",
",",
"kwargs",
"if",
"rng",
"is",
"None",
":",
"msg",
"=",
"(",
"'Dropout layer requires apply_fun to be called with a rng keyword '",
"'argument. That is, instead of `Dropout(params, inputs)`, call '",
"'it like `Dropout(params, inputs, rng=key)`.'",
")",
"raise",
"ValueError",
"(",
"msg",
")",
"if",
"rate",
">=",
"1.0",
":",
"raise",
"ValueError",
"(",
"'Dropout rate (%f) must be lower than 1.'",
"%",
"rate",
")",
"if",
"mode",
"==",
"'train'",
"and",
"rate",
">",
"0.0",
":",
"keep",
"=",
"backend",
".",
"random",
".",
"bernoulli",
"(",
"rng",
",",
"1.0",
"-",
"rate",
",",
"x",
".",
"shape",
")",
"return",
"np",
".",
"where",
"(",
"keep",
",",
"x",
"/",
"(",
"1.0",
"-",
"rate",
")",
",",
"0",
")",
"else",
":",
"return",
"x"
] |
Layer construction function for a dropout layer with given rate.
|
[
"Layer",
"construction",
"function",
"for",
"a",
"dropout",
"layer",
"with",
"given",
"rate",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L415-L429
|
train
|
Layer construction function for a dropout layer with given rate.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKt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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(202 - 154) + chr(111) + chr(54) + chr(2092 - 2042), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(123 - 12) + chr(0b11011 + 0o26) + chr(49) + chr(51), 0b1000), ehT0Px3KOsy9(chr(1284 - 1236) + chr(4224 - 4113) + chr(0b110100) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(2142 - 2031) + chr(49) + chr(0b110100) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x36' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(0b110111) + '\060', 0o10), ehT0Px3KOsy9(chr(569 - 521) + chr(0b1010011 + 0o34) + chr(0b1011 + 0o50) + '\x30' + chr(829 - 776), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(55) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1011 + 0o47) + chr(53) + chr(50), 0b1000), ehT0Px3KOsy9(chr(2135 - 2087) + '\x6f' + '\x32' + chr(54) + chr(0b110111), 54356 - 54348), ehT0Px3KOsy9('\x30' + chr(0b100100 + 0o113) + '\x32' + '\061' + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + chr(0b10110 + 0o34) + chr(0b11000 + 0o30), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(2922 - 2811) + chr(1102 - 1052) + chr(0b100000 + 0o24) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2111 - 2060) + chr(2003 - 1951) + '\063', 31271 - 31263), ehT0Px3KOsy9(chr(658 - 610) + chr(9417 - 9306) + '\x31' + '\061' + chr(468 - 420), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\060' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1001001 + 0o46) + '\x31' + '\x36', 8), ehT0Px3KOsy9('\x30' + chr(1074 - 963) + chr(0b110001) + chr(54) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1154 - 1104) + chr(55) + '\061', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(854 - 805) + chr(136 - 88) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7663 - 7552) + chr(0b110011) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110101) + chr(1111 - 1059), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x37' + chr(0b100111 + 0o20), 0o10), ehT0Px3KOsy9('\060' + chr(4946 - 4835) + '\x31' + '\x30' + chr(1050 - 1002), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b101100 + 0o6) + chr(0b11100 + 0o31) + chr(0b110010 + 0o4), 18830 - 18822), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111 + 0o0) + '\064' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11763 - 11652) + chr(0b110011) + chr(49) + chr(0b11010 + 0o30), 0b1000), ehT0Px3KOsy9(chr(1162 - 1114) + chr(11192 - 11081) + '\067' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101011 + 0o6) + '\x35' + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(3004 - 2893) + chr(0b110010 + 0o1) + chr(0b101000 + 0o14) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(51) + chr(0b110110) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(54) + chr(0b1001 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(2453 - 2399) + chr(0b11 + 0o61), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10100 + 0o133) + chr(2042 - 1991) + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10011 + 0o37) + '\060' + chr(1975 - 1922), 56573 - 56565), ehT0Px3KOsy9('\x30' + chr(7946 - 7835) + chr(50) + '\060' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b101010 + 0o105) + '\x32' + '\064' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(8925 - 8814) + chr(340 - 291) + '\066' + chr(1208 - 1153), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(8988 - 8877) + chr(0b101 + 0o60) + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c'), '\144' + '\x65' + chr(99) + chr(0b1011110 + 0o21) + chr(3575 - 3475) + chr(0b1100101))(chr(10619 - 10502) + chr(116) + chr(4410 - 4308) + chr(1136 - 1091) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xyzKAqpSri57(OeWW0F1dBPRQ, nEbJZ4wfte2w, YygZh57sDDVX=0.0, holLFgwB7vsP=xafqLlk3kkUe(SXOLrMavuUCe(b'F|*N\r'), chr(0b1100100) + chr(3703 - 3602) + '\x63' + chr(6621 - 6510) + chr(365 - 265) + '\x65')(chr(0b1100111 + 0o16) + '\164' + chr(0b1100110) + '\x2d' + chr(0b11111 + 0o31)), OKPXzuZwN61O=None, **M8EIoTs2GJXE):
del nEbJZ4wfte2w, M8EIoTs2GJXE
if OKPXzuZwN61O is None:
jtbovtaIYjRB = xafqLlk3kkUe(SXOLrMavuUCe(b"v|$W\x0c\x06\xcc\xe5\x92\xcb\xce\xeab\x85\x91-\xb1{\x1c\xcb W8MO0\xc2Y\x95Z\x1f\x8b\xd1\xc1[\xd3\xe7\xe7\x82\x14Sb'B\x07S\xcf\xac\x8a\xc2\x97\xee0\xd7\x8d/\xe0e\x10\xc02KjH\x1f!\xdcG\xbfQ\x0f\x8b\x85\x9b\x14\xa7\xed\xe3\xd6W[}g\x07\n\x1d\xcb\xb1\x9b\xcb\xd3\xaf\x7f\xc3\xc3(\x84|\x1a\xc9*Ql\x04O!\xdcA\xa7OF\xc5\x98\xdbD\x86\xf1\xf1\x8b\x17\x1e.(F\x0f\x1f\x98\xac\x8a\x8a\xdb\xe6{\xc0\xc3(\x84|\x1a\xc9*Ql\x04O!\xdcA\xa7OF\xc5\x98\xdbD\x86\xf1\xf1\x8eW@`,\x1a\x08\x16\xc1\xec\x9e\x84"), chr(0b1001111 + 0o25) + '\145' + chr(6760 - 6661) + chr(0b1101111) + chr(0b1100100) + chr(2550 - 2449))(chr(0b1000000 + 0o65) + chr(0b111011 + 0o71) + chr(0b1100110) + '\055' + chr(0b100100 + 0o24))
raise q1QCh3W88sgk(jtbovtaIYjRB)
if YygZh57sDDVX >= 1.0:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'v|$W\x0c\x06\xcc\xe5\x8c\xcb\xc3\xea0\x8d\xc6.\xe9.\x18\xcc6P8NZ`\xc2O\xbdY\x18\xc5\x85\xddU\x9d\xa5\xb3\x8c'), chr(0b1101 + 0o127) + chr(0b1100101) + '\x63' + chr(9025 - 8914) + '\x64' + '\145')('\165' + '\x74' + chr(102) + chr(45) + '\070') % YygZh57sDDVX)
if holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'F|*N\r'), chr(7228 - 7128) + chr(0b11 + 0o142) + chr(0b1100011) + chr(0b111100 + 0o63) + chr(7229 - 7129) + '\x65')('\x75' + chr(229 - 113) + chr(8638 - 8536) + chr(0b100101 + 0o10) + chr(2551 - 2495)) and YygZh57sDDVX > 0.0:
KYBTv50xVjCE = bwojgsUvRJpy.random.bernoulli(OKPXzuZwN61O, 1.0 - YygZh57sDDVX, OeWW0F1dBPRQ.nauYfLglTpcb)
return xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'V\\\rf F\x81\xbc\xaf\xe8\xda\xd0'), chr(0b1100100) + '\145' + chr(8991 - 8892) + chr(11669 - 11558) + chr(7970 - 7870) + chr(0b1100101))('\165' + chr(4577 - 4461) + '\x66' + chr(0b101 + 0o50) + '\x38'))(KYBTv50xVjCE, OeWW0F1dBPRQ / (1.0 - YygZh57sDDVX), ehT0Px3KOsy9(chr(48) + chr(0b10 + 0o155) + '\x30', 0o10))
else:
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
Conv._kernel_shape
|
def _kernel_shape(self, input_shape):
"""Helper to calculate the kernel shape."""
kernel_size_iter = iter(self._kernel_size)
return [self._filters if c == 'O' else
input_shape[self._lhs_spec.index('C')] if c == 'I' else
next(kernel_size_iter) for c in self._rhs_spec]
|
python
|
def _kernel_shape(self, input_shape):
"""Helper to calculate the kernel shape."""
kernel_size_iter = iter(self._kernel_size)
return [self._filters if c == 'O' else
input_shape[self._lhs_spec.index('C')] if c == 'I' else
next(kernel_size_iter) for c in self._rhs_spec]
|
[
"def",
"_kernel_shape",
"(",
"self",
",",
"input_shape",
")",
":",
"kernel_size_iter",
"=",
"iter",
"(",
"self",
".",
"_kernel_size",
")",
"return",
"[",
"self",
".",
"_filters",
"if",
"c",
"==",
"'O'",
"else",
"input_shape",
"[",
"self",
".",
"_lhs_spec",
".",
"index",
"(",
"'C'",
")",
"]",
"if",
"c",
"==",
"'I'",
"else",
"next",
"(",
"kernel_size_iter",
")",
"for",
"c",
"in",
"self",
".",
"_rhs_spec",
"]"
] |
Helper to calculate the kernel shape.
|
[
"Helper",
"to",
"calculate",
"the",
"kernel",
"shape",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L226-L231
|
train
|
Helper to calculate the kernel shape.
|
Pu7Z6IJCgH3a,vcEHX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AMbUz4aLg,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(0b110011) + chr(192 - 137), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010111 + 0o30) + chr(49) + chr(0b110111) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11011 + 0o124) + chr(221 - 169) + chr(1717 - 1669), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(55) + '\064', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001 + 0o2) + '\x31', 41269 - 41261), ehT0Px3KOsy9(chr(48) + chr(0b100111 + 0o110) + chr(50) + chr(0b110101 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(1585 - 1537) + chr(0b101101 + 0o102) + chr(0b110011) + '\x36' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\x37' + '\x37', 43301 - 43293), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(0b101000 + 0o12) + chr(0b1100 + 0o52) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1091 - 1041) + chr(101 - 51) + chr(1600 - 1545), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(292 - 241) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3667 - 3556) + '\061' + chr(2444 - 2390) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\x32' + chr(0b1000 + 0o50), 48477 - 48469), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b11101 + 0o122) + '\x31' + chr(0b110011) + chr(0b0 + 0o64), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(2256 - 2207) + chr(0b1110 + 0o42) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(2154 - 2100) + chr(1278 - 1228), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100001 + 0o22) + chr(1166 - 1113) + chr(0b110000), 34563 - 34555), ehT0Px3KOsy9(chr(370 - 322) + '\157' + chr(583 - 533) + chr(1483 - 1428) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(1115 - 1067) + chr(0b1101111) + '\061' + chr(0b111 + 0o53) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(3688 - 3577) + chr(0b11011 + 0o26) + chr(847 - 796) + chr(1439 - 1387), 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(2843 - 2732) + chr(50) + chr(0b110101) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(421 - 373) + chr(5591 - 5480) + chr(0b110010) + '\067' + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + chr(0b110101) + chr(2464 - 2414), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(2281 - 2170) + '\x35' + chr(0b110110), 38123 - 38115), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\066' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(987 - 936) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(3932 - 3821) + chr(1959 - 1909) + '\x30', 0b1000), ehT0Px3KOsy9(chr(1057 - 1009) + chr(0b1100 + 0o143) + chr(0b110011) + '\061' + '\062', 0b1000), ehT0Px3KOsy9(chr(943 - 895) + chr(0b1010110 + 0o31) + chr(49) + '\x36' + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6058 - 5947) + chr(0b110001) + '\x32' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + chr(50) + '\x36' + chr(0b110000), 42320 - 42312), ehT0Px3KOsy9('\060' + chr(3333 - 3222) + chr(52) + chr(0b100111 + 0o16), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110101) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110000 + 0o77) + '\064', 8), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1011010 + 0o25) + '\x31' + chr(0b110000) + chr(0b1011 + 0o51), 8), ehT0Px3KOsy9(chr(2068 - 2020) + chr(0b1011000 + 0o27) + '\x31' + '\x37' + chr(0b101001 + 0o13), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(0b110000) + chr(48), 19392 - 19384), ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + '\x31' + chr(0b100011 + 0o16) + chr(196 - 143), 41306 - 41298), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\x36' + chr(50), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + chr(53) + chr(48), 5486 - 5478)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'1'), chr(100) + chr(0b1100 + 0o131) + '\143' + chr(2718 - 2607) + '\x64' + chr(5720 - 5619))(chr(7552 - 7435) + chr(713 - 597) + '\146' + chr(45) + chr(2227 - 2171)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def t486guAmpXY_(oVre8I6UXc3b, tANyZeuTfu5y):
jhSxCixk26Bt = ZdP978XkGspL(oVre8I6UXc3b._kernel_size)
return [xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'q\x08w\x11~ L\xa2\xd4\xd9\xd9d'), chr(0b110100 + 0o60) + chr(0b10101 + 0o120) + chr(0b1100011) + '\157' + chr(0b1001011 + 0o31) + chr(7421 - 7320))(chr(0b1110101) + chr(0b110111 + 0o75) + chr(0b1100110) + '\x2d' + '\070')) if qzn1Ctg9WgNh == xafqLlk3kkUe(SXOLrMavuUCe(b'P'), chr(0b1010001 + 0o23) + chr(4279 - 4178) + '\143' + chr(10131 - 10020) + chr(0b111000 + 0o54) + '\x65')('\165' + '\x74' + chr(0b1100110) + chr(0b10010 + 0o33) + chr(0b111000)) else tANyZeuTfu5y[xafqLlk3kkUe(oVre8I6UXc3b._lhs_spec, xafqLlk3kkUe(SXOLrMavuUCe(b'G\x1aO\x0bV{_\xb8\xe5\xe5\xdb%'), '\x64' + '\145' + chr(0b1100011) + chr(1633 - 1522) + chr(5397 - 5297) + '\145')('\x75' + '\164' + chr(7738 - 7636) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\\'), chr(714 - 614) + chr(0b1010 + 0o133) + '\x63' + chr(111) + '\x64' + chr(0b1100101))(chr(0b1110101) + '\164' + '\146' + '\x2d' + chr(1071 - 1015)))] if qzn1Ctg9WgNh == xafqLlk3kkUe(SXOLrMavuUCe(b'V'), chr(0b1000000 + 0o44) + chr(0b1100101) + chr(0b100010 + 0o101) + chr(0b1101111) + chr(100) + '\145')(chr(0b1110101) + chr(116) + '\x66' + chr(0b100110 + 0o7) + '\x38') else nSwwHEeM4cxI(jhSxCixk26Bt) for qzn1Ctg9WgNh in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'@\x0cH\x0f[je\x96\xdc'), '\144' + '\x65' + '\143' + '\x6f' + '\144' + chr(0b1100101))('\x75' + chr(116) + '\146' + '\055' + '\x38'))]
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
Conv._conv_shape_tuple
|
def _conv_shape_tuple(self, lhs_shape, rhs_shape, strides, pads):
"""Compute the shape of a conv given input shapes in canonical order."""
if isinstance(pads, str):
pads = padtype_to_pads(lhs_shape[2:], rhs_shape[2:], strides, pads)
if len(pads) != len(lhs_shape) - 2:
msg = 'Wrong number of explicit pads for conv: expected {}, got {}.'
raise TypeError(msg.format(len(lhs_shape) - 2, len(pads)))
lhs_padded = onp.add(lhs_shape[2:], onp.add(*zip(*pads)))
out_space = onp.floor_divide(
onp.subtract(lhs_padded, rhs_shape[2:]), strides) + 1
out_space = onp.maximum(0, out_space)
out_shape = (lhs_shape[0], rhs_shape[0]) + tuple(out_space)
return tuple(out_shape)
|
python
|
def _conv_shape_tuple(self, lhs_shape, rhs_shape, strides, pads):
"""Compute the shape of a conv given input shapes in canonical order."""
if isinstance(pads, str):
pads = padtype_to_pads(lhs_shape[2:], rhs_shape[2:], strides, pads)
if len(pads) != len(lhs_shape) - 2:
msg = 'Wrong number of explicit pads for conv: expected {}, got {}.'
raise TypeError(msg.format(len(lhs_shape) - 2, len(pads)))
lhs_padded = onp.add(lhs_shape[2:], onp.add(*zip(*pads)))
out_space = onp.floor_divide(
onp.subtract(lhs_padded, rhs_shape[2:]), strides) + 1
out_space = onp.maximum(0, out_space)
out_shape = (lhs_shape[0], rhs_shape[0]) + tuple(out_space)
return tuple(out_shape)
|
[
"def",
"_conv_shape_tuple",
"(",
"self",
",",
"lhs_shape",
",",
"rhs_shape",
",",
"strides",
",",
"pads",
")",
":",
"if",
"isinstance",
"(",
"pads",
",",
"str",
")",
":",
"pads",
"=",
"padtype_to_pads",
"(",
"lhs_shape",
"[",
"2",
":",
"]",
",",
"rhs_shape",
"[",
"2",
":",
"]",
",",
"strides",
",",
"pads",
")",
"if",
"len",
"(",
"pads",
")",
"!=",
"len",
"(",
"lhs_shape",
")",
"-",
"2",
":",
"msg",
"=",
"'Wrong number of explicit pads for conv: expected {}, got {}.'",
"raise",
"TypeError",
"(",
"msg",
".",
"format",
"(",
"len",
"(",
"lhs_shape",
")",
"-",
"2",
",",
"len",
"(",
"pads",
")",
")",
")",
"lhs_padded",
"=",
"onp",
".",
"add",
"(",
"lhs_shape",
"[",
"2",
":",
"]",
",",
"onp",
".",
"add",
"(",
"*",
"zip",
"(",
"*",
"pads",
")",
")",
")",
"out_space",
"=",
"onp",
".",
"floor_divide",
"(",
"onp",
".",
"subtract",
"(",
"lhs_padded",
",",
"rhs_shape",
"[",
"2",
":",
"]",
")",
",",
"strides",
")",
"+",
"1",
"out_space",
"=",
"onp",
".",
"maximum",
"(",
"0",
",",
"out_space",
")",
"out_shape",
"=",
"(",
"lhs_shape",
"[",
"0",
"]",
",",
"rhs_shape",
"[",
"0",
"]",
")",
"+",
"tuple",
"(",
"out_space",
")",
"return",
"tuple",
"(",
"out_shape",
")"
] |
Compute the shape of a conv given input shapes in canonical order.
|
[
"Compute",
"the",
"shape",
"of",
"a",
"conv",
"given",
"input",
"shapes",
"in",
"canonical",
"order",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L233-L245
|
train
|
Compute the shape of a conv given input shapes in canonical order.
|
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,koC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6mjyZZT,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(1655 - 1607) + chr(0b1101111) + chr(0b101101 + 0o10), 6870 - 6862), ehT0Px3KOsy9('\x30' + chr(7101 - 6990) + chr(0b1110 + 0o43) + chr(53) + '\066', 0o10), ehT0Px3KOsy9(chr(1908 - 1860) + chr(0b1101111) + '\063', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x30' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + '\x33' + '\x34' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\x33' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010100 + 0o33) + '\061' + chr(0b101101 + 0o10), 56146 - 56138), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\065' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1814 - 1764) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101110 + 0o1) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(313 - 265) + chr(0b111111 + 0o60) + chr(49) + chr(54) + chr(2370 - 2321), 0o10), ehT0Px3KOsy9(chr(931 - 883) + chr(0b1100111 + 0o10) + chr(807 - 757) + chr(902 - 851) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1763 - 1712) + chr(0b100010 + 0o21) + chr(0b11011 + 0o26), 51484 - 51476), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(0b101 + 0o55) + chr(0b110111) + chr(0b11111 + 0o21), 0b1000), ehT0Px3KOsy9(chr(1840 - 1792) + '\x6f' + chr(881 - 830) + '\063' + chr(748 - 700), 0b1000), ehT0Px3KOsy9(chr(492 - 444) + chr(0b1101111) + '\062' + chr(774 - 720) + chr(162 - 107), 0b1000), ehT0Px3KOsy9('\060' + chr(8454 - 8343) + '\x32' + '\064' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100 + 0o55) + chr(382 - 330) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(51) + chr(55) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(991 - 943) + '\x6f' + chr(49) + chr(50) + chr(0b10001 + 0o37), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(0b110001) + chr(52) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(2829 - 2718) + chr(49) + chr(0b11001 + 0o32) + chr(0b11010 + 0o27), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\064' + chr(50), 9861 - 9853), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(1273 - 1223) + chr(2164 - 2111), 61779 - 61771), ehT0Px3KOsy9(chr(48) + chr(7555 - 7444) + '\x36' + chr(0b101101 + 0o12), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b11000 + 0o30), 22611 - 22603), ehT0Px3KOsy9(chr(93 - 45) + chr(0b1011011 + 0o24) + chr(772 - 723) + chr(50) + chr(0b110000 + 0o1), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11111 + 0o120) + chr(1497 - 1443) + chr(0b1111 + 0o42), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(515 - 462) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + '\063' + chr(948 - 898) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(671 - 623) + chr(6383 - 6272) + '\062' + '\065' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(7861 - 7750) + '\x32' + chr(1204 - 1155) + chr(0b110110), 1722 - 1714), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(52) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b101011 + 0o104) + '\x33' + '\065' + chr(0b10 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1294 - 1245) + chr(50) + chr(1563 - 1513), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1001011 + 0o44) + chr(49) + '\x31' + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(695 - 641), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b10011 + 0o42) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'+'), '\144' + '\145' + chr(9058 - 8959) + '\x6f' + chr(100) + chr(6824 - 6723))(chr(117) + '\164' + chr(0b100011 + 0o103) + chr(0b101100 + 0o1) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def XPSh5fc3_C5e(oVre8I6UXc3b, zmxPnqM6Cprm, d9gHf_KW1oJw, r8knJmMTTKwv, ClVKbku7IAE0):
if PlSM16l2KDPD(ClVKbku7IAE0, M8_cKLkHVB2V):
ClVKbku7IAE0 = O2j2jw2NUyNq(zmxPnqM6Cprm[ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + '\062', 0o10):], d9gHf_KW1oJw[ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010), 8):], r8knJmMTTKwv, ClVKbku7IAE0)
if c2A0yzQpDQB3(ClVKbku7IAE0) != c2A0yzQpDQB3(zmxPnqM6Cprm) - ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(7463 - 7352) + chr(1227 - 1177), 8):
jtbovtaIYjRB = xafqLlk3kkUe(SXOLrMavuUCe(b'R\x1cl\xad\x86\xb8c\x19yb\x14\xec\xf9\xd7\xbe\x97\xc6\x1a`\x959\x050e\x82%V|"!W\x04\xa4\x8f\xed\x8b\x86$t.`\x16s\xa6\x82\xech\x084{\x0c\xb2\xf9\xdf\xb7\xc3\x83\x19m\xd7'), chr(0b11101 + 0o107) + '\x65' + '\x63' + '\x6f' + chr(100) + '\x65')(chr(0b1001110 + 0o47) + chr(0b1010110 + 0o36) + chr(5128 - 5026) + chr(45) + chr(1795 - 1739))
raise sznFqDbNBHlx(xafqLlk3kkUe(jtbovtaIYjRB, xafqLlk3kkUe(SXOLrMavuUCe(b'SZq\xac\xa9\xf9^_Dp\x14\xf4'), '\x64' + '\x65' + '\x63' + chr(111) + chr(100) + chr(6217 - 6116))(chr(117) + chr(116) + chr(4019 - 3917) + chr(45) + '\070'))(c2A0yzQpDQB3(zmxPnqM6Cprm) - ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32', 8), c2A0yzQpDQB3(ClVKbku7IAE0)))
Sh2TsHg9_AiL = E84IQ9WvC5Je.add(zmxPnqM6Cprm[ehT0Px3KOsy9(chr(1144 - 1096) + '\157' + chr(1944 - 1894), 8):], E84IQ9WvC5Je.add(*pZ0NK2y6HRbn(*ClVKbku7IAE0)))
HT4q9IpdMdyp = E84IQ9WvC5Je.floor_divide(E84IQ9WvC5Je.subtract(Sh2TsHg9_AiL, d9gHf_KW1oJw[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b0 + 0o62), 8):]), r8knJmMTTKwv) + ehT0Px3KOsy9(chr(0b110000) + chr(11859 - 11748) + '\061', 8)
HT4q9IpdMdyp = E84IQ9WvC5Je.maximum(ehT0Px3KOsy9(chr(1481 - 1433) + '\x6f' + chr(48), 8), HT4q9IpdMdyp)
wjefSqyQUekw = (zmxPnqM6Cprm[ehT0Px3KOsy9(chr(48) + '\157' + chr(832 - 784), 8)], d9gHf_KW1oJw[ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11111 + 0o21), 8)]) + KNyTy8rYcwji(HT4q9IpdMdyp)
return KNyTy8rYcwji(wjefSqyQUekw)
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
Conv._conv_general_permutations
|
def _conv_general_permutations(self, dimension_numbers):
"""Utility for convolution dimension permutations relative to Conv HLO."""
lhs_spec, rhs_spec, out_spec = dimension_numbers
lhs_char, rhs_char, out_char = ('N', 'C'), ('O', 'I'), ('N', 'C')
charpairs = (lhs_char, rhs_char, out_char)
for i, (a, b) in enumerate(charpairs):
if not (dimension_numbers[i].count(a) == 1 and
dimension_numbers[i].count(b) == 1):
msg = ('convolution dimension_numbers[{}] must contain the characters '
'"{}" and "{}" exatly once, got {}.')
raise TypeError(msg.format(i, a, b, dimension_numbers[i]))
if len(dimension_numbers[i]) != len(set(dimension_numbers[i])):
msg = ('convolution dimension_numbers[{}] cannot have duplicate '
'characters, got {}.')
raise TypeError(msg.format(i, dimension_numbers[i]))
if not (set(lhs_spec) - set(lhs_char) == set(rhs_spec) - set(rhs_char) ==
set(out_spec) - set(out_char)):
msg = ('convolution dimension_numbers elements must each have the same '
'set of spatial characters, got {}.')
raise TypeError(msg.format(dimension_numbers))
def getperm(spec, charpair):
spatial = (i for i, c in enumerate(spec) if c not in charpair)
if spec is not rhs_spec:
spatial = sorted(spatial, key=lambda i: rhs_spec.index(spec[i]))
return (spec.index(charpair[0]), spec.index(charpair[1])) + tuple(spatial)
lhs_perm, rhs_perm, out_perm = map(getperm, dimension_numbers, charpairs)
return lhs_perm, rhs_perm, out_perm
|
python
|
def _conv_general_permutations(self, dimension_numbers):
"""Utility for convolution dimension permutations relative to Conv HLO."""
lhs_spec, rhs_spec, out_spec = dimension_numbers
lhs_char, rhs_char, out_char = ('N', 'C'), ('O', 'I'), ('N', 'C')
charpairs = (lhs_char, rhs_char, out_char)
for i, (a, b) in enumerate(charpairs):
if not (dimension_numbers[i].count(a) == 1 and
dimension_numbers[i].count(b) == 1):
msg = ('convolution dimension_numbers[{}] must contain the characters '
'"{}" and "{}" exatly once, got {}.')
raise TypeError(msg.format(i, a, b, dimension_numbers[i]))
if len(dimension_numbers[i]) != len(set(dimension_numbers[i])):
msg = ('convolution dimension_numbers[{}] cannot have duplicate '
'characters, got {}.')
raise TypeError(msg.format(i, dimension_numbers[i]))
if not (set(lhs_spec) - set(lhs_char) == set(rhs_spec) - set(rhs_char) ==
set(out_spec) - set(out_char)):
msg = ('convolution dimension_numbers elements must each have the same '
'set of spatial characters, got {}.')
raise TypeError(msg.format(dimension_numbers))
def getperm(spec, charpair):
spatial = (i for i, c in enumerate(spec) if c not in charpair)
if spec is not rhs_spec:
spatial = sorted(spatial, key=lambda i: rhs_spec.index(spec[i]))
return (spec.index(charpair[0]), spec.index(charpair[1])) + tuple(spatial)
lhs_perm, rhs_perm, out_perm = map(getperm, dimension_numbers, charpairs)
return lhs_perm, rhs_perm, out_perm
|
[
"def",
"_conv_general_permutations",
"(",
"self",
",",
"dimension_numbers",
")",
":",
"lhs_spec",
",",
"rhs_spec",
",",
"out_spec",
"=",
"dimension_numbers",
"lhs_char",
",",
"rhs_char",
",",
"out_char",
"=",
"(",
"'N'",
",",
"'C'",
")",
",",
"(",
"'O'",
",",
"'I'",
")",
",",
"(",
"'N'",
",",
"'C'",
")",
"charpairs",
"=",
"(",
"lhs_char",
",",
"rhs_char",
",",
"out_char",
")",
"for",
"i",
",",
"(",
"a",
",",
"b",
")",
"in",
"enumerate",
"(",
"charpairs",
")",
":",
"if",
"not",
"(",
"dimension_numbers",
"[",
"i",
"]",
".",
"count",
"(",
"a",
")",
"==",
"1",
"and",
"dimension_numbers",
"[",
"i",
"]",
".",
"count",
"(",
"b",
")",
"==",
"1",
")",
":",
"msg",
"=",
"(",
"'convolution dimension_numbers[{}] must contain the characters '",
"'\"{}\" and \"{}\" exatly once, got {}.'",
")",
"raise",
"TypeError",
"(",
"msg",
".",
"format",
"(",
"i",
",",
"a",
",",
"b",
",",
"dimension_numbers",
"[",
"i",
"]",
")",
")",
"if",
"len",
"(",
"dimension_numbers",
"[",
"i",
"]",
")",
"!=",
"len",
"(",
"set",
"(",
"dimension_numbers",
"[",
"i",
"]",
")",
")",
":",
"msg",
"=",
"(",
"'convolution dimension_numbers[{}] cannot have duplicate '",
"'characters, got {}.'",
")",
"raise",
"TypeError",
"(",
"msg",
".",
"format",
"(",
"i",
",",
"dimension_numbers",
"[",
"i",
"]",
")",
")",
"if",
"not",
"(",
"set",
"(",
"lhs_spec",
")",
"-",
"set",
"(",
"lhs_char",
")",
"==",
"set",
"(",
"rhs_spec",
")",
"-",
"set",
"(",
"rhs_char",
")",
"==",
"set",
"(",
"out_spec",
")",
"-",
"set",
"(",
"out_char",
")",
")",
":",
"msg",
"=",
"(",
"'convolution dimension_numbers elements must each have the same '",
"'set of spatial characters, got {}.'",
")",
"raise",
"TypeError",
"(",
"msg",
".",
"format",
"(",
"dimension_numbers",
")",
")",
"def",
"getperm",
"(",
"spec",
",",
"charpair",
")",
":",
"spatial",
"=",
"(",
"i",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"spec",
")",
"if",
"c",
"not",
"in",
"charpair",
")",
"if",
"spec",
"is",
"not",
"rhs_spec",
":",
"spatial",
"=",
"sorted",
"(",
"spatial",
",",
"key",
"=",
"lambda",
"i",
":",
"rhs_spec",
".",
"index",
"(",
"spec",
"[",
"i",
"]",
")",
")",
"return",
"(",
"spec",
".",
"index",
"(",
"charpair",
"[",
"0",
"]",
")",
",",
"spec",
".",
"index",
"(",
"charpair",
"[",
"1",
"]",
")",
")",
"+",
"tuple",
"(",
"spatial",
")",
"lhs_perm",
",",
"rhs_perm",
",",
"out_perm",
"=",
"map",
"(",
"getperm",
",",
"dimension_numbers",
",",
"charpairs",
")",
"return",
"lhs_perm",
",",
"rhs_perm",
",",
"out_perm"
] |
Utility for convolution dimension permutations relative to Conv HLO.
|
[
"Utility",
"for",
"convolution",
"dimension",
"permutations",
"relative",
"to",
"Conv",
"HLO",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L247-L275
|
train
|
Utility for convolution dimension permutations relative to Conv HLO.
|
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,GN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gh9gDP,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(0b110111) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(2179 - 2068) + '\x31' + '\065' + '\x37', 0b1000), ehT0Px3KOsy9(chr(1849 - 1801) + chr(11860 - 11749) + chr(0b101101 + 0o6) + chr(473 - 425) + chr(861 - 807), 64795 - 64787), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + chr(50) + chr(0b110010) + chr(325 - 273), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b110001 + 0o0) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + chr(0b101 + 0o56) + chr(51) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1623 - 1572) + chr(0b11100 + 0o26) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1100001 + 0o16) + chr(0b110010) + chr(0b110000) + chr(0b110000), 16803 - 16795), ehT0Px3KOsy9(chr(48) + chr(0b101000 + 0o107) + chr(50) + chr(51) + '\x34', 0b1000), ehT0Px3KOsy9(chr(1954 - 1906) + chr(6437 - 6326) + '\x34' + chr(379 - 325), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(618 - 507) + chr(49) + chr(0b101111 + 0o3) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110101) + '\067', 5130 - 5122), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(1962 - 1914) + '\064', 0o10), ehT0Px3KOsy9(chr(1906 - 1858) + chr(6948 - 6837) + chr(0b110010) + chr(1169 - 1114) + '\x34', 0b1000), ehT0Px3KOsy9(chr(351 - 303) + '\x6f' + chr(49) + chr(0b110110) + chr(51), 23998 - 23990), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(1599 - 1545) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(496 - 441) + chr(134 - 84), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b11001 + 0o126) + '\x33' + '\x36' + '\060', 40 - 32), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(1800 - 1750) + '\067', 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + '\x34' + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(53), 15951 - 15943), ehT0Px3KOsy9(chr(2304 - 2256) + chr(3501 - 3390) + '\062' + chr(0b10 + 0o64) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1100111 + 0o10) + chr(1329 - 1278) + chr(0b1000 + 0o51) + chr(0b100000 + 0o27), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x34' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b11000 + 0o127) + chr(0b110011) + chr(0b110000) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(955 - 844) + chr(0b10001 + 0o41) + '\066', 0b1000), ehT0Px3KOsy9(chr(656 - 608) + chr(0b1101111) + chr(0b110011) + '\x32' + chr(103 - 51), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10110 + 0o37), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(54) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x35', 8), ehT0Px3KOsy9('\060' + chr(5602 - 5491) + chr(0b110010) + chr(2369 - 2315) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + '\x31' + chr(0b10 + 0o62), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(213 - 161) + chr(2649 - 2596), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + chr(0b0 + 0o61) + '\x36' + chr(1532 - 1482), 11859 - 11851), ehT0Px3KOsy9(chr(1994 - 1946) + chr(111) + chr(0b101 + 0o56), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101 + 0o142) + chr(0b110011) + '\066' + chr(1732 - 1680), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10100 + 0o37) + '\066' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(8970 - 8859) + chr(51) + chr(1800 - 1747) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b10010 + 0o41) + chr(1223 - 1168), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(53) + chr(0b110000), 36986 - 36978)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x14'), chr(0b101010 + 0o72) + chr(5693 - 5592) + '\143' + chr(4768 - 4657) + chr(9272 - 9172) + chr(0b1100101))(chr(0b111100 + 0o71) + chr(0b111 + 0o155) + '\146' + chr(49 - 4) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def f8tbivcEPNnz(oVre8I6UXc3b, HkA20HegroFF):
(ZR8qEQU6CMHE, potvSOczRSpu, VK2cHh5abv_4) = HkA20HegroFF
(QwX63qRwMfRC, SRZprVCh4MZq, qazZQQo4imKD) = ((xafqLlk3kkUe(SXOLrMavuUCe(b't'), chr(100) + chr(101) + '\x63' + '\157' + chr(0b1011110 + 0o6) + '\x65')(chr(0b1110101) + '\x74' + '\146' + chr(0b1000 + 0o45) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'y'), chr(2427 - 2327) + '\145' + '\x63' + chr(111) + chr(0b1100100) + chr(6419 - 6318))(chr(117) + '\164' + chr(6572 - 6470) + '\055' + chr(0b111000))), (xafqLlk3kkUe(SXOLrMavuUCe(b'u'), '\144' + '\145' + chr(6869 - 6770) + chr(0b1011101 + 0o22) + chr(100) + chr(0b1100101))('\165' + '\x74' + '\146' + chr(0b101101) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b's'), chr(100) + chr(0b1100011 + 0o2) + chr(99) + chr(10055 - 9944) + chr(0b1100100) + chr(0b101001 + 0o74))(chr(0b1001000 + 0o55) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56))), (xafqLlk3kkUe(SXOLrMavuUCe(b't'), '\144' + '\145' + '\143' + chr(0b1101111) + '\x64' + '\x65')(chr(5207 - 5090) + chr(0b1001000 + 0o54) + chr(0b1100110) + chr(0b100001 + 0o14) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'y'), chr(0b1001110 + 0o26) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(0b1000100 + 0o40) + chr(9099 - 8998))(chr(0b1011110 + 0o27) + '\164' + chr(0b1100110) + chr(1164 - 1119) + '\x38')))
BrS7L2AH1Z1O = (QwX63qRwMfRC, SRZprVCh4MZq, qazZQQo4imKD)
for (WVxHKyX45z_L, (XPh1qbAgrPgG, wmN3dvez4qzC)) in YlkZvXL8qwsX(BrS7L2AH1Z1O):
if not (xafqLlk3kkUe(HkA20HegroFF[WVxHKyX45z_L], xafqLlk3kkUe(SXOLrMavuUCe(b'O\x0e\xaa\xc3\xaa\x9a\xb1\xd8\xd6c\x14\xe0'), chr(100) + '\145' + chr(0b1000011 + 0o40) + '\x6f' + '\144' + chr(1260 - 1159))(chr(0b1110101) + '\164' + '\x66' + chr(0b10010 + 0o33) + chr(2031 - 1975)))(XPh1qbAgrPgG) == ehT0Px3KOsy9('\060' + '\x6f' + chr(2340 - 2291), 52927 - 52919) and xafqLlk3kkUe(HkA20HegroFF[WVxHKyX45z_L], xafqLlk3kkUe(SXOLrMavuUCe(b'O\x0e\xaa\xc3\xaa\x9a\xb1\xd8\xd6c\x14\xe0'), '\x64' + '\x65' + chr(0b110101 + 0o56) + '\x6f' + '\144' + '\145')('\x75' + chr(0b1110100) + '\146' + chr(0b100 + 0o51) + chr(56)))(wmN3dvez4qzC) == ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1110 + 0o43), 8)):
jtbovtaIYjRB = xafqLlk3kkUe(SXOLrMavuUCe(b'Y\x00\xa8\xe2\xa1\xb2\xa1\xf4\xf5I=\x8f\xe0\xd5\x1e\xd1\x94\x83>Hk\xe9\xa1\x10\xa8vs\xa6v\xaf~\xce\x11E\x1fv\x87\x87\xc8\xfcU\x01\xb2\xf5\xa7\xb0\xf4\xf4\xf4Cs\xcc\xec\xdd\x01\xd5\x99\x842Uv\x96\xed\x1e\xb866\xb5k\x90%\x917\x18P#\x91\x8b\x89\xebV\x16\xe6\xfb\xa0\xbd\xb1\xac\xbcA<\xdb\xa4\xc7\x0e\x9a'), '\x64' + '\x65' + chr(0b111011 + 0o50) + '\157' + chr(0b1100100) + chr(0b100010 + 0o103))('\165' + chr(0b1110100) + chr(102) + '\055' + chr(0b111000))
raise sznFqDbNBHlx(xafqLlk3kkUe(jtbovtaIYjRB, xafqLlk3kkUe(SXOLrMavuUCe(b'l[\xb4\xfb\x86\xbf\x87\xb3\xccV6\xc5'), chr(100) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(100) + chr(101))(chr(117) + chr(5309 - 5193) + chr(2488 - 2386) + chr(45) + '\070'))(WVxHKyX45z_L, XPh1qbAgrPgG, wmN3dvez4qzC, HkA20HegroFF[WVxHKyX45z_L]))
if c2A0yzQpDQB3(HkA20HegroFF[WVxHKyX45z_L]) != c2A0yzQpDQB3(MVEN8G6CxlvR(HkA20HegroFF[WVxHKyX45z_L])):
jtbovtaIYjRB = xafqLlk3kkUe(SXOLrMavuUCe(b'Y\x00\xa8\xe2\xa1\xb2\xa1\xf4\xf5I=\x8f\xe0\xd5\x1e\xd1\x94\x83>Hk\xe9\xa1\x10\xa8vs\xa6v\xaf~\xce\x11E\x11b\x9a\x9d\x87\xeb\x1a\x07\xa7\xe2\xab\xfe\xb0\xf5\xecJ:\xcc\xe5\xc8\x16\x94\x99\x986Ud\xd5\xbb\x00\xb7g:\xf4b\x9bq\x937\x18\\'), chr(0b1100100) + '\x65' + '\143' + chr(0b1001110 + 0o41) + '\144' + '\x65')(chr(0b1110101) + '\164' + chr(944 - 842) + '\x2d' + '\070')
raise sznFqDbNBHlx(xafqLlk3kkUe(jtbovtaIYjRB, xafqLlk3kkUe(SXOLrMavuUCe(b'l[\xb4\xfb\x86\xbf\x87\xb3\xccV6\xc5'), chr(0b1100100) + chr(101) + chr(8279 - 8180) + chr(0b1101111) + '\x64' + '\145')(chr(117) + '\x74' + '\x66' + '\x2d' + chr(0b111000)))(WVxHKyX45z_L, HkA20HegroFF[WVxHKyX45z_L]))
if not MVEN8G6CxlvR(ZR8qEQU6CMHE) - MVEN8G6CxlvR(QwX63qRwMfRC) == MVEN8G6CxlvR(potvSOczRSpu) - MVEN8G6CxlvR(SRZprVCh4MZq) == MVEN8G6CxlvR(VK2cHh5abv_4) - MVEN8G6CxlvR(qazZQQo4imKD):
jtbovtaIYjRB = xafqLlk3kkUe(SXOLrMavuUCe(b'Y\x00\xa8\xe2\xa1\xb2\xa1\xf4\xf5I=\x8f\xe0\xd5\x1e\xd1\x94\x83>Hk\xe9\xa1\x10\xa8vs\xa6v\xd4`\xdf)\x08\x17m\x80\x80\xc8\xf2O\x1c\xb2\xb4\xab\xbf\xb7\xe8\xbcN2\xd9\xe1\x9c\x07\xdc\x9f\xd0$Fh\xd3\xef\x16\xa0`6\xbbc\xd4v\xc3-\x11\x1bb\x98\xd3\x8b\xf7[\x1d\xa7\xf7\xba\xbb\xa6\xf3\xb0\x064\xc0\xf0\x9c\x08\xc9\xd4'), chr(6295 - 6195) + chr(0b100 + 0o141) + chr(1011 - 912) + '\x6f' + '\144' + chr(0b1100101))('\x75' + '\164' + chr(102) + chr(776 - 731) + '\070')
raise sznFqDbNBHlx(xafqLlk3kkUe(jtbovtaIYjRB, xafqLlk3kkUe(SXOLrMavuUCe(b'l[\xb4\xfb\x86\xbf\x87\xb3\xccV6\xc5'), '\144' + chr(101) + chr(99) + chr(11124 - 11013) + chr(100) + '\x65')(chr(8172 - 8055) + chr(116) + chr(921 - 819) + chr(0b101101) + chr(0b101 + 0o63)))(HkA20HegroFF))
def Gi3ZCmlJfcKL(IH4wfF5htxM9, d5UEOSea7UZi):
MuY1jmZz1_6p = (WVxHKyX45z_L for (WVxHKyX45z_L, qzn1Ctg9WgNh) in YlkZvXL8qwsX(IH4wfF5htxM9) if qzn1Ctg9WgNh not in d5UEOSea7UZi)
if IH4wfF5htxM9 is not potvSOczRSpu:
MuY1jmZz1_6p = vUlqIvNSaRMa(MuY1jmZz1_6p, key=lambda WVxHKyX45z_L: potvSOczRSpu.XdowRbJKZWL9(IH4wfF5htxM9[WVxHKyX45z_L]))
return (xafqLlk3kkUe(IH4wfF5htxM9, xafqLlk3kkUe(SXOLrMavuUCe(b'b\x0b\xa9\xe3\x9c\xbc\x9e\xcb\xc6q\x1f\x96'), chr(751 - 651) + '\x65' + chr(0b1100011) + chr(111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(1916 - 1800) + chr(0b110011 + 0o63) + '\x2d' + chr(0b1111 + 0o51)))(d5UEOSea7UZi[ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100001 + 0o17), 0o10)]), xafqLlk3kkUe(IH4wfF5htxM9, xafqLlk3kkUe(SXOLrMavuUCe(b'b\x0b\xa9\xe3\x9c\xbc\x9e\xcb\xc6q\x1f\x96'), chr(0b1011110 + 0o6) + chr(8236 - 8135) + chr(99) + chr(0b1101111) + '\x64' + chr(0b111010 + 0o53))(chr(0b1110101) + '\x74' + chr(102) + '\x2d' + '\070'))(d5UEOSea7UZi[ehT0Px3KOsy9(chr(1152 - 1104) + '\157' + '\x31', 8)])) + KNyTy8rYcwji(MuY1jmZz1_6p)
(UJ4pAB1Raqt1, Cbi4BzfRtS1h, qoUvsOU_g0iR) = abA97kOQKaLo(Gi3ZCmlJfcKL, HkA20HegroFF, BrS7L2AH1Z1O)
return (UJ4pAB1Raqt1, Cbi4BzfRtS1h, qoUvsOU_g0iR)
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/layers/core.py
|
Conv._conv_general_shape_tuple
|
def _conv_general_shape_tuple(self, lhs_shape, rhs_shape, window_strides,
padding, dimension_numbers):
"""Generalized computation of conv shape."""
lhs_perm, rhs_perm, out_perm = self._conv_general_permutations(
dimension_numbers)
lhs_trans = onp.take(lhs_shape, lhs_perm)
rhs_trans = onp.take(rhs_shape, rhs_perm)
out_trans = self._conv_shape_tuple(
lhs_trans, rhs_trans, window_strides, padding)
return tuple(onp.take(out_trans, onp.argsort(out_perm)))
|
python
|
def _conv_general_shape_tuple(self, lhs_shape, rhs_shape, window_strides,
padding, dimension_numbers):
"""Generalized computation of conv shape."""
lhs_perm, rhs_perm, out_perm = self._conv_general_permutations(
dimension_numbers)
lhs_trans = onp.take(lhs_shape, lhs_perm)
rhs_trans = onp.take(rhs_shape, rhs_perm)
out_trans = self._conv_shape_tuple(
lhs_trans, rhs_trans, window_strides, padding)
return tuple(onp.take(out_trans, onp.argsort(out_perm)))
|
[
"def",
"_conv_general_shape_tuple",
"(",
"self",
",",
"lhs_shape",
",",
"rhs_shape",
",",
"window_strides",
",",
"padding",
",",
"dimension_numbers",
")",
":",
"lhs_perm",
",",
"rhs_perm",
",",
"out_perm",
"=",
"self",
".",
"_conv_general_permutations",
"(",
"dimension_numbers",
")",
"lhs_trans",
"=",
"onp",
".",
"take",
"(",
"lhs_shape",
",",
"lhs_perm",
")",
"rhs_trans",
"=",
"onp",
".",
"take",
"(",
"rhs_shape",
",",
"rhs_perm",
")",
"out_trans",
"=",
"self",
".",
"_conv_shape_tuple",
"(",
"lhs_trans",
",",
"rhs_trans",
",",
"window_strides",
",",
"padding",
")",
"return",
"tuple",
"(",
"onp",
".",
"take",
"(",
"out_trans",
",",
"onp",
".",
"argsort",
"(",
"out_perm",
")",
")",
")"
] |
Generalized computation of conv shape.
|
[
"Generalized",
"computation",
"of",
"conv",
"shape",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L277-L286
|
train
|
Generalized computation of conv shape.
|
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,sbc9gub6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px3KOsy9,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) + '\x31' + chr(558 - 510) + chr(1103 - 1052), 0b1000), ehT0Px3KOsy9(chr(1940 - 1892) + chr(0b1101111) + '\x31' + '\062' + chr(55), 2961 - 2953), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(1864 - 1815) + chr(0b101110 + 0o10) + '\x35', 4113 - 4105), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + '\x36' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + chr(2345 - 2294) + chr(0b110000), 54557 - 54549), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b110110 + 0o71) + chr(0b110010) + '\x34' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1044 - 996) + chr(2045 - 1934) + '\x33' + chr(48) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100 + 0o57) + chr(54) + chr(0b110001), 507 - 499), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\x32' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(2566 - 2511) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(256 - 208) + chr(0b1101111) + '\062' + chr(0b110100 + 0o1) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\062' + chr(1539 - 1484), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001001 + 0o46) + chr(0b110001) + chr(930 - 875) + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(738 - 687) + '\x31' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1010 + 0o51) + '\x35' + chr(1902 - 1854), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + '\x31' + chr(1321 - 1269) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(54) + chr(2298 - 2244), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(2023 - 1972) + chr(48) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10000 + 0o43) + chr(2060 - 2010) + '\066', 32442 - 32434), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + '\x31' + chr(514 - 463) + chr(1328 - 1280), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\067' + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100110 + 0o15) + '\x35' + chr(53), 16641 - 16633), ehT0Px3KOsy9('\060' + chr(6714 - 6603) + chr(50) + chr(0b110100) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(0b100111 + 0o12) + chr(2529 - 2478) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(50) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b11001 + 0o35), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(1514 - 1461) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1001011 + 0o44) + '\x31' + chr(0b110010) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x31' + '\x31', 12468 - 12460), ehT0Px3KOsy9('\x30' + chr(8254 - 8143) + '\063' + '\x30' + chr(952 - 904), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(51) + chr(0b10111 + 0o34) + chr(1155 - 1107), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6991 - 6880) + '\x31' + chr(2121 - 2066) + '\066', 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x33' + chr(407 - 357), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\061' + '\062', 58005 - 57997), ehT0Px3KOsy9('\060' + chr(0b1110 + 0o141) + chr(54) + chr(0b10010 + 0o41), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000001 + 0o56) + chr(50) + chr(0b10001 + 0o41), 11691 - 11683), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1551 - 1500) + chr(1127 - 1077) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(55) + chr(0b100010 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + '\x32' + chr(2456 - 2401) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + '\061' + chr(1499 - 1449) + '\x31', 13323 - 13315)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101111 + 0o6) + chr(0b110000), 17259 - 17251)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'm'), '\144' + chr(0b111 + 0o136) + '\143' + chr(2313 - 2202) + chr(0b1100100) + '\x65')(chr(117) + '\164' + '\x66' + chr(1440 - 1395) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def E_b_sO7cmgVA(oVre8I6UXc3b, zmxPnqM6Cprm, d9gHf_KW1oJw, NRJwWnad4cQH, TFLseEYASEKG, HkA20HegroFF):
(UJ4pAB1Raqt1, Cbi4BzfRtS1h, qoUvsOU_g0iR) = oVre8I6UXc3b._conv_general_permutations(HkA20HegroFF)
Xy82t_lHASlD = E84IQ9WvC5Je.take(zmxPnqM6Cprm, UJ4pAB1Raqt1)
a1mDZQpiOOWI = E84IQ9WvC5Je.take(d9gHf_KW1oJw, Cbi4BzfRtS1h)
RVU18OHhxIYO = oVre8I6UXc3b._conv_shape_tuple(Xy82t_lHASlD, a1mDZQpiOOWI, NRJwWnad4cQH, TFLseEYASEKG)
return KNyTy8rYcwji(xafqLlk3kkUe(E84IQ9WvC5Je, xafqLlk3kkUe(SXOLrMavuUCe(b'76\x1e\xd6'), chr(0b1100100) + chr(101) + chr(0b11110 + 0o105) + chr(0b1101111) + chr(5043 - 4943) + '\x65')(chr(0b1000001 + 0o64) + '\164' + chr(6769 - 6667) + '\x2d' + chr(56)))(RVU18OHhxIYO, xafqLlk3kkUe(E84IQ9WvC5Je, xafqLlk3kkUe(SXOLrMavuUCe(b'"%\x12\xc0w\xd6\xb0'), chr(8406 - 8306) + chr(101) + chr(99) + '\x6f' + chr(0b100100 + 0o100) + '\145')(chr(117) + '\x74' + '\x66' + chr(0b100101 + 0o10) + chr(1674 - 1618)))(qoUvsOU_g0iR)))
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/dopamine_connector.py
|
get_create_agent
|
def get_create_agent(agent_kwargs):
"""Factory for dopamine agent initialization.
Args:
agent_kwargs: dict of BatchDQNAgent parameters
Returns:
Function(sess, environment, summary_writer) -> BatchDQNAgent instance.
"""
def create_agent(sess, environment, summary_writer=None):
"""Creates a DQN agent.
Simplified version of `dopamine.discrete_domains.train.create_agent`
Args:
sess: a session
environment: an environment
summary_writer: a summary writer.
Returns:
a DQN agent.
"""
return BatchDQNAgent(
env_batch_size=environment.batch_size,
sess=sess,
num_actions=environment.action_space.n,
summary_writer=summary_writer,
tf_device="/gpu:*",
**agent_kwargs)
return create_agent
|
python
|
def get_create_agent(agent_kwargs):
"""Factory for dopamine agent initialization.
Args:
agent_kwargs: dict of BatchDQNAgent parameters
Returns:
Function(sess, environment, summary_writer) -> BatchDQNAgent instance.
"""
def create_agent(sess, environment, summary_writer=None):
"""Creates a DQN agent.
Simplified version of `dopamine.discrete_domains.train.create_agent`
Args:
sess: a session
environment: an environment
summary_writer: a summary writer.
Returns:
a DQN agent.
"""
return BatchDQNAgent(
env_batch_size=environment.batch_size,
sess=sess,
num_actions=environment.action_space.n,
summary_writer=summary_writer,
tf_device="/gpu:*",
**agent_kwargs)
return create_agent
|
[
"def",
"get_create_agent",
"(",
"agent_kwargs",
")",
":",
"def",
"create_agent",
"(",
"sess",
",",
"environment",
",",
"summary_writer",
"=",
"None",
")",
":",
"\"\"\"Creates a DQN agent.\n\n Simplified version of `dopamine.discrete_domains.train.create_agent`\n\n Args:\n sess: a session\n environment: an environment\n summary_writer: a summary writer.\n\n Returns:\n a DQN agent.\n \"\"\"",
"return",
"BatchDQNAgent",
"(",
"env_batch_size",
"=",
"environment",
".",
"batch_size",
",",
"sess",
"=",
"sess",
",",
"num_actions",
"=",
"environment",
".",
"action_space",
".",
"n",
",",
"summary_writer",
"=",
"summary_writer",
",",
"tf_device",
"=",
"\"/gpu:*\"",
",",
"*",
"*",
"agent_kwargs",
")",
"return",
"create_agent"
] |
Factory for dopamine agent initialization.
Args:
agent_kwargs: dict of BatchDQNAgent parameters
Returns:
Function(sess, environment, summary_writer) -> BatchDQNAgent instance.
|
[
"Factory",
"for",
"dopamine",
"agent",
"initialization",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L274-L305
|
train
|
Returns a function that creates a new instance of the DQN agent.
|
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,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LkHVB2V,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(0b11100 + 0o24) + chr(0b1101111) + chr(0b110010 + 0o1) + '\062' + chr(0b10101 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(1562 - 1514) + chr(111) + chr(468 - 417) + chr(0b10010 + 0o36) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b100001 + 0o24) + chr(0b101011 + 0o7), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(373 - 262) + chr(1135 - 1084) + '\x30' + '\061', 8), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + chr(0b110001 + 0o4) + chr(54), 32683 - 32675), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(49) + chr(55) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\064' + chr(0b11 + 0o57), 0b1000), ehT0Px3KOsy9(chr(1217 - 1169) + '\x6f' + chr(0b110001) + chr(0b110010) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(2595 - 2484) + chr(50) + chr(1200 - 1146), 25757 - 25749), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b10001 + 0o42) + chr(0b1101 + 0o44), 0o10), ehT0Px3KOsy9(chr(48) + chr(6664 - 6553) + chr(338 - 287) + chr(0b1010 + 0o53) + chr(0b11101 + 0o27), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1722 - 1611) + chr(1875 - 1826) + '\x30' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b110100) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\063' + '\x37', 24957 - 24949), ehT0Px3KOsy9(chr(973 - 925) + '\157' + chr(0b10011 + 0o36) + chr(0b110111), 56002 - 55994), ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + chr(1981 - 1931) + chr(1041 - 989) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101101 + 0o12) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1682 - 1571) + chr(49) + chr(447 - 394) + '\x32', 8), ehT0Px3KOsy9(chr(1414 - 1366) + chr(0b1101111) + '\x33' + chr(0b110101) + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b1000 + 0o50) + '\060', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101011 + 0o7) + chr(53) + chr(0b110101), 59832 - 59824), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(1250 - 1201) + chr(0b110001 + 0o2) + chr(0b110010), 25665 - 25657), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b1111 + 0o47) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11001 + 0o32) + chr(48) + chr(0b110010), 16295 - 16287), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1010 + 0o55) + '\062', 41571 - 41563), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b110111) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(1354 - 1304) + chr(0b101101 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(53) + chr(702 - 648), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x34' + chr(0b110000 + 0o4), 21211 - 21203), ehT0Px3KOsy9(chr(1300 - 1252) + '\157' + chr(1635 - 1584) + chr(0b1 + 0o61) + chr(0b110010), 59225 - 59217), ehT0Px3KOsy9(chr(2117 - 2069) + '\x6f' + chr(51) + chr(0b1001 + 0o54) + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\x37' + chr(0b1011 + 0o52), 9447 - 9439), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + chr(0b110010) + chr(55) + chr(54), 5426 - 5418), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(1988 - 1933) + chr(0b101111 + 0o10), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b110111 + 0o70) + chr(50) + chr(0b11101 + 0o32) + chr(0b110000 + 0o7), 0o10), ehT0Px3KOsy9(chr(48) + chr(9570 - 9459) + chr(50) + '\066' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1011100 + 0o23) + '\061' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(55) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(0b100100 + 0o16) + chr(2100 - 2052) + '\067', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b1 + 0o64) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xff'), chr(9153 - 9053) + '\x65' + chr(0b100010 + 0o101) + chr(111) + chr(0b111110 + 0o46) + chr(0b1100101))(chr(0b1110101) + chr(0b110 + 0o156) + '\x66' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def zJAbRi4nkjQF(s6_Q8BqdG6bE):
def iDb48ZyALwG5(HVWCHjSQ2I35, QUCK3Fwc4YQe, S5uPA4n8ItHK=None):
return YUmnQirwJ8u3(env_batch_size=xafqLlk3kkUe(QUCK3Fwc4YQe, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8\xb9S\xa5t\x01\xc7\x15{\x0c\x94\x19'), '\144' + '\145' + '\143' + '\157' + chr(0b1100100) + chr(796 - 695))(chr(117) + '\x74' + '\x66' + chr(45) + chr(0b111000))), sess=HVWCHjSQ2I35, num_actions=xafqLlk3kkUe(QUCK3Fwc4YQe.action_space, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc\xf0$\xaam\n\xdb\x1ba`\xae8'), chr(9299 - 9199) + chr(101) + '\143' + chr(12197 - 12086) + chr(0b1001010 + 0o32) + chr(4956 - 4855))(chr(117) + chr(10261 - 10145) + chr(0b1001 + 0o135) + '\x2d' + chr(0b111000))), summary_writer=S5uPA4n8ItHK, tf_device=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xa6\x1a\xb4\x14R'), '\144' + '\x65' + chr(5819 - 5720) + chr(0b111101 + 0o62) + chr(8531 - 8431) + '\145')(chr(117) + chr(6027 - 5911) + '\x66' + chr(0b10 + 0o53) + chr(0b10000 + 0o50)), **s6_Q8BqdG6bE)
return iDb48ZyALwG5
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/dopamine_connector.py
|
get_create_batch_env_fun
|
def get_create_batch_env_fun(batch_env_fn, time_limit):
"""Factory for dopamine environment initialization function.
Args:
batch_env_fn: function(in_graph: bool) -> batch environment.
time_limit: time steps limit for environment.
Returns:
function (with optional, unused parameters) initializing environment.
"""
def create_env_fun(game_name=None, sticky_actions=None):
del game_name, sticky_actions
batch_env = batch_env_fn(in_graph=False)
batch_env = ResizeBatchObservation(batch_env) # pylint: disable=redefined-variable-type
batch_env = DopamineBatchEnv(batch_env, max_episode_steps=time_limit)
return batch_env
return create_env_fun
|
python
|
def get_create_batch_env_fun(batch_env_fn, time_limit):
"""Factory for dopamine environment initialization function.
Args:
batch_env_fn: function(in_graph: bool) -> batch environment.
time_limit: time steps limit for environment.
Returns:
function (with optional, unused parameters) initializing environment.
"""
def create_env_fun(game_name=None, sticky_actions=None):
del game_name, sticky_actions
batch_env = batch_env_fn(in_graph=False)
batch_env = ResizeBatchObservation(batch_env) # pylint: disable=redefined-variable-type
batch_env = DopamineBatchEnv(batch_env, max_episode_steps=time_limit)
return batch_env
return create_env_fun
|
[
"def",
"get_create_batch_env_fun",
"(",
"batch_env_fn",
",",
"time_limit",
")",
":",
"def",
"create_env_fun",
"(",
"game_name",
"=",
"None",
",",
"sticky_actions",
"=",
"None",
")",
":",
"del",
"game_name",
",",
"sticky_actions",
"batch_env",
"=",
"batch_env_fn",
"(",
"in_graph",
"=",
"False",
")",
"batch_env",
"=",
"ResizeBatchObservation",
"(",
"batch_env",
")",
"# pylint: disable=redefined-variable-type",
"batch_env",
"=",
"DopamineBatchEnv",
"(",
"batch_env",
",",
"max_episode_steps",
"=",
"time_limit",
")",
"return",
"batch_env",
"return",
"create_env_fun"
] |
Factory for dopamine environment initialization function.
Args:
batch_env_fn: function(in_graph: bool) -> batch environment.
time_limit: time steps limit for environment.
Returns:
function (with optional, unused parameters) initializing environment.
|
[
"Factory",
"for",
"dopamine",
"environment",
"initialization",
"function",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L450-L468
|
train
|
Factory for dopamine environment initialization function.
|
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,j9rjM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ZcNds,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' + '\x6f' + chr(53), 0b1000), ehT0Px3KOsy9(chr(1228 - 1180) + '\157' + '\061' + '\061' + chr(1801 - 1746), ord("\x08")), ehT0Px3KOsy9(chr(1692 - 1644) + '\157' + chr(2031 - 1981) + '\061', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(0b110001) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(304 - 253) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x33' + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(3157 - 3046) + chr(1013 - 963) + chr(1551 - 1500) + chr(0b110110), 48861 - 48853), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1118 - 1067) + chr(0b110000) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + '\x32' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(430 - 382) + chr(0b1011 + 0o144) + chr(1216 - 1167) + chr(0b110010) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11111 + 0o120) + chr(0b110011) + '\067' + chr(2198 - 2148), 28760 - 28752), ehT0Px3KOsy9(chr(1502 - 1454) + chr(0b1100000 + 0o17) + chr(0b10100 + 0o35) + chr(1902 - 1847) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1010100 + 0o33) + chr(0b110011) + chr(55) + chr(0b110 + 0o53), 0b1000), ehT0Px3KOsy9(chr(277 - 229) + chr(5092 - 4981) + chr(0b110011) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b101100 + 0o7) + '\064' + chr(0b100011 + 0o20), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1824 - 1773) + '\x31' + chr(0b1100 + 0o47), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b111 + 0o52) + chr(1847 - 1792), 60240 - 60232), ehT0Px3KOsy9(chr(790 - 742) + '\x6f' + '\061' + '\063' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100011 + 0o20) + chr(0b110100) + '\063', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(627 - 578) + '\x32' + chr(0b11100 + 0o24), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1000 + 0o54) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(1151 - 1102) + chr(0b111 + 0o55), 30356 - 30348), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(952 - 902) + chr(0b1 + 0o57), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\x35' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(708 - 658) + chr(0b110111) + chr(1406 - 1356), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(0b1110 + 0o50) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1855 - 1803) + chr(0b101101 + 0o10), 1869 - 1861), ehT0Px3KOsy9(chr(1671 - 1623) + '\157' + chr(50) + '\x36' + chr(0b10010 + 0o44), 55776 - 55768), ehT0Px3KOsy9(chr(48) + chr(0b110101 + 0o72) + chr(50) + chr(0b110100) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1001100 + 0o43) + chr(51) + chr(0b11100 + 0o32) + '\062', 10419 - 10411), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110101) + chr(0b1011 + 0o52), 0b1000), ehT0Px3KOsy9(chr(683 - 635) + chr(11976 - 11865) + '\x33' + '\x30' + chr(1236 - 1188), 0o10), ehT0Px3KOsy9(chr(317 - 269) + chr(0b1100110 + 0o11) + '\067' + chr(1135 - 1080), 63849 - 63841), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101101 + 0o4) + chr(50) + chr(0b11100 + 0o33), 0o10), ehT0Px3KOsy9(chr(590 - 542) + chr(0b1101111) + chr(0b110010) + chr(580 - 530) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11372 - 11261) + chr(55) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1889 - 1841) + '\157' + chr(49) + chr(0b110011) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1336 - 1286) + chr(0b11101 + 0o32), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\067' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b110000) + '\x32', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(847 - 799) + '\157' + '\065' + chr(0b101111 + 0o1), 20671 - 20663)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'+'), chr(0b1100100) + chr(0b1010000 + 0o25) + '\x63' + chr(0b1101111) + '\144' + '\x65')(chr(11630 - 11513) + chr(116) + chr(102) + chr(0b101101) + chr(401 - 345)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def UlwKrH6Bb6Jo(owwS2WDqR1XF, NKs0KLxUbNuL):
def FspH0Ncd0eV7(dVBVFHyXD86Q=None, QuSYdcxcqzEo=None):
del dVBVFHyXD86Q, QuSYdcxcqzEo
XbEJqqD0tOyU = owwS2WDqR1XF(in_graph=ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1010100 + 0o33) + chr(641 - 593), 0b1000))
XbEJqqD0tOyU = FTbULeLmory2(XbEJqqD0tOyU)
XbEJqqD0tOyU = MEjmwRTs9IUt(XbEJqqD0tOyU, max_episode_steps=NKs0KLxUbNuL)
return XbEJqqD0tOyU
return FspH0Ncd0eV7
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/dopamine_connector.py
|
_parse_hparams
|
def _parse_hparams(hparams):
"""Split hparams, based on key prefixes.
Args:
hparams: hyperparameters
Returns:
Tuple of hparams for respectably: agent, optimizer, runner, replay_buffer.
"""
prefixes = ["agent_", "optimizer_", "runner_", "replay_buffer_"]
ret = []
for prefix in prefixes:
ret_dict = {}
for key in hparams.values():
if prefix in key:
par_name = key[len(prefix):]
ret_dict[par_name] = hparams.get(key)
ret.append(ret_dict)
return ret
|
python
|
def _parse_hparams(hparams):
"""Split hparams, based on key prefixes.
Args:
hparams: hyperparameters
Returns:
Tuple of hparams for respectably: agent, optimizer, runner, replay_buffer.
"""
prefixes = ["agent_", "optimizer_", "runner_", "replay_buffer_"]
ret = []
for prefix in prefixes:
ret_dict = {}
for key in hparams.values():
if prefix in key:
par_name = key[len(prefix):]
ret_dict[par_name] = hparams.get(key)
ret.append(ret_dict)
return ret
|
[
"def",
"_parse_hparams",
"(",
"hparams",
")",
":",
"prefixes",
"=",
"[",
"\"agent_\"",
",",
"\"optimizer_\"",
",",
"\"runner_\"",
",",
"\"replay_buffer_\"",
"]",
"ret",
"=",
"[",
"]",
"for",
"prefix",
"in",
"prefixes",
":",
"ret_dict",
"=",
"{",
"}",
"for",
"key",
"in",
"hparams",
".",
"values",
"(",
")",
":",
"if",
"prefix",
"in",
"key",
":",
"par_name",
"=",
"key",
"[",
"len",
"(",
"prefix",
")",
":",
"]",
"ret_dict",
"[",
"par_name",
"]",
"=",
"hparams",
".",
"get",
"(",
"key",
")",
"ret",
".",
"append",
"(",
"ret_dict",
")",
"return",
"ret"
] |
Split hparams, based on key prefixes.
Args:
hparams: hyperparameters
Returns:
Tuple of hparams for respectably: agent, optimizer, runner, replay_buffer.
|
[
"Split",
"hparams",
"based",
"on",
"key",
"prefixes",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L471-L491
|
train
|
Split hparams based on key prefixes.
Returns a tuple of hparams for respectably
|
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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i1V0ySZcNds,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(111) + '\x34' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\157' + chr(0b110010) + chr(55) + chr(1055 - 1007), 35804 - 35796), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1001100 + 0o43) + chr(0b110011) + chr(0b110110) + '\061', 59875 - 59867), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(0b10110 + 0o35) + chr(53) + chr(0b10010 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b110111) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101101 + 0o5) + chr(1649 - 1598) + chr(1491 - 1442), 0b1000), ehT0Px3KOsy9(chr(2247 - 2199) + '\157' + chr(0b1110 + 0o44) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7200 - 7089) + chr(0b110010) + '\x32' + chr(1717 - 1662), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + '\061' + chr(1083 - 1035) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1011 + 0o50) + chr(1289 - 1236) + chr(55), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101 + 0o54) + '\x36' + chr(2674 - 2621), 0b1000), ehT0Px3KOsy9(chr(917 - 869) + chr(111) + chr(0b100 + 0o57) + chr(0b11000 + 0o32) + chr(1632 - 1582), 7835 - 7827), ehT0Px3KOsy9(chr(306 - 258) + chr(660 - 549) + '\x37' + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b10 + 0o65) + chr(0b1000 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\060' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b110011) + chr(50), 1944 - 1936), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(50) + chr(0b1 + 0o66), 8), ehT0Px3KOsy9('\060' + chr(9473 - 9362) + chr(1718 - 1667) + chr(55) + chr(0b1001 + 0o47), 62840 - 62832), ehT0Px3KOsy9(chr(48) + chr(6722 - 6611) + '\063' + chr(0b110101) + '\063', 0b1000), ehT0Px3KOsy9(chr(1259 - 1211) + chr(0b11010 + 0o125) + '\063' + chr(54) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(800 - 689) + chr(0b110011), 14079 - 14071), ehT0Px3KOsy9(chr(943 - 895) + '\x6f' + '\x32' + '\x31' + chr(742 - 694), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(0b101111 + 0o3) + chr(0b110011 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110001) + chr(0b101111 + 0o5), 35267 - 35259), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011 + 0o0) + chr(0b110001 + 0o0) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(49) + chr(770 - 721) + '\062', 681 - 673), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101110 + 0o5) + '\x30', 2483 - 2475), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + chr(1927 - 1878) + chr(0b110010) + chr(48), 5060 - 5052), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110011) + '\x35', 12545 - 12537), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + chr(49) + '\x30', 11692 - 11684), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\062' + chr(0b100001 + 0o25), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4349 - 4238) + chr(0b110010) + chr(0b10010 + 0o41) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(53) + chr(1104 - 1055), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(49) + '\x35' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(54) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100 + 0o55) + '\x35' + '\x32', 18768 - 18760), ehT0Px3KOsy9(chr(2172 - 2124) + chr(0b1101111) + chr(107 - 58) + chr(0b110001) + chr(0b11011 + 0o34), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\x33' + chr(0b11110 + 0o27), 8), ehT0Px3KOsy9(chr(48) + chr(7900 - 7789) + chr(0b110010) + chr(1322 - 1267) + chr(566 - 515), 8221 - 8213), ehT0Px3KOsy9(chr(1273 - 1225) + chr(111) + chr(0b11000 + 0o32) + chr(53) + chr(0b110100), 28732 - 28724)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(7218 - 7107) + '\065' + chr(637 - 589), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\n'), chr(291 - 191) + chr(0b10011 + 0o122) + chr(99) + '\x6f' + chr(2510 - 2410) + '\145')('\x75' + '\x74' + '\146' + chr(0b101101) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def yJRvUPHBXxnI(n4ljua2gi1Pr):
duSVRgX0v2Qv = [xafqLlk3kkUe(SXOLrMavuUCe(b'E\xdf\x94\x81O\xc6'), '\x64' + chr(6037 - 5936) + chr(99) + chr(111) + '\x64' + chr(0b11001 + 0o114))(chr(0b1110101) + '\x74' + '\x66' + chr(45) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'K\xc8\x85\x86V\xf0h\xf26\xb0'), '\144' + chr(0b1100101) + chr(0b1000011 + 0o40) + '\x6f' + chr(0b10111 + 0o115) + '\145')('\x75' + '\x74' + '\146' + chr(45) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'V\xcd\x9f\x81^\xebM'), '\x64' + chr(0b1001111 + 0o26) + chr(8242 - 8143) + chr(10025 - 9914) + chr(1143 - 1043) + chr(0b1100101))(chr(0b1110101) + chr(0b11 + 0o161) + chr(0b1100110) + '\055' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'V\xdd\x81\x83Z\xe0M\xf51\x89\x13\xb7M\xa0'), chr(6647 - 6547) + '\145' + '\143' + chr(111) + chr(100) + '\x65')(chr(0b1101011 + 0o12) + chr(0b1110100) + chr(102) + chr(604 - 559) + chr(0b101100 + 0o14))]
VHn4CV4Ymrei = []
for K1Ha0XjJTAE7 in duSVRgX0v2Qv:
mGGKgY41hDhY = {}
for K3J4ZwSlE0sT in xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b"w\xe8\x9f\xacu\xec'\xa3\x0c\xde\x11\xb0"), chr(100) + chr(0b1101 + 0o130) + '\x63' + chr(3574 - 3463) + chr(0b1100100) + chr(5286 - 5185))(chr(2259 - 2142) + chr(7224 - 7108) + '\146' + '\055' + chr(56)))():
if K1Ha0XjJTAE7 in K3J4ZwSlE0sT:
s9bJfmYysOB3 = K3J4ZwSlE0sT[c2A0yzQpDQB3(K1Ha0XjJTAE7):]
mGGKgY41hDhY[s9bJfmYysOB3] = n4ljua2gi1Pr.get(K3J4ZwSlE0sT)
xafqLlk3kkUe(VHn4CV4Ymrei, xafqLlk3kkUe(SXOLrMavuUCe(b'E\xc8\x81\x8aU\xfd'), chr(1423 - 1323) + '\145' + chr(0b110101 + 0o56) + chr(0b1100110 + 0o11) + chr(100) + '\145')(chr(0b1001011 + 0o52) + '\164' + '\146' + '\055' + '\070'))(mGGKgY41hDhY)
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/dopamine_connector.py
|
_DQNAgent._build_replay_buffer
|
def _build_replay_buffer(self, use_staging):
"""Build WrappedReplayBuffer with custom OutOfGraphReplayBuffer."""
replay_buffer_kwargs = dict(
observation_shape=dqn_agent.NATURE_DQN_OBSERVATION_SHAPE,
stack_size=dqn_agent.NATURE_DQN_STACK_SIZE,
replay_capacity=self._replay_capacity,
batch_size=self._buffer_batch_size,
update_horizon=self.update_horizon,
gamma=self.gamma,
extra_storage_types=None,
observation_dtype=np.uint8,
)
replay_memory = _OutOfGraphReplayBuffer(
artificial_done=not self._generates_trainable_dones,
**replay_buffer_kwargs)
return circular_replay_buffer.WrappedReplayBuffer(
wrapped_memory=replay_memory,
use_staging=use_staging,
**replay_buffer_kwargs)
|
python
|
def _build_replay_buffer(self, use_staging):
"""Build WrappedReplayBuffer with custom OutOfGraphReplayBuffer."""
replay_buffer_kwargs = dict(
observation_shape=dqn_agent.NATURE_DQN_OBSERVATION_SHAPE,
stack_size=dqn_agent.NATURE_DQN_STACK_SIZE,
replay_capacity=self._replay_capacity,
batch_size=self._buffer_batch_size,
update_horizon=self.update_horizon,
gamma=self.gamma,
extra_storage_types=None,
observation_dtype=np.uint8,
)
replay_memory = _OutOfGraphReplayBuffer(
artificial_done=not self._generates_trainable_dones,
**replay_buffer_kwargs)
return circular_replay_buffer.WrappedReplayBuffer(
wrapped_memory=replay_memory,
use_staging=use_staging,
**replay_buffer_kwargs)
|
[
"def",
"_build_replay_buffer",
"(",
"self",
",",
"use_staging",
")",
":",
"replay_buffer_kwargs",
"=",
"dict",
"(",
"observation_shape",
"=",
"dqn_agent",
".",
"NATURE_DQN_OBSERVATION_SHAPE",
",",
"stack_size",
"=",
"dqn_agent",
".",
"NATURE_DQN_STACK_SIZE",
",",
"replay_capacity",
"=",
"self",
".",
"_replay_capacity",
",",
"batch_size",
"=",
"self",
".",
"_buffer_batch_size",
",",
"update_horizon",
"=",
"self",
".",
"update_horizon",
",",
"gamma",
"=",
"self",
".",
"gamma",
",",
"extra_storage_types",
"=",
"None",
",",
"observation_dtype",
"=",
"np",
".",
"uint8",
",",
")",
"replay_memory",
"=",
"_OutOfGraphReplayBuffer",
"(",
"artificial_done",
"=",
"not",
"self",
".",
"_generates_trainable_dones",
",",
"*",
"*",
"replay_buffer_kwargs",
")",
"return",
"circular_replay_buffer",
".",
"WrappedReplayBuffer",
"(",
"wrapped_memory",
"=",
"replay_memory",
",",
"use_staging",
"=",
"use_staging",
",",
"*",
"*",
"replay_buffer_kwargs",
")"
] |
Build WrappedReplayBuffer with custom OutOfGraphReplayBuffer.
|
[
"Build",
"WrappedReplayBuffer",
"with",
"custom",
"OutOfGraphReplayBuffer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L60-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RS7Iy8j,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(0b1100001 + 0o16) + chr(0b110010 + 0o1) + chr(0b101 + 0o62) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\066' + chr(0b1100 + 0o46), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + '\x32' + chr(0b1110 + 0o51) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(51) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b1111 + 0o46), 0b1000), ehT0Px3KOsy9(chr(1641 - 1593) + chr(0b1101111) + chr(137 - 88) + chr(0b100101 + 0o15) + chr(2177 - 2129), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(12290 - 12179) + chr(50) + chr(0b10011 + 0o37) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + chr(0b110111) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x30' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b110001) + chr(990 - 939) + chr(0b100010 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1011110 + 0o21) + chr(50) + chr(51) + chr(1107 - 1058), 5310 - 5302), ehT0Px3KOsy9('\060' + chr(0b1000110 + 0o51) + '\067' + chr(0b10100 + 0o37), 0o10), ehT0Px3KOsy9(chr(1422 - 1374) + '\157' + chr(49) + chr(1228 - 1177) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(293 - 245) + chr(0b101010 + 0o105) + chr(0b11111 + 0o26) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + '\061' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(1487 - 1376) + chr(49) + '\x35' + chr(2588 - 2534), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000 + 0o1) + '\063' + chr(401 - 353), 9898 - 9890), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000 + 0o1) + chr(0b110001) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\x35' + chr(0b110100 + 0o2), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(608 - 556) + '\x30', 43980 - 43972), ehT0Px3KOsy9('\060' + chr(2833 - 2722) + chr(0b110001 + 0o2) + '\x34' + '\062', 13485 - 13477), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2363 - 2312) + chr(52) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8120 - 8009) + chr(0b110001) + '\065' + chr(0b10010 + 0o36), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + chr(522 - 467) + chr(49), 14678 - 14670), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(0b10001 + 0o41) + '\064' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(2359 - 2309) + chr(0b1010 + 0o51), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(55) + chr(0b101010 + 0o13), 46371 - 46363), ehT0Px3KOsy9(chr(48) + '\157' + chr(1063 - 1012) + chr(0b110110) + '\x35', 6977 - 6969), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1204 - 1150) + chr(0b110111), 61966 - 61958), ehT0Px3KOsy9('\x30' + chr(2299 - 2188) + '\x31' + chr(51) + chr(0b100001 + 0o26), 8), ehT0Px3KOsy9(chr(48) + chr(10689 - 10578) + '\062' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1100 + 0o46) + chr(0b11111 + 0o26) + chr(1294 - 1241), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(1135 - 1083) + chr(0b110101 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(4889 - 4778) + '\063' + chr(0b110010) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11101 + 0o25) + '\062' + chr(0b100110 + 0o17), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(1893 - 1842) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1327 - 1279) + '\157' + chr(0b110101) + chr(2684 - 2630), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(1408 - 1297) + '\063' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1 + 0o156) + chr(0b10111 + 0o33) + chr(0b101100 + 0o13) + chr(341 - 287), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + chr(1899 - 1846) + chr(0b111 + 0o51), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2'), '\144' + '\x65' + '\x63' + chr(0b1011111 + 0o20) + chr(0b101010 + 0o72) + chr(9627 - 9526))(chr(0b1010011 + 0o42) + chr(0b110 + 0o156) + chr(0b1100110) + chr(1553 - 1508) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def axPiLVJpIEEx(oVre8I6UXc3b, UCvR6BI0vYJj):
baRL2bit1908 = wLqBDw8l0eIm(observation_shape=RKJneH9QxdUU.NATURE_DQN_OBSERVATION_SHAPE, stack_size=RKJneH9QxdUU.NATURE_DQN_STACK_SIZE, replay_capacity=oVre8I6UXc3b._replay_capacity, batch_size=oVre8I6UXc3b._buffer_batch_size, update_horizon=oVre8I6UXc3b.update_horizon, gamma=oVre8I6UXc3b.gamma, extra_storage_types=None, observation_dtype=WqUC3KWvYVup.uint8)
dVtFQ7Li5Erx = IS18YQFIuVDB(artificial_done=not oVre8I6UXc3b._generates_trainable_dones, **baRL2bit1908)
return xafqLlk3kkUe(IT9abMXqRhjw, xafqLlk3kkUe(SXOLrMavuUCe(b'\xab@\xdf\xa9}5\xf0m\xa7/\xf5Z#j?\x08>.\x1c'), '\x64' + '\x65' + chr(99) + '\x6f' + chr(0b1100100) + chr(101))(chr(117) + chr(116) + chr(0b10100 + 0o122) + chr(0b1000 + 0o45) + chr(0b110100 + 0o4)))(wrapped_memory=dVtFQ7Li5Erx, use_staging=UCvR6BI0vYJj, **baRL2bit1908)
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/dopamine_connector.py
|
_OutOfGraphReplayBuffer.add
|
def add(self, observation, action, reward, terminal, *args):
"""Append artificial_done to *args and run parent method."""
# If this will be a problem for maintenance, we could probably override
# DQNAgent.add() method instead.
artificial_done = self._artificial_done and terminal
args = list(args)
args.append(artificial_done)
return super(_OutOfGraphReplayBuffer, self).add(observation, action, reward,
terminal, *args)
|
python
|
def add(self, observation, action, reward, terminal, *args):
"""Append artificial_done to *args and run parent method."""
# If this will be a problem for maintenance, we could probably override
# DQNAgent.add() method instead.
artificial_done = self._artificial_done and terminal
args = list(args)
args.append(artificial_done)
return super(_OutOfGraphReplayBuffer, self).add(observation, action, reward,
terminal, *args)
|
[
"def",
"add",
"(",
"self",
",",
"observation",
",",
"action",
",",
"reward",
",",
"terminal",
",",
"*",
"args",
")",
":",
"# If this will be a problem for maintenance, we could probably override",
"# DQNAgent.add() method instead.",
"artificial_done",
"=",
"self",
".",
"_artificial_done",
"and",
"terminal",
"args",
"=",
"list",
"(",
"args",
")",
"args",
".",
"append",
"(",
"artificial_done",
")",
"return",
"super",
"(",
"_OutOfGraphReplayBuffer",
",",
"self",
")",
".",
"add",
"(",
"observation",
",",
"action",
",",
"reward",
",",
"terminal",
",",
"*",
"args",
")"
] |
Append artificial_done to *args and run parent method.
|
[
"Append",
"artificial_done",
"to",
"*",
"args",
"and",
"run",
"parent",
"method",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L257-L265
|
train
|
Add an item to the queue.
|
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,q1QCh3W88sg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xBmo49x2An,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(0b101101 + 0o3) + chr(0b1000000 + 0o57) + chr(51) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(11014 - 10903) + chr(718 - 666) + chr(0b101001 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\x37' + chr(256 - 203), ord("\x08")), ehT0Px3KOsy9(chr(279 - 231) + '\x6f' + '\x36' + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b11111 + 0o30) + '\063', 16311 - 16303), ehT0Px3KOsy9('\060' + '\157' + chr(1002 - 953) + chr(0b110011) + chr(0b10 + 0o62), 0b1000), ehT0Px3KOsy9('\x30' + chr(6044 - 5933) + '\x33' + chr(908 - 858) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(0b10111 + 0o40) + chr(0b110011), 45553 - 45545), ehT0Px3KOsy9(chr(48) + '\157' + chr(1904 - 1853) + chr(52) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(8008 - 7897) + '\x37' + '\x30', 0b1000), ehT0Px3KOsy9(chr(2065 - 2017) + '\157' + chr(0b100001 + 0o22) + chr(0b100001 + 0o26) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b100100 + 0o113) + chr(1813 - 1762) + chr(55) + chr(0b1000 + 0o50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110 + 0o0) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(245 - 194) + chr(423 - 369) + chr(630 - 580), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(1628 - 1579) + chr(0b110101), 30492 - 30484), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\066' + chr(1095 - 1047), 0b1000), ehT0Px3KOsy9('\x30' + chr(8345 - 8234) + chr(0b10111 + 0o37) + chr(0b1000 + 0o53), 0b1000), ehT0Px3KOsy9(chr(2216 - 2168) + chr(0b100010 + 0o115) + '\063' + '\062' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b100010 + 0o16) + '\062', 36377 - 36369), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(700 - 589) + chr(50) + chr(0b100100 + 0o15) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(335 - 287) + chr(0b1101101 + 0o2) + chr(0b110010) + chr(336 - 281) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001111 + 0o40) + '\063' + chr(1986 - 1934) + chr(0b110010 + 0o1), 55604 - 55596), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + '\063' + chr(52) + '\x33', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2369 - 2320) + chr(2532 - 2477) + chr(1342 - 1292), 33175 - 33167), ehT0Px3KOsy9(chr(1705 - 1657) + '\x6f' + chr(2242 - 2193) + chr(0b1111 + 0o45) + chr(54), 16996 - 16988), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + '\063' + chr(1623 - 1575) + chr(0b110000), 35002 - 34994), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + '\063' + '\x32' + chr(48), 0b1000), ehT0Px3KOsy9(chr(266 - 218) + chr(0b1101111) + '\062' + chr(0b110011) + chr(1639 - 1591), 7106 - 7098), ehT0Px3KOsy9(chr(1262 - 1214) + chr(0b1010111 + 0o30) + chr(0b110011) + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101000 + 0o107) + '\063' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3590 - 3479) + chr(0b110001) + chr(0b110101) + '\064', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + '\x30' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + '\064' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(5473 - 5362) + chr(799 - 750) + chr(0b110010) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1001011 + 0o44) + chr(49) + chr(51) + chr(49), 0b1000), ehT0Px3KOsy9(chr(465 - 417) + chr(0b100100 + 0o113) + chr(0b1000 + 0o52) + '\x31' + '\060', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062', 27006 - 26998), ehT0Px3KOsy9(chr(48) + chr(10583 - 10472) + '\x31' + chr(0b110000) + '\062', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x35' + chr(0b111 + 0o51), 24841 - 24833)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'4'), chr(0b1100100) + chr(101) + '\143' + chr(187 - 76) + chr(0b1100100) + '\145')(chr(4121 - 4004) + chr(116) + '\x66' + '\x2d' + chr(0b11101 + 0o33)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def uJ0q9cG5ZOR3(oVre8I6UXc3b, mKQm526a9xSD, vyskHDXig6uT, jEXsEsgeguP4, Bvkw71G8hn1S, *kJDRfRhcZHjS):
UQbpzKELliLX = oVre8I6UXc3b._artificial_done and Bvkw71G8hn1S
kJDRfRhcZHjS = YyaZ4tpXu4lf(kJDRfRhcZHjS)
xafqLlk3kkUe(kJDRfRhcZHjS, xafqLlk3kkUe(SXOLrMavuUCe(b'{U\x8dW\xd58'), '\x64' + '\145' + '\x63' + chr(111) + chr(100) + chr(101))('\x75' + chr(0b1010001 + 0o43) + chr(0b1100110) + chr(117 - 72) + chr(674 - 618)))(UQbpzKELliLX)
return xafqLlk3kkUe(KNx0Ujaz9UM0(IS18YQFIuVDB, oVre8I6UXc3b), xafqLlk3kkUe(SXOLrMavuUCe(b'{A\x99'), chr(0b1010001 + 0o23) + chr(101) + '\143' + chr(111) + '\x64' + chr(0b10000 + 0o125))(chr(0b1110101) + chr(116) + '\146' + chr(0b101101) + chr(786 - 730)))(mKQm526a9xSD, vyskHDXig6uT, jEXsEsgeguP4, Bvkw71G8hn1S, *kJDRfRhcZHjS)
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/dopamine_connector.py
|
DopamineBatchEnv.step
|
def step(self, actions):
"""Step."""
self._elapsed_steps += 1
obs, rewards, dones = \
[np.array(r) for r in self.batch_env.step(actions)]
if self._elapsed_steps > self._max_episode_steps:
done = True
if self._elapsed_steps > self._max_episode_steps + 1:
rewards.fill(0)
else:
done = dones[0]
assert np.all(done == dones), ("Current modifications of Dopamine "
"require same number of steps for each "
"environment in batch")
del dones
self.game_over = done
return obs, rewards, done, {}
|
python
|
def step(self, actions):
"""Step."""
self._elapsed_steps += 1
obs, rewards, dones = \
[np.array(r) for r in self.batch_env.step(actions)]
if self._elapsed_steps > self._max_episode_steps:
done = True
if self._elapsed_steps > self._max_episode_steps + 1:
rewards.fill(0)
else:
done = dones[0]
assert np.all(done == dones), ("Current modifications of Dopamine "
"require same number of steps for each "
"environment in batch")
del dones
self.game_over = done
return obs, rewards, done, {}
|
[
"def",
"step",
"(",
"self",
",",
"actions",
")",
":",
"self",
".",
"_elapsed_steps",
"+=",
"1",
"obs",
",",
"rewards",
",",
"dones",
"=",
"[",
"np",
".",
"array",
"(",
"r",
")",
"for",
"r",
"in",
"self",
".",
"batch_env",
".",
"step",
"(",
"actions",
")",
"]",
"if",
"self",
".",
"_elapsed_steps",
">",
"self",
".",
"_max_episode_steps",
":",
"done",
"=",
"True",
"if",
"self",
".",
"_elapsed_steps",
">",
"self",
".",
"_max_episode_steps",
"+",
"1",
":",
"rewards",
".",
"fill",
"(",
"0",
")",
"else",
":",
"done",
"=",
"dones",
"[",
"0",
"]",
"assert",
"np",
".",
"all",
"(",
"done",
"==",
"dones",
")",
",",
"(",
"\"Current modifications of Dopamine \"",
"\"require same number of steps for each \"",
"\"environment in batch\"",
")",
"del",
"dones",
"self",
".",
"game_over",
"=",
"done",
"return",
"obs",
",",
"rewards",
",",
"done",
",",
"{",
"}"
] |
Step.
|
[
"Step",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L371-L388
|
train
|
Step the environment.
|
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('\x30' + chr(111) + chr(0b10001 + 0o40) + chr(0b101010 + 0o7) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(1060 - 1012) + chr(0b1101111) + chr(50) + '\x30' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + '\x37' + chr(0b111 + 0o51), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(0b110100) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1010100 + 0o33) + chr(0b110001) + '\060' + chr(1061 - 1010), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(904 - 851) + chr(0b110100), 52448 - 52440), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(1512 - 1459) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(668 - 620) + chr(0b1000011 + 0o54) + chr(51) + chr(55) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + '\063' + chr(48), 37014 - 37006), ehT0Px3KOsy9(chr(127 - 79) + chr(0b1101111) + '\061' + '\x36' + chr(862 - 807), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100001 + 0o24) + chr(134 - 84), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(5353 - 5242) + chr(0b110011) + chr(0b10011 + 0o35) + chr(48), 17938 - 17930), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + '\x32', 28035 - 28027), ehT0Px3KOsy9('\x30' + chr(1069 - 958) + '\061' + chr(0b10000 + 0o40) + chr(0b1000 + 0o57), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + '\062' + chr(0b110001) + chr(0b1010 + 0o51), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(0b10110 + 0o33) + chr(1223 - 1173) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(781 - 732) + chr(54) + '\x32', 43294 - 43286), ehT0Px3KOsy9(chr(1563 - 1515) + chr(111) + '\x33' + chr(1567 - 1518) + chr(55), 28355 - 28347), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(50) + '\060' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(51) + chr(55) + chr(2339 - 2285), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\063' + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(2838 - 2727) + chr(0b110010) + chr(0b0 + 0o60) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + '\063' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7394 - 7283) + '\062' + chr(54) + chr(148 - 100), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(50) + chr(469 - 419) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(2508 - 2456) + '\x35', 14307 - 14299), ehT0Px3KOsy9(chr(366 - 318) + chr(0b1101111) + chr(494 - 439) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(0b110100) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1061 - 1009) + chr(0b100101 + 0o22), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\x37' + '\x30', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110010) + chr(0b110111), 57395 - 57387), ehT0Px3KOsy9(chr(0b110000) + chr(7011 - 6900) + chr(0b10 + 0o60) + chr(48) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(2283 - 2231) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(3016 - 2905) + '\063' + chr(682 - 631) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(2009 - 1961) + chr(111) + chr(0b11 + 0o62) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6453 - 6342) + chr(0b100000 + 0o22) + chr(51) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + '\x36' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000101 + 0o52) + chr(0b110011) + chr(0b110111) + chr(50), 8), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + '\x31' + '\060' + '\x37', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110011) + '\x31', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1265 - 1217) + '\x6f' + chr(295 - 242) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'f'), '\x64' + '\145' + '\x63' + '\157' + chr(8019 - 7919) + chr(101))(chr(3260 - 3143) + '\164' + '\146' + chr(0b1010 + 0o43) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def kDuFsAhEatcU(oVre8I6UXc3b, WCl6VUkME_8I):
oVre8I6UXc3b.Gyw9h4Ui3J2T += ehT0Px3KOsy9('\060' + chr(111) + '\061', 0o10)
(HUAx0lWcwxPP, yrDfr6ll4Ijz, ijPEVpFpIejc) = [WqUC3KWvYVup.B0ePDhpqxN5n(JWG5qApaeJkp) for JWG5qApaeJkp in oVre8I6UXc3b.batch_env.kDuFsAhEatcU(WCl6VUkME_8I)]
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\xfc\x0f\xdf+\xd8;\x93k=\x18\x94'), '\144' + chr(0b1011111 + 0o6) + chr(8940 - 8841) + chr(0b1100011 + 0o14) + chr(100) + chr(8765 - 8664))('\x75' + chr(116) + chr(0b11111 + 0o107) + chr(1296 - 1251) + chr(0b101001 + 0o17))) > xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\xe8\x19\x9e\x1c\x89\x1e\x93+\x18N\xa5]4\xff4\x02\xbc'), '\144' + chr(408 - 307) + chr(3601 - 3502) + '\x6f' + chr(8899 - 8799) + chr(0b101 + 0o140))('\x75' + '\164' + chr(0b1100110) + '\x2d' + '\070')):
Ki86oC9WfglU = ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1346 - 1297), 8)
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\xfc\x0f\xdf+\xd8;\x93k=\x18\x94'), '\144' + chr(0b1100101) + chr(0b1100011) + '\157' + chr(5262 - 5162) + chr(101))(chr(0b1110101) + chr(1247 - 1131) + chr(0b1010110 + 0o20) + chr(0b101101) + '\070')) > xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\xe8\x19\x9e\x1c\x89\x1e\x93+\x18N\xa5]4\xff4\x02\xbc'), chr(100) + '\x65' + '\143' + chr(111) + chr(0b101001 + 0o73) + chr(8917 - 8816))(chr(0b111001 + 0o74) + chr(116) + chr(8519 - 8417) + chr(0b101101) + chr(1126 - 1070))) + ehT0Px3KOsy9(chr(48) + chr(9648 - 9537) + chr(1661 - 1612), 8):
xafqLlk3kkUe(yrDfr6ll4Ijz, xafqLlk3kkUe(SXOLrMavuUCe(b'.\xec\x14\x8a'), chr(0b1100100) + '\x65' + chr(4380 - 4281) + chr(3813 - 3702) + chr(0b1000011 + 0o41) + '\x65')('\x75' + chr(0b1110100) + chr(10000 - 9898) + chr(45) + chr(0b111000)))(ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10011 + 0o35), 0o10))
else:
Ki86oC9WfglU = ijPEVpFpIejc[ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(7714 - 7603) + '\060', 8)]
assert xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c\xe9L\xde-\x86_\x88:\x1e\x18\xf3'), '\144' + chr(9525 - 9424) + '\x63' + '\x6f' + '\x64' + chr(101))(chr(0b1110101) + '\164' + '\146' + '\055' + chr(0b111000)))(Ki86oC9WfglU == ijPEVpFpIejc), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xf0\n\x94&\x82\x1a\xda5\x18N\xa9d.\xe80\x06\xa6\xe8\x90-\xa0s\xd6\xb6aW\xd4\x86\x15\xfe\xec\x03\xfb^\xfbB\x8f.+-\xa5\x0b\x87.\x89N\x94-\x1aH\xa5pg\xe47R\xbc\xf3\x9b.\xf3<\xd6\xf9W\x18\xc1\x86\x1b\xff\xa2\x03\xb5Z\xf7A\x95)4-\xeb\x0c\xc6*\x82N\x989\x03I\xa8'), chr(0b1101 + 0o127) + chr(0b1100101) + chr(3605 - 3506) + chr(0b1101111) + chr(0b1100100) + '\145')(chr(0b10111 + 0o136) + chr(0b10111 + 0o135) + '\x66' + '\055' + chr(56))
del ijPEVpFpIejc
oVre8I6UXc3b.FxfN3KvFMSYo = Ki86oC9WfglU
return (HUAx0lWcwxPP, yrDfr6ll4Ijz, Ki86oC9WfglU, {})
|
tensorflow/tensor2tensor
|
tensor2tensor/models/text_cnn.py
|
text_cnn_base
|
def text_cnn_base():
"""Set of hyperparameters."""
hparams = common_hparams.basic_params1()
hparams.batch_size = 4096
hparams.max_length = 256
hparams.clip_grad_norm = 0. # i.e. no gradient clipping
hparams.optimizer_adam_epsilon = 1e-9
hparams.learning_rate_schedule = "legacy"
hparams.learning_rate_decay_scheme = "noam"
hparams.learning_rate = 0.1
hparams.learning_rate_warmup_steps = 4000
hparams.initializer_gain = 1.0
hparams.num_hidden_layers = 6
hparams.initializer = "uniform_unit_scaling"
hparams.weight_decay = 0.0
hparams.optimizer_adam_beta1 = 0.9
hparams.optimizer_adam_beta2 = 0.98
hparams.num_sampled_classes = 0
hparams.label_smoothing = 0.1
hparams.shared_embedding_and_softmax_weights = True
hparams.symbol_modality_num_shards = 16
# Add new ones like this.
hparams.add_hparam("filter_sizes", [2, 3, 4, 5])
hparams.add_hparam("num_filters", 128)
hparams.add_hparam("output_dropout", 0.4)
return hparams
|
python
|
def text_cnn_base():
"""Set of hyperparameters."""
hparams = common_hparams.basic_params1()
hparams.batch_size = 4096
hparams.max_length = 256
hparams.clip_grad_norm = 0. # i.e. no gradient clipping
hparams.optimizer_adam_epsilon = 1e-9
hparams.learning_rate_schedule = "legacy"
hparams.learning_rate_decay_scheme = "noam"
hparams.learning_rate = 0.1
hparams.learning_rate_warmup_steps = 4000
hparams.initializer_gain = 1.0
hparams.num_hidden_layers = 6
hparams.initializer = "uniform_unit_scaling"
hparams.weight_decay = 0.0
hparams.optimizer_adam_beta1 = 0.9
hparams.optimizer_adam_beta2 = 0.98
hparams.num_sampled_classes = 0
hparams.label_smoothing = 0.1
hparams.shared_embedding_and_softmax_weights = True
hparams.symbol_modality_num_shards = 16
# Add new ones like this.
hparams.add_hparam("filter_sizes", [2, 3, 4, 5])
hparams.add_hparam("num_filters", 128)
hparams.add_hparam("output_dropout", 0.4)
return hparams
|
[
"def",
"text_cnn_base",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"hparams",
".",
"batch_size",
"=",
"4096",
"hparams",
".",
"max_length",
"=",
"256",
"hparams",
".",
"clip_grad_norm",
"=",
"0.",
"# i.e. no gradient clipping",
"hparams",
".",
"optimizer_adam_epsilon",
"=",
"1e-9",
"hparams",
".",
"learning_rate_schedule",
"=",
"\"legacy\"",
"hparams",
".",
"learning_rate_decay_scheme",
"=",
"\"noam\"",
"hparams",
".",
"learning_rate",
"=",
"0.1",
"hparams",
".",
"learning_rate_warmup_steps",
"=",
"4000",
"hparams",
".",
"initializer_gain",
"=",
"1.0",
"hparams",
".",
"num_hidden_layers",
"=",
"6",
"hparams",
".",
"initializer",
"=",
"\"uniform_unit_scaling\"",
"hparams",
".",
"weight_decay",
"=",
"0.0",
"hparams",
".",
"optimizer_adam_beta1",
"=",
"0.9",
"hparams",
".",
"optimizer_adam_beta2",
"=",
"0.98",
"hparams",
".",
"num_sampled_classes",
"=",
"0",
"hparams",
".",
"label_smoothing",
"=",
"0.1",
"hparams",
".",
"shared_embedding_and_softmax_weights",
"=",
"True",
"hparams",
".",
"symbol_modality_num_shards",
"=",
"16",
"# Add new ones like this.",
"hparams",
".",
"add_hparam",
"(",
"\"filter_sizes\"",
",",
"[",
"2",
",",
"3",
",",
"4",
",",
"5",
"]",
")",
"hparams",
".",
"add_hparam",
"(",
"\"num_filters\"",
",",
"128",
")",
"hparams",
".",
"add_hparam",
"(",
"\"output_dropout\"",
",",
"0.4",
")",
"return",
"hparams"
] |
Set of hyperparameters.
|
[
"Set",
"of",
"hyperparameters",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/text_cnn.py#L86-L112
|
train
|
Set of hyperparameters.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMK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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(1343 - 1295) + chr(0b1101111) + chr(0b10001 + 0o40) + chr(1753 - 1698) + chr(372 - 318), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + '\x31' + chr(55) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(48) + chr(0b100010 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\067' + chr(52), 1137 - 1129), ehT0Px3KOsy9(chr(670 - 622) + chr(0b1101111) + '\065' + chr(1483 - 1430), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3209 - 3098) + '\063' + chr(55) + chr(0b1101 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(52) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1011 + 0o50) + '\066' + chr(2736 - 2682), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + chr(0b11001 + 0o32) + chr(0b10 + 0o61) + chr(54), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x34', 40712 - 40704), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(50) + '\x34' + '\060', 39649 - 39641), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(10600 - 10489) + chr(50) + '\067' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1170 - 1122) + chr(111) + chr(0b110001) + chr(48) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\x35' + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1356 - 1307) + chr(0b111 + 0o57) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + chr(0b110010) + chr(0b111 + 0o55) + chr(330 - 278), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10581 - 10470) + chr(0b0 + 0o62) + chr(0b11101 + 0o31) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b100100 + 0o23), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + chr(0b110011) + chr(0b110000 + 0o1) + '\x31', 58393 - 58385), ehT0Px3KOsy9(chr(1625 - 1577) + chr(111) + chr(52) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10685 - 10574) + chr(51) + chr(55) + chr(919 - 870), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110011) + '\x30' + chr(2070 - 2018), ord("\x08")), ehT0Px3KOsy9(chr(2027 - 1979) + chr(0b11 + 0o154) + chr(0b110010) + chr(54) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x30' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(0b1001 + 0o50) + chr(0b110100) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b10 + 0o155) + chr(896 - 845) + chr(0b10001 + 0o45) + chr(51), 6363 - 6355), ehT0Px3KOsy9('\060' + chr(12122 - 12011) + '\062' + chr(0b1111 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(49) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1257 - 1209) + chr(0b11101 + 0o122) + chr(0b110001) + chr(0b110001) + chr(0b11 + 0o61), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + '\063' + '\063' + chr(2049 - 1995), 8), ehT0Px3KOsy9(chr(48) + chr(8896 - 8785) + chr(0b110000 + 0o3) + chr(0b1111 + 0o46) + chr(1439 - 1384), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + '\x36', 36634 - 36626), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b10 + 0o65) + chr(398 - 350), ord("\x08")), ehT0Px3KOsy9(chr(997 - 949) + '\x6f' + '\x33' + chr(49) + '\066', 0o10), ehT0Px3KOsy9(chr(1167 - 1119) + chr(111) + chr(49) + chr(0b11111 + 0o25) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110000 + 0o3) + chr(0b110011) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100000 + 0o23) + '\062' + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000101 + 0o52) + chr(51) + '\064' + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + '\x33' + chr(0b10110 + 0o35), 21916 - 21908), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b110000 + 0o77) + chr(735 - 685) + chr(0b110010) + '\060', 59996 - 59988)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + chr(2051 - 1998) + chr(1629 - 1581), 32967 - 32959)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'P'), chr(100) + '\145' + chr(99) + chr(11975 - 11864) + chr(2459 - 2359) + chr(0b1100101))(chr(0b1110101) + chr(0b1100000 + 0o24) + chr(102) + '\x2d' + chr(3014 - 2958)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def B9W9EK45plWq():
n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1()
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(943 - 895) + '\x6f' + '\061' + chr(238 - 190) + chr(0b110000) + '\x30' + '\x30', 47576 - 47568)
n4ljua2gi1Pr._o7pVXAdOCRy = ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(924 - 872) + chr(0b11110 + 0o22) + chr(0b110000), 16785 - 16777)
n4ljua2gi1Pr.SdNSZNVkVjLh = 0.0
n4ljua2gi1Pr.o17O_bIptWdl = 1e-09
n4ljua2gi1Pr.Lz_s7neUzM5V = xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\x18\xa4]N\x82'), '\x64' + chr(101) + '\143' + chr(111) + '\x64' + '\x65')('\x75' + chr(5742 - 5626) + '\x66' + '\x2d' + '\070')
n4ljua2gi1Pr.v3ZnJE9Hdub1 = xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\x12\xa2Q'), chr(0b1010 + 0o132) + '\145' + chr(6939 - 6840) + '\157' + chr(0b1001011 + 0o31) + chr(0b1011 + 0o132))(chr(0b1110100 + 0o1) + chr(0b1000111 + 0o55) + chr(0b1100110) + '\055' + '\x38')
n4ljua2gi1Pr.QGSIpd_yUNzU = 0.1
n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101001 + 0o6) + '\067' + chr(377 - 323) + chr(1380 - 1328) + chr(361 - 313), 0b1000)
n4ljua2gi1Pr.S1SbCBXLapw8 = 1.0
n4ljua2gi1Pr.jZh5_pLUoOoZ = ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + chr(0b110110), 8)
n4ljua2gi1Pr.kwfuYzkY5C57 = xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\x13\xaaZB\x89\x08\xa9\xabj\xc9\xc8\x19\xdf\x15\xc5\xdcf\xa7D'), chr(0b1000011 + 0o41) + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(0b1000010 + 0o42) + '\x65')(chr(0b1110101) + chr(0b111100 + 0o70) + '\146' + '\x2d' + chr(56))
n4ljua2gi1Pr.eB4rJl6fUxw9 = 0.0
n4ljua2gi1Pr.GcOjyd7zcDH8 = 0.9
n4ljua2gi1Pr.CBOVKNT0M9cG = 0.98
n4ljua2gi1Pr.Syf38YGTPvuw = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1101 + 0o43), ord("\x08"))
n4ljua2gi1Pr.FSjUgdaczzRk = 0.1
n4ljua2gi1Pr.qVamxim0L2I1 = ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31', 0o10)
n4ljua2gi1Pr.iBYlnqUAwgIX = ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(0b0 + 0o62) + chr(0b10011 + 0o35), 0o10)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x19\xa7cE\x8b\x04\x84\xbfi'), chr(7764 - 7664) + chr(101) + '\x63' + chr(0b1000000 + 0o57) + '\144' + chr(5665 - 5564))(chr(0b1110101) + '\x74' + '\146' + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x18\x14\xafHH\x89:\x85\xb7~\xc5\xcf'), chr(100) + chr(101) + '\x63' + chr(111) + chr(0b1100100) + chr(0b1100101))('\x75' + '\x74' + chr(8157 - 8055) + chr(45) + chr(0b111000)), [ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\062', 31987 - 31979), ehT0Px3KOsy9(chr(48) + chr(3671 - 3560) + chr(51), 0o10), ehT0Px3KOsy9(chr(1523 - 1475) + '\x6f' + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + chr(0b110101), 0b1000)])
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x19\xa7cE\x8b\x04\x84\xbfi'), '\144' + '\145' + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))('\165' + '\x74' + '\x66' + chr(527 - 482) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\x08\xaecK\x92\t\x82\xbbv\xd3'), '\x64' + chr(101) + '\x63' + '\x6f' + chr(0b1100100 + 0o0) + chr(0b111001 + 0o54))('\x75' + '\x74' + chr(9860 - 9758) + '\x2d' + chr(0b111000)), ehT0Px3KOsy9('\060' + chr(0b10101 + 0o132) + chr(0b110010) + chr(82 - 34) + chr(1062 - 1014), 21128 - 21120))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x19\xa7cE\x8b\x04\x84\xbfi'), chr(0b1011011 + 0o11) + '\145' + chr(0b1100011) + '\x6f' + chr(9585 - 9485) + chr(0b1100101))(chr(7934 - 7817) + chr(0b1110100) + chr(8229 - 8127) + '\055' + chr(2052 - 1996)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x11\x08\xb7LX\x8f:\x92\xack\xd0\xd33\xd8'), '\x64' + chr(7855 - 7754) + chr(0b1010000 + 0o23) + '\157' + '\x64' + '\145')('\165' + '\164' + '\146' + '\x2d' + chr(394 - 338)), 0.4)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/video/next_frame_glow.py
|
next_frame_glow_hparams
|
def next_frame_glow_hparams():
"""Hparams for next_frame_glow."""
hparams = glow.glow_hparams()
# Possible modes are conditional and unconditional
hparams.add_hparam("gen_mode", "conditional")
hparams.add_hparam("learn_top_scale", False)
hparams.add_hparam("condition_all_levels", True)
# For each video, substitutes "num_input_frames + num_output_frames" with a
# randomly sampled patch of length "num_train_frames" during training.
# -1 indicates that the entire video is used for training.
hparams.add_hparam("num_train_frames", -1)
# The following are hparams that model the latent transitions.
# Encoder that maps the latents to a Gaussian distribution.
# This function is used to model the prior over z_{t}. Can be,
# Pointwise -> point-wise multiplication of z_{t-1}.
# conv_net -> one-layer convolution over z_{t-1} .. z_{t - num_cond_latents}
# conv3d_net or conv_lstm
hparams.add_hparam("latent_dist_encoder", "conv_net")
# Number of latents used in the encoder above.
hparams.add_hparam("num_cond_latents", 1)
hparams.add_hparam("latent_architecture", "glow_resnet")
hparams.add_hparam("latent_apply_dilations", False)
hparams.add_hparam("latent_dilation_rates", [1, 3])
# Use latent skip connections
hparams.add_hparam("model_input", False)
hparams.add_hparam("cond_first_frame", False)
hparams.add_hparam("latent_skip", True)
hparams.add_hparam("latent_encoder_depth", 2)
hparams.add_hparam("latent_encoder_width", 512)
hparams.add_hparam("latent_dropout", 0.0)
hparams.add_hparam("latent_pre_output_channels", 512)
hparams.add_hparam("latent_activation", "relu")
hparams.add_hparam("latent_noise", 0.0)
# Pretrains the glow encoder for "pretrain_steps" number of steps.
# By default, don't pretrain and learn end-to-end
hparams.add_hparam("pretrain_steps", -1)
hparams.bottom = {
"inputs": modalities.video_raw_bottom,
"targets": modalities.video_raw_targets_bottom,
}
hparams.loss = {
"targets": modalities.video_l1_raw_loss,
}
hparams.top = {
"targets": modalities.video_raw_top,
}
hparams.init_batch_size = 256
hparams.batch_size = 32
# Possible options: are prev_frame, single_conv and normal
hparams.top_prior = "single_conv"
return hparams
|
python
|
def next_frame_glow_hparams():
"""Hparams for next_frame_glow."""
hparams = glow.glow_hparams()
# Possible modes are conditional and unconditional
hparams.add_hparam("gen_mode", "conditional")
hparams.add_hparam("learn_top_scale", False)
hparams.add_hparam("condition_all_levels", True)
# For each video, substitutes "num_input_frames + num_output_frames" with a
# randomly sampled patch of length "num_train_frames" during training.
# -1 indicates that the entire video is used for training.
hparams.add_hparam("num_train_frames", -1)
# The following are hparams that model the latent transitions.
# Encoder that maps the latents to a Gaussian distribution.
# This function is used to model the prior over z_{t}. Can be,
# Pointwise -> point-wise multiplication of z_{t-1}.
# conv_net -> one-layer convolution over z_{t-1} .. z_{t - num_cond_latents}
# conv3d_net or conv_lstm
hparams.add_hparam("latent_dist_encoder", "conv_net")
# Number of latents used in the encoder above.
hparams.add_hparam("num_cond_latents", 1)
hparams.add_hparam("latent_architecture", "glow_resnet")
hparams.add_hparam("latent_apply_dilations", False)
hparams.add_hparam("latent_dilation_rates", [1, 3])
# Use latent skip connections
hparams.add_hparam("model_input", False)
hparams.add_hparam("cond_first_frame", False)
hparams.add_hparam("latent_skip", True)
hparams.add_hparam("latent_encoder_depth", 2)
hparams.add_hparam("latent_encoder_width", 512)
hparams.add_hparam("latent_dropout", 0.0)
hparams.add_hparam("latent_pre_output_channels", 512)
hparams.add_hparam("latent_activation", "relu")
hparams.add_hparam("latent_noise", 0.0)
# Pretrains the glow encoder for "pretrain_steps" number of steps.
# By default, don't pretrain and learn end-to-end
hparams.add_hparam("pretrain_steps", -1)
hparams.bottom = {
"inputs": modalities.video_raw_bottom,
"targets": modalities.video_raw_targets_bottom,
}
hparams.loss = {
"targets": modalities.video_l1_raw_loss,
}
hparams.top = {
"targets": modalities.video_raw_top,
}
hparams.init_batch_size = 256
hparams.batch_size = 32
# Possible options: are prev_frame, single_conv and normal
hparams.top_prior = "single_conv"
return hparams
|
[
"def",
"next_frame_glow_hparams",
"(",
")",
":",
"hparams",
"=",
"glow",
".",
"glow_hparams",
"(",
")",
"# Possible modes are conditional and unconditional",
"hparams",
".",
"add_hparam",
"(",
"\"gen_mode\"",
",",
"\"conditional\"",
")",
"hparams",
".",
"add_hparam",
"(",
"\"learn_top_scale\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"condition_all_levels\"",
",",
"True",
")",
"# For each video, substitutes \"num_input_frames + num_output_frames\" with a",
"# randomly sampled patch of length \"num_train_frames\" during training.",
"# -1 indicates that the entire video is used for training.",
"hparams",
".",
"add_hparam",
"(",
"\"num_train_frames\"",
",",
"-",
"1",
")",
"# The following are hparams that model the latent transitions.",
"# Encoder that maps the latents to a Gaussian distribution.",
"# This function is used to model the prior over z_{t}. Can be,",
"# Pointwise -> point-wise multiplication of z_{t-1}.",
"# conv_net -> one-layer convolution over z_{t-1} .. z_{t - num_cond_latents}",
"# conv3d_net or conv_lstm",
"hparams",
".",
"add_hparam",
"(",
"\"latent_dist_encoder\"",
",",
"\"conv_net\"",
")",
"# Number of latents used in the encoder above.",
"hparams",
".",
"add_hparam",
"(",
"\"num_cond_latents\"",
",",
"1",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_architecture\"",
",",
"\"glow_resnet\"",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_apply_dilations\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_dilation_rates\"",
",",
"[",
"1",
",",
"3",
"]",
")",
"# Use latent skip connections",
"hparams",
".",
"add_hparam",
"(",
"\"model_input\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"cond_first_frame\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_skip\"",
",",
"True",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_encoder_depth\"",
",",
"2",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_encoder_width\"",
",",
"512",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_dropout\"",
",",
"0.0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_pre_output_channels\"",
",",
"512",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_activation\"",
",",
"\"relu\"",
")",
"hparams",
".",
"add_hparam",
"(",
"\"latent_noise\"",
",",
"0.0",
")",
"# Pretrains the glow encoder for \"pretrain_steps\" number of steps.",
"# By default, don't pretrain and learn end-to-end",
"hparams",
".",
"add_hparam",
"(",
"\"pretrain_steps\"",
",",
"-",
"1",
")",
"hparams",
".",
"bottom",
"=",
"{",
"\"inputs\"",
":",
"modalities",
".",
"video_raw_bottom",
",",
"\"targets\"",
":",
"modalities",
".",
"video_raw_targets_bottom",
",",
"}",
"hparams",
".",
"loss",
"=",
"{",
"\"targets\"",
":",
"modalities",
".",
"video_l1_raw_loss",
",",
"}",
"hparams",
".",
"top",
"=",
"{",
"\"targets\"",
":",
"modalities",
".",
"video_raw_top",
",",
"}",
"hparams",
".",
"init_batch_size",
"=",
"256",
"hparams",
".",
"batch_size",
"=",
"32",
"# Possible options: are prev_frame, single_conv and normal",
"hparams",
".",
"top_prior",
"=",
"\"single_conv\"",
"return",
"hparams"
] |
Hparams for next_frame_glow.
|
[
"Hparams",
"for",
"next_frame_glow",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/next_frame_glow.py#L37-L87
|
train
|
Hparams for next_frame_glow.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyK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OError,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(0b110101 + 0o72) + '\063' + chr(0b1111 + 0o43) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\064' + chr(0b100000 + 0o22), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(50) + chr(0b110111), 54561 - 54553), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b10110 + 0o33) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + '\060' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(55) + chr(0b100101 + 0o20), 0b1000), ehT0Px3KOsy9(chr(2267 - 2219) + chr(0b10010 + 0o135) + chr(49) + chr(1120 - 1067) + '\x36', 22985 - 22977), ehT0Px3KOsy9('\060' + chr(10507 - 10396) + chr(1590 - 1541) + chr(0b110110) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100001 + 0o22) + '\066' + chr(2284 - 2234), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x34' + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2114 - 2064) + chr(1030 - 980), 0b1000), ehT0Px3KOsy9(chr(1251 - 1203) + chr(0b1011101 + 0o22) + '\x33' + '\x31' + chr(1692 - 1643), 2335 - 2327), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b110111 + 0o70) + chr(49) + chr(2049 - 1999) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010111 + 0o30) + chr(0b110010) + '\x32' + chr(1122 - 1069), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + chr(756 - 705) + chr(0b110001) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(1811 - 1757) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1970 - 1920) + '\064' + chr(2741 - 2687), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\067' + chr(0b110000 + 0o3), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\064' + chr(1592 - 1538), 0b1000), ehT0Px3KOsy9(chr(816 - 768) + chr(7676 - 7565) + '\x31' + chr(50) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + '\x33' + chr(0b1100 + 0o51) + chr(1800 - 1745), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000100 + 0o53) + chr(0b110000 + 0o3) + chr(0b110001) + chr(683 - 629), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11100 + 0o123) + '\x31' + chr(0b110000) + chr(0b11101 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(50) + chr(1387 - 1334) + chr(0b110110), 43157 - 43149), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\x36' + chr(1810 - 1762), ord("\x08")), ehT0Px3KOsy9(chr(1644 - 1596) + chr(0b10100 + 0o133) + '\x32' + '\x31' + '\066', 23450 - 23442), ehT0Px3KOsy9(chr(48) + chr(5645 - 5534) + chr(0b110010) + chr(0b11101 + 0o23) + '\x32', 42358 - 42350), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\066' + chr(1070 - 1019), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(495 - 444) + chr(0b110000) + '\x36', 64213 - 64205), ehT0Px3KOsy9(chr(1360 - 1312) + chr(0b1101111) + '\x31' + '\x37' + chr(50), 0b1000), ehT0Px3KOsy9(chr(908 - 860) + chr(0b1100010 + 0o15) + chr(49) + '\062' + chr(0b110100), 36013 - 36005), ehT0Px3KOsy9('\060' + '\157' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + chr(50) + chr(0b110000) + chr(0b110000), 8032 - 8024), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11010 + 0o27) + '\x37' + '\061', 0o10), ehT0Px3KOsy9(chr(1797 - 1749) + '\x6f' + chr(0b110010) + chr(1322 - 1267) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(858 - 810) + '\x6f' + '\x31' + '\066' + chr(52), 56155 - 56147), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b110100) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1029 - 978) + chr(0b110011) + '\x30', 10022 - 10014), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + '\062' + chr(50), 8), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\x34' + chr(0b110110), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110101) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd'), '\x64' + chr(0b11001 + 0o114) + '\143' + chr(5210 - 5099) + '\144' + chr(2070 - 1969))('\165' + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b100 + 0o64)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hwPy7BHnnW87():
n4ljua2gi1Pr = DdcEAbbshEbs.glow_hparams()
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\144' + chr(0b110110 + 0o57) + '\x63' + chr(111) + chr(0b1100100) + '\x65')(chr(0b1100110 + 0o17) + '\x74' + chr(0b100100 + 0o102) + chr(1043 - 998) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\x07\xb9\xd6\xeaR\n\x14'), chr(2883 - 2783) + '\145' + '\143' + chr(8292 - 8181) + '\144' + '\x65')(chr(0b1011110 + 0o27) + chr(9037 - 8921) + '\x66' + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\r\xb9\xed\xeeI\x07\x1e\x9c\xc4~'), '\144' + chr(101) + chr(0b111001 + 0o52) + '\x6f' + chr(100) + '\145')('\165' + chr(3915 - 3799) + chr(0b110111 + 0o57) + chr(0b101101) + '\070'))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(100) + chr(101) + chr(2493 - 2394) + '\x6f' + chr(100) + chr(0b1000100 + 0o41))('\x75' + chr(0b1110100) + chr(0b1100110) + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x07\xb6\xfb\xe9b\x1a\x1e\x82\xfaa\xaa4\xf9\xa9'), chr(0b111010 + 0o52) + chr(0b1100101) + '\143' + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(102) + chr(0b100101 + 0o10) + chr(56)), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110000), 0o10))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(0b1100100) + chr(101) + chr(4666 - 4567) + chr(111) + '\144' + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\r\xb9\xed\xeeI\x07\x1e\x9c\xfas\xa59\xca\xa0\x92\xd0^J!'), chr(0b1001101 + 0o27) + '\145' + '\x63' + '\x6f' + chr(9548 - 9448) + chr(101))(chr(9022 - 8905) + '\164' + chr(0b1000010 + 0o44) + chr(0b1111 + 0o36) + chr(0b111000)), ehT0Px3KOsy9(chr(513 - 465) + chr(111) + '\061', 0b1000))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\x64' + chr(0b100010 + 0o103) + chr(8475 - 8376) + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1 + 0o164) + chr(116) + chr(0b11110 + 0o110) + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd\x17\xba\xd6\xf3O\x0f\x18\x9c\xfat\xbb4\xf8\xa9\x84'), chr(0b1000110 + 0o36) + chr(6161 - 6060) + chr(5669 - 5570) + chr(111) + chr(0b1010 + 0o132) + chr(0b101 + 0o140))('\x75' + chr(116) + chr(102) + chr(1798 - 1753) + '\x38'), -ehT0Px3KOsy9(chr(608 - 560) + chr(111) + chr(335 - 286), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\144' + '\x65' + chr(99) + chr(111) + chr(0b10 + 0o142) + chr(0b1010110 + 0o17))(chr(7132 - 7015) + chr(0b1110100) + '\146' + '\x2d' + chr(1941 - 1885)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x15\x9b\xd6f\x960\xfb\xaf\x98\xc2^T'), chr(0b1100100) + chr(101) + chr(9448 - 9349) + chr(0b1101111) + chr(0b111000 + 0o54) + '\x65')(chr(0b1100111 + 0o16) + chr(0b101101 + 0o107) + chr(0b1100110) + chr(160 - 115) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\r\xb9\xff\xd8S\x0b\x05'), '\x64' + chr(4786 - 4685) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(4559 - 4458))('\x75' + chr(116) + '\146' + chr(262 - 217) + chr(0b111000)))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(100) + '\145' + '\143' + '\157' + chr(0b1001011 + 0o31) + chr(0b101 + 0o140))(chr(0b1101100 + 0o11) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b110001 + 0o7)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd\x17\xba\xd6\xe4R\x00\x15\xad\xc9s\xbd0\xfb\xb8\x84'), chr(0b111101 + 0o47) + chr(0b101011 + 0o72) + chr(99) + '\157' + '\x64' + chr(0b10010 + 0o123))('\165' + chr(0b1110100) + chr(102) + chr(0b100101 + 0o10) + chr(0b111000)), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\x64' + chr(101) + chr(99) + chr(111) + '\x64' + chr(0b1100101))(chr(6098 - 5981) + chr(0b1000000 + 0o64) + chr(102) + '\x2d' + chr(2829 - 2773)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x10\x80\xc6z\xa0!\xf0\xaf\x83\xd3IC'), '\x64' + chr(6017 - 5916) + '\x63' + '\157' + chr(0b1100100) + chr(101))('\165' + chr(116) + chr(8282 - 8180) + chr(0b101101) + chr(1869 - 1813)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\x0e\xb8\xfe\xd8O\x0b\x02\x9c\xc0f'), chr(100) + chr(0b110001 + 0o64) + chr(0b1001011 + 0o30) + '\x6f' + chr(0b1011011 + 0o11) + chr(1389 - 1288))(chr(4398 - 4281) + '\164' + '\146' + chr(0b100010 + 0o13) + chr(0b111000)))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(0b101110 + 0o66) + chr(101) + chr(99) + '\157' + chr(0b1100100) + '\x65')('\x75' + chr(0b1110100) + chr(102) + chr(45) + chr(937 - 881)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x10\x82\xd5~\xb0\n\xf1\xa5\x9b\xc7OO=\x81\xbd'), chr(1046 - 946) + chr(165 - 64) + chr(99) + '\157' + '\x64' + chr(0b1011101 + 0o10))(chr(9180 - 9063) + chr(0b100111 + 0o115) + '\x66' + chr(1073 - 1028) + '\x38'), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(0b1100100) + chr(101) + '\x63' + '\x6f' + chr(100) + chr(101))(chr(117) + '\x74' + chr(5591 - 5489) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x15\x9b\xc9s\xbd<\xfa\xa2\xa8\xd4ZR7\x9c'), chr(363 - 263) + chr(0b1100101) + chr(0b1011010 + 0o11) + chr(111) + '\x64' + chr(101))(chr(2376 - 2259) + '\x74' + chr(0b111110 + 0o50) + chr(0b101101) + '\x38'), [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001), 8), ehT0Px3KOsy9('\060' + chr(8607 - 8496) + '\063', 0b1000)])
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(0b1100100) + '\x65' + '\x63' + '\157' + chr(100) + chr(101))(chr(0b1110101) + '\x74' + chr(0b100011 + 0o103) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe\r\xb3\xec\xebb\x07\x1f\x82\xd0f'), chr(0b1100100) + chr(242 - 141) + '\x63' + '\x6f' + chr(100) + chr(101))('\165' + chr(12558 - 12442) + '\146' + '\055' + chr(1045 - 989)), ehT0Px3KOsy9(chr(214 - 166) + '\157' + chr(48), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(100) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\144' + chr(101))(chr(0b110101 + 0o100) + chr(13380 - 13264) + chr(3281 - 3179) + '\055' + chr(2387 - 2331)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xb0\r\xb9\xed\xd8[\x07\x03\x81\xd1M\xaf'\xf4\xa1\x92"), '\x64' + chr(0b10110 + 0o117) + chr(2646 - 2547) + '\157' + chr(100) + '\x65')('\165' + chr(0b1110100) + chr(0b1100110) + '\055' + chr(0b111000 + 0o0)), ehT0Px3KOsy9('\x30' + chr(0b10101 + 0o132) + chr(0b10111 + 0o31), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\x64' + '\145' + chr(99) + chr(0b1101111) + chr(3159 - 3059) + '\x65')(chr(0b11000 + 0o135) + chr(0b1101001 + 0o13) + chr(0b1100110) + chr(0b100110 + 0o7) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x02\x99\xccb'), chr(3307 - 3207) + chr(8595 - 8494) + '\x63' + '\x6f' + '\144' + chr(101))('\x75' + chr(0b1110100) + chr(4362 - 4260) + '\x2d' + chr(0b111000)), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + chr(0b1010010 + 0o22) + chr(8197 - 8096))('\165' + chr(0b1110100) + '\x66' + '\x2d' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x14\x9c\xc6}\xad0\xe7\x93\x93\xc3KR:'), chr(0b10011 + 0o121) + '\x65' + chr(0b111111 + 0o44) + chr(9299 - 9188) + '\144' + '\145')('\x75' + chr(3539 - 3423) + '\146' + chr(0b10 + 0o53) + chr(56)), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(0b110010), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(6182 - 6082) + '\x65' + chr(6479 - 6380) + '\157' + chr(100) + chr(4409 - 4308))(chr(3886 - 3769) + chr(0b1010 + 0o152) + chr(102) + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x14\x9c\xc6}\xad0\xe7\x93\x80\xcf_R:'), chr(0b1100100) + chr(0b11010 + 0o113) + '\143' + chr(0b1101111) + chr(100) + '\x65')('\x75' + '\x74' + chr(0b1000000 + 0o46) + '\055' + chr(0b101 + 0o63)), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(48) + '\x30' + chr(0b110000), ord("\x08")))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(9440 - 9340) + '\145' + chr(99) + chr(0b1101001 + 0o6) + chr(0b10100 + 0o120) + '\145')(chr(117) + '\x74' + '\x66' + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x15\x80\xcab\xa6 \xe1'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1011110 + 0o21) + '\x64' + chr(101))(chr(0b1110101) + '\x74' + chr(3662 - 3560) + chr(0b100101 + 0o10) + '\x38'), 0.0)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(3387 - 3287) + '\145' + chr(99) + chr(0b1000101 + 0o52) + chr(0b1000 + 0o134) + '\145')('\x75' + '\164' + chr(102) + '\055' + chr(0b1010 + 0o56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x01\x80\xc0M\xa6 \xe1\xbc\x82\xd2dE:\x8e\xa0(\xcb\x1c\xfd'), chr(6173 - 6073) + chr(101) + '\143' + '\157' + chr(100) + '\145')(chr(117) + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\070'), ehT0Px3KOsy9(chr(48) + chr(0b111000 + 0o67) + '\061' + chr(1107 - 1059) + '\060' + '\060', 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\x64' + '\145' + chr(5085 - 4986) + chr(0b1011000 + 0o27) + '\144' + chr(0b1010001 + 0o24))(chr(0b1110101) + chr(9415 - 9299) + '\x66' + chr(0b1011 + 0o42) + chr(466 - 410)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x10\x91\xd1{\xbf4\xe1\xa5\x98\xc8'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(101))(chr(0b1000010 + 0o63) + chr(10304 - 10188) + chr(0b11000 + 0o116) + '\055' + chr(2579 - 2523)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1\x07\xbb\xfc'), chr(0b100 + 0o140) + '\145' + chr(99) + '\x6f' + chr(0b11111 + 0o105) + chr(101))(chr(2741 - 2624) + chr(0b1110100) + chr(0b1100010 + 0o4) + chr(296 - 251) + '\x38'))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), '\144' + chr(3488 - 3387) + chr(0b1010 + 0o131) + '\x6f' + chr(0b11 + 0o141) + chr(101))(chr(0b1101100 + 0o11) + chr(116) + chr(102) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\x03\xa3\xec\xe9I1\x1f\x9d\xcca\xac'), chr(6300 - 6200) + '\145' + '\143' + chr(0b1101111 + 0o0) + chr(100) + '\x65')(chr(0b1100010 + 0o23) + chr(0b1010011 + 0o41) + '\146' + '\x2d' + chr(0b10101 + 0o43)), 0.0)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x06\xb3\xd6\xefM\x0f\x03\x93\xc8'), chr(0b1011100 + 0o10) + chr(0b1000100 + 0o41) + chr(99) + chr(111) + chr(0b1100100) + chr(0b11 + 0o142))(chr(117) + chr(116) + chr(9042 - 8940) + '\x2d' + chr(1719 - 1663)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3\x10\xb2\xfd\xf5\\\x07\x1f\xad\xd6f\xac%\xe6'), '\144' + '\x65' + chr(0b1100011) + '\157' + '\x64' + chr(0b1100101))('\x75' + chr(116) + '\146' + chr(45) + '\070'), -ehT0Px3KOsy9(chr(0b110000) + chr(6341 - 6230) + chr(586 - 537), 8))
n4ljua2gi1Pr.kXxsZxlIQUSQ = {xafqLlk3kkUe(SXOLrMavuUCe(b'\xba\x0c\xa7\xfc\xf3N'), chr(0b1100100) + chr(0b0 + 0o145) + '\x63' + chr(7377 - 7266) + '\x64' + '\x65')(chr(4409 - 4292) + chr(4381 - 4265) + chr(0b110000 + 0o66) + chr(45) + '\070'): PuPeNl0CuqOQ.video_raw_bottom, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7\x03\xa5\xee\xe2I\x1d'), chr(0b1001100 + 0o30) + chr(0b111011 + 0o52) + chr(99) + '\157' + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(102) + chr(45) + '\x38'): PuPeNl0CuqOQ.video_raw_targets_bottom}
n4ljua2gi1Pr.YpO0BcZ6fMsf = {xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7\x03\xa5\xee\xe2I\x1d'), chr(100) + chr(101) + '\x63' + chr(0b101000 + 0o107) + chr(0b1100100) + chr(101))(chr(0b1110 + 0o147) + '\x74' + '\146' + '\055' + '\070'): PuPeNl0CuqOQ.video_l1_raw_loss}
n4ljua2gi1Pr.qxrVBjeryNEZ = {xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7\x03\xa5\xee\xe2I\x1d'), chr(100) + '\145' + chr(99) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(0b111010 + 0o73) + '\164' + chr(102) + chr(45) + chr(56)): PuPeNl0CuqOQ.video_raw_top}
n4ljua2gi1Pr.jU0oiHwVidag = ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + chr(48) + '\060', 59654 - 59646)
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(1358 - 1310) + chr(0b1101111) + chr(2697 - 2645) + chr(48), 0b1000)
n4ljua2gi1Pr.w2YGKaT5EGFl = xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0\x0b\xb9\xee\xebX1\x12\x9d\xcbd'), '\x64' + '\145' + chr(99) + chr(0b1011110 + 0o21) + '\144' + '\x65')(chr(0b1110101) + chr(0b1001011 + 0o51) + '\146' + '\x2d' + chr(56))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/video/next_frame_glow.py
|
next_frame_glow_bair_quant
|
def next_frame_glow_bair_quant():
"""Hparams to reproduce bits-per-pixel results on BAIR action-free dataset."""
hparams = next_frame_glow_hparams()
hparams.video_num_input_frames = 3
hparams.video_num_target_frames = 10
hparams.num_train_frames = 4
hparams.num_cond_latents = 3
hparams.depth = 24
hparams.latent_dist_encoder = "conv3d_net"
hparams.latent_encoder_width = 256
hparams.latent_architecture = "glow_resnet"
hparams.latent_encoder_depth = 5
hparams.latent_apply_dilations = True
hparams.latent_activation = "gatu"
hparams.activation = "gatu"
hparams.learning_rate_constant = 3e-4
hparams.learning_rate_schedule = "constant*linear_warmup"
hparams.learning_rate_warmup_steps = 10000
hparams.init_batch_size = 128
hparams.batch_size = 5
return hparams
|
python
|
def next_frame_glow_bair_quant():
"""Hparams to reproduce bits-per-pixel results on BAIR action-free dataset."""
hparams = next_frame_glow_hparams()
hparams.video_num_input_frames = 3
hparams.video_num_target_frames = 10
hparams.num_train_frames = 4
hparams.num_cond_latents = 3
hparams.depth = 24
hparams.latent_dist_encoder = "conv3d_net"
hparams.latent_encoder_width = 256
hparams.latent_architecture = "glow_resnet"
hparams.latent_encoder_depth = 5
hparams.latent_apply_dilations = True
hparams.latent_activation = "gatu"
hparams.activation = "gatu"
hparams.learning_rate_constant = 3e-4
hparams.learning_rate_schedule = "constant*linear_warmup"
hparams.learning_rate_warmup_steps = 10000
hparams.init_batch_size = 128
hparams.batch_size = 5
return hparams
|
[
"def",
"next_frame_glow_bair_quant",
"(",
")",
":",
"hparams",
"=",
"next_frame_glow_hparams",
"(",
")",
"hparams",
".",
"video_num_input_frames",
"=",
"3",
"hparams",
".",
"video_num_target_frames",
"=",
"10",
"hparams",
".",
"num_train_frames",
"=",
"4",
"hparams",
".",
"num_cond_latents",
"=",
"3",
"hparams",
".",
"depth",
"=",
"24",
"hparams",
".",
"latent_dist_encoder",
"=",
"\"conv3d_net\"",
"hparams",
".",
"latent_encoder_width",
"=",
"256",
"hparams",
".",
"latent_architecture",
"=",
"\"glow_resnet\"",
"hparams",
".",
"latent_encoder_depth",
"=",
"5",
"hparams",
".",
"latent_apply_dilations",
"=",
"True",
"hparams",
".",
"latent_activation",
"=",
"\"gatu\"",
"hparams",
".",
"activation",
"=",
"\"gatu\"",
"hparams",
".",
"learning_rate_constant",
"=",
"3e-4",
"hparams",
".",
"learning_rate_schedule",
"=",
"\"constant*linear_warmup\"",
"hparams",
".",
"learning_rate_warmup_steps",
"=",
"10000",
"hparams",
".",
"init_batch_size",
"=",
"128",
"hparams",
".",
"batch_size",
"=",
"5",
"return",
"hparams"
] |
Hparams to reproduce bits-per-pixel results on BAIR action-free dataset.
|
[
"Hparams",
"to",
"reproduce",
"bits",
"-",
"per",
"-",
"pixel",
"results",
"on",
"BAIR",
"action",
"-",
"free",
"dataset",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/next_frame_glow.py#L91-L111
|
train
|
Hparams to reproduce bits - per - pixel results on BAIR action - free dataset.
|
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('\x30' + '\x6f' + chr(0b100010 + 0o21) + chr(0b110001) + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100101 + 0o14), 56325 - 56317), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(0b110000 + 0o2) + '\x31' + chr(0b1111 + 0o47), 5487 - 5479), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(556 - 507) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(818 - 770) + '\157' + chr(1388 - 1339) + '\066' + chr(0b101100 + 0o12), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + chr(0b10000 + 0o41) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b101111 + 0o1) + chr(0b10110 + 0o34), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(0b1001 + 0o55), 0o10), ehT0Px3KOsy9(chr(48) + chr(9992 - 9881) + chr(0b11100 + 0o26) + chr(51) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(977 - 929) + chr(0b110010 + 0o75) + chr(50) + chr(53) + chr(1338 - 1284), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\061' + chr(2052 - 1998), 17726 - 17718), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b110001) + chr(0b1 + 0o66), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b111010 + 0o65) + chr(49) + '\x30' + chr(443 - 391), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(51) + '\065' + chr(404 - 351), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x34' + chr(0b110110 + 0o1), 9486 - 9478), ehT0Px3KOsy9('\x30' + chr(111) + '\x36' + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\060' + chr(2095 - 2047), 0b1000), ehT0Px3KOsy9(chr(1095 - 1047) + chr(0b1101111) + chr(1441 - 1389) + '\x33', 8), ehT0Px3KOsy9(chr(0b110000) + chr(8311 - 8200) + chr(50) + chr(50) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x31' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(786 - 738) + '\157' + chr(0b101001 + 0o15) + chr(375 - 324), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110111 + 0o70) + chr(487 - 438) + chr(0b110101) + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11111 + 0o23) + chr(1644 - 1596) + chr(1888 - 1833), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(147 - 96) + '\x37' + chr(0b10100 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(512 - 462) + chr(1930 - 1878) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(3412 - 3301) + '\x31' + chr(52) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b1100 + 0o53) + chr(1351 - 1303), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10001 + 0o40) + chr(1382 - 1328) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\061' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(11313 - 11202) + chr(1580 - 1530) + chr(0b110100) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(0b10101 + 0o37) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x37' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(820 - 772) + chr(0b1101111 + 0o0) + chr(0b11101 + 0o24) + '\x33' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101100 + 0o103) + chr(0b110010) + chr(54) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(51) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b110111) + chr(236 - 187), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\x34' + chr(0b100001 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b10111 + 0o33) + chr(1322 - 1272), 18191 - 18183)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(53) + chr(1220 - 1172), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0'), chr(100) + chr(0b1001111 + 0o26) + chr(99) + chr(0b101 + 0o152) + chr(0b1011000 + 0o14) + chr(0b1100101))(chr(117) + chr(0b1110011 + 0o1) + chr(0b1011011 + 0o13) + '\x2d' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def k0JRqHet3dYv():
n4ljua2gi1Pr = hwPy7BHnnW87()
n4ljua2gi1Pr.UUXW9NWPZxPI = ehT0Px3KOsy9('\x30' + chr(111) + '\x33', ord("\x08"))
n4ljua2gi1Pr.UxYiT0ZFW2SZ = ehT0Px3KOsy9('\060' + chr(2214 - 2103) + chr(0b110001) + chr(0b101111 + 0o3), 0o10)
n4ljua2gi1Pr.Dy3_G3jLqKrZ = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\064', 0o10)
n4ljua2gi1Pr.sTkqE2xXh8q0 = ehT0Px3KOsy9(chr(48) + chr(111) + chr(1352 - 1301), 8)
n4ljua2gi1Pr.UEys4_lSwsID = ehT0Px3KOsy9(chr(1866 - 1818) + '\x6f' + chr(51) + '\060', 43110 - 43102)
n4ljua2gi1Pr.zwL8VoHC5z8O = xafqLlk3kkUe(SXOLrMavuUCe(b'\xadn\xe0:Ei\x1dp\xfb\xda'), '\144' + '\x65' + '\x63' + '\x6f' + chr(8880 - 8780) + chr(101))(chr(117) + '\164' + chr(0b1100110) + chr(0b101101 + 0o0) + chr(56))
n4ljua2gi1Pr.WUazk97Mc99k = ehT0Px3KOsy9(chr(1556 - 1508) + chr(235 - 124) + chr(52) + '\060' + chr(0b110000), 61203 - 61195)
n4ljua2gi1Pr.Y_ORWNJ1Xdt5 = xafqLlk3kkUe(SXOLrMavuUCe(b"\xa9m\xe1;)\x7f'm\xf0\xcb:"), '\x64' + chr(0b100010 + 0o103) + chr(3302 - 3203) + chr(7741 - 7630) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(7573 - 7457) + chr(102) + '\055' + '\x38')
n4ljua2gi1Pr.H3YDDM3YosUY = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101), 0o10)
n4ljua2gi1Pr.ygiByXyIEpcq = ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(1214 - 1165), 8)
n4ljua2gi1Pr.PfCBAhmJ92WB = xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9`\xfa9'), chr(9397 - 9297) + chr(0b1010000 + 0o25) + chr(0b101111 + 0o64) + chr(0b1011100 + 0o23) + chr(0b1100100) + chr(101))(chr(0b1 + 0o164) + chr(0b1110100) + chr(0b1000100 + 0o42) + '\055' + '\x38')
n4ljua2gi1Pr._GyOifGFZyk1 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9`\xfa9'), chr(100) + chr(0b1100101) + chr(99) + '\157' + chr(100) + '\x65')(chr(0b101111 + 0o106) + chr(116) + '\x66' + '\055' + '\x38')
n4ljua2gi1Pr.Ot9HUjnkxXA_ = 0.0003
n4ljua2gi1Pr.Lz_s7neUzM5V = xafqLlk3kkUe(SXOLrMavuUCe(b"\xadn\xe0?\x02l,j\xb4\xc2'\xe1!B\x9f8F!Q\xf9\xbfC"), chr(0b10110 + 0o116) + chr(0b1001000 + 0o35) + chr(99) + chr(0b1110 + 0o141) + '\x64' + '\145')('\x75' + chr(0b1101001 + 0o13) + chr(0b101000 + 0o76) + chr(0b111 + 0o46) + chr(1469 - 1413))
n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9('\060' + '\x6f' + chr(1619 - 1569) + chr(51) + chr(0b110100) + '\x32' + chr(48), 21923 - 21915)
n4ljua2gi1Pr.jU0oiHwVidag = ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b101011 + 0o7) + chr(48) + chr(48), 59740 - 59732)
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(652 - 599), 8)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/video/next_frame_glow.py
|
next_frame_glow_bair_qual
|
def next_frame_glow_bair_qual():
"""Hparams for qualitative video generation results."""
hparams = next_frame_glow_bair_quant()
hparams.coupling = "additive"
hparams.temperature = 0.5
hparams.coupling_width = 392
return hparams
|
python
|
def next_frame_glow_bair_qual():
"""Hparams for qualitative video generation results."""
hparams = next_frame_glow_bair_quant()
hparams.coupling = "additive"
hparams.temperature = 0.5
hparams.coupling_width = 392
return hparams
|
[
"def",
"next_frame_glow_bair_qual",
"(",
")",
":",
"hparams",
"=",
"next_frame_glow_bair_quant",
"(",
")",
"hparams",
".",
"coupling",
"=",
"\"additive\"",
"hparams",
".",
"temperature",
"=",
"0.5",
"hparams",
".",
"coupling_width",
"=",
"392",
"return",
"hparams"
] |
Hparams for qualitative video generation results.
|
[
"Hparams",
"for",
"qualitative",
"video",
"generation",
"results",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/next_frame_glow.py#L115-L121
|
train
|
Hparams for qualitative video generation results.
|
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('\060' + '\157' + '\x31' + '\x32' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(12216 - 12105) + chr(49) + chr(354 - 305) + chr(0b110110 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\x36' + '\062', 58966 - 58958), ehT0Px3KOsy9('\060' + chr(6164 - 6053) + '\063' + '\066' + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(1594 - 1543) + chr(0b101001 + 0o7), 113 - 105), ehT0Px3KOsy9('\x30' + chr(6169 - 6058) + chr(572 - 523) + chr(0b10101 + 0o33) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(50) + '\061' + chr(0b10110 + 0o32), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101001 + 0o10) + '\x35' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4068 - 3957) + chr(0b110110) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(1705 - 1594) + chr(0b110001) + chr(903 - 850) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\x33' + chr(1911 - 1863), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\x35' + chr(0b101100 + 0o7), 0b1000), ehT0Px3KOsy9(chr(684 - 636) + chr(0b1101111) + chr(0b110000 + 0o1) + '\x33' + '\x35', 0b1000), ehT0Px3KOsy9(chr(2071 - 2023) + chr(6405 - 6294) + '\x33' + chr(0b110000) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9459 - 9348) + '\x32' + '\x30' + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\067' + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100101 + 0o16) + chr(0b110011) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(9006 - 8895) + chr(55) + chr(0b1100 + 0o51), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b110100) + '\x35', 0b1000), ehT0Px3KOsy9(chr(1051 - 1003) + '\157' + '\067' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(1997 - 1947) + '\066' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(7680 - 7569) + '\x35' + '\x30', 21602 - 21594), ehT0Px3KOsy9(chr(947 - 899) + chr(111) + chr(0b110001) + '\x32' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(12025 - 11914) + '\063' + '\x31' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\066' + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + '\x33' + '\x34' + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(50 - 2) + '\157' + '\066' + chr(2123 - 2072), 0o10), ehT0Px3KOsy9(chr(48) + chr(5810 - 5699) + '\x31' + chr(0b110000) + chr(0b100101 + 0o21), 31763 - 31755), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(50) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2051 - 2002) + '\061' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1000 - 950) + chr(579 - 531) + chr(53), 38141 - 38133), ehT0Px3KOsy9(chr(48) + '\157' + chr(3025 - 2970) + chr(202 - 150), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(0b110001) + '\061' + chr(0b110100), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b110 + 0o54) + chr(51), 0o10), ehT0Px3KOsy9(chr(1528 - 1480) + '\157' + chr(49) + '\x30' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(0b110011) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(0b110010 + 0o5), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1100100 + 0o13) + '\x35' + chr(1238 - 1190), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'}'), chr(100) + chr(2399 - 2298) + chr(0b10101 + 0o116) + chr(12306 - 12195) + chr(0b1100100) + chr(0b1100101))('\165' + chr(0b1010010 + 0o42) + chr(0b1100110) + chr(45) + chr(486 - 430)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def larqsYAAkhiy():
n4ljua2gi1Pr = k0JRqHet3dYv()
n4ljua2gi1Pr.xNyaFMheRVYu = xafqLlk3kkUe(SXOLrMavuUCe(b'2+\x96\x9b,)\xfe\x0b'), chr(0b1100100) + chr(9076 - 8975) + chr(0b1100011) + chr(7692 - 7581) + chr(0b1100100) + '\145')(chr(9300 - 9183) + chr(0b1110100) + chr(0b1100 + 0o132) + chr(0b101101) + '\070')
n4ljua2gi1Pr.uICaXvjWrxGa = 0.5
n4ljua2gi1Pr.MdLD578dcVmq = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + '\066' + chr(1470 - 1421) + chr(48), 0o10)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/video/next_frame_glow.py
|
next_frame_glow_shapes
|
def next_frame_glow_shapes():
"""Hparams for qualitative and quantitative results on shapes dataset."""
hparams = next_frame_glow_bair_quant()
hparams.video_num_input_frames = 1
hparams.video_num_target_frames = 2
hparams.num_train_frames = 2
hparams.num_cond_latents = 1
hparams.coupling = "additive"
hparams.coupling_width = 512
hparams.latent_encoder_depth = 10
hparams.latent_skip = False
hparams.learning_rate_constant = 1e-4
hparams.batch_size = 10
return hparams
|
python
|
def next_frame_glow_shapes():
"""Hparams for qualitative and quantitative results on shapes dataset."""
hparams = next_frame_glow_bair_quant()
hparams.video_num_input_frames = 1
hparams.video_num_target_frames = 2
hparams.num_train_frames = 2
hparams.num_cond_latents = 1
hparams.coupling = "additive"
hparams.coupling_width = 512
hparams.latent_encoder_depth = 10
hparams.latent_skip = False
hparams.learning_rate_constant = 1e-4
hparams.batch_size = 10
return hparams
|
[
"def",
"next_frame_glow_shapes",
"(",
")",
":",
"hparams",
"=",
"next_frame_glow_bair_quant",
"(",
")",
"hparams",
".",
"video_num_input_frames",
"=",
"1",
"hparams",
".",
"video_num_target_frames",
"=",
"2",
"hparams",
".",
"num_train_frames",
"=",
"2",
"hparams",
".",
"num_cond_latents",
"=",
"1",
"hparams",
".",
"coupling",
"=",
"\"additive\"",
"hparams",
".",
"coupling_width",
"=",
"512",
"hparams",
".",
"latent_encoder_depth",
"=",
"10",
"hparams",
".",
"latent_skip",
"=",
"False",
"hparams",
".",
"learning_rate_constant",
"=",
"1e-4",
"hparams",
".",
"batch_size",
"=",
"10",
"return",
"hparams"
] |
Hparams for qualitative and quantitative results on shapes dataset.
|
[
"Hparams",
"for",
"qualitative",
"and",
"quantitative",
"results",
"on",
"shapes",
"dataset",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/next_frame_glow.py#L125-L138
|
train
|
Hparams for qualitative and quantitative results on shapes dataset.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,Z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=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) + '\157' + '\062' + chr(0b100100 + 0o23) + chr(53), 45630 - 45622), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(0b110011) + '\062' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(573 - 525) + '\x6f' + chr(1328 - 1277) + chr(0b110100) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + '\x32' + '\065' + '\x35', 26993 - 26985), ehT0Px3KOsy9(chr(1927 - 1879) + '\157' + chr(0b11101 + 0o25) + chr(0b110101) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1009 - 898) + chr(360 - 306) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(0b110001) + chr(1016 - 968) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(1990 - 1879) + chr(0b110001) + chr(54) + '\063', 304 - 296), ehT0Px3KOsy9(chr(517 - 469) + chr(0b1101111) + chr(2304 - 2254) + '\x33' + chr(0b110000), 53066 - 53058), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\060' + chr(0b10000 + 0o46), 17932 - 17924), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2220 - 2171) + chr(0b11101 + 0o23) + chr(114 - 64), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(136 - 84) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000011 + 0o54) + chr(1367 - 1317) + chr(0b100100 + 0o17) + chr(0b110000), 8), ehT0Px3KOsy9(chr(1617 - 1569) + chr(11757 - 11646) + chr(51) + chr(51), 40419 - 40411), ehT0Px3KOsy9('\x30' + '\157' + chr(226 - 176) + chr(1890 - 1836) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\066' + chr(0b10100 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(1264 - 1209) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(1770 - 1722) + '\x6f' + chr(0b101001 + 0o10) + '\062', 16197 - 16189), ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + chr(0b100010 + 0o20) + '\063' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(9391 - 9280) + chr(0b110001) + chr(885 - 837) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1242 - 1194) + chr(7350 - 7239) + chr(0b11 + 0o60) + chr(1608 - 1555) + chr(2083 - 2029), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b10101 + 0o41) + chr(1051 - 1001), 18354 - 18346), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\062' + chr(1205 - 1156) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(112 - 61), ord("\x08")), ehT0Px3KOsy9(chr(2043 - 1995) + '\x6f' + chr(2176 - 2126) + chr(0b110101) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(0b110110) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(0b110010) + chr(1627 - 1579) + chr(0b1010 + 0o47), 45789 - 45781), ehT0Px3KOsy9(chr(322 - 274) + chr(111) + chr(0b110010) + chr(960 - 911) + chr(2936 - 2881), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b110001 + 0o1) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\062' + '\x37', 0b1000), ehT0Px3KOsy9(chr(1736 - 1688) + '\x6f' + chr(72 - 23) + chr(2324 - 2275) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b10001 + 0o136) + chr(51) + chr(0b10100 + 0o34) + chr(2275 - 2227), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + '\x32' + chr(1226 - 1178) + chr(843 - 791), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\066' + '\064', 40818 - 40810), ehT0Px3KOsy9(chr(1341 - 1293) + chr(0b1101111) + chr(49) + chr(0b11 + 0o57), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1100 + 0o45) + chr(54) + chr(1202 - 1147), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(250 - 199) + chr(0b10101 + 0o35) + chr(48), 0o10), ehT0Px3KOsy9(chr(1247 - 1199) + chr(0b1101111) + '\066' + chr(0b110110), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(105 - 57) + chr(0b100111 + 0o110) + '\065' + chr(0b1 + 0o57), 55500 - 55492)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x93'), chr(1331 - 1231) + chr(7308 - 7207) + chr(4840 - 4741) + chr(6951 - 6840) + chr(6626 - 6526) + '\145')(chr(0b1110101) + chr(0b10111 + 0o135) + '\146' + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Ald0Pk63cZCk():
n4ljua2gi1Pr = k0JRqHet3dYv()
n4ljua2gi1Pr.UUXW9NWPZxPI = ehT0Px3KOsy9(chr(694 - 646) + chr(0b1101111) + chr(0b110001), ord("\x08"))
n4ljua2gi1Pr.UxYiT0ZFW2SZ = ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b100111 + 0o110) + chr(0b11010 + 0o30), 0o10)
n4ljua2gi1Pr.Dy3_G3jLqKrZ = ehT0Px3KOsy9(chr(0b110000) + chr(0b101 + 0o152) + '\062', 8)
n4ljua2gi1Pr.sTkqE2xXh8q0 = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31', 8)
n4ljua2gi1Pr.xNyaFMheRVYu = xafqLlk3kkUe(SXOLrMavuUCe(b'\xdc\xb3\x86\xc4\xda]b%'), chr(100) + '\145' + '\x63' + chr(0b1001011 + 0o44) + chr(0b1100100) + chr(0b1100101))('\165' + chr(116) + '\x66' + chr(0b100011 + 0o12) + chr(1683 - 1627))
n4ljua2gi1Pr.MdLD578dcVmq = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101000 + 0o11) + '\x30' + chr(0b101 + 0o53) + chr(48), ord("\x08"))
n4ljua2gi1Pr.H3YDDM3YosUY = ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101011 + 0o6) + '\062', 8)
n4ljua2gi1Pr.KMmaaY1GTSij = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000), 0b1000)
n4ljua2gi1Pr.Ot9HUjnkxXA_ = 0.0001
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100 + 0o55) + chr(50), 8)
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/video/next_frame_glow.py
|
get_cond_latents
|
def get_cond_latents(all_latents=None, hparams=None):
"""Get z^{cond}_{t} given z^{1..t-1}.
Args:
all_latents: list of list of tensors,
outer-size equals no.of time_steps-1
inner-size equals hparams.n_levels.
hparams: See next_frame_glow_hparams.
Returns:
cond_latents: conditional latents at time-step t.
"""
cond_latents = None
if hparams.gen_mode == "conditional":
if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]:
num_cond_latents = (hparams.num_cond_latents +
int(hparams.cond_first_frame))
if len(all_latents) >= num_cond_latents:
cond_latents = all_latents[-hparams.num_cond_latents:]
if hparams.cond_first_frame:
cond_latents = [all_latents[0]] + cond_latents
elif hparams.latent_dist_encoder in ["pointwise", "conv_lstm"]:
if all_latents:
cond_latents = all_latents[-1]
if hparams.gen_mode == "conditional":
global_step = tf.train.get_or_create_global_step()
condition = tf.greater(global_step, hparams.pretrain_steps)
else:
condition = tf.constant(False, dtype=tf.bool)
return condition, cond_latents
|
python
|
def get_cond_latents(all_latents=None, hparams=None):
"""Get z^{cond}_{t} given z^{1..t-1}.
Args:
all_latents: list of list of tensors,
outer-size equals no.of time_steps-1
inner-size equals hparams.n_levels.
hparams: See next_frame_glow_hparams.
Returns:
cond_latents: conditional latents at time-step t.
"""
cond_latents = None
if hparams.gen_mode == "conditional":
if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]:
num_cond_latents = (hparams.num_cond_latents +
int(hparams.cond_first_frame))
if len(all_latents) >= num_cond_latents:
cond_latents = all_latents[-hparams.num_cond_latents:]
if hparams.cond_first_frame:
cond_latents = [all_latents[0]] + cond_latents
elif hparams.latent_dist_encoder in ["pointwise", "conv_lstm"]:
if all_latents:
cond_latents = all_latents[-1]
if hparams.gen_mode == "conditional":
global_step = tf.train.get_or_create_global_step()
condition = tf.greater(global_step, hparams.pretrain_steps)
else:
condition = tf.constant(False, dtype=tf.bool)
return condition, cond_latents
|
[
"def",
"get_cond_latents",
"(",
"all_latents",
"=",
"None",
",",
"hparams",
"=",
"None",
")",
":",
"cond_latents",
"=",
"None",
"if",
"hparams",
".",
"gen_mode",
"==",
"\"conditional\"",
":",
"if",
"hparams",
".",
"latent_dist_encoder",
"in",
"[",
"\"conv_net\"",
",",
"\"conv3d_net\"",
"]",
":",
"num_cond_latents",
"=",
"(",
"hparams",
".",
"num_cond_latents",
"+",
"int",
"(",
"hparams",
".",
"cond_first_frame",
")",
")",
"if",
"len",
"(",
"all_latents",
")",
">=",
"num_cond_latents",
":",
"cond_latents",
"=",
"all_latents",
"[",
"-",
"hparams",
".",
"num_cond_latents",
":",
"]",
"if",
"hparams",
".",
"cond_first_frame",
":",
"cond_latents",
"=",
"[",
"all_latents",
"[",
"0",
"]",
"]",
"+",
"cond_latents",
"elif",
"hparams",
".",
"latent_dist_encoder",
"in",
"[",
"\"pointwise\"",
",",
"\"conv_lstm\"",
"]",
":",
"if",
"all_latents",
":",
"cond_latents",
"=",
"all_latents",
"[",
"-",
"1",
"]",
"if",
"hparams",
".",
"gen_mode",
"==",
"\"conditional\"",
":",
"global_step",
"=",
"tf",
".",
"train",
".",
"get_or_create_global_step",
"(",
")",
"condition",
"=",
"tf",
".",
"greater",
"(",
"global_step",
",",
"hparams",
".",
"pretrain_steps",
")",
"else",
":",
"condition",
"=",
"tf",
".",
"constant",
"(",
"False",
",",
"dtype",
"=",
"tf",
".",
"bool",
")",
"return",
"condition",
",",
"cond_latents"
] |
Get z^{cond}_{t} given z^{1..t-1}.
Args:
all_latents: list of list of tensors,
outer-size equals no.of time_steps-1
inner-size equals hparams.n_levels.
hparams: See next_frame_glow_hparams.
Returns:
cond_latents: conditional latents at time-step t.
|
[
"Get",
"z^",
"{",
"cond",
"}",
"_",
"{",
"t",
"}",
"given",
"z^",
"{",
"1",
"..",
"t",
"-",
"1",
"}",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/next_frame_glow.py#L150-L179
|
train
|
Get conditional latents given z^1.. t - 1.
|
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,jIl9q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OH72k,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(711 - 663) + '\x6f' + chr(0b110010) + '\x35' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1000010 + 0o55) + chr(50) + '\x35' + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1558 - 1507) + chr(831 - 783), 45268 - 45260), ehT0Px3KOsy9(chr(48) + chr(8196 - 8085) + chr(0b10110 + 0o35) + chr(0b110001) + '\065', 5110 - 5102), ehT0Px3KOsy9(chr(603 - 555) + chr(0b1101111) + chr(248 - 199) + '\x32' + chr(443 - 393), 9109 - 9101), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(0b110001) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x37' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010 + 0o0) + chr(0b100001 + 0o17) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1045 - 997) + chr(111) + chr(51) + chr(0b110111) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(6124 - 6013) + '\x32' + '\060' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + '\062' + chr(0b10011 + 0o43) + chr(0b1011 + 0o45), 17569 - 17561), ehT0Px3KOsy9(chr(933 - 885) + '\157' + chr(0b110001) + '\x37' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(56 - 8) + chr(0b1101111) + '\062' + chr(459 - 404) + chr(0b101101 + 0o10), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + '\x31' + chr(0b100 + 0o60) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b100110 + 0o12) + chr(0b11010 + 0o30), 0o10), ehT0Px3KOsy9('\x30' + chr(905 - 794) + chr(0b11010 + 0o31), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1202 - 1152) + '\061' + chr(50), 64021 - 64013), ehT0Px3KOsy9(chr(413 - 365) + chr(0b101010 + 0o105) + chr(0b110010) + chr(0b10101 + 0o42) + '\x32', 45058 - 45050), ehT0Px3KOsy9('\x30' + '\157' + chr(2137 - 2083) + chr(0b11100 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(911 - 863) + '\x6f' + chr(0b110 + 0o54) + chr(0b110100 + 0o1) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(10228 - 10117) + '\062' + chr(52), 24160 - 24152), ehT0Px3KOsy9('\060' + chr(1103 - 992) + chr(0b110001) + chr(0b100010 + 0o25) + chr(0b111 + 0o53), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100011 + 0o23) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(0b110001) + chr(0b1100 + 0o47) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1771 - 1723) + chr(7693 - 7582) + chr(0b10100 + 0o36) + chr(500 - 445) + chr(0b1110 + 0o43), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\x33' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(0b110010) + chr(55) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1020 - 972) + chr(0b1101111) + '\065' + chr(0b10010 + 0o44), ord("\x08")), ehT0Px3KOsy9('\060' + chr(6623 - 6512) + '\x31' + chr(49) + chr(0b110010 + 0o4), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + chr(259 - 209) + chr(0b0 + 0o67) + '\067', 5095 - 5087), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + '\061' + chr(0b110010) + '\065', 0b1000), ehT0Px3KOsy9(chr(896 - 848) + chr(111) + '\061' + chr(0b1100 + 0o46) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100101 + 0o12) + chr(51) + chr(52), 55673 - 55665), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(1467 - 1412) + chr(1770 - 1722), 0o10), ehT0Px3KOsy9(chr(294 - 246) + chr(5297 - 5186) + '\062' + chr(0b110000) + chr(0b11001 + 0o33), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + chr(0b110010) + chr(49) + '\060', 58852 - 58844), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1207 - 1158) + '\x30' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(51) + '\063' + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b1111 + 0o41) + chr(1207 - 1158), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x84'), chr(100) + chr(2051 - 1950) + chr(99) + chr(111) + '\x64' + '\x65')(chr(0b1110101) + chr(116) + '\146' + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def U4ZTe3c3F7Dt(EAmjp5vnsBda=None, n4ljua2gi1Pr=None):
EJNyt2wVt1N7 = None
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\x98n\x87!{D\xd1\x8c\xb3\xd1?'), chr(100) + chr(101) + chr(0b101 + 0o136) + chr(9395 - 9284) + chr(8149 - 8049) + chr(101))('\165' + '\164' + '\146' + '\055' + '\x38')) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xc2v\xa9;8\x15\xee\x93\xe7\xdc'), '\144' + chr(0b1100101) + chr(0b111011 + 0o50) + chr(111) + chr(5532 - 5432) + '\145')('\x75' + '\x74' + chr(3569 - 3467) + chr(0b101101) + chr(0b111000)):
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\xdaT\xf5\x04#4\xc2\xc8\xfc\x885'), '\144' + '\x65' + '\143' + '\157' + '\144' + chr(0b1011000 + 0o15))('\165' + chr(0b1110100) + '\146' + chr(0b101101) + chr(56))) in [xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xc2v\xbb\r"\x19\xf5'), chr(100) + chr(101) + '\143' + chr(111) + chr(0b1100100) + '\145')('\165' + '\x74' + '\146' + chr(45) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xc2v\xbba(#\xef\x98\xf2'), chr(7701 - 7601) + '\x65' + chr(99) + '\157' + chr(0b1010 + 0o132) + '\145')(chr(0b1110101) + '\x74' + '\x66' + chr(0b101101) + '\070')]:
sTkqE2xXh8q0 = n4ljua2gi1Pr.sTkqE2xXh8q0 + ehT0Px3KOsy9(n4ljua2gi1Pr.cond_first_frame)
if c2A0yzQpDQB3(EAmjp5vnsBda) >= sTkqE2xXh8q0:
EJNyt2wVt1N7 = EAmjp5vnsBda[-n4ljua2gi1Pr.sTkqE2xXh8q0:]
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xc2v\xa9\r*\x15\xf3\x8e\xf2\xef\x1c\xcf\x01/f'), '\x64' + '\x65' + chr(99) + '\157' + '\x64' + '\145')('\165' + '\164' + chr(102) + '\055' + chr(124 - 68))):
EJNyt2wVt1N7 = [EAmjp5vnsBda[ehT0Px3KOsy9('\x30' + '\x6f' + '\060', 18667 - 18659)]] + EJNyt2wVt1N7
elif xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\xdaT\xf5\x04#4\xc2\xc8\xfc\x885'), '\144' + chr(101) + '\x63' + chr(4914 - 4803) + chr(0b1100100) + chr(0b1100101))(chr(0b1 + 0o164) + '\x74' + '\x66' + chr(187 - 142) + chr(1988 - 1932))) in [xafqLlk3kkUe(SXOLrMavuUCe(b'\xda\xc2q\xa3&;\x15\xf2\x98'), '\x64' + chr(8217 - 8116) + chr(2250 - 2151) + '\157' + chr(3030 - 2930) + '\x65')(chr(0b110100 + 0o101) + '\164' + chr(0b1110 + 0o130) + chr(45) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xc2v\xbb\r \x0f\xf5\x90'), chr(0b1000011 + 0o41) + chr(0b1100101) + chr(1916 - 1817) + '\x6f' + chr(0b1 + 0o143) + '\145')(chr(0b1110101) + chr(0b1100110 + 0o16) + '\146' + chr(1774 - 1729) + '\070')]:
if EAmjp5vnsBda:
EJNyt2wVt1N7 = EAmjp5vnsBda[-ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061', 42018 - 42010)]
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\x98n\x87!{D\xd1\x8c\xb3\xd1?'), '\144' + chr(0b1100101) + chr(1001 - 902) + '\157' + chr(3811 - 3711) + chr(101))(chr(117) + '\x74' + chr(0b1000111 + 0o37) + chr(434 - 389) + chr(0b111000))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xc2v\xa9;8\x15\xee\x93\xe7\xdc'), '\x64' + '\145' + chr(2512 - 2413) + '\157' + chr(100) + chr(0b1100101))(chr(117) + chr(8712 - 8596) + chr(102) + chr(0b1000 + 0o45) + chr(63 - 7)):
tnqEWmPx71Oj = IDJ2eXGCBCDu.train.get_or_create_global_step()
z3jGhw6b9vwa = IDJ2eXGCBCDu.greater(tnqEWmPx71Oj, n4ljua2gi1Pr.pretrain_steps)
else:
z3jGhw6b9vwa = IDJ2eXGCBCDu.constant(ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 8), dtype=IDJ2eXGCBCDu.bool)
return (z3jGhw6b9vwa, EJNyt2wVt1N7)
|
tensorflow/tensor2tensor
|
tensor2tensor/models/basic.py
|
basic_fc_small
|
def basic_fc_small():
"""Small fully connected model."""
hparams = common_hparams.basic_params1()
hparams.learning_rate = 0.1
hparams.batch_size = 128
hparams.hidden_size = 256
hparams.num_hidden_layers = 2
hparams.initializer = "uniform_unit_scaling"
hparams.initializer_gain = 1.0
hparams.weight_decay = 0.0
hparams.dropout = 0.0
return hparams
|
python
|
def basic_fc_small():
"""Small fully connected model."""
hparams = common_hparams.basic_params1()
hparams.learning_rate = 0.1
hparams.batch_size = 128
hparams.hidden_size = 256
hparams.num_hidden_layers = 2
hparams.initializer = "uniform_unit_scaling"
hparams.initializer_gain = 1.0
hparams.weight_decay = 0.0
hparams.dropout = 0.0
return hparams
|
[
"def",
"basic_fc_small",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"hparams",
".",
"learning_rate",
"=",
"0.1",
"hparams",
".",
"batch_size",
"=",
"128",
"hparams",
".",
"hidden_size",
"=",
"256",
"hparams",
".",
"num_hidden_layers",
"=",
"2",
"hparams",
".",
"initializer",
"=",
"\"uniform_unit_scaling\"",
"hparams",
".",
"initializer_gain",
"=",
"1.0",
"hparams",
".",
"weight_decay",
"=",
"0.0",
"hparams",
".",
"dropout",
"=",
"0.0",
"return",
"hparams"
] |
Small fully connected model.
|
[
"Small",
"fully",
"connected",
"model",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/basic.py#L47-L58
|
train
|
Small fully connected model.
|
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,hr2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riMOClNT,_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' + chr(50) + chr(2811 - 2756) + chr(2448 - 2398), 0o10), ehT0Px3KOsy9('\060' + chr(8558 - 8447) + chr(0b100 + 0o56) + chr(52), 53655 - 53647), ehT0Px3KOsy9('\x30' + '\157' + '\x36' + chr(0b110110), 41128 - 41120), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(49) + chr(0b110000) + chr(0b10100 + 0o36), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11010 + 0o31) + '\x32' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9455 - 9344) + '\062' + chr(0b1 + 0o66) + '\x32', 8), ehT0Px3KOsy9(chr(1376 - 1328) + '\x6f' + chr(0b1100 + 0o45) + chr(48) + '\x30', 45686 - 45678), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\x31' + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + '\063' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b1000 + 0o53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\065' + chr(1148 - 1093), 30063 - 30055), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(2191 - 2141) + chr(1176 - 1124), 47842 - 47834), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11634 - 11523) + chr(51) + '\062' + '\x35', 30303 - 30295), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + '\061' + '\060' + '\x33', 3571 - 3563), ehT0Px3KOsy9(chr(494 - 446) + '\x6f' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(48) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b100100 + 0o15) + chr(54), 46466 - 46458), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(51), 8), ehT0Px3KOsy9('\x30' + chr(11765 - 11654) + '\062' + '\x31' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100100 + 0o113) + '\x32' + '\x31' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100100 + 0o113) + '\x31' + chr(0b0 + 0o60) + chr(0b1100 + 0o45), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + chr(50) + chr(1270 - 1221) + chr(0b10 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(2056 - 2006) + '\065', 47261 - 47253), ehT0Px3KOsy9(chr(48) + '\157' + chr(263 - 212) + chr(0b111 + 0o53) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(638 - 527) + chr(0b110101) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(0b110010) + chr(0b101000 + 0o17), 49695 - 49687), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(878 - 823), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b100 + 0o153) + chr(50) + chr(0b10100 + 0o42) + chr(51), 60487 - 60479), ehT0Px3KOsy9(chr(2166 - 2118) + chr(0b101000 + 0o107) + chr(0b110100) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(49) + '\066' + chr(49), 36482 - 36474), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\x33', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(53) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1676 - 1626) + chr(49) + chr(1376 - 1326), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(1116 - 1067) + chr(2257 - 2202), 0o10), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + chr(0b110001) + '\061' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b110101) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(9453 - 9342) + '\x31' + '\x33' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6487 - 6376) + chr(49) + chr(0b1110 + 0o47) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(0b110001) + chr(0b1011 + 0o45) + '\067', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x94'), chr(0b1100100) + chr(101) + chr(0b1011100 + 0o7) + chr(4132 - 4021) + '\144' + '\145')(chr(117) + chr(0b1110100) + '\146' + chr(0b101101) + chr(0b11110 + 0o32)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def fk5brribKJwr():
n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1()
n4ljua2gi1Pr.QGSIpd_yUNzU = 0.1
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b101111 + 0o1) + chr(0b1000 + 0o50), 49886 - 49878)
n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(48) + '\157' + '\064' + '\060' + chr(48), 46110 - 46102)
n4ljua2gi1Pr.jZh5_pLUoOoZ = ehT0Px3KOsy9('\x30' + chr(3579 - 3468) + '\x32', 8)
n4ljua2gi1Pr.kwfuYzkY5C57 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xcfz_$\xbb\xc8--ne\x86 ]\xa6 a\xad\xe7e\xed'), '\x64' + chr(2607 - 2506) + chr(99) + '\x6f' + '\x64' + '\145')(chr(117) + chr(8183 - 8067) + chr(102) + chr(0b1010 + 0o43) + chr(0b111000))
n4ljua2gi1Pr.S1SbCBXLapw8 = 1.0
n4ljua2gi1Pr.eB4rJl6fUxw9 = 0.0
n4ljua2gi1Pr.ag0mwEgWzjYv = 0.0
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/transformer_symshard.py
|
_layer_stack
|
def _layer_stack(mp,
inputs,
self_attention_bias,
layers,
hparams,
encoder_output=None,
encoder_decoder_attention_bias=None):
"""A stack of layers.
Args:
mp: a Parallelism object
inputs: a list of Tensors
self_attention_bias: list of bias Tensor for self-attention
(see common_attention.attention_bias())
layers: a string
hparams: hyperparameters for model
encoder_output: optional list of tensors
encoder_decoder_attention_bias: optional list of tensors
Returns:
y: a list of Tensors
"""
layers = layers.strip(",").split(",")
# scaled_dot_product_attention_with_projections uses a 3d attention bias
# (no heads), where multihead_attention uses 4d attention bias.
self_attention_bias_3d = mp(tf.squeeze, self_attention_bias, 1)
if encoder_decoder_attention_bias is not None:
encoder_decoder_attention_bias_3d = mp(
tf.squeeze, encoder_decoder_attention_bias, 1)
relu_dropout_broadcast_dims = (
common_layers.comma_separated_string_to_integer_list(
getattr(hparams, "relu_dropout_broadcast_dims", "")))
mix_size = int(hparams.mix_fraction * hparams.hidden_size)
accumulator = inputs
x = inputs
for layer_num, layer_type in enumerate(layers):
with tf.variable_scope("%s_%d" % (layer_type, layer_num)):
tf.logging.info("%s_%d" % (layer_type, layer_num))
if layer_type == "a":
# accumulate
accumulator = mp(tf.add, x, accumulator)
x = accumulator
elif layer_type == "n":
# normalize
x = mp(common_layers.apply_norm,
x, hparams.norm_type, hparams.hidden_size, hparams.norm_epsilon)
elif layer_type == "d":
# dropout
x = mp(tf.nn.dropout, x, 1.0 - hparams.layer_prepostprocess_dropout)
elif layer_type == "m":
if mix_size > 0:
# mix across shards
def _split(t):
return tuple(tf.split(
t, [mix_size, hparams.hidden_size - mix_size], 2))
to_mix, to_keep = mp(_split, x)
mixed = expert_utils.all_reduce_ring(to_mix, mp)
mixed = mp(tf.multiply, mixed, mp.n ** -0.5)
x = mp(lambda a, b: tf.concat([a, b], 2), mixed, to_keep)
elif layer_type == "att":
# single-head attention
q = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="q_transform")
x = mp(
common_attention.scaled_dot_product_attention_simple,
q, x, x, self_attention_bias_3d)
x = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="o_transform")
elif layer_type == "enc-att":
# single-head attention over encoder
q = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="q_transform")
assert encoder_output is not None
x = mp(
common_attention.scaled_dot_product_attention_simple,
q, encoder_output, encoder_output,
encoder_decoder_attention_bias_3d)
x = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="o_transform")
elif layer_type == "multihead-att":
# multi-head attention
x = mp(
common_attention.multihead_attention,
x,
None,
self_attention_bias, # bias
hparams.multihead_attention_key_channels or hparams.hidden_size,
hparams.multihead_attention_value_channels or hparams.hidden_size,
hparams.hidden_size,
hparams.multihead_attention_num_heads,
hparams.attention_dropout)
elif layer_type == "enc-multihead-att":
# multi-head attention
x = mp(
common_attention.multihead_attention,
x,
encoder_output,
encoder_decoder_attention_bias, # bias
hparams.multihead_attention_key_channels or hparams.hidden_size,
hparams.multihead_attention_value_channels or hparams.hidden_size,
hparams.hidden_size,
hparams.multihead_attention_num_heads,
hparams.attention_dropout)
elif layer_type == "ffn":
x = mp(
common_layers.dense_relu_dense, x,
hparams.filter_size, hparams.hidden_size,
dropout=hparams.relu_dropout,
dropout_broadcast_dims=[relu_dropout_broadcast_dims] * mp.n)
else:
assert False, "unknown sublayer %s" % layer_type
return x
|
python
|
def _layer_stack(mp,
inputs,
self_attention_bias,
layers,
hparams,
encoder_output=None,
encoder_decoder_attention_bias=None):
"""A stack of layers.
Args:
mp: a Parallelism object
inputs: a list of Tensors
self_attention_bias: list of bias Tensor for self-attention
(see common_attention.attention_bias())
layers: a string
hparams: hyperparameters for model
encoder_output: optional list of tensors
encoder_decoder_attention_bias: optional list of tensors
Returns:
y: a list of Tensors
"""
layers = layers.strip(",").split(",")
# scaled_dot_product_attention_with_projections uses a 3d attention bias
# (no heads), where multihead_attention uses 4d attention bias.
self_attention_bias_3d = mp(tf.squeeze, self_attention_bias, 1)
if encoder_decoder_attention_bias is not None:
encoder_decoder_attention_bias_3d = mp(
tf.squeeze, encoder_decoder_attention_bias, 1)
relu_dropout_broadcast_dims = (
common_layers.comma_separated_string_to_integer_list(
getattr(hparams, "relu_dropout_broadcast_dims", "")))
mix_size = int(hparams.mix_fraction * hparams.hidden_size)
accumulator = inputs
x = inputs
for layer_num, layer_type in enumerate(layers):
with tf.variable_scope("%s_%d" % (layer_type, layer_num)):
tf.logging.info("%s_%d" % (layer_type, layer_num))
if layer_type == "a":
# accumulate
accumulator = mp(tf.add, x, accumulator)
x = accumulator
elif layer_type == "n":
# normalize
x = mp(common_layers.apply_norm,
x, hparams.norm_type, hparams.hidden_size, hparams.norm_epsilon)
elif layer_type == "d":
# dropout
x = mp(tf.nn.dropout, x, 1.0 - hparams.layer_prepostprocess_dropout)
elif layer_type == "m":
if mix_size > 0:
# mix across shards
def _split(t):
return tuple(tf.split(
t, [mix_size, hparams.hidden_size - mix_size], 2))
to_mix, to_keep = mp(_split, x)
mixed = expert_utils.all_reduce_ring(to_mix, mp)
mixed = mp(tf.multiply, mixed, mp.n ** -0.5)
x = mp(lambda a, b: tf.concat([a, b], 2), mixed, to_keep)
elif layer_type == "att":
# single-head attention
q = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="q_transform")
x = mp(
common_attention.scaled_dot_product_attention_simple,
q, x, x, self_attention_bias_3d)
x = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="o_transform")
elif layer_type == "enc-att":
# single-head attention over encoder
q = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="q_transform")
assert encoder_output is not None
x = mp(
common_attention.scaled_dot_product_attention_simple,
q, encoder_output, encoder_output,
encoder_decoder_attention_bias_3d)
x = mp(tf.layers.dense, x, hparams.hidden_size, use_bias=False,
name="o_transform")
elif layer_type == "multihead-att":
# multi-head attention
x = mp(
common_attention.multihead_attention,
x,
None,
self_attention_bias, # bias
hparams.multihead_attention_key_channels or hparams.hidden_size,
hparams.multihead_attention_value_channels or hparams.hidden_size,
hparams.hidden_size,
hparams.multihead_attention_num_heads,
hparams.attention_dropout)
elif layer_type == "enc-multihead-att":
# multi-head attention
x = mp(
common_attention.multihead_attention,
x,
encoder_output,
encoder_decoder_attention_bias, # bias
hparams.multihead_attention_key_channels or hparams.hidden_size,
hparams.multihead_attention_value_channels or hparams.hidden_size,
hparams.hidden_size,
hparams.multihead_attention_num_heads,
hparams.attention_dropout)
elif layer_type == "ffn":
x = mp(
common_layers.dense_relu_dense, x,
hparams.filter_size, hparams.hidden_size,
dropout=hparams.relu_dropout,
dropout_broadcast_dims=[relu_dropout_broadcast_dims] * mp.n)
else:
assert False, "unknown sublayer %s" % layer_type
return x
|
[
"def",
"_layer_stack",
"(",
"mp",
",",
"inputs",
",",
"self_attention_bias",
",",
"layers",
",",
"hparams",
",",
"encoder_output",
"=",
"None",
",",
"encoder_decoder_attention_bias",
"=",
"None",
")",
":",
"layers",
"=",
"layers",
".",
"strip",
"(",
"\",\"",
")",
".",
"split",
"(",
"\",\"",
")",
"# scaled_dot_product_attention_with_projections uses a 3d attention bias",
"# (no heads), where multihead_attention uses 4d attention bias.",
"self_attention_bias_3d",
"=",
"mp",
"(",
"tf",
".",
"squeeze",
",",
"self_attention_bias",
",",
"1",
")",
"if",
"encoder_decoder_attention_bias",
"is",
"not",
"None",
":",
"encoder_decoder_attention_bias_3d",
"=",
"mp",
"(",
"tf",
".",
"squeeze",
",",
"encoder_decoder_attention_bias",
",",
"1",
")",
"relu_dropout_broadcast_dims",
"=",
"(",
"common_layers",
".",
"comma_separated_string_to_integer_list",
"(",
"getattr",
"(",
"hparams",
",",
"\"relu_dropout_broadcast_dims\"",
",",
"\"\"",
")",
")",
")",
"mix_size",
"=",
"int",
"(",
"hparams",
".",
"mix_fraction",
"*",
"hparams",
".",
"hidden_size",
")",
"accumulator",
"=",
"inputs",
"x",
"=",
"inputs",
"for",
"layer_num",
",",
"layer_type",
"in",
"enumerate",
"(",
"layers",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"%s_%d\"",
"%",
"(",
"layer_type",
",",
"layer_num",
")",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"%s_%d\"",
"%",
"(",
"layer_type",
",",
"layer_num",
")",
")",
"if",
"layer_type",
"==",
"\"a\"",
":",
"# accumulate",
"accumulator",
"=",
"mp",
"(",
"tf",
".",
"add",
",",
"x",
",",
"accumulator",
")",
"x",
"=",
"accumulator",
"elif",
"layer_type",
"==",
"\"n\"",
":",
"# normalize",
"x",
"=",
"mp",
"(",
"common_layers",
".",
"apply_norm",
",",
"x",
",",
"hparams",
".",
"norm_type",
",",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"norm_epsilon",
")",
"elif",
"layer_type",
"==",
"\"d\"",
":",
"# dropout",
"x",
"=",
"mp",
"(",
"tf",
".",
"nn",
".",
"dropout",
",",
"x",
",",
"1.0",
"-",
"hparams",
".",
"layer_prepostprocess_dropout",
")",
"elif",
"layer_type",
"==",
"\"m\"",
":",
"if",
"mix_size",
">",
"0",
":",
"# mix across shards",
"def",
"_split",
"(",
"t",
")",
":",
"return",
"tuple",
"(",
"tf",
".",
"split",
"(",
"t",
",",
"[",
"mix_size",
",",
"hparams",
".",
"hidden_size",
"-",
"mix_size",
"]",
",",
"2",
")",
")",
"to_mix",
",",
"to_keep",
"=",
"mp",
"(",
"_split",
",",
"x",
")",
"mixed",
"=",
"expert_utils",
".",
"all_reduce_ring",
"(",
"to_mix",
",",
"mp",
")",
"mixed",
"=",
"mp",
"(",
"tf",
".",
"multiply",
",",
"mixed",
",",
"mp",
".",
"n",
"**",
"-",
"0.5",
")",
"x",
"=",
"mp",
"(",
"lambda",
"a",
",",
"b",
":",
"tf",
".",
"concat",
"(",
"[",
"a",
",",
"b",
"]",
",",
"2",
")",
",",
"mixed",
",",
"to_keep",
")",
"elif",
"layer_type",
"==",
"\"att\"",
":",
"# single-head attention",
"q",
"=",
"mp",
"(",
"tf",
".",
"layers",
".",
"dense",
",",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"use_bias",
"=",
"False",
",",
"name",
"=",
"\"q_transform\"",
")",
"x",
"=",
"mp",
"(",
"common_attention",
".",
"scaled_dot_product_attention_simple",
",",
"q",
",",
"x",
",",
"x",
",",
"self_attention_bias_3d",
")",
"x",
"=",
"mp",
"(",
"tf",
".",
"layers",
".",
"dense",
",",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"use_bias",
"=",
"False",
",",
"name",
"=",
"\"o_transform\"",
")",
"elif",
"layer_type",
"==",
"\"enc-att\"",
":",
"# single-head attention over encoder",
"q",
"=",
"mp",
"(",
"tf",
".",
"layers",
".",
"dense",
",",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"use_bias",
"=",
"False",
",",
"name",
"=",
"\"q_transform\"",
")",
"assert",
"encoder_output",
"is",
"not",
"None",
"x",
"=",
"mp",
"(",
"common_attention",
".",
"scaled_dot_product_attention_simple",
",",
"q",
",",
"encoder_output",
",",
"encoder_output",
",",
"encoder_decoder_attention_bias_3d",
")",
"x",
"=",
"mp",
"(",
"tf",
".",
"layers",
".",
"dense",
",",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"use_bias",
"=",
"False",
",",
"name",
"=",
"\"o_transform\"",
")",
"elif",
"layer_type",
"==",
"\"multihead-att\"",
":",
"# multi-head attention",
"x",
"=",
"mp",
"(",
"common_attention",
".",
"multihead_attention",
",",
"x",
",",
"None",
",",
"self_attention_bias",
",",
"# bias",
"hparams",
".",
"multihead_attention_key_channels",
"or",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"multihead_attention_value_channels",
"or",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"multihead_attention_num_heads",
",",
"hparams",
".",
"attention_dropout",
")",
"elif",
"layer_type",
"==",
"\"enc-multihead-att\"",
":",
"# multi-head attention",
"x",
"=",
"mp",
"(",
"common_attention",
".",
"multihead_attention",
",",
"x",
",",
"encoder_output",
",",
"encoder_decoder_attention_bias",
",",
"# bias",
"hparams",
".",
"multihead_attention_key_channels",
"or",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"multihead_attention_value_channels",
"or",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"multihead_attention_num_heads",
",",
"hparams",
".",
"attention_dropout",
")",
"elif",
"layer_type",
"==",
"\"ffn\"",
":",
"x",
"=",
"mp",
"(",
"common_layers",
".",
"dense_relu_dense",
",",
"x",
",",
"hparams",
".",
"filter_size",
",",
"hparams",
".",
"hidden_size",
",",
"dropout",
"=",
"hparams",
".",
"relu_dropout",
",",
"dropout_broadcast_dims",
"=",
"[",
"relu_dropout_broadcast_dims",
"]",
"*",
"mp",
".",
"n",
")",
"else",
":",
"assert",
"False",
",",
"\"unknown sublayer %s\"",
"%",
"layer_type",
"return",
"x"
] |
A stack of layers.
Args:
mp: a Parallelism object
inputs: a list of Tensors
self_attention_bias: list of bias Tensor for self-attention
(see common_attention.attention_bias())
layers: a string
hparams: hyperparameters for model
encoder_output: optional list of tensors
encoder_decoder_attention_bias: optional list of tensors
Returns:
y: a list of Tensors
|
[
"A",
"stack",
"of",
"layers",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/transformer_symshard.py#L227-L339
|
train
|
A stack of 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,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1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,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(403 - 355) + chr(11094 - 10983) + '\062' + '\x31' + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + '\x36' + '\x33', 46361 - 46353), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b101111 + 0o3) + chr(48) + chr(0b1101 + 0o50), 0b1000), ehT0Px3KOsy9(chr(1485 - 1437) + chr(0b1101111) + chr(0b100111 + 0o12) + '\x31' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(2262 - 2214) + chr(0b1101111) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(9096 - 8985) + '\x31' + chr(2214 - 2163) + chr(2449 - 2396), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\x34' + chr(987 - 932), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110100) + chr(53), 0o10), ehT0Px3KOsy9(chr(1873 - 1825) + '\157' + chr(0b110001) + chr(232 - 181) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(0b110101), 7385 - 7377), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\062' + '\x31', 30908 - 30900), ehT0Px3KOsy9(chr(909 - 861) + chr(5206 - 5095) + '\061' + chr(49) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b110010) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10001 + 0o42) + chr(436 - 381) + chr(1082 - 1031), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(276 - 225) + chr(0b1 + 0o65) + chr(827 - 778), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2009 - 1960) + '\x30' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(55), 8), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + '\062' + chr(0b110011) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1444 - 1394) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(2050 - 2002) + chr(6518 - 6407) + '\061' + chr(1179 - 1131) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1110 + 0o43) + '\x32' + chr(2085 - 2036), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(684 - 630) + '\063', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(476 - 425) + chr(0b11110 + 0o24) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8595 - 8484) + '\061' + '\x32' + chr(0b11000 + 0o35), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b10100 + 0o133) + chr(50) + '\x33' + chr(1071 - 1023), 64738 - 64730), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + '\062' + chr(0b110001) + chr(0b101010 + 0o7), 0b1000), ehT0Px3KOsy9(chr(774 - 726) + chr(0b1101111) + chr(0b110011) + chr(0b110101) + chr(1410 - 1356), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(211 - 161) + '\063' + chr(1658 - 1606), 0o10), ehT0Px3KOsy9(chr(2204 - 2156) + chr(0b100000 + 0o117) + chr(0b110111) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + '\066' + chr(0b1000 + 0o51), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + '\x31' + chr(2213 - 2158) + chr(1061 - 1013), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + '\x31', 0o10), ehT0Px3KOsy9(chr(1758 - 1710) + chr(111) + chr(0b11001 + 0o30) + chr(0b10000 + 0o46) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(2103 - 2054) + chr(1291 - 1240), 7370 - 7362), ehT0Px3KOsy9('\x30' + chr(1217 - 1106) + '\x32' + chr(0b110111) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(0b110110), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(53) + '\x32', 49237 - 49229), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(0b10100 + 0o36) + chr(0b110111) + chr(2135 - 2085), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b100001 + 0o24) + chr(0b11110 + 0o22), 14555 - 14547)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1'), chr(100) + '\x65' + '\143' + '\157' + chr(100) + chr(101))('\x75' + '\x74' + chr(102) + chr(45) + chr(0b100001 + 0o27)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Je3RKuXx4Vf3(eroBSmBzokO2, vXoupepMtCXU, rsYpYnJ7N3P3, sGi5Aql23May, n4ljua2gi1Pr, NE_S2zAzN4PI=None, iuvkQfeRHfn5=None):
sGi5Aql23May = sGi5Aql23May.strip(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3'), chr(0b1100100) + chr(101) + '\x63' + '\157' + chr(0b1100100) + chr(101))(chr(117) + chr(3486 - 3370) + '\x66' + chr(0b100 + 0o51) + '\x38')).split(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3'), '\x64' + '\145' + chr(0b101100 + 0o67) + chr(0b1101111) + '\x64' + chr(101))(chr(0b1110101) + chr(11229 - 11113) + chr(0b1100110) + chr(909 - 864) + chr(448 - 392)))
KiMb1zkvrlK9 = eroBSmBzokO2(IDJ2eXGCBCDu.squeeze, rsYpYnJ7N3P3, ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 8))
if iuvkQfeRHfn5 is not None:
dT7nTHW8IgRZ = eroBSmBzokO2(IDJ2eXGCBCDu.squeeze, iuvkQfeRHfn5, ehT0Px3KOsy9('\x30' + chr(6300 - 6189) + chr(0b10110 + 0o33), 8))
xC8v_AiQ1DCT = jSKPaHwSAfVv.comma_separated_string_to_integer_list(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\x96\xe9?Y9u\x08U7p%\x110\x89\x9e"c\xfax\xe72\x0e\x97\xb98\xeb'), chr(0b111110 + 0o46) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110 + 0o0) + chr(0b101101) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b''), '\144' + chr(0b111101 + 0o50) + '\x63' + '\x6f' + '\x64' + chr(0b1100101))('\x75' + chr(116) + chr(0b11001 + 0o115) + chr(45) + chr(0b101001 + 0o17))))
uPvAnxY9k2e2 = ehT0Px3KOsy9(n4ljua2gi1Pr.mix_fraction * n4ljua2gi1Pr.qzoyXN3kdhDL)
dBvMz07v8VLa = vXoupepMtCXU
OeWW0F1dBPRQ = vXoupepMtCXU
for (zpxP3vO4wNTm, nF24o7I0_Wgs) in YlkZvXL8qwsX(sGi5Aql23May):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9\x92\xf7#g?k\x02z+f>>7'), chr(0b1100 + 0o130) + '\145' + '\143' + '\157' + chr(0b1011100 + 0o10) + chr(8727 - 8626))(chr(0b1110101) + '\x74' + '\x66' + chr(949 - 904) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xaa\x80\xdaob'), chr(3625 - 3525) + chr(0b1100101) + '\x63' + '\x6f' + chr(0b1000 + 0o134) + '\145')(chr(2706 - 2589) + chr(0b1010010 + 0o42) + chr(2249 - 2147) + '\x2d' + chr(56)) % (nF24o7I0_Wgs, zpxP3vO4wNTm)):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdc\xc4\xcd2s>`PO4_:'), chr(0b101000 + 0o74) + '\x65' + chr(99) + chr(0b10 + 0o155) + chr(100) + '\145')(chr(117) + '\164' + chr(0b1100110) + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xaa\x80\xdaob'), chr(8963 - 8863) + chr(101) + '\143' + chr(111) + chr(0b11 + 0o141) + chr(0b101001 + 0o74))('\165' + '\164' + chr(0b1101 + 0o131) + '\055' + '\x38') % (nF24o7I0_Wgs, zpxP3vO4wNTm))
if nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xee'), '\144' + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(0b110001 + 0o63) + '\x65')(chr(6560 - 6443) + chr(0b111100 + 0o70) + chr(0b100100 + 0o102) + chr(0b11010 + 0o23) + chr(0b111000)):
dBvMz07v8VLa = eroBSmBzokO2(IDJ2eXGCBCDu.add, OeWW0F1dBPRQ, dBvMz07v8VLa)
OeWW0F1dBPRQ = dBvMz07v8VLa
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1'), chr(0b11 + 0o141) + chr(5108 - 5007) + chr(1083 - 984) + chr(111) + '\144' + '\x65')(chr(0b1110101) + '\x74' + chr(0b1100110) + '\055' + chr(56)):
OeWW0F1dBPRQ = eroBSmBzokO2(jSKPaHwSAfVv.apply_norm, OeWW0F1dBPRQ, n4ljua2gi1Pr.LE5Fu6Tcl7nw, n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.norm_epsilon)
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb'), chr(4944 - 4844) + chr(101) + chr(0b101000 + 0o73) + '\157' + '\144' + chr(9592 - 9491))(chr(9317 - 9200) + chr(116) + chr(102) + '\x2d' + chr(0b10110 + 0o42)):
OeWW0F1dBPRQ = eroBSmBzokO2(IDJ2eXGCBCDu.nn.ag0mwEgWzjYv, OeWW0F1dBPRQ, 1.0 - n4ljua2gi1Pr.RW_xSzp18UeS)
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2'), chr(1309 - 1209) + chr(101) + chr(1380 - 1281) + '\157' + chr(1830 - 1730) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\070'):
if uPvAnxY9k2e2 > ehT0Px3KOsy9(chr(0b110000) + chr(1092 - 981) + chr(1644 - 1596), 1332 - 1324):
def XpqlogcT1p1Z(YeT3l7JgTbWR):
return KNyTy8rYcwji(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\x83\xe9#r'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + '\x6f' + '\144' + chr(0b111111 + 0o46))(chr(0b1110101) + '\x74' + chr(0b1100110) + '\055' + '\x38'))(YeT3l7JgTbWR, [uPvAnxY9k2e2, xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\x89\xea3^\x134\x0cA0A\x1d'), '\144' + chr(0b100 + 0o141) + chr(99) + '\x6f' + chr(0b1100100) + '\x65')(chr(4502 - 4385) + '\164' + chr(0b111100 + 0o52) + chr(117 - 72) + chr(2908 - 2852))) - uPvAnxY9k2e2], ehT0Px3KOsy9(chr(48) + chr(11724 - 11613) + chr(0b1110 + 0o44), 0b1000)))
(a9O6Tlex2TXd, jYDMRiI0EWJE) = eroBSmBzokO2(XpqlogcT1p1Z, OeWW0F1dBPRQ)
BXuRXwpJNbyN = mpdtyez0NuRm.all_reduce_ring(a9O6Tlex2TXd, eroBSmBzokO2)
BXuRXwpJNbyN = eroBSmBzokO2(IDJ2eXGCBCDu.multiply, BXuRXwpJNbyN, eroBSmBzokO2.m1NkCryOw9Bx ** (-0.5))
OeWW0F1dBPRQ = eroBSmBzokO2(lambda XPh1qbAgrPgG, wmN3dvez4qzC: IDJ2eXGCBCDu.concat([XPh1qbAgrPgG, wmN3dvez4qzC], ehT0Px3KOsy9('\x30' + '\157' + chr(50), 8)), BXuRXwpJNbyN, jYDMRiI0EWJE)
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\x87\xf1'), '\144' + chr(0b1010010 + 0o23) + '\143' + chr(111) + chr(0b111100 + 0o50) + '\145')('\165' + chr(8766 - 8650) + '\x66' + chr(1181 - 1136) + '\070'):
WtwjCI_b3w8O = eroBSmBzokO2(IDJ2eXGCBCDu.layers.dense, OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, use_bias=ehT0Px3KOsy9(chr(48) + '\157' + '\060', 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xac\xf18g3t\x01J*h'), '\x64' + '\x65' + chr(4982 - 4883) + chr(0b1101111) + '\x64' + chr(0b111 + 0o136))('\165' + chr(0b101010 + 0o112) + '\x66' + chr(162 - 117) + chr(0b111000)))
OeWW0F1dBPRQ = eroBSmBzokO2(WOnrfm4dlYcf.scaled_dot_product_attention_simple, WtwjCI_b3w8O, OeWW0F1dBPRQ, OeWW0F1dBPRQ, KiMb1zkvrlK9)
OeWW0F1dBPRQ = eroBSmBzokO2(IDJ2eXGCBCDu.layers.dense, OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, use_bias=ehT0Px3KOsy9('\060' + chr(111) + chr(1254 - 1206), 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xac\xf18g3t\x01J*h'), chr(100) + chr(101) + chr(0b1100011) + chr(0b10000 + 0o137) + '\144' + chr(0b100110 + 0o77))(chr(0b1100001 + 0o24) + chr(116) + chr(0b1100110) + chr(45) + '\070'))
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xea\x9d\xe6gg)s'), '\144' + chr(3855 - 3754) + '\143' + '\157' + '\x64' + '\145')('\165' + '\164' + chr(0b1100110) + '\x2d' + '\x38'):
WtwjCI_b3w8O = eroBSmBzokO2(IDJ2eXGCBCDu.layers.dense, OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, use_bias=ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b111111 + 0o60) + chr(0b100011 + 0o15), 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xac\xf18g3t\x01J*h'), chr(0b110010 + 0o62) + '\x65' + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101 + 0o0))(chr(3159 - 3042) + chr(12590 - 12474) + chr(0b1100110) + chr(45) + chr(56)))
assert NE_S2zAzN4PI is not None
OeWW0F1dBPRQ = eroBSmBzokO2(WOnrfm4dlYcf.scaled_dot_product_attention_simple, WtwjCI_b3w8O, NE_S2zAzN4PI, NE_S2zAzN4PI, dT7nTHW8IgRZ)
OeWW0F1dBPRQ = eroBSmBzokO2(IDJ2eXGCBCDu.layers.dense, OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, use_bias=ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(9712 - 9601) + chr(48), 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xac\xf18g3t\x01J*h'), chr(4231 - 4131) + chr(1561 - 1460) + chr(0b1100011) + chr(0b1101111) + '\x64' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(292 - 247) + chr(0b101 + 0o63)))
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2\x86\xe9>o5b\x06Aud%:'), '\x64' + chr(7628 - 7527) + chr(99) + chr(111) + chr(0b1001101 + 0o27) + chr(6882 - 6781))(chr(254 - 137) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b1011 + 0o55)):
OeWW0F1dBPRQ = eroBSmBzokO2(WOnrfm4dlYcf.multihead_attention, OeWW0F1dBPRQ, None, rsYpYnJ7N3P3, n4ljua2gi1Pr.multihead_attention_key_channels or n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.multihead_attention_value_channels or n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.multihead_attention_num_heads, n4ljua2gi1Pr.RdMRr3qkYioQ)
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xea\x9d\xe6gk(k\x13L0`0*\x7f\x9a\x857'), chr(100) + chr(0b1100101) + chr(9072 - 8973) + '\157' + '\x64' + chr(0b10111 + 0o116))(chr(0b111110 + 0o67) + chr(0b1110100) + chr(0b101010 + 0o74) + chr(0b10110 + 0o27) + '\070'):
OeWW0F1dBPRQ = eroBSmBzokO2(WOnrfm4dlYcf.multihead_attention, OeWW0F1dBPRQ, NE_S2zAzN4PI, iuvkQfeRHfn5, n4ljua2gi1Pr.multihead_attention_key_channels or n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.multihead_attention_value_channels or n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.multihead_attention_num_heads, n4ljua2gi1Pr.RdMRr3qkYioQ)
elif nF24o7I0_Wgs == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x95\xeb'), chr(441 - 341) + chr(101) + chr(0b1010 + 0o131) + chr(0b1101111) + '\x64' + '\x65')(chr(0b1110101) + chr(0b11001 + 0o133) + chr(0b1100110) + '\055' + '\070'):
OeWW0F1dBPRQ = eroBSmBzokO2(jSKPaHwSAfVv.dense_relu_dense, OeWW0F1dBPRQ, n4ljua2gi1Pr.deybX8NJ0oEI, n4ljua2gi1Pr.qzoyXN3kdhDL, dropout=n4ljua2gi1Pr.PJc0PNdBnSag, dropout_broadcast_dims=[xC8v_AiQ1DCT] * eroBSmBzokO2.m1NkCryOw9Bx)
else:
assert ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(11891 - 11780) + chr(2181 - 2133), 8), xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\x9d\xee$i*iGV-g=/+\x9e\x83c"\xea'), chr(0b1000 + 0o134) + '\x65' + chr(99) + '\x6f' + chr(6651 - 6551) + '\x65')(chr(0b1110101) + '\164' + '\x66' + chr(0b101101) + chr(0b101100 + 0o14)) % nF24o7I0_Wgs
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/transformer_symshard.py
|
transformer_symshard_base
|
def transformer_symshard_base():
"""Set of hyperparameters."""
hparams = common_hparams.basic_params1()
hparams.hidden_size = 256
hparams.batch_size = 2048
hparams.max_length = 0
# All hyperparameters ending in "dropout" are automatically set to 0.0
# when not in training mode.
hparams.layer_prepostprocess_dropout = 0.2
hparams.add_hparam("attention_dropout", 0.1)
hparams.add_hparam("relu_dropout", 0.0)
hparams.add_hparam("relu_dropout_broadcast_dims", "1")
hparams.layer_prepostprocess_dropout = 0.1
hparams.layer_prepostprocess_dropout_broadcast_dims = "1" # length
hparams.label_smoothing = 0.1
hparams.clip_grad_norm = 0. # i.e. no gradient clipping
hparams.optimizer = "Adafactor"
hparams.learning_rate_schedule = "rsqrt_decay"
hparams.learning_rate_warmup_steps = 10000
hparams.initializer_gain = 1.0
hparams.initializer = "uniform_unit_scaling"
hparams.weight_decay = 0.0
# TODO(noam): use this to control sharing. We now share always
hparams.shared_embedding_and_softmax_weights = True
# we only want one data shard.
hparams.no_data_parallelism = True
# bypass the symbol modality so that we can use model parallelism.
hparams.bottom = {
"inputs": modalities.identity_bottom,
"targets": modalities.identity_bottom,
}
hparams.top = {
"targets": modalities.identity_top,
}
hparams.add_hparam("filter_size", 1280)
hparams.add_hparam("mix_fraction", 0.5)
# attention-related flags
hparams.add_hparam("multihead_attention_num_heads", 4)
hparams.add_hparam("multihead_attention_key_channels", 0)
hparams.add_hparam("multihead_attention_value_channels", 0)
hparams.add_hparam("pos", "timing") # timing, none
hparams.add_hparam(
"encoder_layers", ("n,att,m,d,a," "n,ffn,m,d,a,") * 6 + "n,d")
hparams.add_hparam(
"decoder_layers",
("n,att,m,d,a," "n,enc-att,m,d,a," "n,ffn,m,d,a,") * 6 + "n,d")
# Number of model shards - each one has separate parameters.
# Changing this number invalidates checkpoints.
hparams.add_hparam("num_model_shards", 8)
return hparams
|
python
|
def transformer_symshard_base():
"""Set of hyperparameters."""
hparams = common_hparams.basic_params1()
hparams.hidden_size = 256
hparams.batch_size = 2048
hparams.max_length = 0
# All hyperparameters ending in "dropout" are automatically set to 0.0
# when not in training mode.
hparams.layer_prepostprocess_dropout = 0.2
hparams.add_hparam("attention_dropout", 0.1)
hparams.add_hparam("relu_dropout", 0.0)
hparams.add_hparam("relu_dropout_broadcast_dims", "1")
hparams.layer_prepostprocess_dropout = 0.1
hparams.layer_prepostprocess_dropout_broadcast_dims = "1" # length
hparams.label_smoothing = 0.1
hparams.clip_grad_norm = 0. # i.e. no gradient clipping
hparams.optimizer = "Adafactor"
hparams.learning_rate_schedule = "rsqrt_decay"
hparams.learning_rate_warmup_steps = 10000
hparams.initializer_gain = 1.0
hparams.initializer = "uniform_unit_scaling"
hparams.weight_decay = 0.0
# TODO(noam): use this to control sharing. We now share always
hparams.shared_embedding_and_softmax_weights = True
# we only want one data shard.
hparams.no_data_parallelism = True
# bypass the symbol modality so that we can use model parallelism.
hparams.bottom = {
"inputs": modalities.identity_bottom,
"targets": modalities.identity_bottom,
}
hparams.top = {
"targets": modalities.identity_top,
}
hparams.add_hparam("filter_size", 1280)
hparams.add_hparam("mix_fraction", 0.5)
# attention-related flags
hparams.add_hparam("multihead_attention_num_heads", 4)
hparams.add_hparam("multihead_attention_key_channels", 0)
hparams.add_hparam("multihead_attention_value_channels", 0)
hparams.add_hparam("pos", "timing") # timing, none
hparams.add_hparam(
"encoder_layers", ("n,att,m,d,a," "n,ffn,m,d,a,") * 6 + "n,d")
hparams.add_hparam(
"decoder_layers",
("n,att,m,d,a," "n,enc-att,m,d,a," "n,ffn,m,d,a,") * 6 + "n,d")
# Number of model shards - each one has separate parameters.
# Changing this number invalidates checkpoints.
hparams.add_hparam("num_model_shards", 8)
return hparams
|
[
"def",
"transformer_symshard_base",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"hparams",
".",
"hidden_size",
"=",
"256",
"hparams",
".",
"batch_size",
"=",
"2048",
"hparams",
".",
"max_length",
"=",
"0",
"# All hyperparameters ending in \"dropout\" are automatically set to 0.0",
"# when not in training mode.",
"hparams",
".",
"layer_prepostprocess_dropout",
"=",
"0.2",
"hparams",
".",
"add_hparam",
"(",
"\"attention_dropout\"",
",",
"0.1",
")",
"hparams",
".",
"add_hparam",
"(",
"\"relu_dropout\"",
",",
"0.0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"relu_dropout_broadcast_dims\"",
",",
"\"1\"",
")",
"hparams",
".",
"layer_prepostprocess_dropout",
"=",
"0.1",
"hparams",
".",
"layer_prepostprocess_dropout_broadcast_dims",
"=",
"\"1\"",
"# length",
"hparams",
".",
"label_smoothing",
"=",
"0.1",
"hparams",
".",
"clip_grad_norm",
"=",
"0.",
"# i.e. no gradient clipping",
"hparams",
".",
"optimizer",
"=",
"\"Adafactor\"",
"hparams",
".",
"learning_rate_schedule",
"=",
"\"rsqrt_decay\"",
"hparams",
".",
"learning_rate_warmup_steps",
"=",
"10000",
"hparams",
".",
"initializer_gain",
"=",
"1.0",
"hparams",
".",
"initializer",
"=",
"\"uniform_unit_scaling\"",
"hparams",
".",
"weight_decay",
"=",
"0.0",
"# TODO(noam): use this to control sharing. We now share always",
"hparams",
".",
"shared_embedding_and_softmax_weights",
"=",
"True",
"# we only want one data shard.",
"hparams",
".",
"no_data_parallelism",
"=",
"True",
"# bypass the symbol modality so that we can use model parallelism.",
"hparams",
".",
"bottom",
"=",
"{",
"\"inputs\"",
":",
"modalities",
".",
"identity_bottom",
",",
"\"targets\"",
":",
"modalities",
".",
"identity_bottom",
",",
"}",
"hparams",
".",
"top",
"=",
"{",
"\"targets\"",
":",
"modalities",
".",
"identity_top",
",",
"}",
"hparams",
".",
"add_hparam",
"(",
"\"filter_size\"",
",",
"1280",
")",
"hparams",
".",
"add_hparam",
"(",
"\"mix_fraction\"",
",",
"0.5",
")",
"# attention-related flags",
"hparams",
".",
"add_hparam",
"(",
"\"multihead_attention_num_heads\"",
",",
"4",
")",
"hparams",
".",
"add_hparam",
"(",
"\"multihead_attention_key_channels\"",
",",
"0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"multihead_attention_value_channels\"",
",",
"0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"pos\"",
",",
"\"timing\"",
")",
"# timing, none",
"hparams",
".",
"add_hparam",
"(",
"\"encoder_layers\"",
",",
"(",
"\"n,att,m,d,a,\"",
"\"n,ffn,m,d,a,\"",
")",
"*",
"6",
"+",
"\"n,d\"",
")",
"hparams",
".",
"add_hparam",
"(",
"\"decoder_layers\"",
",",
"(",
"\"n,att,m,d,a,\"",
"\"n,enc-att,m,d,a,\"",
"\"n,ffn,m,d,a,\"",
")",
"*",
"6",
"+",
"\"n,d\"",
")",
"# Number of model shards - each one has separate parameters.",
"# Changing this number invalidates checkpoints.",
"hparams",
".",
"add_hparam",
"(",
"\"num_model_shards\"",
",",
"8",
")",
"return",
"hparams"
] |
Set of hyperparameters.
|
[
"Set",
"of",
"hyperparameters",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/transformer_symshard.py#L343-L392
|
train
|
Set of hyperparameters for transformer_symshard.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOW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68imZ2Ikxp=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(0b100110 + 0o12) + chr(0b100100 + 0o113) + '\x33' + chr(53), 0o10), ehT0Px3KOsy9(chr(690 - 642) + chr(11977 - 11866) + chr(0b11001 + 0o35) + '\067', 60034 - 60026), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1136 - 1086) + chr(49) + '\x35', 58024 - 58016), ehT0Px3KOsy9(chr(48) + chr(11668 - 11557) + '\062' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(51) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + '\065' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(1140 - 1091) + '\063' + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + '\x35' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + '\067' + chr(0b1111 + 0o45), 0o10), ehT0Px3KOsy9(chr(457 - 409) + chr(0b1101111) + chr(0b110001) + '\x32' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + '\061' + chr(0b110001) + chr(0b1010 + 0o54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1714 - 1664) + chr(741 - 691) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b110000) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7748 - 7637) + '\x31' + chr(0b11111 + 0o25) + chr(834 - 783), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\x32' + '\067', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101010 + 0o7) + chr(0b100100 + 0o14) + chr(0b10000 + 0o46), 24933 - 24925), ehT0Px3KOsy9(chr(48) + '\157' + chr(1443 - 1394) + chr(55) + chr(1630 - 1581), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10001 + 0o46) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(51) + chr(0b100001 + 0o26), 0b1000), ehT0Px3KOsy9('\060' + chr(10981 - 10870) + chr(0b110010) + '\x34' + '\060', 62095 - 62087), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(6004 - 5893) + chr(712 - 663) + chr(0b110 + 0o57) + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9(chr(48) + chr(186 - 75) + chr(1974 - 1919) + chr(1968 - 1919), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x37' + chr(2492 - 2440), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000 + 0o1) + '\x37' + '\065', 34342 - 34334), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(51) + '\x36' + '\063', 62809 - 62801), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(50) + chr(50) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x30', 5618 - 5610), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(923 - 812) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b110011) + chr(54), 348 - 340), ehT0Px3KOsy9(chr(910 - 862) + chr(10373 - 10262) + chr(0b110110) + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\x31' + chr(0b10110 + 0o41), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\065' + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(5071 - 4960) + '\061' + chr(51) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + chr(364 - 314) + chr(51) + '\060', 27731 - 27723), ehT0Px3KOsy9('\060' + chr(0b1000 + 0o147) + chr(50) + chr(48) + chr(695 - 645), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11111 + 0o23) + chr(0b110011) + chr(0b111 + 0o56), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + '\x31' + '\060' + chr(0b110 + 0o60), 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(11283 - 11172) + '\x32' + chr(48) + chr(0b10001 + 0o46), 0b1000), ehT0Px3KOsy9(chr(1952 - 1904) + chr(0b1101111) + chr(0b101110 + 0o4) + '\x35' + chr(0b1010 + 0o47), 51811 - 51803)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\065' + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'3'), chr(100) + '\x65' + '\143' + chr(111) + '\x64' + chr(220 - 119))('\165' + chr(0b1110100) + chr(102) + chr(0b110 + 0o47) + chr(2475 - 2419)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Kg2Jiwscw_qh():
n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1()
n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + '\064' + chr(48) + '\x30', ord("\x08"))
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(48) + '\157' + '\064' + chr(48) + '\x30' + '\060', 0o10)
n4ljua2gi1Pr._o7pVXAdOCRy = ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(48), 8)
n4ljua2gi1Pr.RW_xSzp18UeS = 0.2
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), '\144' + chr(0b1100101) + chr(0b0 + 0o143) + chr(0b1001011 + 0o44) + chr(681 - 581) + chr(101))('\165' + '\164' + chr(2158 - 2056) + chr(0b11101 + 0o20) + chr(1236 - 1180)))(xafqLlk3kkUe(SXOLrMavuUCe(b'|C\xf9s\xb4\x194A\xd2\n*\xe6/\x1383\r'), chr(0b1000 + 0o134) + chr(3293 - 3192) + '\x63' + '\x6f' + chr(0b1100100) + '\x65')(chr(0b100010 + 0o123) + chr(6063 - 5947) + chr(0b110101 + 0o61) + chr(0b100111 + 0o6) + chr(1983 - 1927)), 0.1)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), chr(100) + chr(0b1100101) + chr(0b1010110 + 0o15) + '\157' + '\x64' + chr(6777 - 6676))(chr(0b101 + 0o160) + chr(5213 - 5097) + '\x66' + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'oR\xe1c\x85\t/A\xcc:;\xe0'), '\x64' + '\145' + '\x63' + '\157' + chr(0b1000011 + 0o41) + chr(101))(chr(117) + chr(0b1110100) + '\146' + chr(45) + chr(1622 - 1566)), 0.0)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), chr(0b110101 + 0o57) + chr(0b1100101) + chr(0b1100011) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + '\x74' + chr(0b1100110) + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'oR\xe1c\x85\t/A\xcc:;\xe0\x1f\x01%)\x18Z\xfc\xc1\x1bMc\x19\x9a\xfds'), chr(0b100000 + 0o104) + chr(0b1100101) + chr(99) + '\157' + '\x64' + chr(8002 - 7901))('\x75' + chr(12683 - 12567) + chr(0b1100110) + chr(0b101011 + 0o2) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b','), '\144' + chr(9733 - 9632) + chr(0b1100011) + '\x6f' + '\x64' + '\145')(chr(0b101000 + 0o115) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(2477 - 2421)))
n4ljua2gi1Pr.RW_xSzp18UeS = 0.1
n4ljua2gi1Pr.An2Jt26Rv5CT = xafqLlk3kkUe(SXOLrMavuUCe(b','), '\x64' + chr(0b11111 + 0o106) + '\143' + '\x6f' + chr(6202 - 6102) + chr(0b1100101))('\x75' + '\x74' + chr(5298 - 5196) + chr(0b101101) + chr(0b111000))
n4ljua2gi1Pr.FSjUgdaczzRk = 0.1
n4ljua2gi1Pr.SdNSZNVkVjLh = 0.0
n4ljua2gi1Pr.XdKNcYRObPK3 = xafqLlk3kkUe(SXOLrMavuUCe(b'\\S\xecp\xbb\x0e)A\xce'), chr(0b100000 + 0o104) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(3672 - 3572) + chr(101))(chr(0b11001 + 0o134) + chr(0b1110100) + chr(3749 - 3647) + '\055' + chr(0b111000))
n4ljua2gi1Pr.Lz_s7neUzM5V = xafqLlk3kkUe(SXOLrMavuUCe(b'oD\xfcd\xae29K\xdf47'), chr(0b1100100) + chr(5902 - 5801) + chr(1732 - 1633) + chr(0b100000 + 0o117) + '\x64' + '\x65')('\165' + chr(0b1001111 + 0o45) + chr(6553 - 6451) + '\x2d' + chr(0b110001 + 0o7))
n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9(chr(48) + chr(1086 - 975) + '\062' + '\063' + chr(0b1 + 0o63) + chr(0b110010) + chr(48), 0b1000)
n4ljua2gi1Pr.S1SbCBXLapw8 = 1.0
n4ljua2gi1Pr.kwfuYzkY5C57 = xafqLlk3kkUe(SXOLrMavuUCe(b"hY\xe4p\xb5\x1f0q\xc9;'\xe0\x1f\x104'\x15W\xf1\xc7"), '\x64' + chr(9350 - 9249) + chr(99) + chr(11646 - 11535) + '\x64' + chr(3654 - 3553))(chr(7321 - 7204) + '\x74' + '\146' + chr(0b1101 + 0o40) + chr(0b100010 + 0o26))
n4ljua2gi1Pr.eB4rJl6fUxw9 = 0.0
n4ljua2gi1Pr.qVamxim0L2I1 = ehT0Px3KOsy9(chr(116 - 68) + chr(0b1101111) + chr(923 - 874), 0o10)
n4ljua2gi1Pr.ahN6YYm9NJTr = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49), 8)
n4ljua2gi1Pr.kXxsZxlIQUSQ = {xafqLlk3kkUe(SXOLrMavuUCe(b'tY\xfdc\xae\x1e'), chr(0b1100100) + chr(101) + '\x63' + '\157' + chr(114 - 14) + '\145')('\165' + chr(0b1110100) + chr(10350 - 10248) + chr(45) + '\x38'): PuPeNl0CuqOQ.identity_bottom, xafqLlk3kkUe(SXOLrMavuUCe(b'iV\xffq\xbf\x19.'), chr(6195 - 6095) + chr(9888 - 9787) + chr(2495 - 2396) + chr(1023 - 912) + chr(9770 - 9670) + chr(0b110101 + 0o60))(chr(117) + chr(0b110100 + 0o100) + '\146' + chr(0b1101 + 0o40) + chr(0b111000)): PuPeNl0CuqOQ.identity_bottom}
n4ljua2gi1Pr.qxrVBjeryNEZ = {xafqLlk3kkUe(SXOLrMavuUCe(b'iV\xffq\xbf\x19.'), chr(0b1100100) + chr(0b1100101) + '\143' + '\157' + chr(100) + chr(101))('\165' + chr(2299 - 2183) + chr(102) + chr(0b11 + 0o52) + chr(0b10010 + 0o46)): PuPeNl0CuqOQ.identity_top}
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), chr(0b1010110 + 0o16) + '\145' + chr(0b101010 + 0o71) + chr(9347 - 9236) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b10010 + 0o142) + chr(5658 - 5556) + chr(0b101101) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'{^\xe1b\xbf\x1f\x02]\xd5/+'), chr(3988 - 3888) + '\145' + '\143' + '\x6f' + chr(0b11110 + 0o106) + chr(101))('\x75' + chr(0b1110100) + chr(102) + chr(0b11110 + 0o17) + '\x38'), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(1971 - 1919) + '\060' + chr(0b100011 + 0o15), 0o10))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), chr(5164 - 5064) + chr(0b111011 + 0o52) + chr(0b101001 + 0o72) + chr(0b1101111) + chr(0b1001111 + 0o25) + '\145')('\x75' + chr(0b1110100) + '\146' + '\x2d' + chr(0b1 + 0o67)))(xafqLlk3kkUe(SXOLrMavuUCe(b'p^\xf5I\xbc\x1f<M\xc8<!\xfa'), '\x64' + '\x65' + chr(0b1100011) + chr(111) + chr(0b100001 + 0o103) + chr(0b1100101))(chr(0b1010 + 0o153) + '\x74' + chr(0b1000000 + 0o46) + '\x2d' + '\x38'), 0.5)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), '\x64' + chr(0b1010110 + 0o17) + chr(4744 - 4645) + '\157' + chr(8847 - 8747) + '\145')(chr(117) + chr(116) + '\146' + '\055' + chr(0b1011 + 0o55)))(xafqLlk3kkUe(SXOLrMavuUCe(b'pB\xe1b\xb3\x058O\xd8\n/\xe04\x0692\x10Q\xf1\xff\x06LQ"\x9b\xf5agv'), '\x64' + chr(0b1100101) + '\143' + chr(0b1001100 + 0o43) + '\x64' + '\145')(chr(0b1110101) + chr(11417 - 11301) + chr(1235 - 1133) + chr(0b11101 + 0o20) + chr(1808 - 1752)), ehT0Px3KOsy9(chr(48) + chr(5054 - 4943) + '\x34', 0b1000))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), chr(3717 - 3617) + chr(0b110010 + 0o63) + chr(0b1100011) + '\157' + '\144' + '\x65')(chr(0b110 + 0o157) + '\164' + chr(0b11 + 0o143) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'pB\xe1b\xb3\x058O\xd8\n/\xe04\x0692\x10Q\xf1\xff\x03\\E"\x90\xf8amk{X\xbc'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(7470 - 7359) + chr(0b1100100) + chr(0b1100101))(chr(11209 - 11092) + chr(0b1110100) + chr(559 - 457) + '\055' + '\x38'), ehT0Px3KOsy9('\060' + chr(6817 - 6706) + chr(0b110000), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), '\144' + '\145' + chr(0b1001100 + 0o27) + chr(11218 - 11107) + chr(100) + chr(0b1100101))(chr(117) + '\x74' + chr(8990 - 8888) + chr(0b10100 + 0o31) + chr(0b10010 + 0o46)))(xafqLlk3kkUe(SXOLrMavuUCe(b'pB\xe1b\xb3\x058O\xd8\n/\xe04\x0692\x10Q\xf1\xff\x1eXP\x08\x96\xcfckdpZ\xaa\xc7*'), chr(0b1100100) + chr(167 - 66) + chr(0b111110 + 0o45) + chr(1463 - 1352) + chr(8348 - 8248) + '\x65')(chr(2366 - 2249) + '\x74' + '\x66' + chr(45) + chr(0b110011 + 0o5)), ehT0Px3KOsy9(chr(1404 - 1356) + chr(0b11111 + 0o120) + chr(48), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), '\144' + chr(2913 - 2812) + chr(0b1100011) + chr(111) + chr(100) + chr(6761 - 6660))(chr(0b111 + 0o156) + chr(1712 - 1596) + '\146' + chr(366 - 321) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'mX\xfe'), '\x64' + '\x65' + '\143' + chr(0b1101111) + chr(100) + '\145')('\165' + chr(3385 - 3269) + '\x66' + '\055' + chr(1383 - 1327)), xafqLlk3kkUe(SXOLrMavuUCe(b'i^\xe0\x7f\xb4\n'), chr(8454 - 8354) + chr(101) + '\143' + chr(0b1000101 + 0o52) + '\x64' + '\145')('\x75' + '\164' + chr(102) + '\x2d' + chr(56)))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), '\144' + chr(0b1100101) + chr(3916 - 3817) + '\157' + chr(0b11100 + 0o110) + '\x65')(chr(0b101101 + 0o110) + chr(0b1101000 + 0o14) + chr(0b1100110) + chr(0b10 + 0o53) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'xY\xeey\xbe\x08/q\xd047\xf12\x10'), chr(0b1100100) + chr(0b1100101) + chr(8126 - 8027) + '\x6f' + chr(0b1100100) + chr(0b1010 + 0o133))(chr(117) + chr(116) + chr(1851 - 1749) + chr(0b101101 + 0o0) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b's\x1b\xecb\xaeA0\x02\xd8y/\xb8.O1 \x17\x12\xf2\x8c\x0c\x15]Q'), chr(100) + chr(101) + chr(0b1100011) + '\x6f' + chr(100) + chr(7978 - 7877))('\x75' + '\164' + chr(2689 - 2587) + '\055' + chr(0b100110 + 0o22)) * ehT0Px3KOsy9(chr(1959 - 1911) + chr(6853 - 6742) + '\x36', 0o10) + xafqLlk3kkUe(SXOLrMavuUCe(b's\x1b\xe9'), chr(0b1001011 + 0o31) + chr(0b1010111 + 0o16) + chr(5466 - 5367) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(6916 - 6799) + chr(0b1001011 + 0o51) + chr(102) + chr(45) + chr(56)))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), chr(100) + chr(2913 - 2812) + chr(99) + chr(0b101111 + 0o100) + chr(100) + chr(6220 - 6119))(chr(0b1100011 + 0o22) + '\164' + chr(0b101010 + 0o74) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'yR\xeey\xbe\x08/q\xd047\xf12\x10'), chr(100) + chr(101) + chr(8969 - 8870) + chr(0b110000 + 0o77) + chr(2659 - 2559) + chr(101))(chr(0b1110100 + 0o1) + chr(0b1110100) + chr(0b100 + 0o142) + chr(45) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b's\x1b\xecb\xaeA0\x02\xd8y/\xb8.O2(\x1a\x13\xfe\xd4\x1c\x15QQ\x97\xbca/k2R\xa9\xc5u\xf5\xae\xf9j\xe6\x85'), chr(100) + chr(0b1100101) + chr(1037 - 938) + chr(111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(0b101 + 0o157) + '\146' + '\x2d' + chr(0b111000)) * ehT0Px3KOsy9(chr(1606 - 1558) + chr(0b1101111) + chr(0b101 + 0o61), 8) + xafqLlk3kkUe(SXOLrMavuUCe(b's\x1b\xe9'), '\x64' + chr(0b1100101) + '\x63' + chr(111) + chr(4196 - 4096) + chr(0b1100101))('\165' + '\164' + chr(102) + chr(45) + chr(2053 - 1997)))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'|S\xe9I\xb2\x1d<\\\xdd8'), '\x64' + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(6886 - 6786) + chr(101))(chr(117) + chr(12035 - 11919) + chr(0b1010011 + 0o23) + chr(0b10111 + 0o26) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'sB\xe0I\xb7\x029K\xd0\n=\xfc!\x1135'), chr(0b1100100) + '\x65' + chr(99) + '\157' + '\144' + chr(5242 - 5141))('\x75' + '\164' + chr(102) + chr(0b101101) + '\070'), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b1110 + 0o42), 22463 - 22455))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
imagenet_pixelrnn_generator
|
def imagenet_pixelrnn_generator(tmp_dir,
training,
size=_IMAGENET_SMALL_IMAGE_SIZE):
"""Image generator for Imagenet 64x64 downsampled images.
It assumes that the data has been downloaded from
http://image-net.org/small/*_32x32.tar or
http://image-net.org/small/*_64x64.tar into tmp_dir.
Args:
tmp_dir: path to temporary storage directory.
training: a Boolean; if true, we use the train set, otherwise the test set.
size: image size (assumes height and width are same)
Yields:
A dictionary representing the images with the following fields:
* image/encoded: the string encoding the image as JPEG,
* image/format: the string "jpeg" representing image format,
* image/height: an integer representing the height,
* image/width: an integer representing the width.
Every field is actually a list of the corresponding type.
"""
if size == _IMAGENET_SMALL_IMAGE_SIZE:
train_prefix = _IMAGENET_SMALL_TRAIN_PREFIX
eval_prefix = _IMAGENET_SMALL_EVAL_PREFIX
else:
train_prefix = _IMAGENET_MEDIUM_TRAIN_PREFIX
eval_prefix = _IMAGENET_MEDIUM_EVAL_PREFIX
prefix = train_prefix if training else eval_prefix
images_filepath = os.path.join(tmp_dir, prefix)
image_files = tf.gfile.Glob(images_filepath + "/*")
height = size
width = size
const_label = 0
for filename in image_files:
with tf.gfile.Open(filename, "r") as f:
encoded_image = f.read()
yield {
"image/encoded": [encoded_image],
"image/format": ["png"],
"image/class/label": [const_label],
"image/height": [height],
"image/width": [width]
}
|
python
|
def imagenet_pixelrnn_generator(tmp_dir,
training,
size=_IMAGENET_SMALL_IMAGE_SIZE):
"""Image generator for Imagenet 64x64 downsampled images.
It assumes that the data has been downloaded from
http://image-net.org/small/*_32x32.tar or
http://image-net.org/small/*_64x64.tar into tmp_dir.
Args:
tmp_dir: path to temporary storage directory.
training: a Boolean; if true, we use the train set, otherwise the test set.
size: image size (assumes height and width are same)
Yields:
A dictionary representing the images with the following fields:
* image/encoded: the string encoding the image as JPEG,
* image/format: the string "jpeg" representing image format,
* image/height: an integer representing the height,
* image/width: an integer representing the width.
Every field is actually a list of the corresponding type.
"""
if size == _IMAGENET_SMALL_IMAGE_SIZE:
train_prefix = _IMAGENET_SMALL_TRAIN_PREFIX
eval_prefix = _IMAGENET_SMALL_EVAL_PREFIX
else:
train_prefix = _IMAGENET_MEDIUM_TRAIN_PREFIX
eval_prefix = _IMAGENET_MEDIUM_EVAL_PREFIX
prefix = train_prefix if training else eval_prefix
images_filepath = os.path.join(tmp_dir, prefix)
image_files = tf.gfile.Glob(images_filepath + "/*")
height = size
width = size
const_label = 0
for filename in image_files:
with tf.gfile.Open(filename, "r") as f:
encoded_image = f.read()
yield {
"image/encoded": [encoded_image],
"image/format": ["png"],
"image/class/label": [const_label],
"image/height": [height],
"image/width": [width]
}
|
[
"def",
"imagenet_pixelrnn_generator",
"(",
"tmp_dir",
",",
"training",
",",
"size",
"=",
"_IMAGENET_SMALL_IMAGE_SIZE",
")",
":",
"if",
"size",
"==",
"_IMAGENET_SMALL_IMAGE_SIZE",
":",
"train_prefix",
"=",
"_IMAGENET_SMALL_TRAIN_PREFIX",
"eval_prefix",
"=",
"_IMAGENET_SMALL_EVAL_PREFIX",
"else",
":",
"train_prefix",
"=",
"_IMAGENET_MEDIUM_TRAIN_PREFIX",
"eval_prefix",
"=",
"_IMAGENET_MEDIUM_EVAL_PREFIX",
"prefix",
"=",
"train_prefix",
"if",
"training",
"else",
"eval_prefix",
"images_filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"prefix",
")",
"image_files",
"=",
"tf",
".",
"gfile",
".",
"Glob",
"(",
"images_filepath",
"+",
"\"/*\"",
")",
"height",
"=",
"size",
"width",
"=",
"size",
"const_label",
"=",
"0",
"for",
"filename",
"in",
"image_files",
":",
"with",
"tf",
".",
"gfile",
".",
"Open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"encoded_image",
"=",
"f",
".",
"read",
"(",
")",
"yield",
"{",
"\"image/encoded\"",
":",
"[",
"encoded_image",
"]",
",",
"\"image/format\"",
":",
"[",
"\"png\"",
"]",
",",
"\"image/class/label\"",
":",
"[",
"const_label",
"]",
",",
"\"image/height\"",
":",
"[",
"height",
"]",
",",
"\"image/width\"",
":",
"[",
"width",
"]",
"}"
] |
Image generator for Imagenet 64x64 downsampled images.
It assumes that the data has been downloaded from
http://image-net.org/small/*_32x32.tar or
http://image-net.org/small/*_64x64.tar into tmp_dir.
Args:
tmp_dir: path to temporary storage directory.
training: a Boolean; if true, we use the train set, otherwise the test set.
size: image size (assumes height and width are same)
Yields:
A dictionary representing the images with the following fields:
* image/encoded: the string encoding the image as JPEG,
* image/format: the string "jpeg" representing image format,
* image/height: an integer representing the height,
* image/width: an integer representing the width.
Every field is actually a list of the corresponding type.
|
[
"Image",
"generator",
"for",
"Imagenet",
"64x64",
"downsampled",
"images",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L56-L98
|
train
|
Image generator for Imagenet 64x64 downsampled 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,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,NL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9sLammpH,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) + '\x6f' + '\x31' + chr(0b10 + 0o63) + chr(0b110101), 11577 - 11569), ehT0Px3KOsy9(chr(1338 - 1290) + chr(0b101000 + 0o107) + chr(0b110011) + chr(53) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110 + 0o54) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1533 - 1484) + chr(1161 - 1107) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(2159 - 2109) + chr(1758 - 1708) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + chr(1232 - 1181) + chr(0b110101) + chr(490 - 435), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + '\067', 56766 - 56758), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b110101) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1118 - 1065) + chr(49), 10553 - 10545), ehT0Px3KOsy9(chr(432 - 384) + '\x6f' + '\062' + chr(48) + chr(231 - 176), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b10011 + 0o41) + chr(0b101110 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + '\x31' + chr(0b1111 + 0o45) + chr(52), 8), ehT0Px3KOsy9('\x30' + chr(12294 - 12183) + chr(0b110010) + chr(1885 - 1830) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(474 - 424) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(54) + chr(296 - 246), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b11 + 0o62) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + chr(0b110010) + '\x36' + '\x33', 0o10), ehT0Px3KOsy9(chr(837 - 789) + chr(0b1100010 + 0o15) + chr(0b110100) + chr(0b11010 + 0o32), 18197 - 18189), ehT0Px3KOsy9(chr(1843 - 1795) + chr(111) + chr(0b110011) + chr(0b100101 + 0o13) + '\x30', 33293 - 33285), ehT0Px3KOsy9(chr(48) + chr(11814 - 11703) + chr(0b111 + 0o54) + chr(0b111 + 0o53) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100100 + 0o16) + '\062' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(395 - 347) + '\157' + chr(0b110011) + '\065' + chr(0b100 + 0o54), 25162 - 25154), ehT0Px3KOsy9(chr(1995 - 1947) + chr(9995 - 9884) + chr(277 - 226) + '\x32' + '\x33', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(316 - 267) + chr(0b110100) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(312 - 262) + chr(55) + chr(0b10100 + 0o41), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\x37', 21373 - 21365), ehT0Px3KOsy9(chr(1050 - 1002) + chr(0b1101111) + chr(0b110101) + '\x37', 8), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(1242 - 1131) + chr(1807 - 1758) + chr(2404 - 2351) + chr(0b110011), 11547 - 11539), ehT0Px3KOsy9(chr(1874 - 1826) + chr(0b1101111) + chr(51) + chr(0b101011 + 0o13) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9243 - 9132) + '\x32' + '\063' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(781 - 670) + '\x32' + chr(0b101010 + 0o11) + '\064', 47842 - 47834), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(560 - 509) + chr(0b100001 + 0o25) + chr(2772 - 2719), 41984 - 41976), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1835 - 1785) + chr(1416 - 1363) + chr(0b10 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1516 - 1461) + chr(0b110 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(633 - 585) + chr(0b10000 + 0o137) + chr(0b110010) + chr(55) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(54) + chr(2266 - 2218), 25521 - 25513), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11111 + 0o23) + '\x32' + chr(0b1100 + 0o47), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1247 - 1196) + '\066' + chr(53), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + '\x30', 16953 - 16945)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'C'), chr(100) + chr(0b100111 + 0o76) + '\x63' + '\157' + chr(0b1100100) + chr(101))('\x75' + '\x74' + '\146' + chr(1041 - 996) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Sa4wjAttWJAA(JsZ36NJUqtml, H15mhcYcioqz, NLcc3BCJnQka=UJVg681ECKx9):
if NLcc3BCJnQka == UJVg681ECKx9:
plUgZwY9Ztai = tZBJrptyJe9G
BeYBnDj3FZux = h9YDr_rbK7ny
else:
plUgZwY9Ztai = YQ93XEp4szUg
BeYBnDj3FZux = rDzNWv_ewcGV
K1Ha0XjJTAE7 = plUgZwY9Ztai if H15mhcYcioqz else BeYBnDj3FZux
zX6HJW1Us1RL = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, K1Ha0XjJTAE7)
sxe9ObnmYNO9 = IDJ2eXGCBCDu.gfile.Glob(zX6HJW1Us1RL + xafqLlk3kkUe(SXOLrMavuUCe(b'B\xc3'), chr(100) + chr(0b111011 + 0o52) + '\x63' + '\157' + '\144' + chr(101))('\x75' + '\x74' + '\146' + chr(0b101101) + chr(3086 - 3030)))
ehbUULKuygfC = NLcc3BCJnQka
mPx09rBTrGXR = NLcc3BCJnQka
HiwLRfJBkSYN = ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(570 - 522), 16543 - 16535)
for xw4DsBfIJ22E in sxe9ObnmYNO9:
with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'"\x99wl'), chr(100) + '\145' + chr(7408 - 7309) + chr(10837 - 10726) + chr(100) + chr(0b1000110 + 0o37))('\x75' + chr(0b1011110 + 0o26) + chr(0b111011 + 0o53) + chr(833 - 788) + chr(56)))(xw4DsBfIJ22E, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f'), chr(100) + '\x65' + '\143' + chr(0b1001 + 0o146) + '\144' + chr(0b101101 + 0o70))(chr(0b1110101) + '\164' + chr(0b10010 + 0o124) + chr(0b101101) + chr(0b100001 + 0o27))) as EGyt1xfPT1P6:
eYBxH32HV_iQ = EGyt1xfPT1P6.U6MiWrhuCi2Y()
yield {xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x84se\x13\xbd\x8aA\x8dF\xe3b\x00'), '\144' + chr(7523 - 7422) + '\x63' + chr(0b1011100 + 0o23) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b110 + 0o47) + chr(0b110111 + 0o1)): [eYBxH32HV_iQ], xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x84se\x13\xbd\x89@\x9cD\xe6s'), chr(100) + '\145' + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(5168 - 5067))('\x75' + chr(3202 - 3086) + '\x66' + chr(0b101101) + chr(0b111000)): [xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\x87u'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b1010110 + 0o17))('\x75' + '\164' + chr(9403 - 9301) + chr(0b111 + 0o46) + '\070')], xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x84se\x13\xbd\x8cC\x8fZ\xf4(\x08\x05\xd9\xf3\x1e'), chr(0b1100100) + '\145' + chr(0b10010 + 0o121) + chr(0b1101111) + chr(100) + '\145')('\165' + '\164' + chr(0b11 + 0o143) + chr(0b101101) + chr(451 - 395)): [HiwLRfJBkSYN], xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x84se\x13\xbd\x87J\x87N\xefs'), chr(100) + chr(0b1100101) + chr(0b110111 + 0o54) + chr(0b110101 + 0o72) + chr(3527 - 3427) + '\145')('\x75' + chr(116) + chr(0b1100110) + chr(45) + chr(3112 - 3056)): [ehbUULKuygfC], xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x84se\x13\xbd\x98F\x8a]\xef'), '\144' + chr(0b1100101) + chr(0b0 + 0o143) + chr(8432 - 8321) + '\x64' + '\x65')(chr(117) + chr(625 - 509) + '\x66' + chr(0b101101) + chr(2932 - 2876)): [mPx09rBTrGXR]}
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
imagenet_preprocess_example
|
def imagenet_preprocess_example(example, mode, resize_size=None,
normalize=True):
"""Preprocessing used for Imagenet and similar problems."""
resize_size = resize_size or [299, 299]
assert resize_size[0] == resize_size[1]
image = example["inputs"]
if mode == tf.estimator.ModeKeys.TRAIN:
image = preprocess_for_train(image, image_size=resize_size[0],
normalize=normalize)
else:
image = preprocess_for_eval(image, image_size=resize_size[0],
normalize=normalize)
example["inputs"] = image
return example
|
python
|
def imagenet_preprocess_example(example, mode, resize_size=None,
normalize=True):
"""Preprocessing used for Imagenet and similar problems."""
resize_size = resize_size or [299, 299]
assert resize_size[0] == resize_size[1]
image = example["inputs"]
if mode == tf.estimator.ModeKeys.TRAIN:
image = preprocess_for_train(image, image_size=resize_size[0],
normalize=normalize)
else:
image = preprocess_for_eval(image, image_size=resize_size[0],
normalize=normalize)
example["inputs"] = image
return example
|
[
"def",
"imagenet_preprocess_example",
"(",
"example",
",",
"mode",
",",
"resize_size",
"=",
"None",
",",
"normalize",
"=",
"True",
")",
":",
"resize_size",
"=",
"resize_size",
"or",
"[",
"299",
",",
"299",
"]",
"assert",
"resize_size",
"[",
"0",
"]",
"==",
"resize_size",
"[",
"1",
"]",
"image",
"=",
"example",
"[",
"\"inputs\"",
"]",
"if",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
":",
"image",
"=",
"preprocess_for_train",
"(",
"image",
",",
"image_size",
"=",
"resize_size",
"[",
"0",
"]",
",",
"normalize",
"=",
"normalize",
")",
"else",
":",
"image",
"=",
"preprocess_for_eval",
"(",
"image",
",",
"image_size",
"=",
"resize_size",
"[",
"0",
"]",
",",
"normalize",
"=",
"normalize",
")",
"example",
"[",
"\"inputs\"",
"]",
"=",
"image",
"return",
"example"
] |
Preprocessing used for Imagenet and similar problems.
|
[
"Preprocessing",
"used",
"for",
"Imagenet",
"and",
"similar",
"problems",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L101-L116
|
train
|
Preprocessing used for Imagenet and similar problems.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOd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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(3978 - 3867) + chr(513 - 464) + chr(1226 - 1171), 65455 - 65447), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(684 - 634) + chr(259 - 204) + '\x30', 13682 - 13674), ehT0Px3KOsy9(chr(1470 - 1422) + chr(0b1101111) + chr(1008 - 958) + chr(357 - 304) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4821 - 4710) + '\061' + '\x32' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(10474 - 10363) + chr(51) + chr(0b110110) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(526 - 478), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3492 - 3381) + '\061' + '\062' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111000 + 0o67) + chr(0b100110 + 0o15) + '\063' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x32' + chr(2307 - 2254), 8), ehT0Px3KOsy9(chr(2256 - 2208) + chr(111) + '\063' + chr(0b101001 + 0o14), 4220 - 4212), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(1051 - 997) + chr(0b10001 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11000 + 0o37) + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9('\060' + chr(9357 - 9246) + chr(1464 - 1413) + chr(1239 - 1190) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(250 - 200) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b1000 + 0o56), 57143 - 57135), ehT0Px3KOsy9(chr(212 - 164) + chr(111) + chr(830 - 780) + chr(1737 - 1682) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(224 - 174) + chr(0b100001 + 0o20) + chr(527 - 477), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + chr(49) + '\066' + '\067', 8), ehT0Px3KOsy9(chr(1902 - 1854) + '\157' + chr(0b110011) + chr(164 - 111) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(9408 - 9297) + chr(512 - 459) + chr(1357 - 1305), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100101 + 0o22) + chr(0b11110 + 0o22), 47869 - 47861), ehT0Px3KOsy9('\060' + chr(11704 - 11593) + chr(50) + chr(0b10010 + 0o37) + chr(131 - 79), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(320 - 271) + chr(310 - 256) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2181 - 2132) + chr(2259 - 2204) + chr(49), 35915 - 35907), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1010 + 0o51) + '\067' + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(646 - 594) + chr(514 - 463), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + chr(0b100110 + 0o20) + '\x37', 0o10), ehT0Px3KOsy9(chr(138 - 90) + chr(10556 - 10445) + chr(1563 - 1513) + chr(352 - 298) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1000 + 0o52) + '\064' + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\061' + chr(50), 8), ehT0Px3KOsy9(chr(48) + chr(0b10 + 0o155) + '\063' + chr(0b1000 + 0o53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b110010 + 0o75) + '\x32' + chr(1678 - 1630) + chr(0b100001 + 0o26), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3167 - 3056) + chr(421 - 370) + chr(48) + chr(219 - 171), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1001 + 0o146) + chr(872 - 817) + chr(0b110100 + 0o0), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(2106 - 2057) + '\x32', 8), ehT0Px3KOsy9(chr(0b110000) + chr(1548 - 1437) + chr(0b110110), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\x37' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b110011) + '\x35', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(11629 - 11518) + chr(0b110101) + chr(1987 - 1939), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'!'), chr(4804 - 4704) + '\145' + chr(782 - 683) + chr(111) + chr(0b100101 + 0o77) + chr(0b1011101 + 0o10))(chr(117) + chr(0b1101101 + 0o7) + chr(102) + chr(0b101011 + 0o2) + chr(0b110000 + 0o10)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def kRmBjGKzOPMO(kP4qaKv0ZkGv, holLFgwB7vsP, p0u8W1Kk0taZ=None, IOBK62gJSlOh=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001), 0o10)):
p0u8W1Kk0taZ = p0u8W1Kk0taZ or [ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + chr(52) + chr(0b110101) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34' + chr(0b110101) + chr(0b110011), 8)]
assert p0u8W1Kk0taZ[ehT0Px3KOsy9('\x30' + '\157' + '\x30', 0o10)] == p0u8W1Kk0taZ[ehT0Px3KOsy9('\060' + '\157' + '\x31', 8)]
IdmAHWfCqrnp = kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'f\xd6\xd8!\x87]'), '\x64' + chr(5122 - 5021) + '\x63' + '\157' + chr(0b1001110 + 0o26) + chr(0b1000001 + 0o44))(chr(12520 - 12403) + '\164' + chr(7097 - 6995) + chr(0b101101) + chr(0b111000))]
if holLFgwB7vsP == xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'[\xea\xe9\x1d\xbd'), '\x64' + '\x65' + chr(99) + chr(1678 - 1567) + chr(100) + chr(0b1100101))(chr(0b100 + 0o161) + '\164' + chr(0b1100110) + chr(1651 - 1606) + '\070')):
IdmAHWfCqrnp = CH4o4HTh9JWi(IdmAHWfCqrnp, image_size=p0u8W1Kk0taZ[ehT0Px3KOsy9(chr(48) + '\157' + '\060', 8)], normalize=IOBK62gJSlOh)
else:
IdmAHWfCqrnp = kO9XwQawfgDg(IdmAHWfCqrnp, image_size=p0u8W1Kk0taZ[ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(48), 8)], normalize=IOBK62gJSlOh)
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'f\xd6\xd8!\x87]'), '\144' + '\145' + chr(0b1100011) + chr(7728 - 7617) + chr(0b1000 + 0o134) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(779 - 677) + '\x2d' + chr(0b111000))] = IdmAHWfCqrnp
return kP4qaKv0ZkGv
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
_crop
|
def _crop(image, offset_height, offset_width, crop_height, crop_width):
"""Crops the given image using the provided offsets and sizes.
Note that the method doesn't assume we know the input image size but it does
assume we know the input image rank.
Args:
image: `Tensor` image of shape [height, width, channels].
offset_height: `Tensor` indicating the height offset.
offset_width: `Tensor` indicating the width offset.
crop_height: the height of the cropped image.
crop_width: the width of the cropped image.
Returns:
the cropped (and resized) image.
Raises:
InvalidArgumentError: if the rank is not 3 or if the image dimensions are
less than the crop size.
"""
original_shape = tf.shape(image)
rank_assertion = tf.Assert(
tf.equal(tf.rank(image), 3), ["Rank of image must be equal to 3."])
with tf.control_dependencies([rank_assertion]):
cropped_shape = tf.stack([crop_height, crop_width, original_shape[2]])
size_assertion = tf.Assert(
tf.logical_and(
tf.greater_equal(original_shape[0], crop_height),
tf.greater_equal(original_shape[1], crop_width)),
["Crop size greater than the image size."])
offsets = tf.to_int32(tf.stack([offset_height, offset_width, 0]))
# Use tf.slice instead of crop_to_bounding box as it accepts tensors to
# define the crop size.
with tf.control_dependencies([size_assertion]):
image = tf.slice(image, offsets, cropped_shape)
return tf.reshape(image, cropped_shape)
|
python
|
def _crop(image, offset_height, offset_width, crop_height, crop_width):
"""Crops the given image using the provided offsets and sizes.
Note that the method doesn't assume we know the input image size but it does
assume we know the input image rank.
Args:
image: `Tensor` image of shape [height, width, channels].
offset_height: `Tensor` indicating the height offset.
offset_width: `Tensor` indicating the width offset.
crop_height: the height of the cropped image.
crop_width: the width of the cropped image.
Returns:
the cropped (and resized) image.
Raises:
InvalidArgumentError: if the rank is not 3 or if the image dimensions are
less than the crop size.
"""
original_shape = tf.shape(image)
rank_assertion = tf.Assert(
tf.equal(tf.rank(image), 3), ["Rank of image must be equal to 3."])
with tf.control_dependencies([rank_assertion]):
cropped_shape = tf.stack([crop_height, crop_width, original_shape[2]])
size_assertion = tf.Assert(
tf.logical_and(
tf.greater_equal(original_shape[0], crop_height),
tf.greater_equal(original_shape[1], crop_width)),
["Crop size greater than the image size."])
offsets = tf.to_int32(tf.stack([offset_height, offset_width, 0]))
# Use tf.slice instead of crop_to_bounding box as it accepts tensors to
# define the crop size.
with tf.control_dependencies([size_assertion]):
image = tf.slice(image, offsets, cropped_shape)
return tf.reshape(image, cropped_shape)
|
[
"def",
"_crop",
"(",
"image",
",",
"offset_height",
",",
"offset_width",
",",
"crop_height",
",",
"crop_width",
")",
":",
"original_shape",
"=",
"tf",
".",
"shape",
"(",
"image",
")",
"rank_assertion",
"=",
"tf",
".",
"Assert",
"(",
"tf",
".",
"equal",
"(",
"tf",
".",
"rank",
"(",
"image",
")",
",",
"3",
")",
",",
"[",
"\"Rank of image must be equal to 3.\"",
"]",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"rank_assertion",
"]",
")",
":",
"cropped_shape",
"=",
"tf",
".",
"stack",
"(",
"[",
"crop_height",
",",
"crop_width",
",",
"original_shape",
"[",
"2",
"]",
"]",
")",
"size_assertion",
"=",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_and",
"(",
"tf",
".",
"greater_equal",
"(",
"original_shape",
"[",
"0",
"]",
",",
"crop_height",
")",
",",
"tf",
".",
"greater_equal",
"(",
"original_shape",
"[",
"1",
"]",
",",
"crop_width",
")",
")",
",",
"[",
"\"Crop size greater than the image size.\"",
"]",
")",
"offsets",
"=",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"stack",
"(",
"[",
"offset_height",
",",
"offset_width",
",",
"0",
"]",
")",
")",
"# Use tf.slice instead of crop_to_bounding box as it accepts tensors to",
"# define the crop size.",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"size_assertion",
"]",
")",
":",
"image",
"=",
"tf",
".",
"slice",
"(",
"image",
",",
"offsets",
",",
"cropped_shape",
")",
"return",
"tf",
".",
"reshape",
"(",
"image",
",",
"cropped_shape",
")"
] |
Crops the given image using the provided offsets and sizes.
Note that the method doesn't assume we know the input image size but it does
assume we know the input image rank.
Args:
image: `Tensor` image of shape [height, width, channels].
offset_height: `Tensor` indicating the height offset.
offset_width: `Tensor` indicating the width offset.
crop_height: the height of the cropped image.
crop_width: the width of the cropped image.
Returns:
the cropped (and resized) image.
Raises:
InvalidArgumentError: if the rank is not 3 or if the image dimensions are
less than the crop size.
|
[
"Crops",
"the",
"given",
"image",
"using",
"the",
"provided",
"offsets",
"and",
"sizes",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L427-L466
|
train
|
Crops the given image using the provided offsets and sizes.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVH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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(0b111 + 0o51) + '\x6f' + chr(0b110110) + chr(0b110100), 58681 - 58673), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + chr(1918 - 1869) + chr(0b100101 + 0o13) + chr(54), 59053 - 59045), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(0b11100 + 0o27) + chr(0b11011 + 0o32) + '\x31', 48556 - 48548), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(988 - 936) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + '\062' + '\x33' + '\x30', 0b1000), ehT0Px3KOsy9(chr(602 - 554) + chr(0b1101111) + chr(0b10010 + 0o40) + chr(0b100101 + 0o15) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110100) + '\060', 39938 - 39930), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(6058 - 5947) + chr(0b110001) + '\x35' + '\x36', 0o10), ehT0Px3KOsy9(chr(1714 - 1666) + '\x6f' + chr(933 - 880) + chr(1324 - 1274), ord("\x08")), ehT0Px3KOsy9(chr(1740 - 1692) + '\157' + chr(0b110001) + chr(0b100100 + 0o14) + chr(331 - 278), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100000 + 0o26) + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\x36' + '\x35', 0o10), ehT0Px3KOsy9(chr(384 - 336) + chr(0b1101111) + chr(0b100110 + 0o13) + chr(1538 - 1485) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110100) + chr(0b1010 + 0o47), 1087 - 1079), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b101110 + 0o11) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\063' + '\060' + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(909 - 798) + '\067' + chr(0b110000), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b110100) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\x36' + '\x35', 8), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + chr(50) + chr(0b110101) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + '\x32' + '\x32' + chr(2460 - 2409), 26554 - 26546), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(51) + chr(0b11110 + 0o31), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100110 + 0o11) + '\062' + '\067' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(7526 - 7415) + chr(0b100111 + 0o12) + chr(0b11010 + 0o33) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(470 - 359) + '\x34' + chr(0b1101 + 0o45), 0o10), ehT0Px3KOsy9(chr(1616 - 1568) + '\x6f' + '\062' + '\063' + chr(0b11101 + 0o25), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(50) + '\066', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\x32' + chr(2641 - 2588) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(0b110011) + chr(0b110000 + 0o1) + chr(0b110011), 34182 - 34174), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1718 - 1667) + chr(0b110001) + chr(55), 0b1000), ehT0Px3KOsy9(chr(351 - 303) + '\157' + chr(1253 - 1201) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(1628 - 1573) + chr(756 - 707), ord("\x08")), ehT0Px3KOsy9('\060' + chr(906 - 795) + '\x33' + '\x36' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\061' + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101 + 0o54) + '\x35' + chr(54), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11101 + 0o25) + '\x35' + chr(0b110011), 50233 - 50225), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + chr(2449 - 2399) + chr(0b101011 + 0o7) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(672 - 561) + '\x32' + '\062' + '\065', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000 + 0o2) + '\x37', 0b1000), ehT0Px3KOsy9(chr(202 - 154) + '\x6f' + chr(0b110011) + chr(0b110110) + chr(1468 - 1418), 16436 - 16428)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1100111 + 0o10) + chr(0b110101) + chr(0b11010 + 0o26), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a'), chr(100) + '\x65' + chr(0b1100011) + '\x6f' + '\x64' + chr(0b1100101))(chr(117) + chr(0b11111 + 0o125) + chr(4403 - 4301) + chr(164 - 119) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RNTi1v1ffiS8(IdmAHWfCqrnp, lqAVIQ72_nsh, r_toKUo8V0Nu, _cvCrvGpVC_w, EZN7g_yhfVX3):
uoX0EqIBJxTx = IDJ2eXGCBCDu.nauYfLglTpcb(IdmAHWfCqrnp)
HePkhxWEVeqV = IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.equal(IDJ2eXGCBCDu.rank(IdmAHWfCqrnp), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b110011), ord("\x08"))), [xafqLlk3kkUe(SXOLrMavuUCe(b"f'\x87\x08\xb8\xf9\x06NC(Q\x92\r\x01U\xb1K\x12\xd5\xcb\xf6\xbf\xdc\x1eW\xfb:\x8f\xbf\xa0\x00\xca\xd8"), chr(100) + '\x65' + '\143' + chr(0b1110 + 0o141) + chr(0b1100100) + chr(0b10011 + 0o122))('\x75' + '\x74' + chr(2722 - 2620) + chr(0b1100 + 0o41) + chr(0b111000))])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W)\x87\x17\xea\xf9\x0c1N @\x90\x06E]\xaa[\x0f\x90\xda'), chr(100) + chr(0b101011 + 0o72) + chr(99) + chr(0b1001 + 0o146) + '\144' + chr(8000 - 7899))(chr(117) + chr(9931 - 9815) + chr(102) + chr(0b100011 + 0o12) + '\070'))([HePkhxWEVeqV]):
kIdYGBz9wKeo = IDJ2eXGCBCDu.stack([_cvCrvGpVC_w, EZN7g_yhfVX3, uoX0EqIBJxTx[ehT0Px3KOsy9(chr(48) + chr(111) + '\x32', ord("\x08"))]])
MRznW4s2HU28 = IDJ2eXGCBCDu.Assert(IDJ2eXGCBCDu.logical_and(IDJ2eXGCBCDu.greater_equal(uoX0EqIBJxTx[ehT0Px3KOsy9(chr(540 - 492) + '\x6f' + chr(276 - 228), 0o10)], _cvCrvGpVC_w), IDJ2eXGCBCDu.greater_equal(uoX0EqIBJxTx[ehT0Px3KOsy9(chr(2246 - 2198) + chr(0b1101111) + chr(0b110001), ord("\x08"))], EZN7g_yhfVX3)), [xafqLlk3kkUe(SXOLrMavuUCe(b'w4\x86\x13\xb8\xe5\t\x14OeW\x87\r@L\xa1JF\x81\xc1\xf2\xf1\x99\x1bJ\xffv\xc6\xa6\xaeG\x9c\xd6\xfd\x07\xd1\xf0\xbb'), chr(0b1100100) + chr(101) + chr(9687 - 9588) + '\x6f' + chr(100) + '\145')(chr(117) + chr(5621 - 5505) + chr(102) + chr(1055 - 1010) + chr(0b111000))])
m6XSiwJFJw1f = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.stack([lqAVIQ72_nsh, r_toKUo8V0Nu, ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + chr(48), 8)]))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W)\x87\x17\xea\xf9\x0c1N @\x90\x06E]\xaa[\x0f\x90\xda'), chr(0b100000 + 0o104) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(5863 - 5763) + chr(0b1100101))('\x75' + chr(2684 - 2568) + chr(102) + '\055' + chr(574 - 518)))([MRznW4s2HU28]):
IdmAHWfCqrnp = IDJ2eXGCBCDu.slice(IdmAHWfCqrnp, m6XSiwJFJw1f, kIdYGBz9wKeo)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'F#\x9a\x0b\xf9\xe6\x05'), chr(0b1101 + 0o127) + chr(0b101111 + 0o66) + chr(7037 - 6938) + '\x6f' + chr(100) + '\145')('\x75' + chr(116) + chr(0b1111 + 0o127) + chr(45) + '\x38'))(IdmAHWfCqrnp, kIdYGBz9wKeo)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
distorted_bounding_box_crop
|
def distorted_bounding_box_crop(image,
bbox,
min_object_covered=0.1,
aspect_ratio_range=(0.75, 1.33),
area_range=(0.05, 1.0),
max_attempts=100,
scope=None):
"""Generates cropped_image using a one of the bboxes randomly distorted.
See `tf.image.sample_distorted_bounding_box` for more documentation.
Args:
image: `Tensor` of image (it will be converted to floats in [0, 1]).
bbox: `Tensor` of bounding boxes arranged `[1, num_boxes, coords]`
where each coordinate is [0, 1) and the coordinates are arranged
as `[ymin, xmin, ymax, xmax]`. If num_boxes is 0 then use the whole
image.
min_object_covered: An optional `float`. Defaults to `0.1`. The cropped
area of the image must contain at least this fraction of any bounding
box supplied.
aspect_ratio_range: An optional list of `float`s. The cropped area of the
image must have an aspect ratio = width / height within this range.
area_range: An optional list of `float`s. The cropped area of the image
must contain a fraction of the supplied image within in this range.
max_attempts: An optional `int`. Number of attempts at generating a cropped
region of the image of the specified constraints. After `max_attempts`
failures, return the entire image.
scope: Optional `str` for name scope.
Returns:
(cropped image `Tensor`, distorted bbox `Tensor`).
"""
with tf.name_scope(scope, default_name="distorted_bounding_box_crop",
values=[image, bbox]):
# Each bounding box has shape [1, num_boxes, box coords] and
# the coordinates are ordered [ymin, xmin, ymax, xmax].
# A large fraction of image datasets contain a human-annotated bounding
# box delineating the region of the image containing the object of interest.
# We choose to create a new bounding box for the object which is a randomly
# distorted version of the human-annotated bounding box that obeys an
# allowed range of aspect ratios, sizes and overlap with the human-annotated
# bounding box. If no box is supplied, then we assume the bounding box is
# the entire image.
sample_distorted_bounding_box = tf.image.sample_distorted_bounding_box(
tf.shape(image),
bounding_boxes=bbox,
min_object_covered=min_object_covered,
aspect_ratio_range=aspect_ratio_range,
area_range=area_range,
max_attempts=max_attempts,
use_image_if_no_bounding_boxes=True)
bbox_begin, bbox_size, distort_bbox = sample_distorted_bounding_box
# Crop the image to the specified bounding box.
cropped_image = tf.slice(image, bbox_begin, bbox_size)
return cropped_image, distort_bbox
|
python
|
def distorted_bounding_box_crop(image,
bbox,
min_object_covered=0.1,
aspect_ratio_range=(0.75, 1.33),
area_range=(0.05, 1.0),
max_attempts=100,
scope=None):
"""Generates cropped_image using a one of the bboxes randomly distorted.
See `tf.image.sample_distorted_bounding_box` for more documentation.
Args:
image: `Tensor` of image (it will be converted to floats in [0, 1]).
bbox: `Tensor` of bounding boxes arranged `[1, num_boxes, coords]`
where each coordinate is [0, 1) and the coordinates are arranged
as `[ymin, xmin, ymax, xmax]`. If num_boxes is 0 then use the whole
image.
min_object_covered: An optional `float`. Defaults to `0.1`. The cropped
area of the image must contain at least this fraction of any bounding
box supplied.
aspect_ratio_range: An optional list of `float`s. The cropped area of the
image must have an aspect ratio = width / height within this range.
area_range: An optional list of `float`s. The cropped area of the image
must contain a fraction of the supplied image within in this range.
max_attempts: An optional `int`. Number of attempts at generating a cropped
region of the image of the specified constraints. After `max_attempts`
failures, return the entire image.
scope: Optional `str` for name scope.
Returns:
(cropped image `Tensor`, distorted bbox `Tensor`).
"""
with tf.name_scope(scope, default_name="distorted_bounding_box_crop",
values=[image, bbox]):
# Each bounding box has shape [1, num_boxes, box coords] and
# the coordinates are ordered [ymin, xmin, ymax, xmax].
# A large fraction of image datasets contain a human-annotated bounding
# box delineating the region of the image containing the object of interest.
# We choose to create a new bounding box for the object which is a randomly
# distorted version of the human-annotated bounding box that obeys an
# allowed range of aspect ratios, sizes and overlap with the human-annotated
# bounding box. If no box is supplied, then we assume the bounding box is
# the entire image.
sample_distorted_bounding_box = tf.image.sample_distorted_bounding_box(
tf.shape(image),
bounding_boxes=bbox,
min_object_covered=min_object_covered,
aspect_ratio_range=aspect_ratio_range,
area_range=area_range,
max_attempts=max_attempts,
use_image_if_no_bounding_boxes=True)
bbox_begin, bbox_size, distort_bbox = sample_distorted_bounding_box
# Crop the image to the specified bounding box.
cropped_image = tf.slice(image, bbox_begin, bbox_size)
return cropped_image, distort_bbox
|
[
"def",
"distorted_bounding_box_crop",
"(",
"image",
",",
"bbox",
",",
"min_object_covered",
"=",
"0.1",
",",
"aspect_ratio_range",
"=",
"(",
"0.75",
",",
"1.33",
")",
",",
"area_range",
"=",
"(",
"0.05",
",",
"1.0",
")",
",",
"max_attempts",
"=",
"100",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"default_name",
"=",
"\"distorted_bounding_box_crop\"",
",",
"values",
"=",
"[",
"image",
",",
"bbox",
"]",
")",
":",
"# Each bounding box has shape [1, num_boxes, box coords] and",
"# the coordinates are ordered [ymin, xmin, ymax, xmax].",
"# A large fraction of image datasets contain a human-annotated bounding",
"# box delineating the region of the image containing the object of interest.",
"# We choose to create a new bounding box for the object which is a randomly",
"# distorted version of the human-annotated bounding box that obeys an",
"# allowed range of aspect ratios, sizes and overlap with the human-annotated",
"# bounding box. If no box is supplied, then we assume the bounding box is",
"# the entire image.",
"sample_distorted_bounding_box",
"=",
"tf",
".",
"image",
".",
"sample_distorted_bounding_box",
"(",
"tf",
".",
"shape",
"(",
"image",
")",
",",
"bounding_boxes",
"=",
"bbox",
",",
"min_object_covered",
"=",
"min_object_covered",
",",
"aspect_ratio_range",
"=",
"aspect_ratio_range",
",",
"area_range",
"=",
"area_range",
",",
"max_attempts",
"=",
"max_attempts",
",",
"use_image_if_no_bounding_boxes",
"=",
"True",
")",
"bbox_begin",
",",
"bbox_size",
",",
"distort_bbox",
"=",
"sample_distorted_bounding_box",
"# Crop the image to the specified bounding box.",
"cropped_image",
"=",
"tf",
".",
"slice",
"(",
"image",
",",
"bbox_begin",
",",
"bbox_size",
")",
"return",
"cropped_image",
",",
"distort_bbox"
] |
Generates cropped_image using a one of the bboxes randomly distorted.
See `tf.image.sample_distorted_bounding_box` for more documentation.
Args:
image: `Tensor` of image (it will be converted to floats in [0, 1]).
bbox: `Tensor` of bounding boxes arranged `[1, num_boxes, coords]`
where each coordinate is [0, 1) and the coordinates are arranged
as `[ymin, xmin, ymax, xmax]`. If num_boxes is 0 then use the whole
image.
min_object_covered: An optional `float`. Defaults to `0.1`. The cropped
area of the image must contain at least this fraction of any bounding
box supplied.
aspect_ratio_range: An optional list of `float`s. The cropped area of the
image must have an aspect ratio = width / height within this range.
area_range: An optional list of `float`s. The cropped area of the image
must contain a fraction of the supplied image within in this range.
max_attempts: An optional `int`. Number of attempts at generating a cropped
region of the image of the specified constraints. After `max_attempts`
failures, return the entire image.
scope: Optional `str` for name scope.
Returns:
(cropped image `Tensor`, distorted bbox `Tensor`).
|
[
"Generates",
"cropped_image",
"using",
"a",
"one",
"of",
"the",
"bboxes",
"randomly",
"distorted",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L469-L524
|
train
|
Generates a random cropped image using a bounding box.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9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P6_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(0b11110 + 0o22) + '\157' + chr(1382 - 1331) + chr(0b110100) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b111 + 0o60) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b1111 + 0o43) + chr(1570 - 1517), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011101 + 0o22) + '\x33' + chr(0b110110) + chr(0b110110), 44404 - 44396), ehT0Px3KOsy9(chr(352 - 304) + '\157' + chr(1779 - 1730) + chr(0b101001 + 0o7) + chr(0b11001 + 0o33), 14106 - 14098), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(50) + chr(0b110100 + 0o3) + chr(0b101110 + 0o7), 51205 - 51197), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + chr(569 - 519) + '\065' + chr(526 - 473), 0o10), ehT0Px3KOsy9(chr(165 - 117) + chr(111) + '\x32' + chr(0b1010 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(2201 - 2148) + chr(1243 - 1188), 11097 - 11089), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + chr(0b110011) + chr(343 - 295) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(2233 - 2185) + chr(0b11100 + 0o123) + chr(0b110001) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(1057 - 1005), 50435 - 50427), ehT0Px3KOsy9('\x30' + chr(111) + chr(54) + chr(0b10010 + 0o42), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11100 + 0o123) + chr(0b100000 + 0o21) + chr(0b1110 + 0o47) + chr(0b11111 + 0o26), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b110010) + chr(1755 - 1706), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9531 - 9420) + '\x33' + chr(0b11111 + 0o21) + chr(2032 - 1983), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110111) + '\x35', 32762 - 32754), ehT0Px3KOsy9(chr(1072 - 1024) + '\x6f' + '\061' + chr(0b110111) + chr(1139 - 1086), 23983 - 23975), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(49) + '\x34' + chr(0b111 + 0o52), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\067' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(775 - 727) + '\157' + '\062' + chr(1645 - 1595) + chr(0b11100 + 0o31), 8), ehT0Px3KOsy9('\x30' + chr(10499 - 10388) + '\062' + chr(0b110000) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b110001) + chr(0b10001 + 0o42), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(0b11110 + 0o23) + '\x37' + '\064', 34983 - 34975), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(1478 - 1423), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + '\063' + chr(1308 - 1254) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(1143 - 1032) + '\063' + '\x36' + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1917 - 1867) + chr(0b110010) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b11010 + 0o125) + '\x33' + chr(0b101111 + 0o10) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + '\x31' + chr(52) + chr(0b1110 + 0o43), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(1952 - 1903) + chr(2626 - 2571) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b110101 + 0o72) + chr(0b10111 + 0o32) + chr(52) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(10174 - 10063) + chr(0b110110) + chr(0b11 + 0o56), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11000 + 0o33) + chr(0b11011 + 0o30), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\x31' + '\066', 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + chr(0b110110) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(632 - 584) + '\157' + '\067' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010000 + 0o37) + '\x33' + chr(0b0 + 0o60) + '\x32', 0b1000), ehT0Px3KOsy9(chr(325 - 277) + chr(111) + chr(0b110001 + 0o0) + chr(1308 - 1260) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + '\x33' + '\x32' + '\x31', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1126 - 1078) + '\157' + chr(53) + chr(1386 - 1338), 49056 - 49048)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xca'), chr(0b1100100) + chr(4800 - 4699) + chr(0b111111 + 0o44) + chr(11159 - 11048) + chr(0b1100100) + chr(5443 - 5342))('\165' + chr(116) + chr(102) + chr(774 - 729) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def wasSE_MphSDZ(IdmAHWfCqrnp, HdQfPnA6nf66, kkburzGUbWSD=0.1, BWq0EKLUhbB8=(0.75, 1.33), coyk6vqtga2P=(0.05, 1.0), tzEXo_Lvh8Tj=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1492 - 1443) + chr(52) + chr(0b110100), 33261 - 33253), CJBHNoj4zKoT=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a^\xf8\x93\x1b\xce\xcey\xdf\xa0'), chr(0b1011001 + 0o13) + '\145' + chr(99) + chr(111) + chr(0b1100100) + chr(9734 - 9633))('\165' + chr(0b1001111 + 0o45) + chr(7475 - 7373) + chr(601 - 556) + '\070'))(CJBHNoj4zKoT, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x80V\xe6\x82+\xcf\xd9s\xcb\x9alsA\x035\xa8\x93\x1a>_\xfa\xfd\x14\x1f}\x9d\x86'), chr(0b1100100) + chr(101) + chr(7324 - 7225) + '\x6f' + chr(1247 - 1147) + chr(0b1100101))('\165' + chr(0b1001011 + 0o51) + chr(0b1001101 + 0o31) + '\055' + chr(0b111000)), values=[IdmAHWfCqrnp, HdQfPnA6nf66]):
_anB069SjDYh = IDJ2eXGCBCDu.image.sample_distorted_bounding_box(IDJ2eXGCBCDu.nauYfLglTpcb(IdmAHWfCqrnp), bounding_boxes=HdQfPnA6nf66, min_object_covered=kkburzGUbWSD, aspect_ratio_range=BWq0EKLUhbB8, area_range=coyk6vqtga2P, max_attempts=tzEXo_Lvh8Tj, use_image_if_no_bounding_boxes=ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 0b1000))
(r1A0OwfpJkz4, JQHFIGe8RqmO, q8TaQUTSHAaR) = _anB069SjDYh
wGxet3TSzH71 = IDJ2eXGCBCDu.slice(IdmAHWfCqrnp, r1A0OwfpJkz4, JQHFIGe8RqmO)
return (wGxet3TSzH71, q8TaQUTSHAaR)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
_random_crop
|
def _random_crop(image, size):
"""Make a random crop of (`size` x `size`)."""
bbox = tf.constant([0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4])
random_image, bbox = distorted_bounding_box_crop(
image,
bbox,
min_object_covered=0.1,
aspect_ratio_range=(3. / 4, 4. / 3.),
area_range=(0.08, 1.0),
max_attempts=1,
scope=None)
bad = _at_least_x_are_true(tf.shape(image), tf.shape(random_image), 3)
image = tf.cond(
bad, lambda: _center_crop(_do_scale(image, size), size),
lambda: tf.image.resize_bicubic([random_image], [size, size])[0])
return image
|
python
|
def _random_crop(image, size):
"""Make a random crop of (`size` x `size`)."""
bbox = tf.constant([0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4])
random_image, bbox = distorted_bounding_box_crop(
image,
bbox,
min_object_covered=0.1,
aspect_ratio_range=(3. / 4, 4. / 3.),
area_range=(0.08, 1.0),
max_attempts=1,
scope=None)
bad = _at_least_x_are_true(tf.shape(image), tf.shape(random_image), 3)
image = tf.cond(
bad, lambda: _center_crop(_do_scale(image, size), size),
lambda: tf.image.resize_bicubic([random_image], [size, size])[0])
return image
|
[
"def",
"_random_crop",
"(",
"image",
",",
"size",
")",
":",
"bbox",
"=",
"tf",
".",
"constant",
"(",
"[",
"0.0",
",",
"0.0",
",",
"1.0",
",",
"1.0",
"]",
",",
"dtype",
"=",
"tf",
".",
"float32",
",",
"shape",
"=",
"[",
"1",
",",
"1",
",",
"4",
"]",
")",
"random_image",
",",
"bbox",
"=",
"distorted_bounding_box_crop",
"(",
"image",
",",
"bbox",
",",
"min_object_covered",
"=",
"0.1",
",",
"aspect_ratio_range",
"=",
"(",
"3.",
"/",
"4",
",",
"4.",
"/",
"3.",
")",
",",
"area_range",
"=",
"(",
"0.08",
",",
"1.0",
")",
",",
"max_attempts",
"=",
"1",
",",
"scope",
"=",
"None",
")",
"bad",
"=",
"_at_least_x_are_true",
"(",
"tf",
".",
"shape",
"(",
"image",
")",
",",
"tf",
".",
"shape",
"(",
"random_image",
")",
",",
"3",
")",
"image",
"=",
"tf",
".",
"cond",
"(",
"bad",
",",
"lambda",
":",
"_center_crop",
"(",
"_do_scale",
"(",
"image",
",",
"size",
")",
",",
"size",
")",
",",
"lambda",
":",
"tf",
".",
"image",
".",
"resize_bicubic",
"(",
"[",
"random_image",
"]",
",",
"[",
"size",
",",
"size",
"]",
")",
"[",
"0",
"]",
")",
"return",
"image"
] |
Make a random crop of (`size` x `size`).
|
[
"Make",
"a",
"random",
"crop",
"of",
"(",
"size",
"x",
"size",
")",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L527-L543
|
train
|
Make a random crop of size x size.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,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Exception,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' + '\x32' + '\x37' + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(6646 - 6535) + chr(0b100101 + 0o15) + chr(55) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10404 - 10293) + chr(2445 - 2392), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x33' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10011 + 0o43) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(89 - 41) + chr(0b1001000 + 0o47) + chr(0b10011 + 0o37) + chr(49), 966 - 958), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(51) + chr(0b110001 + 0o3) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + '\061' + '\x37' + chr(0b100101 + 0o21), 0b1000), ehT0Px3KOsy9(chr(1266 - 1218) + '\x6f' + chr(55) + '\061', 0o10), ehT0Px3KOsy9(chr(458 - 410) + '\x6f' + chr(0b110011) + chr(49) + '\x37', 0o10), ehT0Px3KOsy9(chr(472 - 424) + '\x6f' + chr(0b10010 + 0o41) + '\x34' + chr(0b110001 + 0o4), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011 + 0o0) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\066' + chr(0b110100), 8), ehT0Px3KOsy9(chr(1689 - 1641) + '\x6f' + chr(0b110001) + chr(0b0 + 0o66) + '\x31', 27385 - 27377), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\x33' + '\064' + chr(50), 6865 - 6857), ehT0Px3KOsy9('\060' + chr(8231 - 8120) + chr(0b110001) + '\067', 38176 - 38168), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b100 + 0o56) + chr(0b100101 + 0o13) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11000 + 0o31) + chr(0b110001) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(48) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1182 - 1134) + '\x6f' + chr(0b1110 + 0o43) + chr(0b100010 + 0o22), 0b1000), ehT0Px3KOsy9(chr(639 - 591) + chr(0b1101011 + 0o4) + '\062' + chr(0b110000) + '\062', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b101000 + 0o16) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b110011) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1213 - 1161) + chr(2385 - 2336), 50258 - 50250), ehT0Px3KOsy9('\060' + chr(399 - 288) + chr(708 - 658) + '\060' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1445 - 1397) + '\157' + chr(50) + chr(2456 - 2405) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(593 - 545) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + '\x37' + '\064', 0o10), ehT0Px3KOsy9(chr(504 - 456) + chr(111) + '\x31' + chr(1056 - 1004) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(1494 - 1443) + chr(1372 - 1317), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(52) + chr(0b1100 + 0o51), 8), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(55) + chr(995 - 947), ord("\x08")), ehT0Px3KOsy9(chr(1235 - 1187) + chr(0b111111 + 0o60) + chr(55) + chr(52), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\x33' + chr(1756 - 1701), 8), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b111010 + 0o65) + '\066' + '\060', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1100 + 0o52) + '\x34', 8), ehT0Px3KOsy9(chr(1213 - 1165) + chr(0b11101 + 0o122) + chr(0b110110) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1538 - 1490) + '\157' + '\x31' + chr(1042 - 994) + '\x34', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(6977 - 6866) + chr(0b11100 + 0o31) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x93'), '\x64' + '\145' + chr(2623 - 2524) + '\x6f' + chr(0b1100100) + chr(101))('\165' + chr(0b100001 + 0o123) + '\146' + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def SXTqKFvT8s4x(IdmAHWfCqrnp, NLcc3BCJnQka):
HdQfPnA6nf66 = IDJ2eXGCBCDu.constant([0.0, 0.0, 1.0, 1.0], dtype=IDJ2eXGCBCDu.float32, shape=[ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(935 - 824) + chr(49), 8), ehT0Px3KOsy9(chr(871 - 823) + '\157' + chr(1677 - 1625), 0o10)])
(NJEpntm38oRs, HdQfPnA6nf66) = wasSE_MphSDZ(IdmAHWfCqrnp, HdQfPnA6nf66, min_object_covered=0.1, aspect_ratio_range=(3.0 / ehT0Px3KOsy9(chr(48) + '\157' + chr(1405 - 1353), 8), 4.0 / 3.0), area_range=(0.08, 1.0), max_attempts=ehT0Px3KOsy9(chr(48) + chr(9728 - 9617) + '\x31', 8), scope=None)
tCo_12qm4Bz3 = Im9WeQvQHytU(IDJ2eXGCBCDu.nauYfLglTpcb(IdmAHWfCqrnp), IDJ2eXGCBCDu.nauYfLglTpcb(NJEpntm38oRs), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b101000 + 0o13), 0b1000))
IdmAHWfCqrnp = IDJ2eXGCBCDu.cond(tCo_12qm4Bz3, lambda : mSttElOFuXlC(u_hf4CgxLI2_(IdmAHWfCqrnp, NLcc3BCJnQka), NLcc3BCJnQka), lambda : IDJ2eXGCBCDu.image.resize_bicubic([NJEpntm38oRs], [NLcc3BCJnQka, NLcc3BCJnQka])[ehT0Px3KOsy9(chr(313 - 265) + '\x6f' + chr(0b110000), ord("\x08"))])
return IdmAHWfCqrnp
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
_at_least_x_are_true
|
def _at_least_x_are_true(a, b, x):
"""At least `x` of `a` and `b` `Tensors` are true."""
match = tf.equal(a, b)
match = tf.cast(match, tf.int32)
return tf.greater_equal(tf.reduce_sum(match), x)
|
python
|
def _at_least_x_are_true(a, b, x):
"""At least `x` of `a` and `b` `Tensors` are true."""
match = tf.equal(a, b)
match = tf.cast(match, tf.int32)
return tf.greater_equal(tf.reduce_sum(match), x)
|
[
"def",
"_at_least_x_are_true",
"(",
"a",
",",
"b",
",",
"x",
")",
":",
"match",
"=",
"tf",
".",
"equal",
"(",
"a",
",",
"b",
")",
"match",
"=",
"tf",
".",
"cast",
"(",
"match",
",",
"tf",
".",
"int32",
")",
"return",
"tf",
".",
"greater_equal",
"(",
"tf",
".",
"reduce_sum",
"(",
"match",
")",
",",
"x",
")"
] |
At least `x` of `a` and `b` `Tensors` are true.
|
[
"At",
"least",
"x",
"of",
"a",
"and",
"b",
"Tensors",
"are",
"true",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L552-L556
|
train
|
At least x of a and b Tensors are true.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6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ectionError,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(111) + chr(0b110001) + chr(0b110011) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\065' + '\x30', 32733 - 32725), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1 + 0o62) + chr(49) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1010 + 0o51) + chr(48) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11 + 0o60) + chr(0b100 + 0o60) + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(2106 - 2051) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(8477 - 8366) + '\x32' + chr(1629 - 1581), 24863 - 24855), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b101001 + 0o7) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1057 - 1009) + chr(0b1101111) + '\061' + chr(0b1101 + 0o50) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b110001) + chr(0b101001 + 0o15), 13561 - 13553), ehT0Px3KOsy9(chr(1740 - 1692) + '\157' + chr(0b110010) + chr(49) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(757 - 709) + chr(0b1101011 + 0o4) + '\061' + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(3458 - 3347) + '\063' + chr(0b110100) + '\x33', 0o10), ehT0Px3KOsy9(chr(284 - 236) + chr(0b1101111) + chr(0b110001) + chr(0b1 + 0o63) + chr(859 - 809), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\061' + chr(49), 0o10), ehT0Px3KOsy9(chr(2121 - 2073) + chr(460 - 349) + chr(0b110011) + chr(55) + chr(495 - 441), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(3959 - 3848) + chr(1188 - 1139) + chr(51) + '\x35', 14725 - 14717), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(468 - 418), 7381 - 7373), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(1632 - 1578) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(351 - 302) + chr(802 - 752) + chr(0b110010), 27192 - 27184), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b110011) + chr(1373 - 1320), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + chr(2836 - 2781) + chr(0b110000), 65066 - 65058), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + '\x31' + '\x33' + chr(2834 - 2779), 42201 - 42193), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b11000 + 0o127) + '\x31' + '\064' + '\x30', 0b1000), ehT0Px3KOsy9(chr(1047 - 999) + chr(111) + chr(2074 - 2025) + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b110110) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b101110 + 0o5) + chr(49) + chr(0b110010), 64041 - 64033), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(611 - 557) + chr(2125 - 2073), ord("\x08")), ehT0Px3KOsy9(chr(388 - 340) + chr(0b111111 + 0o60) + chr(0b101011 + 0o6) + chr(0b1101 + 0o51) + chr(0b1000 + 0o56), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b110000 + 0o77) + '\x31' + chr(0b1100 + 0o47) + chr(1772 - 1724), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1288 - 1239) + chr(50) + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b101010 + 0o11) + chr(0b110010), 27249 - 27241), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2086 - 2035) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(603 - 549) + chr(2464 - 2410), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + chr(0b11010 + 0o32) + chr(51), 13927 - 13919), ehT0Px3KOsy9(chr(0b110000) + chr(245 - 134) + '\063' + chr(52) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1064 - 1016) + chr(111) + chr(49) + chr(52), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062', 8), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(0b110010) + chr(1898 - 1849) + '\x32', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(7972 - 7861) + '\x35' + '\060', 9140 - 9132)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'w'), chr(100) + chr(0b1010011 + 0o22) + chr(0b110101 + 0o56) + chr(111) + chr(100) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(1177 - 1075) + '\055' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Im9WeQvQHytU(XPh1qbAgrPgG, wmN3dvez4qzC, OeWW0F1dBPRQ):
AZi1vqvu7T1_ = IDJ2eXGCBCDu.equal(XPh1qbAgrPgG, wmN3dvez4qzC)
AZi1vqvu7T1_ = IDJ2eXGCBCDu.cast(AZi1vqvu7T1_, IDJ2eXGCBCDu.int32)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'>\xda\xa8\xa1\x94\x9eb\xdd\t?\xf9:\x8f'), chr(6677 - 6577) + chr(0b1100101) + chr(1380 - 1281) + '\157' + chr(0b100011 + 0o101) + '\x65')('\x75' + chr(11039 - 10923) + chr(5985 - 5883) + chr(45) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'+\xcd\xa9\xb5\x83\x9eO\xf1\x19#'), chr(6498 - 6398) + '\x65' + chr(99) + chr(11848 - 11737) + '\x64' + chr(4106 - 4005))('\x75' + '\x74' + '\x66' + chr(0b10101 + 0o30) + chr(0b10 + 0o66)))(AZi1vqvu7T1_), OeWW0F1dBPRQ)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
_do_scale
|
def _do_scale(image, size):
"""Rescale the image by scaling the smaller spatial dimension to `size`."""
shape = tf.cast(tf.shape(image), tf.float32)
w_greater = tf.greater(shape[0], shape[1])
shape = tf.cond(w_greater,
lambda: tf.cast([shape[0] / shape[1] * size, size], tf.int32),
lambda: tf.cast([size, shape[1] / shape[0] * size], tf.int32))
return tf.image.resize_bicubic([image], shape)[0]
|
python
|
def _do_scale(image, size):
"""Rescale the image by scaling the smaller spatial dimension to `size`."""
shape = tf.cast(tf.shape(image), tf.float32)
w_greater = tf.greater(shape[0], shape[1])
shape = tf.cond(w_greater,
lambda: tf.cast([shape[0] / shape[1] * size, size], tf.int32),
lambda: tf.cast([size, shape[1] / shape[0] * size], tf.int32))
return tf.image.resize_bicubic([image], shape)[0]
|
[
"def",
"_do_scale",
"(",
"image",
",",
"size",
")",
":",
"shape",
"=",
"tf",
".",
"cast",
"(",
"tf",
".",
"shape",
"(",
"image",
")",
",",
"tf",
".",
"float32",
")",
"w_greater",
"=",
"tf",
".",
"greater",
"(",
"shape",
"[",
"0",
"]",
",",
"shape",
"[",
"1",
"]",
")",
"shape",
"=",
"tf",
".",
"cond",
"(",
"w_greater",
",",
"lambda",
":",
"tf",
".",
"cast",
"(",
"[",
"shape",
"[",
"0",
"]",
"/",
"shape",
"[",
"1",
"]",
"*",
"size",
",",
"size",
"]",
",",
"tf",
".",
"int32",
")",
",",
"lambda",
":",
"tf",
".",
"cast",
"(",
"[",
"size",
",",
"shape",
"[",
"1",
"]",
"/",
"shape",
"[",
"0",
"]",
"*",
"size",
"]",
",",
"tf",
".",
"int32",
")",
")",
"return",
"tf",
".",
"image",
".",
"resize_bicubic",
"(",
"[",
"image",
"]",
",",
"shape",
")",
"[",
"0",
"]"
] |
Rescale the image by scaling the smaller spatial dimension to `size`.
|
[
"Rescale",
"the",
"image",
"by",
"scaling",
"the",
"smaller",
"spatial",
"dimension",
"to",
"size",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L559-L567
|
train
|
Rescale the image by scaling the smaller spatial dimension to size.
|
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,yg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iEdDQ,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(626 - 578) + chr(9942 - 9831) + chr(1632 - 1577), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101011 + 0o4) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(0b101010 + 0o12) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\067' + chr(0b110100), 54361 - 54353), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b110110) + chr(0b100010 + 0o22), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(0b110101) + '\061', 23597 - 23589), ehT0Px3KOsy9(chr(0b110000) + chr(8743 - 8632) + chr(0b110011) + '\067' + chr(0b101011 + 0o10), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(53) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b110000 + 0o77) + chr(0b110011) + chr(0b110111) + chr(1225 - 1174), 8), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + '\x31' + chr(0b110101) + '\x36', 6784 - 6776), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(520 - 468), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\064' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + chr(0b110110) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(261 - 213) + chr(111) + chr(0b110010) + '\064' + '\x36', 3131 - 3123), ehT0Px3KOsy9(chr(471 - 423) + chr(3695 - 3584) + '\063' + chr(1079 - 1026) + '\066', 0b1000), ehT0Px3KOsy9(chr(857 - 809) + chr(0b1001010 + 0o45) + chr(0b110001) + '\x34' + chr(0b110101 + 0o0), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100100 + 0o13) + chr(0b110001) + chr(0b1101 + 0o45) + chr(0b1 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + '\063' + '\x35' + chr(0b10000 + 0o43), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2222 - 2172) + chr(55) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b101000 + 0o14), 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(1938 - 1888) + chr(2480 - 2428) + chr(52), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11 + 0o56) + chr(54) + '\x37', 22032 - 22024), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b110011 + 0o74) + chr(49) + chr(0b110101 + 0o0) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1744 - 1693) + '\x34' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1385 - 1337) + chr(10985 - 10874) + chr(1586 - 1537) + '\x35' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1809 - 1761) + '\x6f' + '\062' + chr(0b110111) + chr(50), 59389 - 59381), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b101001 + 0o106) + '\x32' + chr(0b110111) + chr(1593 - 1544), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\062', 0o10), ehT0Px3KOsy9(chr(1084 - 1036) + '\157' + '\x32' + chr(2609 - 2557) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + chr(50) + chr(49) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(51) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110110) + chr(0b110101), 33740 - 33732), ehT0Px3KOsy9(chr(1399 - 1351) + chr(111) + chr(673 - 624), ord("\x08")), ehT0Px3KOsy9(chr(648 - 600) + '\157' + '\x32' + chr(0b110110) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(48) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1110 + 0o141) + chr(0b101110 + 0o5) + chr(0b110011) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1248 - 1200) + chr(111) + chr(51) + chr(0b1010 + 0o52) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9491 - 9380) + chr(0b101 + 0o54) + chr(0b110010) + chr(0b110100), 24942 - 24934), ehT0Px3KOsy9(chr(48) + chr(0b101101 + 0o102) + chr(0b101111 + 0o4) + chr(206 - 151) + chr(1609 - 1559), 46718 - 46710), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b110010) + '\064' + chr(410 - 357), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(6544 - 6433) + '\x35' + chr(1674 - 1626), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b')'), chr(100) + chr(0b1100101) + chr(9130 - 9031) + '\x6f' + chr(0b1100100) + chr(0b100000 + 0o105))(chr(0b1110101) + chr(0b1011010 + 0o32) + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def u_hf4CgxLI2_(IdmAHWfCqrnp, NLcc3BCJnQka):
nauYfLglTpcb = IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.nauYfLglTpcb(IdmAHWfCqrnp), IDJ2eXGCBCDu.float32)
wwTT5Vq5KzmG = IDJ2eXGCBCDu.greater(nauYfLglTpcb[ehT0Px3KOsy9(chr(827 - 779) + chr(0b10010 + 0o135) + '\060', 0b1000)], nauYfLglTpcb[ehT0Px3KOsy9('\x30' + chr(9864 - 9753) + chr(0b110001), 8)])
nauYfLglTpcb = IDJ2eXGCBCDu.cond(wwTT5Vq5KzmG, lambda : IDJ2eXGCBCDu.cast([nauYfLglTpcb[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(931 - 883), 8)] / nauYfLglTpcb[ehT0Px3KOsy9('\x30' + chr(111) + '\x31', 8)] * NLcc3BCJnQka, NLcc3BCJnQka], IDJ2eXGCBCDu.int32), lambda : IDJ2eXGCBCDu.cast([NLcc3BCJnQka, nauYfLglTpcb[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8)] / nauYfLglTpcb[ehT0Px3KOsy9(chr(768 - 720) + '\x6f' + chr(1206 - 1158), 8)] * NLcc3BCJnQka], IDJ2eXGCBCDu.int32))
return xafqLlk3kkUe(IDJ2eXGCBCDu.image, xafqLlk3kkUe(SXOLrMavuUCe(b'uc\xd7\xd5\xceL\xa4\xca\x92\ry\xc5Z\xc5'), chr(3310 - 3210) + '\x65' + chr(7455 - 7356) + chr(7080 - 6969) + '\144' + chr(1936 - 1835))(chr(117) + chr(8344 - 8228) + chr(102) + '\x2d' + '\070'))([IdmAHWfCqrnp], nauYfLglTpcb)[ehT0Px3KOsy9('\x30' + chr(111) + '\060', 8)]
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
_center_crop
|
def _center_crop(image, size):
"""Crops to center of image with specified `size`."""
image_height = tf.shape(image)[0]
image_width = tf.shape(image)[1]
offset_height = ((image_height - size) + 1) / 2
offset_width = ((image_width - size) + 1) / 2
image = _crop(image, offset_height, offset_width, size, size)
return image
|
python
|
def _center_crop(image, size):
"""Crops to center of image with specified `size`."""
image_height = tf.shape(image)[0]
image_width = tf.shape(image)[1]
offset_height = ((image_height - size) + 1) / 2
offset_width = ((image_width - size) + 1) / 2
image = _crop(image, offset_height, offset_width, size, size)
return image
|
[
"def",
"_center_crop",
"(",
"image",
",",
"size",
")",
":",
"image_height",
"=",
"tf",
".",
"shape",
"(",
"image",
")",
"[",
"0",
"]",
"image_width",
"=",
"tf",
".",
"shape",
"(",
"image",
")",
"[",
"1",
"]",
"offset_height",
"=",
"(",
"(",
"image_height",
"-",
"size",
")",
"+",
"1",
")",
"/",
"2",
"offset_width",
"=",
"(",
"(",
"image_width",
"-",
"size",
")",
"+",
"1",
")",
"/",
"2",
"image",
"=",
"_crop",
"(",
"image",
",",
"offset_height",
",",
"offset_width",
",",
"size",
",",
"size",
")",
"return",
"image"
] |
Crops to center of image with specified `size`.
|
[
"Crops",
"to",
"center",
"of",
"image",
"with",
"specified",
"size",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L570-L578
|
train
|
Crops to center of image with specified size.
|
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,QWgp4ELTmq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KDPD,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(0b101001 + 0o7) + chr(0b1101111) + chr(0b100101 + 0o15) + chr(0b110111) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1884 - 1834) + '\066' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1205 - 1157) + '\x6f' + chr(51) + chr(53) + chr(2802 - 2747), ord("\x08")), ehT0Px3KOsy9(chr(311 - 263) + chr(111) + chr(0b101100 + 0o7) + chr(0b110010), 64349 - 64341), ehT0Px3KOsy9('\x30' + chr(6416 - 6305) + '\x33' + chr(52) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10001 + 0o40) + chr(1667 - 1618) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(5295 - 5184) + chr(0b1 + 0o62) + chr(0b110000) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2095 - 2046) + chr(48) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(3364 - 3253) + '\062' + '\065' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + '\061' + '\062' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8490 - 8379) + chr(0b110001) + chr(0b11110 + 0o25) + chr(2258 - 2208), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(466 - 415) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(11098 - 10987) + chr(1184 - 1134) + chr(50) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x35' + chr(0b110010), 14815 - 14807), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10 + 0o61) + '\064' + chr(50), 8), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(0b10001 + 0o42) + chr(55) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(0b110001) + chr(0b101101 + 0o10), 0b1000), ehT0Px3KOsy9(chr(1936 - 1888) + chr(111) + chr(2011 - 1961) + chr(0b110111) + chr(0b101010 + 0o14), 8), ehT0Px3KOsy9(chr(137 - 89) + chr(0b1101111) + '\x32' + chr(49) + '\061', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(0b10 + 0o57) + chr(0b110011) + chr(0b110000 + 0o5), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(336 - 287) + '\064', 0o10), ehT0Px3KOsy9(chr(1286 - 1238) + chr(0b1101111) + '\063' + chr(0b110110) + chr(836 - 788), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(54) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(286 - 238) + chr(111) + chr(699 - 648) + '\062' + chr(1773 - 1722), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(758 - 709) + '\063', 18766 - 18758), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + '\062' + chr(53) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(0b110110) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10011 + 0o36) + chr(2519 - 2467) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000100 + 0o53) + chr(1596 - 1546) + chr(50) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10261 - 10150) + chr(51) + chr(0b110111) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + '\062' + '\x33' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b10111 + 0o33) + chr(0b110010) + chr(0b11110 + 0o25), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b110001) + '\x32' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101110 + 0o1) + chr(1581 - 1530) + chr(2282 - 2232) + chr(962 - 912), 0o10), ehT0Px3KOsy9(chr(403 - 355) + '\157' + chr(0b10110 + 0o34) + chr(0b110010) + '\065', 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + '\x36' + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11110 + 0o23) + chr(2732 - 2677) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b110101) + chr(0b1000 + 0o50), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b100100 + 0o15) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(53), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(53) + '\060', 48608 - 48600)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x90'), chr(0b1100100) + chr(101) + chr(0b100101 + 0o76) + chr(0b11010 + 0o125) + '\x64' + '\145')(chr(0b1011 + 0o152) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mSttElOFuXlC(IdmAHWfCqrnp, NLcc3BCJnQka):
aVRbWzCw2Vuo = IDJ2eXGCBCDu.nauYfLglTpcb(IdmAHWfCqrnp)[ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\x30', 0o10)]
RmwDor39z9oL = IDJ2eXGCBCDu.nauYfLglTpcb(IdmAHWfCqrnp)[ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + '\061', 0b1000)]
lqAVIQ72_nsh = (aVRbWzCw2Vuo - NLcc3BCJnQka + ehT0Px3KOsy9(chr(297 - 249) + '\157' + chr(0b110001), 8)) / ehT0Px3KOsy9('\x30' + chr(0b100000 + 0o117) + chr(50), 0b1000)
r_toKUo8V0Nu = (RmwDor39z9oL - NLcc3BCJnQka + ehT0Px3KOsy9(chr(725 - 677) + '\157' + chr(0b110001), 8)) / ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + '\062', 8)
IdmAHWfCqrnp = RNTi1v1ffiS8(IdmAHWfCqrnp, lqAVIQ72_nsh, r_toKUo8V0Nu, NLcc3BCJnQka, NLcc3BCJnQka)
return IdmAHWfCqrnp
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
_normalize
|
def _normalize(image):
"""Normalize the image to zero mean and unit variance."""
offset = tf.constant(MEAN_RGB, shape=[1, 1, 3])
image -= offset
scale = tf.constant(STDDEV_RGB, shape=[1, 1, 3])
image /= scale
return image
|
python
|
def _normalize(image):
"""Normalize the image to zero mean and unit variance."""
offset = tf.constant(MEAN_RGB, shape=[1, 1, 3])
image -= offset
scale = tf.constant(STDDEV_RGB, shape=[1, 1, 3])
image /= scale
return image
|
[
"def",
"_normalize",
"(",
"image",
")",
":",
"offset",
"=",
"tf",
".",
"constant",
"(",
"MEAN_RGB",
",",
"shape",
"=",
"[",
"1",
",",
"1",
",",
"3",
"]",
")",
"image",
"-=",
"offset",
"scale",
"=",
"tf",
".",
"constant",
"(",
"STDDEV_RGB",
",",
"shape",
"=",
"[",
"1",
",",
"1",
",",
"3",
"]",
")",
"image",
"/=",
"scale",
"return",
"image"
] |
Normalize the image to zero mean and unit variance.
|
[
"Normalize",
"the",
"image",
"to",
"zero",
"mean",
"and",
"unit",
"variance",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L581-L588
|
train
|
Normalize the image to zero mean and unit variance.
|
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(48) + chr(111) + '\061' + chr(1576 - 1522) + chr(0b100110 + 0o15), 33959 - 33951), ehT0Px3KOsy9(chr(48) + chr(10165 - 10054) + '\062' + chr(0b110111) + chr(0b101011 + 0o13), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101101 + 0o4) + '\063', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(52) + chr(61 - 7), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110 + 0o53) + chr(0b110011) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + chr(106 - 57), 50125 - 50117), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\x30' + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(1686 - 1636) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b110110 + 0o1) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(55) + '\x30', 0o10), ehT0Px3KOsy9(chr(274 - 226) + chr(0b1101111) + chr(49), 41840 - 41832), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b110001) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\064' + '\062', 36831 - 36823), ehT0Px3KOsy9(chr(0b110000) + chr(5744 - 5633) + chr(0b11101 + 0o26) + chr(51) + '\064', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10100 + 0o37) + chr(0b110010) + chr(0b11111 + 0o22), 64182 - 64174), ehT0Px3KOsy9(chr(48) + chr(3125 - 3014) + chr(1521 - 1470), 50614 - 50606), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1213 - 1163) + chr(0b110011) + chr(0b110100), 40532 - 40524), ehT0Px3KOsy9(chr(88 - 40) + '\157' + chr(0b101011 + 0o7) + chr(54) + chr(0b110000), 54427 - 54419), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101010 + 0o7) + chr(0b110001) + '\x33', 17338 - 17330), ehT0Px3KOsy9('\x30' + '\x6f' + chr(213 - 163) + chr(0b11100 + 0o24) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(2058 - 2010) + '\x6f' + chr(0b100011 + 0o16) + chr(52) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1101 + 0o45) + '\063' + chr(0b1010 + 0o47), 33377 - 33369), ehT0Px3KOsy9(chr(246 - 198) + chr(0b1011101 + 0o22) + '\x31' + chr(80 - 29) + chr(0b11110 + 0o30), 11071 - 11063), ehT0Px3KOsy9('\x30' + '\157' + chr(73 - 24) + '\062' + '\x30', 49748 - 49740), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\x34' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110101 + 0o72) + chr(2315 - 2266) + '\065' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8927 - 8816) + chr(51) + chr(0b110010) + chr(0b110101), 38283 - 38275), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2277 - 2228) + '\063', 8), ehT0Px3KOsy9('\060' + chr(2508 - 2397) + chr(0b110010) + chr(1205 - 1151) + chr(0b11 + 0o61), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(311 - 259) + '\x34', 50009 - 50001), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10100 + 0o35) + chr(51), 8), ehT0Px3KOsy9(chr(2190 - 2142) + chr(4268 - 4157) + chr(1616 - 1567) + '\x35' + chr(507 - 453), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\x30' + chr(0b10111 + 0o32), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6771 - 6660) + chr(1417 - 1368) + '\067' + chr(0b10001 + 0o42), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + '\x33' + chr(1286 - 1234) + chr(0b110100), 14281 - 14273), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + '\061' + chr(0b101111 + 0o4) + chr(0b11110 + 0o31), 0o10), ehT0Px3KOsy9(chr(2113 - 2065) + chr(111) + chr(2545 - 2494) + chr(50) + chr(0b110101), 8), ehT0Px3KOsy9(chr(2012 - 1964) + chr(5403 - 5292) + chr(0b110010) + '\065' + '\067', 0o10), ehT0Px3KOsy9(chr(1056 - 1008) + chr(0b100011 + 0o114) + chr(0b110011) + '\x32' + chr(0b11110 + 0o24), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b1011 + 0o52) + chr(55), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1133 - 1085) + chr(111) + chr(0b110101) + chr(0b11001 + 0o27), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b']'), '\x64' + chr(0b11110 + 0o107) + chr(2545 - 2446) + chr(0b101111 + 0o100) + chr(0b1100001 + 0o3) + chr(0b1100101))(chr(6087 - 5970) + chr(0b1110100) + chr(0b101010 + 0o74) + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def wYiYhU9aZyFF(IdmAHWfCqrnp):
VRaYxwVeIO1g = IDJ2eXGCBCDu.constant(LxhvMoYSZHug, shape=[ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(10343 - 10232) + chr(49), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(0b110011), 8)])
IdmAHWfCqrnp -= VRaYxwVeIO1g
xjPLimsZRgb9 = IDJ2eXGCBCDu.constant(aK_vdZE7Dhyq, shape=[ehT0Px3KOsy9('\x30' + chr(0b1000001 + 0o56) + chr(0b110001), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061', 8), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(0b10 + 0o61), 8)])
IdmAHWfCqrnp /= xjPLimsZRgb9
return IdmAHWfCqrnp
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
preprocess_for_train
|
def preprocess_for_train(image, image_size=224, normalize=True):
"""Preprocesses the given image for evaluation.
Args:
image: `Tensor` representing an image of arbitrary size.
image_size: int, how large the output image should be.
normalize: bool, if True the image is normalized.
Returns:
A preprocessed image `Tensor`.
"""
if normalize: image = tf.to_float(image) / 255.0
image = _random_crop(image, image_size)
if normalize: image = _normalize(image)
image = _flip(image)
image = tf.reshape(image, [image_size, image_size, 3])
return image
|
python
|
def preprocess_for_train(image, image_size=224, normalize=True):
"""Preprocesses the given image for evaluation.
Args:
image: `Tensor` representing an image of arbitrary size.
image_size: int, how large the output image should be.
normalize: bool, if True the image is normalized.
Returns:
A preprocessed image `Tensor`.
"""
if normalize: image = tf.to_float(image) / 255.0
image = _random_crop(image, image_size)
if normalize: image = _normalize(image)
image = _flip(image)
image = tf.reshape(image, [image_size, image_size, 3])
return image
|
[
"def",
"preprocess_for_train",
"(",
"image",
",",
"image_size",
"=",
"224",
",",
"normalize",
"=",
"True",
")",
":",
"if",
"normalize",
":",
"image",
"=",
"tf",
".",
"to_float",
"(",
"image",
")",
"/",
"255.0",
"image",
"=",
"_random_crop",
"(",
"image",
",",
"image_size",
")",
"if",
"normalize",
":",
"image",
"=",
"_normalize",
"(",
"image",
")",
"image",
"=",
"_flip",
"(",
"image",
")",
"image",
"=",
"tf",
".",
"reshape",
"(",
"image",
",",
"[",
"image_size",
",",
"image_size",
",",
"3",
"]",
")",
"return",
"image"
] |
Preprocesses the given image for evaluation.
Args:
image: `Tensor` representing an image of arbitrary size.
image_size: int, how large the output image should be.
normalize: bool, if True the image is normalized.
Returns:
A preprocessed image `Tensor`.
|
[
"Preprocesses",
"the",
"given",
"image",
"for",
"evaluation",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L591-L607
|
train
|
Preprocesses the given image for evaluation.
|
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,QWgp4ELT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l2KDPD,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(1686 - 1638) + '\x6f' + '\061' + chr(0b10 + 0o61) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110000) + chr(0b110111 + 0o0), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100100 + 0o113) + chr(0b110010) + '\x34' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101101 + 0o6) + chr(51) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(2086 - 2037) + '\x33', 0o10), ehT0Px3KOsy9(chr(1083 - 1035) + '\x6f' + chr(50) + chr(543 - 495) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\062' + '\x33', 35577 - 35569), ehT0Px3KOsy9(chr(0b110000) + chr(6607 - 6496) + chr(757 - 708) + chr(0b10000 + 0o43) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + '\x31' + '\066' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(12088 - 11977) + chr(55 - 4) + '\064' + chr(0b10100 + 0o34), 0b1000), ehT0Px3KOsy9(chr(1597 - 1549) + chr(10400 - 10289) + chr(0b110011) + chr(55) + chr(0b110101), 25904 - 25896), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(0b110011) + chr(1204 - 1150) + chr(890 - 839), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\062' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b10000 + 0o46) + chr(1405 - 1355), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(0b110011) + '\x32' + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(472 - 423) + chr(1802 - 1751) + chr(2008 - 1959), 60188 - 60180), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1843 - 1794) + '\067' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(1899 - 1846) + chr(0b1100 + 0o47), 9831 - 9823), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + '\065' + chr(49), 42172 - 42164), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(2169 - 2121) + chr(2260 - 2208), 0b1000), ehT0Px3KOsy9(chr(2213 - 2165) + chr(111) + '\062' + '\x34' + chr(53), 2458 - 2450), ehT0Px3KOsy9(chr(155 - 107) + chr(0b1101111) + chr(1355 - 1304) + chr(0b110011) + chr(1917 - 1867), 36881 - 36873), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + '\065' + chr(0b101111 + 0o3), 46242 - 46234), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101111 + 0o2) + '\x33' + '\x34', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(510 - 461) + chr(0b11111 + 0o22) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110010) + chr(102 - 53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(392 - 341) + '\061' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\060' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b100010 + 0o21) + '\062', 8), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b11110 + 0o24) + '\x30' + chr(0b110011), 14432 - 14424), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\062' + chr(51), 32299 - 32291), ehT0Px3KOsy9(chr(48) + chr(111) + chr(922 - 873) + '\x31' + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + chr(73 - 23) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(900 - 852) + chr(111) + '\x33' + chr(1646 - 1594) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110001) + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + chr(0b110001) + chr(51) + chr(0b1 + 0o57), 0o10), ehT0Px3KOsy9(chr(1200 - 1152) + '\157' + '\063' + '\067' + chr(1521 - 1471), 0o10), ehT0Px3KOsy9('\060' + chr(6886 - 6775) + chr(0b100111 + 0o13) + chr(0b110001) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10000 + 0o41) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x34' + '\061', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(399 - 351) + chr(111) + chr(1408 - 1355) + chr(0b11011 + 0o25), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'r'), '\x64' + '\145' + '\x63' + chr(0b10000 + 0o137) + chr(1059 - 959) + chr(101))(chr(0b111110 + 0o67) + chr(0b1110100) + chr(0b1010110 + 0o20) + chr(976 - 931) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def CH4o4HTh9JWi(IdmAHWfCqrnp, fJKnIM3o6qJL=ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x34' + chr(48), 8), IOBK62gJSlOh=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061', ord("\x08"))):
if IOBK62gJSlOh:
IdmAHWfCqrnp = IDJ2eXGCBCDu.to_float(IdmAHWfCqrnp) / 255.0
IdmAHWfCqrnp = SXTqKFvT8s4x(IdmAHWfCqrnp, fJKnIM3o6qJL)
if IOBK62gJSlOh:
IdmAHWfCqrnp = wYiYhU9aZyFF(IdmAHWfCqrnp)
IdmAHWfCqrnp = GaGdae2jtMlD(IdmAHWfCqrnp)
IdmAHWfCqrnp = IDJ2eXGCBCDu.reshape(IdmAHWfCqrnp, [fJKnIM3o6qJL, fJKnIM3o6qJL, ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(2267 - 2156) + chr(51), 0b1000)])
return IdmAHWfCqrnp
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/imagenet.py
|
preprocess_for_eval
|
def preprocess_for_eval(image, image_size=224, normalize=True):
"""Preprocesses the given image for evaluation.
Args:
image: `Tensor` representing an image of arbitrary size.
image_size: int, how large the output image should be.
normalize: bool, if True the image is normalized.
Returns:
A preprocessed image `Tensor`.
"""
if normalize: image = tf.to_float(image) / 255.0
image = _do_scale(image, image_size + 32)
if normalize: image = _normalize(image)
image = _center_crop(image, image_size)
image = tf.reshape(image, [image_size, image_size, 3])
return image
|
python
|
def preprocess_for_eval(image, image_size=224, normalize=True):
"""Preprocesses the given image for evaluation.
Args:
image: `Tensor` representing an image of arbitrary size.
image_size: int, how large the output image should be.
normalize: bool, if True the image is normalized.
Returns:
A preprocessed image `Tensor`.
"""
if normalize: image = tf.to_float(image) / 255.0
image = _do_scale(image, image_size + 32)
if normalize: image = _normalize(image)
image = _center_crop(image, image_size)
image = tf.reshape(image, [image_size, image_size, 3])
return image
|
[
"def",
"preprocess_for_eval",
"(",
"image",
",",
"image_size",
"=",
"224",
",",
"normalize",
"=",
"True",
")",
":",
"if",
"normalize",
":",
"image",
"=",
"tf",
".",
"to_float",
"(",
"image",
")",
"/",
"255.0",
"image",
"=",
"_do_scale",
"(",
"image",
",",
"image_size",
"+",
"32",
")",
"if",
"normalize",
":",
"image",
"=",
"_normalize",
"(",
"image",
")",
"image",
"=",
"_center_crop",
"(",
"image",
",",
"image_size",
")",
"image",
"=",
"tf",
".",
"reshape",
"(",
"image",
",",
"[",
"image_size",
",",
"image_size",
",",
"3",
"]",
")",
"return",
"image"
] |
Preprocesses the given image for evaluation.
Args:
image: `Tensor` representing an image of arbitrary size.
image_size: int, how large the output image should be.
normalize: bool, if True the image is normalized.
Returns:
A preprocessed image `Tensor`.
|
[
"Preprocesses",
"the",
"given",
"image",
"for",
"evaluation",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/imagenet.py#L610-L626
|
train
|
Preprocesses the given image for evaluation.
|
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,hIl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ccExqw4,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(1312 - 1264) + chr(0b1101111) + '\063' + '\x33' + '\x35', 44732 - 44724), ehT0Px3KOsy9(chr(48) + chr(11306 - 11195) + '\x34' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(2144 - 2096) + chr(0b1101111) + chr(1149 - 1098) + '\x31' + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(2093 - 2043) + chr(0b100101 + 0o21) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101000 + 0o107) + '\066' + chr(0b110110), 25199 - 25191), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110001) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100001 + 0o20) + chr(49) + chr(0b0 + 0o62), 5845 - 5837), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + chr(52) + chr(0b10 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(1436 - 1388) + chr(0b1101111) + '\063' + chr(49) + chr(2291 - 2239), 0b1000), ehT0Px3KOsy9(chr(2202 - 2154) + chr(0b1001000 + 0o47) + '\x33' + chr(0b110001) + chr(0b110110), 61751 - 61743), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\066' + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(894 - 845) + chr(1035 - 983) + chr(0b101101 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\063' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100100 + 0o20) + chr(0b11000 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1007 - 959), 0b1000), ehT0Px3KOsy9(chr(48) + chr(8088 - 7977) + '\061' + '\060' + '\066', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(679 - 626) + chr(0b11011 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11100 + 0o30) + chr(797 - 748), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\060' + '\064', 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(55) + chr(0b1000 + 0o54), 25748 - 25740), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + chr(0b101100 + 0o7) + chr(50) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1611 - 1563) + '\x6f' + chr(49) + chr(55) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\063' + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b11110 + 0o121) + chr(1897 - 1847) + '\066' + chr(2461 - 2411), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(50) + chr(52) + chr(0b101111 + 0o4), 0o10), ehT0Px3KOsy9(chr(568 - 520) + '\157' + '\061' + chr(0b101000 + 0o15) + chr(2645 - 2592), 44874 - 44866), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b110010 + 0o75) + chr(0b1000 + 0o52) + '\x31' + '\067', 0o10), ehT0Px3KOsy9(chr(834 - 786) + chr(10726 - 10615) + chr(0b110001) + chr(0b101110 + 0o6) + chr(0b100111 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101110 + 0o101) + chr(0b110010) + chr(49), 33606 - 33598), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(10302 - 10191) + '\x31' + chr(0b110000), 34936 - 34928), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\065' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b1000 + 0o56) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(50) + chr(0b10010 + 0o44), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\060' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + '\x33' + chr(209 - 161) + chr(0b1110 + 0o44), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(51) + chr(0b10100 + 0o42), 0o10), ehT0Px3KOsy9('\x30' + chr(0b11111 + 0o120) + chr(0b110011) + '\061' + chr(54), 8), ehT0Px3KOsy9(chr(48) + chr(0b1010101 + 0o32) + '\061' + '\x37' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + '\063' + '\067' + '\x35', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(1463 - 1408) + chr(0b110011), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + '\x35' + '\060', 25952 - 25944)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3'), chr(100) + chr(101) + chr(0b11000 + 0o113) + chr(111) + chr(100) + chr(101))(chr(117) + chr(116) + '\146' + chr(143 - 98) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def kO9XwQawfgDg(IdmAHWfCqrnp, fJKnIM3o6qJL=ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(0b0 + 0o63) + chr(633 - 581) + chr(1310 - 1262), ord("\x08")), IOBK62gJSlOh=ehT0Px3KOsy9('\060' + '\x6f' + chr(1278 - 1229), 11303 - 11295)):
if IOBK62gJSlOh:
IdmAHWfCqrnp = IDJ2eXGCBCDu.to_float(IdmAHWfCqrnp) / 255.0
IdmAHWfCqrnp = u_hf4CgxLI2_(IdmAHWfCqrnp, fJKnIM3o6qJL + ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1100001 + 0o16) + '\x34' + chr(1882 - 1834), ord("\x08")))
if IOBK62gJSlOh:
IdmAHWfCqrnp = wYiYhU9aZyFF(IdmAHWfCqrnp)
IdmAHWfCqrnp = mSttElOFuXlC(IdmAHWfCqrnp, fJKnIM3o6qJL)
IdmAHWfCqrnp = IDJ2eXGCBCDu.reshape(IdmAHWfCqrnp, [fJKnIM3o6qJL, fJKnIM3o6qJL, ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011), 65048 - 65040)])
return IdmAHWfCqrnp
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/learning_rate.py
|
MultifactorSchedule
|
def MultifactorSchedule(history=None,
factors="constant * linear_warmup * rsqrt_decay",
constant=0.1,
warmup_steps=100,
decay_factor=0.5,
steps_per_decay=20000):
"""Factor-based learning rate schedule.
Interprets factors in the factors string which can consist of:
* constant: interpreted as the constant value,
* linear_warmup: interpreted as linear warmup until warmup_steps,
* rsqrt_decay: divide by square root of max(step, warmup_steps)
* decay_every: Every k steps decay the learning rate by decay_factor.
Args:
history: the history of training and evaluation (History object).
factors: a string with factors separated by "*" that defines the schedule.
constant: float, the starting constant for the learning rate schedule.
warmup_steps: how many steps to warm up for in the warmup schedule.
decay_factor: The amount to decay the learning rate by.
steps_per_decay: How often to decay the learning rate.
Returns:
a function learning_rate(step): float -> float, the step-dependent lr.
"""
del history
cache_args = (factors, constant, warmup_steps)
if cache_args in _memoized_multifactor_schedules:
return _memoized_multifactor_schedules[cache_args]
factors = [n.strip() for n in factors.split("*")]
def learning_rate(step): # pylint: disable=invalid-name
"""Step to learning rate function."""
ret = 1.0
for name in factors:
if name == "constant":
ret *= constant
elif name == "linear_warmup":
ret *= np.minimum(1.0, step / warmup_steps)
elif name == "rsqrt_decay":
ret /= np.sqrt(np.maximum(step, warmup_steps))
elif name == "decay_every":
ret *= (decay_factor ** (step//steps_per_decay))
else:
raise ValueError("Unknown factor %s." % name)
return ret
_memoized_multifactor_schedules[cache_args] = learning_rate
return learning_rate
|
python
|
def MultifactorSchedule(history=None,
factors="constant * linear_warmup * rsqrt_decay",
constant=0.1,
warmup_steps=100,
decay_factor=0.5,
steps_per_decay=20000):
"""Factor-based learning rate schedule.
Interprets factors in the factors string which can consist of:
* constant: interpreted as the constant value,
* linear_warmup: interpreted as linear warmup until warmup_steps,
* rsqrt_decay: divide by square root of max(step, warmup_steps)
* decay_every: Every k steps decay the learning rate by decay_factor.
Args:
history: the history of training and evaluation (History object).
factors: a string with factors separated by "*" that defines the schedule.
constant: float, the starting constant for the learning rate schedule.
warmup_steps: how many steps to warm up for in the warmup schedule.
decay_factor: The amount to decay the learning rate by.
steps_per_decay: How often to decay the learning rate.
Returns:
a function learning_rate(step): float -> float, the step-dependent lr.
"""
del history
cache_args = (factors, constant, warmup_steps)
if cache_args in _memoized_multifactor_schedules:
return _memoized_multifactor_schedules[cache_args]
factors = [n.strip() for n in factors.split("*")]
def learning_rate(step): # pylint: disable=invalid-name
"""Step to learning rate function."""
ret = 1.0
for name in factors:
if name == "constant":
ret *= constant
elif name == "linear_warmup":
ret *= np.minimum(1.0, step / warmup_steps)
elif name == "rsqrt_decay":
ret /= np.sqrt(np.maximum(step, warmup_steps))
elif name == "decay_every":
ret *= (decay_factor ** (step//steps_per_decay))
else:
raise ValueError("Unknown factor %s." % name)
return ret
_memoized_multifactor_schedules[cache_args] = learning_rate
return learning_rate
|
[
"def",
"MultifactorSchedule",
"(",
"history",
"=",
"None",
",",
"factors",
"=",
"\"constant * linear_warmup * rsqrt_decay\"",
",",
"constant",
"=",
"0.1",
",",
"warmup_steps",
"=",
"100",
",",
"decay_factor",
"=",
"0.5",
",",
"steps_per_decay",
"=",
"20000",
")",
":",
"del",
"history",
"cache_args",
"=",
"(",
"factors",
",",
"constant",
",",
"warmup_steps",
")",
"if",
"cache_args",
"in",
"_memoized_multifactor_schedules",
":",
"return",
"_memoized_multifactor_schedules",
"[",
"cache_args",
"]",
"factors",
"=",
"[",
"n",
".",
"strip",
"(",
")",
"for",
"n",
"in",
"factors",
".",
"split",
"(",
"\"*\"",
")",
"]",
"def",
"learning_rate",
"(",
"step",
")",
":",
"# pylint: disable=invalid-name",
"\"\"\"Step to learning rate function.\"\"\"",
"ret",
"=",
"1.0",
"for",
"name",
"in",
"factors",
":",
"if",
"name",
"==",
"\"constant\"",
":",
"ret",
"*=",
"constant",
"elif",
"name",
"==",
"\"linear_warmup\"",
":",
"ret",
"*=",
"np",
".",
"minimum",
"(",
"1.0",
",",
"step",
"/",
"warmup_steps",
")",
"elif",
"name",
"==",
"\"rsqrt_decay\"",
":",
"ret",
"/=",
"np",
".",
"sqrt",
"(",
"np",
".",
"maximum",
"(",
"step",
",",
"warmup_steps",
")",
")",
"elif",
"name",
"==",
"\"decay_every\"",
":",
"ret",
"*=",
"(",
"decay_factor",
"**",
"(",
"step",
"//",
"steps_per_decay",
")",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unknown factor %s.\"",
"%",
"name",
")",
"return",
"ret",
"_memoized_multifactor_schedules",
"[",
"cache_args",
"]",
"=",
"learning_rate",
"return",
"learning_rate"
] |
Factor-based learning rate schedule.
Interprets factors in the factors string which can consist of:
* constant: interpreted as the constant value,
* linear_warmup: interpreted as linear warmup until warmup_steps,
* rsqrt_decay: divide by square root of max(step, warmup_steps)
* decay_every: Every k steps decay the learning rate by decay_factor.
Args:
history: the history of training and evaluation (History object).
factors: a string with factors separated by "*" that defines the schedule.
constant: float, the starting constant for the learning rate schedule.
warmup_steps: how many steps to warm up for in the warmup schedule.
decay_factor: The amount to decay the learning rate by.
steps_per_decay: How often to decay the learning rate.
Returns:
a function learning_rate(step): float -> float, the step-dependent lr.
|
[
"Factor",
"-",
"based",
"learning",
"rate",
"schedule",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/learning_rate.py#L42-L92
|
train
|
Returns a function that can be used to calculate the learning rate of a single object.
|
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,QWgp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lSM16l2KDPD,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(0b10000 + 0o137) + '\x33' + chr(679 - 624) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(54) + '\063', 34081 - 34073), ehT0Px3KOsy9(chr(1283 - 1235) + chr(0b1101111) + chr(0b10001 + 0o41) + chr(0b110011) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\061' + chr(2135 - 2085) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(1138 - 1088) + chr(2165 - 2112) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2301 - 2252) + chr(2161 - 2107) + chr(0b110110), 53755 - 53747), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001 + 0o0) + chr(53) + chr(0b0 + 0o65), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + '\063' + chr(0b110001) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11101 + 0o31) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + '\065' + chr(2827 - 2773), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(51) + chr(2036 - 1981) + chr(50), 4763 - 4755), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\065' + '\x35', 18229 - 18221), ehT0Px3KOsy9(chr(0b110000) + chr(9533 - 9422) + chr(50) + chr(0b111 + 0o54) + chr(1640 - 1590), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000100 + 0o53) + chr(0b110010) + chr(0b101111 + 0o2) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1182 - 1134) + chr(111) + '\x32' + '\060' + '\064', 31048 - 31040), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\067' + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(55) + chr(49), 11063 - 11055), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(1148 - 1100) + chr(0b1101111) + chr(0b110011) + chr(51) + chr(1943 - 1891), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2386 - 2333) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(0b101000 + 0o12) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + '\066' + chr(1998 - 1950), 35046 - 35038), ehT0Px3KOsy9(chr(1725 - 1677) + chr(0b1101111) + chr(1286 - 1232) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(52) + chr(960 - 909), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2675 - 2564) + '\061' + chr(79 - 30), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + '\x33' + chr(0b110001) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\064' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2284 - 2234) + '\x34' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1848 - 1800) + chr(111) + chr(1885 - 1831) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(0b101111 + 0o3) + '\065', 30897 - 30889), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + '\x33' + chr(1920 - 1870), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(1093 - 1043) + chr(0b10 + 0o64), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + '\x32' + '\065' + chr(1161 - 1111), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + chr(0b110100) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1100001 + 0o16) + chr(51) + chr(899 - 847) + chr(51), 37362 - 37354), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(1211 - 1161) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11101 + 0o122) + chr(0b110011) + chr(934 - 883) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48 - 0) + '\157' + '\063' + chr(2287 - 2235) + '\064', 9141 - 9133), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(50) + chr(0b110000) + chr(0b11010 + 0o26), 0b1000), ehT0Px3KOsy9(chr(340 - 292) + chr(111) + '\x32' + '\061' + '\066', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b111 + 0o150) + chr(0b110101) + chr(0b100110 + 0o12), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6'), chr(100) + chr(0b1001110 + 0o27) + chr(0b1100011) + chr(2179 - 2068) + chr(100) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Jmi7OBjNtE9Z(sD1K7SLfPnDB=None, jMEwDzcmLYzd=xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\\\xf1"\xdc\x17\x03\xbb\x14\x04\xdaA\xf3\xe2\xe1]\x0bv\xabM\xe4]GS)\xe3\x01\xd5F$\xe8\xa2\xf5D\x86s\xb9\x9d'), chr(0b1100100) + '\145' + chr(0b101110 + 0o65) + '\157' + chr(100) + chr(3353 - 3252))(chr(0b1110101) + chr(0b101010 + 0o112) + chr(0b1100110) + '\x2d' + chr(0b100001 + 0o27)), QcnzFjzpljjk=0.1, p2epArE4laJj=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11 + 0o56) + chr(52) + chr(0b110100), ord("\x08")), geSuxboM5P7u=0.5, a2WFZ5AJLt58=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2218 - 2166) + chr(0b110111) + chr(0b1 + 0o57) + '\064' + chr(0b10100 + 0o34), 0o10)):
del sD1K7SLfPnDB
fpDPKwN_e9yc = (jMEwDzcmLYzd, QcnzFjzpljjk, p2epArE4laJj)
if fpDPKwN_e9yc in JBxHcyS7J02d:
return JBxHcyS7J02d[fpDPKwN_e9yc]
jMEwDzcmLYzd = [m1NkCryOw9Bx.strip() for m1NkCryOw9Bx in jMEwDzcmLYzd.split(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2'), chr(0b1100100) + chr(0b1100101) + chr(1941 - 1842) + '\157' + chr(0b100000 + 0o104) + '\145')(chr(117) + chr(0b1010 + 0o152) + '\x66' + chr(0b1011 + 0o42) + chr(56)))]
def QGSIpd_yUNzU(kDuFsAhEatcU):
VHn4CV4Ymrei = 1.0
for AIvJRzLdDfgF in jMEwDzcmLYzd:
if AIvJRzLdDfgF == xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\\\xf1"\xdc\x17\x03\xbb'), chr(0b11110 + 0o106) + '\x65' + chr(0b1 + 0o142) + chr(0b1101111) + '\x64' + chr(0b1000 + 0o135))(chr(8614 - 8497) + '\x74' + chr(0b1100110) + chr(45) + '\x38'):
VHn4CV4Ymrei *= QcnzFjzpljjk
elif AIvJRzLdDfgF == xafqLlk3kkUe(SXOLrMavuUCe(b'\x94Z\xf14\xc9\x042\xb8U\\\x97X\xea'), chr(0b1011110 + 0o6) + '\145' + chr(0b101010 + 0o71) + chr(8631 - 8520) + '\144' + chr(0b1100101))('\165' + chr(116) + chr(102) + chr(667 - 622) + chr(0b111000)):
VHn4CV4Ymrei *= WqUC3KWvYVup.minimum(1.0, kDuFsAhEatcU / p2epArE4laJj)
elif AIvJRzLdDfgF == xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a@\xee#\xdc)\t\xaaWO\x83'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(0b1100000 + 0o4) + '\145')('\165' + chr(0b1110100) + '\146' + chr(0b100100 + 0o11) + '\070'):
VHn4CV4Ymrei /= WqUC3KWvYVup.sqrt(WqUC3KWvYVup.maximum(kDuFsAhEatcU, p2epArE4laJj))
elif AIvJRzLdDfgF == xafqLlk3kkUe(SXOLrMavuUCe(b'\x9cV\xfc0\xd1)\x08\xb9Q\\\x83'), chr(100) + '\x65' + '\x63' + '\157' + chr(0b100001 + 0o103) + chr(0b1011010 + 0o13))(chr(0b100 + 0o161) + '\x74' + chr(102) + chr(0b101101) + chr(0b10110 + 0o42)):
VHn4CV4Ymrei *= geSuxboM5P7u ** (kDuFsAhEatcU // a2WFZ5AJLt58)
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xad]\xf4?\xc7\x01\x03\xefRO\x99Y\xf5\xfe\xa4\x19\n\x07'), '\144' + chr(101) + chr(3095 - 2996) + chr(5639 - 5528) + chr(100) + chr(5555 - 5454))(chr(9154 - 9037) + chr(116) + chr(0b1100110) + '\x2d' + '\x38') % AIvJRzLdDfgF)
return VHn4CV4Ymrei
JBxHcyS7J02d[fpDPKwN_e9yc] = QGSIpd_yUNzU
return QGSIpd_yUNzU
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/learning_rate.py
|
EvalAdjustingSchedule
|
def EvalAdjustingSchedule(history,
constant=0.1,
steps_to_decrease=20,
improvement_margin=0.001,
decrease_rate=1.5,
history_mode="eval",
metric="metrics/accuracy"):
"""Learning rate that decreases when eval metric stalls.
If the chosen metric does not improve by improvement_margin for as many as
steps_to_decrease steps, then the constant gets decreased by decrease rate.
Finally, the MultifactorSchedule gets called with the adjusted constant.
Args:
history: trax.history.History, the history of training and evaluation.
constant: float, the starting constant for the learning rate schedule.
steps_to_decrease: int, after how many steps without improvement
should we decrease the constant.
improvement_margin: how much we need to improve to consider the metric
improved.
decrease_rate: by what fraction to decrease (i.e. lr /= decrease_rate).
history_mode: str, which mode of the history to use.
metric: which evaluation metric to use for adjustments.
Returns:
a function learning_rate(step): float -> float, the step-dependent lr.
"""
metrics = history.get(history_mode, metric)
adjusted = constant
if len(metrics) < 2:
return MultifactorSchedule(history, constant=adjusted)
steps_without_improvement = 0
cur = metrics.pop()[1] # The most-recent value of the metric.
while len(metrics) > 1:
# The one-before value of metrics as .pop() removes one element each time.
prev = metrics.pop()[1]
if cur < prev * (1 + improvement_margin):
steps_without_improvement += 1
else:
cur = prev
steps_without_improvement = 0
if steps_without_improvement >= steps_to_decrease:
adjusted /= decrease_rate
cur = prev
steps_without_improvement = 0
return MultifactorSchedule(history, constant=adjusted)
|
python
|
def EvalAdjustingSchedule(history,
constant=0.1,
steps_to_decrease=20,
improvement_margin=0.001,
decrease_rate=1.5,
history_mode="eval",
metric="metrics/accuracy"):
"""Learning rate that decreases when eval metric stalls.
If the chosen metric does not improve by improvement_margin for as many as
steps_to_decrease steps, then the constant gets decreased by decrease rate.
Finally, the MultifactorSchedule gets called with the adjusted constant.
Args:
history: trax.history.History, the history of training and evaluation.
constant: float, the starting constant for the learning rate schedule.
steps_to_decrease: int, after how many steps without improvement
should we decrease the constant.
improvement_margin: how much we need to improve to consider the metric
improved.
decrease_rate: by what fraction to decrease (i.e. lr /= decrease_rate).
history_mode: str, which mode of the history to use.
metric: which evaluation metric to use for adjustments.
Returns:
a function learning_rate(step): float -> float, the step-dependent lr.
"""
metrics = history.get(history_mode, metric)
adjusted = constant
if len(metrics) < 2:
return MultifactorSchedule(history, constant=adjusted)
steps_without_improvement = 0
cur = metrics.pop()[1] # The most-recent value of the metric.
while len(metrics) > 1:
# The one-before value of metrics as .pop() removes one element each time.
prev = metrics.pop()[1]
if cur < prev * (1 + improvement_margin):
steps_without_improvement += 1
else:
cur = prev
steps_without_improvement = 0
if steps_without_improvement >= steps_to_decrease:
adjusted /= decrease_rate
cur = prev
steps_without_improvement = 0
return MultifactorSchedule(history, constant=adjusted)
|
[
"def",
"EvalAdjustingSchedule",
"(",
"history",
",",
"constant",
"=",
"0.1",
",",
"steps_to_decrease",
"=",
"20",
",",
"improvement_margin",
"=",
"0.001",
",",
"decrease_rate",
"=",
"1.5",
",",
"history_mode",
"=",
"\"eval\"",
",",
"metric",
"=",
"\"metrics/accuracy\"",
")",
":",
"metrics",
"=",
"history",
".",
"get",
"(",
"history_mode",
",",
"metric",
")",
"adjusted",
"=",
"constant",
"if",
"len",
"(",
"metrics",
")",
"<",
"2",
":",
"return",
"MultifactorSchedule",
"(",
"history",
",",
"constant",
"=",
"adjusted",
")",
"steps_without_improvement",
"=",
"0",
"cur",
"=",
"metrics",
".",
"pop",
"(",
")",
"[",
"1",
"]",
"# The most-recent value of the metric.",
"while",
"len",
"(",
"metrics",
")",
">",
"1",
":",
"# The one-before value of metrics as .pop() removes one element each time.",
"prev",
"=",
"metrics",
".",
"pop",
"(",
")",
"[",
"1",
"]",
"if",
"cur",
"<",
"prev",
"*",
"(",
"1",
"+",
"improvement_margin",
")",
":",
"steps_without_improvement",
"+=",
"1",
"else",
":",
"cur",
"=",
"prev",
"steps_without_improvement",
"=",
"0",
"if",
"steps_without_improvement",
">=",
"steps_to_decrease",
":",
"adjusted",
"/=",
"decrease_rate",
"cur",
"=",
"prev",
"steps_without_improvement",
"=",
"0",
"return",
"MultifactorSchedule",
"(",
"history",
",",
"constant",
"=",
"adjusted",
")"
] |
Learning rate that decreases when eval metric stalls.
If the chosen metric does not improve by improvement_margin for as many as
steps_to_decrease steps, then the constant gets decreased by decrease rate.
Finally, the MultifactorSchedule gets called with the adjusted constant.
Args:
history: trax.history.History, the history of training and evaluation.
constant: float, the starting constant for the learning rate schedule.
steps_to_decrease: int, after how many steps without improvement
should we decrease the constant.
improvement_margin: how much we need to improve to consider the metric
improved.
decrease_rate: by what fraction to decrease (i.e. lr /= decrease_rate).
history_mode: str, which mode of the history to use.
metric: which evaluation metric to use for adjustments.
Returns:
a function learning_rate(step): float -> float, the step-dependent lr.
|
[
"Learning",
"rate",
"that",
"decreases",
"when",
"eval",
"metric",
"stalls",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/learning_rate.py#L96-L143
|
train
|
This function calculates the learning rate that decreases when eval metric stalls.
|
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,RQ6CSRrF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j,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) + '\157' + '\061' + chr(0b101 + 0o57) + chr(0b10010 + 0o42), 60900 - 60892), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + '\063' + chr(53) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(2266 - 2218) + '\x6f' + chr(109 - 60) + chr(1360 - 1311) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b10011 + 0o43) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(2516 - 2461) + '\x35', 0b1000), ehT0Px3KOsy9(chr(1604 - 1556) + '\x6f' + '\061' + '\067' + chr(2811 - 2756), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + '\063' + chr(0b110001 + 0o1) + chr(63 - 13), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + chr(364 - 310), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1001001 + 0o46) + '\x31' + '\065' + '\x37', 60976 - 60968), ehT0Px3KOsy9(chr(1217 - 1169) + '\157' + '\062' + '\063' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1094 - 1046) + chr(111) + '\x32' + chr(49) + chr(0b110110), 11316 - 11308), ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(9424 - 9313) + chr(0b110011) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(0b10010 + 0o37) + chr(948 - 900), 58613 - 58605), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + '\x32' + '\x32' + chr(0b11110 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101101 + 0o4) + '\x30' + chr(0b11011 + 0o25), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(54) + chr(0b110001 + 0o6), 32939 - 32931), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b11111 + 0o120) + chr(0b100111 + 0o12) + chr(0b101011 + 0o11) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2048 - 2000) + chr(0b101111 + 0o100) + chr(0b100110 + 0o17) + chr(0b101100 + 0o4), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101000 + 0o13) + chr(0b110000) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b10101 + 0o132) + '\063' + chr(0b110001) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x36' + chr(0b10100 + 0o34), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\x33' + chr(2361 - 2308), 33230 - 33222), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2344 - 2295) + chr(0b111 + 0o51) + '\x30', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(850 - 799) + chr(50) + chr(0b10000 + 0o43), 0b1000), ehT0Px3KOsy9(chr(56 - 8) + '\x6f' + chr(631 - 582) + '\x33' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(121 - 73) + '\x6f' + chr(51) + chr(0b110010) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + '\061' + chr(0b110110) + '\062', 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(0b110100), 61439 - 61431), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(50) + chr(0b110000), 42221 - 42213), ehT0Px3KOsy9(chr(1797 - 1749) + '\x6f' + chr(0b110011) + chr(53) + chr(0b101011 + 0o13), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b1011 + 0o54) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101101 + 0o2) + chr(0b110010) + chr(2073 - 2020), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(50) + chr(0b11 + 0o61) + '\x36', 42347 - 42339), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(10860 - 10749) + '\065' + '\061', 14307 - 14299), ehT0Px3KOsy9(chr(1354 - 1306) + '\x6f' + chr(0b110010) + '\063' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(50) + chr(51) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + '\x31' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(860 - 812) + chr(0b1010111 + 0o30) + chr(0b110010) + '\x31' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11101 + 0o24) + chr(51) + '\x35', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'J'), '\144' + '\x65' + '\143' + chr(111) + chr(7660 - 7560) + '\x65')(chr(0b1010101 + 0o40) + chr(116) + chr(0b1100110) + '\x2d' + chr(1817 - 1761)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def IBCiECv1jabo(sD1K7SLfPnDB, QcnzFjzpljjk=0.1, Ii9KjZT5bRF3=ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + '\x32' + '\064', 58331 - 58323), YOJqr9Qwxrwv=0.001, hsGI67fVYZZr=1.5, b5McKY4j57Sw=xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\x99.\x9f'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(0b1101111) + '\144' + chr(3144 - 3043))(chr(0b1110101) + chr(4929 - 4813) + chr(2842 - 2740) + chr(0b101101 + 0o0) + chr(0b111000)), UyTbk4dY9zDl=xafqLlk3kkUe(SXOLrMavuUCe(b'\t\x8a;\x81\x14\x1c\xa1\x01\x0e\xf9\xed_li\xf59'), '\x64' + chr(101) + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(1800 - 1744))):
yYegMqDoSfs5 = sD1K7SLfPnDB.get(b5McKY4j57Sw, UyTbk4dY9zDl)
qsPxN3DOfcLk = QcnzFjzpljjk
if c2A0yzQpDQB3(yYegMqDoSfs5) < ehT0Px3KOsy9('\060' + chr(5674 - 5563) + '\x32', 0b1000):
return Jmi7OBjNtE9Z(sD1K7SLfPnDB, constant=qsPxN3DOfcLk)
JRnPcxBh0ksD = ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + '\x30', ord("\x08"))
wL6S4kgnTowq = yYegMqDoSfs5.pop()[ehT0Px3KOsy9(chr(74 - 26) + chr(4965 - 4854) + chr(1352 - 1303), ord("\x08"))]
while c2A0yzQpDQB3(yYegMqDoSfs5) > ehT0Px3KOsy9(chr(550 - 502) + '\157' + chr(49), 8):
RIir6MzmTiCT = yYegMqDoSfs5.pop()[ehT0Px3KOsy9(chr(48) + '\x6f' + chr(451 - 402), 8)]
if wL6S4kgnTowq < RIir6MzmTiCT * (ehT0Px3KOsy9(chr(251 - 203) + '\x6f' + chr(0b100100 + 0o15), 8) + YOJqr9Qwxrwv):
JRnPcxBh0ksD += ehT0Px3KOsy9(chr(2281 - 2233) + chr(0b1101111) + chr(0b110001), 8)
else:
wL6S4kgnTowq = RIir6MzmTiCT
JRnPcxBh0ksD = ehT0Px3KOsy9(chr(502 - 454) + chr(111) + '\x30', 8)
if JRnPcxBh0ksD >= Ii9KjZT5bRF3:
qsPxN3DOfcLk /= hsGI67fVYZZr
wL6S4kgnTowq = RIir6MzmTiCT
JRnPcxBh0ksD = ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(0b110000), 8)
return Jmi7OBjNtE9Z(sD1K7SLfPnDB, constant=qsPxN3DOfcLk)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
project_hidden
|
def project_hidden(x, projection_tensors, hidden_size, num_blocks):
"""Project encoder hidden state under num_blocks using projection tensors.
Args:
x: Encoder hidden state of shape [batch_size, latent_dim, hidden_size].
projection_tensors: Projection tensors used to project the hidden state.
hidden_size: Dimension of the latent space.
num_blocks: Number of blocks in DVQ.
Returns:
x_projected: Projected states of shape [batch_size, latent_dim, num_blocks,
hidden_size / num_blocks].
"""
batch_size, latent_dim, _ = common_layers.shape_list(x)
x = tf.reshape(x, shape=[1, -1, hidden_size])
x_tiled = tf.reshape(
tf.tile(x, multiples=[num_blocks, 1, 1]),
shape=[num_blocks, -1, hidden_size])
x_projected = tf.matmul(x_tiled, projection_tensors)
x_projected = tf.transpose(x_projected, perm=[1, 0, 2])
x_4d = tf.reshape(x_projected, [batch_size, latent_dim, num_blocks, -1])
return x_4d
|
python
|
def project_hidden(x, projection_tensors, hidden_size, num_blocks):
"""Project encoder hidden state under num_blocks using projection tensors.
Args:
x: Encoder hidden state of shape [batch_size, latent_dim, hidden_size].
projection_tensors: Projection tensors used to project the hidden state.
hidden_size: Dimension of the latent space.
num_blocks: Number of blocks in DVQ.
Returns:
x_projected: Projected states of shape [batch_size, latent_dim, num_blocks,
hidden_size / num_blocks].
"""
batch_size, latent_dim, _ = common_layers.shape_list(x)
x = tf.reshape(x, shape=[1, -1, hidden_size])
x_tiled = tf.reshape(
tf.tile(x, multiples=[num_blocks, 1, 1]),
shape=[num_blocks, -1, hidden_size])
x_projected = tf.matmul(x_tiled, projection_tensors)
x_projected = tf.transpose(x_projected, perm=[1, 0, 2])
x_4d = tf.reshape(x_projected, [batch_size, latent_dim, num_blocks, -1])
return x_4d
|
[
"def",
"project_hidden",
"(",
"x",
",",
"projection_tensors",
",",
"hidden_size",
",",
"num_blocks",
")",
":",
"batch_size",
",",
"latent_dim",
",",
"_",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"shape",
"=",
"[",
"1",
",",
"-",
"1",
",",
"hidden_size",
"]",
")",
"x_tiled",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"tile",
"(",
"x",
",",
"multiples",
"=",
"[",
"num_blocks",
",",
"1",
",",
"1",
"]",
")",
",",
"shape",
"=",
"[",
"num_blocks",
",",
"-",
"1",
",",
"hidden_size",
"]",
")",
"x_projected",
"=",
"tf",
".",
"matmul",
"(",
"x_tiled",
",",
"projection_tensors",
")",
"x_projected",
"=",
"tf",
".",
"transpose",
"(",
"x_projected",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"x_4d",
"=",
"tf",
".",
"reshape",
"(",
"x_projected",
",",
"[",
"batch_size",
",",
"latent_dim",
",",
"num_blocks",
",",
"-",
"1",
"]",
")",
"return",
"x_4d"
] |
Project encoder hidden state under num_blocks using projection tensors.
Args:
x: Encoder hidden state of shape [batch_size, latent_dim, hidden_size].
projection_tensors: Projection tensors used to project the hidden state.
hidden_size: Dimension of the latent space.
num_blocks: Number of blocks in DVQ.
Returns:
x_projected: Projected states of shape [batch_size, latent_dim, num_blocks,
hidden_size / num_blocks].
|
[
"Project",
"encoder",
"hidden",
"state",
"under",
"num_blocks",
"using",
"projection",
"tensors",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L33-L54
|
train
|
Project encoder hidden state under num_blocks using projection tensors.
|
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,ZMHES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3xd4bh,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(0b101101 + 0o3) + chr(6829 - 6718) + chr(50) + chr(51) + chr(0b110010 + 0o1), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(194 - 143) + '\x32' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b101 + 0o55) + chr(0b110000) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2558 - 2507) + chr(0b110110) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110111) + chr(0b100011 + 0o20), 0o10), ehT0Px3KOsy9(chr(1716 - 1668) + chr(0b1101111) + chr(51) + '\x32' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + chr(1233 - 1184) + chr(0b100 + 0o62) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(54) + '\x36', 62738 - 62730), ehT0Px3KOsy9('\060' + chr(6793 - 6682) + '\x32' + chr(0b11111 + 0o21) + chr(0b1001 + 0o51), 32076 - 32068), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\x6f' + '\061' + '\x35' + chr(0b101001 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b100101 + 0o13) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2596 - 2485) + '\062' + chr(0b110001) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6252 - 6141) + chr(0b100010 + 0o21) + chr(0b110010) + chr(0b110011 + 0o2), ord("\x08")), ehT0Px3KOsy9('\060' + chr(167 - 56) + chr(0b11111 + 0o22) + chr(0b110011 + 0o1) + chr(0b110000), 5704 - 5696), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b11 + 0o56) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(1641 - 1590) + chr(49) + '\063', 36880 - 36872), ehT0Px3KOsy9(chr(469 - 421) + chr(5707 - 5596) + chr(1199 - 1144) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x36' + chr(0b110111), 29946 - 29938), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + '\x35' + chr(0b110000 + 0o2), 34199 - 34191), ehT0Px3KOsy9('\x30' + chr(0b11010 + 0o125) + '\062' + chr(2231 - 2179) + '\x33', 0b1000), ehT0Px3KOsy9(chr(2204 - 2156) + chr(111) + chr(0b110111) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(215 - 167) + chr(111) + '\062' + chr(54) + chr(0b11 + 0o55), 0o10), ehT0Px3KOsy9('\060' + chr(3354 - 3243) + chr(51) + '\063' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + chr(0b1000 + 0o51) + chr(2220 - 2168) + chr(318 - 268), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(48) + chr(2498 - 2443), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(54) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(3954 - 3843) + '\061' + chr(49) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\062' + '\062' + chr(0b10111 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(53) + '\x33', 53907 - 53899), ehT0Px3KOsy9(chr(48) + chr(7514 - 7403) + '\063' + chr(209 - 158) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(1605 - 1494) + chr(0b110001 + 0o1) + '\x35' + chr(0b10011 + 0o40), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\x31' + chr(208 - 154), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(2215 - 2166) + chr(755 - 702) + chr(806 - 757), 31909 - 31901), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(11035 - 10924) + '\062' + chr(55) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x35' + chr(0b110001), 33793 - 33785), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1101 + 0o46) + chr(0b110011) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100100 + 0o113) + chr(2165 - 2114) + chr(0b10011 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3455 - 3344) + chr(0b110001) + chr(1527 - 1477) + '\065', 35716 - 35708)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(805 - 757) + chr(0b1101111) + chr(0b101110 + 0o7) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5'), chr(0b1100100) + '\x65' + chr(2097 - 1998) + chr(0b1101111) + chr(0b1000010 + 0o42) + chr(101))('\165' + chr(7036 - 6920) + '\146' + '\x2d' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def LGyHV2Zcrcvi(OeWW0F1dBPRQ, ZSxXCHnDE64q, qzoyXN3kdhDL, azOnMTJc4Vem):
(ix9dZyeAmUxY, GELGNuVd7ZTT, VNGQdHSFPrso) = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, shape=[ehT0Px3KOsy9(chr(1428 - 1380) + chr(111) + chr(0b101110 + 0o3), 0b1000), -ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101011 + 0o6), 8), qzoyXN3kdhDL])
SwmfzTMZJd6D = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.tile(OeWW0F1dBPRQ, multiples=[azOnMTJc4Vem, ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1000010 + 0o55) + chr(0b110001), 8)]), shape=[azOnMTJc4Vem, -ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1887 - 1838), 8), qzoyXN3kdhDL])
QEzXcyb_fsmG = IDJ2eXGCBCDu.matmul(SwmfzTMZJd6D, ZSxXCHnDE64q)
QEzXcyb_fsmG = IDJ2eXGCBCDu.transpose(QEzXcyb_fsmG, perm=[ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1110 + 0o43), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(586 - 538), 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b11111 + 0o120) + chr(0b11111 + 0o23), ord("\x08"))])
XD3BeiZf24hm = IDJ2eXGCBCDu.reshape(QEzXcyb_fsmG, [ix9dZyeAmUxY, GELGNuVd7ZTT, azOnMTJc4Vem, -ehT0Px3KOsy9('\060' + chr(111) + '\061', 8)])
return XD3BeiZf24hm
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
slice_hidden
|
def slice_hidden(x, hidden_size, num_blocks):
"""Slice encoder hidden state under num_blocks.
Args:
x: Encoder hidden state of shape [batch_size, latent_dim, hidden_size].
hidden_size: Dimension of the latent space.
num_blocks: Number of blocks in DVQ.
Returns:
Sliced states of shape [batch_size, latent_dim, num_blocks, block_dim].
"""
batch_size, latent_dim, _ = common_layers.shape_list(x)
block_dim = hidden_size // num_blocks
x_sliced = tf.reshape(x,
shape=[batch_size, latent_dim, num_blocks, block_dim])
return x_sliced
|
python
|
def slice_hidden(x, hidden_size, num_blocks):
"""Slice encoder hidden state under num_blocks.
Args:
x: Encoder hidden state of shape [batch_size, latent_dim, hidden_size].
hidden_size: Dimension of the latent space.
num_blocks: Number of blocks in DVQ.
Returns:
Sliced states of shape [batch_size, latent_dim, num_blocks, block_dim].
"""
batch_size, latent_dim, _ = common_layers.shape_list(x)
block_dim = hidden_size // num_blocks
x_sliced = tf.reshape(x,
shape=[batch_size, latent_dim, num_blocks, block_dim])
return x_sliced
|
[
"def",
"slice_hidden",
"(",
"x",
",",
"hidden_size",
",",
"num_blocks",
")",
":",
"batch_size",
",",
"latent_dim",
",",
"_",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"block_dim",
"=",
"hidden_size",
"//",
"num_blocks",
"x_sliced",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"shape",
"=",
"[",
"batch_size",
",",
"latent_dim",
",",
"num_blocks",
",",
"block_dim",
"]",
")",
"return",
"x_sliced"
] |
Slice encoder hidden state under num_blocks.
Args:
x: Encoder hidden state of shape [batch_size, latent_dim, hidden_size].
hidden_size: Dimension of the latent space.
num_blocks: Number of blocks in DVQ.
Returns:
Sliced states of shape [batch_size, latent_dim, num_blocks, block_dim].
|
[
"Slice",
"encoder",
"hidden",
"state",
"under",
"num_blocks",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L57-L72
|
train
|
Slice encoder hidden state under num_blocks.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sH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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(4318 - 4207) + '\063' + '\060', 43970 - 43962), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1911 - 1862) + '\065' + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10001 + 0o37), 22522 - 22514), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(2346 - 2293) + '\066', 12500 - 12492), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(1049 - 999) + '\x35' + '\065', 45241 - 45233), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(53) + chr(0b100 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(1835 - 1787) + '\x6f' + chr(1008 - 956) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1799 - 1748) + chr(50) + '\067', 0b1000), ehT0Px3KOsy9(chr(427 - 379) + chr(7528 - 7417) + chr(49) + '\063' + chr(0b110101), 22355 - 22347), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10011 + 0o40) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b110011) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(0b11101 + 0o30) + chr(0b11011 + 0o31), 0b1000), ehT0Px3KOsy9('\060' + chr(3055 - 2944) + '\x31' + '\x30' + chr(52), 41629 - 41621), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100100 + 0o23) + chr(0b110011), 2597 - 2589), ehT0Px3KOsy9('\060' + chr(0b111101 + 0o62) + '\067' + chr(0b10 + 0o56), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x37' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + '\062' + chr(1712 - 1663) + '\067', 57512 - 57504), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b100011 + 0o24) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + chr(0b11100 + 0o27) + chr(0b110010) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b1010 + 0o52), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001 + 0o2) + '\x36' + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + chr(49) + chr(0b110110) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(68 - 19) + chr(52) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(7428 - 7317) + '\062' + chr(0b110000) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110110) + chr(1318 - 1270), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\x36' + chr(0b10000 + 0o43), 0b1000), ehT0Px3KOsy9('\x30' + chr(2541 - 2430) + '\063' + chr(451 - 398) + chr(55), 54829 - 54821), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + chr(0b100001 + 0o23) + '\x34', 57982 - 57974), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(2223 - 2174) + chr(0b11001 + 0o31) + '\061', 22215 - 22207), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(1377 - 1324) + chr(0b110111), 12703 - 12695), ehT0Px3KOsy9('\060' + chr(4873 - 4762) + '\x33' + chr(0b110011) + chr(0b110001), 38736 - 38728), ehT0Px3KOsy9(chr(2089 - 2041) + '\x6f' + chr(0b110011) + chr(475 - 424) + '\067', 46197 - 46189), ehT0Px3KOsy9('\060' + '\x6f' + chr(1883 - 1834) + chr(0b101110 + 0o5) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(11932 - 11821) + chr(0b1100 + 0o46) + chr(0b10110 + 0o36) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110000) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1508 - 1460) + chr(0b1101111) + chr(0b11000 + 0o37) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + '\x33' + chr(0b110000 + 0o1) + chr(752 - 699), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\x36' + chr(0b1 + 0o63), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + '\x37', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(791 - 743) + chr(7698 - 7587) + '\x35' + chr(0b11 + 0o55), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'6'), '\144' + '\x65' + chr(610 - 511) + chr(0b1101111) + '\x64' + chr(6258 - 6157))(chr(0b1110101) + chr(116) + chr(102) + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def GNfWXfXMlQz5(OeWW0F1dBPRQ, qzoyXN3kdhDL, azOnMTJc4Vem):
(ix9dZyeAmUxY, GELGNuVd7ZTT, VNGQdHSFPrso) = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
beq0UcPkiJvw = qzoyXN3kdhDL // azOnMTJc4Vem
cLA_Onji0yiU = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, shape=[ix9dZyeAmUxY, GELGNuVd7ZTT, azOnMTJc4Vem, beq0UcPkiJvw])
return cLA_Onji0yiU
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
nearest_neighbor
|
def nearest_neighbor(x,
means,
block_v_size,
random_top_k=1,
soft_em=False,
num_samples=1,
sum_over_latents=False,
summary=True):
"""Find the nearest element in means to elements in x.
Args:
x: Continuous encodings of shape [batch_size, latent_dim, num_blocks,
block_dim].
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
block_v_size: Number of table entries per block.
random_top_k: Noisy top-k if this is bigger than 1.
soft_em: If True then use soft EM rather than hard EM.
num_samples: Number of samples to take in soft EM.
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss. Used only when doing soft EM.
summary: If True then record summary histogram of entropies.
Returns:
Tensor with nearest element in mean encoded in one-hot notation
and distances.
"""
batch_size, latent_dim, num_blocks, block_dim = common_layers.shape_list(x)
x = tf.reshape(x, [batch_size * latent_dim, num_blocks, block_dim])
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
# computing cluster probabilities
if soft_em:
num_blocks = common_layers.shape_list(dist)[1]
nearest_idx = tf.stack(
[
tf.multinomial(-dist[:, i, :], num_samples=num_samples)
for i in range(num_blocks)
],
axis=1)
nearest_hot = tf.one_hot(nearest_idx, depth=block_v_size)
neg_q_entropy = tf.reduce_sum(
nearest_hot * tf.expand_dims(tf.nn.log_softmax(-dist), 2), axis=2)
if sum_over_latents:
neg_q_entropy = tf.reduce_sum(neg_q_entropy, [1, 2])
neg_q_entropy = tf.reduce_mean(neg_q_entropy, axis=0)
nearest_hot = tf.reduce_mean(nearest_hot, axis=-2)
if summary:
tf.summary.histogram("neg_q_entropy", tf.reshape(neg_q_entropy, [-1]))
else:
neg_q_entropy = 0.
if random_top_k > 1:
_, top_k_idx = tf.nn.top_k(-dist, k=random_top_k)
nearest_idx = tf.gather(
top_k_idx,
tf.random_uniform(
[1], minval=0, maxval=random_top_k - 1, dtype=tf.int32),
axis=-1)
else:
nearest_idx = tf.argmax(-dist, axis=-1)
nearest_hot = tf.one_hot(nearest_idx, block_v_size)
return nearest_hot, neg_q_entropy
|
python
|
def nearest_neighbor(x,
means,
block_v_size,
random_top_k=1,
soft_em=False,
num_samples=1,
sum_over_latents=False,
summary=True):
"""Find the nearest element in means to elements in x.
Args:
x: Continuous encodings of shape [batch_size, latent_dim, num_blocks,
block_dim].
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
block_v_size: Number of table entries per block.
random_top_k: Noisy top-k if this is bigger than 1.
soft_em: If True then use soft EM rather than hard EM.
num_samples: Number of samples to take in soft EM.
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss. Used only when doing soft EM.
summary: If True then record summary histogram of entropies.
Returns:
Tensor with nearest element in mean encoded in one-hot notation
and distances.
"""
batch_size, latent_dim, num_blocks, block_dim = common_layers.shape_list(x)
x = tf.reshape(x, [batch_size * latent_dim, num_blocks, block_dim])
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
# computing cluster probabilities
if soft_em:
num_blocks = common_layers.shape_list(dist)[1]
nearest_idx = tf.stack(
[
tf.multinomial(-dist[:, i, :], num_samples=num_samples)
for i in range(num_blocks)
],
axis=1)
nearest_hot = tf.one_hot(nearest_idx, depth=block_v_size)
neg_q_entropy = tf.reduce_sum(
nearest_hot * tf.expand_dims(tf.nn.log_softmax(-dist), 2), axis=2)
if sum_over_latents:
neg_q_entropy = tf.reduce_sum(neg_q_entropy, [1, 2])
neg_q_entropy = tf.reduce_mean(neg_q_entropy, axis=0)
nearest_hot = tf.reduce_mean(nearest_hot, axis=-2)
if summary:
tf.summary.histogram("neg_q_entropy", tf.reshape(neg_q_entropy, [-1]))
else:
neg_q_entropy = 0.
if random_top_k > 1:
_, top_k_idx = tf.nn.top_k(-dist, k=random_top_k)
nearest_idx = tf.gather(
top_k_idx,
tf.random_uniform(
[1], minval=0, maxval=random_top_k - 1, dtype=tf.int32),
axis=-1)
else:
nearest_idx = tf.argmax(-dist, axis=-1)
nearest_hot = tf.one_hot(nearest_idx, block_v_size)
return nearest_hot, neg_q_entropy
|
[
"def",
"nearest_neighbor",
"(",
"x",
",",
"means",
",",
"block_v_size",
",",
"random_top_k",
"=",
"1",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"1",
",",
"sum_over_latents",
"=",
"False",
",",
"summary",
"=",
"True",
")",
":",
"batch_size",
",",
"latent_dim",
",",
"num_blocks",
",",
"block_dim",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"batch_size",
"*",
"latent_dim",
",",
"num_blocks",
",",
"block_dim",
"]",
")",
"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",
"# computing cluster probabilities",
"if",
"soft_em",
":",
"num_blocks",
"=",
"common_layers",
".",
"shape_list",
"(",
"dist",
")",
"[",
"1",
"]",
"nearest_idx",
"=",
"tf",
".",
"stack",
"(",
"[",
"tf",
".",
"multinomial",
"(",
"-",
"dist",
"[",
":",
",",
"i",
",",
":",
"]",
",",
"num_samples",
"=",
"num_samples",
")",
"for",
"i",
"in",
"range",
"(",
"num_blocks",
")",
"]",
",",
"axis",
"=",
"1",
")",
"nearest_hot",
"=",
"tf",
".",
"one_hot",
"(",
"nearest_idx",
",",
"depth",
"=",
"block_v_size",
")",
"neg_q_entropy",
"=",
"tf",
".",
"reduce_sum",
"(",
"nearest_hot",
"*",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"nn",
".",
"log_softmax",
"(",
"-",
"dist",
")",
",",
"2",
")",
",",
"axis",
"=",
"2",
")",
"if",
"sum_over_latents",
":",
"neg_q_entropy",
"=",
"tf",
".",
"reduce_sum",
"(",
"neg_q_entropy",
",",
"[",
"1",
",",
"2",
"]",
")",
"neg_q_entropy",
"=",
"tf",
".",
"reduce_mean",
"(",
"neg_q_entropy",
",",
"axis",
"=",
"0",
")",
"nearest_hot",
"=",
"tf",
".",
"reduce_mean",
"(",
"nearest_hot",
",",
"axis",
"=",
"-",
"2",
")",
"if",
"summary",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"neg_q_entropy\"",
",",
"tf",
".",
"reshape",
"(",
"neg_q_entropy",
",",
"[",
"-",
"1",
"]",
")",
")",
"else",
":",
"neg_q_entropy",
"=",
"0.",
"if",
"random_top_k",
">",
"1",
":",
"_",
",",
"top_k_idx",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"-",
"dist",
",",
"k",
"=",
"random_top_k",
")",
"nearest_idx",
"=",
"tf",
".",
"gather",
"(",
"top_k_idx",
",",
"tf",
".",
"random_uniform",
"(",
"[",
"1",
"]",
",",
"minval",
"=",
"0",
",",
"maxval",
"=",
"random_top_k",
"-",
"1",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
",",
"axis",
"=",
"-",
"1",
")",
"else",
":",
"nearest_idx",
"=",
"tf",
".",
"argmax",
"(",
"-",
"dist",
",",
"axis",
"=",
"-",
"1",
")",
"nearest_hot",
"=",
"tf",
".",
"one_hot",
"(",
"nearest_idx",
",",
"block_v_size",
")",
"return",
"nearest_hot",
",",
"neg_q_entropy"
] |
Find the nearest element in means to elements in x.
Args:
x: Continuous encodings of shape [batch_size, latent_dim, num_blocks,
block_dim].
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
block_v_size: Number of table entries per block.
random_top_k: Noisy top-k if this is bigger than 1.
soft_em: If True then use soft EM rather than hard EM.
num_samples: Number of samples to take in soft EM.
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss. Used only when doing soft EM.
summary: If True then record summary histogram of entropies.
Returns:
Tensor with nearest element in mean encoded in one-hot notation
and distances.
|
[
"Find",
"the",
"nearest",
"element",
"in",
"means",
"to",
"elements",
"in",
"x",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L75-L141
|
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,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(2015 - 1967) + chr(0b101001 + 0o106) + '\x31' + chr(0b110100) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\065' + chr(0b101011 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(856 - 805), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(53) + chr(0b10100 + 0o35), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b111110 + 0o61) + chr(929 - 880) + chr(1125 - 1074) + chr(0b100100 + 0o22), 18261 - 18253), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(50) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101100 + 0o7) + chr(411 - 360) + chr(55), 45769 - 45761), ehT0Px3KOsy9('\x30' + chr(0b1011001 + 0o26) + chr(167 - 118) + chr(0b110110) + chr(0b101111 + 0o2), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(2011 - 1959) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000100 + 0o53) + '\x32' + '\x31' + chr(1569 - 1521), 38986 - 38978), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(7545 - 7434) + chr(51) + chr(0b110011) + chr(1704 - 1650), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + '\065' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + '\x31' + '\x31' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(9959 - 9848) + chr(51) + chr(0b1111 + 0o44) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(2554 - 2502) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b110110) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11010 + 0o125) + chr(0b10000 + 0o43) + chr(0b100111 + 0o16) + chr(0b10100 + 0o35), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(0b110010) + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b11110 + 0o24) + chr(1585 - 1530), 0b1000), ehT0Px3KOsy9(chr(48) + chr(358 - 247) + chr(49) + '\065' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(2009 - 1961) + chr(0b1101111) + '\063' + chr(55) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(55) + chr(1034 - 981), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(681 - 628), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\060' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(0b110000) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1010000 + 0o37) + '\066' + chr(0b100001 + 0o24), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b11010 + 0o35) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11208 - 11097) + chr(1376 - 1325) + chr(0b110111) + chr(0b101100 + 0o6), 53952 - 53944), ehT0Px3KOsy9(chr(973 - 925) + chr(0b1101111) + chr(687 - 639), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(51) + '\066', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b10000 + 0o137) + chr(49) + chr(0b110100) + chr(0b110011), 65504 - 65496), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(10110 - 9999) + chr(0b100110 + 0o14) + chr(0b100110 + 0o13) + chr(0b101000 + 0o14), 28479 - 28471), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(53) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(11738 - 11627) + chr(0b110001) + chr(2319 - 2268) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(789 - 738) + chr(301 - 247) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3524 - 3413) + chr(0b10110 + 0o34) + '\x30' + chr(49), 0b1000), ehT0Px3KOsy9(chr(1198 - 1150) + chr(9179 - 9068) + '\061' + chr(54) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(2601 - 2550) + chr(0b110000) + chr(1160 - 1109), 8), ehT0Px3KOsy9('\060' + chr(9887 - 9776) + '\x32' + chr(0b100110 + 0o14) + chr(0b101101 + 0o4), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + chr(53) + chr(1935 - 1887), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'O'), chr(0b1100100) + chr(101) + chr(0b10101 + 0o116) + '\157' + '\144' + '\145')(chr(117) + chr(0b1011011 + 0o31) + chr(0b1100110) + chr(582 - 537) + chr(0b11110 + 0o32)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ynNl3vltSzzU(OeWW0F1dBPRQ, XCAIkNRdiX0I, oNd8C7o94vJ7, dnb6Ebgk6qnD=ehT0Px3KOsy9(chr(740 - 692) + chr(7104 - 6993) + '\x31', 64931 - 64923), sjb7MZHDGfYq=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000), 8), Wuetkhsbidt0=ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(1128 - 1079), 8), obB50GGkp9jd=ehT0Px3KOsy9(chr(603 - 555) + chr(0b1101111) + chr(1725 - 1677), 8), oLgyQ45ORWXM=ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(1050 - 939) + chr(1884 - 1835), 8)):
(ix9dZyeAmUxY, GELGNuVd7ZTT, azOnMTJc4Vem, beq0UcPkiJvw) = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [ix9dZyeAmUxY * GELGNuVd7ZTT, azOnMTJc4Vem, beq0UcPkiJvw])
fGB238pT2MDS = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(OeWW0F1dBPRQ), axis=-ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + '\061', 8), keep_dims=ehT0Px3KOsy9('\060' + chr(2298 - 2187) + chr(0b11 + 0o56), 8))
VKkOWR9YyfoZ = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(XCAIkNRdiX0I), axis=-ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001), 8), keep_dims=ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(2237 - 2188), 8))
OsEVnTBapoxv = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(OeWW0F1dBPRQ, perm=[ehT0Px3KOsy9('\060' + chr(11719 - 11608) + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + chr(0b101100 + 0o103) + '\060', 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(50), 0o10)]), IDJ2eXGCBCDu.transpose(XCAIkNRdiX0I, perm=[ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(6866 - 6755) + '\x30', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + chr(50), 8), ehT0Px3KOsy9('\x30' + chr(3776 - 3665) + chr(0b0 + 0o61), 8)]))
OsEVnTBapoxv = IDJ2eXGCBCDu.transpose(OsEVnTBapoxv, perm=[ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\060', 8), ehT0Px3KOsy9(chr(1917 - 1869) + '\x6f' + '\x32', 8)])
ydho_1U2EnKK = fGB238pT2MDS + IDJ2eXGCBCDu.transpose(VKkOWR9YyfoZ, perm=[ehT0Px3KOsy9(chr(1178 - 1130) + chr(8459 - 8348) + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(185 - 137), 8), ehT0Px3KOsy9(chr(1785 - 1737) + chr(0b100111 + 0o110) + chr(0b110001), 8)]) - ehT0Px3KOsy9(chr(815 - 767) + chr(0b1101111) + chr(0b110010), 8) * OsEVnTBapoxv
if sjb7MZHDGfYq:
azOnMTJc4Vem = jSKPaHwSAfVv.shape_list(ydho_1U2EnKK)[ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061', 8)]
Dv7uUy8KB2ra = IDJ2eXGCBCDu.stack([IDJ2eXGCBCDu.multinomial(-ydho_1U2EnKK[:, WVxHKyX45z_L, :], num_samples=Wuetkhsbidt0) for WVxHKyX45z_L in vQr8gNKaIaWE(azOnMTJc4Vem)], axis=ehT0Px3KOsy9(chr(48) + chr(7621 - 7510) + chr(0b11001 + 0o30), 8))
WFCVMlXsdosn = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(Dv7uUy8KB2ra, depth=oNd8C7o94vJ7)
BUVIuWfbUd44 = IDJ2eXGCBCDu.reduce_sum(WFCVMlXsdosn * IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.nn.log_softmax(-ydho_1U2EnKK), ehT0Px3KOsy9(chr(48) + chr(0b110 + 0o151) + chr(0b100010 + 0o20), 8)), axis=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(902 - 852), 8))
if obB50GGkp9jd:
BUVIuWfbUd44 = IDJ2eXGCBCDu.reduce_sum(BUVIuWfbUd44, [ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(966 - 917), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11000 + 0o32), 8)])
BUVIuWfbUd44 = IDJ2eXGCBCDu.reduce_mean(BUVIuWfbUd44, axis=ehT0Px3KOsy9('\060' + chr(10474 - 10363) + chr(48), 8))
WFCVMlXsdosn = IDJ2eXGCBCDu.reduce_mean(WFCVMlXsdosn, axis=-ehT0Px3KOsy9(chr(48) + chr(8147 - 8036) + chr(0b110010), 8))
if oLgyQ45ORWXM:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'>.\x17\xf3)\xaa\xbd\x05\xb0\xdc\xab\xf8'), chr(7043 - 6943) + chr(101) + chr(99) + '\157' + chr(100) + chr(4277 - 4176))(chr(0b1110101) + chr(0b10101 + 0o137) + chr(102) + chr(727 - 682) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\x0fD\xf6/\xcc\xba\x1f\x91\xfa\xb1\xd97'), chr(0b1100100) + '\145' + chr(5759 - 5660) + chr(8036 - 7925) + '\x64' + chr(9384 - 9283))(chr(0b1110000 + 0o5) + chr(116) + chr(0b1100110) + chr(0b101100 + 0o1) + '\070'), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x13\x0fP\xc1?\xe3\xba'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(2147 - 2036) + chr(2542 - 2442) + '\145')(chr(0b1110101) + '\164' + '\146' + '\055' + '\070'))(BUVIuWfbUd44, [-ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31', 8)]))
else:
BUVIuWfbUd44 = 0.0
if dnb6Ebgk6qnD > ehT0Px3KOsy9(chr(48) + chr(9351 - 9240) + chr(49), 8):
(VNGQdHSFPrso, Qoh6CntzWLSX) = IDJ2eXGCBCDu.nn.top_k(-ydho_1U2EnKK, k=dnb6Ebgk6qnD)
Dv7uUy8KB2ra = IDJ2eXGCBCDu.gather(Qoh6CntzWLSX, IDJ2eXGCBCDu.random_uniform([ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8)], minval=ehT0Px3KOsy9('\x30' + chr(0b1001100 + 0o43) + chr(0b110000), 8), maxval=dnb6Ebgk6qnD - ehT0Px3KOsy9(chr(0b110000) + chr(2753 - 2642) + '\x31', 8), dtype=IDJ2eXGCBCDu.int32), axis=-ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + chr(0b110001), 8))
else:
Dv7uUy8KB2ra = IDJ2eXGCBCDu.argmax(-ydho_1U2EnKK, axis=-ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(0b110001), 8))
WFCVMlXsdosn = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(Dv7uUy8KB2ra, oNd8C7o94vJ7)
return (WFCVMlXsdosn, BUVIuWfbUd44)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
embedding_lookup
|
def embedding_lookup(x,
means,
num_blocks,
block_v_size,
bottleneck_kind="dvq",
random_top_k=1,
soft_em=False,
num_samples=1,
do_hard_gumbel_softmax=False,
temperature_warmup_steps=150000,
num_flows=0,
approximate_gs_entropy=False,
sum_over_latents=False):
"""Compute nearest neighbors and loss for training the embeddings via DVQ.
Args:
x: Continuous encodings of shape [batch_size, latent_dim, num_blocks,
block_dim].
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
num_blocks: Number of blocks in DVQ.
block_v_size: Number of table entries per block.
bottleneck_kind: Discrete bottleneck type.
random_top_k: Noisy top-k if this is bigger than 1.
soft_em: If True then use soft EM rather than hard EM.
num_samples: Number of samples to use for soft EM.
do_hard_gumbel_softmax: Whether to use hard or soft Gumbel-Softmax samples
for gumbel-softmax-dvq bottleneck.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0. Used only if bottleneck_kind is gumbel-softmax-dvq.
num_flows: Number of inverse autoregressive flows for gumbel-softmax-dvq
bottleneck.
approximate_gs_entropy: Whether to approximate the Gumbel-Softmax density
as a categorical distribution when calculating the sample entropy. Used
only if bottleneck_kind is gumbel-softmax-dvq.
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss. Used only if soft EM or when bottleneck_kind is
gumbel-softmax-dvq.
Returns:
x_means_hot: The nearest neighbor in one hot form, with shape
[batch_size * latent_dim, num_blocks, block_v_size].
x_means: The nearest neighbor itself, with shape [batch_size * latent_dim,
num_blocks, block_dim].
q_loss: Scalar Tensor representing codebook loss.
e_loss: Scalar Tensor representing commitment loss.
neg_q_entropy: Scalar Tensor representing negative entropy of variational
approximation (0 if it is deterministic).
"""
if bottleneck_kind == "gumbel-softmax-dvq":
x_means_hot, neg_q_entropy = gumbel_softmax_nearest_neighbor_dvq(
x,
means,
block_v_size,
hard=do_hard_gumbel_softmax,
num_samples=num_samples,
temperature_warmup_steps=temperature_warmup_steps,
num_flows=num_flows,
approximate_gs_entropy=approximate_gs_entropy,
sum_over_latents=sum_over_latents)
else:
x_means_hot, neg_q_entropy = nearest_neighbor(
x,
means,
block_v_size,
random_top_k,
soft_em=soft_em,
num_samples=num_samples,
sum_over_latents=sum_over_latents)
x_means_hot_flat = tf.reshape(x_means_hot, [-1, num_blocks, 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])
batch_size, latent_dim, num_blocks, block_dim = common_layers.shape_list(x)
x = tf.reshape(x, [batch_size * latent_dim, num_blocks, block_dim])
# Currently, we use the mean scaling for the commitment loss, as opposed to
# summing across all non-batch dimensions.
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, neg_q_entropy
|
python
|
def embedding_lookup(x,
means,
num_blocks,
block_v_size,
bottleneck_kind="dvq",
random_top_k=1,
soft_em=False,
num_samples=1,
do_hard_gumbel_softmax=False,
temperature_warmup_steps=150000,
num_flows=0,
approximate_gs_entropy=False,
sum_over_latents=False):
"""Compute nearest neighbors and loss for training the embeddings via DVQ.
Args:
x: Continuous encodings of shape [batch_size, latent_dim, num_blocks,
block_dim].
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
num_blocks: Number of blocks in DVQ.
block_v_size: Number of table entries per block.
bottleneck_kind: Discrete bottleneck type.
random_top_k: Noisy top-k if this is bigger than 1.
soft_em: If True then use soft EM rather than hard EM.
num_samples: Number of samples to use for soft EM.
do_hard_gumbel_softmax: Whether to use hard or soft Gumbel-Softmax samples
for gumbel-softmax-dvq bottleneck.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0. Used only if bottleneck_kind is gumbel-softmax-dvq.
num_flows: Number of inverse autoregressive flows for gumbel-softmax-dvq
bottleneck.
approximate_gs_entropy: Whether to approximate the Gumbel-Softmax density
as a categorical distribution when calculating the sample entropy. Used
only if bottleneck_kind is gumbel-softmax-dvq.
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss. Used only if soft EM or when bottleneck_kind is
gumbel-softmax-dvq.
Returns:
x_means_hot: The nearest neighbor in one hot form, with shape
[batch_size * latent_dim, num_blocks, block_v_size].
x_means: The nearest neighbor itself, with shape [batch_size * latent_dim,
num_blocks, block_dim].
q_loss: Scalar Tensor representing codebook loss.
e_loss: Scalar Tensor representing commitment loss.
neg_q_entropy: Scalar Tensor representing negative entropy of variational
approximation (0 if it is deterministic).
"""
if bottleneck_kind == "gumbel-softmax-dvq":
x_means_hot, neg_q_entropy = gumbel_softmax_nearest_neighbor_dvq(
x,
means,
block_v_size,
hard=do_hard_gumbel_softmax,
num_samples=num_samples,
temperature_warmup_steps=temperature_warmup_steps,
num_flows=num_flows,
approximate_gs_entropy=approximate_gs_entropy,
sum_over_latents=sum_over_latents)
else:
x_means_hot, neg_q_entropy = nearest_neighbor(
x,
means,
block_v_size,
random_top_k,
soft_em=soft_em,
num_samples=num_samples,
sum_over_latents=sum_over_latents)
x_means_hot_flat = tf.reshape(x_means_hot, [-1, num_blocks, 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])
batch_size, latent_dim, num_blocks, block_dim = common_layers.shape_list(x)
x = tf.reshape(x, [batch_size * latent_dim, num_blocks, block_dim])
# Currently, we use the mean scaling for the commitment loss, as opposed to
# summing across all non-batch dimensions.
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, neg_q_entropy
|
[
"def",
"embedding_lookup",
"(",
"x",
",",
"means",
",",
"num_blocks",
",",
"block_v_size",
",",
"bottleneck_kind",
"=",
"\"dvq\"",
",",
"random_top_k",
"=",
"1",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"1",
",",
"do_hard_gumbel_softmax",
"=",
"False",
",",
"temperature_warmup_steps",
"=",
"150000",
",",
"num_flows",
"=",
"0",
",",
"approximate_gs_entropy",
"=",
"False",
",",
"sum_over_latents",
"=",
"False",
")",
":",
"if",
"bottleneck_kind",
"==",
"\"gumbel-softmax-dvq\"",
":",
"x_means_hot",
",",
"neg_q_entropy",
"=",
"gumbel_softmax_nearest_neighbor_dvq",
"(",
"x",
",",
"means",
",",
"block_v_size",
",",
"hard",
"=",
"do_hard_gumbel_softmax",
",",
"num_samples",
"=",
"num_samples",
",",
"temperature_warmup_steps",
"=",
"temperature_warmup_steps",
",",
"num_flows",
"=",
"num_flows",
",",
"approximate_gs_entropy",
"=",
"approximate_gs_entropy",
",",
"sum_over_latents",
"=",
"sum_over_latents",
")",
"else",
":",
"x_means_hot",
",",
"neg_q_entropy",
"=",
"nearest_neighbor",
"(",
"x",
",",
"means",
",",
"block_v_size",
",",
"random_top_k",
",",
"soft_em",
"=",
"soft_em",
",",
"num_samples",
"=",
"num_samples",
",",
"sum_over_latents",
"=",
"sum_over_latents",
")",
"x_means_hot_flat",
"=",
"tf",
".",
"reshape",
"(",
"x_means_hot",
",",
"[",
"-",
"1",
",",
"num_blocks",
",",
"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",
"]",
")",
"batch_size",
",",
"latent_dim",
",",
"num_blocks",
",",
"block_dim",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"batch_size",
"*",
"latent_dim",
",",
"num_blocks",
",",
"block_dim",
"]",
")",
"# Currently, we use the mean scaling for the commitment loss, as opposed to",
"# summing across all non-batch dimensions.",
"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",
",",
"neg_q_entropy"
] |
Compute nearest neighbors and loss for training the embeddings via DVQ.
Args:
x: Continuous encodings of shape [batch_size, latent_dim, num_blocks,
block_dim].
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
num_blocks: Number of blocks in DVQ.
block_v_size: Number of table entries per block.
bottleneck_kind: Discrete bottleneck type.
random_top_k: Noisy top-k if this is bigger than 1.
soft_em: If True then use soft EM rather than hard EM.
num_samples: Number of samples to use for soft EM.
do_hard_gumbel_softmax: Whether to use hard or soft Gumbel-Softmax samples
for gumbel-softmax-dvq bottleneck.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0. Used only if bottleneck_kind is gumbel-softmax-dvq.
num_flows: Number of inverse autoregressive flows for gumbel-softmax-dvq
bottleneck.
approximate_gs_entropy: Whether to approximate the Gumbel-Softmax density
as a categorical distribution when calculating the sample entropy. Used
only if bottleneck_kind is gumbel-softmax-dvq.
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss. Used only if soft EM or when bottleneck_kind is
gumbel-softmax-dvq.
Returns:
x_means_hot: The nearest neighbor in one hot form, with shape
[batch_size * latent_dim, num_blocks, block_v_size].
x_means: The nearest neighbor itself, with shape [batch_size * latent_dim,
num_blocks, block_dim].
q_loss: Scalar Tensor representing codebook loss.
e_loss: Scalar Tensor representing commitment loss.
neg_q_entropy: Scalar Tensor representing negative entropy of variational
approximation (0 if it is deterministic).
|
[
"Compute",
"nearest",
"neighbors",
"and",
"loss",
"for",
"training",
"the",
"embeddings",
"via",
"DVQ",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L144-L222
|
train
|
This function computes nearest neighbors and loss for training the embeddings via DVQ.
|
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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v,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' + '\x32' + chr(0b11110 + 0o31), 31308 - 31300), ehT0Px3KOsy9('\x30' + chr(10130 - 10019) + chr(1250 - 1200) + '\060' + chr(0b10 + 0o62), 41534 - 41526), ehT0Px3KOsy9('\060' + chr(11108 - 10997) + chr(50) + chr(0b110001) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b11000 + 0o127) + chr(0b110010) + '\x32' + chr(0b111 + 0o55), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(2545 - 2494) + chr(52) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + '\064' + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11000 + 0o35) + chr(0b110011 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(0b10100 + 0o35) + '\x35' + chr(0b110100), 44502 - 44494), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(1695 - 1644) + chr(2731 - 2678) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(0b1000 + 0o52) + chr(0b11110 + 0o31) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1293 - 1245) + '\157' + chr(50) + chr(0b101100 + 0o6) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1111 + 0o42) + chr(50) + '\066', 0o10), ehT0Px3KOsy9(chr(633 - 585) + chr(0b1101010 + 0o5) + '\x33' + '\x30' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\065' + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(9107 - 8996) + '\061' + '\x32' + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\x31' + chr(49) + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010 + 0o1) + '\064' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101110 + 0o1) + chr(51) + chr(49) + chr(55), 0b1000), ehT0Px3KOsy9(chr(302 - 254) + chr(111) + chr(0b110010 + 0o1) + chr(54) + chr(2447 - 2393), 37353 - 37345), ehT0Px3KOsy9('\x30' + chr(0b1011000 + 0o27) + chr(681 - 630) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(10453 - 10342) + chr(1992 - 1942) + '\x30' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1000001 + 0o56) + chr(0b110101) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(1683 - 1632) + chr(0b110100) + chr(0b111 + 0o51), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(4841 - 4730) + chr(0b1 + 0o60) + chr(55) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(51) + '\x36' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1377 - 1329) + '\157' + chr(50) + chr(1894 - 1842) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(0b110010) + '\x32' + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(5680 - 5569) + chr(50) + chr(2392 - 2337) + chr(2346 - 2295), 49836 - 49828), ehT0Px3KOsy9(chr(1382 - 1334) + chr(111) + '\x32' + chr(655 - 600) + '\063', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001 + 0o1) + '\060' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1561 - 1513) + chr(0b100 + 0o153) + chr(0b11001 + 0o31) + chr(0b10010 + 0o40) + chr(0b101001 + 0o13), 8), ehT0Px3KOsy9(chr(737 - 689) + chr(111) + '\x35' + chr(2052 - 2001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(5969 - 5858) + '\x32' + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8224 - 8113) + chr(0b10101 + 0o34) + '\x33' + chr(2023 - 1969), 3186 - 3178), ehT0Px3KOsy9(chr(426 - 378) + '\157' + chr(0b110011) + chr(0b100110 + 0o15) + '\061', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x35' + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1804 - 1755) + chr(1376 - 1323) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1 + 0o156) + '\061' + chr(51) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(2145 - 2097) + chr(111) + chr(0b100110 + 0o13) + chr(2579 - 2527) + chr(0b110000), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1107 - 1059) + chr(0b1101111) + chr(0b10101 + 0o40) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'9'), chr(5109 - 5009) + chr(101) + chr(0b100 + 0o137) + chr(0b1100101 + 0o12) + '\x64' + chr(0b111010 + 0o53))(chr(117) + chr(116) + chr(0b10010 + 0o124) + chr(0b101101) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def _rf4aB2Cw0sq(OeWW0F1dBPRQ, XCAIkNRdiX0I, azOnMTJc4Vem, oNd8C7o94vJ7, rZIVWZZhpCQD=xafqLlk3kkUe(SXOLrMavuUCe(b's\xf2\xfa'), '\x64' + chr(4837 - 4736) + '\x63' + '\157' + chr(1217 - 1117) + '\x65')(chr(0b100100 + 0o121) + chr(0b1110100) + '\x66' + '\055' + chr(928 - 872)), dnb6Ebgk6qnD=ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + chr(0b100100 + 0o15), 0b1000), sjb7MZHDGfYq=ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(0b110000), 0o10), Wuetkhsbidt0=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8), hDN9FYo5x_x3=ehT0Px3KOsy9(chr(1930 - 1882) + '\157' + chr(0b110000), 8), SpOun2NrX5aX=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101111 + 0o5) + chr(0b110100) + '\x34' + '\067' + chr(0b101101 + 0o11) + chr(332 - 284), 0b1000), GX8NHphWqxXa=ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + '\x30', 8), dHf4p5Wcuj7D=ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(384 - 336), 8), obB50GGkp9jd=ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(579 - 531), 8)):
if rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'p\xf1\xe6\xf6\x81\xcf\x02\x1f\x86\xdc\xe2;\xa0f\x072:\x96'), chr(100) + chr(0b1100101) + chr(0b101 + 0o136) + '\x6f' + chr(0b1100100) + '\x65')(chr(117) + chr(8285 - 8169) + '\146' + '\055' + '\x38'):
(fu_DLUnq0Rui, BUVIuWfbUd44) = CzZi_v00JBG6(OeWW0F1dBPRQ, XCAIkNRdiX0I, oNd8C7o94vJ7, hard=hDN9FYo5x_x3, num_samples=Wuetkhsbidt0, temperature_warmup_steps=SpOun2NrX5aX, num_flows=GX8NHphWqxXa, approximate_gs_entropy=dHf4p5Wcuj7D, sum_over_latents=obB50GGkp9jd)
else:
(fu_DLUnq0Rui, BUVIuWfbUd44) = ynNl3vltSzzU(OeWW0F1dBPRQ, XCAIkNRdiX0I, oNd8C7o94vJ7, dnb6Ebgk6qnD, soft_em=sjb7MZHDGfYq, num_samples=Wuetkhsbidt0, sum_over_latents=obB50GGkp9jd)
OzTTsjtkYNjK = IDJ2eXGCBCDu.reshape(fu_DLUnq0Rui, [-ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b110001), 8), azOnMTJc4Vem, oNd8C7o94vJ7])
xPgmXL9DQrWF = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(OzTTsjtkYNjK, perm=[ehT0Px3KOsy9('\060' + chr(0b1100101 + 0o12) + '\061', 8), ehT0Px3KOsy9(chr(2224 - 2176) + '\157' + '\x30', 8), ehT0Px3KOsy9('\x30' + chr(11039 - 10928) + chr(0b10000 + 0o42), 61579 - 61571)]), XCAIkNRdiX0I)
xPgmXL9DQrWF = IDJ2eXGCBCDu.transpose(xPgmXL9DQrWF, [ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1000101 + 0o52) + '\x31', 8), ehT0Px3KOsy9(chr(0b110000) + chr(1507 - 1396) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(342 - 292), 8)])
(ix9dZyeAmUxY, GELGNuVd7ZTT, azOnMTJc4Vem, beq0UcPkiJvw) = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [ix9dZyeAmUxY * GELGNuVd7ZTT, azOnMTJc4Vem, beq0UcPkiJvw])
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, BUVIuWfbUd44)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
bit_to_int
|
def bit_to_int(x_bit, num_bits, base=2):
"""Turn x_bit representing numbers bitwise (lower-endian) to int tensor.
Args:
x_bit: Tensor containing numbers in a particular base to be converted to
int.
num_bits: Number of bits in the representation.
base: Base of the representation.
Returns:
Integer representation of this number.
"""
x_l = tf.stop_gradient(tf.to_int32(tf.reshape(x_bit, [-1, num_bits])))
x_labels = [
x_l[:, i] * tf.to_int32(base)**tf.to_int32(i) for i in range(num_bits)]
res = sum(x_labels)
return tf.to_int32(tf.reshape(res, common_layers.shape_list(x_bit)[:-1]))
|
python
|
def bit_to_int(x_bit, num_bits, base=2):
"""Turn x_bit representing numbers bitwise (lower-endian) to int tensor.
Args:
x_bit: Tensor containing numbers in a particular base to be converted to
int.
num_bits: Number of bits in the representation.
base: Base of the representation.
Returns:
Integer representation of this number.
"""
x_l = tf.stop_gradient(tf.to_int32(tf.reshape(x_bit, [-1, num_bits])))
x_labels = [
x_l[:, i] * tf.to_int32(base)**tf.to_int32(i) for i in range(num_bits)]
res = sum(x_labels)
return tf.to_int32(tf.reshape(res, common_layers.shape_list(x_bit)[:-1]))
|
[
"def",
"bit_to_int",
"(",
"x_bit",
",",
"num_bits",
",",
"base",
"=",
"2",
")",
":",
"x_l",
"=",
"tf",
".",
"stop_gradient",
"(",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"reshape",
"(",
"x_bit",
",",
"[",
"-",
"1",
",",
"num_bits",
"]",
")",
")",
")",
"x_labels",
"=",
"[",
"x_l",
"[",
":",
",",
"i",
"]",
"*",
"tf",
".",
"to_int32",
"(",
"base",
")",
"**",
"tf",
".",
"to_int32",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"num_bits",
")",
"]",
"res",
"=",
"sum",
"(",
"x_labels",
")",
"return",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"reshape",
"(",
"res",
",",
"common_layers",
".",
"shape_list",
"(",
"x_bit",
")",
"[",
":",
"-",
"1",
"]",
")",
")"
] |
Turn x_bit representing numbers bitwise (lower-endian) to int tensor.
Args:
x_bit: Tensor containing numbers in a particular base to be converted to
int.
num_bits: Number of bits in the representation.
base: Base of the representation.
Returns:
Integer representation of this number.
|
[
"Turn",
"x_bit",
"representing",
"numbers",
"bitwise",
"(",
"lower",
"-",
"endian",
")",
"to",
"int",
"tensor",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L225-L241
|
train
|
Turn x_bit representing numbers bitwise ( lower - endian ) to int 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,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8d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LammpH,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(55) + '\063', 50688 - 50680), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b110100) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\064' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(0b110100) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10000 + 0o43) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(259 - 211) + chr(0b1101111) + chr(0b100001 + 0o20) + chr(0b110101) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10000 + 0o43) + chr(0b110 + 0o53) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(52) + chr(0b110111), 44427 - 44419), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110001 + 0o4) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(453 - 405) + chr(881 - 828), ord("\x08")), ehT0Px3KOsy9(chr(708 - 660) + '\x6f' + chr(49) + chr(0b100010 + 0o16) + chr(53), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\062' + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(970 - 921) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + '\x33' + chr(0b100100 + 0o15) + chr(0b1000 + 0o53), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\063' + chr(363 - 314), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(5395 - 5284) + chr(1219 - 1169) + chr(0b1010 + 0o54) + '\x32', 51968 - 51960), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + '\x31' + chr(942 - 890) + chr(0b110001 + 0o3), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110) + chr(53), 59857 - 59849), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\x36' + chr(367 - 316), 0o10), ehT0Px3KOsy9(chr(1536 - 1488) + chr(0b1100101 + 0o12) + '\062' + chr(0b0 + 0o61), 18617 - 18609), ehT0Px3KOsy9('\060' + chr(1314 - 1203) + chr(0b100000 + 0o22) + '\066' + '\060', 0b1000), ehT0Px3KOsy9(chr(738 - 690) + chr(6966 - 6855) + '\062' + chr(0b110011) + chr(0b100 + 0o55), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(4807 - 4696) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(3111 - 3000) + '\062' + chr(0b110010) + chr(52), 9990 - 9982), ehT0Px3KOsy9(chr(1149 - 1101) + '\x6f' + '\x32' + chr(49) + '\062', 63129 - 63121), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x33' + '\065', 4921 - 4913), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x35' + chr(49), 0o10), ehT0Px3KOsy9(chr(456 - 408) + chr(2052 - 1941) + '\062' + chr(0b100010 + 0o21) + chr(52), 0b1000), ehT0Px3KOsy9(chr(1795 - 1747) + chr(0b1101111) + '\062' + '\060' + '\060', 12723 - 12715), ehT0Px3KOsy9(chr(1028 - 980) + '\157' + chr(0b110001) + chr(55) + '\066', 22689 - 22681), ehT0Px3KOsy9('\x30' + chr(0b101111 + 0o100) + '\063' + chr(2506 - 2455) + chr(50), 0b1000), ehT0Px3KOsy9(chr(1691 - 1643) + '\157' + chr(0b11100 + 0o27) + '\066' + chr(0b110011), 18208 - 18200), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(3295 - 3184) + '\061' + chr(53), 35045 - 35037), ehT0Px3KOsy9(chr(0b110000) + chr(9995 - 9884) + '\x33' + chr(0b1 + 0o61) + chr(54), 0o10), ehT0Px3KOsy9(chr(1542 - 1494) + chr(111) + chr(0b101111 + 0o2) + chr(0b110011) + chr(2123 - 2070), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(2457 - 2346) + chr(895 - 846) + '\x32' + chr(0b101001 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(0b111 + 0o52) + chr(0b110001 + 0o2) + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b1001 + 0o53) + chr(1513 - 1464), 16335 - 16327), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b100100 + 0o15) + '\x35' + chr(0b1110 + 0o46), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2625 - 2572) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x15'), chr(0b1011011 + 0o11) + chr(0b1100101) + '\x63' + chr(0b1010101 + 0o32) + '\x64' + chr(0b101011 + 0o72))(chr(0b1110101) + chr(7084 - 6968) + chr(0b1100110) + '\x2d' + chr(0b100100 + 0o24)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def gBBBAhX0TTvq(R41vtJ6cRDF9, xvzt498SEA6K, XLXqkmM_0GVx=ehT0Px3KOsy9(chr(1618 - 1570) + chr(111) + chr(0b110010), 8)):
Pwkog3xriYf_ = IDJ2eXGCBCDu.stop_gradient(IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.reshape(R41vtJ6cRDF9, [-ehT0Px3KOsy9(chr(0b110000) + chr(6856 - 6745) + chr(49), ord("\x08")), xvzt498SEA6K])))
iEG9SFXKjXHK = [Pwkog3xriYf_[:, WVxHKyX45z_L] * IDJ2eXGCBCDu.to_int32(XLXqkmM_0GVx) ** IDJ2eXGCBCDu.to_int32(WVxHKyX45z_L) for WVxHKyX45z_L in vQr8gNKaIaWE(xvzt498SEA6K)]
MsbwfslwLjRO = xkxBmo49x2An(iEG9SFXKjXHK)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'O\x08\xbdJs\x1b=\xf9'), chr(0b1100100) + chr(101) + chr(0b101100 + 0o67) + chr(0b1101111) + chr(0b1100100) + chr(101))('\165' + chr(183 - 67) + chr(0b1100110) + chr(0b11000 + 0o25) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'I\x02\x91K|\x1fk'), chr(100) + '\145' + chr(99) + chr(0b101111 + 0o100) + chr(2799 - 2699) + '\x65')('\x75' + chr(8068 - 7952) + '\146' + chr(0b101101) + chr(56)))(MsbwfslwLjRO, xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'H\x0f\x83Sx0b\xa2\x94\x1b'), '\144' + chr(4336 - 4235) + chr(0b1100011) + chr(10114 - 10003) + chr(0b1000110 + 0o36) + chr(0b1100101))(chr(117) + chr(9875 - 9759) + '\146' + chr(1999 - 1954) + chr(2235 - 2179)))(R41vtJ6cRDF9)[:-ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001), 8)]))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
int_to_bit_embed
|
def int_to_bit_embed(x_int, num_bits, embedding_size, base=2):
"""Turn x_int into a bitwise (lower-endian) tensor and embed densly."""
shape = common_layers.shape_list(x_int)
inputs = int_to_bit(x_int, num_bits, base=base)
inputs = tf.reshape(inputs, shape[:-1] + [shape[-1] * 8])
inputs = 2.0 * tf.to_float(inputs) - 1.0 # Move from 0/1 to -1/1.
return tf.layers.dense(inputs, embedding_size, name="int_to_bit_embed")
|
python
|
def int_to_bit_embed(x_int, num_bits, embedding_size, base=2):
"""Turn x_int into a bitwise (lower-endian) tensor and embed densly."""
shape = common_layers.shape_list(x_int)
inputs = int_to_bit(x_int, num_bits, base=base)
inputs = tf.reshape(inputs, shape[:-1] + [shape[-1] * 8])
inputs = 2.0 * tf.to_float(inputs) - 1.0 # Move from 0/1 to -1/1.
return tf.layers.dense(inputs, embedding_size, name="int_to_bit_embed")
|
[
"def",
"int_to_bit_embed",
"(",
"x_int",
",",
"num_bits",
",",
"embedding_size",
",",
"base",
"=",
"2",
")",
":",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x_int",
")",
"inputs",
"=",
"int_to_bit",
"(",
"x_int",
",",
"num_bits",
",",
"base",
"=",
"base",
")",
"inputs",
"=",
"tf",
".",
"reshape",
"(",
"inputs",
",",
"shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"shape",
"[",
"-",
"1",
"]",
"*",
"8",
"]",
")",
"inputs",
"=",
"2.0",
"*",
"tf",
".",
"to_float",
"(",
"inputs",
")",
"-",
"1.0",
"# Move from 0/1 to -1/1.",
"return",
"tf",
".",
"layers",
".",
"dense",
"(",
"inputs",
",",
"embedding_size",
",",
"name",
"=",
"\"int_to_bit_embed\"",
")"
] |
Turn x_int into a bitwise (lower-endian) tensor and embed densly.
|
[
"Turn",
"x_int",
"into",
"a",
"bitwise",
"(",
"lower",
"-",
"endian",
")",
"tensor",
"and",
"embed",
"densly",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/lay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,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(197 - 149) + chr(111) + '\x32' + chr(0b110101) + chr(0b101010 + 0o11), 22165 - 22157), ehT0Px3KOsy9(chr(0b110000) + chr(11974 - 11863) + '\061' + '\060' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1308 - 1260) + chr(0b1010100 + 0o33) + '\x33' + chr(50) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(48) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + chr(0b110010 + 0o1) + chr(0b110011) + '\061', 53670 - 53662), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(53) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\x31' + '\062' + chr(0b11010 + 0o32), 49127 - 49119), ehT0Px3KOsy9('\x30' + chr(111) + chr(1124 - 1073) + '\x30' + chr(0b11110 + 0o26), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\x31' + '\x33', 0b1000), ehT0Px3KOsy9(chr(1354 - 1306) + chr(111) + chr(0b0 + 0o63) + chr(0b110110) + chr(0b101 + 0o56), 43222 - 43214), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110110) + '\x36', 39517 - 39509), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b111010 + 0o65) + '\x31' + '\062' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(749 - 699) + '\065' + chr(0b100 + 0o56), 0b1000), ehT0Px3KOsy9('\x30' + chr(10839 - 10728) + '\x32' + chr(54) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(51) + '\066' + '\066', 0b1000), ehT0Px3KOsy9(chr(1010 - 962) + '\x6f' + chr(51) + '\x34' + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(760 - 710) + chr(0b110000) + '\066', 0b1000), ehT0Px3KOsy9(chr(1835 - 1787) + chr(0b1100011 + 0o14) + '\x31' + chr(2328 - 2277) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b11101 + 0o122) + '\061' + '\064' + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b110111) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1214 - 1103) + chr(0b110001) + chr(1128 - 1076) + '\064', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1852 - 1797) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(929 - 881) + chr(0b10010 + 0o135) + chr(0b101101 + 0o5) + '\x31' + '\x31', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + '\x31' + chr(2281 - 2232) + chr(49), 22357 - 22349), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110111) + chr(54), 8), ehT0Px3KOsy9(chr(1913 - 1865) + chr(0b1101111) + '\x31' + chr(55) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(8690 - 8579) + chr(0b1 + 0o65) + chr(2633 - 2579), 8), ehT0Px3KOsy9(chr(48) + chr(11641 - 11530) + '\063' + '\x37' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101000 + 0o13) + '\x37' + '\063', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + chr(50) + '\x33' + chr(0b110010 + 0o2), 20335 - 20327), ehT0Px3KOsy9('\x30' + chr(111) + chr(272 - 221) + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + '\x31' + chr(0b110 + 0o56), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b110101) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b11110 + 0o22), 3685 - 3677), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(52) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(269 - 214) + chr(440 - 387), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\x32' + chr(0b11011 + 0o32), 8678 - 8670), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\x31' + '\065', 0o10), ehT0Px3KOsy9(chr(1884 - 1836) + '\157' + chr(914 - 865) + '\064' + '\x30', 13205 - 13197)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(53) + chr(811 - 763), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x85'), '\144' + '\x65' + chr(0b1111 + 0o124) + chr(0b1101111) + chr(0b1000101 + 0o37) + '\x65')(chr(3668 - 3551) + '\x74' + chr(6469 - 6367) + chr(0b11101 + 0o20) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def F5lDuWFXhqlY(YG0IvU5zeVte, xvzt498SEA6K, zneb7J1rGxnv, XLXqkmM_0GVx=ehT0Px3KOsy9(chr(0b110000) + chr(7577 - 7466) + chr(517 - 467), 0b1000)):
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(YG0IvU5zeVte)
vXoupepMtCXU = yJGZvHIPIBwO(YG0IvU5zeVte, xvzt498SEA6K, base=XLXqkmM_0GVx)
vXoupepMtCXU = IDJ2eXGCBCDu.reshape(vXoupepMtCXU, nauYfLglTpcb[:-ehT0Px3KOsy9(chr(48) + '\x6f' + '\061', ord("\x08"))] + [nauYfLglTpcb[-ehT0Px3KOsy9('\x30' + chr(0b1000011 + 0o54) + chr(0b1010 + 0o47), 8)] * ehT0Px3KOsy9(chr(48) + chr(7635 - 7524) + '\061' + chr(0b110000), 8)])
vXoupepMtCXU = 2.0 * IDJ2eXGCBCDu.to_float(vXoupepMtCXU) - 1.0
return xafqLlk3kkUe(IDJ2eXGCBCDu.layers, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf$\xbe5\xbc'), chr(100) + '\145' + chr(0b1010011 + 0o20) + chr(5262 - 5151) + chr(100) + chr(0b1100101))(chr(0b1000001 + 0o64) + chr(0b1110100) + chr(102) + chr(0b101101) + chr(0b111000)))(vXoupepMtCXU, zneb7J1rGxnv, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2/\xa4\x19\xad\x07\x0b\xa6"\x87i2\xc7\xd0\x93\x86'), chr(0b110101 + 0o57) + chr(101) + chr(99) + chr(111) + chr(0b1011000 + 0o14) + chr(0b1100101))('\x75' + chr(116) + '\x66' + chr(1461 - 1416) + chr(0b111000)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
embed
|
def embed(x,
hidden_size,
z_size,
filter_size,
bottleneck_kind="dvq",
soft_em=False,
num_blocks=2,
num_residuals=1,
block_v_size=None,
means=None,
name=None):
"""Embedding function that takes discrete latent and returns embedding.
Args:
x: Input to the discretization bottleneck.
hidden_size: Dimension of the latent state.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
filter_size: Dimension to project embedding by. Used only if bottleneck_kind
is semhash.
bottleneck_kind: Kind of discretization bottleneck to use; one of dvq,
semhash, gumbel-softmax (Default: dvq).
soft_em: If True then it uses a multi-sample version of EM (Default: False).
num_blocks: Number of blocks in DVQ (Default: 2).
num_residuals: Number of residuals (Default: 1).
block_v_size: Number of embedding entries per block (Default: None).
means: The embedding table for dvq (Default: None).
name: Name for the bottleneck scope.
Returns:
Continuous embedding to be passed on to the decoder.
Raises:
ValueError: For unknown or missing arguments.
"""
with tf.variable_scope(name, default_name="embed", reuse=tf.AUTO_REUSE):
if bottleneck_kind == "semhash":
c = int_to_bit(x, z_size)
h1a = tf.layers.dense(c, filter_size, name="vch1a")
h1b = tf.layers.dense(1.0 - c, filter_size, name="vch1b")
h1 = h1a + h1b
elif bottleneck_kind == "gumbel-softmax":
hot = tf.one_hot(x, 2**z_size)
h1 = tf.layers.dense(hot, hidden_size, name="dae_dense")
elif bottleneck_kind in ["dvq", "gumbel-softmax-dvq"]:
if block_v_size is None:
raise ValueError("Bottleneck kind is dvq but block_v_size is None.")
if soft_em:
assert num_residuals == 1
x_hot_flat = tf.reshape(x, shape=[-1, num_blocks, block_v_size])
h1 = tf.matmul(tf.transpose(x_hot_flat, perm=[1, 0, 2]), means[0])
h1 = tf.transpose(h1, perm=[1, 0, 2])
new_shape = common_layers.shape_list(x)
new_shape[-1] = hidden_size
h1 = tf.reshape(h1, shape=new_shape)
else:
shape_x = common_layers.shape_list(x)
x_flat = tf.reshape(x, [-1, 1])
c = int_to_bit(x_flat, num_bits=z_size, base=2)
shape = common_layers.shape_list(c)
new_shape = shape
new_shape[-1] = num_residuals
new_shape.append(num_blocks)
new_shape.append(int(z_size / (num_residuals * num_blocks)))
c = tf.to_int32(tf.reshape(c, shape=new_shape))
h1_shape = shape_x
h1_shape.append(hidden_size)
h1 = tf.zeros(dtype=tf.float32, shape=h1_shape)
for i in range(num_residuals):
c_residual = bit_to_int(
c[:, :, i, :, :],
num_bits=int(z_size / (num_residuals * num_blocks)),
base=2)
c_hot = tf.one_hot(c_residual, depth=block_v_size, axis=-1)
c_hot_flat = tf.reshape(c_hot, shape=[-1, num_blocks, block_v_size])
h1_residual = tf.matmul(
tf.transpose(c_hot_flat, perm=[1, 0, 2]), means[i])
h1_residual = tf.transpose(h1_residual, perm=[1, 0, 2])
h1_residual = tf.reshape(h1_residual, shape=h1_shape)
h1 += h1_residual
elif bottleneck_kind == "rounding":
h1 = x
else:
raise ValueError("Unknown bottleneck kind.")
return h1
|
python
|
def embed(x,
hidden_size,
z_size,
filter_size,
bottleneck_kind="dvq",
soft_em=False,
num_blocks=2,
num_residuals=1,
block_v_size=None,
means=None,
name=None):
"""Embedding function that takes discrete latent and returns embedding.
Args:
x: Input to the discretization bottleneck.
hidden_size: Dimension of the latent state.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
filter_size: Dimension to project embedding by. Used only if bottleneck_kind
is semhash.
bottleneck_kind: Kind of discretization bottleneck to use; one of dvq,
semhash, gumbel-softmax (Default: dvq).
soft_em: If True then it uses a multi-sample version of EM (Default: False).
num_blocks: Number of blocks in DVQ (Default: 2).
num_residuals: Number of residuals (Default: 1).
block_v_size: Number of embedding entries per block (Default: None).
means: The embedding table for dvq (Default: None).
name: Name for the bottleneck scope.
Returns:
Continuous embedding to be passed on to the decoder.
Raises:
ValueError: For unknown or missing arguments.
"""
with tf.variable_scope(name, default_name="embed", reuse=tf.AUTO_REUSE):
if bottleneck_kind == "semhash":
c = int_to_bit(x, z_size)
h1a = tf.layers.dense(c, filter_size, name="vch1a")
h1b = tf.layers.dense(1.0 - c, filter_size, name="vch1b")
h1 = h1a + h1b
elif bottleneck_kind == "gumbel-softmax":
hot = tf.one_hot(x, 2**z_size)
h1 = tf.layers.dense(hot, hidden_size, name="dae_dense")
elif bottleneck_kind in ["dvq", "gumbel-softmax-dvq"]:
if block_v_size is None:
raise ValueError("Bottleneck kind is dvq but block_v_size is None.")
if soft_em:
assert num_residuals == 1
x_hot_flat = tf.reshape(x, shape=[-1, num_blocks, block_v_size])
h1 = tf.matmul(tf.transpose(x_hot_flat, perm=[1, 0, 2]), means[0])
h1 = tf.transpose(h1, perm=[1, 0, 2])
new_shape = common_layers.shape_list(x)
new_shape[-1] = hidden_size
h1 = tf.reshape(h1, shape=new_shape)
else:
shape_x = common_layers.shape_list(x)
x_flat = tf.reshape(x, [-1, 1])
c = int_to_bit(x_flat, num_bits=z_size, base=2)
shape = common_layers.shape_list(c)
new_shape = shape
new_shape[-1] = num_residuals
new_shape.append(num_blocks)
new_shape.append(int(z_size / (num_residuals * num_blocks)))
c = tf.to_int32(tf.reshape(c, shape=new_shape))
h1_shape = shape_x
h1_shape.append(hidden_size)
h1 = tf.zeros(dtype=tf.float32, shape=h1_shape)
for i in range(num_residuals):
c_residual = bit_to_int(
c[:, :, i, :, :],
num_bits=int(z_size / (num_residuals * num_blocks)),
base=2)
c_hot = tf.one_hot(c_residual, depth=block_v_size, axis=-1)
c_hot_flat = tf.reshape(c_hot, shape=[-1, num_blocks, block_v_size])
h1_residual = tf.matmul(
tf.transpose(c_hot_flat, perm=[1, 0, 2]), means[i])
h1_residual = tf.transpose(h1_residual, perm=[1, 0, 2])
h1_residual = tf.reshape(h1_residual, shape=h1_shape)
h1 += h1_residual
elif bottleneck_kind == "rounding":
h1 = x
else:
raise ValueError("Unknown bottleneck kind.")
return h1
|
[
"def",
"embed",
"(",
"x",
",",
"hidden_size",
",",
"z_size",
",",
"filter_size",
",",
"bottleneck_kind",
"=",
"\"dvq\"",
",",
"soft_em",
"=",
"False",
",",
"num_blocks",
"=",
"2",
",",
"num_residuals",
"=",
"1",
",",
"block_v_size",
"=",
"None",
",",
"means",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"embed\"",
",",
"reuse",
"=",
"tf",
".",
"AUTO_REUSE",
")",
":",
"if",
"bottleneck_kind",
"==",
"\"semhash\"",
":",
"c",
"=",
"int_to_bit",
"(",
"x",
",",
"z_size",
")",
"h1a",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"c",
",",
"filter_size",
",",
"name",
"=",
"\"vch1a\"",
")",
"h1b",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"1.0",
"-",
"c",
",",
"filter_size",
",",
"name",
"=",
"\"vch1b\"",
")",
"h1",
"=",
"h1a",
"+",
"h1b",
"elif",
"bottleneck_kind",
"==",
"\"gumbel-softmax\"",
":",
"hot",
"=",
"tf",
".",
"one_hot",
"(",
"x",
",",
"2",
"**",
"z_size",
")",
"h1",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"hot",
",",
"hidden_size",
",",
"name",
"=",
"\"dae_dense\"",
")",
"elif",
"bottleneck_kind",
"in",
"[",
"\"dvq\"",
",",
"\"gumbel-softmax-dvq\"",
"]",
":",
"if",
"block_v_size",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Bottleneck kind is dvq but block_v_size is None.\"",
")",
"if",
"soft_em",
":",
"assert",
"num_residuals",
"==",
"1",
"x_hot_flat",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"shape",
"=",
"[",
"-",
"1",
",",
"num_blocks",
",",
"block_v_size",
"]",
")",
"h1",
"=",
"tf",
".",
"matmul",
"(",
"tf",
".",
"transpose",
"(",
"x_hot_flat",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
",",
"means",
"[",
"0",
"]",
")",
"h1",
"=",
"tf",
".",
"transpose",
"(",
"h1",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"new_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"new_shape",
"[",
"-",
"1",
"]",
"=",
"hidden_size",
"h1",
"=",
"tf",
".",
"reshape",
"(",
"h1",
",",
"shape",
"=",
"new_shape",
")",
"else",
":",
"shape_x",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"x_flat",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"1",
"]",
")",
"c",
"=",
"int_to_bit",
"(",
"x_flat",
",",
"num_bits",
"=",
"z_size",
",",
"base",
"=",
"2",
")",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"c",
")",
"new_shape",
"=",
"shape",
"new_shape",
"[",
"-",
"1",
"]",
"=",
"num_residuals",
"new_shape",
".",
"append",
"(",
"num_blocks",
")",
"new_shape",
".",
"append",
"(",
"int",
"(",
"z_size",
"/",
"(",
"num_residuals",
"*",
"num_blocks",
")",
")",
")",
"c",
"=",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"reshape",
"(",
"c",
",",
"shape",
"=",
"new_shape",
")",
")",
"h1_shape",
"=",
"shape_x",
"h1_shape",
".",
"append",
"(",
"hidden_size",
")",
"h1",
"=",
"tf",
".",
"zeros",
"(",
"dtype",
"=",
"tf",
".",
"float32",
",",
"shape",
"=",
"h1_shape",
")",
"for",
"i",
"in",
"range",
"(",
"num_residuals",
")",
":",
"c_residual",
"=",
"bit_to_int",
"(",
"c",
"[",
":",
",",
":",
",",
"i",
",",
":",
",",
":",
"]",
",",
"num_bits",
"=",
"int",
"(",
"z_size",
"/",
"(",
"num_residuals",
"*",
"num_blocks",
")",
")",
",",
"base",
"=",
"2",
")",
"c_hot",
"=",
"tf",
".",
"one_hot",
"(",
"c_residual",
",",
"depth",
"=",
"block_v_size",
",",
"axis",
"=",
"-",
"1",
")",
"c_hot_flat",
"=",
"tf",
".",
"reshape",
"(",
"c_hot",
",",
"shape",
"=",
"[",
"-",
"1",
",",
"num_blocks",
",",
"block_v_size",
"]",
")",
"h1_residual",
"=",
"tf",
".",
"matmul",
"(",
"tf",
".",
"transpose",
"(",
"c_hot_flat",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
",",
"means",
"[",
"i",
"]",
")",
"h1_residual",
"=",
"tf",
".",
"transpose",
"(",
"h1_residual",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"h1_residual",
"=",
"tf",
".",
"reshape",
"(",
"h1_residual",
",",
"shape",
"=",
"h1_shape",
")",
"h1",
"+=",
"h1_residual",
"elif",
"bottleneck_kind",
"==",
"\"rounding\"",
":",
"h1",
"=",
"x",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unknown bottleneck kind.\"",
")",
"return",
"h1"
] |
Embedding function that takes discrete latent and returns embedding.
Args:
x: Input to the discretization bottleneck.
hidden_size: Dimension of the latent state.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
filter_size: Dimension to project embedding by. Used only if bottleneck_kind
is semhash.
bottleneck_kind: Kind of discretization bottleneck to use; one of dvq,
semhash, gumbel-softmax (Default: dvq).
soft_em: If True then it uses a multi-sample version of EM (Default: False).
num_blocks: Number of blocks in DVQ (Default: 2).
num_residuals: Number of residuals (Default: 1).
block_v_size: Number of embedding entries per block (Default: None).
means: The embedding table for dvq (Default: None).
name: Name for the bottleneck scope.
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/discretization.py#L272-L357
|
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,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0Zkat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dt5d,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(0b100111 + 0o11) + chr(0b1011010 + 0o25) + chr(0b110010) + chr(409 - 358) + chr(974 - 923), 6673 - 6665), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + '\x32' + chr(0b110100) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(1510 - 1399) + chr(0b110010) + '\x35' + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + '\063' + chr(0b110001) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9912 - 9801) + chr(0b110011) + '\064' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(51) + chr(0b110010) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(1455 - 1404) + chr(1492 - 1442) + chr(1074 - 1020), 58745 - 58737), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + '\063' + '\x33' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(52) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b100100 + 0o16) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(893 - 840) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\064' + chr(1135 - 1082), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101000 + 0o107) + chr(51) + chr(0b110111) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(53) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(52) + chr(0b101111 + 0o3), 36979 - 36971), ehT0Px3KOsy9('\x30' + '\157' + chr(53) + chr(837 - 788), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b110111) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(103 - 48) + chr(55), 10722 - 10714), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(0b110010) + chr(0b110101) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(161 - 110) + chr(1722 - 1672), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100111 + 0o10) + '\x35' + '\x31', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(939 - 886) + chr(0b11001 + 0o27), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + '\061' + '\065' + chr(0b11011 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b110011 + 0o74) + chr(1665 - 1615) + chr(0b110001) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11456 - 11345) + chr(50) + chr(0b110000) + chr(53), 53551 - 53543), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b100 + 0o56) + chr(0b11110 + 0o25), 32480 - 32472), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b110 + 0o55) + '\x36', 0b1000), ehT0Px3KOsy9(chr(2060 - 2012) + '\x6f' + chr(0b100000 + 0o21) + chr(595 - 543) + chr(2246 - 2195), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + chr(0b100101 + 0o15) + chr(48) + chr(0b101011 + 0o5), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + '\062' + chr(49) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\067' + chr(0b11 + 0o60), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(52) + chr(54), 30305 - 30297), ehT0Px3KOsy9(chr(0b110000) + chr(6914 - 6803) + chr(0b110001) + chr(0b110001), 45229 - 45221), ehT0Px3KOsy9(chr(1878 - 1830) + '\157' + '\x33' + '\063' + chr(0b110010), 50916 - 50908), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(9318 - 9207) + '\061' + chr(2894 - 2840) + chr(0b10101 + 0o36), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(48) + chr(2712 - 2657), 64769 - 64761), ehT0Px3KOsy9('\060' + chr(0b10110 + 0o131) + chr(0b1011 + 0o47) + '\x36' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(0b110001) + chr(0b110010) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11011 + 0o30) + chr(0b110010) + chr(1171 - 1123), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110101 + 0o0) + chr(1876 - 1828), 16250 - 16242)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5'), chr(100) + '\145' + chr(0b1100000 + 0o3) + '\157' + '\144' + chr(0b1100101))('\x75' + '\x74' + chr(102) + chr(1667 - 1622) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def DSKhI6I667G0(OeWW0F1dBPRQ, qzoyXN3kdhDL, NSd4iRY6tdp8, deybX8NJ0oEI, rZIVWZZhpCQD=xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\xd6\xd8'), chr(0b1100100) + chr(0b1010100 + 0o21) + chr(99) + chr(111) + '\x64' + chr(101))(chr(10779 - 10662) + chr(116) + chr(102) + chr(0b101101) + chr(325 - 269)), sjb7MZHDGfYq=ehT0Px3KOsy9('\060' + chr(111) + chr(48), 37488 - 37480), azOnMTJc4Vem=ehT0Px3KOsy9(chr(48) + '\157' + chr(50), 0b1000), R38qqj9vgOQS=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101100 + 0o5), ord("\x08")), oNd8C7o94vJ7=None, XCAIkNRdiX0I=None, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\xc1\xdb\xa6\x81\xb0\xba\xbe~\xe6\x8eJ\x88\n'), chr(100) + chr(0b1000000 + 0o45) + chr(0b100001 + 0o102) + '\x6f' + chr(0b1100100) + '\145')('\165' + '\x74' + chr(0b1100110) + chr(0b101101) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcd\xcb\xaa\x84'), chr(0b1100100) + chr(4029 - 3928) + chr(99) + chr(1305 - 1194) + chr(100) + chr(101))(chr(117) + chr(0b1010101 + 0o37) + '\x66' + chr(0b100111 + 0o6) + chr(0b111000)), reuse=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xda\xf5\xfd\x80\xbf\x80\x93\x8er\xd0'), chr(0b1001 + 0o133) + chr(0b1100101) + chr(1420 - 1321) + chr(0b110101 + 0o72) + chr(0b1011101 + 0o7) + '\x65')('\165' + '\164' + '\x66' + '\x2d' + chr(0b101100 + 0o14)))):
if rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8\xc5\xc4\xa7\x81\xa1\xbe'), chr(100) + chr(101) + chr(99) + chr(0b101 + 0o152) + chr(100) + chr(706 - 605))(chr(13353 - 13236) + '\164' + '\x66' + '\055' + chr(2922 - 2866)):
qzn1Ctg9WgNh = yJGZvHIPIBwO(OeWW0F1dBPRQ, NSd4iRY6tdp8)
iT5VkYIrJ3K0 = IDJ2eXGCBCDu.layers.dense(qzn1Ctg9WgNh, deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\xc3\xc1\xfe\x81'), chr(4867 - 4767) + chr(0b1100101) + '\x63' + chr(0b100110 + 0o111) + '\x64' + chr(101))('\x75' + chr(116) + chr(4808 - 4706) + chr(0b101101) + '\x38'))
T6pPGkiz_8Et = IDJ2eXGCBCDu.layers.dense(1.0 - qzn1Ctg9WgNh, deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\xc3\xc1\xfe\x82'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + chr(0b1110 + 0o126) + chr(0b1001101 + 0o30))('\x75' + '\164' + chr(102) + chr(0b101101) + '\070'))
pHCcavHAFrT_ = iT5VkYIrJ3K0 + T6pPGkiz_8Et
elif rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\xd5\xc4\xad\x85\xbe\xfb\xa8N\xf3\x99H\x99\x17'), '\144' + chr(101) + chr(7746 - 7647) + '\157' + '\x64' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(4664 - 4562) + '\x2d' + '\x38'):
XSj99enejNvO = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(OeWW0F1dBPRQ, ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32', 8) ** NSd4iRY6tdp8)
pHCcavHAFrT_ = IDJ2eXGCBCDu.layers.dense(XSj99enejNvO, qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\xc1\xcc\x90\x84\xb7\xb8\xa8D'), chr(0b1100100) + '\145' + chr(0b11111 + 0o104) + chr(5865 - 5754) + chr(0b111001 + 0o53) + chr(101))(chr(0b100 + 0o161) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b10110 + 0o42)))
elif rZIVWZZhpCQD in [xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\xd6\xd8'), '\x64' + chr(1605 - 1504) + '\x63' + chr(0b1101111) + '\144' + '\145')(chr(0b1110101) + chr(11111 - 10995) + chr(102) + chr(811 - 766) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\xd5\xc4\xad\x85\xbe\xfb\xa8N\xf3\x99H\x99\x17\xcfM\x0c\xce'), chr(100) + chr(9564 - 9463) + '\x63' + chr(0b1101111) + chr(0b1001100 + 0o30) + chr(2189 - 2088))(chr(3275 - 3158) + '\x74' + '\x66' + '\x2d' + chr(896 - 840))]:
if oNd8C7o94vJ7 is None:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"\xd9\xcf\xdd\xbb\x8c\xb7\xb8\xbeB\xfe\xcdN\x91\x01\x86\t\x13\xcc\x88~_\x19M\xeb\xf0'\xfe\x01\xec\xe0X@9\x7f\x85\x00\xae\xcd7\xf0\xf2\xd3\x89\x81\x8f\xbc\xb3\xf5"), chr(100) + chr(0b1100101) + '\143' + chr(0b101110 + 0o101) + '\144' + chr(0b1010110 + 0o17))('\165' + chr(3364 - 3248) + chr(0b1100110) + chr(0b10001 + 0o34) + '\070'))
if sjb7MZHDGfYq:
assert R38qqj9vgOQS == ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10100 + 0o35), 8)
DENVSQILTujm = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, shape=[-ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1101 + 0o44), 8), azOnMTJc4Vem, oNd8C7o94vJ7])
pHCcavHAFrT_ = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(DENVSQILTujm, perm=[ehT0Px3KOsy9(chr(1717 - 1669) + chr(0b100101 + 0o112) + chr(0b11101 + 0o24), 8), ehT0Px3KOsy9('\x30' + chr(9889 - 9778) + '\060', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2148 - 2098), 8)]), XCAIkNRdiX0I[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\060', 8)])
pHCcavHAFrT_ = IDJ2eXGCBCDu.transpose(pHCcavHAFrT_, perm=[ehT0Px3KOsy9(chr(1903 - 1855) + '\157' + chr(0b101101 + 0o4), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1011 + 0o45), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50), 8)])
P7dVzv6_yXeE = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
P7dVzv6_yXeE[-ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(4931 - 4820) + chr(0b11010 + 0o27), 8)] = qzoyXN3kdhDL
pHCcavHAFrT_ = IDJ2eXGCBCDu.reshape(pHCcavHAFrT_, shape=P7dVzv6_yXeE)
else:
aGtbOvWfCD5N = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
mstS6zVd22Jf = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9('\060' + chr(111) + chr(0b101000 + 0o11), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 8)])
qzn1Ctg9WgNh = yJGZvHIPIBwO(mstS6zVd22Jf, num_bits=NSd4iRY6tdp8, base=ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1011011 + 0o24) + chr(2203 - 2153), 8))
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(qzn1Ctg9WgNh)
P7dVzv6_yXeE = nauYfLglTpcb
P7dVzv6_yXeE[-ehT0Px3KOsy9(chr(876 - 828) + '\x6f' + chr(0b110001), 8)] = R38qqj9vgOQS
xafqLlk3kkUe(P7dVzv6_yXeE, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xd0\xd9\xaa\x8e\xb6'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(6780 - 6663) + chr(0b1110100) + chr(0b1100110) + chr(1048 - 1003) + chr(0b110111 + 0o1)))(azOnMTJc4Vem)
xafqLlk3kkUe(P7dVzv6_yXeE, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xd0\xd9\xaa\x8e\xb6'), chr(100) + chr(0b1100101) + chr(8191 - 8092) + chr(0b10011 + 0o134) + '\x64' + chr(101))('\165' + '\x74' + chr(102) + chr(45) + '\070'))(ehT0Px3KOsy9(NSd4iRY6tdp8 / (R38qqj9vgOQS * azOnMTJc4Vem)))
qzn1Ctg9WgNh = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.reshape(qzn1Ctg9WgNh, shape=P7dVzv6_yXeE))
VA84Lbf0Xj2y = aGtbOvWfCD5N
xafqLlk3kkUe(VA84Lbf0Xj2y, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xd0\xd9\xaa\x8e\xb6'), chr(0b11011 + 0o111) + chr(0b1100101) + chr(4060 - 3961) + chr(0b1101111 + 0o0) + '\x64' + chr(0b110011 + 0o62))('\x75' + '\164' + chr(0b1001010 + 0o34) + chr(0b1111 + 0o36) + chr(0b100100 + 0o24)))(qzoyXN3kdhDL)
pHCcavHAFrT_ = IDJ2eXGCBCDu.zeros(dtype=IDJ2eXGCBCDu.float32, shape=VA84Lbf0Xj2y)
for WVxHKyX45z_L in vQr8gNKaIaWE(R38qqj9vgOQS):
EnqLYZfndVCQ = gBBBAhX0TTvq(qzn1Ctg9WgNh[:, :, WVxHKyX45z_L, :, :], num_bits=ehT0Px3KOsy9(NSd4iRY6tdp8 / (R38qqj9vgOQS * azOnMTJc4Vem)), base=ehT0Px3KOsy9(chr(1974 - 1926) + chr(0b11110 + 0o121) + chr(1243 - 1193), 8))
WxhLPyUpYRb5 = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(EnqLYZfndVCQ, depth=oNd8C7o94vJ7, axis=-ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49), 8))
JA2_G28zRyJ2 = IDJ2eXGCBCDu.reshape(WxhLPyUpYRb5, shape=[-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31', 8), azOnMTJc4Vem, oNd8C7o94vJ7])
XBwd5zKzojwg = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(JA2_G28zRyJ2, perm=[ehT0Px3KOsy9(chr(1226 - 1178) + chr(111) + '\061', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(277 - 229), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010), 8)]), XCAIkNRdiX0I[WVxHKyX45z_L])
XBwd5zKzojwg = IDJ2eXGCBCDu.transpose(XBwd5zKzojwg, perm=[ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + '\x31', 8), ehT0Px3KOsy9(chr(828 - 780) + chr(111) + chr(48), 8), ehT0Px3KOsy9(chr(1875 - 1827) + chr(0b1101111) + chr(50), 8)])
XBwd5zKzojwg = IDJ2eXGCBCDu.reshape(XBwd5zKzojwg, shape=VA84Lbf0Xj2y)
pHCcavHAFrT_ += XBwd5zKzojwg
elif rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xcf\xdc\xa1\x84\xbb\xb8\xbc'), '\144' + chr(0b1010100 + 0o21) + '\143' + chr(111) + '\x64' + chr(0b1100101))(chr(1761 - 1644) + chr(116) + chr(0b1100110) + chr(1077 - 1032) + chr(1298 - 1242)):
pHCcavHAFrT_ = OeWW0F1dBPRQ
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\xce\xc2\xa1\x8f\xa5\xb8\xfbC\xfa\x99Q\x94\n\x8cL\x19\xd4\x88q@\x06\t\xa7'), '\144' + '\145' + '\x63' + chr(218 - 107) + chr(9706 - 9606) + '\x65')(chr(0b1101 + 0o150) + chr(0b1110100) + chr(102) + chr(0b10111 + 0o26) + chr(0b111000)))
return pHCcavHAFrT_
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
vae
|
def vae(x, z_size, name=None):
"""Simple variational autoencoder without discretization.
Args:
x: Input to the discretization bottleneck.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
name: Name for the bottleneck scope.
Returns:
Embedding function, latent, loss, mu and log_simga.
"""
with tf.variable_scope(name, default_name="vae"):
mu = tf.layers.dense(x, z_size, name="mu")
log_sigma = tf.layers.dense(x, z_size, name="log_sigma")
shape = common_layers.shape_list(x)
epsilon = tf.random_normal([shape[0], shape[1], 1, z_size])
z = mu + tf.exp(log_sigma / 2) * epsilon
kl = 0.5 * tf.reduce_mean(
tf.expm1(log_sigma) + tf.square(mu) - log_sigma, axis=-1)
free_bits = z_size // 4
kl_loss = tf.reduce_mean(tf.maximum(kl - free_bits, 0.0))
return z, kl_loss, mu, log_sigma
|
python
|
def vae(x, z_size, name=None):
"""Simple variational autoencoder without discretization.
Args:
x: Input to the discretization bottleneck.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
name: Name for the bottleneck scope.
Returns:
Embedding function, latent, loss, mu and log_simga.
"""
with tf.variable_scope(name, default_name="vae"):
mu = tf.layers.dense(x, z_size, name="mu")
log_sigma = tf.layers.dense(x, z_size, name="log_sigma")
shape = common_layers.shape_list(x)
epsilon = tf.random_normal([shape[0], shape[1], 1, z_size])
z = mu + tf.exp(log_sigma / 2) * epsilon
kl = 0.5 * tf.reduce_mean(
tf.expm1(log_sigma) + tf.square(mu) - log_sigma, axis=-1)
free_bits = z_size // 4
kl_loss = tf.reduce_mean(tf.maximum(kl - free_bits, 0.0))
return z, kl_loss, mu, log_sigma
|
[
"def",
"vae",
"(",
"x",
",",
"z_size",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"vae\"",
")",
":",
"mu",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"z_size",
",",
"name",
"=",
"\"mu\"",
")",
"log_sigma",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"z_size",
",",
"name",
"=",
"\"log_sigma\"",
")",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"epsilon",
"=",
"tf",
".",
"random_normal",
"(",
"[",
"shape",
"[",
"0",
"]",
",",
"shape",
"[",
"1",
"]",
",",
"1",
",",
"z_size",
"]",
")",
"z",
"=",
"mu",
"+",
"tf",
".",
"exp",
"(",
"log_sigma",
"/",
"2",
")",
"*",
"epsilon",
"kl",
"=",
"0.5",
"*",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"expm1",
"(",
"log_sigma",
")",
"+",
"tf",
".",
"square",
"(",
"mu",
")",
"-",
"log_sigma",
",",
"axis",
"=",
"-",
"1",
")",
"free_bits",
"=",
"z_size",
"//",
"4",
"kl_loss",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"maximum",
"(",
"kl",
"-",
"free_bits",
",",
"0.0",
")",
")",
"return",
"z",
",",
"kl_loss",
",",
"mu",
",",
"log_sigma"
] |
Simple variational autoencoder without discretization.
Args:
x: Input to the discretization bottleneck.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
name: Name for the bottleneck scope.
Returns:
Embedding function, latent, loss, mu and log_simga.
|
[
"Simple",
"variational",
"autoencoder",
"without",
"discretization",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L360-L381
|
train
|
Simple variational autoencoder without discretization.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S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VJsrp8,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('\x30' + '\157' + chr(49) + '\060' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1568 - 1517) + '\061' + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(1923 - 1875) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(676 - 627) + '\x32' + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\064' + chr(2240 - 2192), ord("\x08")), ehT0Px3KOsy9(chr(275 - 227) + chr(0b1101111) + chr(0b1111 + 0o42) + '\064' + '\x34', 18996 - 18988), ehT0Px3KOsy9(chr(2082 - 2034) + chr(0b1101111) + chr(0b11101 + 0o26) + '\x36' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10011 + 0o37) + '\066', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b111 + 0o57) + '\064', 20816 - 20808), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\066' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\066' + chr(1067 - 1019), 39035 - 39027), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(49) + chr(0b110000) + chr(0b110000), 64445 - 64437), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110101) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1010 + 0o50) + chr(0b101011 + 0o6) + chr(48), 19306 - 19298), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + chr(1139 - 1090) + chr(55) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b101100 + 0o7) + chr(0b10010 + 0o40) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(2308 - 2257) + '\x37' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(2690 - 2579) + chr(50) + chr(0b11111 + 0o25) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(2457 - 2407) + '\065', 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(2844 - 2733) + chr(0b110001) + chr(0b110010) + chr(0b110010 + 0o0), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(0b110001) + '\064' + chr(0b110111), 34307 - 34299), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(55) + '\060', 53554 - 53546), ehT0Px3KOsy9(chr(2100 - 2052) + chr(111) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7468 - 7357) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\060' + chr(53), 0b1000), ehT0Px3KOsy9(chr(2151 - 2103) + chr(111) + '\062' + chr(53) + chr(0b10110 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4190 - 4079) + chr(0b110001) + chr(54) + chr(2075 - 2027), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + chr(283 - 232) + '\x30' + '\x37', 42879 - 42871), ehT0Px3KOsy9('\x30' + chr(0b110000 + 0o77) + '\x33' + chr(0b100100 + 0o17), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1971 - 1922) + chr(0b110 + 0o52) + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(3107 - 2996) + '\x32' + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(8702 - 8591) + chr(1737 - 1686) + chr(0b110011) + chr(0b101011 + 0o10), 33611 - 33603), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(3982 - 3871) + chr(599 - 550) + chr(0b110000) + chr(51), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b11000 + 0o36) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(470 - 422) + chr(0b100001 + 0o116) + chr(0b101000 + 0o12) + '\062' + chr(2226 - 2175), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\065' + chr(52), 6462 - 6454), ehT0Px3KOsy9('\x30' + chr(5164 - 5053) + chr(0b110011) + chr(50) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110100) + chr(54), 0o10), ehT0Px3KOsy9(chr(2131 - 2083) + '\157' + chr(0b100110 + 0o13) + chr(0b1111 + 0o50) + chr(56 - 8), 40184 - 40176)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(475 - 427) + chr(111) + chr(0b110101) + chr(0b100101 + 0o13), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'm'), chr(0b1100000 + 0o4) + chr(0b101101 + 0o70) + chr(0b1010011 + 0o20) + '\x6f' + chr(0b1100100) + chr(1091 - 990))('\165' + '\x74' + '\x66' + chr(0b100000 + 0o15) + chr(2683 - 2627)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def sDRTDO0rxXPy(OeWW0F1dBPRQ, NSd4iRY6tdp8, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'5\xae\xb6=\xc1\x06\x9ds\xab\xc0\x13/\x1c\xed'), chr(3592 - 3492) + '\x65' + chr(4822 - 4723) + chr(8793 - 8682) + '\144' + chr(0b1100101))(chr(117) + chr(482 - 366) + chr(0b101 + 0o141) + '\x2d' + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'5\xae\xa1'), chr(0b1000100 + 0o40) + '\x65' + chr(4263 - 4164) + '\x6f' + '\x64' + chr(0b110 + 0o137))(chr(0b1110101) + chr(116) + chr(3654 - 3552) + chr(1439 - 1394) + chr(0b111000))):
hOLPUi_G8xuS = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, NSd4iRY6tdp8, name=xafqLlk3kkUe(SXOLrMavuUCe(b'.\xba'), '\144' + chr(0b1010101 + 0o20) + '\x63' + '\x6f' + '\x64' + chr(101))('\165' + chr(0b1110100) + '\x66' + chr(45) + chr(979 - 923)))
klT0pXGsdgAQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, NSd4iRY6tdp8, name=xafqLlk3kkUe(SXOLrMavuUCe(b'/\xa0\xa3\x0b\xd3\r\x96{\x95'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + chr(741 - 641) + '\145')(chr(6648 - 6531) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56)))
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
Xtig2zAKpR0T = IDJ2eXGCBCDu.random_normal([nauYfLglTpcb[ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(0b110000), 8)], nauYfLglTpcb[ehT0Px3KOsy9(chr(48) + chr(1284 - 1173) + '\061', 8)], ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + '\x31', 8), NSd4iRY6tdp8])
AFGBo4BePxZi = hOLPUi_G8xuS + IDJ2eXGCBCDu.exp(klT0pXGsdgAQ / ehT0Px3KOsy9('\060' + chr(3302 - 3191) + '\062', 39327 - 39319)) * Xtig2zAKpR0T
y5Mu5kTbeC7U = 0.5 * IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.expm1(klT0pXGsdgAQ) + IDJ2eXGCBCDu.square(hOLPUi_G8xuS) - klT0pXGsdgAQ, axis=-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001), 8))
HqhYQ8Mg5Wtl = NSd4iRY6tdp8 // ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x34', 35638 - 35630)
PuTBORXba93h = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.maximum(y5Mu5kTbeC7U - HqhYQ8Mg5Wtl, 0.0))
return (AFGBo4BePxZi, PuTBORXba93h, hOLPUi_G8xuS, klT0pXGsdgAQ)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
gumbel_sample
|
def gumbel_sample(shape):
"""Sample from the Gumbel distribution, protect from overflows.
Args:
shape: Shape of Gumbel samples.
Returns:
Noise drawn from Gumbel distribution.
"""
uniform_samples = tf.random_uniform(shape, minval=0.00001, maxval=0.99998)
return -tf.log(-tf.log(uniform_samples))
|
python
|
def gumbel_sample(shape):
"""Sample from the Gumbel distribution, protect from overflows.
Args:
shape: Shape of Gumbel samples.
Returns:
Noise drawn from Gumbel distribution.
"""
uniform_samples = tf.random_uniform(shape, minval=0.00001, maxval=0.99998)
return -tf.log(-tf.log(uniform_samples))
|
[
"def",
"gumbel_sample",
"(",
"shape",
")",
":",
"uniform_samples",
"=",
"tf",
".",
"random_uniform",
"(",
"shape",
",",
"minval",
"=",
"0.00001",
",",
"maxval",
"=",
"0.99998",
")",
"return",
"-",
"tf",
".",
"log",
"(",
"-",
"tf",
".",
"log",
"(",
"uniform_samples",
")",
")"
] |
Sample from the Gumbel distribution, protect from overflows.
Args:
shape: Shape of Gumbel samples.
Returns:
Noise drawn from Gumbel distribution.
|
[
"Sample",
"from",
"the",
"Gumbel",
"distribution",
"protect",
"from",
"overflows",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L402-L412
|
train
|
Sample from the Gumbel distribution protect from overflows.
|
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,sR2sPcm7Zr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L,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) + '\x6f' + '\061' + '\x30' + chr(2176 - 2124), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\x33' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(766 - 718) + chr(0b1101111) + chr(0b110100) + chr(2348 - 2294), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\067' + chr(0b101000 + 0o11), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(1906 - 1857) + chr(0b11 + 0o63), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b101001 + 0o10) + chr(0b10100 + 0o40) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\065', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(1770 - 1719) + '\064' + '\x36', 46372 - 46364), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(70 - 21) + '\x35' + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(1818 - 1707) + chr(0b110010) + '\x33' + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(10358 - 10247) + chr(0b110001) + chr(1364 - 1309) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1100 + 0o46) + chr(0b110010 + 0o1) + '\061', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(55) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(0b10100 + 0o36) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(689 - 639) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1011110 + 0o21) + chr(49) + chr(0b1111 + 0o44) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10100 + 0o35) + chr(0b111 + 0o55) + '\x35', 0o10), ehT0Px3KOsy9(chr(756 - 708) + '\157' + chr(0b110001) + chr(51) + chr(0b100101 + 0o15), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5360 - 5249) + chr(51) + chr(55) + chr(0b110010), 23875 - 23867), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(0b110001) + '\065' + chr(0b101111 + 0o1), 0o10), ehT0Px3KOsy9(chr(1832 - 1784) + '\x6f' + chr(1085 - 1035) + '\061' + '\x30', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(0b110101) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\x31' + chr(0b110001) + chr(0b11110 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x37' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\x30' + chr(0b1011 + 0o50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1698 - 1587) + chr(0b11 + 0o60) + chr(0b110110) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1696 - 1648) + chr(0b1101111) + '\063' + '\x36' + '\062', 30689 - 30681), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + '\x31' + chr(2580 - 2525), 6646 - 6638), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\063' + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(688 - 639) + chr(0b110011), 27723 - 27715), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(0b110010) + '\x30' + chr(0b110101), 53584 - 53576), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(1302 - 1252) + chr(0b110111) + chr(192 - 137), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(1606 - 1495) + '\x31' + chr(0b110001) + chr(2625 - 2571), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x34' + chr(0b10000 + 0o42), ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + '\x31' + chr(49) + chr(0b100011 + 0o22), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + '\x33' + '\063' + chr(0b110100), 50705 - 50697), ehT0Px3KOsy9(chr(1736 - 1688) + chr(111) + chr(468 - 418) + chr(2418 - 2368) + chr(53), 45660 - 45652), ehT0Px3KOsy9(chr(1875 - 1827) + chr(111) + chr(0b110011) + chr(0b110100) + chr(0b100101 + 0o20), 52154 - 52146)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(665 - 617) + chr(0b1010000 + 0o37) + '\065' + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'j'), chr(0b101110 + 0o66) + chr(101) + chr(0b1100011) + chr(111) + chr(100) + chr(2868 - 2767))(chr(2475 - 2358) + '\164' + '\146' + chr(45) + chr(0b111 + 0o61)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def PHnecpeO1VoA(nauYfLglTpcb):
L7RkCmNkhDoo = IDJ2eXGCBCDu.random_uniform(nauYfLglTpcb, minval=1e-05, maxval=0.99998)
return -xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'(\xb6A'), chr(6229 - 6129) + chr(1559 - 1458) + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(2961 - 2860))(chr(0b1110101) + chr(116) + chr(102) + chr(45) + chr(104 - 48)))(-xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'(\xb6A'), chr(0b1100100) + '\145' + '\x63' + chr(111) + chr(100) + '\x65')(chr(0b10 + 0o163) + chr(0b1000001 + 0o63) + chr(0b100011 + 0o103) + chr(0b10 + 0o53) + chr(1848 - 1792)))(L7RkCmNkhDoo))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
gumbel_softmax
|
def gumbel_softmax(x,
z_size,
mode,
softmax_k=0,
temperature_warmup_steps=150000,
summary=True,
name=None):
"""Gumbel softmax discretization bottleneck.
Args:
x: Input to the discretization bottleneck.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
mode: tf.estimator.ModeKeys.
softmax_k: If > 0 then do top-k softmax.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0.
summary: Whether to write summaries.
name: Name for the bottleneck scope.
Returns:
Embedding function, discrete code, and loss.
"""
with tf.variable_scope(name, default_name="gumbel_softmax"):
m = tf.layers.dense(x, 2**z_size, name="mask")
if softmax_k > 0:
m, kl = top_k_softmax(m, softmax_k)
return m, m, 1.0 - tf.reduce_mean(kl)
logsm = tf.nn.log_softmax(m)
# Gumbel-softmax sample.
gumbel_samples = gumbel_sample(common_layers.shape_list(m))
steps = temperature_warmup_steps
gumbel_samples *= common_layers.inverse_exp_decay(steps // 5) * 0.5
temperature = 1.2 - common_layers.inverse_lin_decay(steps)
# 10% of the time keep reasonably high temperature to keep learning.
temperature = tf.cond(
tf.less(tf.random_uniform([]), 0.9), lambda: temperature,
lambda: tf.random_uniform([], minval=0.5, maxval=1.0))
s = tf.nn.softmax((logsm + gumbel_samples) / temperature)
m = tf.nn.softmax(m)
kl = -tf.reduce_max(logsm, axis=-1)
if summary:
tf.summary.histogram("max-log", tf.reshape(kl, [-1]))
# Calculate the argmax and construct hot vectors.
maxvec = tf.reshape(tf.argmax(m, axis=-1), [-1])
maxvhot = tf.stop_gradient(tf.one_hot(maxvec, 2**z_size))
# Add losses that prevent too few being used.
distrib = tf.reshape(logsm, [-1, 2**z_size]) * maxvhot
d_mean = tf.reduce_mean(distrib, axis=[0], keep_dims=True)
d_variance = tf.reduce_mean(
tf.squared_difference(distrib, d_mean), axis=[0])
d_dev = -tf.reduce_mean(d_variance)
ret = s
if mode != tf.estimator.ModeKeys.TRAIN:
ret = tf.reshape(maxvhot, common_layers.shape_list(s)) # Just hot @eval.
return m, ret, d_dev * 5.0 + tf.reduce_mean(kl) * 0.002
|
python
|
def gumbel_softmax(x,
z_size,
mode,
softmax_k=0,
temperature_warmup_steps=150000,
summary=True,
name=None):
"""Gumbel softmax discretization bottleneck.
Args:
x: Input to the discretization bottleneck.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
mode: tf.estimator.ModeKeys.
softmax_k: If > 0 then do top-k softmax.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0.
summary: Whether to write summaries.
name: Name for the bottleneck scope.
Returns:
Embedding function, discrete code, and loss.
"""
with tf.variable_scope(name, default_name="gumbel_softmax"):
m = tf.layers.dense(x, 2**z_size, name="mask")
if softmax_k > 0:
m, kl = top_k_softmax(m, softmax_k)
return m, m, 1.0 - tf.reduce_mean(kl)
logsm = tf.nn.log_softmax(m)
# Gumbel-softmax sample.
gumbel_samples = gumbel_sample(common_layers.shape_list(m))
steps = temperature_warmup_steps
gumbel_samples *= common_layers.inverse_exp_decay(steps // 5) * 0.5
temperature = 1.2 - common_layers.inverse_lin_decay(steps)
# 10% of the time keep reasonably high temperature to keep learning.
temperature = tf.cond(
tf.less(tf.random_uniform([]), 0.9), lambda: temperature,
lambda: tf.random_uniform([], minval=0.5, maxval=1.0))
s = tf.nn.softmax((logsm + gumbel_samples) / temperature)
m = tf.nn.softmax(m)
kl = -tf.reduce_max(logsm, axis=-1)
if summary:
tf.summary.histogram("max-log", tf.reshape(kl, [-1]))
# Calculate the argmax and construct hot vectors.
maxvec = tf.reshape(tf.argmax(m, axis=-1), [-1])
maxvhot = tf.stop_gradient(tf.one_hot(maxvec, 2**z_size))
# Add losses that prevent too few being used.
distrib = tf.reshape(logsm, [-1, 2**z_size]) * maxvhot
d_mean = tf.reduce_mean(distrib, axis=[0], keep_dims=True)
d_variance = tf.reduce_mean(
tf.squared_difference(distrib, d_mean), axis=[0])
d_dev = -tf.reduce_mean(d_variance)
ret = s
if mode != tf.estimator.ModeKeys.TRAIN:
ret = tf.reshape(maxvhot, common_layers.shape_list(s)) # Just hot @eval.
return m, ret, d_dev * 5.0 + tf.reduce_mean(kl) * 0.002
|
[
"def",
"gumbel_softmax",
"(",
"x",
",",
"z_size",
",",
"mode",
",",
"softmax_k",
"=",
"0",
",",
"temperature_warmup_steps",
"=",
"150000",
",",
"summary",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"gumbel_softmax\"",
")",
":",
"m",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"2",
"**",
"z_size",
",",
"name",
"=",
"\"mask\"",
")",
"if",
"softmax_k",
">",
"0",
":",
"m",
",",
"kl",
"=",
"top_k_softmax",
"(",
"m",
",",
"softmax_k",
")",
"return",
"m",
",",
"m",
",",
"1.0",
"-",
"tf",
".",
"reduce_mean",
"(",
"kl",
")",
"logsm",
"=",
"tf",
".",
"nn",
".",
"log_softmax",
"(",
"m",
")",
"# Gumbel-softmax sample.",
"gumbel_samples",
"=",
"gumbel_sample",
"(",
"common_layers",
".",
"shape_list",
"(",
"m",
")",
")",
"steps",
"=",
"temperature_warmup_steps",
"gumbel_samples",
"*=",
"common_layers",
".",
"inverse_exp_decay",
"(",
"steps",
"//",
"5",
")",
"*",
"0.5",
"temperature",
"=",
"1.2",
"-",
"common_layers",
".",
"inverse_lin_decay",
"(",
"steps",
")",
"# 10% of the time keep reasonably high temperature to keep learning.",
"temperature",
"=",
"tf",
".",
"cond",
"(",
"tf",
".",
"less",
"(",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
")",
",",
"0.9",
")",
",",
"lambda",
":",
"temperature",
",",
"lambda",
":",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
",",
"minval",
"=",
"0.5",
",",
"maxval",
"=",
"1.0",
")",
")",
"s",
"=",
"tf",
".",
"nn",
".",
"softmax",
"(",
"(",
"logsm",
"+",
"gumbel_samples",
")",
"/",
"temperature",
")",
"m",
"=",
"tf",
".",
"nn",
".",
"softmax",
"(",
"m",
")",
"kl",
"=",
"-",
"tf",
".",
"reduce_max",
"(",
"logsm",
",",
"axis",
"=",
"-",
"1",
")",
"if",
"summary",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"max-log\"",
",",
"tf",
".",
"reshape",
"(",
"kl",
",",
"[",
"-",
"1",
"]",
")",
")",
"# Calculate the argmax and construct hot vectors.",
"maxvec",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"argmax",
"(",
"m",
",",
"axis",
"=",
"-",
"1",
")",
",",
"[",
"-",
"1",
"]",
")",
"maxvhot",
"=",
"tf",
".",
"stop_gradient",
"(",
"tf",
".",
"one_hot",
"(",
"maxvec",
",",
"2",
"**",
"z_size",
")",
")",
"# Add losses that prevent too few being used.",
"distrib",
"=",
"tf",
".",
"reshape",
"(",
"logsm",
",",
"[",
"-",
"1",
",",
"2",
"**",
"z_size",
"]",
")",
"*",
"maxvhot",
"d_mean",
"=",
"tf",
".",
"reduce_mean",
"(",
"distrib",
",",
"axis",
"=",
"[",
"0",
"]",
",",
"keep_dims",
"=",
"True",
")",
"d_variance",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"squared_difference",
"(",
"distrib",
",",
"d_mean",
")",
",",
"axis",
"=",
"[",
"0",
"]",
")",
"d_dev",
"=",
"-",
"tf",
".",
"reduce_mean",
"(",
"d_variance",
")",
"ret",
"=",
"s",
"if",
"mode",
"!=",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
":",
"ret",
"=",
"tf",
".",
"reshape",
"(",
"maxvhot",
",",
"common_layers",
".",
"shape_list",
"(",
"s",
")",
")",
"# Just hot @eval.",
"return",
"m",
",",
"ret",
",",
"d_dev",
"*",
"5.0",
"+",
"tf",
".",
"reduce_mean",
"(",
"kl",
")",
"*",
"0.002"
] |
Gumbel softmax discretization bottleneck.
Args:
x: Input to the discretization bottleneck.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
mode: tf.estimator.ModeKeys.
softmax_k: If > 0 then do top-k softmax.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0.
summary: Whether to write summaries.
name: Name for the bottleneck scope.
Returns:
Embedding function, discrete code, and loss.
|
[
"Gumbel",
"softmax",
"discretization",
"bottleneck",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L415-L475
|
train
|
Gumbel - softmax discretization bottleneck.
|
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Wp,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(0b101111 + 0o100) + '\061' + chr(0b11010 + 0o33) + chr(588 - 539), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4591 - 4480) + chr(50) + '\066' + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(1788 - 1738) + chr(2145 - 2094) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8609 - 8498) + chr(0b11100 + 0o25) + '\x31', 58537 - 58529), ehT0Px3KOsy9(chr(185 - 137) + '\157' + chr(0b1110 + 0o45) + chr(157 - 108) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(5777 - 5666) + '\x31' + chr(55) + '\066', 32712 - 32704), ehT0Px3KOsy9(chr(48) + chr(111) + chr(54) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2154 - 2105) + chr(0b110110) + chr(0b11000 + 0o34), 23114 - 23106), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(1972 - 1919) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(0b11010 + 0o30) + chr(0b10100 + 0o36), 35674 - 35666), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1897 - 1845) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(0b10010 + 0o41) + '\x36', 6020 - 6012), ehT0Px3KOsy9(chr(344 - 296) + chr(111) + chr(51) + chr(0b110110) + chr(1806 - 1757), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100100 + 0o15) + chr(49) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(2178 - 2125) + chr(254 - 200), ord("\x08")), ehT0Px3KOsy9(chr(757 - 709) + chr(111) + chr(53) + chr(0b110011 + 0o1), 9623 - 9615), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100011 + 0o16) + chr(0b110001) + chr(0b10001 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b110101 + 0o72) + chr(929 - 880) + chr(51) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100111 + 0o13) + chr(0b101011 + 0o10) + chr(2225 - 2177), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + chr(0b10011 + 0o36) + chr(1527 - 1479) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000101 + 0o52) + chr(0b1001 + 0o52) + chr(0b110100) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1777 - 1726) + '\x31' + chr(1071 - 1023), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + chr(50) + chr(0b101001 + 0o10) + chr(988 - 935), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(51) + '\061' + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\x32' + '\066', 17047 - 17039), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10110 + 0o34) + chr(49) + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(7162 - 7051) + '\063' + chr(0b110100) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(237 - 188) + chr(48), 8), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(48) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1001100 + 0o43) + chr(0b10100 + 0o35) + chr(49), 8), ehT0Px3KOsy9(chr(49 - 1) + chr(111) + chr(0b100100 + 0o22) + chr(0b10000 + 0o47), 40046 - 40038), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1000100 + 0o53) + chr(0b100011 + 0o20) + chr(0b1101 + 0o44) + chr(0b101 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1465 - 1416) + chr(0b110100) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + '\067' + '\060', 44133 - 44125), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + '\x36' + chr(2286 - 2237), 62488 - 62480), ehT0Px3KOsy9('\060' + '\157' + chr(0b101111 + 0o4) + '\065' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(55) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + '\x33' + '\065' + chr(51), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2204 - 2156) + '\x6f' + chr(53) + chr(0b11011 + 0o25), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'G'), '\x64' + '\x65' + chr(9253 - 9154) + chr(111) + '\x64' + '\145')(chr(117) + '\x74' + chr(5423 - 5321) + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mAQyRTblh_y7(OeWW0F1dBPRQ, NSd4iRY6tdp8, holLFgwB7vsP, pHiVlA3UX8ZY=ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\x30', 8), SpOun2NrX5aX=ehT0Px3KOsy9(chr(1162 - 1114) + chr(111) + chr(52) + chr(52) + chr(56 - 4) + chr(0b110010 + 0o5) + chr(0b1011 + 0o53) + chr(840 - 792), 0o10), oLgyQ45ORWXM=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), ord("\x08")), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xd2\xec`\xac\x1cZ\x11\xf4aD1\x81+'), chr(100) + '\145' + chr(0b1100011) + chr(4701 - 4590) + chr(0b1111 + 0o125) + chr(0b1100101))(chr(5400 - 5283) + chr(0b11011 + 0o131) + '\x66' + '\x2d' + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\xc6\xf3k\xa8\x12i\x07\xc4tS3\x906'), '\144' + chr(101) + chr(0b110010 + 0o61) + chr(0b1101111) + '\144' + chr(0b111 + 0o136))(chr(2133 - 2016) + '\164' + chr(102) + chr(207 - 162) + chr(0b111000))):
r8ufID9JCHnI = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, ehT0Px3KOsy9(chr(1339 - 1291) + chr(1215 - 1104) + chr(50), 437 - 429) ** NSd4iRY6tdp8, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\xd2\xedb'), chr(9604 - 9504) + '\145' + chr(0b11 + 0o140) + '\157' + '\144' + chr(101))('\x75' + chr(0b1010110 + 0o36) + chr(8054 - 7952) + chr(0b101101) + chr(56)))
if pHiVlA3UX8ZY > ehT0Px3KOsy9('\x30' + chr(111) + chr(1342 - 1294), 8):
(r8ufID9JCHnI, y5Mu5kTbeC7U) = vdfbjKKmFmje(r8ufID9JCHnI, pHiVlA3UX8ZY)
return (r8ufID9JCHnI, r8ufID9JCHnI, 1.0 - xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b\xd6\xfa|\xae\x1bi\x19\xcesI'), '\x64' + chr(0b1100101) + '\x63' + chr(111) + '\144' + chr(0b1011 + 0o132))('\165' + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(56)))(y5Mu5kTbeC7U))
Bxj9XVSuI2G_ = IDJ2eXGCBCDu.nn.log_softmax(r8ufID9JCHnI)
BX2pABD_1Jen = PHnecpeO1VoA(jSKPaHwSAfVv.shape_list(r8ufID9JCHnI))
v0VhEmlMsO_l = SpOun2NrX5aX
BX2pABD_1Jen *= jSKPaHwSAfVv.inverse_exp_decay(v0VhEmlMsO_l // ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + '\x35', 0b1000)) * 0.5
uICaXvjWrxGa = 1.2 - jSKPaHwSAfVv.inverse_lin_decay(v0VhEmlMsO_l)
uICaXvjWrxGa = IDJ2eXGCBCDu.cond(IDJ2eXGCBCDu.less(IDJ2eXGCBCDu.random_uniform([]), 0.9), lambda : uICaXvjWrxGa, lambda : IDJ2eXGCBCDu.random_uniform([], minval=0.5, maxval=1.0))
vGrByMSYMp9h = IDJ2eXGCBCDu.nn.softmax((Bxj9XVSuI2G_ + BX2pABD_1Jen) / uICaXvjWrxGa)
r8ufID9JCHnI = IDJ2eXGCBCDu.nn.softmax(r8ufID9JCHnI)
y5Mu5kTbeC7U = -IDJ2eXGCBCDu.reduce_max(Bxj9XVSuI2G_, axis=-ehT0Px3KOsy9(chr(48) + chr(0b1001 + 0o146) + chr(49), 8))
if oLgyQ45ORWXM:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'6\xf7\xaaS\xbaGT\x00\xfeFR\x0f'), chr(0b1100100) + chr(5316 - 5215) + '\143' + '\x6f' + chr(100) + chr(0b1100101))('\165' + '\x74' + chr(0b1100110) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\xd2\xe6$\xa1\x11Q'), chr(100) + chr(0b1100101) + chr(4041 - 3942) + chr(111) + '\x64' + chr(0b111110 + 0o47))(chr(117) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b111000)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b\xd6\xeda\xac\x0eS'), chr(100) + chr(0b110010 + 0o63) + '\143' + '\x6f' + chr(7348 - 7248) + chr(101))(chr(0b1010100 + 0o41) + '\x74' + chr(0b1100110) + chr(465 - 420) + chr(0b111000)))(y5Mu5kTbeC7U, [-ehT0Px3KOsy9(chr(48) + chr(4018 - 3907) + chr(0b100011 + 0o16), 8)]))
y0JRMA9FkoId = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.argmax(r8ufID9JCHnI, axis=-ehT0Px3KOsy9(chr(0b110000) + chr(0b10 + 0o155) + chr(701 - 652), 8)), [-ehT0Px3KOsy9('\x30' + chr(0b11111 + 0o120) + chr(49), 8)])
J2J1aDlPk3zG = IDJ2eXGCBCDu.stop_gradient(IDJ2eXGCBCDu.Hq3fv4Yp0EhD(y0JRMA9FkoId, ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1 + 0o61), 8) ** NSd4iRY6tdp8))
zYB9M55a4uGF = IDJ2eXGCBCDu.reshape(Bxj9XVSuI2G_, [-ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062', 8) ** NSd4iRY6tdp8]) * J2J1aDlPk3zG
S0Jmy8Zkjykl = IDJ2eXGCBCDu.reduce_mean(zYB9M55a4uGF, axis=[ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100 + 0o54), 8)], keep_dims=ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001), 8))
WbSOZPh3DgXe = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(zYB9M55a4uGF, S0Jmy8Zkjykl), axis=[ehT0Px3KOsy9('\x30' + chr(6021 - 5910) + chr(1543 - 1495), 8)])
iHCtM23MY07H = -IDJ2eXGCBCDu.reduce_mean(WbSOZPh3DgXe)
VHn4CV4Ymrei = vGrByMSYMp9h
if holLFgwB7vsP != xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'=\xe1\xdf@\x83'), chr(100) + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(45) + chr(0b0 + 0o70))):
VHn4CV4Ymrei = IDJ2eXGCBCDu.reshape(J2J1aDlPk3zG, jSKPaHwSAfVv.shape_list(vGrByMSYMp9h))
return (r8ufID9JCHnI, VHn4CV4Ymrei, iHCtM23MY07H * 5.0 + xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b\xd6\xfa|\xae\x1bi\x19\xcesI'), '\144' + '\x65' + chr(0b1100011) + chr(0b1011100 + 0o23) + chr(0b11100 + 0o110) + '\x65')('\165' + chr(0b10111 + 0o135) + chr(4336 - 4234) + chr(715 - 670) + chr(56)))(y5Mu5kTbeC7U) * 0.002)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
discrete_bottleneck
|
def discrete_bottleneck(inputs,
hidden_size,
z_size,
filter_size,
mode=None,
bottleneck_kind="dvq",
num_blocks=2,
num_residuals=1,
reshape_method="slice",
projection_tensors=None,
beta=0.25,
ema=True,
means=None,
ema_count=None,
ema_means=None,
epsilon=1e-5,
decay=0.999,
random_top_k=1,
soft_em=False,
num_samples=1,
softmax_k=0,
temperature_warmup_steps=150000,
do_hard_gumbel_softmax=False,
num_flows=0,
approximate_gs_entropy=False,
sum_over_latents=False,
discrete_mix=0.5,
noise_dev=1.,
startup_steps=50000,
summary=True,
name=None,
cond=True):
"""Discretization bottleneck.
Args:
inputs: Input to the bottleneck, a Tensor of shape [..., channels].
hidden_size: Dimension of the dense output.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
filter_size: Filter size in the embedding function.
mode: tf.estimator.ModeKeys.
bottleneck_kind: Kind of discretization bottleneck. One of dense, dvq
(decomposed vector quantization), gumbel-softmax, gumbel-softmax-dvq,
semhash, or vae.
num_blocks: Number of blocks. Used only if bottleneck_kind is DVQ.
num_residuals: Number of residual units used to compute nearest
neighbors. Used only if bottleneck_kind is DVQ.
reshape_method: Method to reshape. Used only if bottleneck_kind is DVQ.
projection_tensors: If the reshape method is project, then these are the
tensors used to project.
beta: Scale factor for codebook loss and EMA. Used only if bottleneck_kind
is DVQ.
ema: Whether to update embeddings using exponential moving averages. Used
only if bottleneck_kind is DVQ.
means: The embedding table. Used only if ema is True.
ema_count: Table of counts for each embedding corresponding to how many
examples in a batch it was the closest to. Used only if ema is True.
ema_means: Exponentially averaged version of the embeddings. Used only if
ema is True.
epsilon: Small value to avoid dividing by zero in EMA update. Used only if
ema is True.
decay: Decay factor for the exponential moving average. Used only if ema is
True.
random_top_k: Noisy top-k. Used only if bottleneck_kind is DVQ.
soft_em: Whether to use soft EM or hard EM. Used only if bottleneck_kind is
DVQ.
num_samples: Number of samples for soft EM. Used only if soft_em is True.
softmax_k: If > 0 then do top-k softmax. Used only if bottleneck_kind
is gumbel-softmax.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0. Used only if bottleneck_kind is gumbel-softmax or gumbel-softmax-dvq.
do_hard_gumbel_softmax: Whether to use hard or soft Gumbel-Softmax
samples. Used only if bottleneck_kind is gumbel-softmax-dvq.
num_flows: Number of inverse autoregresive flows. Used only if
bottleneck_kind is gumbel-softmax-dvq.
approximate_gs_entropy: Whether to approximate the Gumbel-Softmax density
as a categorical distribution when calculating the sample entropy. Used
only if bottleneck_kind is gumbel-softmax-dvq.
sum_over_latents: Whether to sum over all non-batch dimensions before
taking mean of entropy loss term. Used only if bottleneck kind is DVQ
or gumbel-softmax-dvq.
discrete_mix: Factor for mixing discrete and non-discrete input. Used only
if bottleneck_kind is semhash.
noise_dev: Noise stddev. Used only if bottleneck_kind is semhash.
startup_steps: Number of steps after which latent predictor is trained. Used
only if bottleneck_kind is semhash.
summary: Whether to write summaries.
name: Name for the bottleneck scope.
cond: A tf.bool condition on whether to update the codebook.
Returns:
outputs_dense: Tensor of shape [..., output_dim]. The output dimension is
hidden_size if bottleneck_kind is gumbel-softmax, DVQ; filter_size if
bottleneck_kind is dense, semhash, vae. If bottleneck_kind is DVQ,
outputs_dense represents the codebook (means) indexed by outputs_discrete.
outputs_discrete: Tensor of shape [...]. Discrete codes, each an index in
[0, 2**z_size). It uses the hot representation if soft_em is True.
extra_loss: Scalar Tensor. Sum of codebook and commitment losses if
bottleneck_kind is DVQ; else zero.
embed_fn: Function embed with arguments partially filled in.
neg_q_entropy: Scalar Tensor representing negative entropy of variational
approximation (0 if it is deterministic).
Raises:
ValueError: If projection_tensors is None for reshape_method project, or
ema_count or ema_means is None if ema is True, or unknown args.
"""
if bottleneck_kind in ["dvq", "gumbel-softmax-dvq"]:
assert means is not None
if hidden_size % num_blocks != 0:
raise ValueError("num_blocks does not divide hidden size")
if z_size % num_residuals != 0:
raise ValueError("num_residuals does not divide embedding table size")
z_size_per_residual = int(z_size / num_residuals)
if z_size_per_residual % num_blocks != 0:
raise ValueError("num_blocks does not divide embedding table size")
block_v_size = 2**int(z_size_per_residual / num_blocks)
if ema:
if ema_count is None:
raise ValueError("ema_count is None but ema is True")
if ema_means is None:
raise ValueError("ema_means is None but ema is True")
else:
block_v_size = None
with tf.variable_scope(
name, default_name="discrete_bottleneck", reuse=tf.AUTO_REUSE):
embed_fn = partial(
embed,
hidden_size=hidden_size,
z_size=z_size,
filter_size=filter_size,
bottleneck_kind=bottleneck_kind,
soft_em=soft_em,
num_blocks=num_blocks,
num_residuals=num_residuals,
block_v_size=block_v_size,
means=means,
name=name)
if bottleneck_kind == "dense":
# Note discrete output is continuous here.
outputs_discrete = tf.layers.dense(inputs, z_size, name="vcc")
outputs_dense = tf.layers.dense(
outputs_discrete, filter_size, name="vch1")
extra_loss = tf.constant(0.0)
neg_q_entropy = tf.constant(0.0)
elif bottleneck_kind in ["dvq", "gumbel-softmax-dvq"]:
inputs_3d = inputs
if len(inputs.shape) == 4:
inputs_3d = tf.squeeze(inputs, axis=2)
if reshape_method == "slice":
x_reshaped = slice_hidden(
inputs_3d, hidden_size=hidden_size, num_blocks=num_blocks)
elif reshape_method == "project":
if projection_tensors is None:
raise ValueError(
"Projection tensors is None for reshape_method project")
x_reshaped = project_hidden(
inputs_3d,
projection_tensors=projection_tensors,
hidden_size=hidden_size,
num_blocks=num_blocks)
else:
raise ValueError("Unknown reshape_method")
x_res = tf.reshape(x_reshaped,
[-1] + common_layers.shape_list(x_reshaped)[2:])
x_means_hot = []
x_means = 0
extra_loss = 0
for i in range(num_residuals):
x_means_hot_res, x_means_res, q_loss_res, e_loss_res, neg_q_entropy = (
embedding_lookup(
x_reshaped,
means=means[i],
num_blocks=num_blocks,
block_v_size=block_v_size,
bottleneck_kind=bottleneck_kind,
random_top_k=random_top_k,
soft_em=soft_em,
num_samples=num_samples,
temperature_warmup_steps=temperature_warmup_steps,
do_hard_gumbel_softmax=do_hard_gumbel_softmax,
num_flows=num_flows,
approximate_gs_entropy=approximate_gs_entropy,
sum_over_latents=sum_over_latents))
# Update the EMA variables.
if ema:
tf.logging.info("Using EMA with beta = {}".format(beta))
updated_ema_count_res = moving_averages.assign_moving_average(
ema_count[i],
tf.where(cond,
tf.reduce_sum(
tf.reshape(x_means_hot_res,
shape=[-1, num_blocks, block_v_size]),
axis=0), ema_count[i]),
decay,
zero_debias=False)
dw = tf.matmul(
tf.transpose(x_means_hot_res, perm=[1, 2, 0]),
tf.transpose(x_res, perm=[1, 0, 2]))
updated_ema_means_res = moving_averages.assign_moving_average(
ema_means[i], tf.where(cond, dw, ema_means[i]),
decay, zero_debias=False)
n = tf.reduce_sum(updated_ema_count_res, axis=-1, keep_dims=True)
updated_ema_count_res = (
(updated_ema_count_res + epsilon) / (n + 2**z_size * epsilon) * n)
# pylint: disable=g-no-augmented-assignment
updated_ema_means_res = updated_ema_means_res / tf.expand_dims(
updated_ema_count_res, axis=-1)
# pylint: enable=g-no-augmented-assignment
with tf.control_dependencies([e_loss_res]):
update_means_res = tf.assign(means[i],
tf.where(cond,
updated_ema_means_res,
means[i]))
with tf.control_dependencies([update_means_res]):
extra_loss += beta * e_loss_res
else:
extra_loss += q_loss_res + beta * e_loss_res
# Update the residuals.
x_res -= x_means_res
x_means += x_means_res
x_means_hot.append(x_means_hot_res)
# Get the discrete latent representation.
x_means_hot = tf.stack(x_means_hot, axis=1)
x_means_idx = tf.argmax(x_means_hot, axis=-1)
# Get the binary representation.
x_means_bits = int_to_bit(
x_means_idx,
num_bits=int(z_size / (num_residuals * num_blocks)),
base=2)
shape = common_layers.shape_list(x_means_bits)
new_shape = shape[:-2]
new_shape[-1] = z_size
x_means_bits = tf.reshape(x_means_bits, shape=new_shape)
outputs_discrete = bit_to_int(
tf.to_int32(x_means_bits), num_bits=z_size, base=2)
# Adjust shape of discrete outputs.
inputs_shape = common_layers.shape_list(inputs)
outputs_discrete = tf.reshape(outputs_discrete, inputs_shape[:-1])
# If we're using soft EM then set discretes to the hot representation.
if soft_em:
outputs_discrete = x_means_hot
outputs_discrete = tf.reshape(outputs_discrete,
inputs_shape[:-1] + [block_v_size])
# Reshape assuming hidden_size == inputs_shape[:-1].
x_means = tf.reshape(x_means, inputs_shape)
outputs_dense = inputs + tf.stop_gradient(x_means - inputs)
elif bottleneck_kind == "gumbel-softmax":
_, outputs_hot, extra_loss = gumbel_softmax(
inputs,
z_size=z_size,
mode=mode,
softmax_k=softmax_k,
temperature_warmup_steps=temperature_warmup_steps,
summary=summary,
name=name)
outputs_discrete = tf.argmax(outputs_hot, axis=-1)
outputs_dense = tf.layers.dense(
outputs_hot, hidden_size, name="dae_dense")
neg_q_entropy = tf.constant(0.0)
elif bottleneck_kind == "semhash":
outputs_discrete = tf.layers.dense(inputs, z_size, name="vcc")
y_clean = common_layers.saturating_sigmoid(outputs_discrete)
if summary:
tf.summary.histogram("y_clean", tf.reshape(y_clean, [-1]))
if noise_dev > 0 and mode == tf.estimator.ModeKeys.TRAIN:
noise = tf.truncated_normal(
common_layers.shape_list(outputs_discrete),
mean=0.0,
stddev=noise_dev)
y = common_layers.saturating_sigmoid(outputs_discrete + noise)
else:
y = y_clean
d = tf.to_float(tf.less(0.5, y))
y_discrete = tf.stop_gradient(d) + y - tf.stop_gradient(y)
pd = common_layers.inverse_exp_decay(startup_steps * 2)
pd *= discrete_mix
pd = pd if mode == tf.estimator.ModeKeys.TRAIN else 1.0
c = tf.where(
tf.less(tf.random_uniform([common_layers.shape_list(y)[0]]), pd),
y_discrete, y)
outputs_dense_a = tf.layers.dense(c, filter_size, name="vch1a")
outputs_dense_b = tf.layers.dense(1.0 - c, filter_size, name="vch1b")
outputs_dense = outputs_dense_a + outputs_dense_b
dx = tf.to_int32(tf.stop_gradient(d))
outputs_discrete = bit_to_int(dx, z_size)
extra_loss = tf.constant(0.0)
neg_q_entropy = tf.constant(0.0)
elif bottleneck_kind == "vae":
outputs_discrete, extra_loss, _, _ = vae(inputs, z_size, name="vae")
outputs_dense = tf.layers.dense(
outputs_discrete, filter_size, name="vch1")
neg_q_entropy = tf.constant(0.0)
else:
raise ValueError("Unknown discretization method.")
return outputs_dense, outputs_discrete, extra_loss, embed_fn, neg_q_entropy
|
python
|
def discrete_bottleneck(inputs,
hidden_size,
z_size,
filter_size,
mode=None,
bottleneck_kind="dvq",
num_blocks=2,
num_residuals=1,
reshape_method="slice",
projection_tensors=None,
beta=0.25,
ema=True,
means=None,
ema_count=None,
ema_means=None,
epsilon=1e-5,
decay=0.999,
random_top_k=1,
soft_em=False,
num_samples=1,
softmax_k=0,
temperature_warmup_steps=150000,
do_hard_gumbel_softmax=False,
num_flows=0,
approximate_gs_entropy=False,
sum_over_latents=False,
discrete_mix=0.5,
noise_dev=1.,
startup_steps=50000,
summary=True,
name=None,
cond=True):
"""Discretization bottleneck.
Args:
inputs: Input to the bottleneck, a Tensor of shape [..., channels].
hidden_size: Dimension of the dense output.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
filter_size: Filter size in the embedding function.
mode: tf.estimator.ModeKeys.
bottleneck_kind: Kind of discretization bottleneck. One of dense, dvq
(decomposed vector quantization), gumbel-softmax, gumbel-softmax-dvq,
semhash, or vae.
num_blocks: Number of blocks. Used only if bottleneck_kind is DVQ.
num_residuals: Number of residual units used to compute nearest
neighbors. Used only if bottleneck_kind is DVQ.
reshape_method: Method to reshape. Used only if bottleneck_kind is DVQ.
projection_tensors: If the reshape method is project, then these are the
tensors used to project.
beta: Scale factor for codebook loss and EMA. Used only if bottleneck_kind
is DVQ.
ema: Whether to update embeddings using exponential moving averages. Used
only if bottleneck_kind is DVQ.
means: The embedding table. Used only if ema is True.
ema_count: Table of counts for each embedding corresponding to how many
examples in a batch it was the closest to. Used only if ema is True.
ema_means: Exponentially averaged version of the embeddings. Used only if
ema is True.
epsilon: Small value to avoid dividing by zero in EMA update. Used only if
ema is True.
decay: Decay factor for the exponential moving average. Used only if ema is
True.
random_top_k: Noisy top-k. Used only if bottleneck_kind is DVQ.
soft_em: Whether to use soft EM or hard EM. Used only if bottleneck_kind is
DVQ.
num_samples: Number of samples for soft EM. Used only if soft_em is True.
softmax_k: If > 0 then do top-k softmax. Used only if bottleneck_kind
is gumbel-softmax.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0. Used only if bottleneck_kind is gumbel-softmax or gumbel-softmax-dvq.
do_hard_gumbel_softmax: Whether to use hard or soft Gumbel-Softmax
samples. Used only if bottleneck_kind is gumbel-softmax-dvq.
num_flows: Number of inverse autoregresive flows. Used only if
bottleneck_kind is gumbel-softmax-dvq.
approximate_gs_entropy: Whether to approximate the Gumbel-Softmax density
as a categorical distribution when calculating the sample entropy. Used
only if bottleneck_kind is gumbel-softmax-dvq.
sum_over_latents: Whether to sum over all non-batch dimensions before
taking mean of entropy loss term. Used only if bottleneck kind is DVQ
or gumbel-softmax-dvq.
discrete_mix: Factor for mixing discrete and non-discrete input. Used only
if bottleneck_kind is semhash.
noise_dev: Noise stddev. Used only if bottleneck_kind is semhash.
startup_steps: Number of steps after which latent predictor is trained. Used
only if bottleneck_kind is semhash.
summary: Whether to write summaries.
name: Name for the bottleneck scope.
cond: A tf.bool condition on whether to update the codebook.
Returns:
outputs_dense: Tensor of shape [..., output_dim]. The output dimension is
hidden_size if bottleneck_kind is gumbel-softmax, DVQ; filter_size if
bottleneck_kind is dense, semhash, vae. If bottleneck_kind is DVQ,
outputs_dense represents the codebook (means) indexed by outputs_discrete.
outputs_discrete: Tensor of shape [...]. Discrete codes, each an index in
[0, 2**z_size). It uses the hot representation if soft_em is True.
extra_loss: Scalar Tensor. Sum of codebook and commitment losses if
bottleneck_kind is DVQ; else zero.
embed_fn: Function embed with arguments partially filled in.
neg_q_entropy: Scalar Tensor representing negative entropy of variational
approximation (0 if it is deterministic).
Raises:
ValueError: If projection_tensors is None for reshape_method project, or
ema_count or ema_means is None if ema is True, or unknown args.
"""
if bottleneck_kind in ["dvq", "gumbel-softmax-dvq"]:
assert means is not None
if hidden_size % num_blocks != 0:
raise ValueError("num_blocks does not divide hidden size")
if z_size % num_residuals != 0:
raise ValueError("num_residuals does not divide embedding table size")
z_size_per_residual = int(z_size / num_residuals)
if z_size_per_residual % num_blocks != 0:
raise ValueError("num_blocks does not divide embedding table size")
block_v_size = 2**int(z_size_per_residual / num_blocks)
if ema:
if ema_count is None:
raise ValueError("ema_count is None but ema is True")
if ema_means is None:
raise ValueError("ema_means is None but ema is True")
else:
block_v_size = None
with tf.variable_scope(
name, default_name="discrete_bottleneck", reuse=tf.AUTO_REUSE):
embed_fn = partial(
embed,
hidden_size=hidden_size,
z_size=z_size,
filter_size=filter_size,
bottleneck_kind=bottleneck_kind,
soft_em=soft_em,
num_blocks=num_blocks,
num_residuals=num_residuals,
block_v_size=block_v_size,
means=means,
name=name)
if bottleneck_kind == "dense":
# Note discrete output is continuous here.
outputs_discrete = tf.layers.dense(inputs, z_size, name="vcc")
outputs_dense = tf.layers.dense(
outputs_discrete, filter_size, name="vch1")
extra_loss = tf.constant(0.0)
neg_q_entropy = tf.constant(0.0)
elif bottleneck_kind in ["dvq", "gumbel-softmax-dvq"]:
inputs_3d = inputs
if len(inputs.shape) == 4:
inputs_3d = tf.squeeze(inputs, axis=2)
if reshape_method == "slice":
x_reshaped = slice_hidden(
inputs_3d, hidden_size=hidden_size, num_blocks=num_blocks)
elif reshape_method == "project":
if projection_tensors is None:
raise ValueError(
"Projection tensors is None for reshape_method project")
x_reshaped = project_hidden(
inputs_3d,
projection_tensors=projection_tensors,
hidden_size=hidden_size,
num_blocks=num_blocks)
else:
raise ValueError("Unknown reshape_method")
x_res = tf.reshape(x_reshaped,
[-1] + common_layers.shape_list(x_reshaped)[2:])
x_means_hot = []
x_means = 0
extra_loss = 0
for i in range(num_residuals):
x_means_hot_res, x_means_res, q_loss_res, e_loss_res, neg_q_entropy = (
embedding_lookup(
x_reshaped,
means=means[i],
num_blocks=num_blocks,
block_v_size=block_v_size,
bottleneck_kind=bottleneck_kind,
random_top_k=random_top_k,
soft_em=soft_em,
num_samples=num_samples,
temperature_warmup_steps=temperature_warmup_steps,
do_hard_gumbel_softmax=do_hard_gumbel_softmax,
num_flows=num_flows,
approximate_gs_entropy=approximate_gs_entropy,
sum_over_latents=sum_over_latents))
# Update the EMA variables.
if ema:
tf.logging.info("Using EMA with beta = {}".format(beta))
updated_ema_count_res = moving_averages.assign_moving_average(
ema_count[i],
tf.where(cond,
tf.reduce_sum(
tf.reshape(x_means_hot_res,
shape=[-1, num_blocks, block_v_size]),
axis=0), ema_count[i]),
decay,
zero_debias=False)
dw = tf.matmul(
tf.transpose(x_means_hot_res, perm=[1, 2, 0]),
tf.transpose(x_res, perm=[1, 0, 2]))
updated_ema_means_res = moving_averages.assign_moving_average(
ema_means[i], tf.where(cond, dw, ema_means[i]),
decay, zero_debias=False)
n = tf.reduce_sum(updated_ema_count_res, axis=-1, keep_dims=True)
updated_ema_count_res = (
(updated_ema_count_res + epsilon) / (n + 2**z_size * epsilon) * n)
# pylint: disable=g-no-augmented-assignment
updated_ema_means_res = updated_ema_means_res / tf.expand_dims(
updated_ema_count_res, axis=-1)
# pylint: enable=g-no-augmented-assignment
with tf.control_dependencies([e_loss_res]):
update_means_res = tf.assign(means[i],
tf.where(cond,
updated_ema_means_res,
means[i]))
with tf.control_dependencies([update_means_res]):
extra_loss += beta * e_loss_res
else:
extra_loss += q_loss_res + beta * e_loss_res
# Update the residuals.
x_res -= x_means_res
x_means += x_means_res
x_means_hot.append(x_means_hot_res)
# Get the discrete latent representation.
x_means_hot = tf.stack(x_means_hot, axis=1)
x_means_idx = tf.argmax(x_means_hot, axis=-1)
# Get the binary representation.
x_means_bits = int_to_bit(
x_means_idx,
num_bits=int(z_size / (num_residuals * num_blocks)),
base=2)
shape = common_layers.shape_list(x_means_bits)
new_shape = shape[:-2]
new_shape[-1] = z_size
x_means_bits = tf.reshape(x_means_bits, shape=new_shape)
outputs_discrete = bit_to_int(
tf.to_int32(x_means_bits), num_bits=z_size, base=2)
# Adjust shape of discrete outputs.
inputs_shape = common_layers.shape_list(inputs)
outputs_discrete = tf.reshape(outputs_discrete, inputs_shape[:-1])
# If we're using soft EM then set discretes to the hot representation.
if soft_em:
outputs_discrete = x_means_hot
outputs_discrete = tf.reshape(outputs_discrete,
inputs_shape[:-1] + [block_v_size])
# Reshape assuming hidden_size == inputs_shape[:-1].
x_means = tf.reshape(x_means, inputs_shape)
outputs_dense = inputs + tf.stop_gradient(x_means - inputs)
elif bottleneck_kind == "gumbel-softmax":
_, outputs_hot, extra_loss = gumbel_softmax(
inputs,
z_size=z_size,
mode=mode,
softmax_k=softmax_k,
temperature_warmup_steps=temperature_warmup_steps,
summary=summary,
name=name)
outputs_discrete = tf.argmax(outputs_hot, axis=-1)
outputs_dense = tf.layers.dense(
outputs_hot, hidden_size, name="dae_dense")
neg_q_entropy = tf.constant(0.0)
elif bottleneck_kind == "semhash":
outputs_discrete = tf.layers.dense(inputs, z_size, name="vcc")
y_clean = common_layers.saturating_sigmoid(outputs_discrete)
if summary:
tf.summary.histogram("y_clean", tf.reshape(y_clean, [-1]))
if noise_dev > 0 and mode == tf.estimator.ModeKeys.TRAIN:
noise = tf.truncated_normal(
common_layers.shape_list(outputs_discrete),
mean=0.0,
stddev=noise_dev)
y = common_layers.saturating_sigmoid(outputs_discrete + noise)
else:
y = y_clean
d = tf.to_float(tf.less(0.5, y))
y_discrete = tf.stop_gradient(d) + y - tf.stop_gradient(y)
pd = common_layers.inverse_exp_decay(startup_steps * 2)
pd *= discrete_mix
pd = pd if mode == tf.estimator.ModeKeys.TRAIN else 1.0
c = tf.where(
tf.less(tf.random_uniform([common_layers.shape_list(y)[0]]), pd),
y_discrete, y)
outputs_dense_a = tf.layers.dense(c, filter_size, name="vch1a")
outputs_dense_b = tf.layers.dense(1.0 - c, filter_size, name="vch1b")
outputs_dense = outputs_dense_a + outputs_dense_b
dx = tf.to_int32(tf.stop_gradient(d))
outputs_discrete = bit_to_int(dx, z_size)
extra_loss = tf.constant(0.0)
neg_q_entropy = tf.constant(0.0)
elif bottleneck_kind == "vae":
outputs_discrete, extra_loss, _, _ = vae(inputs, z_size, name="vae")
outputs_dense = tf.layers.dense(
outputs_discrete, filter_size, name="vch1")
neg_q_entropy = tf.constant(0.0)
else:
raise ValueError("Unknown discretization method.")
return outputs_dense, outputs_discrete, extra_loss, embed_fn, neg_q_entropy
|
[
"def",
"discrete_bottleneck",
"(",
"inputs",
",",
"hidden_size",
",",
"z_size",
",",
"filter_size",
",",
"mode",
"=",
"None",
",",
"bottleneck_kind",
"=",
"\"dvq\"",
",",
"num_blocks",
"=",
"2",
",",
"num_residuals",
"=",
"1",
",",
"reshape_method",
"=",
"\"slice\"",
",",
"projection_tensors",
"=",
"None",
",",
"beta",
"=",
"0.25",
",",
"ema",
"=",
"True",
",",
"means",
"=",
"None",
",",
"ema_count",
"=",
"None",
",",
"ema_means",
"=",
"None",
",",
"epsilon",
"=",
"1e-5",
",",
"decay",
"=",
"0.999",
",",
"random_top_k",
"=",
"1",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"1",
",",
"softmax_k",
"=",
"0",
",",
"temperature_warmup_steps",
"=",
"150000",
",",
"do_hard_gumbel_softmax",
"=",
"False",
",",
"num_flows",
"=",
"0",
",",
"approximate_gs_entropy",
"=",
"False",
",",
"sum_over_latents",
"=",
"False",
",",
"discrete_mix",
"=",
"0.5",
",",
"noise_dev",
"=",
"1.",
",",
"startup_steps",
"=",
"50000",
",",
"summary",
"=",
"True",
",",
"name",
"=",
"None",
",",
"cond",
"=",
"True",
")",
":",
"if",
"bottleneck_kind",
"in",
"[",
"\"dvq\"",
",",
"\"gumbel-softmax-dvq\"",
"]",
":",
"assert",
"means",
"is",
"not",
"None",
"if",
"hidden_size",
"%",
"num_blocks",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"num_blocks does not divide hidden size\"",
")",
"if",
"z_size",
"%",
"num_residuals",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"num_residuals does not divide embedding table size\"",
")",
"z_size_per_residual",
"=",
"int",
"(",
"z_size",
"/",
"num_residuals",
")",
"if",
"z_size_per_residual",
"%",
"num_blocks",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"num_blocks does not divide embedding table size\"",
")",
"block_v_size",
"=",
"2",
"**",
"int",
"(",
"z_size_per_residual",
"/",
"num_blocks",
")",
"if",
"ema",
":",
"if",
"ema_count",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"ema_count is None but ema is True\"",
")",
"if",
"ema_means",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"ema_means is None but ema is True\"",
")",
"else",
":",
"block_v_size",
"=",
"None",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"discrete_bottleneck\"",
",",
"reuse",
"=",
"tf",
".",
"AUTO_REUSE",
")",
":",
"embed_fn",
"=",
"partial",
"(",
"embed",
",",
"hidden_size",
"=",
"hidden_size",
",",
"z_size",
"=",
"z_size",
",",
"filter_size",
"=",
"filter_size",
",",
"bottleneck_kind",
"=",
"bottleneck_kind",
",",
"soft_em",
"=",
"soft_em",
",",
"num_blocks",
"=",
"num_blocks",
",",
"num_residuals",
"=",
"num_residuals",
",",
"block_v_size",
"=",
"block_v_size",
",",
"means",
"=",
"means",
",",
"name",
"=",
"name",
")",
"if",
"bottleneck_kind",
"==",
"\"dense\"",
":",
"# Note discrete output is continuous here.",
"outputs_discrete",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"inputs",
",",
"z_size",
",",
"name",
"=",
"\"vcc\"",
")",
"outputs_dense",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"outputs_discrete",
",",
"filter_size",
",",
"name",
"=",
"\"vch1\"",
")",
"extra_loss",
"=",
"tf",
".",
"constant",
"(",
"0.0",
")",
"neg_q_entropy",
"=",
"tf",
".",
"constant",
"(",
"0.0",
")",
"elif",
"bottleneck_kind",
"in",
"[",
"\"dvq\"",
",",
"\"gumbel-softmax-dvq\"",
"]",
":",
"inputs_3d",
"=",
"inputs",
"if",
"len",
"(",
"inputs",
".",
"shape",
")",
"==",
"4",
":",
"inputs_3d",
"=",
"tf",
".",
"squeeze",
"(",
"inputs",
",",
"axis",
"=",
"2",
")",
"if",
"reshape_method",
"==",
"\"slice\"",
":",
"x_reshaped",
"=",
"slice_hidden",
"(",
"inputs_3d",
",",
"hidden_size",
"=",
"hidden_size",
",",
"num_blocks",
"=",
"num_blocks",
")",
"elif",
"reshape_method",
"==",
"\"project\"",
":",
"if",
"projection_tensors",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Projection tensors is None for reshape_method project\"",
")",
"x_reshaped",
"=",
"project_hidden",
"(",
"inputs_3d",
",",
"projection_tensors",
"=",
"projection_tensors",
",",
"hidden_size",
"=",
"hidden_size",
",",
"num_blocks",
"=",
"num_blocks",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unknown reshape_method\"",
")",
"x_res",
"=",
"tf",
".",
"reshape",
"(",
"x_reshaped",
",",
"[",
"-",
"1",
"]",
"+",
"common_layers",
".",
"shape_list",
"(",
"x_reshaped",
")",
"[",
"2",
":",
"]",
")",
"x_means_hot",
"=",
"[",
"]",
"x_means",
"=",
"0",
"extra_loss",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"num_residuals",
")",
":",
"x_means_hot_res",
",",
"x_means_res",
",",
"q_loss_res",
",",
"e_loss_res",
",",
"neg_q_entropy",
"=",
"(",
"embedding_lookup",
"(",
"x_reshaped",
",",
"means",
"=",
"means",
"[",
"i",
"]",
",",
"num_blocks",
"=",
"num_blocks",
",",
"block_v_size",
"=",
"block_v_size",
",",
"bottleneck_kind",
"=",
"bottleneck_kind",
",",
"random_top_k",
"=",
"random_top_k",
",",
"soft_em",
"=",
"soft_em",
",",
"num_samples",
"=",
"num_samples",
",",
"temperature_warmup_steps",
"=",
"temperature_warmup_steps",
",",
"do_hard_gumbel_softmax",
"=",
"do_hard_gumbel_softmax",
",",
"num_flows",
"=",
"num_flows",
",",
"approximate_gs_entropy",
"=",
"approximate_gs_entropy",
",",
"sum_over_latents",
"=",
"sum_over_latents",
")",
")",
"# Update the EMA variables.",
"if",
"ema",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Using EMA with beta = {}\"",
".",
"format",
"(",
"beta",
")",
")",
"updated_ema_count_res",
"=",
"moving_averages",
".",
"assign_moving_average",
"(",
"ema_count",
"[",
"i",
"]",
",",
"tf",
".",
"where",
"(",
"cond",
",",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"reshape",
"(",
"x_means_hot_res",
",",
"shape",
"=",
"[",
"-",
"1",
",",
"num_blocks",
",",
"block_v_size",
"]",
")",
",",
"axis",
"=",
"0",
")",
",",
"ema_count",
"[",
"i",
"]",
")",
",",
"decay",
",",
"zero_debias",
"=",
"False",
")",
"dw",
"=",
"tf",
".",
"matmul",
"(",
"tf",
".",
"transpose",
"(",
"x_means_hot_res",
",",
"perm",
"=",
"[",
"1",
",",
"2",
",",
"0",
"]",
")",
",",
"tf",
".",
"transpose",
"(",
"x_res",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
")",
"updated_ema_means_res",
"=",
"moving_averages",
".",
"assign_moving_average",
"(",
"ema_means",
"[",
"i",
"]",
",",
"tf",
".",
"where",
"(",
"cond",
",",
"dw",
",",
"ema_means",
"[",
"i",
"]",
")",
",",
"decay",
",",
"zero_debias",
"=",
"False",
")",
"n",
"=",
"tf",
".",
"reduce_sum",
"(",
"updated_ema_count_res",
",",
"axis",
"=",
"-",
"1",
",",
"keep_dims",
"=",
"True",
")",
"updated_ema_count_res",
"=",
"(",
"(",
"updated_ema_count_res",
"+",
"epsilon",
")",
"/",
"(",
"n",
"+",
"2",
"**",
"z_size",
"*",
"epsilon",
")",
"*",
"n",
")",
"# pylint: disable=g-no-augmented-assignment",
"updated_ema_means_res",
"=",
"updated_ema_means_res",
"/",
"tf",
".",
"expand_dims",
"(",
"updated_ema_count_res",
",",
"axis",
"=",
"-",
"1",
")",
"# pylint: enable=g-no-augmented-assignment",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"e_loss_res",
"]",
")",
":",
"update_means_res",
"=",
"tf",
".",
"assign",
"(",
"means",
"[",
"i",
"]",
",",
"tf",
".",
"where",
"(",
"cond",
",",
"updated_ema_means_res",
",",
"means",
"[",
"i",
"]",
")",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"update_means_res",
"]",
")",
":",
"extra_loss",
"+=",
"beta",
"*",
"e_loss_res",
"else",
":",
"extra_loss",
"+=",
"q_loss_res",
"+",
"beta",
"*",
"e_loss_res",
"# Update the residuals.",
"x_res",
"-=",
"x_means_res",
"x_means",
"+=",
"x_means_res",
"x_means_hot",
".",
"append",
"(",
"x_means_hot_res",
")",
"# Get the discrete latent representation.",
"x_means_hot",
"=",
"tf",
".",
"stack",
"(",
"x_means_hot",
",",
"axis",
"=",
"1",
")",
"x_means_idx",
"=",
"tf",
".",
"argmax",
"(",
"x_means_hot",
",",
"axis",
"=",
"-",
"1",
")",
"# Get the binary representation.",
"x_means_bits",
"=",
"int_to_bit",
"(",
"x_means_idx",
",",
"num_bits",
"=",
"int",
"(",
"z_size",
"/",
"(",
"num_residuals",
"*",
"num_blocks",
")",
")",
",",
"base",
"=",
"2",
")",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x_means_bits",
")",
"new_shape",
"=",
"shape",
"[",
":",
"-",
"2",
"]",
"new_shape",
"[",
"-",
"1",
"]",
"=",
"z_size",
"x_means_bits",
"=",
"tf",
".",
"reshape",
"(",
"x_means_bits",
",",
"shape",
"=",
"new_shape",
")",
"outputs_discrete",
"=",
"bit_to_int",
"(",
"tf",
".",
"to_int32",
"(",
"x_means_bits",
")",
",",
"num_bits",
"=",
"z_size",
",",
"base",
"=",
"2",
")",
"# Adjust shape of discrete outputs.",
"inputs_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"inputs",
")",
"outputs_discrete",
"=",
"tf",
".",
"reshape",
"(",
"outputs_discrete",
",",
"inputs_shape",
"[",
":",
"-",
"1",
"]",
")",
"# If we're using soft EM then set discretes to the hot representation.",
"if",
"soft_em",
":",
"outputs_discrete",
"=",
"x_means_hot",
"outputs_discrete",
"=",
"tf",
".",
"reshape",
"(",
"outputs_discrete",
",",
"inputs_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"block_v_size",
"]",
")",
"# Reshape assuming hidden_size == inputs_shape[:-1].",
"x_means",
"=",
"tf",
".",
"reshape",
"(",
"x_means",
",",
"inputs_shape",
")",
"outputs_dense",
"=",
"inputs",
"+",
"tf",
".",
"stop_gradient",
"(",
"x_means",
"-",
"inputs",
")",
"elif",
"bottleneck_kind",
"==",
"\"gumbel-softmax\"",
":",
"_",
",",
"outputs_hot",
",",
"extra_loss",
"=",
"gumbel_softmax",
"(",
"inputs",
",",
"z_size",
"=",
"z_size",
",",
"mode",
"=",
"mode",
",",
"softmax_k",
"=",
"softmax_k",
",",
"temperature_warmup_steps",
"=",
"temperature_warmup_steps",
",",
"summary",
"=",
"summary",
",",
"name",
"=",
"name",
")",
"outputs_discrete",
"=",
"tf",
".",
"argmax",
"(",
"outputs_hot",
",",
"axis",
"=",
"-",
"1",
")",
"outputs_dense",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"outputs_hot",
",",
"hidden_size",
",",
"name",
"=",
"\"dae_dense\"",
")",
"neg_q_entropy",
"=",
"tf",
".",
"constant",
"(",
"0.0",
")",
"elif",
"bottleneck_kind",
"==",
"\"semhash\"",
":",
"outputs_discrete",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"inputs",
",",
"z_size",
",",
"name",
"=",
"\"vcc\"",
")",
"y_clean",
"=",
"common_layers",
".",
"saturating_sigmoid",
"(",
"outputs_discrete",
")",
"if",
"summary",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"y_clean\"",
",",
"tf",
".",
"reshape",
"(",
"y_clean",
",",
"[",
"-",
"1",
"]",
")",
")",
"if",
"noise_dev",
">",
"0",
"and",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
":",
"noise",
"=",
"tf",
".",
"truncated_normal",
"(",
"common_layers",
".",
"shape_list",
"(",
"outputs_discrete",
")",
",",
"mean",
"=",
"0.0",
",",
"stddev",
"=",
"noise_dev",
")",
"y",
"=",
"common_layers",
".",
"saturating_sigmoid",
"(",
"outputs_discrete",
"+",
"noise",
")",
"else",
":",
"y",
"=",
"y_clean",
"d",
"=",
"tf",
".",
"to_float",
"(",
"tf",
".",
"less",
"(",
"0.5",
",",
"y",
")",
")",
"y_discrete",
"=",
"tf",
".",
"stop_gradient",
"(",
"d",
")",
"+",
"y",
"-",
"tf",
".",
"stop_gradient",
"(",
"y",
")",
"pd",
"=",
"common_layers",
".",
"inverse_exp_decay",
"(",
"startup_steps",
"*",
"2",
")",
"pd",
"*=",
"discrete_mix",
"pd",
"=",
"pd",
"if",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
"else",
"1.0",
"c",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"less",
"(",
"tf",
".",
"random_uniform",
"(",
"[",
"common_layers",
".",
"shape_list",
"(",
"y",
")",
"[",
"0",
"]",
"]",
")",
",",
"pd",
")",
",",
"y_discrete",
",",
"y",
")",
"outputs_dense_a",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"c",
",",
"filter_size",
",",
"name",
"=",
"\"vch1a\"",
")",
"outputs_dense_b",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"1.0",
"-",
"c",
",",
"filter_size",
",",
"name",
"=",
"\"vch1b\"",
")",
"outputs_dense",
"=",
"outputs_dense_a",
"+",
"outputs_dense_b",
"dx",
"=",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"stop_gradient",
"(",
"d",
")",
")",
"outputs_discrete",
"=",
"bit_to_int",
"(",
"dx",
",",
"z_size",
")",
"extra_loss",
"=",
"tf",
".",
"constant",
"(",
"0.0",
")",
"neg_q_entropy",
"=",
"tf",
".",
"constant",
"(",
"0.0",
")",
"elif",
"bottleneck_kind",
"==",
"\"vae\"",
":",
"outputs_discrete",
",",
"extra_loss",
",",
"_",
",",
"_",
"=",
"vae",
"(",
"inputs",
",",
"z_size",
",",
"name",
"=",
"\"vae\"",
")",
"outputs_dense",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"outputs_discrete",
",",
"filter_size",
",",
"name",
"=",
"\"vch1\"",
")",
"neg_q_entropy",
"=",
"tf",
".",
"constant",
"(",
"0.0",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unknown discretization method.\"",
")",
"return",
"outputs_dense",
",",
"outputs_discrete",
",",
"extra_loss",
",",
"embed_fn",
",",
"neg_q_entropy"
] |
Discretization bottleneck.
Args:
inputs: Input to the bottleneck, a Tensor of shape [..., channels].
hidden_size: Dimension of the dense output.
z_size: Number of bits, where discrete codes range from 1 to 2**z_size.
filter_size: Filter size in the embedding function.
mode: tf.estimator.ModeKeys.
bottleneck_kind: Kind of discretization bottleneck. One of dense, dvq
(decomposed vector quantization), gumbel-softmax, gumbel-softmax-dvq,
semhash, or vae.
num_blocks: Number of blocks. Used only if bottleneck_kind is DVQ.
num_residuals: Number of residual units used to compute nearest
neighbors. Used only if bottleneck_kind is DVQ.
reshape_method: Method to reshape. Used only if bottleneck_kind is DVQ.
projection_tensors: If the reshape method is project, then these are the
tensors used to project.
beta: Scale factor for codebook loss and EMA. Used only if bottleneck_kind
is DVQ.
ema: Whether to update embeddings using exponential moving averages. Used
only if bottleneck_kind is DVQ.
means: The embedding table. Used only if ema is True.
ema_count: Table of counts for each embedding corresponding to how many
examples in a batch it was the closest to. Used only if ema is True.
ema_means: Exponentially averaged version of the embeddings. Used only if
ema is True.
epsilon: Small value to avoid dividing by zero in EMA update. Used only if
ema is True.
decay: Decay factor for the exponential moving average. Used only if ema is
True.
random_top_k: Noisy top-k. Used only if bottleneck_kind is DVQ.
soft_em: Whether to use soft EM or hard EM. Used only if bottleneck_kind is
DVQ.
num_samples: Number of samples for soft EM. Used only if soft_em is True.
softmax_k: If > 0 then do top-k softmax. Used only if bottleneck_kind
is gumbel-softmax.
temperature_warmup_steps: Number of steps it takes to decay temperature to
0. Used only if bottleneck_kind is gumbel-softmax or gumbel-softmax-dvq.
do_hard_gumbel_softmax: Whether to use hard or soft Gumbel-Softmax
samples. Used only if bottleneck_kind is gumbel-softmax-dvq.
num_flows: Number of inverse autoregresive flows. Used only if
bottleneck_kind is gumbel-softmax-dvq.
approximate_gs_entropy: Whether to approximate the Gumbel-Softmax density
as a categorical distribution when calculating the sample entropy. Used
only if bottleneck_kind is gumbel-softmax-dvq.
sum_over_latents: Whether to sum over all non-batch dimensions before
taking mean of entropy loss term. Used only if bottleneck kind is DVQ
or gumbel-softmax-dvq.
discrete_mix: Factor for mixing discrete and non-discrete input. Used only
if bottleneck_kind is semhash.
noise_dev: Noise stddev. Used only if bottleneck_kind is semhash.
startup_steps: Number of steps after which latent predictor is trained. Used
only if bottleneck_kind is semhash.
summary: Whether to write summaries.
name: Name for the bottleneck scope.
cond: A tf.bool condition on whether to update the codebook.
Returns:
outputs_dense: Tensor of shape [..., output_dim]. The output dimension is
hidden_size if bottleneck_kind is gumbel-softmax, DVQ; filter_size if
bottleneck_kind is dense, semhash, vae. If bottleneck_kind is DVQ,
outputs_dense represents the codebook (means) indexed by outputs_discrete.
outputs_discrete: Tensor of shape [...]. Discrete codes, each an index in
[0, 2**z_size). It uses the hot representation if soft_em is True.
extra_loss: Scalar Tensor. Sum of codebook and commitment losses if
bottleneck_kind is DVQ; else zero.
embed_fn: Function embed with arguments partially filled in.
neg_q_entropy: Scalar Tensor representing negative entropy of variational
approximation (0 if it is deterministic).
Raises:
ValueError: If projection_tensors is None for reshape_method project, or
ema_count or ema_means is None if ema is True, or unknown args.
|
[
"Discretization",
"bottleneck",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L478-L788
|
train
|
Discretization bottleneck.
|
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,BXIwDASQ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R9h,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(0b110101), 40758 - 40750), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + chr(1321 - 1266) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b1110 + 0o141) + chr(1373 - 1323) + chr(52) + '\066', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(218 - 169) + chr(0b110001) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b100100 + 0o15) + chr(0b1101 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1000101 + 0o52) + chr(357 - 303), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(1219 - 1169), 0b1000), ehT0Px3KOsy9(chr(1232 - 1184) + '\157' + chr(2389 - 2340) + chr(0b110101) + chr(1354 - 1299), 8102 - 8094), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(53) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b11101 + 0o122) + chr(0b101110 + 0o4) + chr(1021 - 966) + chr(2119 - 2068), 0o10), ehT0Px3KOsy9(chr(1323 - 1275) + chr(0b1101111) + chr(0b11 + 0o60) + chr(54) + '\x37', 25165 - 25157), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001101 + 0o42) + chr(1986 - 1937) + '\x37' + chr(0b10010 + 0o43), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1292 - 1243) + chr(0b110000), 4164 - 4156), ehT0Px3KOsy9('\x30' + chr(239 - 128) + chr(0b10001 + 0o42) + chr(0b110101) + chr(1930 - 1877), 38745 - 38737), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(1082 - 971) + '\062' + '\x33' + '\067', 5345 - 5337), ehT0Px3KOsy9(chr(48) + '\x6f' + '\066' + chr(54), 0o10), ehT0Px3KOsy9(chr(1148 - 1100) + chr(0b1100000 + 0o17) + '\061' + chr(0b101010 + 0o7) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b110010) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011011 + 0o24) + chr(0b110100) + chr(0b11111 + 0o23), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(2226 - 2176) + '\x36' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b100 + 0o60), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010000 + 0o37) + chr(0b100001 + 0o21) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100110 + 0o13) + chr(48) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2506 - 2395) + chr(0b110010) + chr(680 - 627), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b110100) + chr(0b100101 + 0o15), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(54) + '\x36', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(590 - 538) + chr(2798 - 2743), 9825 - 9817), ehT0Px3KOsy9(chr(640 - 592) + chr(111) + chr(0b110011) + chr(51) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000110 + 0o51) + chr(51) + chr(2008 - 1958) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(3385 - 3274) + chr(0b110010 + 0o0) + chr(0b100000 + 0o22) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001000 + 0o47) + '\x32' + '\x32' + chr(2571 - 2520), 2602 - 2594), ehT0Px3KOsy9(chr(656 - 608) + chr(11332 - 11221) + chr(762 - 713) + '\x37' + chr(0b100111 + 0o16), 8), ehT0Px3KOsy9(chr(1922 - 1874) + chr(6355 - 6244) + '\x32' + chr(0b110011) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(859 - 811) + chr(0b1101111) + '\063' + chr(2248 - 2197) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1946 - 1898) + chr(111) + '\x33' + chr(2497 - 2445) + chr(0b1100 + 0o46), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(2175 - 2122) + chr(768 - 713), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110110) + chr(0b100001 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(2301 - 2253) + chr(111) + chr(54), 8), ehT0Px3KOsy9(chr(48) + chr(11756 - 11645) + '\x32' + chr(0b10010 + 0o42) + chr(2222 - 2167), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101 + 0o60) + chr(0b1101 + 0o43), 13187 - 13179)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'+'), '\144' + chr(8293 - 8192) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + chr(102) + '\055' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def MWB0DpQiwB8G(vXoupepMtCXU, qzoyXN3kdhDL, NSd4iRY6tdp8, deybX8NJ0oEI, holLFgwB7vsP=None, rZIVWZZhpCQD=xafqLlk3kkUe(SXOLrMavuUCe(b'aM\xd7'), chr(100) + '\x65' + chr(99) + chr(0b1101111) + chr(0b100010 + 0o102) + '\x65')('\x75' + chr(0b110111 + 0o75) + chr(0b1000011 + 0o43) + chr(0b101101) + chr(0b111000)), azOnMTJc4Vem=ehT0Px3KOsy9('\x30' + '\157' + chr(50), 0o10), R38qqj9vgOQS=ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + '\x31', ord("\x08")), c4UcgDokHFHK=xafqLlk3kkUe(SXOLrMavuUCe(b'vW\xcf-.'), chr(8601 - 8501) + chr(4177 - 4076) + '\143' + '\x6f' + '\144' + chr(0b1100101))(chr(11241 - 11124) + chr(0b1110100) + chr(680 - 578) + chr(45) + chr(0b10100 + 0o44)), ZSxXCHnDE64q=None, FjcovgoHM1LG=0.25, fewd3RWy_xMU=ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(3439 - 3328) + chr(2008 - 1959), 8), XCAIkNRdiX0I=None, ALokVh6YPLgI=None, vx6LjadlTfNA=None, Xtig2zAKpR0T=1e-05, eeyC5_0F9WOf=0.999, dnb6Ebgk6qnD=ehT0Px3KOsy9(chr(1237 - 1189) + chr(12059 - 11948) + chr(0b10011 + 0o36), 8), sjb7MZHDGfYq=ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + '\x30', 0o10), Wuetkhsbidt0=ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8), pHiVlA3UX8ZY=ehT0Px3KOsy9('\x30' + chr(111) + '\060', 8), SpOun2NrX5aX=ehT0Px3KOsy9(chr(0b110000) + chr(6196 - 6085) + chr(52) + '\x34' + chr(0b110100) + chr(55) + '\066' + '\x30', 13486 - 13478), hDN9FYo5x_x3=ehT0Px3KOsy9(chr(2289 - 2241) + chr(111) + chr(48), 8), GX8NHphWqxXa=ehT0Px3KOsy9(chr(1179 - 1131) + chr(7376 - 7265) + chr(1433 - 1385), 8), dHf4p5Wcuj7D=ehT0Px3KOsy9(chr(2296 - 2248) + chr(928 - 817) + '\x30', 8), obB50GGkp9jd=ehT0Px3KOsy9(chr(0b110000) + chr(9305 - 9194) + chr(0b101100 + 0o4), 8), FtHa2Z0CovdL=0.5, hLYdKHTg6T7n=1.0, bC3NvZ9zq7eV=ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b10010 + 0o42) + '\061' + chr(53) + '\062' + '\060', ord("\x08")), oLgyQ45ORWXM=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8), AIvJRzLdDfgF=None, cqK7WzUanJkr=ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101011 + 0o6), 8)):
if rZIVWZZhpCQD in [xafqLlk3kkUe(SXOLrMavuUCe(b'aM\xd7'), chr(528 - 428) + chr(0b111010 + 0o53) + '\x63' + chr(111) + chr(1734 - 1634) + chr(110 - 9))(chr(0b1001100 + 0o51) + chr(116) + '\x66' + chr(45) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'bN\xcb,.j?\x1c\xc1\xdd\x83\x10i\x95\xb2R=#'), chr(0b1010100 + 0o20) + chr(0b1100101) + chr(7808 - 7709) + chr(111) + '\x64' + chr(0b111110 + 0o47))(chr(0b1100111 + 0o16) + chr(116) + chr(0b111100 + 0o52) + chr(0b11111 + 0o16) + '\070')]:
assert XCAIkNRdiX0I is not None
if qzoyXN3kdhDL % azOnMTJc4Vem != ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11100 + 0o24), 8):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'kN\xcb\x11)j}\x0c\xc5\xc8\xd7\x19g\x88\xec\x16%=V\x93h\x7f3|\x86S\x07\xb4\xbb\xf6`\xf6\x13\xbd\xae\x8bUT'), chr(100) + chr(101) + chr(0b1100011) + chr(0b1011000 + 0o27) + chr(0b111110 + 0o46) + '\x65')(chr(0b1110101) + chr(343 - 227) + chr(0b1100110) + chr(0b101 + 0o50) + chr(56)))
if NSd4iRY6tdp8 % R38qqj9vgOQS != ehT0Px3KOsy9('\060' + chr(11761 - 11650) + chr(1515 - 1467), 8):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'kN\xcb\x119ca\x06\xca\xce\x96\x11{\xcd\xfbY.!\x02\xddcbeq\x8b@N\xb8\xb7\xb2a\xfe\x1f\xf8\xb9\x86F_a\x87qZ\xc4".&a\x06\xd4\xde'), chr(0b1100100) + chr(0b1011101 + 0o10) + chr(0b100110 + 0o75) + chr(0b100010 + 0o115) + '\144' + '\x65')('\165' + chr(0b1001101 + 0o47) + chr(2781 - 2679) + '\x2d' + '\070'))
VQy5Rt1FMyKA = ehT0Px3KOsy9(NSd4iRY6tdp8 / R38qqj9vgOQS)
if VQy5Rt1FMyKA % azOnMTJc4Vem != ehT0Px3KOsy9('\x30' + '\157' + '\x30', 8):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'kN\xcb\x11)j}\x0c\xc5\xc8\xd7\x19g\x88\xec\x16%=V\x93h\x7f3|\x86S\x07\xb9\xbf\xf0a\xf7\x19\xf4\xb3\x85\x0fEg\xc5i^\x86="|w'), '\x64' + chr(0b1100101) + '\143' + chr(111) + '\144' + '\x65')(chr(117) + chr(116) + chr(271 - 169) + chr(0b10101 + 0o30) + chr(0b1110 + 0o52)))
oNd8C7o94vJ7 = ehT0Px3KOsy9('\060' + '\157' + '\x32', 8) ** ehT0Px3KOsy9(VQy5Rt1FMyKA / azOnMTJc4Vem)
if fewd3RWy_xMU:
if ALokVh6YPLgI is None:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'`V\xc7\x11(ig\x01\xda\x9b\x9e\x0e(\xa3\xf0X.r@\xc6x6 x\x83\x16N\xaf\xf2\xc6v\xe6\x18'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\x6f' + chr(7410 - 7310) + chr(0b1100101))(chr(11377 - 11260) + chr(0b1001100 + 0o50) + chr(3498 - 3396) + '\x2d' + chr(1849 - 1793)))
if vx6LjadlTfNA is None:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'`V\xc7\x11&cs\x01\xdd\x9b\x9e\x0e(\xa3\xf0X.r@\xc6x6 x\x83\x16N\xaf\xf2\xc6v\xe6\x18'), chr(6520 - 6420) + chr(0b111101 + 0o50) + chr(826 - 727) + '\x6f' + chr(0b1100100) + chr(5211 - 5110))(chr(117) + '\x74' + chr(0b1100110) + chr(45) + '\x38'))
else:
oNd8C7o94vJ7 = None
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"sZ\xd4'*d~\n\xf1\xc8\x94\x12x\x88"), chr(100) + '\145' + chr(0b110001 + 0o62) + chr(0b1101111) + chr(100) + chr(101))(chr(117) + chr(116) + chr(102) + '\055' + chr(0b111 + 0o61)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'aR\xd5-9cf\n\xf1\xd9\x98\t|\x81\xfaX.1I'), chr(0b1100100) + chr(0b1011100 + 0o11) + chr(1329 - 1230) + '\157' + chr(100) + chr(101))(chr(0b1101001 + 0o14) + chr(0b1110100) + '\x66' + '\055' + chr(56)), reuse=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'Dn\xf2\x01\x14TW:\xfd\xfe'), chr(6446 - 6346) + '\145' + chr(0b1100011) + '\x6f' + '\x64' + chr(6366 - 6265))(chr(7745 - 7628) + chr(0b1101111 + 0o5) + '\146' + '\x2d' + chr(0b111000)))):
qk7ql9buv3eD = q_kvx1iNIzrz(DSKhI6I667G0, hidden_size=qzoyXN3kdhDL, z_size=NSd4iRY6tdp8, filter_size=deybX8NJ0oEI, bottleneck_kind=rZIVWZZhpCQD, soft_em=sjb7MZHDGfYq, num_blocks=azOnMTJc4Vem, num_residuals=R38qqj9vgOQS, block_v_size=oNd8C7o94vJ7, means=XCAIkNRdiX0I, name=AIvJRzLdDfgF)
if rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'a^\xc8=.'), '\144' + chr(0b1001110 + 0o27) + chr(0b111110 + 0o45) + '\157' + '\144' + chr(101))('\165' + chr(116) + '\146' + chr(0b1 + 0o54) + chr(56)):
eqLd2g7gm0lR = IDJ2eXGCBCDu.layers.dense(vXoupepMtCXU, NSd4iRY6tdp8, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sX\xc5'), chr(100) + chr(101) + chr(99) + chr(0b1100 + 0o143) + '\x64' + chr(101))(chr(7550 - 7433) + chr(0b1010000 + 0o44) + chr(102) + chr(0b101101) + chr(0b1110 + 0o52)))
xKWK39b5uv2n = IDJ2eXGCBCDu.layers.dense(eqLd2g7gm0lR, deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sX\xce\x7f'), chr(464 - 364) + chr(0b1100101) + chr(3454 - 3355) + chr(0b1101111) + chr(100) + '\145')(chr(0b100001 + 0o124) + '\164' + chr(102) + chr(0b1000 + 0o45) + '\070'))
OyYXdGmcLv7F = IDJ2eXGCBCDu.constant(0.0)
BUVIuWfbUd44 = IDJ2eXGCBCDu.constant(0.0)
elif rZIVWZZhpCQD in [xafqLlk3kkUe(SXOLrMavuUCe(b'aM\xd7'), chr(0b1100100) + '\145' + chr(6486 - 6387) + chr(0b1101111) + '\x64' + '\145')(chr(0b110111 + 0o76) + chr(1399 - 1283) + '\146' + chr(45) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'bN\xcb,.j?\x1c\xc1\xdd\x83\x10i\x95\xb2R=#'), chr(0b1 + 0o143) + chr(101) + chr(99) + chr(0b101101 + 0o102) + '\x64' + chr(1704 - 1603))(chr(0b1110101) + '\x74' + '\146' + chr(0b101101) + '\x38')]:
I1RC_0dpvDbJ = vXoupepMtCXU
if c2A0yzQpDQB3(xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'kZ\xd3\x17-Ju\x03\xfa\xcb\x94\x1f'), chr(100) + chr(2196 - 2095) + chr(99) + chr(0b1000100 + 0o53) + chr(8529 - 8429) + '\145')(chr(7624 - 7507) + chr(116) + '\146' + chr(45) + chr(1703 - 1647)))) == ehT0Px3KOsy9(chr(1475 - 1427) + '\x6f' + '\064', 8):
I1RC_0dpvDbJ = IDJ2eXGCBCDu.squeeze(vXoupepMtCXU, axis=ehT0Px3KOsy9('\060' + chr(0b1100000 + 0o17) + chr(0b110010), 8))
if c4UcgDokHFHK == xafqLlk3kkUe(SXOLrMavuUCe(b'vW\xcf-.'), '\x64' + chr(101) + '\x63' + chr(111) + chr(6040 - 5940) + chr(2486 - 2385))(chr(117) + chr(0b1110100) + chr(102) + '\055' + chr(3073 - 3017)):
zsnSwTonLzpD = GNfWXfXMlQz5(I1RC_0dpvDbJ, hidden_size=qzoyXN3kdhDL, num_blocks=azOnMTJc4Vem)
elif c4UcgDokHFHK == xafqLlk3kkUe(SXOLrMavuUCe(b'uI\xc9$.ef'), chr(3404 - 3304) + chr(101) + chr(99) + chr(8165 - 8054) + chr(3864 - 3764) + chr(101))(chr(117) + '\x74' + chr(102) + chr(0b111 + 0o46) + chr(56)):
if ZSxXCHnDE64q is None:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'UI\xc9$.ef\x06\xc1\xd5\xd7\tm\x83\xecY9!\x02\xda\x7f6\x0bz\x8cS\x07\xba\xbd\xe0$\xe1\x18\xee\xb5\x83_TY\xca`O\xce!/&b\x1d\xc1\xd1\x92\x1e|'), '\x64' + '\145' + chr(8660 - 8561) + '\x6f' + '\144' + '\x65')('\x75' + '\164' + chr(0b1100110) + chr(1119 - 1074) + '\070'))
zsnSwTonLzpD = LGyHV2Zcrcvi(I1RC_0dpvDbJ, projection_tensors=ZSxXCHnDE64q, hidden_size=qzoyXN3kdhDL, num_blocks=azOnMTJc4Vem)
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'PU\xcd $q|O\xdc\xde\x84\x15i\x9d\xfai&7V\xdbcr'), chr(0b1100100) + chr(9853 - 9752) + '\x63' + '\x6f' + '\x64' + '\x65')(chr(1380 - 1263) + chr(116) + chr(102) + chr(45) + chr(0b1100 + 0o54)))
kPE4Rnh56Ft5 = IDJ2eXGCBCDu.reshape(zsnSwTonLzpD, [-ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + chr(0b110001), 8)] + jSKPaHwSAfVv.shape_list(zsnSwTonLzpD)[ehT0Px3KOsy9('\060' + '\157' + chr(50), 8):])
fu_DLUnq0Rui = []
xPgmXL9DQrWF = ehT0Px3KOsy9('\x30' + '\157' + chr(2256 - 2208), 8)
OyYXdGmcLv7F = ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 8)
for WVxHKyX45z_L in vQr8gNKaIaWE(R38qqj9vgOQS):
(pJha1B2oklts, mDQ1GoWzkmyz, lqQ4yhonit7Q, A5EXke6iNeWb, BUVIuWfbUd44) = _rf4aB2Cw0sq(zsnSwTonLzpD, means=XCAIkNRdiX0I[WVxHKyX45z_L], num_blocks=azOnMTJc4Vem, block_v_size=oNd8C7o94vJ7, bottleneck_kind=rZIVWZZhpCQD, random_top_k=dnb6Ebgk6qnD, soft_em=sjb7MZHDGfYq, num_samples=Wuetkhsbidt0, temperature_warmup_steps=SpOun2NrX5aX, do_hard_gumbel_softmax=hDN9FYo5x_x3, num_flows=GX8NHphWqxXa, approximate_gs_entropy=dHf4p5Wcuj7D, sum_over_latents=obB50GGkp9jd)
if fewd3RWy_xMU:
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'V\x0c\xee6>euX\xc4\xd7\xad\x16'), '\x64' + '\x65' + '\x63' + chr(111) + chr(100) + '\145')('\165' + chr(0b1110100) + '\146' + chr(0b101101) + '\x38'))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'PH\xcf ,&W"\xef\x9b\x80\x14|\x85\xbfT.&C\x9316>h'), '\144' + chr(0b110010 + 0o63) + chr(99) + '\x6f' + '\x64' + chr(0b1100101))(chr(0b110110 + 0o77) + chr(0b1110100) + '\x66' + chr(94 - 49) + chr(1670 - 1614)), xafqLlk3kkUe(SXOLrMavuUCe(b'S\x0f\xd4!\x03gA\\\xfe\xcb\x92\x17'), chr(0b1100100) + chr(1571 - 1470) + chr(3679 - 3580) + chr(5583 - 5472) + chr(0b101111 + 0o65) + chr(101))('\165' + chr(0b1110100) + chr(102) + chr(0b101101) + chr(0b101010 + 0o16)))(FjcovgoHM1LG))
abo1yrs3mZ8O = nDgFXrDqtELR.assign_moving_average(ALokVh6YPLgI[WVxHKyX45z_L], IDJ2eXGCBCDu.dRFAC59yQBm_(cqK7WzUanJkr, IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.reshape(pJha1B2oklts, shape=[-ehT0Px3KOsy9('\060' + chr(111) + '\061', 8), azOnMTJc4Vem, oNd8C7o94vJ7]), axis=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110000), 8)), ALokVh6YPLgI[WVxHKyX45z_L]), eeyC5_0F9WOf, zero_debias=ehT0Px3KOsy9('\060' + '\157' + chr(905 - 857), 8))
UVJMTi_S70Uf = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(pJha1B2oklts, perm=[ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31', 8), ehT0Px3KOsy9(chr(1083 - 1035) + '\x6f' + chr(0b1 + 0o61), 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\x30', 8)]), IDJ2eXGCBCDu.transpose(kPE4Rnh56Ft5, perm=[ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11101 + 0o24), 8), ehT0Px3KOsy9(chr(1033 - 985) + chr(0b1101111) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1332 - 1282), 8)]))
ZD0WAKUABUM2 = nDgFXrDqtELR.assign_moving_average(vx6LjadlTfNA[WVxHKyX45z_L], IDJ2eXGCBCDu.dRFAC59yQBm_(cqK7WzUanJkr, UVJMTi_S70Uf, vx6LjadlTfNA[WVxHKyX45z_L]), eeyC5_0F9WOf, zero_debias=ehT0Px3KOsy9('\x30' + chr(7565 - 7454) + chr(0b11001 + 0o27), 8))
m1NkCryOw9Bx = IDJ2eXGCBCDu.reduce_sum(abo1yrs3mZ8O, axis=-ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + '\x31', 8), keep_dims=ehT0Px3KOsy9('\x30' + '\x6f' + chr(49), 8))
abo1yrs3mZ8O = (abo1yrs3mZ8O + Xtig2zAKpR0T) / (m1NkCryOw9Bx + ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b10100 + 0o133) + '\x32', 8) ** NSd4iRY6tdp8 * Xtig2zAKpR0T) * m1NkCryOw9Bx
ZD0WAKUABUM2 = ZD0WAKUABUM2 / IDJ2eXGCBCDu.expand_dims(abo1yrs3mZ8O, axis=-ehT0Px3KOsy9(chr(48) + chr(2357 - 2246) + chr(0b110001), 8))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'fT\xc8:9i~0\xca\xde\x87\x18f\x89\xfaX(;G\xc0'), '\144' + '\x65' + chr(0b1100011) + chr(111) + '\144' + chr(101))(chr(10122 - 10005) + chr(1457 - 1341) + chr(0b1100110) + '\x2d' + chr(0b1110 + 0o52)))([A5EXke6iNeWb]):
NufY31ARfhZP = IDJ2eXGCBCDu.assign(XCAIkNRdiX0I[WVxHKyX45z_L], IDJ2eXGCBCDu.dRFAC59yQBm_(cqK7WzUanJkr, ZD0WAKUABUM2, XCAIkNRdiX0I[WVxHKyX45z_L]))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'fT\xc8:9i~0\xca\xde\x87\x18f\x89\xfaX(;G\xc0'), chr(100) + chr(0b1100101) + chr(99) + chr(111) + '\144' + chr(0b1100101))(chr(0b1010011 + 0o42) + '\x74' + chr(0b1100110) + '\x2d' + chr(0b111000)))([NufY31ARfhZP]):
OyYXdGmcLv7F += FjcovgoHM1LG * A5EXke6iNeWb
else:
OyYXdGmcLv7F += lqQ4yhonit7Q + FjcovgoHM1LG * A5EXke6iNeWb
kPE4Rnh56Ft5 -= mDQ1GoWzkmyz
xPgmXL9DQrWF += mDQ1GoWzkmyz
xafqLlk3kkUe(fu_DLUnq0Rui, xafqLlk3kkUe(SXOLrMavuUCe(b'dK\xd6+%b'), chr(100) + chr(0b111010 + 0o53) + '\143' + chr(0b1011111 + 0o20) + chr(0b1100100) + chr(0b10001 + 0o124))(chr(0b1110101) + chr(116) + chr(0b111010 + 0o54) + chr(0b11001 + 0o24) + '\070'))(pJha1B2oklts)
fu_DLUnq0Rui = IDJ2eXGCBCDu.stack(fu_DLUnq0Rui, axis=ehT0Px3KOsy9('\x30' + chr(8549 - 8438) + '\x31', 8))
T8BdHeA1BjOx = IDJ2eXGCBCDu.argmax(fu_DLUnq0Rui, axis=-ehT0Px3KOsy9('\060' + chr(4051 - 3940) + chr(1100 - 1051), 8))
lb_w7F3T47NC = yJGZvHIPIBwO(T8BdHeA1BjOx, num_bits=ehT0Px3KOsy9(NSd4iRY6tdp8 / (R38qqj9vgOQS * azOnMTJc4Vem)), base=ehT0Px3KOsy9('\060' + chr(111) + '\x32', 8))
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(lb_w7F3T47NC)
P7dVzv6_yXeE = nauYfLglTpcb[:-ehT0Px3KOsy9('\060' + chr(770 - 659) + '\062', 8)]
P7dVzv6_yXeE[-ehT0Px3KOsy9('\060' + chr(111) + '\061', 8)] = NSd4iRY6tdp8
lb_w7F3T47NC = IDJ2eXGCBCDu.reshape(lb_w7F3T47NC, shape=P7dVzv6_yXeE)
eqLd2g7gm0lR = gBBBAhX0TTvq(IDJ2eXGCBCDu.to_int32(lb_w7F3T47NC), num_bits=NSd4iRY6tdp8, base=ehT0Px3KOsy9(chr(510 - 462) + chr(0b1101111) + chr(0b1 + 0o61), 8))
VgP_McURhCb5 = jSKPaHwSAfVv.shape_list(vXoupepMtCXU)
eqLd2g7gm0lR = IDJ2eXGCBCDu.reshape(eqLd2g7gm0lR, VgP_McURhCb5[:-ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8)])
if sjb7MZHDGfYq:
eqLd2g7gm0lR = fu_DLUnq0Rui
eqLd2g7gm0lR = IDJ2eXGCBCDu.reshape(eqLd2g7gm0lR, VgP_McURhCb5[:-ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001), 8)] + [oNd8C7o94vJ7])
xPgmXL9DQrWF = IDJ2eXGCBCDu.reshape(xPgmXL9DQrWF, VgP_McURhCb5)
xKWK39b5uv2n = vXoupepMtCXU + IDJ2eXGCBCDu.stop_gradient(xPgmXL9DQrWF - vXoupepMtCXU)
elif rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'bN\xcb,.j?\x1c\xc1\xdd\x83\x10i\x95'), '\x64' + '\145' + '\x63' + chr(3831 - 3720) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(0b1100000 + 0o24) + '\x66' + '\x2d' + chr(0b111000)):
(VNGQdHSFPrso, mPCAhP4HeiUW, OyYXdGmcLv7F) = mAQyRTblh_y7(vXoupepMtCXU, z_size=NSd4iRY6tdp8, mode=holLFgwB7vsP, softmax_k=pHiVlA3UX8ZY, temperature_warmup_steps=SpOun2NrX5aX, summary=oLgyQ45ORWXM, name=AIvJRzLdDfgF)
eqLd2g7gm0lR = IDJ2eXGCBCDu.argmax(mPCAhP4HeiUW, axis=-ehT0Px3KOsy9(chr(48) + '\157' + chr(1537 - 1488), 8))
xKWK39b5uv2n = IDJ2eXGCBCDu.layers.dense(mPCAhP4HeiUW, qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'aZ\xc3\x11/c|\x1c\xcb'), '\144' + chr(0b1100101) + '\x63' + chr(2598 - 2487) + chr(0b1100100) + chr(101))(chr(0b1110101) + '\x74' + '\x66' + chr(45) + chr(0b10011 + 0o45)))
BUVIuWfbUd44 = IDJ2eXGCBCDu.constant(0.0)
elif rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'v^\xcb&*uz'), chr(100) + chr(0b1100101) + chr(1413 - 1314) + '\x6f' + '\144' + '\x65')(chr(0b1010111 + 0o36) + chr(116) + '\146' + '\055' + chr(635 - 579)):
eqLd2g7gm0lR = IDJ2eXGCBCDu.layers.dense(vXoupepMtCXU, NSd4iRY6tdp8, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sX\xc5'), chr(2032 - 1932) + '\x65' + '\143' + chr(111) + chr(5275 - 5175) + chr(0b1100101))(chr(0b110111 + 0o76) + chr(0b11010 + 0o132) + '\146' + chr(336 - 291) + '\070'))
NHSx3iuZVgYb = jSKPaHwSAfVv.saturating_sigmoid(eqLd2g7gm0lR)
if oLgyQ45ORWXM:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x7f\x92\x14<?p\x1b\xfb\xef\x82,'), '\144' + '\145' + '\x63' + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(117) + chr(0b1110011 + 0o1) + chr(1252 - 1150) + chr(0b10011 + 0o32) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'|d\xc5".g|'), '\x64' + chr(5268 - 5167) + '\143' + chr(0b111111 + 0o60) + chr(6169 - 6069) + '\145')(chr(0b100101 + 0o120) + chr(0b100111 + 0o115) + '\x66' + chr(0b101101) + chr(0b110100 + 0o4)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'w^\xd5&*vw'), chr(100) + chr(5592 - 5491) + chr(99) + chr(0b110111 + 0o70) + chr(0b110110 + 0o56) + chr(101))('\x75' + chr(4552 - 4436) + '\146' + '\055' + '\070'))(NHSx3iuZVgYb, [-ehT0Px3KOsy9('\x30' + chr(111) + '\x31', 8)]))
if hLYdKHTg6T7n > ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + chr(1517 - 1469), 8) and holLFgwB7vsP == xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'Qi\xe7\x07\x05'), '\x64' + chr(0b1100101) + chr(99) + '\157' + chr(0b1100100) + chr(0b100100 + 0o101))(chr(0b1110101) + '\x74' + '\146' + chr(0b101100 + 0o1) + '\x38')):
MudPQU2D1pmv = IDJ2eXGCBCDu.truncated_normal(jSKPaHwSAfVv.shape_list(eqLd2g7gm0lR), mean=0.0, stddev=hLYdKHTg6T7n)
SqiSOtYOqOJH = jSKPaHwSAfVv.saturating_sigmoid(eqLd2g7gm0lR + MudPQU2D1pmv)
else:
SqiSOtYOqOJH = NHSx3iuZVgYb
pd3lxn9vqWxp = IDJ2eXGCBCDu.to_float(IDJ2eXGCBCDu.less(0.5, SqiSOtYOqOJH))
u6UdRrSywht4 = IDJ2eXGCBCDu.stop_gradient(pd3lxn9vqWxp) + SqiSOtYOqOJH - IDJ2eXGCBCDu.stop_gradient(SqiSOtYOqOJH)
dubtF9GfzOdC = jSKPaHwSAfVv.inverse_exp_decay(bC3NvZ9zq7eV * ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100001 + 0o21), 8))
dubtF9GfzOdC *= FtHa2Z0CovdL
dubtF9GfzOdC = dubtF9GfzOdC if holLFgwB7vsP == IDJ2eXGCBCDu.estimator.ModeKeys.TRAIN else 1.0
qzn1Ctg9WgNh = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.less(IDJ2eXGCBCDu.random_uniform([jSKPaHwSAfVv.shape_list(SqiSOtYOqOJH)[ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + '\x30', 8)]]), dubtF9GfzOdC), u6UdRrSywht4, SqiSOtYOqOJH)
l6zoRqL8vdkY = IDJ2eXGCBCDu.layers.dense(qzn1Ctg9WgNh, deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sX\xce\x7f*'), '\144' + chr(0b1100101) + chr(4172 - 4073) + chr(0b1101100 + 0o3) + chr(824 - 724) + chr(5610 - 5509))(chr(117) + chr(0b110000 + 0o104) + '\146' + chr(0b101101) + chr(0b111000)))
PDUmjmZ0jwzY = IDJ2eXGCBCDu.layers.dense(1.0 - qzn1Ctg9WgNh, deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sX\xce\x7f)'), '\x64' + chr(0b100010 + 0o103) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))('\x75' + '\x74' + '\146' + chr(0b101101) + '\070'))
xKWK39b5uv2n = l6zoRqL8vdkY + PDUmjmZ0jwzY
yGt1PN0KO3VY = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.stop_gradient(pd3lxn9vqWxp))
eqLd2g7gm0lR = gBBBAhX0TTvq(yGt1PN0KO3VY, NSd4iRY6tdp8)
OyYXdGmcLv7F = IDJ2eXGCBCDu.constant(0.0)
BUVIuWfbUd44 = IDJ2eXGCBCDu.constant(0.0)
elif rZIVWZZhpCQD == xafqLlk3kkUe(SXOLrMavuUCe(b'sZ\xc3'), '\x64' + chr(0b1100101) + chr(0b100 + 0o137) + chr(6890 - 6779) + '\144' + chr(0b1100101))(chr(0b111110 + 0o67) + chr(0b1110100) + '\x66' + '\055' + '\x38'):
(eqLd2g7gm0lR, OyYXdGmcLv7F, VNGQdHSFPrso, VNGQdHSFPrso) = sDRTDO0rxXPy(vXoupepMtCXU, NSd4iRY6tdp8, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sZ\xc3'), '\144' + chr(7852 - 7751) + '\x63' + chr(0b100100 + 0o113) + '\x64' + chr(0b1100101))(chr(12732 - 12615) + '\x74' + '\146' + chr(45) + chr(0b111000)))
xKWK39b5uv2n = IDJ2eXGCBCDu.layers.dense(eqLd2g7gm0lR, deybX8NJ0oEI, name=xafqLlk3kkUe(SXOLrMavuUCe(b'sX\xce\x7f'), '\144' + chr(0b1100101) + '\143' + '\157' + '\x64' + chr(101))('\x75' + '\x74' + '\x66' + chr(0b11100 + 0o21) + chr(0b111000)))
BUVIuWfbUd44 = IDJ2eXGCBCDu.constant(0.0)
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'PU\xcd $q|O\xca\xd2\x84\x1ez\x88\xeb_13V\xdacxex\x87BO\xb3\xb6\xbc'), '\x64' + chr(7103 - 7002) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(101))(chr(117) + '\164' + chr(4920 - 4818) + chr(0b101101) + '\x38'))
return (xKWK39b5uv2n, eqLd2g7gm0lR, OyYXdGmcLv7F, qk7ql9buv3eD, BUVIuWfbUd44)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
predict_bits_with_lstm
|
def predict_bits_with_lstm(prediction_source, state_size, total_num_bits,
target_bits=None, extra_inputs=None,
bits_at_once=8, temperature=1.0, dropout=0.1):
"""Predict a sequence of bits (a latent) with LSTM, both training and infer.
Given a tensor on which the predictions are based (prediction_source), we use
a single-layer LSTM with state of size state_size to predict total_num_bits,
which we predict in groups of size bits_at_once. During training, we use
target_bits as input to the LSTM (teacher forcing) and return the target_bits
together with the prediction loss. During inference, we sample with the given
temperature and return the predicted sequence and loss 0.
Args:
prediction_source: a Tensor of shape [batch_size, ...] used to create
the initial state and the first input to the LSTM.
state_size: python integer, the size of the LSTM state.
total_num_bits: python integer, how many bits in total to predict.
target_bits: a tensor of shape [batch_size, total_num_bits] used during
training as the target to predict; each element should be -1 or 1.
extra_inputs: a Tensor [batch_size, total_num_bits // bits_at_once, d]
of additional inputs, passed as additional LSTM inputs.
bits_at_once: pytho integer, how many bits to predict at once.
temperature: python float, temperature used for sampling during inference.
dropout: float, the amount of dropout to aply during training (0.1 default).
Returns:
a pair (bits, loss) with the predicted bit sequence, which is a Tensor of
shape [batch_size, total_num_bits] with elements either -1 or 1, and a loss
used to train the predictions against the provided target_bits.
"""
with tf.variable_scope("predict_bits_with_lstm"):
# Layers and cell state creation.
lstm_cell = tf.nn.rnn_cell.LSTMCell(state_size)
discrete_predict = tf.layers.Dense(2**bits_at_once, name="discrete_predict")
discrete_embed = tf.layers.Dense(state_size, name="discrete_embed")
batch_size = common_layers.shape_list(prediction_source)[0]
layer_pred = tf.layers.flatten(prediction_source)
first_lstm_input = tf.layers.dense(layer_pred, state_size, name="istate")
c_state = tf.layers.dense(layer_pred, state_size, name="cstate")
m_state = tf.layers.dense(layer_pred, state_size, name="mstate")
state = (c_state, m_state)
# Prediction mode if no targets are given.
if target_bits is None:
outputs = []
lstm_input = first_lstm_input
for i in range(total_num_bits // bits_at_once):
if extra_inputs is not None:
lstm_input = tf.concat([lstm_input, extra_inputs[:, i, :]], axis=1)
output, state = lstm_cell(lstm_input, state)
discrete_logits = discrete_predict(output)
discrete_samples = common_layers.sample_with_temperature(
discrete_logits, temperature)
outputs.append(tf.expand_dims(discrete_samples, axis=1))
lstm_input = discrete_embed(tf.one_hot(discrete_samples, 256))
outputs = tf.concat(outputs, axis=1)
outputs = int_to_bit(outputs, bits_at_once)
outputs = tf.reshape(outputs, [batch_size, total_num_bits])
return 2 * outputs - 1, 0.0
# Training mode, calculating loss.
assert total_num_bits % bits_at_once == 0
target_bits = tf.reshape(tf.maximum(tf.stop_gradient(target_bits), 0), [
batch_size, total_num_bits // bits_at_once, bits_at_once])
target_ints = bit_to_int(target_bits, bits_at_once)
tf.summary.histogram("target_integers", tf.reshape(target_ints, [-1]))
target_hot = tf.one_hot(target_ints, 2**bits_at_once, axis=-1)
target_embedded = discrete_embed(target_hot)
target_embedded = tf.nn.dropout(target_embedded, 1.0 - dropout)
teacher_input = tf.concat(
[tf.expand_dims(first_lstm_input, axis=1), target_embedded], axis=1)
outputs = []
for i in range(total_num_bits // bits_at_once):
lstm_input = teacher_input[:, i, :]
if extra_inputs is not None:
lstm_input = tf.concat([lstm_input, extra_inputs[:, i, :]], axis=1)
output, state = lstm_cell(lstm_input, state)
outputs.append(tf.expand_dims(output, axis=1))
outputs = tf.concat(outputs, axis=1)
outputs = tf.nn.dropout(outputs, 1.0 - dropout)
d_int_pred = discrete_predict(outputs)
pred_loss = tf.losses.sparse_softmax_cross_entropy(
logits=d_int_pred, labels=target_ints)
pred_loss = tf.reduce_mean(pred_loss)
return d_int_pred, pred_loss
|
python
|
def predict_bits_with_lstm(prediction_source, state_size, total_num_bits,
target_bits=None, extra_inputs=None,
bits_at_once=8, temperature=1.0, dropout=0.1):
"""Predict a sequence of bits (a latent) with LSTM, both training and infer.
Given a tensor on which the predictions are based (prediction_source), we use
a single-layer LSTM with state of size state_size to predict total_num_bits,
which we predict in groups of size bits_at_once. During training, we use
target_bits as input to the LSTM (teacher forcing) and return the target_bits
together with the prediction loss. During inference, we sample with the given
temperature and return the predicted sequence and loss 0.
Args:
prediction_source: a Tensor of shape [batch_size, ...] used to create
the initial state and the first input to the LSTM.
state_size: python integer, the size of the LSTM state.
total_num_bits: python integer, how many bits in total to predict.
target_bits: a tensor of shape [batch_size, total_num_bits] used during
training as the target to predict; each element should be -1 or 1.
extra_inputs: a Tensor [batch_size, total_num_bits // bits_at_once, d]
of additional inputs, passed as additional LSTM inputs.
bits_at_once: pytho integer, how many bits to predict at once.
temperature: python float, temperature used for sampling during inference.
dropout: float, the amount of dropout to aply during training (0.1 default).
Returns:
a pair (bits, loss) with the predicted bit sequence, which is a Tensor of
shape [batch_size, total_num_bits] with elements either -1 or 1, and a loss
used to train the predictions against the provided target_bits.
"""
with tf.variable_scope("predict_bits_with_lstm"):
# Layers and cell state creation.
lstm_cell = tf.nn.rnn_cell.LSTMCell(state_size)
discrete_predict = tf.layers.Dense(2**bits_at_once, name="discrete_predict")
discrete_embed = tf.layers.Dense(state_size, name="discrete_embed")
batch_size = common_layers.shape_list(prediction_source)[0]
layer_pred = tf.layers.flatten(prediction_source)
first_lstm_input = tf.layers.dense(layer_pred, state_size, name="istate")
c_state = tf.layers.dense(layer_pred, state_size, name="cstate")
m_state = tf.layers.dense(layer_pred, state_size, name="mstate")
state = (c_state, m_state)
# Prediction mode if no targets are given.
if target_bits is None:
outputs = []
lstm_input = first_lstm_input
for i in range(total_num_bits // bits_at_once):
if extra_inputs is not None:
lstm_input = tf.concat([lstm_input, extra_inputs[:, i, :]], axis=1)
output, state = lstm_cell(lstm_input, state)
discrete_logits = discrete_predict(output)
discrete_samples = common_layers.sample_with_temperature(
discrete_logits, temperature)
outputs.append(tf.expand_dims(discrete_samples, axis=1))
lstm_input = discrete_embed(tf.one_hot(discrete_samples, 256))
outputs = tf.concat(outputs, axis=1)
outputs = int_to_bit(outputs, bits_at_once)
outputs = tf.reshape(outputs, [batch_size, total_num_bits])
return 2 * outputs - 1, 0.0
# Training mode, calculating loss.
assert total_num_bits % bits_at_once == 0
target_bits = tf.reshape(tf.maximum(tf.stop_gradient(target_bits), 0), [
batch_size, total_num_bits // bits_at_once, bits_at_once])
target_ints = bit_to_int(target_bits, bits_at_once)
tf.summary.histogram("target_integers", tf.reshape(target_ints, [-1]))
target_hot = tf.one_hot(target_ints, 2**bits_at_once, axis=-1)
target_embedded = discrete_embed(target_hot)
target_embedded = tf.nn.dropout(target_embedded, 1.0 - dropout)
teacher_input = tf.concat(
[tf.expand_dims(first_lstm_input, axis=1), target_embedded], axis=1)
outputs = []
for i in range(total_num_bits // bits_at_once):
lstm_input = teacher_input[:, i, :]
if extra_inputs is not None:
lstm_input = tf.concat([lstm_input, extra_inputs[:, i, :]], axis=1)
output, state = lstm_cell(lstm_input, state)
outputs.append(tf.expand_dims(output, axis=1))
outputs = tf.concat(outputs, axis=1)
outputs = tf.nn.dropout(outputs, 1.0 - dropout)
d_int_pred = discrete_predict(outputs)
pred_loss = tf.losses.sparse_softmax_cross_entropy(
logits=d_int_pred, labels=target_ints)
pred_loss = tf.reduce_mean(pred_loss)
return d_int_pred, pred_loss
|
[
"def",
"predict_bits_with_lstm",
"(",
"prediction_source",
",",
"state_size",
",",
"total_num_bits",
",",
"target_bits",
"=",
"None",
",",
"extra_inputs",
"=",
"None",
",",
"bits_at_once",
"=",
"8",
",",
"temperature",
"=",
"1.0",
",",
"dropout",
"=",
"0.1",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"predict_bits_with_lstm\"",
")",
":",
"# Layers and cell state creation.",
"lstm_cell",
"=",
"tf",
".",
"nn",
".",
"rnn_cell",
".",
"LSTMCell",
"(",
"state_size",
")",
"discrete_predict",
"=",
"tf",
".",
"layers",
".",
"Dense",
"(",
"2",
"**",
"bits_at_once",
",",
"name",
"=",
"\"discrete_predict\"",
")",
"discrete_embed",
"=",
"tf",
".",
"layers",
".",
"Dense",
"(",
"state_size",
",",
"name",
"=",
"\"discrete_embed\"",
")",
"batch_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"prediction_source",
")",
"[",
"0",
"]",
"layer_pred",
"=",
"tf",
".",
"layers",
".",
"flatten",
"(",
"prediction_source",
")",
"first_lstm_input",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"layer_pred",
",",
"state_size",
",",
"name",
"=",
"\"istate\"",
")",
"c_state",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"layer_pred",
",",
"state_size",
",",
"name",
"=",
"\"cstate\"",
")",
"m_state",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"layer_pred",
",",
"state_size",
",",
"name",
"=",
"\"mstate\"",
")",
"state",
"=",
"(",
"c_state",
",",
"m_state",
")",
"# Prediction mode if no targets are given.",
"if",
"target_bits",
"is",
"None",
":",
"outputs",
"=",
"[",
"]",
"lstm_input",
"=",
"first_lstm_input",
"for",
"i",
"in",
"range",
"(",
"total_num_bits",
"//",
"bits_at_once",
")",
":",
"if",
"extra_inputs",
"is",
"not",
"None",
":",
"lstm_input",
"=",
"tf",
".",
"concat",
"(",
"[",
"lstm_input",
",",
"extra_inputs",
"[",
":",
",",
"i",
",",
":",
"]",
"]",
",",
"axis",
"=",
"1",
")",
"output",
",",
"state",
"=",
"lstm_cell",
"(",
"lstm_input",
",",
"state",
")",
"discrete_logits",
"=",
"discrete_predict",
"(",
"output",
")",
"discrete_samples",
"=",
"common_layers",
".",
"sample_with_temperature",
"(",
"discrete_logits",
",",
"temperature",
")",
"outputs",
".",
"append",
"(",
"tf",
".",
"expand_dims",
"(",
"discrete_samples",
",",
"axis",
"=",
"1",
")",
")",
"lstm_input",
"=",
"discrete_embed",
"(",
"tf",
".",
"one_hot",
"(",
"discrete_samples",
",",
"256",
")",
")",
"outputs",
"=",
"tf",
".",
"concat",
"(",
"outputs",
",",
"axis",
"=",
"1",
")",
"outputs",
"=",
"int_to_bit",
"(",
"outputs",
",",
"bits_at_once",
")",
"outputs",
"=",
"tf",
".",
"reshape",
"(",
"outputs",
",",
"[",
"batch_size",
",",
"total_num_bits",
"]",
")",
"return",
"2",
"*",
"outputs",
"-",
"1",
",",
"0.0",
"# Training mode, calculating loss.",
"assert",
"total_num_bits",
"%",
"bits_at_once",
"==",
"0",
"target_bits",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"maximum",
"(",
"tf",
".",
"stop_gradient",
"(",
"target_bits",
")",
",",
"0",
")",
",",
"[",
"batch_size",
",",
"total_num_bits",
"//",
"bits_at_once",
",",
"bits_at_once",
"]",
")",
"target_ints",
"=",
"bit_to_int",
"(",
"target_bits",
",",
"bits_at_once",
")",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"target_integers\"",
",",
"tf",
".",
"reshape",
"(",
"target_ints",
",",
"[",
"-",
"1",
"]",
")",
")",
"target_hot",
"=",
"tf",
".",
"one_hot",
"(",
"target_ints",
",",
"2",
"**",
"bits_at_once",
",",
"axis",
"=",
"-",
"1",
")",
"target_embedded",
"=",
"discrete_embed",
"(",
"target_hot",
")",
"target_embedded",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"target_embedded",
",",
"1.0",
"-",
"dropout",
")",
"teacher_input",
"=",
"tf",
".",
"concat",
"(",
"[",
"tf",
".",
"expand_dims",
"(",
"first_lstm_input",
",",
"axis",
"=",
"1",
")",
",",
"target_embedded",
"]",
",",
"axis",
"=",
"1",
")",
"outputs",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"total_num_bits",
"//",
"bits_at_once",
")",
":",
"lstm_input",
"=",
"teacher_input",
"[",
":",
",",
"i",
",",
":",
"]",
"if",
"extra_inputs",
"is",
"not",
"None",
":",
"lstm_input",
"=",
"tf",
".",
"concat",
"(",
"[",
"lstm_input",
",",
"extra_inputs",
"[",
":",
",",
"i",
",",
":",
"]",
"]",
",",
"axis",
"=",
"1",
")",
"output",
",",
"state",
"=",
"lstm_cell",
"(",
"lstm_input",
",",
"state",
")",
"outputs",
".",
"append",
"(",
"tf",
".",
"expand_dims",
"(",
"output",
",",
"axis",
"=",
"1",
")",
")",
"outputs",
"=",
"tf",
".",
"concat",
"(",
"outputs",
",",
"axis",
"=",
"1",
")",
"outputs",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"outputs",
",",
"1.0",
"-",
"dropout",
")",
"d_int_pred",
"=",
"discrete_predict",
"(",
"outputs",
")",
"pred_loss",
"=",
"tf",
".",
"losses",
".",
"sparse_softmax_cross_entropy",
"(",
"logits",
"=",
"d_int_pred",
",",
"labels",
"=",
"target_ints",
")",
"pred_loss",
"=",
"tf",
".",
"reduce_mean",
"(",
"pred_loss",
")",
"return",
"d_int_pred",
",",
"pred_loss"
] |
Predict a sequence of bits (a latent) with LSTM, both training and infer.
Given a tensor on which the predictions are based (prediction_source), we use
a single-layer LSTM with state of size state_size to predict total_num_bits,
which we predict in groups of size bits_at_once. During training, we use
target_bits as input to the LSTM (teacher forcing) and return the target_bits
together with the prediction loss. During inference, we sample with the given
temperature and return the predicted sequence and loss 0.
Args:
prediction_source: a Tensor of shape [batch_size, ...] used to create
the initial state and the first input to the LSTM.
state_size: python integer, the size of the LSTM state.
total_num_bits: python integer, how many bits in total to predict.
target_bits: a tensor of shape [batch_size, total_num_bits] used during
training as the target to predict; each element should be -1 or 1.
extra_inputs: a Tensor [batch_size, total_num_bits // bits_at_once, d]
of additional inputs, passed as additional LSTM inputs.
bits_at_once: pytho integer, how many bits to predict at once.
temperature: python float, temperature used for sampling during inference.
dropout: float, the amount of dropout to aply during training (0.1 default).
Returns:
a pair (bits, loss) with the predicted bit sequence, which is a Tensor of
shape [batch_size, total_num_bits] with elements either -1 or 1, and a loss
used to train the predictions against the provided target_bits.
|
[
"Predict",
"a",
"sequence",
"of",
"bits",
"(",
"a",
"latent",
")",
"with",
"LSTM",
"both",
"training",
"and",
"infer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L791-L876
|
train
|
Predict a sequence of bits with LSTM.
|
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,koCeDP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jyZZT,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) + '\x33' + chr(51) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101101 + 0o102) + chr(49) + chr(0b0 + 0o63), 7970 - 7962), ehT0Px3KOsy9(chr(1862 - 1814) + chr(111) + chr(50), 61841 - 61833), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(49) + '\064' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10100 + 0o36) + chr(0b110110) + chr(1673 - 1625), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(52) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1055 - 944) + '\063' + chr(50) + '\x34', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100001 + 0o26) + chr(408 - 353), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(0b100000 + 0o26), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(246 - 196) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(0b110001) + '\x35' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111 + 0o0) + '\063' + '\064', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1692 - 1643) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + '\x34' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(540 - 490) + chr(53) + chr(1695 - 1642), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1440 - 1390) + chr(0b101000 + 0o10) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(2173 - 2125) + chr(0b100011 + 0o114) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(100 - 52) + '\157' + chr(1117 - 1068) + chr(292 - 241) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1994 - 1883) + chr(0b110001 + 0o5) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(0b10 + 0o60) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + '\x33' + chr(1290 - 1239) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(4044 - 3933) + '\x32' + '\067' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(50) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b110001) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(966 - 918) + chr(111) + '\061' + chr(452 - 397) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + '\x32' + '\062', 45147 - 45139), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2054 - 2004) + '\060' + chr(788 - 734), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + chr(49) + chr(769 - 721), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b110000), 42675 - 42667), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(302 - 254), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + '\063' + chr(49) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + chr(1504 - 1454) + chr(51) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\x32' + '\x30', 0b1000), ehT0Px3KOsy9(chr(706 - 658) + chr(0b1001001 + 0o46) + chr(49) + chr(0b10111 + 0o33) + chr(0b11011 + 0o32), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b11110 + 0o27) + chr(0b100001 + 0o24), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(3823 - 3712) + chr(51) + '\064' + '\x30', 0o10), ehT0Px3KOsy9(chr(845 - 797) + chr(3011 - 2900) + '\x33' + '\067' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b111 + 0o53) + chr(53), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + chr(0b1100 + 0o44), 63894 - 63886)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2'), chr(5379 - 5279) + '\x65' + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b110111 + 0o56))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(1398 - 1342)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hbrjMrxgrrPy(Y_ww15mzvXKf, ybe0t6mdMkGA, _P61TaxEl5zk, BuqTRVum9XK3=None, PQUL7p8nyYID=None, hirdDkUtlkrL=ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(776 - 728), 8), uICaXvjWrxGa=1.0, ag0mwEgWzjYv=0.1):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xaajp\n\xd1\xc2\xb8ZA\xe4\x0bs{F'), chr(0b1010010 + 0o22) + chr(101) + chr(0b100010 + 0o101) + chr(0b101000 + 0o107) + chr(0b1010101 + 0o17) + chr(0b110101 + 0o60))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xacyg\x07\xd9\xc3\xa0`|\xfe\x1coTT\xc4\xf3o\x00Za\xae\xd3'), '\x64' + chr(0b1100101) + '\143' + chr(8554 - 8443) + '\144' + chr(5061 - 4960))('\x75' + chr(116) + chr(7263 - 7161) + '\x2d' + chr(0b111000))):
niKwoNx3HagZ = IDJ2eXGCBCDu.nn.rnn_cell.LSTMCell(ybe0t6mdMkGA)
LPebBlQ1W1DS = IDJ2eXGCBCDu.layers.Dense(ehT0Px3KOsy9('\x30' + chr(111) + chr(50), 8) ** hirdDkUtlkrL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8bq\x00\xc2\xc5\xa0ZA\xe7\x1ayoJ\xce\xf3'), chr(100) + chr(0b1100101) + chr(0b10001 + 0o122) + chr(5762 - 5651) + chr(0b1100100) + '\145')(chr(117) + chr(0b1110100) + '\146' + chr(45) + chr(0b1010 + 0o56)))
UfDbVMZ1fZY6 = IDJ2eXGCBCDu.layers.Dense(ybe0t6mdMkGA, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8bq\x00\xc2\xc5\xa0ZA\xf2\x05~nG'), chr(0b1100100) + chr(0b1100101) + '\143' + chr(5161 - 5050) + '\144' + '\x65')(chr(117) + chr(0b1100100 + 0o20) + chr(0b10001 + 0o125) + '\x2d' + chr(0b111000)))
ix9dZyeAmUxY = jSKPaHwSAfVv.shape_list(Y_ww15mzvXKf)[ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x30', ord("\x08"))]
pZXGr4xjGfww = IDJ2eXGCBCDu.layers.flatten(Y_ww15mzvXKf)
qmcNRo8QvnyL = IDJ2eXGCBCDu.layers.dense(pZXGr4xjGfww, ybe0t6mdMkGA, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5xv\x02\xc4\xc5'), '\x64' + chr(0b1001000 + 0o35) + chr(99) + chr(2156 - 2045) + chr(100) + chr(353 - 252))('\x75' + chr(0b10111 + 0o135) + chr(102) + '\x2d' + chr(0b100000 + 0o30)))
MXcVy4Xv1eOD = IDJ2eXGCBCDu.layers.dense(pZXGr4xjGfww, ybe0t6mdMkGA, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbfxv\x02\xc4\xc5'), chr(1284 - 1184) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(0b100100 + 0o100) + chr(101))(chr(117) + chr(0b101101 + 0o107) + chr(0b1100110) + chr(490 - 445) + '\x38'))
dd6uGoTzXTXP = IDJ2eXGCBCDu.layers.dense(pZXGr4xjGfww, ybe0t6mdMkGA, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb1xv\x02\xc4\xc5'), '\x64' + chr(6344 - 6243) + chr(0b1001011 + 0o30) + '\157' + '\x64' + '\145')(chr(117) + chr(116) + chr(0b1100110) + chr(782 - 737) + '\x38'))
KKFQISrGeiAm = (MXcVy4Xv1eOD, dd6uGoTzXTXP)
if BuqTRVum9XK3 is None:
Dx_DllZ8uCko = []
kmbyRQe3NyKh = qmcNRo8QvnyL
for WVxHKyX45z_L in vQr8gNKaIaWE(_P61TaxEl5zk // hirdDkUtlkrL):
if PQUL7p8nyYID is not None:
kmbyRQe3NyKh = IDJ2eXGCBCDu.concat([kmbyRQe3NyKh, PQUL7p8nyYID[:, WVxHKyX45z_L, :]], axis=ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b1001 + 0o50), 0b1000))
(e1jVqMSBZ01Y, KKFQISrGeiAm) = niKwoNx3HagZ(kmbyRQe3NyKh, KKFQISrGeiAm)
QR2yueGQwFXN = LPebBlQ1W1DS(e1jVqMSBZ01Y)
cHHKFHNqWKlG = jSKPaHwSAfVv.sample_with_temperature(QR2yueGQwFXN, uICaXvjWrxGa)
xafqLlk3kkUe(Dx_DllZ8uCko, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd{r\x06\xde\xc4'), chr(100) + chr(0b1100101) + chr(99) + chr(111) + '\144' + chr(0b1100101))(chr(10723 - 10606) + '\x74' + chr(0b1100110) + '\055' + chr(1095 - 1039)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9sr\x02\xde\xc4\x8b[w\xfa\x1b'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1000001 + 0o56) + chr(100) + '\145')('\x75' + chr(0b1110100) + chr(0b1010101 + 0o21) + chr(1447 - 1402) + chr(56)))(cHHKFHNqWKlG, axis=ehT0Px3KOsy9('\060' + chr(111) + chr(49), 8)))
kmbyRQe3NyKh = UfDbVMZ1fZY6(IDJ2eXGCBCDu.Hq3fv4Yp0EhD(cHHKFHNqWKlG, ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(52) + '\060' + '\060', 0o10)))
Dx_DllZ8uCko = IDJ2eXGCBCDu.concat(Dx_DllZ8uCko, axis=ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + '\061', 8))
Dx_DllZ8uCko = yJGZvHIPIBwO(Dx_DllZ8uCko, hirdDkUtlkrL)
Dx_DllZ8uCko = IDJ2eXGCBCDu.reshape(Dx_DllZ8uCko, [ix9dZyeAmUxY, _P61TaxEl5zk])
return (ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010), 8) * Dx_DllZ8uCko - ehT0Px3KOsy9(chr(48) + chr(12204 - 12093) + '\x31', 8), 0.0)
assert _P61TaxEl5zk % hirdDkUtlkrL == ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1101 + 0o43), 8)
BuqTRVum9XK3 = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.maximum(IDJ2eXGCBCDu.stop_gradient(BuqTRVum9XK3), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(12309 - 12198) + chr(0b1110 + 0o42), 8)), [ix9dZyeAmUxY, _P61TaxEl5zk // hirdDkUtlkrL, hirdDkUtlkrL])
qlaV1WTXNYJT = gBBBAhX0TTvq(BuqTRVum9XK3, hirdDkUtlkrL)
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83O69\xc7\x99\xb6KK\xc3\x1dM'), '\x64' + chr(4021 - 3920) + '\143' + chr(111) + chr(6816 - 6716) + chr(4252 - 4151))('\x75' + '\164' + chr(3254 - 3152) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8jp\x04\xd5\xd4\x8bVp\xe3\r{nQ\xde'), chr(0b1100000 + 0o4) + '\145' + chr(0b1100011) + chr(0b1100011 + 0o14) + chr(0b1010000 + 0o24) + chr(5844 - 5743))('\165' + chr(0b1110100) + chr(1905 - 1803) + '\x2d' + chr(0b111000)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xaenq\x0b\xd1\xd0\xb1'), chr(2186 - 2086) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\144' + chr(0b1010 + 0o133))('\165' + chr(116) + chr(0b11011 + 0o113) + '\055' + '\070'))(qlaV1WTXNYJT, [-ehT0Px3KOsy9(chr(48) + chr(0b10101 + 0o132) + chr(0b110001), 8)]))
A411mynQe3Ga = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(qlaV1WTXNYJT, ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100101 + 0o15), 8) ** hirdDkUtlkrL, axis=-ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101101 + 0o4), 8))
c2qZBtra7AUE = UfDbVMZ1fZY6(A411mynQe3Ga)
c2qZBtra7AUE = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(c2qZBtra7AUE, 1.0 - ag0mwEgWzjYv)
kJLuU6i3pNjU = IDJ2eXGCBCDu.concat([IDJ2eXGCBCDu.expand_dims(qmcNRo8QvnyL, axis=ehT0Px3KOsy9(chr(516 - 468) + '\157' + '\x31', 8)), c2qZBtra7AUE], axis=ehT0Px3KOsy9(chr(1291 - 1243) + chr(111) + chr(0b110001), 8))
Dx_DllZ8uCko = []
for WVxHKyX45z_L in vQr8gNKaIaWE(_P61TaxEl5zk // hirdDkUtlkrL):
kmbyRQe3NyKh = kJLuU6i3pNjU[:, WVxHKyX45z_L, :]
if PQUL7p8nyYID is not None:
kmbyRQe3NyKh = IDJ2eXGCBCDu.concat([kmbyRQe3NyKh, PQUL7p8nyYID[:, WVxHKyX45z_L, :]], axis=ehT0Px3KOsy9('\x30' + '\x6f' + chr(1403 - 1354), 8))
(e1jVqMSBZ01Y, KKFQISrGeiAm) = niKwoNx3HagZ(kmbyRQe3NyKh, KKFQISrGeiAm)
xafqLlk3kkUe(Dx_DllZ8uCko, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd{r\x06\xde\xc4'), chr(0b1100100) + chr(391 - 290) + chr(0b100010 + 0o101) + chr(0b1101111) + '\x64' + chr(101))(chr(0b110110 + 0o77) + '\164' + chr(0b1010 + 0o134) + '\x2d' + '\x38'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9sr\x02\xde\xc4\x8b[w\xfa\x1b'), chr(8779 - 8679) + '\x65' + '\143' + chr(5687 - 5576) + chr(8283 - 8183) + chr(192 - 91))(chr(0b101100 + 0o111) + chr(0b1100010 + 0o22) + chr(0b1100110) + chr(1383 - 1338) + chr(56)))(e1jVqMSBZ01Y, axis=ehT0Px3KOsy9(chr(0b110000) + chr(2549 - 2438) + chr(1883 - 1834), 8)))
Dx_DllZ8uCko = IDJ2eXGCBCDu.concat(Dx_DllZ8uCko, axis=ehT0Px3KOsy9('\x30' + chr(11685 - 11574) + chr(1101 - 1052), 8))
Dx_DllZ8uCko = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(Dx_DllZ8uCko, 1.0 - ag0mwEgWzjYv)
x0epwBPKrBKQ = LPebBlQ1W1DS(Dx_DllZ8uCko)
urjeZ7o3QpDk = IDJ2eXGCBCDu.losses.sparse_softmax_cross_entropy(logits=x0epwBPKrBKQ, labels=qlaV1WTXNYJT)
urjeZ7o3QpDk = IDJ2eXGCBCDu.reduce_mean(urjeZ7o3QpDk)
return (x0epwBPKrBKQ, urjeZ7o3QpDk)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
get_vq_codebook
|
def get_vq_codebook(codebook_size, hidden_size):
"""Get lookup table for VQ bottleneck."""
with tf.variable_scope("vq", reuse=tf.AUTO_REUSE):
means = tf.get_variable(
name="means",
shape=[codebook_size, hidden_size],
initializer=tf.uniform_unit_scaling_initializer())
ema_count = tf.get_variable(
name="ema_count",
shape=[codebook_size],
initializer=tf.constant_initializer(0),
trainable=False)
with tf.colocate_with(means):
ema_means = tf.get_variable(
name="ema_means",
initializer=means.initialized_value(),
trainable=False)
return means, ema_means, ema_count
|
python
|
def get_vq_codebook(codebook_size, hidden_size):
"""Get lookup table for VQ bottleneck."""
with tf.variable_scope("vq", reuse=tf.AUTO_REUSE):
means = tf.get_variable(
name="means",
shape=[codebook_size, hidden_size],
initializer=tf.uniform_unit_scaling_initializer())
ema_count = tf.get_variable(
name="ema_count",
shape=[codebook_size],
initializer=tf.constant_initializer(0),
trainable=False)
with tf.colocate_with(means):
ema_means = tf.get_variable(
name="ema_means",
initializer=means.initialized_value(),
trainable=False)
return means, ema_means, ema_count
|
[
"def",
"get_vq_codebook",
"(",
"codebook_size",
",",
"hidden_size",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"vq\"",
",",
"reuse",
"=",
"tf",
".",
"AUTO_REUSE",
")",
":",
"means",
"=",
"tf",
".",
"get_variable",
"(",
"name",
"=",
"\"means\"",
",",
"shape",
"=",
"[",
"codebook_size",
",",
"hidden_size",
"]",
",",
"initializer",
"=",
"tf",
".",
"uniform_unit_scaling_initializer",
"(",
")",
")",
"ema_count",
"=",
"tf",
".",
"get_variable",
"(",
"name",
"=",
"\"ema_count\"",
",",
"shape",
"=",
"[",
"codebook_size",
"]",
",",
"initializer",
"=",
"tf",
".",
"constant_initializer",
"(",
"0",
")",
",",
"trainable",
"=",
"False",
")",
"with",
"tf",
".",
"colocate_with",
"(",
"means",
")",
":",
"ema_means",
"=",
"tf",
".",
"get_variable",
"(",
"name",
"=",
"\"ema_means\"",
",",
"initializer",
"=",
"means",
".",
"initialized_value",
"(",
")",
",",
"trainable",
"=",
"False",
")",
"return",
"means",
",",
"ema_means",
",",
"ema_count"
] |
Get lookup table for VQ bottleneck.
|
[
"Get",
"lookup",
"table",
"for",
"VQ",
"bottleneck",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L885-L905
|
train
|
Get lookup table for VQ bottleneck.
|
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,QWgp4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SM16l2KDPD,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(217 - 169) + '\157' + chr(49) + chr(1958 - 1908) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(800 - 752) + '\157' + chr(0b110001) + chr(0b100111 + 0o14) + chr(1630 - 1575), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010 + 0o0) + chr(0b110111) + chr(1644 - 1594), ord("\x08")), ehT0Px3KOsy9(chr(1552 - 1504) + '\157' + '\x32' + chr(0b110111) + chr(0b1111 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110010) + '\x34' + chr(1150 - 1101), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b110 + 0o151) + chr(0b110011) + '\x33' + chr(0b10011 + 0o36), 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(49) + chr(0b101001 + 0o11), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(345 - 293) + chr(0b110111), 23360 - 23352), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(1176 - 1123) + '\x31', 58309 - 58301), ehT0Px3KOsy9(chr(2152 - 2104) + chr(111) + chr(0b100 + 0o57) + chr(52) + chr(0b10000 + 0o42), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011 + 0o144) + chr(0b110010) + chr(0b101001 + 0o15) + chr(0b10011 + 0o41), 35964 - 35956), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(491 - 441) + chr(52) + chr(0b110 + 0o61), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1110 + 0o141) + '\x34' + chr(0b1010 + 0o51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(757 - 708) + '\060' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\064' + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110111) + chr(195 - 140), 56314 - 56306), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(2279 - 2229) + '\062', 8), ehT0Px3KOsy9(chr(1398 - 1350) + chr(0b100000 + 0o117) + chr(50) + '\067' + '\x33', 0o10), ehT0Px3KOsy9(chr(908 - 860) + chr(0b1101111) + chr(2558 - 2505) + chr(1269 - 1220), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4468 - 4357) + chr(0b110011) + chr(0b110001 + 0o5) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100011 + 0o20) + '\x32' + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(1847 - 1736) + '\063' + chr(0b10000 + 0o47) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101101 + 0o2) + chr(50) + chr(51) + chr(0b101 + 0o62), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(204 - 150) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(0b110010) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(1557 - 1509) + chr(6940 - 6829) + chr(1038 - 988) + chr(1687 - 1635) + chr(49), 8), ehT0Px3KOsy9(chr(2027 - 1979) + '\157' + '\063' + chr(1365 - 1312) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b11100 + 0o31), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + '\x33' + chr(0b110001), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101011 + 0o6) + chr(0b110110) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11584 - 11473) + '\x32' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3234 - 3123) + '\063' + chr(0b110011) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(2258 - 2210) + chr(111) + chr(49) + '\x36' + chr(0b1010 + 0o53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(55), 28026 - 28018), ehT0Px3KOsy9(chr(561 - 513) + chr(0b1101111) + chr(2556 - 2501) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + chr(0b110011) + '\x31' + chr(142 - 90), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b11 + 0o63), 36778 - 36770)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(0b10110 + 0o37) + chr(612 - 564), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'|'), '\x64' + chr(101) + chr(5816 - 5717) + chr(0b1101011 + 0o4) + '\144' + '\145')('\165' + '\x74' + '\x66' + chr(0b10101 + 0o30) + chr(1819 - 1763)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ydI5SANw_p5d(X1eo1equXaXT, qzoyXN3kdhDL):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'$>\xc8\xd0\xc0.\xb5ox\x9a\x81\xdb\xd7F'), chr(5477 - 5377) + chr(0b1100101) + chr(99) + '\x6f' + chr(0b10100 + 0o120) + chr(0b111101 + 0o50))(chr(117) + chr(116) + chr(102) + chr(0b1111 + 0o36) + chr(0b110110 + 0o2)))(xafqLlk3kkUe(SXOLrMavuUCe(b'$.'), chr(0b1100100) + chr(5690 - 5589) + chr(0b100000 + 0o103) + chr(111) + '\144' + chr(7994 - 7893))(chr(117) + chr(0b1000110 + 0o56) + chr(0b1100110) + chr(45) + '\070'), reuse=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x13\n\xee\xf6\xfe\x1e\x9c_t\xac'), '\x64' + chr(0b1100011 + 0o2) + chr(6434 - 6335) + chr(0b1101111) + chr(2698 - 2598) + chr(101))(chr(0b11100 + 0o131) + chr(0b1100111 + 0o15) + chr(8490 - 8388) + '\x2d' + chr(0b111000)))):
XCAIkNRdiX0I = IDJ2eXGCBCDu.get_variable(name=xafqLlk3kkUe(SXOLrMavuUCe(b'?:\xdb\xd7\xd2'), chr(3761 - 3661) + chr(0b11010 + 0o113) + chr(0b100 + 0o137) + '\x6f' + '\x64' + '\x65')('\x75' + '\164' + '\146' + chr(0b101101) + '\x38'), shape=[X1eo1equXaXT, qzoyXN3kdhDL], initializer=IDJ2eXGCBCDu.uniform_unit_scaling_initializer())
ALokVh6YPLgI = IDJ2eXGCBCDu.get_variable(name=xafqLlk3kkUe(SXOLrMavuUCe(b'72\xdb\xe6\xc2#\xacdS'), '\x64' + '\145' + chr(0b1100011) + chr(111) + chr(0b1100100) + '\145')(chr(4618 - 4501) + chr(116) + chr(0b1100110) + chr(107 - 62) + chr(0b100100 + 0o24)), shape=[X1eo1equXaXT], initializer=IDJ2eXGCBCDu.constant_initializer(ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(0b10110 + 0o32), 40429 - 40421)), trainable=ehT0Px3KOsy9(chr(542 - 494) + chr(7231 - 7120) + chr(968 - 920), 8))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'10\xd6\xd6\xc2-\xadox\x9e\x8b\xc0\xcf'), chr(1246 - 1146) + '\x65' + chr(99) + chr(0b1 + 0o156) + chr(100) + '\x65')(chr(117) + '\164' + chr(0b1100110) + chr(45) + chr(56)))(XCAIkNRdiX0I):
vx6LjadlTfNA = IDJ2eXGCBCDu.get_variable(name=xafqLlk3kkUe(SXOLrMavuUCe(b'72\xdb\xe6\xcc)\xb8dT'), chr(9183 - 9083) + chr(0b10001 + 0o124) + chr(99) + '\x6f' + '\x64' + chr(0b1100101))('\165' + '\x74' + chr(0b1100110) + chr(45) + chr(0b101101 + 0o13)), initializer=XCAIkNRdiX0I.initialized_value(), trainable=ehT0Px3KOsy9('\060' + chr(111) + chr(0b110000), 8))
return (XCAIkNRdiX0I, vx6LjadlTfNA, ALokVh6YPLgI)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
vq_nearest_neighbor
|
def vq_nearest_neighbor(x, means,
soft_em=False, num_samples=10, temperature=None):
"""Find the nearest element in means to elements in x."""
bottleneck_size = common_layers.shape_list(means)[0]
x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keepdims=True)
means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keepdims=True)
scalar_prod = tf.matmul(x, means, transpose_b=True)
dist = x_norm_sq + tf.transpose(means_norm_sq) - 2 * scalar_prod
if soft_em:
x_means_idx = tf.multinomial(-dist, num_samples=num_samples)
x_means_hot = tf.one_hot(
x_means_idx, depth=common_layers.shape_list(means)[0])
x_means_hot = tf.reduce_mean(x_means_hot, axis=1)
else:
if temperature is None:
x_means_idx = tf.argmax(-dist, axis=-1)
else:
x_means_idx = tf.multinomial(- dist / temperature, 1)
x_means_idx = tf.squeeze(x_means_idx, axis=-1)
if (common_layers.should_generate_summaries() and
not common_layers.is_xla_compiled()):
tf.summary.histogram("means_idx", tf.reshape(x_means_idx, [-1]))
x_means_hot = tf.one_hot(x_means_idx, bottleneck_size)
x_means_hot_flat = tf.reshape(x_means_hot, [-1, bottleneck_size])
x_means = tf.matmul(x_means_hot_flat, means)
e_loss = tf.reduce_mean(tf.squared_difference(x, tf.stop_gradient(x_means)))
return x_means_hot, e_loss, dist
|
python
|
def vq_nearest_neighbor(x, means,
soft_em=False, num_samples=10, temperature=None):
"""Find the nearest element in means to elements in x."""
bottleneck_size = common_layers.shape_list(means)[0]
x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keepdims=True)
means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keepdims=True)
scalar_prod = tf.matmul(x, means, transpose_b=True)
dist = x_norm_sq + tf.transpose(means_norm_sq) - 2 * scalar_prod
if soft_em:
x_means_idx = tf.multinomial(-dist, num_samples=num_samples)
x_means_hot = tf.one_hot(
x_means_idx, depth=common_layers.shape_list(means)[0])
x_means_hot = tf.reduce_mean(x_means_hot, axis=1)
else:
if temperature is None:
x_means_idx = tf.argmax(-dist, axis=-1)
else:
x_means_idx = tf.multinomial(- dist / temperature, 1)
x_means_idx = tf.squeeze(x_means_idx, axis=-1)
if (common_layers.should_generate_summaries() and
not common_layers.is_xla_compiled()):
tf.summary.histogram("means_idx", tf.reshape(x_means_idx, [-1]))
x_means_hot = tf.one_hot(x_means_idx, bottleneck_size)
x_means_hot_flat = tf.reshape(x_means_hot, [-1, bottleneck_size])
x_means = tf.matmul(x_means_hot_flat, means)
e_loss = tf.reduce_mean(tf.squared_difference(x, tf.stop_gradient(x_means)))
return x_means_hot, e_loss, dist
|
[
"def",
"vq_nearest_neighbor",
"(",
"x",
",",
"means",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"10",
",",
"temperature",
"=",
"None",
")",
":",
"bottleneck_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"means",
")",
"[",
"0",
"]",
"x_norm_sq",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"x",
")",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"means_norm_sq",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"means",
")",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"scalar_prod",
"=",
"tf",
".",
"matmul",
"(",
"x",
",",
"means",
",",
"transpose_b",
"=",
"True",
")",
"dist",
"=",
"x_norm_sq",
"+",
"tf",
".",
"transpose",
"(",
"means_norm_sq",
")",
"-",
"2",
"*",
"scalar_prod",
"if",
"soft_em",
":",
"x_means_idx",
"=",
"tf",
".",
"multinomial",
"(",
"-",
"dist",
",",
"num_samples",
"=",
"num_samples",
")",
"x_means_hot",
"=",
"tf",
".",
"one_hot",
"(",
"x_means_idx",
",",
"depth",
"=",
"common_layers",
".",
"shape_list",
"(",
"means",
")",
"[",
"0",
"]",
")",
"x_means_hot",
"=",
"tf",
".",
"reduce_mean",
"(",
"x_means_hot",
",",
"axis",
"=",
"1",
")",
"else",
":",
"if",
"temperature",
"is",
"None",
":",
"x_means_idx",
"=",
"tf",
".",
"argmax",
"(",
"-",
"dist",
",",
"axis",
"=",
"-",
"1",
")",
"else",
":",
"x_means_idx",
"=",
"tf",
".",
"multinomial",
"(",
"-",
"dist",
"/",
"temperature",
",",
"1",
")",
"x_means_idx",
"=",
"tf",
".",
"squeeze",
"(",
"x_means_idx",
",",
"axis",
"=",
"-",
"1",
")",
"if",
"(",
"common_layers",
".",
"should_generate_summaries",
"(",
")",
"and",
"not",
"common_layers",
".",
"is_xla_compiled",
"(",
")",
")",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"means_idx\"",
",",
"tf",
".",
"reshape",
"(",
"x_means_idx",
",",
"[",
"-",
"1",
"]",
")",
")",
"x_means_hot",
"=",
"tf",
".",
"one_hot",
"(",
"x_means_idx",
",",
"bottleneck_size",
")",
"x_means_hot_flat",
"=",
"tf",
".",
"reshape",
"(",
"x_means_hot",
",",
"[",
"-",
"1",
",",
"bottleneck_size",
"]",
")",
"x_means",
"=",
"tf",
".",
"matmul",
"(",
"x_means_hot_flat",
",",
"means",
")",
"e_loss",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"squared_difference",
"(",
"x",
",",
"tf",
".",
"stop_gradient",
"(",
"x_means",
")",
")",
")",
"return",
"x_means_hot",
",",
"e_loss",
",",
"dist"
] |
Find the nearest element in means to elements in x.
|
[
"Find",
"the",
"nearest",
"element",
"in",
"means",
"to",
"elements",
"in",
"x",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L908-L934
|
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,RouZF7bjEXAv,j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wxiBOH72k,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(394 - 346) + chr(0b1101111) + '\063' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(1210 - 1162) + '\157' + chr(49) + chr(0b10100 + 0o34) + chr(2862 - 2807), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + '\x31' + chr(1498 - 1445) + chr(0b101110 + 0o5), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7414 - 7303) + '\x33' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110011) + chr(0b110101), 11865 - 11857), ehT0Px3KOsy9(chr(308 - 260) + chr(0b1101111) + chr(0b101010 + 0o14) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(48) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110111) + chr(0b101101 + 0o11), 39221 - 39213), ehT0Px3KOsy9(chr(48) + chr(9986 - 9875) + chr(0b110001) + '\065' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(1094 - 1046) + chr(111) + chr(0b10100 + 0o37) + chr(0b110111) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(2086 - 2038) + '\157' + chr(349 - 297) + chr(0b110001 + 0o0), 0b1000), ehT0Px3KOsy9(chr(204 - 156) + chr(11231 - 11120) + chr(49) + '\x31' + chr(0b110111), 48688 - 48680), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x32' + chr(2260 - 2206), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(0b101100 + 0o5) + chr(0b110110) + '\064', 15757 - 15749), ehT0Px3KOsy9(chr(48) + chr(12224 - 12113) + '\x32' + '\060' + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(11827 - 11716) + chr(136 - 82), 11685 - 11677), ehT0Px3KOsy9(chr(1797 - 1749) + chr(0b1101111) + chr(0b11100 + 0o27) + chr(1398 - 1350), 8), ehT0Px3KOsy9(chr(0b110000) + chr(5997 - 5886) + '\x33' + '\065' + chr(0b11011 + 0o31), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8222 - 8111) + chr(0b110011) + chr(0b110101) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b101001 + 0o11) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110001) + chr(0b110111), 8), ehT0Px3KOsy9('\060' + chr(0b110000 + 0o77) + '\062' + chr(0b110000) + chr(0b11010 + 0o35), 8), ehT0Px3KOsy9('\x30' + chr(0b101010 + 0o105) + '\061' + '\x32' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b111 + 0o57), 8), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(862 - 813) + chr(52), 0b1000), ehT0Px3KOsy9(chr(2270 - 2222) + chr(0b1101111) + '\061' + chr(0b1110 + 0o51) + chr(1682 - 1628), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(0b110001) + chr(0b110111) + chr(0b110000 + 0o7), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(1559 - 1508), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101110 + 0o5) + chr(0b101110 + 0o11) + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + chr(0b110010) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b10 + 0o61) + chr(2387 - 2338), 45887 - 45879), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100100 + 0o17) + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b11101 + 0o27) + chr(1666 - 1613), 22845 - 22837), ehT0Px3KOsy9(chr(0b110000) + chr(4320 - 4209) + chr(0b100100 + 0o15) + chr(0b100001 + 0o22) + chr(48), 41218 - 41210), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(2997 - 2942) + chr(0b100100 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\060' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1462 - 1414) + chr(0b1101111) + chr(353 - 303) + '\062' + chr(0b1000 + 0o56), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(195 - 143) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4403 - 4292) + '\x32' + chr(55) + chr(0b110110), 8), ehT0Px3KOsy9(chr(1983 - 1935) + chr(111) + chr(0b111 + 0o52) + chr(0b110110) + chr(1572 - 1517), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(1859 - 1748) + chr(53) + chr(1754 - 1706), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'6'), '\x64' + chr(3986 - 3885) + chr(0b1100011) + chr(941 - 830) + chr(100) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(0b1011 + 0o55)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def _BIEDn8fJw4t(OeWW0F1dBPRQ, XCAIkNRdiX0I, sjb7MZHDGfYq=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(48), 34113 - 34105), Wuetkhsbidt0=ehT0Px3KOsy9(chr(2203 - 2155) + '\x6f' + chr(0b100001 + 0o20) + '\x32', 0o10), uICaXvjWrxGa=None):
MyjCWd_3JWq1 = jSKPaHwSAfVv.shape_list(XCAIkNRdiX0I)[ehT0Px3KOsy9(chr(699 - 651) + chr(111) + chr(0b110000), 8)]
fGB238pT2MDS = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(OeWW0F1dBPRQ), axis=-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2199 - 2150), 0b1000), keepdims=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110 + 0o53), 8))
VKkOWR9YyfoZ = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(XCAIkNRdiX0I), axis=-ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(49), 8), keepdims=ehT0Px3KOsy9('\060' + '\157' + chr(0b110001), 8))
OsEVnTBapoxv = IDJ2eXGCBCDu.matmul(OeWW0F1dBPRQ, XCAIkNRdiX0I, transpose_b=ehT0Px3KOsy9('\x30' + '\157' + chr(399 - 350), 8))
ydho_1U2EnKK = fGB238pT2MDS + IDJ2eXGCBCDu.transpose(VKkOWR9YyfoZ) - ehT0Px3KOsy9(chr(0b110000) + chr(4602 - 4491) + '\062', 0o10) * OsEVnTBapoxv
if sjb7MZHDGfYq:
T8BdHeA1BjOx = IDJ2eXGCBCDu.multinomial(-ydho_1U2EnKK, num_samples=Wuetkhsbidt0)
fu_DLUnq0Rui = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(T8BdHeA1BjOx, depth=jSKPaHwSAfVv.shape_list(XCAIkNRdiX0I)[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(48), 8)])
fu_DLUnq0Rui = IDJ2eXGCBCDu.reduce_mean(fu_DLUnq0Rui, axis=ehT0Px3KOsy9(chr(2018 - 1970) + '\x6f' + '\061', 8))
else:
if uICaXvjWrxGa is None:
T8BdHeA1BjOx = IDJ2eXGCBCDu.argmax(-ydho_1U2EnKK, axis=-ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + '\x31', 8))
else:
T8BdHeA1BjOx = IDJ2eXGCBCDu.multinomial(-ydho_1U2EnKK / uICaXvjWrxGa, ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(49), 8))
T8BdHeA1BjOx = IDJ2eXGCBCDu.squeeze(T8BdHeA1BjOx, axis=-ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(9535 - 9424) + chr(0b110001), 8))
if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'k/\x04h\xf1W\x1c\xd9\x0b\x96D=7\x00\xe2Yk\x99\x86\xbe.\xf5>c\xff'), chr(4459 - 4359) + chr(10070 - 9969) + chr(0b1100011) + chr(10191 - 10080) + '\144' + chr(0b1100101))('\165' + '\164' + '\x66' + chr(45) + '\x38'))() and (not xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'q44e\xf1R\x1c\xdd\x01\x95Q&:\x11\xe3'), chr(100) + '\145' + '\x63' + chr(111) + chr(0b1101 + 0o127) + chr(5469 - 5368))('\165' + '\164' + chr(0b1100110) + '\x2d' + '\x38'))()):
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'G\x03_G\xea\n!\xca;\xacT\x1e'), chr(0b1110 + 0o126) + '\145' + chr(0b1100011) + chr(0b1101111) + '\144' + '\x65')('\165' + chr(9583 - 9467) + chr(8966 - 8864) + '\x2d' + chr(0b1111 + 0o51)))(xafqLlk3kkUe(SXOLrMavuUCe(b'u"\ns\xeel*\xda\x16'), chr(0b111011 + 0o51) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(0b1100100) + chr(0b101111 + 0o66))(chr(0b1110101) + chr(11732 - 11616) + chr(1627 - 1525) + chr(0b101101) + chr(56)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'j"\x18u\xfcC&'), chr(6605 - 6505) + chr(101) + '\143' + chr(8658 - 8547) + chr(0b1100100) + chr(101))('\x75' + chr(0b1110100) + chr(9243 - 9141) + chr(0b0 + 0o55) + chr(56)))(T8BdHeA1BjOx, [-ehT0Px3KOsy9(chr(1149 - 1101) + chr(0b1101111) + chr(49), 8)]))
fu_DLUnq0Rui = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(T8BdHeA1BjOx, MyjCWd_3JWq1)
OzTTsjtkYNjK = IDJ2eXGCBCDu.reshape(fu_DLUnq0Rui, [-ehT0Px3KOsy9(chr(0b110000) + chr(7184 - 7073) + chr(0b110001), 8), MyjCWd_3JWq1])
xPgmXL9DQrWF = IDJ2eXGCBCDu.matmul(OzTTsjtkYNjK, XCAIkNRdiX0I)
bGSDGpa5hkiT = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(OeWW0F1dBPRQ, IDJ2eXGCBCDu.stop_gradient(xPgmXL9DQrWF)))
return (fu_DLUnq0Rui, bGSDGpa5hkiT, ydho_1U2EnKK)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
vq_discrete_bottleneck
|
def vq_discrete_bottleneck(x,
bottleneck_bits,
beta=0.25,
decay=0.999,
epsilon=1e-5,
soft_em=False,
num_samples=10):
"""Simple vector quantized discrete bottleneck."""
bottleneck_size = 2**bottleneck_bits
x_means_hot, e_loss, _ = vq_body(
x,
bottleneck_size,
beta=beta,
decay=decay,
epsilon=epsilon,
soft_em=soft_em,
num_samples=num_samples)
return x_means_hot, e_loss
|
python
|
def vq_discrete_bottleneck(x,
bottleneck_bits,
beta=0.25,
decay=0.999,
epsilon=1e-5,
soft_em=False,
num_samples=10):
"""Simple vector quantized discrete bottleneck."""
bottleneck_size = 2**bottleneck_bits
x_means_hot, e_loss, _ = vq_body(
x,
bottleneck_size,
beta=beta,
decay=decay,
epsilon=epsilon,
soft_em=soft_em,
num_samples=num_samples)
return x_means_hot, e_loss
|
[
"def",
"vq_discrete_bottleneck",
"(",
"x",
",",
"bottleneck_bits",
",",
"beta",
"=",
"0.25",
",",
"decay",
"=",
"0.999",
",",
"epsilon",
"=",
"1e-5",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"10",
")",
":",
"bottleneck_size",
"=",
"2",
"**",
"bottleneck_bits",
"x_means_hot",
",",
"e_loss",
",",
"_",
"=",
"vq_body",
"(",
"x",
",",
"bottleneck_size",
",",
"beta",
"=",
"beta",
",",
"decay",
"=",
"decay",
",",
"epsilon",
"=",
"epsilon",
",",
"soft_em",
"=",
"soft_em",
",",
"num_samples",
"=",
"num_samples",
")",
"return",
"x_means_hot",
",",
"e_loss"
] |
Simple vector quantized discrete bottleneck.
|
[
"Simple",
"vector",
"quantized",
"discrete",
"bottleneck",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L937-L954
|
train
|
Simple vector quantized discrete bottleneck.
|
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(0b100011 + 0o15) + '\157' + chr(0b100100 + 0o15) + chr(53) + chr(0b110 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\065' + chr(1668 - 1616), 3882 - 3874), ehT0Px3KOsy9(chr(2136 - 2088) + chr(7596 - 7485) + chr(1908 - 1859) + chr(52) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\x32' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2047 - 1999) + chr(0b1011000 + 0o27) + chr(50) + chr(839 - 791) + chr(0b10001 + 0o44), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111 + 0o0) + chr(0b1010 + 0o51) + chr(50) + chr(2194 - 2140), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(53) + '\065', 7269 - 7261), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b100011 + 0o24) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(764 - 714), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(2820 - 2709) + '\x32' + chr(0b110100) + '\x34', 0o10), ehT0Px3KOsy9(chr(1687 - 1639) + chr(0b1101111) + chr(50) + '\063' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(146 - 35) + chr(51) + chr(55) + '\065', 0b1000), ehT0Px3KOsy9(chr(2086 - 2038) + chr(0b1101111) + chr(0b1101 + 0o44) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(116 - 68) + '\x6f' + '\x32' + '\x37' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(0b110011) + chr(0b110000) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(0b110101 + 0o2) + '\x36', 8), ehT0Px3KOsy9(chr(1133 - 1085) + chr(0b1010011 + 0o34) + chr(1677 - 1627) + chr(0b110110) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(699 - 651) + chr(111) + '\x32' + '\x35' + '\x32', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b1000 + 0o52) + '\x36', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2559 - 2508) + chr(125 - 74) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(2266 - 2155) + chr(0b110010) + chr(1509 - 1458) + chr(2425 - 2375), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1010 + 0o51) + '\066' + '\066', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(1869 - 1819) + chr(2038 - 1988), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\061' + chr(0b110011) + '\067', 51777 - 51769), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(54) + chr(1949 - 1898), 48667 - 48659), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(1850 - 1800) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(1427 - 1316) + chr(484 - 431), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + chr(51) + chr(0b10011 + 0o37), 0b1000), ehT0Px3KOsy9('\x30' + chr(4110 - 3999) + chr(51) + '\x30' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(1583 - 1532) + chr(0b1110 + 0o43) + '\x30', 23604 - 23596), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + chr(0b110001) + chr(52) + '\066', 0o10), ehT0Px3KOsy9(chr(2038 - 1990) + '\157' + chr(554 - 505) + '\062' + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10001 + 0o40) + chr(0b110001) + chr(48), 53633 - 53625), ehT0Px3KOsy9(chr(1549 - 1501) + '\x6f' + chr(0b110010) + chr(53) + '\061', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(0b1111 + 0o43) + chr(237 - 188), 10528 - 10520), ehT0Px3KOsy9(chr(200 - 152) + '\157' + chr(624 - 573) + '\x35' + '\065', 40098 - 40090), ehT0Px3KOsy9('\060' + chr(1003 - 892) + chr(0b101 + 0o56) + chr(1495 - 1446) + chr(702 - 654), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + chr(2231 - 2182) + chr(0b1011 + 0o45) + chr(282 - 230), 8726 - 8718), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + chr(1794 - 1744) + '\x34' + '\065', 0o10), ehT0Px3KOsy9(chr(1655 - 1607) + '\157' + chr(51) + chr(0b110100) + chr(0b110011), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + '\065' + chr(0b11000 + 0o30), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'C'), chr(4551 - 4451) + chr(101) + '\143' + chr(0b111001 + 0o66) + '\144' + '\145')('\x75' + '\x74' + '\x66' + '\x2d' + chr(0b110010 + 0o6)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def AA7HUoEwKt_Y(OeWW0F1dBPRQ, L0tf_yAed5SW, FjcovgoHM1LG=0.25, eeyC5_0F9WOf=0.999, Xtig2zAKpR0T=1e-05, sjb7MZHDGfYq=ehT0Px3KOsy9('\060' + '\x6f' + chr(48), 0o10), Wuetkhsbidt0=ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(0b110001) + '\x32', 8)):
MyjCWd_3JWq1 = ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010), 0b1000) ** L0tf_yAed5SW
(fu_DLUnq0Rui, bGSDGpa5hkiT, VNGQdHSFPrso) = N49LSkm2h4zv(OeWW0F1dBPRQ, MyjCWd_3JWq1, beta=FjcovgoHM1LG, decay=eeyC5_0F9WOf, epsilon=Xtig2zAKpR0T, soft_em=sjb7MZHDGfYq, num_samples=Wuetkhsbidt0)
return (fu_DLUnq0Rui, bGSDGpa5hkiT)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
vq_body
|
def vq_body(x,
codebook_size,
beta=0.25,
decay=0.999,
epsilon=1e-5,
soft_em=False,
num_samples=10,
temperature=None,
do_update=True):
"""Discretize each x into one of codebook_size codes."""
x_shape = common_layers.shape_list(x)
hidden_size = x_shape[-1]
means, ema_means, ema_count = get_vq_codebook(codebook_size, hidden_size)
x = tf.reshape(x, [-1, hidden_size])
x_means_hot, e_loss, distances = vq_nearest_neighbor(
x, means, soft_em=soft_em, num_samples=num_samples,
temperature=temperature)
def loss_with_update():
"""Update the ema variables and return loss triggering the update."""
updated_ema_count = moving_averages.assign_moving_average(
ema_count,
tf.reduce_sum(tf.reshape(x_means_hot, shape=[-1, codebook_size]),
axis=0),
decay,
zero_debias=False)
dw = tf.matmul(x_means_hot, x, transpose_a=True)
updated_ema_means = tf.identity(
moving_averages.assign_moving_average(
ema_means, dw, decay, zero_debias=False))
n = tf.reduce_sum(updated_ema_count, axis=-1, keepdims=True)
updated_ema_count = (
(updated_ema_count + epsilon) / (n + codebook_size * epsilon) * n)
updated_ema_means /= tf.expand_dims(updated_ema_count, axis=-1)
with tf.control_dependencies([e_loss]):
update_means = means.assign(updated_ema_means)
with tf.control_dependencies([update_means]):
return beta * e_loss
# Loss, also do update if requested.
if do_update:
loss = loss_with_update()
else:
loss = tf.cond(do_update, loss_with_update, lambda: beta * e_loss)
d = tf.reshape(x_means_hot, x_shape[:-1] + [codebook_size])
return d, loss, distances
|
python
|
def vq_body(x,
codebook_size,
beta=0.25,
decay=0.999,
epsilon=1e-5,
soft_em=False,
num_samples=10,
temperature=None,
do_update=True):
"""Discretize each x into one of codebook_size codes."""
x_shape = common_layers.shape_list(x)
hidden_size = x_shape[-1]
means, ema_means, ema_count = get_vq_codebook(codebook_size, hidden_size)
x = tf.reshape(x, [-1, hidden_size])
x_means_hot, e_loss, distances = vq_nearest_neighbor(
x, means, soft_em=soft_em, num_samples=num_samples,
temperature=temperature)
def loss_with_update():
"""Update the ema variables and return loss triggering the update."""
updated_ema_count = moving_averages.assign_moving_average(
ema_count,
tf.reduce_sum(tf.reshape(x_means_hot, shape=[-1, codebook_size]),
axis=0),
decay,
zero_debias=False)
dw = tf.matmul(x_means_hot, x, transpose_a=True)
updated_ema_means = tf.identity(
moving_averages.assign_moving_average(
ema_means, dw, decay, zero_debias=False))
n = tf.reduce_sum(updated_ema_count, axis=-1, keepdims=True)
updated_ema_count = (
(updated_ema_count + epsilon) / (n + codebook_size * epsilon) * n)
updated_ema_means /= tf.expand_dims(updated_ema_count, axis=-1)
with tf.control_dependencies([e_loss]):
update_means = means.assign(updated_ema_means)
with tf.control_dependencies([update_means]):
return beta * e_loss
# Loss, also do update if requested.
if do_update:
loss = loss_with_update()
else:
loss = tf.cond(do_update, loss_with_update, lambda: beta * e_loss)
d = tf.reshape(x_means_hot, x_shape[:-1] + [codebook_size])
return d, loss, distances
|
[
"def",
"vq_body",
"(",
"x",
",",
"codebook_size",
",",
"beta",
"=",
"0.25",
",",
"decay",
"=",
"0.999",
",",
"epsilon",
"=",
"1e-5",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"10",
",",
"temperature",
"=",
"None",
",",
"do_update",
"=",
"True",
")",
":",
"x_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"hidden_size",
"=",
"x_shape",
"[",
"-",
"1",
"]",
"means",
",",
"ema_means",
",",
"ema_count",
"=",
"get_vq_codebook",
"(",
"codebook_size",
",",
"hidden_size",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"hidden_size",
"]",
")",
"x_means_hot",
",",
"e_loss",
",",
"distances",
"=",
"vq_nearest_neighbor",
"(",
"x",
",",
"means",
",",
"soft_em",
"=",
"soft_em",
",",
"num_samples",
"=",
"num_samples",
",",
"temperature",
"=",
"temperature",
")",
"def",
"loss_with_update",
"(",
")",
":",
"\"\"\"Update the ema variables and return loss triggering the update.\"\"\"",
"updated_ema_count",
"=",
"moving_averages",
".",
"assign_moving_average",
"(",
"ema_count",
",",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"reshape",
"(",
"x_means_hot",
",",
"shape",
"=",
"[",
"-",
"1",
",",
"codebook_size",
"]",
")",
",",
"axis",
"=",
"0",
")",
",",
"decay",
",",
"zero_debias",
"=",
"False",
")",
"dw",
"=",
"tf",
".",
"matmul",
"(",
"x_means_hot",
",",
"x",
",",
"transpose_a",
"=",
"True",
")",
"updated_ema_means",
"=",
"tf",
".",
"identity",
"(",
"moving_averages",
".",
"assign_moving_average",
"(",
"ema_means",
",",
"dw",
",",
"decay",
",",
"zero_debias",
"=",
"False",
")",
")",
"n",
"=",
"tf",
".",
"reduce_sum",
"(",
"updated_ema_count",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"updated_ema_count",
"=",
"(",
"(",
"updated_ema_count",
"+",
"epsilon",
")",
"/",
"(",
"n",
"+",
"codebook_size",
"*",
"epsilon",
")",
"*",
"n",
")",
"updated_ema_means",
"/=",
"tf",
".",
"expand_dims",
"(",
"updated_ema_count",
",",
"axis",
"=",
"-",
"1",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"e_loss",
"]",
")",
":",
"update_means",
"=",
"means",
".",
"assign",
"(",
"updated_ema_means",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"update_means",
"]",
")",
":",
"return",
"beta",
"*",
"e_loss",
"# Loss, also do update if requested.",
"if",
"do_update",
":",
"loss",
"=",
"loss_with_update",
"(",
")",
"else",
":",
"loss",
"=",
"tf",
".",
"cond",
"(",
"do_update",
",",
"loss_with_update",
",",
"lambda",
":",
"beta",
"*",
"e_loss",
")",
"d",
"=",
"tf",
".",
"reshape",
"(",
"x_means_hot",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"codebook_size",
"]",
")",
"return",
"d",
",",
"loss",
",",
"distances"
] |
Discretize each x into one of codebook_size codes.
|
[
"Discretize",
"each",
"x",
"into",
"one",
"of",
"codebook_size",
"codes",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L957-L1004
|
train
|
Returns a single body of the VQ model.
|
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,hO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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) + '\x31' + chr(1685 - 1631) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110110) + chr(0b11001 + 0o35), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x31' + '\067', 43812 - 43804), ehT0Px3KOsy9('\060' + chr(4247 - 4136) + chr(0b1110 + 0o44) + chr(55) + chr(0b101001 + 0o7), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5402 - 5291) + chr(0b11000 + 0o32) + '\x37' + '\063', 47325 - 47317), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(472 - 419) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + '\x35' + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\067' + chr(123 - 75), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(2450 - 2400) + chr(50) + chr(111 - 59), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1011110 + 0o21) + '\063' + chr(0b11100 + 0o26) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(908 - 859) + chr(0b110110) + chr(1917 - 1865), 0o10), ehT0Px3KOsy9('\060' + chr(0b111111 + 0o60) + chr(0b110001) + chr(1284 - 1233), 4049 - 4041), ehT0Px3KOsy9(chr(1259 - 1211) + chr(2648 - 2537) + '\063' + chr(54) + chr(876 - 824), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b10 + 0o63) + '\x36', 47337 - 47329), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(0b110011) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(3529 - 3418) + chr(49) + '\x31' + chr(0b1001 + 0o56), 8), ehT0Px3KOsy9(chr(48) + chr(0b1010100 + 0o33) + '\x33' + chr(0b110010 + 0o2), 467 - 459), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b10001 + 0o45) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1367 - 1319) + '\x6f' + chr(0b110001) + '\x34' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\x32' + chr(0b101 + 0o62), 26833 - 26825), ehT0Px3KOsy9(chr(62 - 14) + chr(111) + chr(0b10 + 0o61) + chr(0b100111 + 0o13) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(2303 - 2253) + chr(0b110100 + 0o1), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(450 - 400) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(645 - 594) + '\065', 11304 - 11296), ehT0Px3KOsy9(chr(117 - 69) + chr(12198 - 12087) + chr(0b110000 + 0o1) + chr(50) + chr(2649 - 2596), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\067' + chr(808 - 755), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(52) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(55) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x32' + chr(0b110111), 8), ehT0Px3KOsy9(chr(1859 - 1811) + chr(0b1001100 + 0o43) + '\x31' + chr(0b110100) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(0b110001) + chr(0b110110 + 0o1) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7517 - 7406) + chr(443 - 392) + chr(0b101011 + 0o10) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(49) + chr(957 - 909) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(1962 - 1911) + chr(0b110011) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(2166 - 2118) + '\x6f' + '\x33' + chr(0b110101) + chr(0b101101 + 0o12), 9209 - 9201), ehT0Px3KOsy9(chr(1753 - 1705) + '\x6f' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b11000 + 0o32) + chr(0b1111 + 0o44), 8), ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + '\x31' + chr(0b1 + 0o66) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1858 - 1808) + chr(0b110010) + chr(52 - 2), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(2777 - 2666) + '\067' + chr(0b110101), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(512 - 464) + chr(111) + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b']'), chr(4610 - 4510) + chr(101) + chr(2230 - 2131) + '\x6f' + chr(5775 - 5675) + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(102) + '\055' + chr(1819 - 1763)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def N49LSkm2h4zv(OeWW0F1dBPRQ, X1eo1equXaXT, FjcovgoHM1LG=0.25, eeyC5_0F9WOf=0.999, Xtig2zAKpR0T=1e-05, sjb7MZHDGfYq=ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10010 + 0o36), ord("\x08")), Wuetkhsbidt0=ehT0Px3KOsy9(chr(48) + chr(8665 - 8554) + chr(0b11 + 0o56) + '\x32', 29292 - 29284), uICaXvjWrxGa=None, KPd4IghLrj_2=ehT0Px3KOsy9(chr(48) + '\157' + '\061', ord("\x08"))):
QQEXXbdZyz6m = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
qzoyXN3kdhDL = QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(49), 8)]
(XCAIkNRdiX0I, vx6LjadlTfNA, ALokVh6YPLgI) = ydI5SANw_p5d(X1eo1equXaXT, qzoyXN3kdhDL)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(48) + chr(8278 - 8167) + '\061', 8), qzoyXN3kdhDL])
(fu_DLUnq0Rui, bGSDGpa5hkiT, _NvIcr6svyB8) = _BIEDn8fJw4t(OeWW0F1dBPRQ, XCAIkNRdiX0I, soft_em=sjb7MZHDGfYq, num_samples=Wuetkhsbidt0, temperature=uICaXvjWrxGa)
def GAT5rbAQQbkg():
FuqutXPYitL0 = nDgFXrDqtELR.assign_moving_average(ALokVh6YPLgI, IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.reshape(fu_DLUnq0Rui, shape=[-ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8), X1eo1equXaXT]), axis=ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(48), 8)), eeyC5_0F9WOf, zero_debias=ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(872 - 824), 8))
UVJMTi_S70Uf = IDJ2eXGCBCDu.matmul(fu_DLUnq0Rui, OeWW0F1dBPRQ, transpose_a=ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + '\061', 8))
RVkrIbasqS0L = IDJ2eXGCBCDu.identity(nDgFXrDqtELR.assign_moving_average(vx6LjadlTfNA, UVJMTi_S70Uf, eeyC5_0F9WOf, zero_debias=ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000), 8)))
m1NkCryOw9Bx = IDJ2eXGCBCDu.reduce_sum(FuqutXPYitL0, axis=-ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 8), keepdims=ehT0Px3KOsy9(chr(1127 - 1079) + chr(9634 - 9523) + '\061', 8))
FuqutXPYitL0 = (FuqutXPYitL0 + Xtig2zAKpR0T) / (m1NkCryOw9Bx + X1eo1equXaXT * Xtig2zAKpR0T) * m1NkCryOw9Bx
RVkrIbasqS0L /= IDJ2eXGCBCDu.expand_dims(FuqutXPYitL0, axis=-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49), 8))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10Y!\xcc\xc9\x06@\xa7\xf0\xb7\x04n\x9a\xcaz!\x7f\xd9\x04\xa4'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(0b1000001 + 0o56) + chr(0b1010000 + 0o24) + '\x65')(chr(0b11010 + 0o133) + chr(116) + '\146' + chr(1199 - 1154) + chr(0b111000)))([bGSDGpa5hkiT]):
lMKniTbgIhg2 = XCAIkNRdiX0I.assign(RVkrIbasqS0L)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10Y!\xcc\xc9\x06@\xa7\xf0\xb7\x04n\x9a\xcaz!\x7f\xd9\x04\xa4'), '\144' + chr(0b1100101) + '\143' + '\x6f' + chr(0b1010110 + 0o16) + '\x65')('\165' + chr(0b1100001 + 0o23) + chr(0b111011 + 0o53) + chr(45) + chr(56)))([lMKniTbgIhg2]):
return FjcovgoHM1LG * bGSDGpa5hkiT
if KPd4IghLrj_2:
YpO0BcZ6fMsf = GAT5rbAQQbkg()
else:
YpO0BcZ6fMsf = IDJ2eXGCBCDu.cond(KPd4IghLrj_2, GAT5rbAQQbkg, lambda : FjcovgoHM1LG * bGSDGpa5hkiT)
pd3lxn9vqWxp = IDJ2eXGCBCDu.reshape(fu_DLUnq0Rui, QQEXXbdZyz6m[:-ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + '\x31', 8)] + [X1eo1equXaXT])
return (pd3lxn9vqWxp, YpO0BcZ6fMsf, _NvIcr6svyB8)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
vq_loss
|
def vq_loss(x,
targets,
codebook_size,
beta=0.25,
decay=0.999,
epsilon=1e-5,
soft_em=False,
num_samples=10,
temperature=None,
do_update=True):
"""Compute the loss of large vocab tensors using a VQAE codebook.
Args:
x: Tensor of inputs to be quantized to nearest code
targets: Tensor of target indices to target codes
codebook_size: Size of quantization codebook
beta: scalar float for moving averages
decay: scalar float for moving averages
epsilon: scalar float for moving averages
soft_em: boolean, whether to apply a soft sampling procedure
num_samples: if soft_em, number of samples to take
temperature: temperature if we want to sample nearest neighbors or None
do_update: whether to update the means; True by default, can be a Tensor
Returns:
discrete_x: one-hot Tensor indicating which codebook element is closest to x
x_means: Tensor, on the forward pass: closest codebook element to x, on the
backwards pass: soft convex-combination of codebook elements by proximity
to x
target_means: the codebook elements corresponding to the targets
code_loss: loss driving x closer to its nearest codebook element
targets_loss: cross-entropy loss driving x closer to code corresponding to
target
"""
x_shape = common_layers.shape_list(x)
target_shape = common_layers.shape_list(targets)
hidden_size = x_shape[-1]
means, _, _ = get_vq_codebook(codebook_size, hidden_size)
x = tf.reshape(x, [-1, hidden_size])
targets = tf.reshape(targets, [-1])
one_hot_targets = tf.one_hot(targets, codebook_size)
target_means = tf.matmul(one_hot_targets, means)
discrete_x, code_loss, distances = vq_body(
x,
codebook_size,
beta=beta,
decay=decay,
epsilon=epsilon,
soft_em=soft_em,
num_samples=num_samples,
temperature=temperature,
do_update=do_update)
logits = -distances
targets_loss = tf.losses.sparse_softmax_cross_entropy(
logits=logits, labels=targets)
targets_loss = tf.reduce_mean(targets_loss)
x_means = tf.matmul(discrete_x, means)
x_means = x + tf.stop_gradient(x_means - x)
discrete_x = tf.reshape(discrete_x, x_shape[:-1] + [codebook_size])
target_means = tf.reshape(target_means, target_shape + [hidden_size])
return discrete_x, x_means, target_means, code_loss, targets_loss
|
python
|
def vq_loss(x,
targets,
codebook_size,
beta=0.25,
decay=0.999,
epsilon=1e-5,
soft_em=False,
num_samples=10,
temperature=None,
do_update=True):
"""Compute the loss of large vocab tensors using a VQAE codebook.
Args:
x: Tensor of inputs to be quantized to nearest code
targets: Tensor of target indices to target codes
codebook_size: Size of quantization codebook
beta: scalar float for moving averages
decay: scalar float for moving averages
epsilon: scalar float for moving averages
soft_em: boolean, whether to apply a soft sampling procedure
num_samples: if soft_em, number of samples to take
temperature: temperature if we want to sample nearest neighbors or None
do_update: whether to update the means; True by default, can be a Tensor
Returns:
discrete_x: one-hot Tensor indicating which codebook element is closest to x
x_means: Tensor, on the forward pass: closest codebook element to x, on the
backwards pass: soft convex-combination of codebook elements by proximity
to x
target_means: the codebook elements corresponding to the targets
code_loss: loss driving x closer to its nearest codebook element
targets_loss: cross-entropy loss driving x closer to code corresponding to
target
"""
x_shape = common_layers.shape_list(x)
target_shape = common_layers.shape_list(targets)
hidden_size = x_shape[-1]
means, _, _ = get_vq_codebook(codebook_size, hidden_size)
x = tf.reshape(x, [-1, hidden_size])
targets = tf.reshape(targets, [-1])
one_hot_targets = tf.one_hot(targets, codebook_size)
target_means = tf.matmul(one_hot_targets, means)
discrete_x, code_loss, distances = vq_body(
x,
codebook_size,
beta=beta,
decay=decay,
epsilon=epsilon,
soft_em=soft_em,
num_samples=num_samples,
temperature=temperature,
do_update=do_update)
logits = -distances
targets_loss = tf.losses.sparse_softmax_cross_entropy(
logits=logits, labels=targets)
targets_loss = tf.reduce_mean(targets_loss)
x_means = tf.matmul(discrete_x, means)
x_means = x + tf.stop_gradient(x_means - x)
discrete_x = tf.reshape(discrete_x, x_shape[:-1] + [codebook_size])
target_means = tf.reshape(target_means, target_shape + [hidden_size])
return discrete_x, x_means, target_means, code_loss, targets_loss
|
[
"def",
"vq_loss",
"(",
"x",
",",
"targets",
",",
"codebook_size",
",",
"beta",
"=",
"0.25",
",",
"decay",
"=",
"0.999",
",",
"epsilon",
"=",
"1e-5",
",",
"soft_em",
"=",
"False",
",",
"num_samples",
"=",
"10",
",",
"temperature",
"=",
"None",
",",
"do_update",
"=",
"True",
")",
":",
"x_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"target_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"targets",
")",
"hidden_size",
"=",
"x_shape",
"[",
"-",
"1",
"]",
"means",
",",
"_",
",",
"_",
"=",
"get_vq_codebook",
"(",
"codebook_size",
",",
"hidden_size",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"hidden_size",
"]",
")",
"targets",
"=",
"tf",
".",
"reshape",
"(",
"targets",
",",
"[",
"-",
"1",
"]",
")",
"one_hot_targets",
"=",
"tf",
".",
"one_hot",
"(",
"targets",
",",
"codebook_size",
")",
"target_means",
"=",
"tf",
".",
"matmul",
"(",
"one_hot_targets",
",",
"means",
")",
"discrete_x",
",",
"code_loss",
",",
"distances",
"=",
"vq_body",
"(",
"x",
",",
"codebook_size",
",",
"beta",
"=",
"beta",
",",
"decay",
"=",
"decay",
",",
"epsilon",
"=",
"epsilon",
",",
"soft_em",
"=",
"soft_em",
",",
"num_samples",
"=",
"num_samples",
",",
"temperature",
"=",
"temperature",
",",
"do_update",
"=",
"do_update",
")",
"logits",
"=",
"-",
"distances",
"targets_loss",
"=",
"tf",
".",
"losses",
".",
"sparse_softmax_cross_entropy",
"(",
"logits",
"=",
"logits",
",",
"labels",
"=",
"targets",
")",
"targets_loss",
"=",
"tf",
".",
"reduce_mean",
"(",
"targets_loss",
")",
"x_means",
"=",
"tf",
".",
"matmul",
"(",
"discrete_x",
",",
"means",
")",
"x_means",
"=",
"x",
"+",
"tf",
".",
"stop_gradient",
"(",
"x_means",
"-",
"x",
")",
"discrete_x",
"=",
"tf",
".",
"reshape",
"(",
"discrete_x",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"codebook_size",
"]",
")",
"target_means",
"=",
"tf",
".",
"reshape",
"(",
"target_means",
",",
"target_shape",
"+",
"[",
"hidden_size",
"]",
")",
"return",
"discrete_x",
",",
"x_means",
",",
"target_means",
",",
"code_loss",
",",
"targets_loss"
] |
Compute the loss of large vocab tensors using a VQAE codebook.
Args:
x: Tensor of inputs to be quantized to nearest code
targets: Tensor of target indices to target codes
codebook_size: Size of quantization codebook
beta: scalar float for moving averages
decay: scalar float for moving averages
epsilon: scalar float for moving averages
soft_em: boolean, whether to apply a soft sampling procedure
num_samples: if soft_em, number of samples to take
temperature: temperature if we want to sample nearest neighbors or None
do_update: whether to update the means; True by default, can be a Tensor
Returns:
discrete_x: one-hot Tensor indicating which codebook element is closest to x
x_means: Tensor, on the forward pass: closest codebook element to x, on the
backwards pass: soft convex-combination of codebook elements by proximity
to x
target_means: the codebook elements corresponding to the targets
code_loss: loss driving x closer to its nearest codebook element
targets_loss: cross-entropy loss driving x closer to code corresponding to
target
|
[
"Compute",
"the",
"loss",
"of",
"large",
"vocab",
"tensors",
"using",
"a",
"VQAE",
"codebook",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L1007-L1071
|
train
|
Compute the loss of large vocab tensors using a VQAE codebook.
|
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('\x30' + '\x6f' + chr(2400 - 2350) + chr(0b101110 + 0o4) + chr(0b10101 + 0o36), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(0b101010 + 0o11) + chr(2064 - 2010) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100 + 0o56) + '\x37' + chr(1554 - 1503), 31419 - 31411), ehT0Px3KOsy9('\060' + chr(5366 - 5255) + chr(51) + chr(536 - 488) + chr(0b101001 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b110110 + 0o71) + chr(0b1101 + 0o46) + '\x35' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b100 + 0o55) + chr(1662 - 1610) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\066' + '\x35', 61060 - 61052), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110110) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10011 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + chr(1667 - 1556) + chr(878 - 827) + chr(0b110000) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(10002 - 9891) + chr(0b101001 + 0o12) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(51) + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + chr(1928 - 1879) + '\061' + chr(0b100011 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b110010) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1011 + 0o47) + '\061' + chr(0b110100), 48273 - 48265), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(51) + chr(0b110010), 52231 - 52223), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(54) + chr(0b10110 + 0o33), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\066' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(2062 - 2014) + chr(0b1101111) + chr(49) + chr(764 - 709) + chr(0b110101), 56522 - 56514), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110 + 0o52) + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9('\x30' + chr(9404 - 9293) + chr(0b101101 + 0o4) + chr(0b110100) + chr(422 - 369), 0b1000), ehT0Px3KOsy9(chr(2081 - 2033) + chr(6855 - 6744) + '\x33' + '\066' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1321 - 1273) + chr(0b1101111) + chr(49) + '\062' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101000 + 0o15) + chr(0b110101), 62011 - 62003), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(7048 - 6937) + '\x34', 29089 - 29081), ehT0Px3KOsy9(chr(913 - 865) + chr(0b10111 + 0o130) + '\062' + chr(50), 27475 - 27467), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(611 - 561) + chr(49) + chr(0b100001 + 0o17), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10350 - 10239) + chr(0b11100 + 0o25) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(626 - 577) + '\062' + chr(0b100111 + 0o14), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + chr(51) + chr(51) + chr(391 - 341), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11111 + 0o120) + chr(0b110010) + chr(791 - 738) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1812 - 1762) + chr(0b110011) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2053 - 2002) + chr(1527 - 1477) + chr(1288 - 1235), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + chr(49) + '\x34' + chr(1596 - 1544), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2240 - 2129) + '\x33' + chr(0b100111 + 0o16) + '\063', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(8697 - 8586) + '\062' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101001 + 0o10) + chr(0b110111) + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001000 + 0o47) + '\x31' + chr(0b110010) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1967 - 1919) + chr(0b111011 + 0o64) + '\x32' + chr(55) + chr(0b10 + 0o56), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(53) + '\x37', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + '\065' + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd'), chr(0b1000110 + 0o36) + '\145' + chr(8083 - 7984) + '\x6f' + chr(2261 - 2161) + chr(0b1100101))(chr(0b11100 + 0o131) + '\164' + chr(0b1001000 + 0o36) + chr(0b101101) + chr(0b1101 + 0o53)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RPCJvuWDjKBx(OeWW0F1dBPRQ, xIEmRseySp3z, X1eo1equXaXT, FjcovgoHM1LG=0.25, eeyC5_0F9WOf=0.999, Xtig2zAKpR0T=1e-05, sjb7MZHDGfYq=ehT0Px3KOsy9('\060' + chr(4822 - 4711) + '\060', 15186 - 15178), Wuetkhsbidt0=ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b110010), ord("\x08")), uICaXvjWrxGa=None, KPd4IghLrj_2=ehT0Px3KOsy9(chr(633 - 585) + '\x6f' + chr(0b110001), 0o10)):
QQEXXbdZyz6m = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
nk7Ena0OgGVQ = jSKPaHwSAfVv.shape_list(xIEmRseySp3z)
qzoyXN3kdhDL = QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(48) + chr(225 - 114) + chr(0b11111 + 0o22), 8)]
(XCAIkNRdiX0I, VNGQdHSFPrso, VNGQdHSFPrso) = ydI5SANw_p5d(X1eo1equXaXT, qzoyXN3kdhDL)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(698 - 649), 8), qzoyXN3kdhDL])
xIEmRseySp3z = IDJ2eXGCBCDu.reshape(xIEmRseySp3z, [-ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 8)])
fHDoaZCs9RRi = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(xIEmRseySp3z, X1eo1equXaXT)
oAg3t8J4YoaT = IDJ2eXGCBCDu.matmul(fHDoaZCs9RRi, XCAIkNRdiX0I)
(CKX3wOZw9CZ0, wGC6NL52U25e, _NvIcr6svyB8) = N49LSkm2h4zv(OeWW0F1dBPRQ, X1eo1equXaXT, beta=FjcovgoHM1LG, decay=eeyC5_0F9WOf, epsilon=Xtig2zAKpR0T, soft_em=sjb7MZHDGfYq, num_samples=Wuetkhsbidt0, temperature=uICaXvjWrxGa, do_update=KPd4IghLrj_2)
wF9nmvjsKjYM = -_NvIcr6svyB8
_G7tKUzC8sU3 = IDJ2eXGCBCDu.losses.sparse_softmax_cross_entropy(logits=wF9nmvjsKjYM, labels=xIEmRseySp3z)
_G7tKUzC8sU3 = IDJ2eXGCBCDu.reduce_mean(_G7tKUzC8sU3)
xPgmXL9DQrWF = IDJ2eXGCBCDu.matmul(CKX3wOZw9CZ0, XCAIkNRdiX0I)
xPgmXL9DQrWF = OeWW0F1dBPRQ + IDJ2eXGCBCDu.stop_gradient(xPgmXL9DQrWF - OeWW0F1dBPRQ)
CKX3wOZw9CZ0 = IDJ2eXGCBCDu.reshape(CKX3wOZw9CZ0, QQEXXbdZyz6m[:-ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001), 8)] + [X1eo1equXaXT])
oAg3t8J4YoaT = IDJ2eXGCBCDu.reshape(oAg3t8J4YoaT, nk7Ena0OgGVQ + [qzoyXN3kdhDL])
return (CKX3wOZw9CZ0, xPgmXL9DQrWF, oAg3t8J4YoaT, wGC6NL52U25e, _G7tKUzC8sU3)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
vq_discrete_unbottleneck
|
def vq_discrete_unbottleneck(x, hidden_size):
"""Simple undiscretization from vector quantized representation."""
x_shape = common_layers.shape_list(x)
x = tf.to_float(x)
bottleneck_size = common_layers.shape_list(x)[-1]
means, _, _ = get_vq_codebook(bottleneck_size, hidden_size)
result = tf.matmul(tf.reshape(x, [-1, x_shape[-1]]), means)
return tf.reshape(result, x_shape[:-1] + [hidden_size])
|
python
|
def vq_discrete_unbottleneck(x, hidden_size):
"""Simple undiscretization from vector quantized representation."""
x_shape = common_layers.shape_list(x)
x = tf.to_float(x)
bottleneck_size = common_layers.shape_list(x)[-1]
means, _, _ = get_vq_codebook(bottleneck_size, hidden_size)
result = tf.matmul(tf.reshape(x, [-1, x_shape[-1]]), means)
return tf.reshape(result, x_shape[:-1] + [hidden_size])
|
[
"def",
"vq_discrete_unbottleneck",
"(",
"x",
",",
"hidden_size",
")",
":",
"x_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"to_float",
"(",
"x",
")",
"bottleneck_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"[",
"-",
"1",
"]",
"means",
",",
"_",
",",
"_",
"=",
"get_vq_codebook",
"(",
"bottleneck_size",
",",
"hidden_size",
")",
"result",
"=",
"tf",
".",
"matmul",
"(",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
",",
"means",
")",
"return",
"tf",
".",
"reshape",
"(",
"result",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"hidden_size",
"]",
")"
] |
Simple undiscretization from vector quantized representation.
|
[
"Simple",
"undiscretization",
"from",
"vector",
"quantized",
"representation",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L1074-L1081
|
train
|
Simple undiscretization from vector quantized representation.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9Dhh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zcpInYwBvYW,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('\060' + chr(0b111110 + 0o61) + '\062' + chr(0b110011), 46626 - 46618), ehT0Px3KOsy9('\060' + chr(111) + chr(621 - 570) + chr(0b110101) + chr(1224 - 1174), 42989 - 42981), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(586 - 535) + chr(0b101001 + 0o12) + chr(0b1000 + 0o50), 10991 - 10983), ehT0Px3KOsy9(chr(597 - 549) + chr(0b1100000 + 0o17) + chr(0b100110 + 0o14) + chr(0b11011 + 0o34) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b101110 + 0o11) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + chr(49) + chr(0b10111 + 0o31) + chr(53), 54500 - 54492), ehT0Px3KOsy9('\060' + chr(11691 - 11580) + chr(1697 - 1647) + chr(1423 - 1373) + chr(0b0 + 0o67), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x30', 0o10), ehT0Px3KOsy9(chr(2116 - 2068) + chr(111) + chr(0b101000 + 0o13) + '\062' + '\x35', 0o10), ehT0Px3KOsy9(chr(1760 - 1712) + chr(111) + '\061' + '\063' + chr(0b101010 + 0o11), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1787 - 1739) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(844 - 796) + chr(111) + chr(0b11 + 0o60) + '\x32' + chr(0b110010), 38463 - 38455), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(1095 - 1043) + chr(0b101 + 0o57), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1101 + 0o44) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(413 - 365) + chr(111) + chr(0b110001) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(49) + chr(55) + chr(101 - 53), 1040 - 1032), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b110110) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(10355 - 10244) + chr(0b100 + 0o55) + chr(48) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b110011) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(54) + chr(0b11111 + 0o24), 10132 - 10124), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b110111) + '\066', 6235 - 6227), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1000 + 0o52) + chr(0b110110) + chr(1365 - 1315), 8), ehT0Px3KOsy9('\x30' + chr(2758 - 2647) + '\x31' + chr(0b110101) + '\x30', 55518 - 55510), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(9895 - 9784) + chr(587 - 535) + chr(2214 - 2161), 0b1000), ehT0Px3KOsy9(chr(1064 - 1016) + '\157' + chr(0b100001 + 0o20) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(54) + chr(2770 - 2716), 4849 - 4841), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1111 + 0o42) + '\x37' + '\062', 8), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b10111 + 0o32) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100011 + 0o14) + chr(54) + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(10434 - 10323) + chr(647 - 597) + '\x35' + chr(1348 - 1300), 12332 - 12324), ehT0Px3KOsy9(chr(1780 - 1732) + chr(111) + chr(0b1 + 0o61) + chr(2634 - 2581) + chr(1958 - 1903), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b10011 + 0o36) + '\x30', 28635 - 28627), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b110 + 0o151) + chr(0b101011 + 0o6) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(52) + '\061', 0b1000), ehT0Px3KOsy9(chr(1893 - 1845) + chr(6428 - 6317) + '\062' + chr(2609 - 2555) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(9892 - 9781) + chr(0b100011 + 0o23) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b11111 + 0o120) + chr(0b100011 + 0o20) + chr(52) + '\x30', 0o10), ehT0Px3KOsy9(chr(1169 - 1121) + chr(2570 - 2459) + '\063' + chr(0b110111) + chr(2284 - 2236), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(115 - 65), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(358 - 247) + '\065' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'='), '\144' + '\x65' + '\143' + '\157' + '\x64' + chr(0b1100101))(chr(839 - 722) + chr(0b1110100) + '\146' + chr(45) + chr(2555 - 2499)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ix49FQPz8XkJ(OeWW0F1dBPRQ, qzoyXN3kdhDL):
QQEXXbdZyz6m = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.to_float(OeWW0F1dBPRQ)
MyjCWd_3JWq1 = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)[-ehT0Px3KOsy9(chr(2270 - 2222) + chr(0b1001111 + 0o40) + '\x31', 0o10)]
(XCAIkNRdiX0I, VNGQdHSFPrso, VNGQdHSFPrso) = ydI5SANw_p5d(MyjCWd_3JWq1, qzoyXN3kdhDL)
ShZmEKfTkAOZ = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(1377 - 1329) + chr(0b1101111) + '\x31', 8), QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b110000 + 0o77) + chr(49), 8)]]), XCAIkNRdiX0I)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'a\x8f\xab\xd6\x1b5\xf2'), chr(0b1001110 + 0o26) + chr(3165 - 3064) + chr(0b1100011) + chr(111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1100110) + '\x2d' + '\070'))(ShZmEKfTkAOZ, QQEXXbdZyz6m[:-ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b110110 + 0o71) + chr(0b11101 + 0o24), 8)] + [qzoyXN3kdhDL])
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
gumbel_softmax_nearest_neighbor_dvq
|
def gumbel_softmax_nearest_neighbor_dvq(x,
means,
block_v_size,
hard=False,
temperature_init=1.2,
num_samples=1,
temperature_warmup_steps=150000,
summary=True,
num_flows=0,
approximate_gs_entropy=False,
sum_over_latents=False):
"""Sample from Gumbel-Softmax and compute neighbors and losses.
Args:
x: A `float`-like `Tensor` of shape [batch_size, latent_dim, num_blocks,
block_dim] containing the latent vectors to be compared to the codebook.
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
block_v_size: Number of discrete codes per block.
hard: Determines whether we take hard or soft Gumbel-Softmax samples
(Default: False).
temperature_init: Initial temperature used for Gumbel-Softmax samples,
after it which it decays to 0 (Default: 1.2).
num_samples: Number of samples drawn for each latent (Default: 1).
temperature_warmup_steps: Number of steps it takes to decay temperature to 0
(Default: 150000).
summary: When `True`, we save histogram summaries of the KL term (Default:
True).
num_flows: Number of inverse autoregressive flows with Gumbel-Softmax
samples.
approximate_gs_entropy: When `True`, we approximate Gumbel-Softmax
density as categorical when calculating sample entropy (Default: False).
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss.
Returns:
x_means_assignments: A `float`-like `Tensor` containing the codebook
assignments, averaged over samples, with shape [batch_size * latent_dim,
num_blocks, block_v_size].
neg_q_entropy: The negative entropy of the variational distribution,
averaged over samples.
"""
batch_size, latent_dim, num_blocks, block_dim = common_layers.shape_list(x)
# Combine latent_dim and batch_size for computing distances.
x = tf.reshape(x, [-1, num_blocks, block_dim])
# Compute distances using (x - means)**2 = x**2 + means**2 - 2*x*means.
x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keepdims=True)
means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keepdims=True)
means_norm_sq = tf.transpose(means_norm_sq, perm=[2, 0, 1])
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 + means_norm_sq - 2 * scalar_prod
# IAF requires latents to have their own dimension, so reshape dist from
# [batch_size * latent_dim, num_blocks, block_v_size] to
# [batch_size * num_blocks, latent_dim, block_v_size].
dist = tf.reshape(dist, [batch_size, latent_dim, num_blocks, -1])
dist = tf.reshape(
tf.transpose(dist, perm=[0, 2, 1, 3]), [-1, latent_dim, block_v_size])
log_class_probs = tf.nn.log_softmax(-dist)
sample_shape = [num_samples] + common_layers.shape_list(dist)
gumbel_samples = gumbel_sample(sample_shape)
# Temperature decays linearly.
temperature = temperature_init - common_layers.inverse_lin_decay(
temperature_warmup_steps)
# 10% of the time keep reasonably high temperature to keep learning.
temperature = tf.cond(
tf.less(tf.random_uniform([]), 0.9), lambda: temperature,
lambda: tf.random_uniform([], minval=0.5, maxval=1.0))
gumbel_softmax_samples = tf.nn.softmax(
(tf.expand_dims(log_class_probs, 0) + gumbel_samples) / temperature)
q_samples = tf.clip_by_value(gumbel_softmax_samples, 1e-6, 1 - 1e-6)
if approximate_gs_entropy:
q_dist = tfp.distributions.Multinomial(total_count=1.0, logits=-dist)
else:
q_dist = tfp.distributions.RelaxedOneHotCategorical(
temperature, logits=-dist)
# Take mean over samples to approximate entropy.
neg_q_entropy = tf.reduce_mean(q_dist.log_prob(q_samples), 0)
if summary:
tf.summary.histogram("neg_q_entropy", tf.reshape(neg_q_entropy, [-1]))
if sum_over_latents:
neg_q_entropy = tf.reshape(neg_q_entropy,
[batch_size, num_blocks, latent_dim])
neg_q_entropy = tf.reduce_sum(neg_q_entropy, [1, 2])
neg_q_entropy = tf.reduce_mean(neg_q_entropy)
if num_flows > 0:
hparams = iaf_hparams(hidden_size=512, filter_size=4096)
q_samples = tf.reshape(q_samples, [-1, latent_dim, block_v_size])
for flow in range(num_flows):
shifted_samples = tf.pad(q_samples, [[0, 0], [1, 0], [0, 0]])[:, :-1, :]
# Project samples from [batch_size, latent_size, block_v_size] to
# [batch_size, latent_size, hidden_size].
shifted_samples = common_layers.dense(shifted_samples,
hparams.hidden_size)
# TODO(vafa): Include masking as a flag.
mask = True
if mask:
attention_type = cia.AttentionType.LOCAL_1D
else:
attention_type = cia.AttentionType.GLOBAL
ffn_output = cia.transformer_decoder_layers(
inputs=shifted_samples,
encoder_output=None,
num_layers=6,
hparams=hparams,
attention_type=attention_type,
name="transformer_" + str(flow))
# Project samples back to [batch_size, latent_size, block_v_size].
ffn_output = common_layers.dense(ffn_output, block_v_size)
log_pi = tf.nn.log_softmax(ffn_output)
# Flow 1: Adding log_pi to q_samples and dividing by the temperature.
# Note that we drop the last dimension of q_samples for centered-softmax,
# which we can do without recalculating probabilities because the last
# dimension of log_pi and q_samples are deterministic given the others.
# Flow 2: Centered-softmax.
chained_bijectors = tfp.bijectors.Chain([
tfp.bijectors.SoftmaxCentered(),
tfp.bijectors.Affine(
shift=log_pi[:, :, :-1],
scale_identity_multiplier=1. / temperature)
])
q_samples = chained_bijectors.forward(q_samples[:, :, :-1])
log_det = chained_bijectors.inverse_log_det_jacobian(
q_samples, event_ndims=1)
log_det = tf.reshape(log_det,
[num_samples, batch_size, num_blocks, latent_dim])
if sum_over_latents:
log_det = tf.reduce_sum(log_det, axis=[2, 3])
neg_q_entropy += tf.reduce_mean(log_det)
q_samples = tf.reshape(
q_samples,
[num_samples, batch_size * num_blocks, latent_dim, block_v_size])
if hard:
x_means_idx = tf.argmax(q_samples, -1)
# Take average of one-hot vectors over samples.
x_means_hot = tf.reduce_mean(tf.one_hot(x_means_idx, block_v_size), 0)
x_means_assignments = (
tf.reduce_mean(q_samples, 0) +
tf.stop_gradient(x_means_hot - tf.reduce_mean(q_samples, 0)))
else:
x_means_assignments = tf.reduce_mean(gumbel_softmax_samples, 0)
# Reshape assignments to [batch_size * latent_dim, num_blocks,
# block_v_size]. We have to transpose between reshapes to make sure the
# dimensions have the correct interpretation.
x_means_assignments = tf.reshape(
x_means_assignments, [batch_size, num_blocks, latent_dim, block_v_size])
x_means_assignments = tf.transpose(x_means_assignments, [0, 2, 1, 3])
x_means_assignments = tf.reshape(
x_means_assignments, [batch_size * latent_dim, num_blocks, block_v_size])
return x_means_assignments, neg_q_entropy
|
python
|
def gumbel_softmax_nearest_neighbor_dvq(x,
means,
block_v_size,
hard=False,
temperature_init=1.2,
num_samples=1,
temperature_warmup_steps=150000,
summary=True,
num_flows=0,
approximate_gs_entropy=False,
sum_over_latents=False):
"""Sample from Gumbel-Softmax and compute neighbors and losses.
Args:
x: A `float`-like `Tensor` of shape [batch_size, latent_dim, num_blocks,
block_dim] containing the latent vectors to be compared to the codebook.
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
block_v_size: Number of discrete codes per block.
hard: Determines whether we take hard or soft Gumbel-Softmax samples
(Default: False).
temperature_init: Initial temperature used for Gumbel-Softmax samples,
after it which it decays to 0 (Default: 1.2).
num_samples: Number of samples drawn for each latent (Default: 1).
temperature_warmup_steps: Number of steps it takes to decay temperature to 0
(Default: 150000).
summary: When `True`, we save histogram summaries of the KL term (Default:
True).
num_flows: Number of inverse autoregressive flows with Gumbel-Softmax
samples.
approximate_gs_entropy: When `True`, we approximate Gumbel-Softmax
density as categorical when calculating sample entropy (Default: False).
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss.
Returns:
x_means_assignments: A `float`-like `Tensor` containing the codebook
assignments, averaged over samples, with shape [batch_size * latent_dim,
num_blocks, block_v_size].
neg_q_entropy: The negative entropy of the variational distribution,
averaged over samples.
"""
batch_size, latent_dim, num_blocks, block_dim = common_layers.shape_list(x)
# Combine latent_dim and batch_size for computing distances.
x = tf.reshape(x, [-1, num_blocks, block_dim])
# Compute distances using (x - means)**2 = x**2 + means**2 - 2*x*means.
x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keepdims=True)
means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keepdims=True)
means_norm_sq = tf.transpose(means_norm_sq, perm=[2, 0, 1])
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 + means_norm_sq - 2 * scalar_prod
# IAF requires latents to have their own dimension, so reshape dist from
# [batch_size * latent_dim, num_blocks, block_v_size] to
# [batch_size * num_blocks, latent_dim, block_v_size].
dist = tf.reshape(dist, [batch_size, latent_dim, num_blocks, -1])
dist = tf.reshape(
tf.transpose(dist, perm=[0, 2, 1, 3]), [-1, latent_dim, block_v_size])
log_class_probs = tf.nn.log_softmax(-dist)
sample_shape = [num_samples] + common_layers.shape_list(dist)
gumbel_samples = gumbel_sample(sample_shape)
# Temperature decays linearly.
temperature = temperature_init - common_layers.inverse_lin_decay(
temperature_warmup_steps)
# 10% of the time keep reasonably high temperature to keep learning.
temperature = tf.cond(
tf.less(tf.random_uniform([]), 0.9), lambda: temperature,
lambda: tf.random_uniform([], minval=0.5, maxval=1.0))
gumbel_softmax_samples = tf.nn.softmax(
(tf.expand_dims(log_class_probs, 0) + gumbel_samples) / temperature)
q_samples = tf.clip_by_value(gumbel_softmax_samples, 1e-6, 1 - 1e-6)
if approximate_gs_entropy:
q_dist = tfp.distributions.Multinomial(total_count=1.0, logits=-dist)
else:
q_dist = tfp.distributions.RelaxedOneHotCategorical(
temperature, logits=-dist)
# Take mean over samples to approximate entropy.
neg_q_entropy = tf.reduce_mean(q_dist.log_prob(q_samples), 0)
if summary:
tf.summary.histogram("neg_q_entropy", tf.reshape(neg_q_entropy, [-1]))
if sum_over_latents:
neg_q_entropy = tf.reshape(neg_q_entropy,
[batch_size, num_blocks, latent_dim])
neg_q_entropy = tf.reduce_sum(neg_q_entropy, [1, 2])
neg_q_entropy = tf.reduce_mean(neg_q_entropy)
if num_flows > 0:
hparams = iaf_hparams(hidden_size=512, filter_size=4096)
q_samples = tf.reshape(q_samples, [-1, latent_dim, block_v_size])
for flow in range(num_flows):
shifted_samples = tf.pad(q_samples, [[0, 0], [1, 0], [0, 0]])[:, :-1, :]
# Project samples from [batch_size, latent_size, block_v_size] to
# [batch_size, latent_size, hidden_size].
shifted_samples = common_layers.dense(shifted_samples,
hparams.hidden_size)
# TODO(vafa): Include masking as a flag.
mask = True
if mask:
attention_type = cia.AttentionType.LOCAL_1D
else:
attention_type = cia.AttentionType.GLOBAL
ffn_output = cia.transformer_decoder_layers(
inputs=shifted_samples,
encoder_output=None,
num_layers=6,
hparams=hparams,
attention_type=attention_type,
name="transformer_" + str(flow))
# Project samples back to [batch_size, latent_size, block_v_size].
ffn_output = common_layers.dense(ffn_output, block_v_size)
log_pi = tf.nn.log_softmax(ffn_output)
# Flow 1: Adding log_pi to q_samples and dividing by the temperature.
# Note that we drop the last dimension of q_samples for centered-softmax,
# which we can do without recalculating probabilities because the last
# dimension of log_pi and q_samples are deterministic given the others.
# Flow 2: Centered-softmax.
chained_bijectors = tfp.bijectors.Chain([
tfp.bijectors.SoftmaxCentered(),
tfp.bijectors.Affine(
shift=log_pi[:, :, :-1],
scale_identity_multiplier=1. / temperature)
])
q_samples = chained_bijectors.forward(q_samples[:, :, :-1])
log_det = chained_bijectors.inverse_log_det_jacobian(
q_samples, event_ndims=1)
log_det = tf.reshape(log_det,
[num_samples, batch_size, num_blocks, latent_dim])
if sum_over_latents:
log_det = tf.reduce_sum(log_det, axis=[2, 3])
neg_q_entropy += tf.reduce_mean(log_det)
q_samples = tf.reshape(
q_samples,
[num_samples, batch_size * num_blocks, latent_dim, block_v_size])
if hard:
x_means_idx = tf.argmax(q_samples, -1)
# Take average of one-hot vectors over samples.
x_means_hot = tf.reduce_mean(tf.one_hot(x_means_idx, block_v_size), 0)
x_means_assignments = (
tf.reduce_mean(q_samples, 0) +
tf.stop_gradient(x_means_hot - tf.reduce_mean(q_samples, 0)))
else:
x_means_assignments = tf.reduce_mean(gumbel_softmax_samples, 0)
# Reshape assignments to [batch_size * latent_dim, num_blocks,
# block_v_size]. We have to transpose between reshapes to make sure the
# dimensions have the correct interpretation.
x_means_assignments = tf.reshape(
x_means_assignments, [batch_size, num_blocks, latent_dim, block_v_size])
x_means_assignments = tf.transpose(x_means_assignments, [0, 2, 1, 3])
x_means_assignments = tf.reshape(
x_means_assignments, [batch_size * latent_dim, num_blocks, block_v_size])
return x_means_assignments, neg_q_entropy
|
[
"def",
"gumbel_softmax_nearest_neighbor_dvq",
"(",
"x",
",",
"means",
",",
"block_v_size",
",",
"hard",
"=",
"False",
",",
"temperature_init",
"=",
"1.2",
",",
"num_samples",
"=",
"1",
",",
"temperature_warmup_steps",
"=",
"150000",
",",
"summary",
"=",
"True",
",",
"num_flows",
"=",
"0",
",",
"approximate_gs_entropy",
"=",
"False",
",",
"sum_over_latents",
"=",
"False",
")",
":",
"batch_size",
",",
"latent_dim",
",",
"num_blocks",
",",
"block_dim",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"# Combine latent_dim and batch_size for computing distances.",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"num_blocks",
",",
"block_dim",
"]",
")",
"# Compute distances using (x - means)**2 = x**2 + means**2 - 2*x*means.",
"x_norm_sq",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"x",
")",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"means_norm_sq",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"means",
")",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"means_norm_sq",
"=",
"tf",
".",
"transpose",
"(",
"means_norm_sq",
",",
"perm",
"=",
"[",
"2",
",",
"0",
",",
"1",
"]",
")",
"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",
"+",
"means_norm_sq",
"-",
"2",
"*",
"scalar_prod",
"# IAF requires latents to have their own dimension, so reshape dist from",
"# [batch_size * latent_dim, num_blocks, block_v_size] to",
"# [batch_size * num_blocks, latent_dim, block_v_size].",
"dist",
"=",
"tf",
".",
"reshape",
"(",
"dist",
",",
"[",
"batch_size",
",",
"latent_dim",
",",
"num_blocks",
",",
"-",
"1",
"]",
")",
"dist",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"transpose",
"(",
"dist",
",",
"perm",
"=",
"[",
"0",
",",
"2",
",",
"1",
",",
"3",
"]",
")",
",",
"[",
"-",
"1",
",",
"latent_dim",
",",
"block_v_size",
"]",
")",
"log_class_probs",
"=",
"tf",
".",
"nn",
".",
"log_softmax",
"(",
"-",
"dist",
")",
"sample_shape",
"=",
"[",
"num_samples",
"]",
"+",
"common_layers",
".",
"shape_list",
"(",
"dist",
")",
"gumbel_samples",
"=",
"gumbel_sample",
"(",
"sample_shape",
")",
"# Temperature decays linearly.",
"temperature",
"=",
"temperature_init",
"-",
"common_layers",
".",
"inverse_lin_decay",
"(",
"temperature_warmup_steps",
")",
"# 10% of the time keep reasonably high temperature to keep learning.",
"temperature",
"=",
"tf",
".",
"cond",
"(",
"tf",
".",
"less",
"(",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
")",
",",
"0.9",
")",
",",
"lambda",
":",
"temperature",
",",
"lambda",
":",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
",",
"minval",
"=",
"0.5",
",",
"maxval",
"=",
"1.0",
")",
")",
"gumbel_softmax_samples",
"=",
"tf",
".",
"nn",
".",
"softmax",
"(",
"(",
"tf",
".",
"expand_dims",
"(",
"log_class_probs",
",",
"0",
")",
"+",
"gumbel_samples",
")",
"/",
"temperature",
")",
"q_samples",
"=",
"tf",
".",
"clip_by_value",
"(",
"gumbel_softmax_samples",
",",
"1e-6",
",",
"1",
"-",
"1e-6",
")",
"if",
"approximate_gs_entropy",
":",
"q_dist",
"=",
"tfp",
".",
"distributions",
".",
"Multinomial",
"(",
"total_count",
"=",
"1.0",
",",
"logits",
"=",
"-",
"dist",
")",
"else",
":",
"q_dist",
"=",
"tfp",
".",
"distributions",
".",
"RelaxedOneHotCategorical",
"(",
"temperature",
",",
"logits",
"=",
"-",
"dist",
")",
"# Take mean over samples to approximate entropy.",
"neg_q_entropy",
"=",
"tf",
".",
"reduce_mean",
"(",
"q_dist",
".",
"log_prob",
"(",
"q_samples",
")",
",",
"0",
")",
"if",
"summary",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"neg_q_entropy\"",
",",
"tf",
".",
"reshape",
"(",
"neg_q_entropy",
",",
"[",
"-",
"1",
"]",
")",
")",
"if",
"sum_over_latents",
":",
"neg_q_entropy",
"=",
"tf",
".",
"reshape",
"(",
"neg_q_entropy",
",",
"[",
"batch_size",
",",
"num_blocks",
",",
"latent_dim",
"]",
")",
"neg_q_entropy",
"=",
"tf",
".",
"reduce_sum",
"(",
"neg_q_entropy",
",",
"[",
"1",
",",
"2",
"]",
")",
"neg_q_entropy",
"=",
"tf",
".",
"reduce_mean",
"(",
"neg_q_entropy",
")",
"if",
"num_flows",
">",
"0",
":",
"hparams",
"=",
"iaf_hparams",
"(",
"hidden_size",
"=",
"512",
",",
"filter_size",
"=",
"4096",
")",
"q_samples",
"=",
"tf",
".",
"reshape",
"(",
"q_samples",
",",
"[",
"-",
"1",
",",
"latent_dim",
",",
"block_v_size",
"]",
")",
"for",
"flow",
"in",
"range",
"(",
"num_flows",
")",
":",
"shifted_samples",
"=",
"tf",
".",
"pad",
"(",
"q_samples",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"1",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"[",
":",
",",
":",
"-",
"1",
",",
":",
"]",
"# Project samples from [batch_size, latent_size, block_v_size] to",
"# [batch_size, latent_size, hidden_size].",
"shifted_samples",
"=",
"common_layers",
".",
"dense",
"(",
"shifted_samples",
",",
"hparams",
".",
"hidden_size",
")",
"# TODO(vafa): Include masking as a flag.",
"mask",
"=",
"True",
"if",
"mask",
":",
"attention_type",
"=",
"cia",
".",
"AttentionType",
".",
"LOCAL_1D",
"else",
":",
"attention_type",
"=",
"cia",
".",
"AttentionType",
".",
"GLOBAL",
"ffn_output",
"=",
"cia",
".",
"transformer_decoder_layers",
"(",
"inputs",
"=",
"shifted_samples",
",",
"encoder_output",
"=",
"None",
",",
"num_layers",
"=",
"6",
",",
"hparams",
"=",
"hparams",
",",
"attention_type",
"=",
"attention_type",
",",
"name",
"=",
"\"transformer_\"",
"+",
"str",
"(",
"flow",
")",
")",
"# Project samples back to [batch_size, latent_size, block_v_size].",
"ffn_output",
"=",
"common_layers",
".",
"dense",
"(",
"ffn_output",
",",
"block_v_size",
")",
"log_pi",
"=",
"tf",
".",
"nn",
".",
"log_softmax",
"(",
"ffn_output",
")",
"# Flow 1: Adding log_pi to q_samples and dividing by the temperature.",
"# Note that we drop the last dimension of q_samples for centered-softmax,",
"# which we can do without recalculating probabilities because the last",
"# dimension of log_pi and q_samples are deterministic given the others.",
"# Flow 2: Centered-softmax.",
"chained_bijectors",
"=",
"tfp",
".",
"bijectors",
".",
"Chain",
"(",
"[",
"tfp",
".",
"bijectors",
".",
"SoftmaxCentered",
"(",
")",
",",
"tfp",
".",
"bijectors",
".",
"Affine",
"(",
"shift",
"=",
"log_pi",
"[",
":",
",",
":",
",",
":",
"-",
"1",
"]",
",",
"scale_identity_multiplier",
"=",
"1.",
"/",
"temperature",
")",
"]",
")",
"q_samples",
"=",
"chained_bijectors",
".",
"forward",
"(",
"q_samples",
"[",
":",
",",
":",
",",
":",
"-",
"1",
"]",
")",
"log_det",
"=",
"chained_bijectors",
".",
"inverse_log_det_jacobian",
"(",
"q_samples",
",",
"event_ndims",
"=",
"1",
")",
"log_det",
"=",
"tf",
".",
"reshape",
"(",
"log_det",
",",
"[",
"num_samples",
",",
"batch_size",
",",
"num_blocks",
",",
"latent_dim",
"]",
")",
"if",
"sum_over_latents",
":",
"log_det",
"=",
"tf",
".",
"reduce_sum",
"(",
"log_det",
",",
"axis",
"=",
"[",
"2",
",",
"3",
"]",
")",
"neg_q_entropy",
"+=",
"tf",
".",
"reduce_mean",
"(",
"log_det",
")",
"q_samples",
"=",
"tf",
".",
"reshape",
"(",
"q_samples",
",",
"[",
"num_samples",
",",
"batch_size",
"*",
"num_blocks",
",",
"latent_dim",
",",
"block_v_size",
"]",
")",
"if",
"hard",
":",
"x_means_idx",
"=",
"tf",
".",
"argmax",
"(",
"q_samples",
",",
"-",
"1",
")",
"# Take average of one-hot vectors over samples.",
"x_means_hot",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"one_hot",
"(",
"x_means_idx",
",",
"block_v_size",
")",
",",
"0",
")",
"x_means_assignments",
"=",
"(",
"tf",
".",
"reduce_mean",
"(",
"q_samples",
",",
"0",
")",
"+",
"tf",
".",
"stop_gradient",
"(",
"x_means_hot",
"-",
"tf",
".",
"reduce_mean",
"(",
"q_samples",
",",
"0",
")",
")",
")",
"else",
":",
"x_means_assignments",
"=",
"tf",
".",
"reduce_mean",
"(",
"gumbel_softmax_samples",
",",
"0",
")",
"# Reshape assignments to [batch_size * latent_dim, num_blocks,",
"# block_v_size]. We have to transpose between reshapes to make sure the",
"# dimensions have the correct interpretation.",
"x_means_assignments",
"=",
"tf",
".",
"reshape",
"(",
"x_means_assignments",
",",
"[",
"batch_size",
",",
"num_blocks",
",",
"latent_dim",
",",
"block_v_size",
"]",
")",
"x_means_assignments",
"=",
"tf",
".",
"transpose",
"(",
"x_means_assignments",
",",
"[",
"0",
",",
"2",
",",
"1",
",",
"3",
"]",
")",
"x_means_assignments",
"=",
"tf",
".",
"reshape",
"(",
"x_means_assignments",
",",
"[",
"batch_size",
"*",
"latent_dim",
",",
"num_blocks",
",",
"block_v_size",
"]",
")",
"return",
"x_means_assignments",
",",
"neg_q_entropy"
] |
Sample from Gumbel-Softmax and compute neighbors and losses.
Args:
x: A `float`-like `Tensor` of shape [batch_size, latent_dim, num_blocks,
block_dim] containing the latent vectors to be compared to the codebook.
means: Embedding table of shape [num_blocks, block_v_size, block_dim].
block_v_size: Number of discrete codes per block.
hard: Determines whether we take hard or soft Gumbel-Softmax samples
(Default: False).
temperature_init: Initial temperature used for Gumbel-Softmax samples,
after it which it decays to 0 (Default: 1.2).
num_samples: Number of samples drawn for each latent (Default: 1).
temperature_warmup_steps: Number of steps it takes to decay temperature to 0
(Default: 150000).
summary: When `True`, we save histogram summaries of the KL term (Default:
True).
num_flows: Number of inverse autoregressive flows with Gumbel-Softmax
samples.
approximate_gs_entropy: When `True`, we approximate Gumbel-Softmax
density as categorical when calculating sample entropy (Default: False).
sum_over_latents: Whether to sum over non-batch dimensions when calculating
negative entropy loss.
Returns:
x_means_assignments: A `float`-like `Tensor` containing the codebook
assignments, averaged over samples, with shape [batch_size * latent_dim,
num_blocks, block_v_size].
neg_q_entropy: The negative entropy of the variational distribution,
averaged over samples.
|
[
"Sample",
"from",
"Gumbel",
"-",
"Softmax",
"and",
"compute",
"neighbors",
"and",
"losses",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L1084-L1251
|
train
|
Sample from Gumbel - Softmax and compute neighbors and losses.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWA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ithmeticError,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(0b110010) + '\063' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + '\x30' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(0b100110 + 0o12), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + '\065' + chr(49), 22307 - 22299), ehT0Px3KOsy9(chr(1535 - 1487) + chr(345 - 234) + '\062' + '\063' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\060', 24528 - 24520), ehT0Px3KOsy9(chr(48) + '\157' + '\x37' + chr(0b10 + 0o61), 52415 - 52407), ehT0Px3KOsy9(chr(1070 - 1022) + chr(0b1100011 + 0o14) + '\067' + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11100 + 0o25) + '\x32' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b110010) + chr(606 - 554), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(1237 - 1183) + chr(53), 0b1000), ehT0Px3KOsy9(chr(162 - 114) + chr(8071 - 7960) + chr(51) + chr(50) + chr(1720 - 1665), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x32' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(10953 - 10842) + chr(1854 - 1803) + chr(0b110110) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(1292 - 1242) + chr(0b11001 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1100001 + 0o16) + chr(0b110001) + chr(1141 - 1086) + chr(1878 - 1828), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101011 + 0o6) + chr(55) + '\062', 8), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b10100 + 0o133) + chr(0b1110 + 0o44) + chr(0b110101) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1110 + 0o141) + '\x32' + chr(52) + '\064', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + '\062' + chr(0b100 + 0o57) + '\060', 8), ehT0Px3KOsy9(chr(48) + chr(2601 - 2490) + '\063' + '\x35' + '\061', 8), ehT0Px3KOsy9(chr(160 - 112) + '\157' + '\x35' + '\x33', 43943 - 43935), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(111 - 60), 20887 - 20879), ehT0Px3KOsy9(chr(564 - 516) + chr(0b1101111) + chr(0b110010) + chr(0b110100) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110111) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101000 + 0o13) + chr(54) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10 + 0o57) + chr(0b100111 + 0o20) + '\062', 8), ehT0Px3KOsy9(chr(497 - 449) + '\157' + chr(0b101011 + 0o6) + chr(54) + chr(0b11110 + 0o24), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(50) + chr(2638 - 2583), 8), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + '\x32' + chr(0b1000 + 0o54) + '\060', 8), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1100 + 0o143) + '\061' + chr(0b110100) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1011100 + 0o23) + '\061' + chr(52) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2126 - 2077) + '\066' + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(10659 - 10548) + chr(1682 - 1632) + chr(599 - 549) + chr(53), 56967 - 56959), ehT0Px3KOsy9(chr(233 - 185) + '\157' + chr(1647 - 1597) + '\066' + '\x32', 50204 - 50196), ehT0Px3KOsy9(chr(936 - 888) + chr(111) + '\x32' + chr(0b11111 + 0o21), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + '\061' + '\061' + chr(2553 - 2499), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10110 + 0o35) + chr(0b110010) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\063' + chr(865 - 814), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b101101 + 0o4) + chr(54) + chr(0b1101 + 0o46), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(4395 - 4284) + chr(2583 - 2530) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5'), chr(0b1100100) + chr(101) + '\143' + chr(0b1101111) + '\144' + '\x65')(chr(117) + chr(0b101000 + 0o114) + chr(102) + chr(414 - 369) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def CzZi_v00JBG6(OeWW0F1dBPRQ, XCAIkNRdiX0I, oNd8C7o94vJ7, Dk5dqmQQYwtj=ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + '\x30', 8), Mt_IRysVIHSI=1.2, Wuetkhsbidt0=ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100111 + 0o12), 0b1000), SpOun2NrX5aX=ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(11033 - 10922) + '\x34' + chr(1468 - 1416) + chr(52) + '\x37' + chr(2284 - 2230) + chr(48), 0o10), oLgyQ45ORWXM=ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + '\061', 8), GX8NHphWqxXa=ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\060', 8), dHf4p5Wcuj7D=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110000), 8), obB50GGkp9jd=ehT0Px3KOsy9(chr(48) + '\157' + chr(1707 - 1659), 8)):
(ix9dZyeAmUxY, GELGNuVd7ZTT, azOnMTJc4Vem, beq0UcPkiJvw) = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + '\061', 8), azOnMTJc4Vem, beq0UcPkiJvw])
fGB238pT2MDS = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(OeWW0F1dBPRQ), axis=-ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(0b110001), 8), keepdims=ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(794 - 745), 8))
VKkOWR9YyfoZ = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(XCAIkNRdiX0I), axis=-ehT0Px3KOsy9(chr(0b110000) + chr(6542 - 6431) + '\x31', 8), keepdims=ehT0Px3KOsy9(chr(0b110000) + chr(9142 - 9031) + '\x31', 8))
VKkOWR9YyfoZ = IDJ2eXGCBCDu.transpose(VKkOWR9YyfoZ, perm=[ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(425 - 377) + chr(0b110110 + 0o71) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49), 8)])
OsEVnTBapoxv = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(OeWW0F1dBPRQ, perm=[ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061', 8), ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + '\x30', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010), 8)]), IDJ2eXGCBCDu.transpose(XCAIkNRdiX0I, perm=[ehT0Px3KOsy9(chr(0b110000) + chr(5373 - 5262) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(5041 - 4930) + '\062', 8), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + chr(49), 8)]))
OsEVnTBapoxv = IDJ2eXGCBCDu.transpose(OsEVnTBapoxv, perm=[ehT0Px3KOsy9('\x30' + chr(12214 - 12103) + '\061', 8), ehT0Px3KOsy9('\060' + chr(0b111101 + 0o62) + chr(0b10010 + 0o36), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101001 + 0o11), 8)])
ydho_1U2EnKK = fGB238pT2MDS + VKkOWR9YyfoZ - ehT0Px3KOsy9('\060' + '\157' + '\062', 8) * OsEVnTBapoxv
ydho_1U2EnKK = IDJ2eXGCBCDu.reshape(ydho_1U2EnKK, [ix9dZyeAmUxY, GELGNuVd7ZTT, azOnMTJc4Vem, -ehT0Px3KOsy9('\060' + chr(111) + '\x31', 8)])
ydho_1U2EnKK = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.transpose(ydho_1U2EnKK, perm=[ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + chr(0b101101 + 0o3), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(293 - 243), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2299 - 2248), ord("\x08"))]), [-ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8), GELGNuVd7ZTT, oNd8C7o94vJ7])
c86vFEFOAEsj = IDJ2eXGCBCDu.nn.log_softmax(-ydho_1U2EnKK)
Xqm7onEd4wGH = [Wuetkhsbidt0] + jSKPaHwSAfVv.shape_list(ydho_1U2EnKK)
BX2pABD_1Jen = PHnecpeO1VoA(Xqm7onEd4wGH)
uICaXvjWrxGa = Mt_IRysVIHSI - jSKPaHwSAfVv.inverse_lin_decay(SpOun2NrX5aX)
uICaXvjWrxGa = IDJ2eXGCBCDu.cond(IDJ2eXGCBCDu.less(IDJ2eXGCBCDu.random_uniform([]), 0.9), lambda : uICaXvjWrxGa, lambda : IDJ2eXGCBCDu.random_uniform([], minval=0.5, maxval=1.0))
YMaNLUP1nSqz = IDJ2eXGCBCDu.nn.softmax((IDJ2eXGCBCDu.expand_dims(c86vFEFOAEsj, ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\060', 8)) + BX2pABD_1Jen) / uICaXvjWrxGa)
avFF7GkL8IJx = IDJ2eXGCBCDu.clip_by_value(YMaNLUP1nSqz, 1e-06, ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + chr(0b110001), 8) - 1e-06)
if dHf4p5Wcuj7D:
j0zfKFxRwVR2 = Ys555qziAbad.distributions.Multinomial(total_count=1.0, logits=-ydho_1U2EnKK)
else:
j0zfKFxRwVR2 = Ys555qziAbad.distributions.RelaxedOneHotCategorical(uICaXvjWrxGa, logits=-ydho_1U2EnKK)
BUVIuWfbUd44 = IDJ2eXGCBCDu.reduce_mean(j0zfKFxRwVR2.log_prob(avFF7GkL8IJx), ehT0Px3KOsy9('\060' + '\157' + '\x30', 8))
if oLgyQ45ORWXM:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4\xc04\xb3\xef!YJ\x01\x80\xc0\x86'), chr(9545 - 9445) + chr(0b1100101) + chr(0b1100011) + chr(0b10101 + 0o132) + chr(100) + '\x65')(chr(117) + chr(116) + chr(102) + '\055' + chr(2316 - 2260)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5\xe1g\xb6\xe9G^P \xa6\xda\xa7\xaa'), chr(0b1100100) + chr(0b110101 + 0o60) + '\143' + chr(111) + chr(100) + chr(6717 - 6616))(chr(7111 - 6994) + '\x74' + chr(102) + chr(0b100100 + 0o11) + chr(0b11001 + 0o37)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xe1s\x81\xf9h^'), '\x64' + '\x65' + '\x63' + '\157' + chr(9115 - 9015) + '\x65')(chr(2774 - 2657) + chr(0b1110100) + chr(0b110100 + 0o62) + '\055' + chr(56)))(BUVIuWfbUd44, [-ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1100000 + 0o17) + chr(0b110001), 8)]))
if obB50GGkp9jd:
BUVIuWfbUd44 = IDJ2eXGCBCDu.reshape(BUVIuWfbUd44, [ix9dZyeAmUxY, azOnMTJc4Vem, GELGNuVd7ZTT])
BUVIuWfbUd44 = IDJ2eXGCBCDu.reduce_sum(BUVIuWfbUd44, [ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + chr(49), 8), ehT0Px3KOsy9('\060' + chr(7553 - 7442) + chr(0b10011 + 0o37), 8)])
BUVIuWfbUd44 = IDJ2eXGCBCDu.reduce_mean(BUVIuWfbUd44)
if GX8NHphWqxXa > ehT0Px3KOsy9('\x30' + chr(0b10001 + 0o136) + '\060', 8):
n4ljua2gi1Pr = _nWFGJrjIGqg(hidden_size=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\060' + chr(0b110000) + '\060', ord("\x08")), filter_size=ehT0Px3KOsy9('\060' + chr(7702 - 7591) + chr(0b1000 + 0o51) + chr(71 - 23) + chr(48) + '\x30' + chr(2149 - 2101), 0b1000))
avFF7GkL8IJx = IDJ2eXGCBCDu.reshape(avFF7GkL8IJx, [-ehT0Px3KOsy9(chr(229 - 181) + chr(111) + chr(49), 8), GELGNuVd7ZTT, oNd8C7o94vJ7])
for wPIDxw0JoYvT in vQr8gNKaIaWE(GX8NHphWqxXa):
lfcaQOcnhnIZ = IDJ2eXGCBCDu.pad(avFF7GkL8IJx, [[ehT0Px3KOsy9(chr(1878 - 1830) + chr(0b1101111) + chr(0b110000), 8), ehT0Px3KOsy9(chr(468 - 420) + chr(7069 - 6958) + '\x30', 8)], [ehT0Px3KOsy9(chr(901 - 853) + chr(0b1101111) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 8)], [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(48), 8), ehT0Px3KOsy9(chr(1859 - 1811) + '\x6f' + '\x30', 8)]])[:, :-ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(6295 - 6184) + chr(0b100110 + 0o13), 8), :]
lfcaQOcnhnIZ = jSKPaHwSAfVv.dense(lfcaQOcnhnIZ, n4ljua2gi1Pr.qzoyXN3kdhDL)
Iz1jSgUKZDvt = ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100111 + 0o12), 8)
if Iz1jSgUKZDvt:
lZ1GB4L2oMeG = oIL3U1EOcJgs.AttentionType.LOCAL_1D
else:
lZ1GB4L2oMeG = oIL3U1EOcJgs.AttentionType.GLOBAL
_7svqxjLepRK = oIL3U1EOcJgs.transformer_decoder_layers(inputs=lfcaQOcnhnIZ, encoder_output=None, num_layers=ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(54), 0b1000), hparams=n4ljua2gi1Pr, attention_type=lZ1GB4L2oMeG, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xef\xf6a\x87\xeb~TL9\xb1\xc7\x88'), chr(0b1100100) + '\145' + '\143' + chr(7607 - 7496) + '\x64' + chr(0b1 + 0o144))(chr(0b1110101) + chr(0b1110100) + chr(102) + '\055' + chr(1765 - 1709)) + M8_cKLkHVB2V(wPIDxw0JoYvT))
_7svqxjLepRK = jSKPaHwSAfVv.dense(_7svqxjLepRK, oNd8C7o94vJ7)
wCvnFtXcWGde = IDJ2eXGCBCDu.nn.log_softmax(_7svqxjLepRK)
HWx08RIFoD2O = Ys555qziAbad.bijectors.Chain([Ys555qziAbad.bijectors.SoftmaxCentered(), Ys555qziAbad.bijectors.Affine(shift=wCvnFtXcWGde[:, :, :-ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100010 + 0o17), 8)], scale_identity_multiplier=1.0 / uICaXvjWrxGa)])
avFF7GkL8IJx = HWx08RIFoD2O.forward(avFF7GkL8IJx[:, :, :-ehT0Px3KOsy9('\x30' + chr(8571 - 8460) + chr(0b110001), 8)])
bomUQLTne4Lt = HWx08RIFoD2O.inverse_log_det_jacobian(avFF7GkL8IJx, event_ndims=ehT0Px3KOsy9(chr(48) + chr(12219 - 12108) + '\x31', 8))
bomUQLTne4Lt = IDJ2eXGCBCDu.reshape(bomUQLTne4Lt, [Wuetkhsbidt0, ix9dZyeAmUxY, azOnMTJc4Vem, GELGNuVd7ZTT])
if obB50GGkp9jd:
bomUQLTne4Lt = IDJ2eXGCBCDu.reduce_sum(bomUQLTne4Lt, axis=[ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(0b10111 + 0o33), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33', 8)])
BUVIuWfbUd44 += IDJ2eXGCBCDu.reduce_mean(bomUQLTne4Lt)
avFF7GkL8IJx = IDJ2eXGCBCDu.reshape(avFF7GkL8IJx, [Wuetkhsbidt0, ix9dZyeAmUxY * azOnMTJc4Vem, GELGNuVd7ZTT, oNd8C7o94vJ7])
if Dk5dqmQQYwtj:
T8BdHeA1BjOx = IDJ2eXGCBCDu.argmax(avFF7GkL8IJx, -ehT0Px3KOsy9('\060' + '\157' + chr(0b100000 + 0o21), 8))
fu_DLUnq0Rui = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.Hq3fv4Yp0EhD(T8BdHeA1BjOx, oNd8C7o94vJ7), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1144 - 1096), 8))
X_xQ5QiFH6Bh = IDJ2eXGCBCDu.reduce_mean(avFF7GkL8IJx, ehT0Px3KOsy9(chr(80 - 32) + chr(7299 - 7188) + chr(694 - 646), 8)) + IDJ2eXGCBCDu.stop_gradient(fu_DLUnq0Rui - IDJ2eXGCBCDu.reduce_mean(avFF7GkL8IJx, ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(479 - 431), 8)))
else:
X_xQ5QiFH6Bh = IDJ2eXGCBCDu.reduce_mean(YMaNLUP1nSqz, ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8))
X_xQ5QiFH6Bh = IDJ2eXGCBCDu.reshape(X_xQ5QiFH6Bh, [ix9dZyeAmUxY, azOnMTJc4Vem, GELGNuVd7ZTT, oNd8C7o94vJ7])
X_xQ5QiFH6Bh = IDJ2eXGCBCDu.transpose(X_xQ5QiFH6Bh, [ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + '\060', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(219 - 169), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 8), ehT0Px3KOsy9('\060' + chr(2369 - 2258) + chr(0b11101 + 0o26), 8)])
X_xQ5QiFH6Bh = IDJ2eXGCBCDu.reshape(X_xQ5QiFH6Bh, [ix9dZyeAmUxY * GELGNuVd7ZTT, azOnMTJc4Vem, oNd8C7o94vJ7])
return (X_xQ5QiFH6Bh, BUVIuWfbUd44)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
gumbel_softmax_discrete_bottleneck
|
def gumbel_softmax_discrete_bottleneck(x,
bottleneck_bits,
beta=0.25,
decay=0.999,
epsilon=1e-5,
temperature_warmup_steps=150000,
hard=False,
summary=True):
"""VQ-VAE using Gumbel-Softmax.
Different from `gumbel_softmax()` function as
this function calculates the KL by using the discrete entropy
instead of taking the argmax, and it also uses an exponential moving average
to update the codebook while the `gumbel_softmax()` function includes no
codebook update.
Args:
x: A `float`-like `Tensor` containing the latent vectors to be compared to
the codebook, whose squared difference is used as the Gumbel-Softmax
logits.
bottleneck_bits: An `int` that sets the size of the bottleneck in `log_2`.
beta: Beta factor for commitment loss (Default: 0.25).
decay: Decay factor for exponential moving average (Default: 0.999).
epsilon: Small value to avoid dividing by zero in EMA update
(Default: 1e-5).
temperature_warmup_steps: Number of steps it takes to decay temperature to 0
(Default: 150000).
hard: When `True`, we use hard Gumbel-Softmax samples and force
discrete latents by taking the argmax. When `False`, we use soft samples,
which we treat as codebook weights (Default: False).
summary: When `True`, we save histogram summaries of the KL term (Default:
True).
Returns:
x_means_assignments: A `float`-like `Tensor` containing the codebook
assignments. When `hard == True`, this is one-hot, containing the arg-max
of the Gumbel-Softmax samples (and we use the straightthrough gradient).
Otherwise, it contains the Gumbel-Softmax samples exactly, which are
values from the `(K-1)`-simplex where `K` is the bottleneck size.
loss: The loss, which is the sum of the KL between the Gumbel-Softmax and
the uniform prior and the commitment loss multiplied by the beta factor.
We approximate the KL by using the entropy of a categorical distribution
instead of the Gumbel Softmax.
"""
bottleneck_size = 2**bottleneck_bits
x_shape = common_layers.shape_list(x)
hidden_size = x_shape[-1]
means, ema_means, ema_count = get_vq_codebook(bottleneck_size, hidden_size)
x = tf.reshape(x, [-1, hidden_size])
bottleneck_size = common_layers.shape_list(means)[0]
x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keepdims=True)
means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keepdims=True)
scalar_prod = tf.matmul(x, means, transpose_b=True)
dist = x_norm_sq + tf.transpose(means_norm_sq) - 2 * scalar_prod
class_probs = tf.nn.softmax(dist)
log_class_probs = tf.nn.log_softmax(dist)
gumbel_samples = gumbel_sample(common_layers.shape_list(dist))
steps = temperature_warmup_steps
gumbel_samples *= common_layers.inverse_exp_decay(steps // 5) * 0.5
temperature = 1.2 - common_layers.inverse_lin_decay(steps)
# 10% of the time keep reasonably high temperature to keep learning.
temperature = tf.cond(
tf.less(tf.random_uniform([]), 0.9), lambda: temperature,
lambda: tf.random_uniform([], minval=0.5, maxval=1.0))
gumbel_softmax_samples = tf.nn.softmax(
(log_class_probs + gumbel_samples) / temperature)
# Calculate KL between q and a uniform prior.
kl = tf.reduce_sum(
class_probs * (log_class_probs - tf.log(1.0 / bottleneck_size)), -1)
if summary:
tf.summary.histogram("KL", tf.reshape(kl, [-1]))
# Straight-through gradient estimation when we're using hard assignments.
if hard:
x_means_idx = tf.reshape(tf.argmax(gumbel_softmax_samples, axis=-1), [-1])
x_means_hot = tf.one_hot(x_means_idx, bottleneck_size)
x_means_assignments = gumbel_softmax_samples + tf.stop_gradient(
x_means_hot - gumbel_softmax_samples)
else:
x_means_assignments = gumbel_softmax_samples
x_means_assignments_flat = tf.reshape(x_means_assignments,
[-1, bottleneck_size])
x_means = tf.matmul(x_means_assignments_flat, means)
commitment_loss = tf.reduce_mean(
tf.squared_difference(x, tf.stop_gradient(x_means)))
# Update the ema variables.
updated_ema_count = moving_averages.assign_moving_average(
ema_count,
tf.reduce_sum(
tf.reshape(x_means_assignments, shape=[-1, bottleneck_size]), axis=0),
decay,
zero_debias=False)
dw = tf.matmul(x_means_assignments, x, transpose_a=True)
updated_ema_means = tf.identity(
moving_averages.assign_moving_average(
ema_means, dw, decay, zero_debias=False))
n = tf.reduce_sum(updated_ema_count, axis=-1, keepdims=True)
updated_ema_count = (
(updated_ema_count + epsilon) / (n + bottleneck_size * epsilon) * n)
updated_ema_means /= tf.expand_dims(updated_ema_count, axis=-1)
with tf.control_dependencies([commitment_loss]):
update_means = means.assign(updated_ema_means)
with tf.control_dependencies([update_means]):
loss = beta * commitment_loss
# Add KL loss.
loss += tf.reduce_mean(kl)
x_means_assignments = tf.reshape(x_means_assignments,
x_shape[:-1] + [bottleneck_size])
return x_means_assignments, loss
|
python
|
def gumbel_softmax_discrete_bottleneck(x,
bottleneck_bits,
beta=0.25,
decay=0.999,
epsilon=1e-5,
temperature_warmup_steps=150000,
hard=False,
summary=True):
"""VQ-VAE using Gumbel-Softmax.
Different from `gumbel_softmax()` function as
this function calculates the KL by using the discrete entropy
instead of taking the argmax, and it also uses an exponential moving average
to update the codebook while the `gumbel_softmax()` function includes no
codebook update.
Args:
x: A `float`-like `Tensor` containing the latent vectors to be compared to
the codebook, whose squared difference is used as the Gumbel-Softmax
logits.
bottleneck_bits: An `int` that sets the size of the bottleneck in `log_2`.
beta: Beta factor for commitment loss (Default: 0.25).
decay: Decay factor for exponential moving average (Default: 0.999).
epsilon: Small value to avoid dividing by zero in EMA update
(Default: 1e-5).
temperature_warmup_steps: Number of steps it takes to decay temperature to 0
(Default: 150000).
hard: When `True`, we use hard Gumbel-Softmax samples and force
discrete latents by taking the argmax. When `False`, we use soft samples,
which we treat as codebook weights (Default: False).
summary: When `True`, we save histogram summaries of the KL term (Default:
True).
Returns:
x_means_assignments: A `float`-like `Tensor` containing the codebook
assignments. When `hard == True`, this is one-hot, containing the arg-max
of the Gumbel-Softmax samples (and we use the straightthrough gradient).
Otherwise, it contains the Gumbel-Softmax samples exactly, which are
values from the `(K-1)`-simplex where `K` is the bottleneck size.
loss: The loss, which is the sum of the KL between the Gumbel-Softmax and
the uniform prior and the commitment loss multiplied by the beta factor.
We approximate the KL by using the entropy of a categorical distribution
instead of the Gumbel Softmax.
"""
bottleneck_size = 2**bottleneck_bits
x_shape = common_layers.shape_list(x)
hidden_size = x_shape[-1]
means, ema_means, ema_count = get_vq_codebook(bottleneck_size, hidden_size)
x = tf.reshape(x, [-1, hidden_size])
bottleneck_size = common_layers.shape_list(means)[0]
x_norm_sq = tf.reduce_sum(tf.square(x), axis=-1, keepdims=True)
means_norm_sq = tf.reduce_sum(tf.square(means), axis=-1, keepdims=True)
scalar_prod = tf.matmul(x, means, transpose_b=True)
dist = x_norm_sq + tf.transpose(means_norm_sq) - 2 * scalar_prod
class_probs = tf.nn.softmax(dist)
log_class_probs = tf.nn.log_softmax(dist)
gumbel_samples = gumbel_sample(common_layers.shape_list(dist))
steps = temperature_warmup_steps
gumbel_samples *= common_layers.inverse_exp_decay(steps // 5) * 0.5
temperature = 1.2 - common_layers.inverse_lin_decay(steps)
# 10% of the time keep reasonably high temperature to keep learning.
temperature = tf.cond(
tf.less(tf.random_uniform([]), 0.9), lambda: temperature,
lambda: tf.random_uniform([], minval=0.5, maxval=1.0))
gumbel_softmax_samples = tf.nn.softmax(
(log_class_probs + gumbel_samples) / temperature)
# Calculate KL between q and a uniform prior.
kl = tf.reduce_sum(
class_probs * (log_class_probs - tf.log(1.0 / bottleneck_size)), -1)
if summary:
tf.summary.histogram("KL", tf.reshape(kl, [-1]))
# Straight-through gradient estimation when we're using hard assignments.
if hard:
x_means_idx = tf.reshape(tf.argmax(gumbel_softmax_samples, axis=-1), [-1])
x_means_hot = tf.one_hot(x_means_idx, bottleneck_size)
x_means_assignments = gumbel_softmax_samples + tf.stop_gradient(
x_means_hot - gumbel_softmax_samples)
else:
x_means_assignments = gumbel_softmax_samples
x_means_assignments_flat = tf.reshape(x_means_assignments,
[-1, bottleneck_size])
x_means = tf.matmul(x_means_assignments_flat, means)
commitment_loss = tf.reduce_mean(
tf.squared_difference(x, tf.stop_gradient(x_means)))
# Update the ema variables.
updated_ema_count = moving_averages.assign_moving_average(
ema_count,
tf.reduce_sum(
tf.reshape(x_means_assignments, shape=[-1, bottleneck_size]), axis=0),
decay,
zero_debias=False)
dw = tf.matmul(x_means_assignments, x, transpose_a=True)
updated_ema_means = tf.identity(
moving_averages.assign_moving_average(
ema_means, dw, decay, zero_debias=False))
n = tf.reduce_sum(updated_ema_count, axis=-1, keepdims=True)
updated_ema_count = (
(updated_ema_count + epsilon) / (n + bottleneck_size * epsilon) * n)
updated_ema_means /= tf.expand_dims(updated_ema_count, axis=-1)
with tf.control_dependencies([commitment_loss]):
update_means = means.assign(updated_ema_means)
with tf.control_dependencies([update_means]):
loss = beta * commitment_loss
# Add KL loss.
loss += tf.reduce_mean(kl)
x_means_assignments = tf.reshape(x_means_assignments,
x_shape[:-1] + [bottleneck_size])
return x_means_assignments, loss
|
[
"def",
"gumbel_softmax_discrete_bottleneck",
"(",
"x",
",",
"bottleneck_bits",
",",
"beta",
"=",
"0.25",
",",
"decay",
"=",
"0.999",
",",
"epsilon",
"=",
"1e-5",
",",
"temperature_warmup_steps",
"=",
"150000",
",",
"hard",
"=",
"False",
",",
"summary",
"=",
"True",
")",
":",
"bottleneck_size",
"=",
"2",
"**",
"bottleneck_bits",
"x_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"hidden_size",
"=",
"x_shape",
"[",
"-",
"1",
"]",
"means",
",",
"ema_means",
",",
"ema_count",
"=",
"get_vq_codebook",
"(",
"bottleneck_size",
",",
"hidden_size",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"hidden_size",
"]",
")",
"bottleneck_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"means",
")",
"[",
"0",
"]",
"x_norm_sq",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"x",
")",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"means_norm_sq",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"means",
")",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"scalar_prod",
"=",
"tf",
".",
"matmul",
"(",
"x",
",",
"means",
",",
"transpose_b",
"=",
"True",
")",
"dist",
"=",
"x_norm_sq",
"+",
"tf",
".",
"transpose",
"(",
"means_norm_sq",
")",
"-",
"2",
"*",
"scalar_prod",
"class_probs",
"=",
"tf",
".",
"nn",
".",
"softmax",
"(",
"dist",
")",
"log_class_probs",
"=",
"tf",
".",
"nn",
".",
"log_softmax",
"(",
"dist",
")",
"gumbel_samples",
"=",
"gumbel_sample",
"(",
"common_layers",
".",
"shape_list",
"(",
"dist",
")",
")",
"steps",
"=",
"temperature_warmup_steps",
"gumbel_samples",
"*=",
"common_layers",
".",
"inverse_exp_decay",
"(",
"steps",
"//",
"5",
")",
"*",
"0.5",
"temperature",
"=",
"1.2",
"-",
"common_layers",
".",
"inverse_lin_decay",
"(",
"steps",
")",
"# 10% of the time keep reasonably high temperature to keep learning.",
"temperature",
"=",
"tf",
".",
"cond",
"(",
"tf",
".",
"less",
"(",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
")",
",",
"0.9",
")",
",",
"lambda",
":",
"temperature",
",",
"lambda",
":",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
",",
"minval",
"=",
"0.5",
",",
"maxval",
"=",
"1.0",
")",
")",
"gumbel_softmax_samples",
"=",
"tf",
".",
"nn",
".",
"softmax",
"(",
"(",
"log_class_probs",
"+",
"gumbel_samples",
")",
"/",
"temperature",
")",
"# Calculate KL between q and a uniform prior.",
"kl",
"=",
"tf",
".",
"reduce_sum",
"(",
"class_probs",
"*",
"(",
"log_class_probs",
"-",
"tf",
".",
"log",
"(",
"1.0",
"/",
"bottleneck_size",
")",
")",
",",
"-",
"1",
")",
"if",
"summary",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"KL\"",
",",
"tf",
".",
"reshape",
"(",
"kl",
",",
"[",
"-",
"1",
"]",
")",
")",
"# Straight-through gradient estimation when we're using hard assignments.",
"if",
"hard",
":",
"x_means_idx",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"argmax",
"(",
"gumbel_softmax_samples",
",",
"axis",
"=",
"-",
"1",
")",
",",
"[",
"-",
"1",
"]",
")",
"x_means_hot",
"=",
"tf",
".",
"one_hot",
"(",
"x_means_idx",
",",
"bottleneck_size",
")",
"x_means_assignments",
"=",
"gumbel_softmax_samples",
"+",
"tf",
".",
"stop_gradient",
"(",
"x_means_hot",
"-",
"gumbel_softmax_samples",
")",
"else",
":",
"x_means_assignments",
"=",
"gumbel_softmax_samples",
"x_means_assignments_flat",
"=",
"tf",
".",
"reshape",
"(",
"x_means_assignments",
",",
"[",
"-",
"1",
",",
"bottleneck_size",
"]",
")",
"x_means",
"=",
"tf",
".",
"matmul",
"(",
"x_means_assignments_flat",
",",
"means",
")",
"commitment_loss",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"squared_difference",
"(",
"x",
",",
"tf",
".",
"stop_gradient",
"(",
"x_means",
")",
")",
")",
"# Update the ema variables.",
"updated_ema_count",
"=",
"moving_averages",
".",
"assign_moving_average",
"(",
"ema_count",
",",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"reshape",
"(",
"x_means_assignments",
",",
"shape",
"=",
"[",
"-",
"1",
",",
"bottleneck_size",
"]",
")",
",",
"axis",
"=",
"0",
")",
",",
"decay",
",",
"zero_debias",
"=",
"False",
")",
"dw",
"=",
"tf",
".",
"matmul",
"(",
"x_means_assignments",
",",
"x",
",",
"transpose_a",
"=",
"True",
")",
"updated_ema_means",
"=",
"tf",
".",
"identity",
"(",
"moving_averages",
".",
"assign_moving_average",
"(",
"ema_means",
",",
"dw",
",",
"decay",
",",
"zero_debias",
"=",
"False",
")",
")",
"n",
"=",
"tf",
".",
"reduce_sum",
"(",
"updated_ema_count",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"updated_ema_count",
"=",
"(",
"(",
"updated_ema_count",
"+",
"epsilon",
")",
"/",
"(",
"n",
"+",
"bottleneck_size",
"*",
"epsilon",
")",
"*",
"n",
")",
"updated_ema_means",
"/=",
"tf",
".",
"expand_dims",
"(",
"updated_ema_count",
",",
"axis",
"=",
"-",
"1",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"commitment_loss",
"]",
")",
":",
"update_means",
"=",
"means",
".",
"assign",
"(",
"updated_ema_means",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"update_means",
"]",
")",
":",
"loss",
"=",
"beta",
"*",
"commitment_loss",
"# Add KL loss.",
"loss",
"+=",
"tf",
".",
"reduce_mean",
"(",
"kl",
")",
"x_means_assignments",
"=",
"tf",
".",
"reshape",
"(",
"x_means_assignments",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"bottleneck_size",
"]",
")",
"return",
"x_means_assignments",
",",
"loss"
] |
VQ-VAE using Gumbel-Softmax.
Different from `gumbel_softmax()` function as
this function calculates the KL by using the discrete entropy
instead of taking the argmax, and it also uses an exponential moving average
to update the codebook while the `gumbel_softmax()` function includes no
codebook update.
Args:
x: A `float`-like `Tensor` containing the latent vectors to be compared to
the codebook, whose squared difference is used as the Gumbel-Softmax
logits.
bottleneck_bits: An `int` that sets the size of the bottleneck in `log_2`.
beta: Beta factor for commitment loss (Default: 0.25).
decay: Decay factor for exponential moving average (Default: 0.999).
epsilon: Small value to avoid dividing by zero in EMA update
(Default: 1e-5).
temperature_warmup_steps: Number of steps it takes to decay temperature to 0
(Default: 150000).
hard: When `True`, we use hard Gumbel-Softmax samples and force
discrete latents by taking the argmax. When `False`, we use soft samples,
which we treat as codebook weights (Default: False).
summary: When `True`, we save histogram summaries of the KL term (Default:
True).
Returns:
x_means_assignments: A `float`-like `Tensor` containing the codebook
assignments. When `hard == True`, this is one-hot, containing the arg-max
of the Gumbel-Softmax samples (and we use the straightthrough gradient).
Otherwise, it contains the Gumbel-Softmax samples exactly, which are
values from the `(K-1)`-simplex where `K` is the bottleneck size.
loss: The loss, which is the sum of the KL between the Gumbel-Softmax and
the uniform prior and the commitment loss multiplied by the beta factor.
We approximate the KL by using the entropy of a categorical distribution
instead of the Gumbel Softmax.
|
[
"VQ",
"-",
"VAE",
"using",
"Gumbel",
"-",
"Softmax",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L1254-L1371
|
train
|
Gumbel - Softmax discrete bottleneck.
|
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,_zJ24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YyThfhgG,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(111) + chr(2184 - 2135) + '\067' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010 + 0o145) + chr(49) + chr(2214 - 2163) + chr(0b100 + 0o56), 56539 - 56531), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b1 + 0o57) + chr(0b1011 + 0o50), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(2597 - 2542) + chr(852 - 801), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + chr(159 - 108) + chr(920 - 871) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b11111 + 0o22) + chr(53), 24270 - 24262), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(54) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\062' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9038 - 8927) + chr(250 - 199) + chr(0b110111) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10101 + 0o34) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(54) + chr(1627 - 1576), 0o10), ehT0Px3KOsy9(chr(2148 - 2100) + '\x6f' + '\x32' + '\060' + chr(1201 - 1146), 0o10), ehT0Px3KOsy9('\060' + chr(5877 - 5766) + '\x32' + '\065' + chr(2681 - 2628), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + chr(0b100111 + 0o12) + '\062' + chr(0b10001 + 0o44), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(52) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(426 - 377) + chr(0b110001) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110000 + 0o2) + chr(0b110010) + '\x33', 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + '\061' + chr(0b110011) + chr(0b1111 + 0o43), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110000) + chr(0b110100), 53279 - 53271), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + chr(2531 - 2479) + '\x32', 0b1000), ehT0Px3KOsy9(chr(1616 - 1568) + '\x6f' + chr(302 - 252) + '\x35' + chr(0b11100 + 0o33), 0o10), ehT0Px3KOsy9(chr(2163 - 2115) + chr(0b1101111) + chr(0b110011) + chr(1300 - 1248) + chr(0b11101 + 0o25), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b100001 + 0o17) + chr(1438 - 1386), 0b1000), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + chr(0b110010) + chr(0b11100 + 0o31) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(11546 - 11435) + chr(0b11110 + 0o25) + '\x35' + '\060', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + '\067' + chr(0b110011), 8), ehT0Px3KOsy9(chr(414 - 366) + chr(9943 - 9832) + chr(51) + chr(0b101010 + 0o14) + '\063', 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + '\063' + chr(1364 - 1316) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100011 + 0o14) + chr(0b110011) + chr(388 - 335) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(0b11000 + 0o32) + chr(2838 - 2784), 26336 - 26328), ehT0Px3KOsy9(chr(48) + chr(0b11101 + 0o122) + chr(51) + '\x37' + '\x31', 42848 - 42840), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110110) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1162 - 1114) + chr(0b100000 + 0o117) + chr(0b110010) + chr(0b110011) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11572 - 11461) + '\062' + '\067' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2160 - 2107) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(52) + chr(2343 - 2289), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(2103 - 2055) + chr(52), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b110011) + chr(0b110001), 473 - 465), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b110110) + chr(0b10011 + 0o36), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\x36' + '\067', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x35' + '\060', 64352 - 64344)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'S'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\157' + chr(5315 - 5215) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b10100 + 0o122) + chr(1581 - 1536) + chr(3054 - 2998)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def m3kGAmNq1VlS(OeWW0F1dBPRQ, L0tf_yAed5SW, FjcovgoHM1LG=0.25, eeyC5_0F9WOf=0.999, Xtig2zAKpR0T=1e-05, SpOun2NrX5aX=ehT0Px3KOsy9(chr(0b110000) + chr(0b100011 + 0o114) + '\x34' + chr(52) + chr(662 - 610) + '\x37' + '\066' + '\060', 0b1000), Dk5dqmQQYwtj=ehT0Px3KOsy9('\x30' + '\157' + chr(2016 - 1968), 0o10), oLgyQ45ORWXM=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2340 - 2291), 13657 - 13649)):
MyjCWd_3JWq1 = ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(0b110010), ord("\x08")) ** L0tf_yAed5SW
QQEXXbdZyz6m = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
qzoyXN3kdhDL = QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(49), 8)]
(XCAIkNRdiX0I, vx6LjadlTfNA, ALokVh6YPLgI) = ydI5SANw_p5d(MyjCWd_3JWq1, qzoyXN3kdhDL)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9('\060' + chr(0b111010 + 0o65) + '\x31', 8), qzoyXN3kdhDL])
MyjCWd_3JWq1 = jSKPaHwSAfVv.shape_list(XCAIkNRdiX0I)[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000), 8)]
fGB238pT2MDS = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(OeWW0F1dBPRQ), axis=-ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b111 + 0o52), 8), keepdims=ehT0Px3KOsy9(chr(730 - 682) + '\x6f' + chr(0b110001), 8))
VKkOWR9YyfoZ = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.square(XCAIkNRdiX0I), axis=-ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100010 + 0o17), 8), keepdims=ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + '\061', 8))
OsEVnTBapoxv = IDJ2eXGCBCDu.matmul(OeWW0F1dBPRQ, XCAIkNRdiX0I, transpose_b=ehT0Px3KOsy9(chr(268 - 220) + chr(0b100111 + 0o110) + chr(0b110001 + 0o0), 8))
ydho_1U2EnKK = fGB238pT2MDS + IDJ2eXGCBCDu.transpose(VKkOWR9YyfoZ) - ehT0Px3KOsy9(chr(470 - 422) + chr(10139 - 10028) + '\x32', 8) * OsEVnTBapoxv
Gup6ocq5srk3 = IDJ2eXGCBCDu.nn.softmax(ydho_1U2EnKK)
c86vFEFOAEsj = IDJ2eXGCBCDu.nn.log_softmax(ydho_1U2EnKK)
BX2pABD_1Jen = PHnecpeO1VoA(jSKPaHwSAfVv.shape_list(ydho_1U2EnKK))
v0VhEmlMsO_l = SpOun2NrX5aX
BX2pABD_1Jen *= jSKPaHwSAfVv.inverse_exp_decay(v0VhEmlMsO_l // ehT0Px3KOsy9(chr(1291 - 1243) + chr(111) + chr(0b110101), 0o10)) * 0.5
uICaXvjWrxGa = 1.2 - jSKPaHwSAfVv.inverse_lin_decay(v0VhEmlMsO_l)
uICaXvjWrxGa = IDJ2eXGCBCDu.cond(IDJ2eXGCBCDu.less(IDJ2eXGCBCDu.random_uniform([]), 0.9), lambda : uICaXvjWrxGa, lambda : IDJ2eXGCBCDu.random_uniform([], minval=0.5, maxval=1.0))
YMaNLUP1nSqz = IDJ2eXGCBCDu.nn.softmax((c86vFEFOAEsj + BX2pABD_1Jen) / uICaXvjWrxGa)
y5Mu5kTbeC7U = IDJ2eXGCBCDu.reduce_sum(Gup6ocq5srk3 * (c86vFEFOAEsj - IDJ2eXGCBCDu.log(1.0 / MyjCWd_3JWq1)), -ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8))
if oLgyQ45ORWXM:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'"\x1e\xf7\xe1\xb8\xb4\x15\xe7\xa8]F\xd6'), '\x64' + chr(0b1100101) + '\143' + chr(0b1101111) + '\x64' + '\x65')('\x75' + chr(116) + chr(0b1100110) + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'6\x16'), '\144' + '\145' + chr(5962 - 5863) + '\157' + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(11398 - 11282) + '\x66' + chr(45) + '\x38'), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f?\xb0\xd3\xae\xfd\x12'), chr(100) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(100) + chr(4492 - 4391))('\x75' + chr(116) + chr(0b111101 + 0o51) + '\x2d' + chr(1861 - 1805)))(y5Mu5kTbeC7U, [-ehT0Px3KOsy9('\x30' + '\157' + '\x31', 8)]))
if Dk5dqmQQYwtj:
T8BdHeA1BjOx = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.argmax(YMaNLUP1nSqz, axis=-ehT0Px3KOsy9('\x30' + chr(0b1111 + 0o140) + chr(0b110001 + 0o0), 8)), [-ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(12223 - 12112) + '\061', 8)])
fu_DLUnq0Rui = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(T8BdHeA1BjOx, MyjCWd_3JWq1)
X_xQ5QiFH6Bh = YMaNLUP1nSqz + IDJ2eXGCBCDu.stop_gradient(fu_DLUnq0Rui - YMaNLUP1nSqz)
else:
X_xQ5QiFH6Bh = YMaNLUP1nSqz
ubJVm4yjLSFT = IDJ2eXGCBCDu.reshape(X_xQ5QiFH6Bh, [-ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10001 + 0o40), 8), MyjCWd_3JWq1])
xPgmXL9DQrWF = IDJ2eXGCBCDu.matmul(ubJVm4yjLSFT, XCAIkNRdiX0I)
UWkVdITflrDQ = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(OeWW0F1dBPRQ, IDJ2eXGCBCDu.stop_gradient(xPgmXL9DQrWF)))
FuqutXPYitL0 = nDgFXrDqtELR.assign_moving_average(ALokVh6YPLgI, IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.reshape(X_xQ5QiFH6Bh, shape=[-ehT0Px3KOsy9('\x30' + '\x6f' + '\x31', 8), MyjCWd_3JWq1]), axis=ehT0Px3KOsy9(chr(48) + chr(111) + chr(48), 8)), eeyC5_0F9WOf, zero_debias=ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + chr(0b10100 + 0o34), 8))
UVJMTi_S70Uf = IDJ2eXGCBCDu.matmul(X_xQ5QiFH6Bh, OeWW0F1dBPRQ, transpose_a=ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31', 8))
RVkrIbasqS0L = IDJ2eXGCBCDu.identity(nDgFXrDqtELR.assign_moving_average(vx6LjadlTfNA, UVJMTi_S70Uf, eeyC5_0F9WOf, zero_debias=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000), 8)))
m1NkCryOw9Bx = IDJ2eXGCBCDu.reduce_sum(FuqutXPYitL0, axis=-ehT0Px3KOsy9('\060' + chr(111) + chr(1231 - 1182), 8), keepdims=ehT0Px3KOsy9('\x30' + chr(5187 - 5076) + chr(49), 8))
FuqutXPYitL0 = (FuqutXPYitL0 + Xtig2zAKpR0T) / (m1NkCryOw9Bx + MyjCWd_3JWq1 * Xtig2zAKpR0T) * m1NkCryOw9Bx
RVkrIbasqS0L /= IDJ2eXGCBCDu.expand_dims(FuqutXPYitL0, axis=-ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(0b110000 + 0o1), 8))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e5\xad\xcf\xbd\xe2\x1b\xcc\x99lC\xe2\xc31\x86"\xf03\xe1Q'), chr(100) + chr(0b1100101) + '\143' + chr(0b1101111) + '\144' + '\x65')(chr(117) + chr(0b100 + 0o160) + chr(0b110100 + 0o62) + chr(1863 - 1818) + '\070'))([UWkVdITflrDQ]):
lMKniTbgIhg2 = XCAIkNRdiX0I.assign(RVkrIbasqS0L)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e5\xad\xcf\xbd\xe2\x1b\xcc\x99lC\xe2\xc31\x86"\xf03\xe1Q'), chr(1272 - 1172) + chr(6613 - 6512) + chr(0b1100011) + chr(0b1011101 + 0o22) + '\x64' + chr(0b1011101 + 0o10))(chr(117) + chr(116) + '\146' + chr(0b101000 + 0o5) + '\070'))([lMKniTbgIhg2]):
YpO0BcZ6fMsf = FjcovgoHM1LG * UWkVdITflrDQ
YpO0BcZ6fMsf += IDJ2eXGCBCDu.reduce_mean(y5Mu5kTbeC7U)
X_xQ5QiFH6Bh = IDJ2eXGCBCDu.reshape(X_xQ5QiFH6Bh, QQEXXbdZyz6m[:-ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + chr(790 - 741), 8)] + [MyjCWd_3JWq1])
return (X_xQ5QiFH6Bh, YpO0BcZ6fMsf)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/discretization.py
|
tanh_discrete_bottleneck
|
def tanh_discrete_bottleneck(x, bottleneck_bits, bottleneck_noise,
discretize_warmup_steps, mode):
"""Simple discretization through tanh, flip bottleneck_noise many bits."""
x = tf.layers.dense(x, bottleneck_bits, name="tanh_discrete_bottleneck")
d0 = tf.stop_gradient(2.0 * tf.to_float(tf.less(0.0, x))) - 1.0
if mode == tf.estimator.ModeKeys.TRAIN:
x += tf.truncated_normal(
common_layers.shape_list(x), mean=0.0, stddev=0.2)
x = tf.tanh(x)
d = x + tf.stop_gradient(2.0 * tf.to_float(tf.less(0.0, x)) - 1.0 - x)
if mode == tf.estimator.ModeKeys.TRAIN:
noise = tf.random_uniform(common_layers.shape_list(x))
noise = 2.0 * tf.to_float(tf.less(bottleneck_noise, noise)) - 1.0
d *= noise
d = common_layers.mix(d, x, discretize_warmup_steps,
mode == tf.estimator.ModeKeys.TRAIN)
return d, d0
|
python
|
def tanh_discrete_bottleneck(x, bottleneck_bits, bottleneck_noise,
discretize_warmup_steps, mode):
"""Simple discretization through tanh, flip bottleneck_noise many bits."""
x = tf.layers.dense(x, bottleneck_bits, name="tanh_discrete_bottleneck")
d0 = tf.stop_gradient(2.0 * tf.to_float(tf.less(0.0, x))) - 1.0
if mode == tf.estimator.ModeKeys.TRAIN:
x += tf.truncated_normal(
common_layers.shape_list(x), mean=0.0, stddev=0.2)
x = tf.tanh(x)
d = x + tf.stop_gradient(2.0 * tf.to_float(tf.less(0.0, x)) - 1.0 - x)
if mode == tf.estimator.ModeKeys.TRAIN:
noise = tf.random_uniform(common_layers.shape_list(x))
noise = 2.0 * tf.to_float(tf.less(bottleneck_noise, noise)) - 1.0
d *= noise
d = common_layers.mix(d, x, discretize_warmup_steps,
mode == tf.estimator.ModeKeys.TRAIN)
return d, d0
|
[
"def",
"tanh_discrete_bottleneck",
"(",
"x",
",",
"bottleneck_bits",
",",
"bottleneck_noise",
",",
"discretize_warmup_steps",
",",
"mode",
")",
":",
"x",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"bottleneck_bits",
",",
"name",
"=",
"\"tanh_discrete_bottleneck\"",
")",
"d0",
"=",
"tf",
".",
"stop_gradient",
"(",
"2.0",
"*",
"tf",
".",
"to_float",
"(",
"tf",
".",
"less",
"(",
"0.0",
",",
"x",
")",
")",
")",
"-",
"1.0",
"if",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
":",
"x",
"+=",
"tf",
".",
"truncated_normal",
"(",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
",",
"mean",
"=",
"0.0",
",",
"stddev",
"=",
"0.2",
")",
"x",
"=",
"tf",
".",
"tanh",
"(",
"x",
")",
"d",
"=",
"x",
"+",
"tf",
".",
"stop_gradient",
"(",
"2.0",
"*",
"tf",
".",
"to_float",
"(",
"tf",
".",
"less",
"(",
"0.0",
",",
"x",
")",
")",
"-",
"1.0",
"-",
"x",
")",
"if",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
":",
"noise",
"=",
"tf",
".",
"random_uniform",
"(",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
")",
"noise",
"=",
"2.0",
"*",
"tf",
".",
"to_float",
"(",
"tf",
".",
"less",
"(",
"bottleneck_noise",
",",
"noise",
")",
")",
"-",
"1.0",
"d",
"*=",
"noise",
"d",
"=",
"common_layers",
".",
"mix",
"(",
"d",
",",
"x",
",",
"discretize_warmup_steps",
",",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
")",
"return",
"d",
",",
"d0"
] |
Simple discretization through tanh, flip bottleneck_noise many bits.
|
[
"Simple",
"discretization",
"through",
"tanh",
"flip",
"bottleneck_noise",
"many",
"bits",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L1374-L1390
|
train
|
Simple discretization through tanh flip bottleneck_noise many bits.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,V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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(2279 - 2231) + chr(2705 - 2594) + chr(0b110011) + chr(2857 - 2803), ord("\x08")), ehT0Px3KOsy9('\060' + chr(5062 - 4951) + chr(50) + '\063' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1100100 + 0o13) + chr(2094 - 2045) + chr(1300 - 1249) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(52) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(48) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b10001 + 0o46) + chr(793 - 740), 9610 - 9602), ehT0Px3KOsy9('\060' + chr(111) + chr(122 - 72) + chr(1874 - 1825) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11011 + 0o30) + '\060' + chr(687 - 634), 20554 - 20546), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(122 - 72) + '\x31' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + '\063' + chr(310 - 262) + chr(0b101 + 0o56), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110101) + chr(0b100 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + '\062' + chr(0b110100) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + '\x33', 15221 - 15213), ehT0Px3KOsy9(chr(261 - 213) + '\x6f' + chr(0b110010) + chr(454 - 404) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\x30' + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + chr(287 - 238) + '\062' + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(321 - 271) + chr(50) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(12004 - 11893) + chr(52) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(48) + chr(408 - 360), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(168 - 116) + chr(0b100010 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2331 - 2281) + chr(49) + chr(1697 - 1648), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(49) + '\x37', 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(50) + chr(0b110100) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110110) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101001 + 0o6) + chr(0b1000 + 0o55) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(1481 - 1432) + chr(1003 - 949), 8), ehT0Px3KOsy9('\x30' + chr(6615 - 6504) + '\062' + chr(0b110111) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\x36' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(717 - 666) + chr(0b110000) + chr(838 - 787), 8), ehT0Px3KOsy9(chr(297 - 249) + chr(0b1101111) + '\061' + chr(1360 - 1310) + '\067', 24584 - 24576), ehT0Px3KOsy9(chr(308 - 260) + chr(0b1001111 + 0o40) + chr(49) + chr(54) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001011 + 0o44) + '\062' + chr(0b101001 + 0o15) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\060' + '\065', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(2520 - 2467) + chr(0b110001), 19840 - 19832), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(1355 - 1304) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(0b101110 + 0o5) + chr(53) + chr(0b110111), 55604 - 55596), ehT0Px3KOsy9(chr(166 - 118) + '\157' + chr(0b1001 + 0o50) + chr(813 - 765) + chr(0b10111 + 0o33), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(806 - 756) + chr(0b100 + 0o56) + chr(49), 8), ehT0Px3KOsy9('\060' + chr(7821 - 7710) + chr(1690 - 1640) + chr(0b110111) + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2319 - 2270) + chr(1443 - 1392) + '\060', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(0b110101) + '\x30', 57497 - 57489)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'0'), chr(7834 - 7734) + '\145' + '\x63' + chr(1254 - 1143) + '\x64' + chr(101))('\165' + '\x74' + '\x66' + chr(0b101 + 0o50) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def v__R6XgmgWtR(OeWW0F1dBPRQ, L0tf_yAed5SW, r1G583Dm7QSl, jjDbSmPUfjP2, holLFgwB7vsP):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, L0tf_yAed5SW, name=xafqLlk3kkUe(SXOLrMavuUCe(b'j\xf96\xc8\xde\xd9\xe7\xb6\xec\xb1\x0f\xd1f\xce\xe1<\xe6Q,\x84\xe7\xea\xc4Y'), '\144' + '\145' + '\x63' + chr(111) + '\x64' + chr(101))(chr(3126 - 3009) + chr(116) + chr(102) + chr(0b101101) + '\x38'))
Aa_pbn8SZ1gG = IDJ2eXGCBCDu.stop_gradient(2.0 * IDJ2eXGCBCDu.to_float(IDJ2eXGCBCDu.less(0.0, OeWW0F1dBPRQ))) - 1.0
if holLFgwB7vsP == xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'J\xca\x19\xe9\xcf'), chr(100) + chr(4552 - 4451) + '\143' + chr(2656 - 2545) + chr(6842 - 6742) + chr(8471 - 8370))('\165' + '\x74' + chr(0b1100110) + chr(1923 - 1878) + '\070')):
OeWW0F1dBPRQ += IDJ2eXGCBCDu.truncated_normal(jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ), mean=0.0, stddev=0.2)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.tanh(OeWW0F1dBPRQ)
pd3lxn9vqWxp = OeWW0F1dBPRQ + IDJ2eXGCBCDu.stop_gradient(2.0 * IDJ2eXGCBCDu.to_float(IDJ2eXGCBCDu.less(0.0, OeWW0F1dBPRQ)) - 1.0 - OeWW0F1dBPRQ)
if holLFgwB7vsP == xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'J\xca\x19\xe9\xcf'), chr(4272 - 4172) + '\145' + chr(0b111011 + 0o50) + '\x6f' + chr(0b101000 + 0o74) + chr(0b111010 + 0o53))('\165' + chr(116) + chr(0b1100110) + chr(1818 - 1773) + chr(0b111000))):
MudPQU2D1pmv = IDJ2eXGCBCDu.random_uniform(jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ))
MudPQU2D1pmv = 2.0 * IDJ2eXGCBCDu.to_float(IDJ2eXGCBCDu.less(r1G583Dm7QSl, MudPQU2D1pmv)) - 1.0
pd3lxn9vqWxp *= MudPQU2D1pmv
pd3lxn9vqWxp = jSKPaHwSAfVv.mix(pd3lxn9vqWxp, OeWW0F1dBPRQ, jjDbSmPUfjP2, holLFgwB7vsP == IDJ2eXGCBCDu.estimator.ModeKeys.TRAIN)
return (pd3lxn9vqWxp, Aa_pbn8SZ1gG)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.