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/layers/common_layers.py
|
shift_right_3d
|
def shift_right_3d(x, pad_value=None):
"""Shift the second dimension of x right by one."""
if pad_value is None:
shifted_targets = tf.pad(x, [[0, 0], [1, 0], [0, 0]])[:, :-1, :]
else:
shifted_targets = tf.concat([pad_value, x], axis=1)[:, :-1, :]
return shifted_targets
|
python
|
def shift_right_3d(x, pad_value=None):
"""Shift the second dimension of x right by one."""
if pad_value is None:
shifted_targets = tf.pad(x, [[0, 0], [1, 0], [0, 0]])[:, :-1, :]
else:
shifted_targets = tf.concat([pad_value, x], axis=1)[:, :-1, :]
return shifted_targets
|
[
"def",
"shift_right_3d",
"(",
"x",
",",
"pad_value",
"=",
"None",
")",
":",
"if",
"pad_value",
"is",
"None",
":",
"shifted_targets",
"=",
"tf",
".",
"pad",
"(",
"x",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"1",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"[",
":",
",",
":",
"-",
"1",
",",
":",
"]",
"else",
":",
"shifted_targets",
"=",
"tf",
".",
"concat",
"(",
"[",
"pad_value",
",",
"x",
"]",
",",
"axis",
"=",
"1",
")",
"[",
":",
",",
":",
"-",
"1",
",",
":",
"]",
"return",
"shifted_targets"
] |
Shift the second dimension of x right by one.
|
[
"Shift",
"the",
"second",
"dimension",
"of",
"x",
"right",
"by",
"one",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/bl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Z0NK2y6HRbn,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(252 - 204) + chr(0b1100111 + 0o10) + '\x37' + chr(55), 27770 - 27762), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1111 + 0o44) + '\x31' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(49) + chr(819 - 766) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4959 - 4848) + '\063' + chr(0b100 + 0o56) + chr(51), 52476 - 52468), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b11001 + 0o30) + chr(1831 - 1780), 8), ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + '\x31' + chr(0b1011 + 0o46) + chr(50), 46422 - 46414), ehT0Px3KOsy9('\060' + chr(11179 - 11068) + chr(49) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\067' + chr(1609 - 1561), 51788 - 51780), ehT0Px3KOsy9(chr(0b110000) + chr(7172 - 7061) + chr(1382 - 1332), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1112 - 1064) + chr(0b1101111) + chr(401 - 352) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b101000 + 0o107) + chr(51) + chr(0b1110 + 0o42) + '\x32', 0o10), ehT0Px3KOsy9(chr(1481 - 1433) + chr(0b1001101 + 0o42) + chr(0b100101 + 0o14) + chr(0b110000) + chr(383 - 334), 0o10), ehT0Px3KOsy9('\060' + chr(2711 - 2600) + chr(49) + chr(868 - 818) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1011111 + 0o20) + chr(668 - 619) + chr(54) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + '\x31' + '\x34' + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x35' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b101010 + 0o10), 0b1000), ehT0Px3KOsy9('\x30' + chr(2544 - 2433) + chr(1345 - 1296) + '\x34' + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1011 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(1101 - 1046) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(837 - 787) + chr(635 - 586) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(50) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(1279 - 1168) + '\062' + chr(0b1011 + 0o52) + chr(0b100101 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1001 + 0o52) + '\064' + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(50) + chr(0b100010 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6735 - 6624) + '\x34' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(0b10001 + 0o42) + chr(48) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1101 + 0o47) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100 + 0o57) + chr(0b10010 + 0o42) + chr(1093 - 1044), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(52) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + '\066', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101100 + 0o3) + chr(1374 - 1324) + chr(0b110000) + '\063', 36808 - 36800), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + chr(0b1001 + 0o51) + chr(0b110000) + chr(2363 - 2313), 0o10), ehT0Px3KOsy9(chr(2261 - 2213) + chr(111) + chr(0b110011) + '\065' + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110100) + chr(1571 - 1523), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + '\x34' + '\x34', 0b1000), ehT0Px3KOsy9(chr(854 - 806) + '\x6f' + '\061' + chr(49) + chr(0b10101 + 0o42), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + chr(0b10 + 0o56), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x11'), '\144' + '\145' + '\143' + chr(0b1101111) + chr(0b101111 + 0o65) + chr(101))(chr(6576 - 6459) + chr(116) + chr(102) + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def N1lQCNDUnhCz(OeWW0F1dBPRQ, TRas5ITvIE8v=None):
if TRas5ITvIE8v is None:
oyK7XSnTOkEL = IDJ2eXGCBCDu.pad(OeWW0F1dBPRQ, [[ehT0Px3KOsy9(chr(48) + chr(11282 - 11171) + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(48), 8)], [ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b111110 + 0o61) + chr(0b1100 + 0o45), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x30', 8)], [ehT0Px3KOsy9(chr(1759 - 1711) + chr(0b1011110 + 0o21) + '\x30', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x30', 8)]])[:, :-ehT0Px3KOsy9(chr(0b110000) + chr(0b1011101 + 0o22) + chr(1427 - 1378), 8), :]
else:
oyK7XSnTOkEL = IDJ2eXGCBCDu.concat([TRas5ITvIE8v, OeWW0F1dBPRQ], axis=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8))[:, :-ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 8), :]
return oyK7XSnTOkEL
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
shift_right_2d
|
def shift_right_2d(x, pad_value=None):
"""Shift the second dimension of x right by one."""
if pad_value is None:
shifted_targets = tf.pad(x, [[0, 0], [1, 0]])[:, :-1]
else:
shifted_targets = tf.concat([pad_value, x], axis=1)[:, :-1]
return shifted_targets
|
python
|
def shift_right_2d(x, pad_value=None):
"""Shift the second dimension of x right by one."""
if pad_value is None:
shifted_targets = tf.pad(x, [[0, 0], [1, 0]])[:, :-1]
else:
shifted_targets = tf.concat([pad_value, x], axis=1)[:, :-1]
return shifted_targets
|
[
"def",
"shift_right_2d",
"(",
"x",
",",
"pad_value",
"=",
"None",
")",
":",
"if",
"pad_value",
"is",
"None",
":",
"shifted_targets",
"=",
"tf",
".",
"pad",
"(",
"x",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"1",
",",
"0",
"]",
"]",
")",
"[",
":",
",",
":",
"-",
"1",
"]",
"else",
":",
"shifted_targets",
"=",
"tf",
".",
"concat",
"(",
"[",
"pad_value",
",",
"x",
"]",
",",
"axis",
"=",
"1",
")",
"[",
":",
",",
":",
"-",
"1",
"]",
"return",
"shifted_targets"
] |
Shift the second dimension of x right by one.
|
[
"Shift",
"the",
"second",
"dimension",
"of",
"x",
"right",
"by",
"one",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L408-L414
|
train
|
Shift the second dimension of x right by one.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVM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ingIOError,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' + '\062' + '\x34' + chr(0b110101), 37894 - 37886), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1001100 + 0o43) + chr(0b100000 + 0o23) + chr(1049 - 996) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3367 - 3256) + '\x36' + chr(0b110111), 21227 - 21219), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(971 - 921) + '\061' + '\x35', 55532 - 55524), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10101 + 0o36) + chr(858 - 806) + '\064', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b111111 + 0o60) + '\061' + chr(0b110000) + chr(2443 - 2392), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101100 + 0o3) + '\065' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110100) + '\x34', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(760 - 709) + chr(543 - 492), 59025 - 59017), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + chr(889 - 841), 59829 - 59821), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\x37' + chr(0b111 + 0o52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(49) + '\063' + chr(0b10111 + 0o37), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b1 + 0o57) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100100 + 0o13) + '\x31' + chr(0b110111) + chr(0b101001 + 0o15), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(55) + chr(0b101100 + 0o6), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(54) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6592 - 6481) + chr(51) + '\064' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b11101 + 0o24) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(281 - 230) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(632 - 582) + chr(0b110100) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(4090 - 3979) + '\067' + '\x35', 17548 - 17540), ehT0Px3KOsy9(chr(48) + chr(0b1000100 + 0o53) + '\x32' + chr(0b110101) + chr(0b111 + 0o55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101100 + 0o7) + chr(0b110111) + chr(0b11110 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(49) + '\066' + chr(216 - 164), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(285 - 236) + chr(0b10011 + 0o44) + '\066', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b101000 + 0o107) + '\x31' + chr(0b10111 + 0o40) + chr(0b110001), 8), ehT0Px3KOsy9(chr(123 - 75) + chr(0b1101111) + '\x31' + '\065' + chr(50), 15760 - 15752), ehT0Px3KOsy9(chr(766 - 718) + '\157' + chr(55) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b11100 + 0o123) + '\x33' + chr(1362 - 1308) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(556 - 507) + '\065', 32606 - 32598), ehT0Px3KOsy9(chr(1631 - 1583) + chr(0b1101111) + chr(0b110010) + chr(351 - 299) + chr(0b101110 + 0o7), 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(55) + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + chr(10842 - 10731) + '\063' + '\x32', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110011 + 0o1) + chr(49), 28449 - 28441), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\x30' + chr(49), 8), ehT0Px3KOsy9(chr(1216 - 1168) + chr(0b1100101 + 0o12) + chr(0b110010) + chr(0b110101) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + '\x33' + '\x35' + '\x34', 24005 - 23997), ehT0Px3KOsy9(chr(1972 - 1924) + '\157' + chr(49) + chr(53) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(51) + chr(0b110111) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(99 - 47), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110101 + 0o0) + chr(0b101100 + 0o4), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), chr(5022 - 4922) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(9202 - 9102) + '\145')('\x75' + chr(116) + chr(0b1100110) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def tgTDco6PiXbN(OeWW0F1dBPRQ, TRas5ITvIE8v=None):
if TRas5ITvIE8v is None:
oyK7XSnTOkEL = IDJ2eXGCBCDu.pad(OeWW0F1dBPRQ, [[ehT0Px3KOsy9(chr(0b110000) + '\157' + '\060', 23390 - 23382), ehT0Px3KOsy9(chr(48) + chr(111) + '\060', 8)], [ehT0Px3KOsy9('\060' + chr(111) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\060', 8)]])[:, :-ehT0Px3KOsy9(chr(48) + chr(0b111000 + 0o67) + chr(0b110001), 8)]
else:
oyK7XSnTOkEL = IDJ2eXGCBCDu.concat([TRas5ITvIE8v, OeWW0F1dBPRQ], axis=ehT0Px3KOsy9('\x30' + '\157' + '\x31', 8))[:, :-ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b11 + 0o154) + chr(2289 - 2240), 8)]
return oyK7XSnTOkEL
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_stride2_multistep
|
def conv_stride2_multistep(x, nbr_steps, output_filters, name=None, reuse=None):
"""Use a strided convolution to downsample x by 2, `nbr_steps` times.
We use stride and filter size 2 to avoid the checkerboard problem of deconvs.
As detailed in http://distill.pub/2016/deconv-checkerboard/.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]` or
`[batch, spatial_1, spatial_2, depth]`
nbr_steps: number of halving downsample rounds to apply
output_filters: an int specifying the filter count for the convolutions
name: a string
reuse: a boolean
Returns:
a `Tensor` with shape `[batch, spatial / (2**nbr_steps), output_filters]` or
`[batch, spatial_1 / (2**nbr_steps), spatial_2 / (2**nbr_steps),
output_filters]`
"""
with tf.variable_scope(
name, default_name="conv_stride2_multistep", values=[x], reuse=reuse):
if nbr_steps == 0:
out = conv(x, output_filters, (1, 1))
return out, [out]
hidden_layers = [x]
for i in range(nbr_steps):
hidden_layers.append(
conv(
hidden_layers[-1],
output_filters, (2, 2),
strides=2,
activation=tf.nn.relu,
name="conv" + str(i)))
return hidden_layers[-1], hidden_layers
|
python
|
def conv_stride2_multistep(x, nbr_steps, output_filters, name=None, reuse=None):
"""Use a strided convolution to downsample x by 2, `nbr_steps` times.
We use stride and filter size 2 to avoid the checkerboard problem of deconvs.
As detailed in http://distill.pub/2016/deconv-checkerboard/.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]` or
`[batch, spatial_1, spatial_2, depth]`
nbr_steps: number of halving downsample rounds to apply
output_filters: an int specifying the filter count for the convolutions
name: a string
reuse: a boolean
Returns:
a `Tensor` with shape `[batch, spatial / (2**nbr_steps), output_filters]` or
`[batch, spatial_1 / (2**nbr_steps), spatial_2 / (2**nbr_steps),
output_filters]`
"""
with tf.variable_scope(
name, default_name="conv_stride2_multistep", values=[x], reuse=reuse):
if nbr_steps == 0:
out = conv(x, output_filters, (1, 1))
return out, [out]
hidden_layers = [x]
for i in range(nbr_steps):
hidden_layers.append(
conv(
hidden_layers[-1],
output_filters, (2, 2),
strides=2,
activation=tf.nn.relu,
name="conv" + str(i)))
return hidden_layers[-1], hidden_layers
|
[
"def",
"conv_stride2_multistep",
"(",
"x",
",",
"nbr_steps",
",",
"output_filters",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"conv_stride2_multistep\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"if",
"nbr_steps",
"==",
"0",
":",
"out",
"=",
"conv",
"(",
"x",
",",
"output_filters",
",",
"(",
"1",
",",
"1",
")",
")",
"return",
"out",
",",
"[",
"out",
"]",
"hidden_layers",
"=",
"[",
"x",
"]",
"for",
"i",
"in",
"range",
"(",
"nbr_steps",
")",
":",
"hidden_layers",
".",
"append",
"(",
"conv",
"(",
"hidden_layers",
"[",
"-",
"1",
"]",
",",
"output_filters",
",",
"(",
"2",
",",
"2",
")",
",",
"strides",
"=",
"2",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"name",
"=",
"\"conv\"",
"+",
"str",
"(",
"i",
")",
")",
")",
"return",
"hidden_layers",
"[",
"-",
"1",
"]",
",",
"hidden_layers"
] |
Use a strided convolution to downsample x by 2, `nbr_steps` times.
We use stride and filter size 2 to avoid the checkerboard problem of deconvs.
As detailed in http://distill.pub/2016/deconv-checkerboard/.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]` or
`[batch, spatial_1, spatial_2, depth]`
nbr_steps: number of halving downsample rounds to apply
output_filters: an int specifying the filter count for the convolutions
name: a string
reuse: a boolean
Returns:
a `Tensor` with shape `[batch, spatial / (2**nbr_steps), output_filters]` or
`[batch, spatial_1 / (2**nbr_steps), spatial_2 / (2**nbr_steps),
output_filters]`
|
[
"Use",
"a",
"strided",
"convolution",
"to",
"downsample",
"x",
"by",
"2",
"nbr_steps",
"times",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L417-L450
|
train
|
Use a strided convolution to downsample x by 2 n_steps times.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,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_tHXvM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5VS3dE_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(11999 - 11888) + chr(52) + chr(0b101111 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(0b110000) + chr(160 - 112), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100100 + 0o15) + chr(0b1011 + 0o47) + chr(796 - 742), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(651 - 603) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\x36' + chr(0b101100 + 0o13), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(52) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6405 - 6294) + chr(49) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1731 - 1683) + chr(111) + chr(2526 - 2475) + '\064', 5400 - 5392), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1100 - 1051) + '\x31' + '\063', 34627 - 34619), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10111 + 0o130) + chr(0b110001) + '\x35' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110010 + 0o4), 28001 - 27993), ehT0Px3KOsy9(chr(2041 - 1993) + '\157' + chr(359 - 308) + '\x37' + chr(714 - 660), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(52) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1023 - 973) + '\x34' + '\060', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(1309 - 1258) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(611 - 500) + '\067' + chr(0b110001 + 0o0), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\067' + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1377 - 1324), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(345 - 295) + '\x37' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2345 - 2292) + chr(776 - 726), 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(0b110110) + '\062', 13283 - 13275), ehT0Px3KOsy9('\060' + chr(0b1010101 + 0o32) + '\x32' + chr(0b11100 + 0o25) + chr(0b11001 + 0o31), 2405 - 2397), ehT0Px3KOsy9(chr(498 - 450) + chr(0b1101111) + '\x33' + chr(1194 - 1139) + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110 + 0o54) + '\067' + chr(0b110100), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\065' + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\066' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(143 - 92) + '\x37' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3699 - 3588) + chr(1260 - 1210) + '\066' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1511 - 1463) + chr(12062 - 11951) + '\x33' + chr(0b110110) + chr(0b10110 + 0o34), 50260 - 50252), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1010 + 0o51) + chr(0b110111) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(75 - 27) + chr(0b1101111) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11790 - 11679) + '\x33' + chr(0b1000 + 0o51) + chr(0b1100 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + chr(52), 33226 - 33218), ehT0Px3KOsy9(chr(48) + '\157' + chr(398 - 347) + '\x31' + chr(1476 - 1425), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + '\064' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100001 + 0o16) + chr(0b110001) + chr(51) + '\067', 18268 - 18260), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + chr(0b110011) + chr(0b1 + 0o63) + chr(49), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(0b1110 + 0o47) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x08'), chr(6574 - 6474) + chr(0b1011110 + 0o7) + chr(99) + chr(0b1101111) + chr(0b100000 + 0o104) + chr(101))('\165' + '\164' + '\146' + chr(0b101101) + chr(1325 - 1269)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def eWoP_9hx6IzW(OeWW0F1dBPRQ, OPtriMmpkikA, A3v6xokHa0UA, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'P\xa1$-\xd6\x05ey\x14c\x0flf\x9b'), chr(7604 - 7504) + chr(0b1011011 + 0o12) + chr(0b1100011) + chr(0b1101111) + chr(9420 - 9320) + chr(0b1100101))('\x75' + chr(116) + '\146' + chr(710 - 665) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'E\xaf82\xe8\x14}n"t\t1I\x93V\xcc\xe8P\x8bq\xd9Z'), chr(100) + '\x65' + '\x63' + chr(111) + chr(0b1100100) + chr(1992 - 1891))(chr(4392 - 4275) + chr(7430 - 7314) + chr(7601 - 7499) + '\x2d' + '\x38'), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
if OPtriMmpkikA == ehT0Px3KOsy9('\x30' + '\x6f' + chr(746 - 698), 10574 - 10566):
UkrMp_I0RDmo = m1sWr00SVpVY(OeWW0F1dBPRQ, A3v6xokHa0UA, (ehT0Px3KOsy9(chr(0b110000) + chr(10478 - 10367) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1452 - 1404) + chr(0b1101111) + chr(1176 - 1127), 8)))
return (UkrMp_I0RDmo, [UkrMp_I0RDmo])
xC59PqsDvz4k = [OeWW0F1dBPRQ]
for WVxHKyX45z_L in vQr8gNKaIaWE(OPtriMmpkikA):
xafqLlk3kkUe(xC59PqsDvz4k, xafqLlk3kkUe(SXOLrMavuUCe(b'G\xb0&!\xd9\x03'), chr(5115 - 5015) + '\x65' + '\143' + '\157' + '\x64' + chr(4413 - 4312))(chr(6000 - 5883) + chr(116) + '\x66' + chr(847 - 802) + chr(0b111000)))(m1sWr00SVpVY(xC59PqsDvz4k[-ehT0Px3KOsy9(chr(2195 - 2147) + chr(0b1001100 + 0o43) + '\061', 8)], A3v6xokHa0UA, (ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50), 0b1000), ehT0Px3KOsy9(chr(1367 - 1319) + '\157' + '\x32', 8)), strides=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32', 8), activation=xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xa5:1'), chr(0b1100100) + '\145' + chr(0b10000 + 0o123) + chr(6841 - 6730) + chr(100) + '\145')('\x75' + chr(0b111 + 0o155) + chr(1964 - 1862) + chr(0b1011 + 0o42) + '\x38')), name=xafqLlk3kkUe(SXOLrMavuUCe(b'E\xaf82'), chr(0b1100100) + chr(9399 - 9298) + '\x63' + '\x6f' + chr(0b1100100) + '\145')(chr(117) + chr(0b1110100) + '\146' + chr(45) + chr(56)) + M8_cKLkHVB2V(WVxHKyX45z_L)))
return (xC59PqsDvz4k[-ehT0Px3KOsy9(chr(278 - 230) + '\x6f' + chr(1885 - 1836), 8)], xC59PqsDvz4k)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
deconv_stride2_multistep
|
def deconv_stride2_multistep(x,
nbr_steps,
output_filters,
name=None,
reuse=None):
"""Use a deconvolution to upsample x by 2**`nbr_steps`.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]` or
`[batch, spatial_1, spatial_2, depth]`
nbr_steps: an int specifying the number of doubling upsample rounds to
apply.
output_filters: an int specifying the filter count for the deconvolutions
name: a string
reuse: a boolean
Returns:
a `Tensor` with shape `[batch, spatial * (2**nbr_steps), output_filters]` or
`[batch, spatial_1 * (2**nbr_steps), spatial_2 * (2**nbr_steps),
output_filters]`
"""
with tf.variable_scope(
name, default_name="deconv_stride2_multistep", values=[x], reuse=reuse):
def deconv1d(cur, i):
cur_shape = shape_list(cur)
thicker = conv(
cur,
output_filters * 2, (1, 1),
padding="SAME",
activation=tf.nn.relu,
name="deconv1d" + str(i))
return tf.reshape(thicker,
[cur_shape[0], cur_shape[1] * 2, 1, output_filters])
def deconv2d(cur, i):
thicker = conv(
cur,
output_filters * 4, (1, 1),
padding="SAME",
activation=tf.nn.relu,
name="deconv2d" + str(i))
return tf.depth_to_space(thicker, 2)
cur = x
for i in range(nbr_steps):
if cur.get_shape()[2] == 1:
cur = deconv1d(cur, i)
else:
cur_dim = shape_list(cur)[2]
if isinstance(cur_dim, int):
if cur_dim == 1:
cur = deconv1d(cur, i)
else:
cur = deconv2d(cur, i)
else:
cur = tf.cond(
tf.equal(cur_dim, 1),
lambda idx=i: deconv1d(cur, idx),
lambda idx=i: deconv2d(cur, idx))
return cur
|
python
|
def deconv_stride2_multistep(x,
nbr_steps,
output_filters,
name=None,
reuse=None):
"""Use a deconvolution to upsample x by 2**`nbr_steps`.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]` or
`[batch, spatial_1, spatial_2, depth]`
nbr_steps: an int specifying the number of doubling upsample rounds to
apply.
output_filters: an int specifying the filter count for the deconvolutions
name: a string
reuse: a boolean
Returns:
a `Tensor` with shape `[batch, spatial * (2**nbr_steps), output_filters]` or
`[batch, spatial_1 * (2**nbr_steps), spatial_2 * (2**nbr_steps),
output_filters]`
"""
with tf.variable_scope(
name, default_name="deconv_stride2_multistep", values=[x], reuse=reuse):
def deconv1d(cur, i):
cur_shape = shape_list(cur)
thicker = conv(
cur,
output_filters * 2, (1, 1),
padding="SAME",
activation=tf.nn.relu,
name="deconv1d" + str(i))
return tf.reshape(thicker,
[cur_shape[0], cur_shape[1] * 2, 1, output_filters])
def deconv2d(cur, i):
thicker = conv(
cur,
output_filters * 4, (1, 1),
padding="SAME",
activation=tf.nn.relu,
name="deconv2d" + str(i))
return tf.depth_to_space(thicker, 2)
cur = x
for i in range(nbr_steps):
if cur.get_shape()[2] == 1:
cur = deconv1d(cur, i)
else:
cur_dim = shape_list(cur)[2]
if isinstance(cur_dim, int):
if cur_dim == 1:
cur = deconv1d(cur, i)
else:
cur = deconv2d(cur, i)
else:
cur = tf.cond(
tf.equal(cur_dim, 1),
lambda idx=i: deconv1d(cur, idx),
lambda idx=i: deconv2d(cur, idx))
return cur
|
[
"def",
"deconv_stride2_multistep",
"(",
"x",
",",
"nbr_steps",
",",
"output_filters",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"deconv_stride2_multistep\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"def",
"deconv1d",
"(",
"cur",
",",
"i",
")",
":",
"cur_shape",
"=",
"shape_list",
"(",
"cur",
")",
"thicker",
"=",
"conv",
"(",
"cur",
",",
"output_filters",
"*",
"2",
",",
"(",
"1",
",",
"1",
")",
",",
"padding",
"=",
"\"SAME\"",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"name",
"=",
"\"deconv1d\"",
"+",
"str",
"(",
"i",
")",
")",
"return",
"tf",
".",
"reshape",
"(",
"thicker",
",",
"[",
"cur_shape",
"[",
"0",
"]",
",",
"cur_shape",
"[",
"1",
"]",
"*",
"2",
",",
"1",
",",
"output_filters",
"]",
")",
"def",
"deconv2d",
"(",
"cur",
",",
"i",
")",
":",
"thicker",
"=",
"conv",
"(",
"cur",
",",
"output_filters",
"*",
"4",
",",
"(",
"1",
",",
"1",
")",
",",
"padding",
"=",
"\"SAME\"",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"name",
"=",
"\"deconv2d\"",
"+",
"str",
"(",
"i",
")",
")",
"return",
"tf",
".",
"depth_to_space",
"(",
"thicker",
",",
"2",
")",
"cur",
"=",
"x",
"for",
"i",
"in",
"range",
"(",
"nbr_steps",
")",
":",
"if",
"cur",
".",
"get_shape",
"(",
")",
"[",
"2",
"]",
"==",
"1",
":",
"cur",
"=",
"deconv1d",
"(",
"cur",
",",
"i",
")",
"else",
":",
"cur_dim",
"=",
"shape_list",
"(",
"cur",
")",
"[",
"2",
"]",
"if",
"isinstance",
"(",
"cur_dim",
",",
"int",
")",
":",
"if",
"cur_dim",
"==",
"1",
":",
"cur",
"=",
"deconv1d",
"(",
"cur",
",",
"i",
")",
"else",
":",
"cur",
"=",
"deconv2d",
"(",
"cur",
",",
"i",
")",
"else",
":",
"cur",
"=",
"tf",
".",
"cond",
"(",
"tf",
".",
"equal",
"(",
"cur_dim",
",",
"1",
")",
",",
"lambda",
"idx",
"=",
"i",
":",
"deconv1d",
"(",
"cur",
",",
"idx",
")",
",",
"lambda",
"idx",
"=",
"i",
":",
"deconv2d",
"(",
"cur",
",",
"idx",
")",
")",
"return",
"cur"
] |
Use a deconvolution to upsample x by 2**`nbr_steps`.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]` or
`[batch, spatial_1, spatial_2, depth]`
nbr_steps: an int specifying the number of doubling upsample rounds to
apply.
output_filters: an int specifying the filter count for the deconvolutions
name: a string
reuse: a boolean
Returns:
a `Tensor` with shape `[batch, spatial * (2**nbr_steps), output_filters]` or
`[batch, spatial_1 * (2**nbr_steps), spatial_2 * (2**nbr_steps),
output_filters]`
|
[
"Use",
"a",
"deconvolution",
"to",
"upsample",
"x",
"by",
"2",
"**",
"nbr_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L453-L513
|
train
|
Use a deconvolution to upsample x by 2 ** nbr_steps.
|
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,_bikz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IaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\x32' + chr(1759 - 1707), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(0b110011) + chr(0b100101 + 0o21) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\065' + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11111 + 0o120) + chr(50) + chr(0b1111 + 0o50) + chr(0b100010 + 0o24), 55877 - 55869), ehT0Px3KOsy9(chr(1761 - 1713) + '\157' + chr(0b110001) + '\062' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(48) + '\061', 0b1000), ehT0Px3KOsy9(chr(1870 - 1822) + chr(0b110110 + 0o71) + chr(478 - 429) + chr(2763 - 2710) + '\x34', 0o10), ehT0Px3KOsy9(chr(1167 - 1119) + '\x6f' + chr(937 - 888) + '\x30' + chr(0b101010 + 0o11), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(578 - 529) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x34' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(939 - 891) + chr(0b1101111) + chr(0b101000 + 0o13) + '\x36' + '\x30', 0b1000), ehT0Px3KOsy9(chr(1434 - 1386) + '\157' + chr(0b100001 + 0o21) + '\x33' + '\063', 23949 - 23941), ehT0Px3KOsy9(chr(0b110000) + chr(2098 - 1987) + chr(0b11111 + 0o23) + chr(1140 - 1086) + chr(0b10001 + 0o43), 44616 - 44608), ehT0Px3KOsy9(chr(900 - 852) + chr(0b1101111) + chr(50) + '\x30' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\066' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x34' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010 + 0o1) + chr(0b1100 + 0o45) + chr(524 - 474), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + '\x33' + '\x36' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1851 - 1803) + chr(0b1101111) + '\x34' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + '\x33' + chr(49) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(55) + chr(0b11111 + 0o22), 0b1000), ehT0Px3KOsy9(chr(48) + chr(5850 - 5739) + chr(2812 - 2757) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(12164 - 12053) + '\061' + '\063' + chr(48), 63035 - 63027), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b101001 + 0o11) + chr(2028 - 1977), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b1001 + 0o55), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1242 - 1193) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b101010 + 0o6) + chr(0b110101), 8), ehT0Px3KOsy9(chr(1920 - 1872) + chr(111) + chr(0b110110) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b101 + 0o55) + chr(1341 - 1287), 49417 - 49409), ehT0Px3KOsy9('\x30' + chr(6630 - 6519) + chr(442 - 391) + '\x30' + chr(119 - 70), 13030 - 13022), ehT0Px3KOsy9('\x30' + chr(0b11000 + 0o127) + chr(1158 - 1104) + chr(0b101011 + 0o11), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110001) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x37' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(2137 - 2082) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(2302 - 2254) + chr(5177 - 5066) + '\062' + chr(0b110 + 0o56) + chr(2343 - 2293), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + chr(0b110001) + chr(0b110111) + chr(0b100 + 0o57), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b110010) + chr(0b100110 + 0o17), 63978 - 63970), ehT0Px3KOsy9(chr(0b110000) + chr(0b111010 + 0o65) + '\x32' + chr(0b10101 + 0o42) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + chr(2047 - 1997) + chr(48) + chr(2157 - 2105), 0o10), ehT0Px3KOsy9('\x30' + chr(2338 - 2227) + '\x31' + '\062', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + '\065' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xba'), '\x64' + '\145' + chr(0b101000 + 0o73) + chr(111) + chr(0b1100100) + '\x65')('\165' + '\164' + '\146' + chr(1197 - 1152) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def UsypFCKS6ruo(OeWW0F1dBPRQ, OPtriMmpkikA, A3v6xokHa0UA, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2\x96^\xd74\xe3\x00&QS\x93\xf4\xc4\xe0'), chr(0b1100100) + chr(0b110010 + 0o63) + chr(0b1011111 + 0o4) + chr(6037 - 5926) + '\144' + '\145')(chr(117) + chr(3526 - 3410) + '\x66' + chr(0b101 + 0o50) + chr(0b100111 + 0o21)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\x92O\xd1;\xf730zR\x99\xff\xd1\xb7\xe8L\xbf\x9fR\xa5\xcaI=#'), '\144' + chr(8360 - 8259) + chr(99) + chr(111) + chr(0b110111 + 0o55) + chr(0b1100 + 0o131))(chr(0b1110101) + chr(0b1011 + 0o151) + chr(0b1100110) + chr(1669 - 1624) + '\070'), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
def R0aYwLaVshA9(wL6S4kgnTowq, WVxHKyX45z_L):
ok72FAgMhqwH = qypPRW8fq869(wL6S4kgnTowq)
NbjBQHAjtBee = m1sWr00SVpVY(wL6S4kgnTowq, A3v6xokHa0UA * ehT0Px3KOsy9(chr(48) + '\157' + '\062', 0b1000), (ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(239 - 190), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061', 8)), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7\xb6a\xfb'), chr(851 - 751) + chr(0b1010110 + 0o17) + chr(0b111010 + 0o51) + chr(111) + chr(5534 - 5434) + chr(0b1100101))(chr(0b111111 + 0o66) + chr(116) + '\146' + '\x2d' + chr(284 - 228)), activation=IDJ2eXGCBCDu.nn.relu, name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xf0\x92O\xd1;\xf7]'"), chr(100) + '\145' + chr(99) + '\157' + '\144' + chr(0b1100101))(chr(5727 - 5610) + '\164' + chr(102) + chr(0b100001 + 0o14) + '\x38') + M8_cKLkHVB2V(WVxHKyX45z_L))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6\x92_\xd64\xf1\t'), chr(1470 - 1370) + chr(101) + chr(0b1100011) + chr(111) + chr(0b1100 + 0o130) + '\145')(chr(0b100001 + 0o124) + '\164' + chr(0b1010010 + 0o24) + chr(45) + chr(0b100011 + 0o25)))(NbjBQHAjtBee, [ok72FAgMhqwH[ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1010001 + 0o36) + chr(1700 - 1652), 0o10)], ok72FAgMhqwH[ehT0Px3KOsy9('\x30' + chr(111) + '\061', 8)] * ehT0Px3KOsy9(chr(826 - 778) + chr(0b10011 + 0o134) + chr(2024 - 1974), 8), ehT0Px3KOsy9(chr(2024 - 1976) + '\157' + chr(49), 8), A3v6xokHa0UA])
def hHBLYFrbv3ZL(wL6S4kgnTowq, WVxHKyX45z_L):
NbjBQHAjtBee = m1sWr00SVpVY(wL6S4kgnTowq, A3v6xokHa0UA * ehT0Px3KOsy9('\x30' + '\157' + chr(835 - 783), 0o10), (ehT0Px3KOsy9(chr(48) + chr(111) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(0b111100 + 0o63) + chr(49), 8)), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7\xb6a\xfb'), chr(0b1100100) + chr(3530 - 3429) + '\143' + chr(111) + '\x64' + '\145')('\165' + chr(0b1110100) + '\x66' + '\x2d' + '\x38'), activation=IDJ2eXGCBCDu.nn.relu, name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xf0\x92O\xd1;\xf7^'"), chr(0b1111 + 0o125) + chr(9992 - 9891) + chr(0b1100011) + '\157' + '\144' + '\x65')(chr(0b1110101) + chr(0b110010 + 0o102) + chr(223 - 121) + chr(0b101001 + 0o4) + '\070') + M8_cKLkHVB2V(WVxHKyX45z_L))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\x92\\\xca=\xde\x18,QS\x80\xfa\xd7\xe0'), '\144' + chr(101) + '\x63' + '\157' + '\144' + chr(0b1100000 + 0o5))(chr(117) + chr(0b10011 + 0o141) + chr(0b1001000 + 0o36) + chr(0b101101) + chr(0b111000)))(NbjBQHAjtBee, ehT0Px3KOsy9('\x30' + '\x6f' + chr(50), 8))
wL6S4kgnTowq = OeWW0F1dBPRQ
for WVxHKyX45z_L in vQr8gNKaIaWE(OPtriMmpkikA):
if xafqLlk3kkUe(wL6S4kgnTowq, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\x92X\xe1&\xe9\r3k'), chr(7239 - 7139) + '\145' + chr(0b110000 + 0o63) + chr(111) + '\144' + chr(9989 - 9888))(chr(12832 - 12715) + chr(116) + '\x66' + chr(45) + '\070'))()[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010), 8)] == ehT0Px3KOsy9('\x30' + '\157' + chr(0b0 + 0o61), 8):
wL6S4kgnTowq = R0aYwLaVshA9(wL6S4kgnTowq, WVxHKyX45z_L)
else:
zDUQeCzhNDb2 = qypPRW8fq869(wL6S4kgnTowq)[ehT0Px3KOsy9(chr(489 - 441) + '\157' + '\x32', 8)]
if PlSM16l2KDPD(zDUQeCzhNDb2, ehT0Px3KOsy9):
if zDUQeCzhNDb2 == ehT0Px3KOsy9(chr(48) + chr(3946 - 3835) + '\061', 8):
wL6S4kgnTowq = R0aYwLaVshA9(wL6S4kgnTowq, WVxHKyX45z_L)
else:
wL6S4kgnTowq = hHBLYFrbv3ZL(wL6S4kgnTowq, WVxHKyX45z_L)
else:
wL6S4kgnTowq = IDJ2eXGCBCDu.cond(IDJ2eXGCBCDu.equal(zDUQeCzhNDb2, ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49), 8)), lambda YlqusYB6InkM=WVxHKyX45z_L: R0aYwLaVshA9(wL6S4kgnTowq, YlqusYB6InkM), lambda YlqusYB6InkM=WVxHKyX45z_L: hHBLYFrbv3ZL(wL6S4kgnTowq, YlqusYB6InkM))
return wL6S4kgnTowq
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_internal
|
def conv_internal(conv_fn, inputs, filters, kernel_size, **kwargs):
"""Conditional conv_fn making kernel 1d or 2d depending on inputs shape."""
static_shape = inputs.get_shape()
if not static_shape or len(static_shape) != 4:
raise ValueError("Inputs to conv must have statically known rank 4. "
"Shape: " + str(static_shape))
# Add support for left padding.
if kwargs.get("padding") == "LEFT":
dilation_rate = (1, 1)
if "dilation_rate" in kwargs:
dilation_rate = kwargs["dilation_rate"]
assert kernel_size[0] % 2 == 1 and kernel_size[1] % 2 == 1
height_padding = 2 * (kernel_size[0] // 2) * dilation_rate[0]
cond_padding = tf.cond(
tf.equal(shape_list(inputs)[2], 1), lambda: tf.constant(0),
lambda: tf.constant(2 * (kernel_size[1] // 2) * dilation_rate[1]))
width_padding = 0 if static_shape[2] == 1 else cond_padding
padding = [[0, 0], [height_padding, 0], [width_padding, 0], [0, 0]]
inputs = tf.pad(inputs, padding)
# Set middle two dimensions to None to prevent convolution from complaining
inputs.set_shape([static_shape[0], None, None, static_shape[3]])
kwargs["padding"] = "VALID"
def conv2d_kernel(kernel_size_arg, name_suffix):
"""Call conv2d but add suffix to name."""
name = "{}_{}".format(kwargs.get("name", "conv"), name_suffix)
original_name = kwargs.pop("name", None)
original_force2d = kwargs.pop("force2d", None)
result = conv_fn(inputs, filters, kernel_size_arg, name=name, **kwargs)
if original_name is not None:
kwargs["name"] = original_name # Restore for other calls.
if original_force2d is not None:
kwargs["force2d"] = original_force2d
return result
return conv2d_kernel(kernel_size, "single")
|
python
|
def conv_internal(conv_fn, inputs, filters, kernel_size, **kwargs):
"""Conditional conv_fn making kernel 1d or 2d depending on inputs shape."""
static_shape = inputs.get_shape()
if not static_shape or len(static_shape) != 4:
raise ValueError("Inputs to conv must have statically known rank 4. "
"Shape: " + str(static_shape))
# Add support for left padding.
if kwargs.get("padding") == "LEFT":
dilation_rate = (1, 1)
if "dilation_rate" in kwargs:
dilation_rate = kwargs["dilation_rate"]
assert kernel_size[0] % 2 == 1 and kernel_size[1] % 2 == 1
height_padding = 2 * (kernel_size[0] // 2) * dilation_rate[0]
cond_padding = tf.cond(
tf.equal(shape_list(inputs)[2], 1), lambda: tf.constant(0),
lambda: tf.constant(2 * (kernel_size[1] // 2) * dilation_rate[1]))
width_padding = 0 if static_shape[2] == 1 else cond_padding
padding = [[0, 0], [height_padding, 0], [width_padding, 0], [0, 0]]
inputs = tf.pad(inputs, padding)
# Set middle two dimensions to None to prevent convolution from complaining
inputs.set_shape([static_shape[0], None, None, static_shape[3]])
kwargs["padding"] = "VALID"
def conv2d_kernel(kernel_size_arg, name_suffix):
"""Call conv2d but add suffix to name."""
name = "{}_{}".format(kwargs.get("name", "conv"), name_suffix)
original_name = kwargs.pop("name", None)
original_force2d = kwargs.pop("force2d", None)
result = conv_fn(inputs, filters, kernel_size_arg, name=name, **kwargs)
if original_name is not None:
kwargs["name"] = original_name # Restore for other calls.
if original_force2d is not None:
kwargs["force2d"] = original_force2d
return result
return conv2d_kernel(kernel_size, "single")
|
[
"def",
"conv_internal",
"(",
"conv_fn",
",",
"inputs",
",",
"filters",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")",
":",
"static_shape",
"=",
"inputs",
".",
"get_shape",
"(",
")",
"if",
"not",
"static_shape",
"or",
"len",
"(",
"static_shape",
")",
"!=",
"4",
":",
"raise",
"ValueError",
"(",
"\"Inputs to conv must have statically known rank 4. \"",
"\"Shape: \"",
"+",
"str",
"(",
"static_shape",
")",
")",
"# Add support for left padding.",
"if",
"kwargs",
".",
"get",
"(",
"\"padding\"",
")",
"==",
"\"LEFT\"",
":",
"dilation_rate",
"=",
"(",
"1",
",",
"1",
")",
"if",
"\"dilation_rate\"",
"in",
"kwargs",
":",
"dilation_rate",
"=",
"kwargs",
"[",
"\"dilation_rate\"",
"]",
"assert",
"kernel_size",
"[",
"0",
"]",
"%",
"2",
"==",
"1",
"and",
"kernel_size",
"[",
"1",
"]",
"%",
"2",
"==",
"1",
"height_padding",
"=",
"2",
"*",
"(",
"kernel_size",
"[",
"0",
"]",
"//",
"2",
")",
"*",
"dilation_rate",
"[",
"0",
"]",
"cond_padding",
"=",
"tf",
".",
"cond",
"(",
"tf",
".",
"equal",
"(",
"shape_list",
"(",
"inputs",
")",
"[",
"2",
"]",
",",
"1",
")",
",",
"lambda",
":",
"tf",
".",
"constant",
"(",
"0",
")",
",",
"lambda",
":",
"tf",
".",
"constant",
"(",
"2",
"*",
"(",
"kernel_size",
"[",
"1",
"]",
"//",
"2",
")",
"*",
"dilation_rate",
"[",
"1",
"]",
")",
")",
"width_padding",
"=",
"0",
"if",
"static_shape",
"[",
"2",
"]",
"==",
"1",
"else",
"cond_padding",
"padding",
"=",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"height_padding",
",",
"0",
"]",
",",
"[",
"width_padding",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
"inputs",
"=",
"tf",
".",
"pad",
"(",
"inputs",
",",
"padding",
")",
"# Set middle two dimensions to None to prevent convolution from complaining",
"inputs",
".",
"set_shape",
"(",
"[",
"static_shape",
"[",
"0",
"]",
",",
"None",
",",
"None",
",",
"static_shape",
"[",
"3",
"]",
"]",
")",
"kwargs",
"[",
"\"padding\"",
"]",
"=",
"\"VALID\"",
"def",
"conv2d_kernel",
"(",
"kernel_size_arg",
",",
"name_suffix",
")",
":",
"\"\"\"Call conv2d but add suffix to name.\"\"\"",
"name",
"=",
"\"{}_{}\"",
".",
"format",
"(",
"kwargs",
".",
"get",
"(",
"\"name\"",
",",
"\"conv\"",
")",
",",
"name_suffix",
")",
"original_name",
"=",
"kwargs",
".",
"pop",
"(",
"\"name\"",
",",
"None",
")",
"original_force2d",
"=",
"kwargs",
".",
"pop",
"(",
"\"force2d\"",
",",
"None",
")",
"result",
"=",
"conv_fn",
"(",
"inputs",
",",
"filters",
",",
"kernel_size_arg",
",",
"name",
"=",
"name",
",",
"*",
"*",
"kwargs",
")",
"if",
"original_name",
"is",
"not",
"None",
":",
"kwargs",
"[",
"\"name\"",
"]",
"=",
"original_name",
"# Restore for other calls.",
"if",
"original_force2d",
"is",
"not",
"None",
":",
"kwargs",
"[",
"\"force2d\"",
"]",
"=",
"original_force2d",
"return",
"result",
"return",
"conv2d_kernel",
"(",
"kernel_size",
",",
"\"single\"",
")"
] |
Conditional conv_fn making kernel 1d or 2d depending on inputs shape.
|
[
"Conditional",
"conv_fn",
"making",
"kernel",
"1d",
"or",
"2d",
"depending",
"on",
"inputs",
"shape",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L516-L551
|
train
|
Internal function for convolution.
|
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,qqrhSmCSbb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ey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(239 - 188) + '\x32' + chr(52), 39271 - 39263), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + '\065', 9972 - 9964), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\064' + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(3463 - 3352) + chr(51) + '\064' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(588 - 477) + '\x31' + chr(0b1100 + 0o52) + chr(0b1111 + 0o50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2930 - 2819) + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7856 - 7745) + '\061' + chr(0b110011) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x31' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(5956 - 5845) + chr(0b110001) + '\x30', 54163 - 54155), ehT0Px3KOsy9('\060' + chr(0b1000001 + 0o56) + '\062' + '\064' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1314 - 1266) + chr(0b100110 + 0o111) + chr(0b110001) + chr(49) + chr(52), 0b1000), ehT0Px3KOsy9(chr(1710 - 1662) + '\x6f' + chr(2406 - 2353), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(0b101101 + 0o4) + chr(0b110100) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + chr(49) + chr(54) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + '\063' + '\x35' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1858 - 1804) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b110000) + chr(1456 - 1407), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + '\x33' + chr(0b110001) + chr(1249 - 1197), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(4183 - 4072) + chr(0b110011) + chr(50) + chr(0b101101 + 0o10), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + '\x36', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\x33' + chr(99 - 48), 32247 - 32239), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + '\066' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\063', 43458 - 43450), ehT0Px3KOsy9(chr(48) + chr(0b111101 + 0o62) + '\x37' + chr(1576 - 1524), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + '\062' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b111 + 0o52) + chr(55) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + chr(0b110001) + '\063' + chr(0b11 + 0o64), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b111 + 0o52) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b110011) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4265 - 4154) + chr(0b10101 + 0o35) + chr(50) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10110 + 0o131) + '\065' + chr(53), 8), ehT0Px3KOsy9(chr(197 - 149) + chr(8118 - 8007) + '\x33' + chr(0b110111) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1470 - 1421) + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9(chr(1705 - 1657) + chr(0b1000101 + 0o52) + '\061' + chr(0b1000 + 0o54) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(1121 - 1068) + chr(305 - 254), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b100001 + 0o25) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1248 - 1200) + chr(0b1101111) + chr(1179 - 1130) + '\x37' + '\x37', 0o10), ehT0Px3KOsy9(chr(247 - 199) + '\x6f' + chr(51) + chr(684 - 632) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(11130 - 11019) + chr(0b1110 + 0o45) + chr(0b110010) + '\061', 44188 - 44180), ehT0Px3KOsy9(chr(1878 - 1830) + '\157' + chr(49) + chr(51) + chr(729 - 680), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(5329 - 5218) + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa'), chr(0b101 + 0o137) + chr(101) + chr(99) + '\157' + '\x64' + chr(0b1001001 + 0o34))(chr(0b1001111 + 0o46) + '\x74' + chr(0b1100110) + chr(1329 - 1284) + chr(2811 - 2755)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def jnsJp2uSC1K_(g8j_K9LUbc07, vXoupepMtCXU, MErh319F3bgE, m6gwVXy4D3Au, **M8EIoTs2GJXE):
mPvZu54qNVig = vXoupepMtCXU.get_shape()
if not mPvZu54qNVig or c2A0yzQpDQB3(mPvZu54qNVig) != ehT0Px3KOsy9(chr(48) + chr(1290 - 1179) + '\x34', 0o10):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\x9dC\x93\x91\x03g{\xbcg\x85/j\r\x03\xc8[\xf4\xbf\xa1\x0e\xb3SuY\xb6\r+(\xec\xf9N\x9f)\x0b\x12\x11\x14\x89\xbe.\xba\r\x91\x85\x19\x7f{\xfc&\x85\x1fm\x02\x05\x8d\x0c\xa1'), chr(0b11100 + 0o110) + '\x65' + '\143' + '\157' + chr(100) + chr(101))('\165' + chr(0b1110100) + chr(102) + chr(0b101101 + 0o0) + chr(496 - 440)) + M8_cKLkHVB2V(mPvZu54qNVig))
if xafqLlk3kkUe(M8EIoTs2GJXE, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3H\x97'), chr(8984 - 8884) + chr(0b100100 + 0o101) + chr(99) + '\x6f' + '\x64' + chr(0b1100101))(chr(0b1110100 + 0o1) + '\x74' + chr(7874 - 7772) + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4L\x87\x80\x1ez<'), chr(8487 - 8387) + '\x65' + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b100001 + 0o104))(chr(0b1001 + 0o154) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b10 + 0o66))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\x98h\xa5\xb0'), chr(0b1100100) + chr(0b1100101) + chr(0b100010 + 0o101) + chr(0b1101111) + '\144' + chr(0b111011 + 0o52))('\x75' + '\x74' + chr(0b1100110) + '\x2d' + '\x38'):
Rm2KgSQziMI2 = (ehT0Px3KOsy9(chr(48) + chr(7530 - 7419) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2383 - 2272) + chr(0b11100 + 0o25), 8))
if xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0D\x8f\x85\x03}4\xa6W\xd7-q\x06'), chr(0b100101 + 0o77) + '\x65' + chr(845 - 746) + '\157' + chr(0b1100100) + chr(101))(chr(117) + chr(9622 - 9506) + chr(0b1100000 + 0o6) + '\x2d' + '\070') in M8EIoTs2GJXE:
Rm2KgSQziMI2 = M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0D\x8f\x85\x03}4\xa6W\xd7-q\x06'), chr(0b1100100) + chr(101) + chr(99) + '\x6f' + chr(0b1000111 + 0o35) + chr(101))(chr(0b1110101) + '\164' + chr(426 - 324) + chr(0b101 + 0o50) + chr(0b111000))]
assert m6gwVXy4D3Au[ehT0Px3KOsy9(chr(48) + chr(7719 - 7608) + chr(48), ord("\x08"))] % ehT0Px3KOsy9('\060' + '\x6f' + '\062', 0o10) == ehT0Px3KOsy9(chr(0b110000) + chr(1400 - 1289) + '\x31', 8) and m6gwVXy4D3Au[ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + '\061', 8)] % ehT0Px3KOsy9(chr(757 - 709) + chr(0b1000100 + 0o53) + chr(164 - 114), 8) == ehT0Px3KOsy9(chr(945 - 897) + '\x6f' + chr(1625 - 1576), 8)
KT3RMXlE4Iwi = ehT0Px3KOsy9(chr(0b110000) + chr(599 - 488) + '\062', 8) * (m6gwVXy4D3Au[ehT0Px3KOsy9(chr(1091 - 1043) + '\x6f' + chr(2179 - 2131), 8)] // ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1328 - 1278), 8)) * Rm2KgSQziMI2[ehT0Px3KOsy9(chr(230 - 182) + '\x6f' + chr(0b101101 + 0o3), 8)]
coPLmRNet_pb = IDJ2eXGCBCDu.cond(IDJ2eXGCBCDu.equal(qypPRW8fq869(vXoupepMtCXU)[ehT0Px3KOsy9(chr(639 - 591) + chr(111) + chr(50), 8)], ehT0Px3KOsy9('\060' + '\x6f' + chr(0b111 + 0o52), 8)), lambda : IDJ2eXGCBCDu.constant(ehT0Px3KOsy9('\060' + chr(452 - 341) + chr(48), 8)), lambda : IDJ2eXGCBCDu.constant(ehT0Px3KOsy9('\x30' + chr(111) + '\x32', 8) * (m6gwVXy4D3Au[ehT0Px3KOsy9(chr(0b110000) + chr(11112 - 11001) + chr(49), 8)] // ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11001 + 0o31), 8)) * Rm2KgSQziMI2[ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061', 8)]))
o7e_EUWc8mDu = ehT0Px3KOsy9('\060' + '\157' + chr(48), 8) if mPvZu54qNVig[ehT0Px3KOsy9('\x30' + chr(0b1101000 + 0o7) + '\x32', 8)] == ehT0Px3KOsy9('\060' + chr(11599 - 11488) + chr(0b110001), 8) else coPLmRNet_pb
TFLseEYASEKG = [[ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1379 - 1331), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\060', 8)], [KT3RMXlE4Iwi, ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8)], [o7e_EUWc8mDu, ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + chr(48), 8)], [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(48), 8), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(1035 - 987), 8)]]
vXoupepMtCXU = IDJ2eXGCBCDu.pad(vXoupepMtCXU, TFLseEYASEKG)
xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7H\x97\xbb\x04|:\xb8m'), chr(4208 - 4108) + chr(6433 - 6332) + '\143' + '\157' + '\x64' + chr(0b1000000 + 0o45))('\x75' + chr(0b1110100) + chr(7367 - 7265) + chr(0b101100 + 0o1) + chr(1086 - 1030)))([mPvZu54qNVig[ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(2194 - 2146), 8)], None, None, mPvZu54qNVig[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010 + 0o1), 8)]])
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4L\x87\x80\x1ez<'), chr(100) + chr(5879 - 5778) + '\143' + chr(0b100100 + 0o113) + '\x64' + chr(6258 - 6157))('\x75' + chr(116) + '\x66' + '\055' + '\x38')] = xafqLlk3kkUe(SXOLrMavuUCe(b'\x82l\xaf\xad3'), chr(434 - 334) + chr(0b11110 + 0o107) + '\143' + '\157' + '\144' + '\145')(chr(8455 - 8338) + '\164' + chr(0b1100110) + chr(0b1110 + 0o37) + chr(56))
def tTa1yJKKTVPl(WzySCKP0n_2T, ahysG3Y278Zx):
AIvJRzLdDfgF = xafqLlk3kkUe(SXOLrMavuUCe(b'\xafP\xbc\x9f\n'), chr(0b1100100 + 0o0) + chr(0b1100101) + '\143' + chr(1581 - 1470) + chr(1510 - 1410) + chr(0b1100100 + 0o1))(chr(0b10001 + 0o144) + chr(10377 - 10261) + '\146' + chr(0b1010 + 0o43) + '\070').V4roHaS3Ppej(M8EIoTs2GJXE.get(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbaL\x8e\x81'), '\144' + chr(4608 - 4507) + '\143' + chr(111) + '\x64' + chr(0b1001011 + 0o32))(chr(0b1110101) + chr(12514 - 12398) + chr(0b1100110) + '\055' + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7B\x8d\x92'), '\x64' + '\x65' + '\143' + '\x6f' + chr(0b1100100) + '\145')(chr(3252 - 3135) + chr(4725 - 4609) + '\146' + chr(0b101101) + chr(1236 - 1180))), ahysG3Y278Zx)
TOsHP5jDVYNn = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbaL\x8e\x81'), chr(100) + chr(0b100101 + 0o100) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(101))('\x75' + chr(0b1110100) + '\x66' + '\055' + chr(56)), None)
evBE3uHia88X = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2B\x91\x87\x12&?'), chr(849 - 749) + chr(101) + chr(8647 - 8548) + '\x6f' + chr(0b1100100) + '\x65')(chr(3180 - 3063) + chr(116) + chr(1890 - 1788) + chr(0b1001 + 0o44) + chr(1410 - 1354)), None)
ShZmEKfTkAOZ = g8j_K9LUbc07(vXoupepMtCXU, MErh319F3bgE, WzySCKP0n_2T, name=AIvJRzLdDfgF, **M8EIoTs2GJXE)
if TOsHP5jDVYNn is not None:
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\xbaL\x8e\x81'), '\144' + chr(5481 - 5380) + '\143' + chr(0b1101101 + 0o2) + chr(100) + chr(4109 - 4008))('\165' + chr(4197 - 4081) + '\x66' + chr(0b101101) + chr(56))] = TOsHP5jDVYNn
if evBE3uHia88X is not None:
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2B\x91\x87\x12&?'), '\144' + chr(0b1010100 + 0o21) + '\143' + chr(7654 - 7543) + chr(100) + '\x65')('\165' + chr(0b1100001 + 0o23) + '\x66' + '\x2d' + '\x38')] = evBE3uHia88X
return ShZmEKfTkAOZ
return tTa1yJKKTVPl(m6gwVXy4D3Au, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7D\x8d\x83\x1bq'), chr(0b101011 + 0o71) + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(918 - 818) + chr(0b1100101))('\x75' + chr(116) + chr(0b1000001 + 0o45) + '\055' + chr(0b110100 + 0o4)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
subseparable_conv
|
def subseparable_conv(inputs, filters, kernel_size, **kwargs):
"""Sub-separable convolution. If separability == 0 it's a separable_conv."""
def conv_fn(inputs, filters, kernel_size, **kwargs):
"""Sub-separable convolution, splits into separability-many blocks."""
separability = None
if "separability" in kwargs:
separability = kwargs.pop("separability")
if separability:
parts = []
abs_sep = separability if separability > 0 else -1 * separability
for split_idx, split in enumerate(tf.split(inputs, abs_sep, axis=3)):
with tf.variable_scope("part_%d" % split_idx):
if separability > 0:
parts.append(
layers().Conv2D(filters // separability, kernel_size,
**kwargs)(split))
else:
parts.append(
layers().SeparableConv2D(filters // abs_sep,
kernel_size, **kwargs)(split))
if separability > 1:
result = layers().Conv2D(filters, (1, 1))(tf.concat(parts, axis=3))
elif abs_sep == 1: # If we have just one block, return it.
assert len(parts) == 1
result = parts[0]
else:
result = tf.concat(parts, axis=3)
else:
result = layers().SeparableConv2D(filters, kernel_size,
**kwargs)(inputs)
if separability is not None:
kwargs["separability"] = separability
return result
return conv_internal(conv_fn, inputs, filters, kernel_size, **kwargs)
|
python
|
def subseparable_conv(inputs, filters, kernel_size, **kwargs):
"""Sub-separable convolution. If separability == 0 it's a separable_conv."""
def conv_fn(inputs, filters, kernel_size, **kwargs):
"""Sub-separable convolution, splits into separability-many blocks."""
separability = None
if "separability" in kwargs:
separability = kwargs.pop("separability")
if separability:
parts = []
abs_sep = separability if separability > 0 else -1 * separability
for split_idx, split in enumerate(tf.split(inputs, abs_sep, axis=3)):
with tf.variable_scope("part_%d" % split_idx):
if separability > 0:
parts.append(
layers().Conv2D(filters // separability, kernel_size,
**kwargs)(split))
else:
parts.append(
layers().SeparableConv2D(filters // abs_sep,
kernel_size, **kwargs)(split))
if separability > 1:
result = layers().Conv2D(filters, (1, 1))(tf.concat(parts, axis=3))
elif abs_sep == 1: # If we have just one block, return it.
assert len(parts) == 1
result = parts[0]
else:
result = tf.concat(parts, axis=3)
else:
result = layers().SeparableConv2D(filters, kernel_size,
**kwargs)(inputs)
if separability is not None:
kwargs["separability"] = separability
return result
return conv_internal(conv_fn, inputs, filters, kernel_size, **kwargs)
|
[
"def",
"subseparable_conv",
"(",
"inputs",
",",
"filters",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"conv_fn",
"(",
"inputs",
",",
"filters",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Sub-separable convolution, splits into separability-many blocks.\"\"\"",
"separability",
"=",
"None",
"if",
"\"separability\"",
"in",
"kwargs",
":",
"separability",
"=",
"kwargs",
".",
"pop",
"(",
"\"separability\"",
")",
"if",
"separability",
":",
"parts",
"=",
"[",
"]",
"abs_sep",
"=",
"separability",
"if",
"separability",
">",
"0",
"else",
"-",
"1",
"*",
"separability",
"for",
"split_idx",
",",
"split",
"in",
"enumerate",
"(",
"tf",
".",
"split",
"(",
"inputs",
",",
"abs_sep",
",",
"axis",
"=",
"3",
")",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"part_%d\"",
"%",
"split_idx",
")",
":",
"if",
"separability",
">",
"0",
":",
"parts",
".",
"append",
"(",
"layers",
"(",
")",
".",
"Conv2D",
"(",
"filters",
"//",
"separability",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")",
"(",
"split",
")",
")",
"else",
":",
"parts",
".",
"append",
"(",
"layers",
"(",
")",
".",
"SeparableConv2D",
"(",
"filters",
"//",
"abs_sep",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")",
"(",
"split",
")",
")",
"if",
"separability",
">",
"1",
":",
"result",
"=",
"layers",
"(",
")",
".",
"Conv2D",
"(",
"filters",
",",
"(",
"1",
",",
"1",
")",
")",
"(",
"tf",
".",
"concat",
"(",
"parts",
",",
"axis",
"=",
"3",
")",
")",
"elif",
"abs_sep",
"==",
"1",
":",
"# If we have just one block, return it.",
"assert",
"len",
"(",
"parts",
")",
"==",
"1",
"result",
"=",
"parts",
"[",
"0",
"]",
"else",
":",
"result",
"=",
"tf",
".",
"concat",
"(",
"parts",
",",
"axis",
"=",
"3",
")",
"else",
":",
"result",
"=",
"layers",
"(",
")",
".",
"SeparableConv2D",
"(",
"filters",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")",
"(",
"inputs",
")",
"if",
"separability",
"is",
"not",
"None",
":",
"kwargs",
"[",
"\"separability\"",
"]",
"=",
"separability",
"return",
"result",
"return",
"conv_internal",
"(",
"conv_fn",
",",
"inputs",
",",
"filters",
",",
"kernel_size",
",",
"*",
"*",
"kwargs",
")"
] |
Sub-separable convolution. If separability == 0 it's a separable_conv.
|
[
"Sub",
"-",
"separable",
"convolution",
".",
"If",
"separability",
"==",
"0",
"it",
"s",
"a",
"separable_conv",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L579-L614
|
train
|
Sub - separable convolution.
|
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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yTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\x31' + '\x32', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\066', 63777 - 63769), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(646 - 596) + chr(0b110010) + chr(0b1010 + 0o54), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\065' + chr(0b101110 + 0o5), 0o10), ehT0Px3KOsy9(chr(2247 - 2199) + chr(0b1101011 + 0o4) + '\x32' + '\x35' + chr(0b10100 + 0o35), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(1743 - 1694) + '\x31' + chr(0b0 + 0o60), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010001 + 0o36) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(1439 - 1389) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010 + 0o1) + chr(0b101101 + 0o6) + chr(0b1110 + 0o43), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(2400 - 2351) + '\x30' + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9(chr(1558 - 1510) + '\157' + '\063' + chr(0b100 + 0o61), 39246 - 39238), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101001 + 0o11) + chr(680 - 626) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110111) + chr(0b101100 + 0o12), 8903 - 8895), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b101100 + 0o5) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(49) + '\x36' + chr(51), 32594 - 32586), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1110 + 0o141) + '\067' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001001 + 0o46) + chr(2389 - 2338) + chr(0b101011 + 0o5) + chr(0b11111 + 0o22), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + '\x33', 14536 - 14528), ehT0Px3KOsy9('\060' + '\157' + chr(759 - 709) + chr(1225 - 1174) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(1564 - 1512) + chr(0b110110), 52061 - 52053), ehT0Px3KOsy9(chr(48) + '\157' + '\x37' + '\064', 0b1000), ehT0Px3KOsy9(chr(1457 - 1409) + chr(0b1101111) + chr(0b100001 + 0o20) + '\x31' + chr(0b110000), 8), ehT0Px3KOsy9('\060' + chr(111) + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(48) + chr(0b10110 + 0o41), 33237 - 33229), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + '\x32' + chr(1678 - 1627) + chr(1451 - 1396), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\064' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + '\061' + chr(0b110011) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1729 - 1680) + chr(49) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\x33' + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(0b1010000 + 0o37) + '\x34' + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\x37' + chr(947 - 897), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11111 + 0o24) + '\x31' + chr(845 - 795), 8), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(50) + chr(55) + chr(1058 - 1009), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(50) + '\x33' + chr(1927 - 1873), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(0b110010) + '\065' + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(11198 - 11087) + chr(0b110110) + chr(51), 55125 - 55117), ehT0Px3KOsy9(chr(48) + chr(7013 - 6902) + chr(0b11101 + 0o25) + chr(0b10011 + 0o35) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10 + 0o57) + chr(0b11011 + 0o32) + chr(0b110111), 24770 - 24762)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11111 + 0o26) + chr(48), 23164 - 23156)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4'), chr(0b1100100) + chr(0b1100101) + chr(0b1001100 + 0o27) + chr(111) + '\x64' + chr(8287 - 8186))(chr(117) + chr(0b1000100 + 0o60) + '\146' + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def WjoAbnBa0SsI(vXoupepMtCXU, MErh319F3bgE, m6gwVXy4D3Au, **M8EIoTs2GJXE):
def g8j_K9LUbc07(vXoupepMtCXU, MErh319F3bgE, m6gwVXy4D3Au, **M8EIoTs2GJXE):
hWr_AfvsCMfQ = None
if xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9c\xe6\n\xdb)`\xb9\xb5|6d'), '\144' + chr(0b1000100 + 0o41) + '\143' + '\157' + chr(0b1100100) + chr(10055 - 9954))('\165' + '\164' + chr(300 - 198) + '\055' + chr(2748 - 2692)) in M8EIoTs2GJXE:
hWr_AfvsCMfQ = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9c\xe6\n\xdb)`\xb9\xb5|6d'), chr(0b1010010 + 0o22) + chr(0b1100101) + '\x63' + '\x6f' + chr(100) + '\145')(chr(4543 - 4426) + chr(3354 - 3238) + '\146' + chr(0b101101) + chr(0b111000)))
if hWr_AfvsCMfQ:
gIfWK5W_pmM4 = []
fFEZ6TUNIxzN = hWr_AfvsCMfQ if hWr_AfvsCMfQ > ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b11010 + 0o125) + '\x30', 0b1000) else -ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10010 + 0o37), 0o10) * hWr_AfvsCMfQ
for (eSTgHKWjz4lC, vsJU7GhuEuh6) in YlkZvXL8qwsX(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9v\xfa\x02\xdd'), chr(3014 - 2914) + chr(9834 - 9733) + '\x63' + '\x6f' + chr(0b11001 + 0o113) + chr(5405 - 5304))('\165' + '\x74' + '\146' + '\x2d' + chr(0b111000)))(vXoupepMtCXU, fFEZ6TUNIxzN, axis=ehT0Px3KOsy9('\060' + chr(124 - 13) + '\x33', 0o10))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbcg\xe4\x02\xc8*n\xb5\x86f!rd\xd0'), chr(5819 - 5719) + chr(0b1100101) + '\x63' + '\x6f' + chr(0b1100100) + '\x65')('\x75' + chr(9070 - 8954) + '\146' + chr(0b101101) + chr(457 - 401)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbag\xe4\x1f\xf6mf'), chr(8268 - 8168) + '\x65' + chr(99) + '\157' + chr(0b1100011 + 0o1) + '\145')(chr(11790 - 11673) + chr(116) + chr(0b10010 + 0o124) + chr(45) + chr(56)) % eSTgHKWjz4lC):
if hWr_AfvsCMfQ > ehT0Px3KOsy9(chr(48) + chr(1073 - 962) + '\x30', 8):
xafqLlk3kkUe(gIfWK5W_pmM4, xafqLlk3kkUe(SXOLrMavuUCe(b'\xabv\xe6\x0e\xc7,'), chr(0b1100100) + chr(4167 - 4066) + chr(99) + chr(111) + chr(8715 - 8615) + chr(0b1001000 + 0o35))('\x75' + chr(116) + chr(102) + '\055' + chr(56)))(xafqLlk3kkUe(sGi5Aql23May(), xafqLlk3kkUe(SXOLrMavuUCe(b'\x89i\xf8\x1d\x9b\x0c'), chr(0b1100100) + '\145' + chr(3405 - 3306) + chr(12118 - 12007) + chr(100) + chr(7059 - 6958))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(0b110011 + 0o5)))(MErh319F3bgE // hWr_AfvsCMfQ, m6gwVXy4D3Au, **M8EIoTs2GJXE)(vsJU7GhuEuh6))
else:
xafqLlk3kkUe(gIfWK5W_pmM4, xafqLlk3kkUe(SXOLrMavuUCe(b'\xabv\xe6\x0e\xc7,'), '\144' + chr(0b1001101 + 0o30) + chr(0b1100011) + chr(0b1000100 + 0o53) + chr(0b1011101 + 0o7) + '\145')(chr(11036 - 10919) + chr(116) + chr(102) + chr(0b10011 + 0o32) + chr(0b10110 + 0o42)))(xafqLlk3kkUe(sGi5Aql23May(), xafqLlk3kkUe(SXOLrMavuUCe(b'\x99c\xe6\n\xdb)`\xbc\xbcV-sb\x87z'), chr(4922 - 4822) + chr(1884 - 1783) + chr(0b1100011) + chr(316 - 205) + chr(3204 - 3104) + '\145')(chr(0b1101010 + 0o13) + chr(0b1001010 + 0o52) + '\146' + '\055' + chr(56)))(MErh319F3bgE // fFEZ6TUNIxzN, m6gwVXy4D3Au, **M8EIoTs2GJXE)(vsJU7GhuEuh6))
if hWr_AfvsCMfQ > ehT0Px3KOsy9(chr(0b110000) + chr(8608 - 8497) + chr(1412 - 1363), 8):
ShZmEKfTkAOZ = sGi5Aql23May().Conv2D(MErh319F3bgE, (ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1000101 + 0o52) + chr(0b11000 + 0o31), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + '\061', 8)))(IDJ2eXGCBCDu.concat(gIfWK5W_pmM4, axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1894 - 1843), 8)))
elif fFEZ6TUNIxzN == ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1100111 + 0o10) + chr(1031 - 982), 8):
assert c2A0yzQpDQB3(gIfWK5W_pmM4) == ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + '\061', 8)
ShZmEKfTkAOZ = gIfWK5W_pmM4[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x30', 8)]
else:
ShZmEKfTkAOZ = IDJ2eXGCBCDu.concat(gIfWK5W_pmM4, axis=ehT0Px3KOsy9('\x30' + '\157' + '\x33', 8))
else:
ShZmEKfTkAOZ = sGi5Aql23May().SeparableConv2D(MErh319F3bgE, m6gwVXy4D3Au, **M8EIoTs2GJXE)(vXoupepMtCXU)
if hWr_AfvsCMfQ is not None:
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9c\xe6\n\xdb)`\xb9\xb5|6d'), chr(100) + '\x65' + '\x63' + chr(9729 - 9618) + '\144' + chr(5499 - 5398))('\165' + chr(8006 - 7890) + '\x66' + '\055' + chr(0b111000))] = hWr_AfvsCMfQ
return ShZmEKfTkAOZ
return jnsJp2uSC1K_(g8j_K9LUbc07, vXoupepMtCXU, MErh319F3bgE, m6gwVXy4D3Au, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
tpu_conv1d
|
def tpu_conv1d(inputs, filters, kernel_size, padding="SAME", name="tpu_conv1d"):
"""Version of conv1d that works on TPU (as of 11/2017).
Args:
inputs: a Tensor with shape [batch, length, input_depth].
filters: an integer.
kernel_size: an integer.
padding: a string - "SAME" or "LEFT".
name: a string.
Returns:
a Tensor with shape [batch, length, filters].
"""
if kernel_size == 1:
return dense(inputs, filters, name=name, use_bias=True)
if padding == "SAME":
assert kernel_size % 2 == 1
first_offset = -((kernel_size - 1) // 2)
else:
assert padding == "LEFT"
first_offset = -(kernel_size - 1)
last_offset = first_offset + kernel_size - 1
results = []
padded = tf.pad(inputs, [[0, 0], [-first_offset, last_offset], [0, 0]])
for i in range(kernel_size):
shifted = tf.slice(padded, [0, i, 0], tf.shape(inputs)) if i else inputs
shifted.set_shape(inputs.get_shape())
results.append(
dense(shifted, filters, use_bias=(i == 0), name=name + "_%d" % i))
ret = tf.add_n(results)
ret *= kernel_size**-0.5
return ret
|
python
|
def tpu_conv1d(inputs, filters, kernel_size, padding="SAME", name="tpu_conv1d"):
"""Version of conv1d that works on TPU (as of 11/2017).
Args:
inputs: a Tensor with shape [batch, length, input_depth].
filters: an integer.
kernel_size: an integer.
padding: a string - "SAME" or "LEFT".
name: a string.
Returns:
a Tensor with shape [batch, length, filters].
"""
if kernel_size == 1:
return dense(inputs, filters, name=name, use_bias=True)
if padding == "SAME":
assert kernel_size % 2 == 1
first_offset = -((kernel_size - 1) // 2)
else:
assert padding == "LEFT"
first_offset = -(kernel_size - 1)
last_offset = first_offset + kernel_size - 1
results = []
padded = tf.pad(inputs, [[0, 0], [-first_offset, last_offset], [0, 0]])
for i in range(kernel_size):
shifted = tf.slice(padded, [0, i, 0], tf.shape(inputs)) if i else inputs
shifted.set_shape(inputs.get_shape())
results.append(
dense(shifted, filters, use_bias=(i == 0), name=name + "_%d" % i))
ret = tf.add_n(results)
ret *= kernel_size**-0.5
return ret
|
[
"def",
"tpu_conv1d",
"(",
"inputs",
",",
"filters",
",",
"kernel_size",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"tpu_conv1d\"",
")",
":",
"if",
"kernel_size",
"==",
"1",
":",
"return",
"dense",
"(",
"inputs",
",",
"filters",
",",
"name",
"=",
"name",
",",
"use_bias",
"=",
"True",
")",
"if",
"padding",
"==",
"\"SAME\"",
":",
"assert",
"kernel_size",
"%",
"2",
"==",
"1",
"first_offset",
"=",
"-",
"(",
"(",
"kernel_size",
"-",
"1",
")",
"//",
"2",
")",
"else",
":",
"assert",
"padding",
"==",
"\"LEFT\"",
"first_offset",
"=",
"-",
"(",
"kernel_size",
"-",
"1",
")",
"last_offset",
"=",
"first_offset",
"+",
"kernel_size",
"-",
"1",
"results",
"=",
"[",
"]",
"padded",
"=",
"tf",
".",
"pad",
"(",
"inputs",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"-",
"first_offset",
",",
"last_offset",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"for",
"i",
"in",
"range",
"(",
"kernel_size",
")",
":",
"shifted",
"=",
"tf",
".",
"slice",
"(",
"padded",
",",
"[",
"0",
",",
"i",
",",
"0",
"]",
",",
"tf",
".",
"shape",
"(",
"inputs",
")",
")",
"if",
"i",
"else",
"inputs",
"shifted",
".",
"set_shape",
"(",
"inputs",
".",
"get_shape",
"(",
")",
")",
"results",
".",
"append",
"(",
"dense",
"(",
"shifted",
",",
"filters",
",",
"use_bias",
"=",
"(",
"i",
"==",
"0",
")",
",",
"name",
"=",
"name",
"+",
"\"_%d\"",
"%",
"i",
")",
")",
"ret",
"=",
"tf",
".",
"add_n",
"(",
"results",
")",
"ret",
"*=",
"kernel_size",
"**",
"-",
"0.5",
"return",
"ret"
] |
Version of conv1d that works on TPU (as of 11/2017).
Args:
inputs: a Tensor with shape [batch, length, input_depth].
filters: an integer.
kernel_size: an integer.
padding: a string - "SAME" or "LEFT".
name: a string.
Returns:
a Tensor with shape [batch, length, filters].
|
[
"Version",
"of",
"conv1d",
"that",
"works",
"on",
"TPU",
"(",
"as",
"of",
"11",
"/",
"2017",
")",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L617-L648
|
train
|
Version of conv1d that works on TPU.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,y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ytesWarning,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' + '\x33' + chr(0b101100 + 0o6) + chr(0b1100 + 0o44), 0o10), ehT0Px3KOsy9(chr(48) + chr(1806 - 1695) + chr(0b110011) + '\061' + chr(0b1 + 0o66), 5826 - 5818), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(0b11 + 0o56) + '\x36', 23720 - 23712), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10000 + 0o44) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(0b10011 + 0o37) + '\x37' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(232 - 184) + '\x6f' + '\061' + '\x30' + chr(1922 - 1870), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(51) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(53) + chr(2768 - 2715), 47999 - 47991), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10011 + 0o40) + '\x30' + chr(0b11101 + 0o23), 0o10), ehT0Px3KOsy9('\x30' + chr(4487 - 4376) + chr(1912 - 1862) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37' + chr(0b11001 + 0o32), 0b1000), ehT0Px3KOsy9('\x30' + chr(8604 - 8493) + chr(0b110010 + 0o0) + chr(0b110011) + chr(49), 64524 - 64516), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b110101 + 0o72) + chr(1447 - 1397) + '\064' + chr(0b110111), 51126 - 51118), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(1307 - 1258) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(2035 - 1987) + chr(111) + chr(0b110001) + '\x35' + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100110 + 0o14) + '\061' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(50) + chr(55), 0o10), ehT0Px3KOsy9(chr(2089 - 2041) + '\157' + chr(817 - 767) + '\065' + chr(0b10 + 0o63), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + '\063' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b10111 + 0o130) + chr(0b11101 + 0o25) + chr(54) + '\x30', 5660 - 5652), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + '\x33' + '\060' + '\x33', 23224 - 23216), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\x34' + '\064', 0b1000), ehT0Px3KOsy9(chr(839 - 791) + chr(0b1010111 + 0o30) + '\x32' + '\061' + '\x33', 37689 - 37681), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x33' + '\066', 39856 - 39848), ehT0Px3KOsy9(chr(1308 - 1260) + chr(111) + chr(0b110010 + 0o1) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1706 - 1658) + '\x6f' + chr(0b110110) + chr(0b11101 + 0o32), 0o10), ehT0Px3KOsy9('\060' + chr(11089 - 10978) + chr(0b110001) + '\065' + chr(0b100101 + 0o15), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b1111 + 0o42) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(11536 - 11425) + '\062' + chr(1230 - 1180) + chr(2719 - 2666), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b10111 + 0o40) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(2431 - 2381) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6974 - 6863) + chr(0b110010) + '\066' + chr(0b11000 + 0o30), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b111 + 0o51) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(0b10011 + 0o40) + '\064', 52312 - 52304), ehT0Px3KOsy9(chr(1414 - 1366) + chr(8654 - 8543) + chr(0b110001) + '\x36' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b111001 + 0o66) + chr(51) + chr(0b101100 + 0o10) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1767 - 1716) + chr(428 - 380) + chr(0b101001 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\x36' + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(1526 - 1415) + chr(50) + chr(0b10000 + 0o40) + '\066', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(3898 - 3787) + chr(0b111 + 0o56) + chr(48), 21002 - 20994)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe'), '\x64' + '\x65' + chr(99) + '\x6f' + chr(9076 - 8976) + chr(0b1001 + 0o134))(chr(117) + chr(4236 - 4120) + chr(0b100100 + 0o102) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def o1rZz41nLKdE(vXoupepMtCXU, MErh319F3bgE, m6gwVXy4D3Au, TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\x8e\xc3g'), '\144' + chr(101) + '\x63' + chr(0b1101111) + chr(6840 - 6740) + chr(101))('\x75' + chr(9162 - 9046) + chr(0b1100110) + chr(45) + chr(0b10 + 0o66)), AIvJRzLdDfgF=xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4\xbf\xfb}\xd9+\xf4\x1b\xf1v'), '\x64' + chr(101) + chr(0b1100011) + chr(0b1011111 + 0o20) + '\144' + chr(101))(chr(117) + '\164' + chr(102) + chr(0b101101) + chr(2108 - 2052))):
if m6gwVXy4D3Au == ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49), 0b1000):
return AM71TO6gBqHa(vXoupepMtCXU, MErh319F3bgE, name=AIvJRzLdDfgF, use_bias=ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 8))
if TFLseEYASEKG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\x8e\xc3g'), '\144' + chr(101) + chr(0b1100011) + chr(111) + '\144' + chr(101))('\165' + chr(116) + chr(0b10011 + 0o123) + '\x2d' + chr(56)):
assert m6gwVXy4D3Au % ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1100000 + 0o17) + '\062', 0o10) == ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(0b110001), 8)
ZZwH2uYWWYT1 = -((m6gwVXy4D3Au - ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001), 8)) // ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(0b10110 + 0o34), 8))
else:
assert TFLseEYASEKG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x9c\x8a\xc8v'), chr(2351 - 2251) + chr(0b1 + 0o144) + chr(99) + '\157' + '\x64' + '\145')('\165' + chr(116) + chr(0b111011 + 0o53) + chr(0b101101) + chr(0b1000 + 0o60))
ZZwH2uYWWYT1 = -(m6gwVXy4D3Au - ehT0Px3KOsy9('\x30' + chr(6720 - 6609) + chr(0b110001), 8))
ehnuwRQqfnnI = ZZwH2uYWWYT1 + m6gwVXy4D3Au - ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8)
iIGKX2zSEGYP = []
Jr6qMmXilxlt = IDJ2eXGCBCDu.pad(vXoupepMtCXU, [[ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(48), 8)], [-ZZwH2uYWWYT1, ehnuwRQqfnnI], [ehT0Px3KOsy9(chr(2007 - 1959) + chr(0b1100 + 0o143) + chr(48), 8), ehT0Px3KOsy9('\060' + chr(111) + '\060', 8)]])
for WVxHKyX45z_L in vQr8gNKaIaWE(m6gwVXy4D3Au):
FseGXd0R6EWO = IDJ2eXGCBCDu.slice(Jr6qMmXilxlt, [ehT0Px3KOsy9(chr(1266 - 1218) + chr(0b1101111) + chr(0b110000), 8), WVxHKyX45z_L, ehT0Px3KOsy9(chr(1446 - 1398) + chr(8024 - 7913) + chr(1918 - 1870), 8)], IDJ2eXGCBCDu.nauYfLglTpcb(vXoupepMtCXU)) if WVxHKyX45z_L else vXoupepMtCXU
xafqLlk3kkUe(FseGXd0R6EWO, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3\xaa\xfa}\xc9,\xfb\x1d\xa5'), chr(0b1100100) + '\x65' + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(8640 - 8539))(chr(0b1010110 + 0o37) + chr(7354 - 7238) + chr(7453 - 7351) + chr(45) + '\x38'))(xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7\xaa\xfa}\xc9,\xfb\x1d\xa5'), '\144' + '\x65' + chr(7508 - 7409) + '\157' + '\144' + chr(8002 - 7901))('\x75' + '\164' + chr(102) + chr(0b101101) + '\x38'))())
xafqLlk3kkUe(iIGKX2zSEGYP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb1\xbf\xfeG\xd4 '), '\144' + chr(8044 - 7943) + chr(99) + chr(0b1101111) + '\144' + '\145')(chr(8709 - 8592) + '\x74' + chr(1103 - 1001) + chr(0b101101) + '\x38'))(AM71TO6gBqHa(FseGXd0R6EWO, MErh319F3bgE, use_bias=WVxHKyX45z_L == ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + '\060', 8), name=AIvJRzLdDfgF + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f\xea\xea'), chr(2011 - 1911) + '\x65' + chr(5732 - 5633) + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + chr(116) + chr(0b1100010 + 0o4) + '\x2d' + chr(56)) % WVxHKyX45z_L))
VHn4CV4Ymrei = IDJ2eXGCBCDu.add_n(iIGKX2zSEGYP)
VHn4CV4Ymrei *= m6gwVXy4D3Au ** (-0.5)
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
layer_norm_vars
|
def layer_norm_vars(filters):
"""Create Variables for layer norm."""
scale = tf.get_variable(
"layer_norm_scale", [filters], initializer=tf.ones_initializer())
bias = tf.get_variable(
"layer_norm_bias", [filters], initializer=tf.zeros_initializer())
return scale, bias
|
python
|
def layer_norm_vars(filters):
"""Create Variables for layer norm."""
scale = tf.get_variable(
"layer_norm_scale", [filters], initializer=tf.ones_initializer())
bias = tf.get_variable(
"layer_norm_bias", [filters], initializer=tf.zeros_initializer())
return scale, bias
|
[
"def",
"layer_norm_vars",
"(",
"filters",
")",
":",
"scale",
"=",
"tf",
".",
"get_variable",
"(",
"\"layer_norm_scale\"",
",",
"[",
"filters",
"]",
",",
"initializer",
"=",
"tf",
".",
"ones_initializer",
"(",
")",
")",
"bias",
"=",
"tf",
".",
"get_variable",
"(",
"\"layer_norm_bias\"",
",",
"[",
"filters",
"]",
",",
"initializer",
"=",
"tf",
".",
"zeros_initializer",
"(",
")",
")",
"return",
"scale",
",",
"bias"
] |
Create Variables for layer norm.
|
[
"Create",
"Variables",
"for",
"layer",
"norm",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L651-L657
|
train
|
Create Variables for layer norm.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt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ZvXL8qwsX,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' + '\157' + chr(0b100000 + 0o25) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(0b100100 + 0o113) + '\x33' + chr(50) + '\x34', 0o10), ehT0Px3KOsy9(chr(235 - 187) + chr(847 - 736) + chr(0b110011) + chr(0b1011 + 0o54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(10678 - 10567) + chr(0b110001) + chr(366 - 312) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(405 - 356) + chr(48) + chr(0b10010 + 0o37), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2387 - 2276) + '\064' + chr(0b110010), 12839 - 12831), ehT0Px3KOsy9(chr(956 - 908) + chr(0b1101111) + chr(51) + chr(0b110111) + chr(0b100010 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(0b110011) + '\x37' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + '\x31' + chr(2326 - 2275) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(1700 - 1652) + chr(0b10011 + 0o134) + '\x34' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(7370 - 7259) + '\x31' + '\x36' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(1717 - 1606) + '\061' + chr(1645 - 1592) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(1366 - 1312) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11556 - 11445) + '\x32' + chr(0b11111 + 0o26), 19017 - 19009), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b110101) + chr(0b10011 + 0o40), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b110110) + chr(0b100111 + 0o20), 0o10), ehT0Px3KOsy9(chr(563 - 515) + chr(2315 - 2204) + chr(51) + chr(0b1001 + 0o53), 44461 - 44453), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(6123 - 6012) + chr(0b110010) + chr(54) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110100) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110110) + chr(48), 19489 - 19481), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(50) + chr(1197 - 1149), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b10111 + 0o33) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + '\x31' + chr(0b110000) + '\061', 8), ehT0Px3KOsy9(chr(395 - 347) + '\157' + chr(1258 - 1204) + chr(1098 - 1045), 4640 - 4632), ehT0Px3KOsy9(chr(2237 - 2189) + '\157' + chr(49) + chr(54) + '\062', 3734 - 3726), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(4907 - 4796) + chr(49) + '\x34' + '\x32', 24680 - 24672), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b110110) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4194 - 4083) + chr(51) + chr(1670 - 1620) + chr(0b11000 + 0o33), 0b1000), ehT0Px3KOsy9(chr(432 - 384) + chr(111) + '\x32' + chr(0b101111 + 0o5), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101110 + 0o1) + '\061' + '\064' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(763 - 714) + chr(0b110001) + chr(0b10001 + 0o37), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\x33' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11660 - 11549) + chr(53) + '\x31', 52387 - 52379), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(9558 - 9447) + chr(0b1010 + 0o51) + '\060' + chr(0b10000 + 0o45), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110010) + chr(1107 - 1053), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101111 + 0o2) + '\x31' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + chr(0b110011) + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(818 - 768) + chr(54) + '\064', 51739 - 51731), ehT0Px3KOsy9(chr(48) + chr(10719 - 10608) + chr(370 - 320) + chr(0b110111) + '\065', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + '\065' + chr(2225 - 2177), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x01'), chr(100) + chr(0b1100101) + chr(0b111001 + 0o52) + chr(0b10011 + 0o134) + chr(0b1100100) + '\x65')(chr(2519 - 2402) + '\164' + chr(4912 - 4810) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def odQDHnrcnffS(MErh319F3bgE):
xjPLimsZRgb9 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'C\xb5f\x163}\x95\x91(N/\x1a\x95t\x87\xd2'), chr(3177 - 3077) + chr(3437 - 3336) + chr(99) + chr(0b1101111) + chr(100) + chr(8919 - 8818))(chr(0b100 + 0o161) + chr(116) + chr(102) + chr(395 - 350) + '\070'), [MErh319F3bgE], initializer=IDJ2eXGCBCDu.ones_initializer())
IKTrMTySqz10 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'C\xb5f\x163}\x95\x91(N/\x0b\x9ft\x98'), chr(8007 - 7907) + chr(101) + chr(0b1100011) + chr(0b1101111) + '\x64' + '\x65')('\x75' + chr(13063 - 12947) + chr(0b1100110) + '\055' + chr(0b111000)), [MErh319F3bgE], initializer=IDJ2eXGCBCDu.zeros_initializer())
return (xjPLimsZRgb9, IKTrMTySqz10)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
layer_norm_compute
|
def layer_norm_compute(x, epsilon, scale, bias, layer_collection=None):
"""Layer norm raw computation."""
# Save these before they get converted to tensors by the casting below
params = (scale, bias)
epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
mean = tf.reduce_mean(x, axis=[-1], keepdims=True)
variance = tf.reduce_mean(
tf.squared_difference(x, mean), axis=[-1], keepdims=True)
norm_x = (x - mean) * tf.rsqrt(variance + epsilon)
output = norm_x * scale + bias
return output
|
python
|
def layer_norm_compute(x, epsilon, scale, bias, layer_collection=None):
"""Layer norm raw computation."""
# Save these before they get converted to tensors by the casting below
params = (scale, bias)
epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
mean = tf.reduce_mean(x, axis=[-1], keepdims=True)
variance = tf.reduce_mean(
tf.squared_difference(x, mean), axis=[-1], keepdims=True)
norm_x = (x - mean) * tf.rsqrt(variance + epsilon)
output = norm_x * scale + bias
return output
|
[
"def",
"layer_norm_compute",
"(",
"x",
",",
"epsilon",
",",
"scale",
",",
"bias",
",",
"layer_collection",
"=",
"None",
")",
":",
"# Save these before they get converted to tensors by the casting below",
"params",
"=",
"(",
"scale",
",",
"bias",
")",
"epsilon",
",",
"scale",
",",
"bias",
"=",
"[",
"cast_like",
"(",
"t",
",",
"x",
")",
"for",
"t",
"in",
"[",
"epsilon",
",",
"scale",
",",
"bias",
"]",
"]",
"mean",
"=",
"tf",
".",
"reduce_mean",
"(",
"x",
",",
"axis",
"=",
"[",
"-",
"1",
"]",
",",
"keepdims",
"=",
"True",
")",
"variance",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"squared_difference",
"(",
"x",
",",
"mean",
")",
",",
"axis",
"=",
"[",
"-",
"1",
"]",
",",
"keepdims",
"=",
"True",
")",
"norm_x",
"=",
"(",
"x",
"-",
"mean",
")",
"*",
"tf",
".",
"rsqrt",
"(",
"variance",
"+",
"epsilon",
")",
"output",
"=",
"norm_x",
"*",
"scale",
"+",
"bias",
"return",
"output"
] |
Layer norm raw computation.
|
[
"Layer",
"norm",
"raw",
"computation",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L660-L675
|
train
|
Layer norm raw computation.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjV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Error,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(0b11001 + 0o30) + chr(1720 - 1666) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2293 - 2182) + chr(52) + chr(50), 0b1000), ehT0Px3KOsy9(chr(2011 - 1963) + '\157' + chr(2067 - 2017) + '\065' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(51) + chr(55) + '\061', 0o10), ehT0Px3KOsy9(chr(1446 - 1398) + '\x6f' + '\x31' + '\x31' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(53) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x30' + chr(0b110101), 10126 - 10118), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110100) + chr(0b100 + 0o62), 3912 - 3904), ehT0Px3KOsy9(chr(813 - 765) + '\157' + chr(0b100 + 0o57) + '\067' + '\067', 0b1000), ehT0Px3KOsy9(chr(1249 - 1201) + '\157' + chr(0b100110 + 0o15) + chr(2622 - 2569) + chr(0b100110 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10 + 0o61) + chr(0b1001 + 0o55), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10100 + 0o37) + '\x35' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b110101) + '\067', 29999 - 29991), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(52), 43316 - 43308), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100011 + 0o22) + chr(700 - 650), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x32' + chr(0b110100), 51413 - 51405), ehT0Px3KOsy9('\x30' + '\157' + chr(2938 - 2883) + '\064', 36574 - 36566), ehT0Px3KOsy9('\x30' + chr(0b1001110 + 0o41) + '\x33' + '\x33', 47311 - 47303), ehT0Px3KOsy9(chr(1575 - 1527) + '\157' + chr(51) + chr(0b110010) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(5312 - 5201) + chr(0b100010 + 0o21) + chr(0b1010 + 0o50) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(51) + chr(0b11001 + 0o32) + '\067', 45934 - 45926), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(11426 - 11315) + chr(51) + chr(55) + '\065', 14518 - 14510), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(51) + chr(2393 - 2339), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1554 - 1503) + chr(2635 - 2581) + chr(283 - 229), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(52), 8), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(12266 - 12155) + chr(0b110011) + chr(0b110101) + chr(0b10111 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1699 - 1649) + chr(0b11011 + 0o31) + '\060', 28918 - 28910), ehT0Px3KOsy9(chr(48) + '\157' + chr(2135 - 2086) + chr(1524 - 1471) + '\065', 0b1000), ehT0Px3KOsy9(chr(837 - 789) + chr(0b1000001 + 0o56) + '\x32' + chr(0b110100 + 0o3) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(676 - 627) + chr(2184 - 2132) + chr(323 - 272), 44183 - 44175), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + '\062' + '\x35' + '\x32', 8), ehT0Px3KOsy9(chr(720 - 672) + '\157' + chr(0b110011) + '\064' + chr(0b101 + 0o55), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\061' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(2008 - 1959) + chr(54), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(632 - 583) + chr(2586 - 2531) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8851 - 8740) + '\067' + chr(363 - 311), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b110001) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(1678 - 1567) + chr(1347 - 1297) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(89 - 41) + '\157' + chr(467 - 419), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1221 - 1173) + '\157' + '\065' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'X'), chr(0b1110 + 0o126) + chr(0b1100101) + '\x63' + chr(3922 - 3811) + chr(6898 - 6798) + chr(9379 - 9278))(chr(11434 - 11317) + '\164' + '\146' + chr(619 - 574) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hwU74GPyNW1U(OeWW0F1dBPRQ, Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10, QhNZfIyyHZe2=None):
nEbJZ4wfte2w = (xjPLimsZRgb9, IKTrMTySqz10)
(Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10) = [QzW8kYNS1xWf(YeT3l7JgTbWR, OeWW0F1dBPRQ) for YeT3l7JgTbWR in [Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10]]
aJhItC_Vawlw = IDJ2eXGCBCDu.reduce_mean(OeWW0F1dBPRQ, axis=[-ehT0Px3KOsy9('\060' + '\157' + chr(49), ord("\x08"))], keepdims=ehT0Px3KOsy9('\060' + chr(4096 - 3985) + chr(49), 8))
nVKbP5sF7181 = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(OeWW0F1dBPRQ, aJhItC_Vawlw), axis=[-ehT0Px3KOsy9('\x30' + '\157' + chr(0b100100 + 0o15), 8)], keepdims=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061', 8))
dTl75bALqheE = (OeWW0F1dBPRQ - aJhItC_Vawlw) * IDJ2eXGCBCDu.rsqrt(nVKbP5sF7181 + Xtig2zAKpR0T)
e1jVqMSBZ01Y = dTl75bALqheE * xjPLimsZRgb9 + IKTrMTySqz10
return e1jVqMSBZ01Y
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
layer_norm
|
def layer_norm(x,
filters=None,
epsilon=1e-6,
name=None,
reuse=None,
layer_collection=None):
"""Layer normalize the tensor x, averaging over the last dimension."""
if filters is None:
filters = shape_list(x)[-1]
with tf.variable_scope(
name, default_name="layer_norm", values=[x], reuse=reuse):
scale, bias = layer_norm_vars(filters)
return layer_norm_compute(x, epsilon, scale, bias,
layer_collection=layer_collection)
|
python
|
def layer_norm(x,
filters=None,
epsilon=1e-6,
name=None,
reuse=None,
layer_collection=None):
"""Layer normalize the tensor x, averaging over the last dimension."""
if filters is None:
filters = shape_list(x)[-1]
with tf.variable_scope(
name, default_name="layer_norm", values=[x], reuse=reuse):
scale, bias = layer_norm_vars(filters)
return layer_norm_compute(x, epsilon, scale, bias,
layer_collection=layer_collection)
|
[
"def",
"layer_norm",
"(",
"x",
",",
"filters",
"=",
"None",
",",
"epsilon",
"=",
"1e-6",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
",",
"layer_collection",
"=",
"None",
")",
":",
"if",
"filters",
"is",
"None",
":",
"filters",
"=",
"shape_list",
"(",
"x",
")",
"[",
"-",
"1",
"]",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"layer_norm\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"scale",
",",
"bias",
"=",
"layer_norm_vars",
"(",
"filters",
")",
"return",
"layer_norm_compute",
"(",
"x",
",",
"epsilon",
",",
"scale",
",",
"bias",
",",
"layer_collection",
"=",
"layer_collection",
")"
] |
Layer normalize the tensor x, averaging over the last dimension.
|
[
"Layer",
"normalize",
"the",
"tensor",
"x",
"averaging",
"over",
"the",
"last",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L678-L691
|
train
|
Layer normalize the tensor x averaging over the last dimension.
|
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,h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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('\x30' + '\x6f' + chr(0b100111 + 0o12) + chr(0b11001 + 0o27) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + '\x31' + '\065' + chr(738 - 689), 8055 - 8047), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b11111 + 0o21), 0b1000), ehT0Px3KOsy9('\x30' + chr(4164 - 4053) + chr(0b11001 + 0o30) + '\064' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(1007 - 959) + chr(111) + chr(2014 - 1964) + '\x35' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10050 - 9939) + chr(2460 - 2410) + chr(1994 - 1941) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(51) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(55) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b110101) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(5098 - 4987) + chr(0b110110) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + '\063' + chr(0b110011) + chr(0b101100 + 0o5), 52672 - 52664), ehT0Px3KOsy9('\060' + chr(111) + chr(1200 - 1151) + chr(0b100101 + 0o17) + chr(55), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\064' + '\060', 0b1000), ehT0Px3KOsy9(chr(2261 - 2213) + chr(111) + chr(0b10110 + 0o33) + '\x36' + chr(776 - 724), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(323 - 272) + '\x32', 4218 - 4210), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(2093 - 2043) + chr(1973 - 1920) + chr(0b11101 + 0o23), 30584 - 30576), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(571 - 522) + chr(0b1100 + 0o50) + chr(125 - 74), 41686 - 41678), ehT0Px3KOsy9('\x30' + chr(4680 - 4569) + chr(0b110010) + chr(2352 - 2300) + chr(0b10011 + 0o42), 0b1000), ehT0Px3KOsy9('\060' + chr(4931 - 4820) + chr(49) + '\066' + '\x34', 8), ehT0Px3KOsy9(chr(701 - 653) + '\157' + chr(561 - 510) + chr(0b110100 + 0o2) + chr(467 - 414), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b110110) + '\x31', 31421 - 31413), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(1710 - 1658) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(50) + chr(0b110 + 0o60) + chr(48), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + '\063' + chr(1648 - 1594), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4774 - 4663) + '\061' + chr(0b1010 + 0o55) + chr(633 - 580), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x33' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(0b110011) + '\x34' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + '\x30' + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b110001) + chr(2305 - 2256), 0o10), ehT0Px3KOsy9(chr(277 - 229) + chr(0b10111 + 0o130) + chr(0b10000 + 0o42) + '\065' + chr(0b110001), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(2345 - 2296) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + chr(49) + '\x32' + chr(0b100110 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b111 + 0o150) + chr(51) + chr(0b1111 + 0o43) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101011 + 0o104) + chr(0b11110 + 0o23) + chr(449 - 398) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\x31' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\x36' + chr(1430 - 1377), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(54) + chr(1619 - 1568), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101001 + 0o11) + chr(0b110111) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(51) + chr(49) + chr(2165 - 2110), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(53) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'k'), chr(100) + chr(0b1100101) + chr(0b1000000 + 0o43) + chr(0b10100 + 0o133) + chr(4937 - 4837) + chr(2822 - 2721))(chr(0b1100010 + 0o23) + '\164' + '\x66' + chr(99 - 54) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def EbVYEOXA2Nzq(OeWW0F1dBPRQ, MErh319F3bgE=None, Xtig2zAKpR0T=1e-06, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None, QhNZfIyyHZe2=None):
if MErh319F3bgE is None:
MErh319F3bgE = qypPRW8fq869(OeWW0F1dBPRQ)[-ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001), ord("\x08"))]
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'3\x08j\x08\xcd\xcb\xb1^7G\xba\x08\xd0\x11'), chr(0b1100100) + chr(0b110110 + 0o57) + chr(0b1100011) + chr(111) + chr(0b1111 + 0o125) + chr(0b1100101))(chr(0b110111 + 0o76) + chr(0b100010 + 0o122) + chr(0b1100110) + '\x2d' + chr(0b101101 + 0o13)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b')\x08a\x04\xde\xf6\xb3T\x1aY'), '\144' + chr(0b1000000 + 0o45) + chr(0b1100011) + chr(111) + '\x64' + chr(101))(chr(117) + '\x74' + '\146' + chr(45) + '\x38'), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
(xjPLimsZRgb9, IKTrMTySqz10) = odQDHnrcnffS(MErh319F3bgE)
return hwU74GPyNW1U(OeWW0F1dBPRQ, Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10, layer_collection=QhNZfIyyHZe2)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
group_norm
|
def group_norm(x, filters=None, num_groups=8, epsilon=1e-5):
"""Group normalization as in https://arxiv.org/abs/1803.08494."""
x_shape = shape_list(x)
if filters is None:
filters = x_shape[-1]
assert len(x_shape) == 4
assert filters % num_groups == 0
# Prepare variables.
scale = tf.get_variable(
"group_norm_scale", [filters], initializer=tf.ones_initializer())
bias = tf.get_variable(
"group_norm_bias", [filters], initializer=tf.zeros_initializer())
epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
# Reshape and compute group norm.
x = tf.reshape(x, x_shape[:-1] + [num_groups, filters // num_groups])
# Calculate mean and variance on heights, width, channels (not groups).
mean, variance = tf.nn.moments(x, [1, 2, 4], keep_dims=True)
norm_x = (x - mean) * tf.rsqrt(variance + epsilon)
return tf.reshape(norm_x, x_shape) * scale + bias
|
python
|
def group_norm(x, filters=None, num_groups=8, epsilon=1e-5):
"""Group normalization as in https://arxiv.org/abs/1803.08494."""
x_shape = shape_list(x)
if filters is None:
filters = x_shape[-1]
assert len(x_shape) == 4
assert filters % num_groups == 0
# Prepare variables.
scale = tf.get_variable(
"group_norm_scale", [filters], initializer=tf.ones_initializer())
bias = tf.get_variable(
"group_norm_bias", [filters], initializer=tf.zeros_initializer())
epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
# Reshape and compute group norm.
x = tf.reshape(x, x_shape[:-1] + [num_groups, filters // num_groups])
# Calculate mean and variance on heights, width, channels (not groups).
mean, variance = tf.nn.moments(x, [1, 2, 4], keep_dims=True)
norm_x = (x - mean) * tf.rsqrt(variance + epsilon)
return tf.reshape(norm_x, x_shape) * scale + bias
|
[
"def",
"group_norm",
"(",
"x",
",",
"filters",
"=",
"None",
",",
"num_groups",
"=",
"8",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"if",
"filters",
"is",
"None",
":",
"filters",
"=",
"x_shape",
"[",
"-",
"1",
"]",
"assert",
"len",
"(",
"x_shape",
")",
"==",
"4",
"assert",
"filters",
"%",
"num_groups",
"==",
"0",
"# Prepare variables.",
"scale",
"=",
"tf",
".",
"get_variable",
"(",
"\"group_norm_scale\"",
",",
"[",
"filters",
"]",
",",
"initializer",
"=",
"tf",
".",
"ones_initializer",
"(",
")",
")",
"bias",
"=",
"tf",
".",
"get_variable",
"(",
"\"group_norm_bias\"",
",",
"[",
"filters",
"]",
",",
"initializer",
"=",
"tf",
".",
"zeros_initializer",
"(",
")",
")",
"epsilon",
",",
"scale",
",",
"bias",
"=",
"[",
"cast_like",
"(",
"t",
",",
"x",
")",
"for",
"t",
"in",
"[",
"epsilon",
",",
"scale",
",",
"bias",
"]",
"]",
"# Reshape and compute group norm.",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"num_groups",
",",
"filters",
"//",
"num_groups",
"]",
")",
"# Calculate mean and variance on heights, width, channels (not groups).",
"mean",
",",
"variance",
"=",
"tf",
".",
"nn",
".",
"moments",
"(",
"x",
",",
"[",
"1",
",",
"2",
",",
"4",
"]",
",",
"keep_dims",
"=",
"True",
")",
"norm_x",
"=",
"(",
"x",
"-",
"mean",
")",
"*",
"tf",
".",
"rsqrt",
"(",
"variance",
"+",
"epsilon",
")",
"return",
"tf",
".",
"reshape",
"(",
"norm_x",
",",
"x_shape",
")",
"*",
"scale",
"+",
"bias"
] |
Group normalization as in https://arxiv.org/abs/1803.08494.
|
[
"Group",
"normalization",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1803",
".",
"08494",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L694-L712
|
train
|
Group normalization as in https://arxiv. org. abs. 1803. 08494.
|
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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,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) + '\062' + chr(497 - 449) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + chr(50) + chr(0b11000 + 0o37) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\x37' + chr(2027 - 1974), ord("\x08")), ehT0Px3KOsy9(chr(1368 - 1320) + chr(9569 - 9458) + chr(55) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110101) + chr(53), 1451 - 1443), ehT0Px3KOsy9(chr(1596 - 1548) + '\157' + '\061' + chr(1450 - 1398) + '\061', 0b1000), ehT0Px3KOsy9(chr(1700 - 1652) + chr(0b10011 + 0o134) + '\062' + chr(0b110 + 0o55) + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000011 + 0o54) + chr(50) + chr(0b110001) + chr(0b11110 + 0o25), 52103 - 52095), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b110111) + '\x37', 0o10), ehT0Px3KOsy9(chr(1706 - 1658) + chr(0b1000100 + 0o53) + '\062' + '\061', 33262 - 33254), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b10010 + 0o43) + chr(619 - 569), 56136 - 56128), ehT0Px3KOsy9('\060' + chr(0b1000101 + 0o52) + '\063' + chr(0b101100 + 0o10) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(12112 - 12001) + chr(0b1000 + 0o55) + '\066', 55854 - 55846), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b110111) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(1323 - 1270) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(55) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\067' + chr(0b11100 + 0o33), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b10010 + 0o41) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(140 - 91) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10732 - 10621) + chr(642 - 589) + chr(48), 33904 - 33896), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(48) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(6291 - 6180) + chr(0b101001 + 0o11) + chr(51) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10001 + 0o41) + '\x36' + chr(0b101100 + 0o11), ord("\x08")), ehT0Px3KOsy9(chr(1791 - 1743) + chr(111) + '\063' + chr(0b110101) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\060' + chr(1441 - 1387), 65165 - 65157), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(49) + chr(0b100111 + 0o14), 47736 - 47728), ehT0Px3KOsy9(chr(1928 - 1880) + chr(111) + chr(53), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(2159 - 2110) + '\x33', 51544 - 51536), ehT0Px3KOsy9(chr(990 - 942) + chr(0b1101111) + chr(49) + chr(0b110101 + 0o2) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(674 - 626) + '\157' + chr(362 - 312) + chr(52) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + '\062' + '\063' + chr(0b110110), 13820 - 13812), ehT0Px3KOsy9(chr(48) + '\157' + chr(2597 - 2546) + '\x31' + chr(0b1111 + 0o43), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1417 - 1368) + chr(0b1011 + 0o52) + '\063', 0b1000), ehT0Px3KOsy9(chr(762 - 714) + '\157' + chr(0b100110 + 0o17) + '\x30', 8), ehT0Px3KOsy9(chr(1899 - 1851) + chr(111) + '\064' + '\x35', 3735 - 3727), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1643 - 1594) + '\060' + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100101 + 0o16) + chr(0b110001) + chr(1244 - 1194), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\063' + '\067', 33069 - 33061)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1945 - 1897) + chr(0b1101111) + chr(53) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8'), chr(0b1100100) + chr(8441 - 8340) + '\x63' + chr(111) + chr(2434 - 2334) + chr(0b1100101))('\x75' + '\164' + '\146' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def soVcshbNn0vN(OeWW0F1dBPRQ, MErh319F3bgE=None, a39It4XsxVZ1=ehT0Px3KOsy9(chr(108 - 60) + '\157' + chr(881 - 832) + '\060', 0o10), Xtig2zAKpR0T=1e-05):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
if MErh319F3bgE is None:
MErh319F3bgE = QQEXXbdZyz6m[-ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(0b110001), 0b1000)]
assert c2A0yzQpDQB3(QQEXXbdZyz6m) == ehT0Px3KOsy9(chr(0b110000) + chr(1248 - 1137) + '\x34', 0b1000)
assert MErh319F3bgE % a39It4XsxVZ1 == ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(9360 - 9249) + chr(0b110000), 8)
xjPLimsZRgb9 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xcc\xd2N\x1d>\xf5\xe4\x1e\x92N\x19\x82O\x16L'), chr(100) + '\x65' + chr(0b1100011) + chr(0b1101010 + 0o5) + chr(0b100110 + 0o76) + chr(6341 - 6240))(chr(117) + chr(0b1110100) + '\146' + '\055' + chr(2887 - 2831)), [MErh319F3bgE], initializer=IDJ2eXGCBCDu.ones_initializer())
IKTrMTySqz10 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xcc\xd2N\x1d>\xf5\xe4\x1e\x92N\x08\x88O\t'), '\x64' + chr(0b1010001 + 0o24) + '\x63' + '\157' + chr(0b1100100) + chr(0b1010000 + 0o25))(chr(8503 - 8386) + chr(0b1110100) + '\146' + '\055' + '\x38'), [MErh319F3bgE], initializer=IDJ2eXGCBCDu.zeros_initializer())
(Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10) = [QzW8kYNS1xWf(YeT3l7JgTbWR, OeWW0F1dBPRQ) for YeT3l7JgTbWR in [Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10]]
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, QQEXXbdZyz6m[:-ehT0Px3KOsy9('\x30' + '\x6f' + chr(1386 - 1337), 8)] + [a39It4XsxVZ1, MErh319F3bgE // a39It4XsxVZ1])
(aJhItC_Vawlw, nVKbP5sF7181) = IDJ2eXGCBCDu.nn.moments(OeWW0F1dBPRQ, [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101 + 0o54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(659 - 548) + '\x34', 8)], keep_dims=ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8))
dTl75bALqheE = (OeWW0F1dBPRQ - aJhItC_Vawlw) * IDJ2eXGCBCDu.rsqrt(nVKbP5sF7181 + Xtig2zAKpR0T)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4\xdb\xceS\x0c\x11\xfe'), chr(0b1100100) + chr(0b1000011 + 0o42) + '\143' + chr(0b1101111) + chr(0b1100011 + 0o1) + chr(0b1001011 + 0o32))(chr(6379 - 6262) + chr(6050 - 5934) + chr(3835 - 3733) + '\x2d' + '\070'))(dTl75bALqheE, QQEXXbdZyz6m) * xjPLimsZRgb9 + IKTrMTySqz10
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
noam_norm
|
def noam_norm(x, epsilon=1.0, name=None):
"""One version of layer normalization."""
with tf.name_scope(name, default_name="noam_norm", values=[x]):
shape = x.get_shape()
ndims = len(shape)
return (tf.nn.l2_normalize(x, ndims - 1, epsilon=epsilon) * tf.sqrt(
to_float(shape[-1])))
|
python
|
def noam_norm(x, epsilon=1.0, name=None):
"""One version of layer normalization."""
with tf.name_scope(name, default_name="noam_norm", values=[x]):
shape = x.get_shape()
ndims = len(shape)
return (tf.nn.l2_normalize(x, ndims - 1, epsilon=epsilon) * tf.sqrt(
to_float(shape[-1])))
|
[
"def",
"noam_norm",
"(",
"x",
",",
"epsilon",
"=",
"1.0",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"default_name",
"=",
"\"noam_norm\"",
",",
"values",
"=",
"[",
"x",
"]",
")",
":",
"shape",
"=",
"x",
".",
"get_shape",
"(",
")",
"ndims",
"=",
"len",
"(",
"shape",
")",
"return",
"(",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"x",
",",
"ndims",
"-",
"1",
",",
"epsilon",
"=",
"epsilon",
")",
"*",
"tf",
".",
"sqrt",
"(",
"to_float",
"(",
"shape",
"[",
"-",
"1",
"]",
")",
")",
")"
] |
One version of layer normalization.
|
[
"One",
"version",
"of",
"layer",
"normalization",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L715-L721
|
train
|
One version of layer normalization.
|
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,N5Ee6d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DQB3,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(8179 - 8068) + chr(0b11111 + 0o23) + chr(0b100000 + 0o22) + chr(1628 - 1576), 54833 - 54825), ehT0Px3KOsy9('\060' + chr(0b1000101 + 0o52) + chr(0b11110 + 0o24) + chr(0b100001 + 0o25) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x37' + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101110 + 0o1) + '\061' + chr(704 - 652) + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010000 + 0o37) + chr(0b110011) + '\062' + chr(0b10110 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(1553 - 1442) + chr(0b10101 + 0o36) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1368 - 1320) + chr(3296 - 3185) + chr(49) + '\x31' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(12213 - 12102) + chr(2381 - 2332) + chr(0b110011) + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + chr(7406 - 7295) + chr(51) + '\064' + chr(0b110000), 16531 - 16523), ehT0Px3KOsy9(chr(2147 - 2099) + '\157' + '\x33' + chr(0b10 + 0o56) + '\x32', 16674 - 16666), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(365 - 317) + chr(6998 - 6887) + '\063' + '\x37' + '\064', 35568 - 35560), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1101 + 0o47) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7545 - 7434) + chr(0b110001) + '\x36' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101010 + 0o5) + chr(0b110010 + 0o1) + chr(0b1010 + 0o52) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(0b101001 + 0o12) + '\063' + chr(50), 17672 - 17664), ehT0Px3KOsy9('\x30' + chr(0b1011000 + 0o27) + chr(0b110011) + chr(52), 32086 - 32078), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1486 - 1435) + chr(0b101100 + 0o13), 0o10), ehT0Px3KOsy9(chr(292 - 244) + '\x6f' + chr(1636 - 1587) + chr(52) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(222 - 111) + '\062' + chr(0b11 + 0o61) + chr(50), 0o10), ehT0Px3KOsy9(chr(2108 - 2060) + '\157' + chr(51) + chr(0b11010 + 0o35) + chr(1117 - 1064), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101011 + 0o4) + chr(0b11010 + 0o27) + '\x35' + chr(0b101000 + 0o13), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(823 - 768) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(912 - 864) + chr(111) + chr(51) + chr(1578 - 1526) + chr(1057 - 1006), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b100000 + 0o25) + '\x32', 0b1000), ehT0Px3KOsy9(chr(749 - 701) + chr(0b1101111) + '\061' + '\x37' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(49) + '\060' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(1460 - 1349) + chr(2795 - 2740) + chr(645 - 595), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b110010) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(51) + chr(0b11100 + 0o27) + chr(266 - 212), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + chr(0b110010) + chr(0b10101 + 0o34) + chr(0b110011), 7152 - 7144), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(50) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(1265 - 1217) + '\x6f' + chr(0b1011 + 0o54) + '\x32', 8), ehT0Px3KOsy9(chr(0b110000) + chr(3237 - 3126) + '\x34' + chr(1434 - 1380), 39042 - 39034), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(55) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110010) + chr(0b101010 + 0o11), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + '\x33' + chr(683 - 633) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101110 + 0o5) + '\x31' + chr(0b110 + 0o52), 0b1000), ehT0Px3KOsy9(chr(2239 - 2191) + chr(4228 - 4117) + chr(0b110101) + chr(0b100000 + 0o22), 15835 - 15827), ehT0Px3KOsy9(chr(1949 - 1901) + '\157' + chr(0b110100) + chr(1899 - 1844), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(2503 - 2450) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xba'), chr(100) + '\x65' + '\x63' + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b10110 + 0o136) + '\146' + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def fiJWLgZ9moXY(OeWW0F1dBPRQ, Xtig2zAKpR0T=1.0, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xd0\x94\x03\x8en-5\x90\xa7'), chr(0b1100010 + 0o2) + chr(101) + chr(99) + chr(8519 - 8408) + chr(100) + chr(0b1100101))(chr(0b101011 + 0o112) + '\x74' + chr(5115 - 5013) + chr(1500 - 1455) + chr(56)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xde\x98\x0b\x8es!(\x8d'), chr(1840 - 1740) + chr(8599 - 8498) + chr(0b1 + 0o142) + '\x6f' + '\x64' + chr(0b1000010 + 0o43))(chr(0b111100 + 0o71) + chr(0b1010000 + 0o44) + chr(1339 - 1237) + chr(0b100110 + 0o7) + chr(0b101 + 0o63)), values=[OeWW0F1dBPRQ]):
nauYfLglTpcb = OeWW0F1dBPRQ.get_shape()
OLYL2NTQs758 = c2A0yzQpDQB3(nauYfLglTpcb)
return xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\x83\xa6\x08\xbeo#;\x8c\xabv\x99'), chr(100) + '\145' + '\x63' + '\x6f' + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b100000 + 0o106) + chr(45) + chr(56)))(OeWW0F1dBPRQ, OLYL2NTQs758 - ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b100111 + 0o110) + chr(0b110001), ord("\x08")), epsilon=Xtig2zAKpR0T) * xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7\xc0\x8b\x12'), chr(0b101100 + 0o70) + chr(2361 - 2260) + '\143' + chr(10251 - 10140) + chr(6624 - 6524) + '\x65')(chr(117) + chr(116) + '\x66' + chr(45) + chr(56)))(ZUL3kHBGU8Uu(nauYfLglTpcb[-ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + chr(0b110001), 8)]))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
l2_norm
|
def l2_norm(x, filters=None, epsilon=1e-6, name=None, reuse=None):
"""Layer normalization with l2 norm."""
if filters is None:
filters = shape_list(x)[-1]
with tf.variable_scope(name, default_name="l2_norm", values=[x], reuse=reuse):
scale = tf.get_variable(
"l2_norm_scale", [filters], initializer=tf.ones_initializer())
bias = tf.get_variable(
"l2_norm_bias", [filters], initializer=tf.zeros_initializer())
epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
mean = tf.reduce_mean(x, axis=[-1], keepdims=True)
l2norm = tf.reduce_sum(
tf.squared_difference(x, mean), axis=[-1], keepdims=True)
norm_x = (x - mean) * tf.rsqrt(l2norm + epsilon)
return norm_x * scale + bias
|
python
|
def l2_norm(x, filters=None, epsilon=1e-6, name=None, reuse=None):
"""Layer normalization with l2 norm."""
if filters is None:
filters = shape_list(x)[-1]
with tf.variable_scope(name, default_name="l2_norm", values=[x], reuse=reuse):
scale = tf.get_variable(
"l2_norm_scale", [filters], initializer=tf.ones_initializer())
bias = tf.get_variable(
"l2_norm_bias", [filters], initializer=tf.zeros_initializer())
epsilon, scale, bias = [cast_like(t, x) for t in [epsilon, scale, bias]]
mean = tf.reduce_mean(x, axis=[-1], keepdims=True)
l2norm = tf.reduce_sum(
tf.squared_difference(x, mean), axis=[-1], keepdims=True)
norm_x = (x - mean) * tf.rsqrt(l2norm + epsilon)
return norm_x * scale + bias
|
[
"def",
"l2_norm",
"(",
"x",
",",
"filters",
"=",
"None",
",",
"epsilon",
"=",
"1e-6",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"if",
"filters",
"is",
"None",
":",
"filters",
"=",
"shape_list",
"(",
"x",
")",
"[",
"-",
"1",
"]",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"l2_norm\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"scale",
"=",
"tf",
".",
"get_variable",
"(",
"\"l2_norm_scale\"",
",",
"[",
"filters",
"]",
",",
"initializer",
"=",
"tf",
".",
"ones_initializer",
"(",
")",
")",
"bias",
"=",
"tf",
".",
"get_variable",
"(",
"\"l2_norm_bias\"",
",",
"[",
"filters",
"]",
",",
"initializer",
"=",
"tf",
".",
"zeros_initializer",
"(",
")",
")",
"epsilon",
",",
"scale",
",",
"bias",
"=",
"[",
"cast_like",
"(",
"t",
",",
"x",
")",
"for",
"t",
"in",
"[",
"epsilon",
",",
"scale",
",",
"bias",
"]",
"]",
"mean",
"=",
"tf",
".",
"reduce_mean",
"(",
"x",
",",
"axis",
"=",
"[",
"-",
"1",
"]",
",",
"keepdims",
"=",
"True",
")",
"l2norm",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"squared_difference",
"(",
"x",
",",
"mean",
")",
",",
"axis",
"=",
"[",
"-",
"1",
"]",
",",
"keepdims",
"=",
"True",
")",
"norm_x",
"=",
"(",
"x",
"-",
"mean",
")",
"*",
"tf",
".",
"rsqrt",
"(",
"l2norm",
"+",
"epsilon",
")",
"return",
"norm_x",
"*",
"scale",
"+",
"bias"
] |
Layer normalization with l2 norm.
|
[
"Layer",
"normalization",
"with",
"l2",
"norm",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L724-L738
|
train
|
Layer normalization with l2 norm.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy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Error,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) + '\x33' + chr(1162 - 1111) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + '\067' + chr(0b11110 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(453 - 405) + '\x6f' + chr(0b1111 + 0o44) + '\x31' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(2064 - 2016) + '\x6f' + chr(0b110001) + chr(54) + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b100000 + 0o25) + chr(1814 - 1762), 45380 - 45372), ehT0Px3KOsy9(chr(1682 - 1634) + chr(111) + chr(0b110001) + chr(761 - 707) + chr(0b110110), 8), ehT0Px3KOsy9('\060' + chr(6584 - 6473) + '\x36' + chr(0b10111 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(2418 - 2367) + chr(0b110010) + chr(2058 - 2010), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1010 + 0o47) + chr(0b100 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(51) + chr(1409 - 1361) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(1689 - 1640), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1111 + 0o43) + chr(134 - 86) + chr(1394 - 1346), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + '\065' + chr(0b110111), 41107 - 41099), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1001000 + 0o47) + chr(0b110010) + chr(2371 - 2318) + '\x33', 0b1000), ehT0Px3KOsy9(chr(2232 - 2184) + '\x6f' + chr(0b110001) + chr(1509 - 1457) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + '\x33' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11884 - 11773) + '\067' + chr(0b11100 + 0o30), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(0b110100) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(812 - 764) + chr(111) + '\x32' + chr(0b1001 + 0o47) + chr(53), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b111 + 0o54) + '\x31' + '\066', 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b101000 + 0o107) + '\062' + '\x37' + chr(0b10101 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1802 - 1691) + chr(0b11000 + 0o35) + chr(1216 - 1164), 25477 - 25469), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11011 + 0o26) + chr(0b101100 + 0o12) + chr(0b100011 + 0o15), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8519 - 8408) + chr(0b110010) + '\067' + chr(50), 21537 - 21529), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b110101) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010 + 0o1) + chr(2462 - 2410) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(705 - 594) + '\063' + '\x37' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(0b110001) + chr(0b110110) + chr(0b110111), 53265 - 53257), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111101 + 0o62) + '\062' + '\066' + '\x32', 24216 - 24208), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + '\x31' + '\066', 8), ehT0Px3KOsy9(chr(48) + chr(8642 - 8531) + chr(0b110011) + '\x34' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b110100) + chr(2185 - 2136), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(48) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110011) + chr(2379 - 2330), ord("\x08")), ehT0Px3KOsy9('\060' + chr(9981 - 9870) + '\x35' + chr(48), 0o10), ehT0Px3KOsy9(chr(2108 - 2060) + '\157' + '\x31' + chr(52) + '\067', 1532 - 1524), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(2550 - 2496) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + '\x33' + chr(0b110010) + '\x37', 61893 - 61885), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1590 - 1536) + chr(0b100111 + 0o14), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1960 - 1912) + chr(10550 - 10439) + chr(942 - 889) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf6'), chr(0b11111 + 0o105) + chr(3293 - 3192) + '\x63' + '\157' + '\x64' + chr(0b1000010 + 0o43))('\165' + chr(9911 - 9795) + chr(0b1100110) + '\x2d' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def TW9wV0gSFoa6(OeWW0F1dBPRQ, MErh319F3bgE=None, Xtig2zAKpR0T=1e-06, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
if MErh319F3bgE is None:
MErh319F3bgE = qypPRW8fq869(OeWW0F1dBPRQ)[-ehT0Px3KOsy9(chr(656 - 608) + chr(111) + '\061', 62635 - 62627)]
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xae\x9b\xbc\x1f\x8d\x14[\xb5T\xb1r\xef\x9f\xce'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(111) + chr(0b100100 + 0o100) + '\x65')(chr(0b1110101) + '\164' + chr(102) + chr(0b101101) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\xc8\x91\x18\x83\x04Z'), chr(100) + chr(0b1100101) + '\x63' + '\157' + chr(2718 - 2618) + chr(8789 - 8688))(chr(0b1110101) + '\x74' + chr(9038 - 8936) + chr(45) + chr(56)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
xjPLimsZRgb9 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\xc8\x91\x18\x83\x04Z\x8fx\xa1p\xec\x8a'), chr(3304 - 3204) + chr(3888 - 3787) + '\x63' + '\157' + '\x64' + chr(0b1100101))(chr(0b1011110 + 0o27) + '\164' + '\146' + chr(0b101101) + chr(0b111000)), [MErh319F3bgE], initializer=IDJ2eXGCBCDu.ones_initializer())
IKTrMTySqz10 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\xc8\x91\x18\x83\x04Z\x8fi\xabp\xf3'), chr(0b11110 + 0o106) + chr(1419 - 1318) + '\143' + chr(0b1101111) + chr(100) + chr(101))('\x75' + chr(116) + chr(1536 - 1434) + chr(45) + chr(2628 - 2572)), [MErh319F3bgE], initializer=IDJ2eXGCBCDu.zeros_initializer())
(Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10) = [QzW8kYNS1xWf(YeT3l7JgTbWR, OeWW0F1dBPRQ) for YeT3l7JgTbWR in [Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10]]
aJhItC_Vawlw = IDJ2eXGCBCDu.reduce_mean(OeWW0F1dBPRQ, axis=[-ehT0Px3KOsy9(chr(1149 - 1101) + '\157' + '\061', 8)], keepdims=ehT0Px3KOsy9(chr(48) + '\157' + '\061', 8))
Cce7kc9FbvNl = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.squared_difference(OeWW0F1dBPRQ, aJhItC_Vawlw), axis=[-ehT0Px3KOsy9(chr(48) + '\157' + chr(0b0 + 0o61), 8)], keepdims=ehT0Px3KOsy9(chr(723 - 675) + chr(0b1101111) + chr(240 - 191), 8))
dTl75bALqheE = (OeWW0F1dBPRQ - aJhItC_Vawlw) * IDJ2eXGCBCDu.rsqrt(Cce7kc9FbvNl + Xtig2zAKpR0T)
return dTl75bALqheE * xjPLimsZRgb9 + IKTrMTySqz10
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
apply_spectral_norm
|
def apply_spectral_norm(x):
"""Normalizes x using the spectral norm.
The implementation follows Algorithm 1 of
https://arxiv.org/abs/1802.05957. If x is not a 2-D Tensor, then it is
reshaped such that the number of channels (last-dimension) is the same.
Args:
x: Tensor with the last dimension equal to the number of filters.
Returns:
x: Tensor with the same shape as x normalized by the spectral norm.
assign_op: Op to be run after every step to update the vector "u".
"""
weights_shape = shape_list(x)
other, num_filters = tf.reduce_prod(weights_shape[:-1]), weights_shape[-1]
# Reshape into a 2-D matrix with outer size num_filters.
weights_2d = tf.reshape(x, (other, num_filters))
# v = Wu / ||W u||
with tf.variable_scope("u", reuse=tf.AUTO_REUSE):
u = tf.get_variable(
"u", [num_filters, 1],
initializer=tf.truncated_normal_initializer(),
trainable=False)
v = tf.nn.l2_normalize(tf.matmul(weights_2d, u))
# u_new = vW / ||v W||
u_new = tf.nn.l2_normalize(tf.matmul(tf.transpose(v), weights_2d))
# s = v*W*u
spectral_norm = tf.squeeze(
tf.matmul(tf.transpose(v), tf.matmul(weights_2d, tf.transpose(u_new))))
# set u equal to u_new in the next iteration.
assign_op = tf.assign(u, tf.transpose(u_new))
return tf.divide(x, spectral_norm), assign_op
|
python
|
def apply_spectral_norm(x):
"""Normalizes x using the spectral norm.
The implementation follows Algorithm 1 of
https://arxiv.org/abs/1802.05957. If x is not a 2-D Tensor, then it is
reshaped such that the number of channels (last-dimension) is the same.
Args:
x: Tensor with the last dimension equal to the number of filters.
Returns:
x: Tensor with the same shape as x normalized by the spectral norm.
assign_op: Op to be run after every step to update the vector "u".
"""
weights_shape = shape_list(x)
other, num_filters = tf.reduce_prod(weights_shape[:-1]), weights_shape[-1]
# Reshape into a 2-D matrix with outer size num_filters.
weights_2d = tf.reshape(x, (other, num_filters))
# v = Wu / ||W u||
with tf.variable_scope("u", reuse=tf.AUTO_REUSE):
u = tf.get_variable(
"u", [num_filters, 1],
initializer=tf.truncated_normal_initializer(),
trainable=False)
v = tf.nn.l2_normalize(tf.matmul(weights_2d, u))
# u_new = vW / ||v W||
u_new = tf.nn.l2_normalize(tf.matmul(tf.transpose(v), weights_2d))
# s = v*W*u
spectral_norm = tf.squeeze(
tf.matmul(tf.transpose(v), tf.matmul(weights_2d, tf.transpose(u_new))))
# set u equal to u_new in the next iteration.
assign_op = tf.assign(u, tf.transpose(u_new))
return tf.divide(x, spectral_norm), assign_op
|
[
"def",
"apply_spectral_norm",
"(",
"x",
")",
":",
"weights_shape",
"=",
"shape_list",
"(",
"x",
")",
"other",
",",
"num_filters",
"=",
"tf",
".",
"reduce_prod",
"(",
"weights_shape",
"[",
":",
"-",
"1",
"]",
")",
",",
"weights_shape",
"[",
"-",
"1",
"]",
"# Reshape into a 2-D matrix with outer size num_filters.",
"weights_2d",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"(",
"other",
",",
"num_filters",
")",
")",
"# v = Wu / ||W u||",
"with",
"tf",
".",
"variable_scope",
"(",
"\"u\"",
",",
"reuse",
"=",
"tf",
".",
"AUTO_REUSE",
")",
":",
"u",
"=",
"tf",
".",
"get_variable",
"(",
"\"u\"",
",",
"[",
"num_filters",
",",
"1",
"]",
",",
"initializer",
"=",
"tf",
".",
"truncated_normal_initializer",
"(",
")",
",",
"trainable",
"=",
"False",
")",
"v",
"=",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"tf",
".",
"matmul",
"(",
"weights_2d",
",",
"u",
")",
")",
"# u_new = vW / ||v W||",
"u_new",
"=",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"tf",
".",
"matmul",
"(",
"tf",
".",
"transpose",
"(",
"v",
")",
",",
"weights_2d",
")",
")",
"# s = v*W*u",
"spectral_norm",
"=",
"tf",
".",
"squeeze",
"(",
"tf",
".",
"matmul",
"(",
"tf",
".",
"transpose",
"(",
"v",
")",
",",
"tf",
".",
"matmul",
"(",
"weights_2d",
",",
"tf",
".",
"transpose",
"(",
"u_new",
")",
")",
")",
")",
"# set u equal to u_new in the next iteration.",
"assign_op",
"=",
"tf",
".",
"assign",
"(",
"u",
",",
"tf",
".",
"transpose",
"(",
"u_new",
")",
")",
"return",
"tf",
".",
"divide",
"(",
"x",
",",
"spectral_norm",
")",
",",
"assign_op"
] |
Normalizes x using the spectral norm.
The implementation follows Algorithm 1 of
https://arxiv.org/abs/1802.05957. If x is not a 2-D Tensor, then it is
reshaped such that the number of channels (last-dimension) is the same.
Args:
x: Tensor with the last dimension equal to the number of filters.
Returns:
x: Tensor with the same shape as x normalized by the spectral norm.
assign_op: Op to be run after every step to update the vector "u".
|
[
"Normalizes",
"x",
"using",
"the",
"spectral",
"norm",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L741-L778
|
train
|
Normalizes x using the spectral norm.
|
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,QWgp4EL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16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\060' + chr(0b10110 + 0o37), 0b1000), ehT0Px3KOsy9(chr(610 - 562) + '\x6f' + chr(0b10000 + 0o41) + chr(49) + chr(0b10110 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + '\x32' + '\x33' + chr(0b100011 + 0o17), 54051 - 54043), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(12081 - 11970) + chr(50) + chr(0b110001) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1336 - 1287) + '\x33' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1010 + 0o47) + '\067' + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b110001), 51277 - 51269), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(51) + chr(0b110101) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(2484 - 2431) + chr(0b11 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(49) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + chr(655 - 601) + chr(0b10110 + 0o37), 30450 - 30442), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b11111 + 0o27) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111101 + 0o62) + chr(49) + chr(1231 - 1181) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\061' + '\060' + chr(50), 54114 - 54106), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b101100 + 0o11) + chr(0b1001 + 0o53), 31223 - 31215), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(0b110010) + chr(0b110110) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\060' + chr(50), 8), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\063' + chr(1728 - 1675) + chr(2838 - 2783), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110011), 43246 - 43238), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(10475 - 10364) + chr(0b101001 + 0o11) + chr(0b110001) + '\x31', 3387 - 3379), ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + '\062' + '\066' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(2736 - 2625) + '\061' + chr(0b100111 + 0o17) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b100 + 0o62) + '\060', 8), ehT0Px3KOsy9(chr(140 - 92) + chr(0b1011001 + 0o26) + chr(0b110010) + chr(0b110001) + '\067', 0o10), ehT0Px3KOsy9(chr(363 - 315) + chr(0b11001 + 0o126) + chr(721 - 672) + chr(434 - 382) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11 + 0o57) + chr(49) + chr(0b101000 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(51) + '\061' + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(53), 53649 - 53641), ehT0Px3KOsy9('\x30' + chr(4961 - 4850) + chr(2205 - 2155) + chr(0b110001) + chr(52), 1760 - 1752), ehT0Px3KOsy9(chr(48) + chr(0b1011101 + 0o22) + chr(0b10100 + 0o37) + chr(2029 - 1977) + chr(0b1011 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b0 + 0o63) + chr(52) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(0b110010) + chr(1121 - 1067) + '\x31', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b100100 + 0o17), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b111 + 0o53) + chr(0b11100 + 0o32) + chr(49), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(1612 - 1561) + chr(0b110010) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\x37' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110100) + chr(0b0 + 0o65), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(3328 - 3217) + '\x33' + chr(1327 - 1272) + chr(1379 - 1324), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + '\060' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(0b110010) + chr(0b11011 + 0o26) + chr(1664 - 1609), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(2733 - 2680) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xab'), chr(0b100000 + 0o104) + chr(534 - 433) + chr(99) + chr(0b1001011 + 0o44) + '\x64' + chr(101))('\x75' + chr(0b1010011 + 0o41) + '\146' + chr(1214 - 1169) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xW111jsYNzbt(OeWW0F1dBPRQ):
jl7vJkWm6O3U = qypPRW8fq869(OeWW0F1dBPRQ)
(KK0ERS7DqYrY, zVkWryy7Pzt7) = (IDJ2eXGCBCDu.reduce_prod(jl7vJkWm6O3U[:-ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(10785 - 10674) + chr(0b11101 + 0o24), 0o10)]), jl7vJkWm6O3U[-ehT0Px3KOsy9('\x30' + '\x6f' + '\x31', 8)])
EQPSmTtw32OP = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, (KK0ERS7DqYrY, zVkWryy7Pzt7))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"\xf3.\xe8\xe1>\x1b}\x8a6\xf8V\x9f#'"), chr(100) + chr(0b111100 + 0o51) + chr(0b10110 + 0o115) + '\157' + chr(6259 - 6159) + chr(0b111010 + 0o53))(chr(0b1110101) + chr(116) + '\146' + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0'), chr(0b11010 + 0o112) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(6195 - 6078) + chr(0b1110100) + '\x66' + chr(45) + chr(0b10000 + 0o50)), reuse=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4\x1a\xce\xc7\x00+T\xba:\xce'), chr(0b1100100) + chr(0b1100101) + '\143' + chr(111) + chr(5419 - 5319) + chr(101))(chr(117) + '\x74' + '\x66' + chr(45) + '\070'))):
SkdK71rGR8E7 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0'), chr(0b100101 + 0o77) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(116) + '\x66' + chr(0b101101) + '\x38'), [zVkWryy7Pzt7, ehT0Px3KOsy9('\060' + chr(111) + '\x31', 8)], initializer=IDJ2eXGCBCDu.truncated_normal_initializer(), trainable=ehT0Px3KOsy9('\060' + '\157' + '\060', ord("\x08")))
cMbll0QYhULo = IDJ2eXGCBCDu.nn.l2_normalize(IDJ2eXGCBCDu.matmul(EQPSmTtw32OP, SkdK71rGR8E7))
TslLZtaynmSP = IDJ2eXGCBCDu.nn.l2_normalize(IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(cMbll0QYhULo), EQPSmTtw32OP))
rdTCksXXrhoK = IDJ2eXGCBCDu.squeeze(IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.transpose(cMbll0QYhULo), IDJ2eXGCBCDu.matmul(EQPSmTtw32OP, IDJ2eXGCBCDu.transpose(TslLZtaynmSP))))
MZYt05TKlSHo = IDJ2eXGCBCDu.assign(SkdK71rGR8E7, IDJ2eXGCBCDu.transpose(TslLZtaynmSP))
return (xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1&\xec\xe1;\x1c'), chr(100) + chr(1764 - 1663) + chr(0b1011000 + 0o13) + chr(0b1101111) + '\144' + '\145')('\x75' + chr(0b1110100) + chr(8883 - 8781) + chr(45) + chr(56)))(OeWW0F1dBPRQ, rdTCksXXrhoK), MZYt05TKlSHo)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
apply_norm
|
def apply_norm(x, norm_type, depth, epsilon, layer_collection=None):
"""Apply Normalization."""
if layer_collection is not None:
assert norm_type == "layer"
if norm_type == "layer":
return layer_norm(
x, filters=depth, epsilon=epsilon, layer_collection=layer_collection)
if norm_type == "group":
return group_norm(x, filters=depth, epsilon=epsilon)
if norm_type == "batch":
return layers().BatchNormalization(epsilon=epsilon)(x)
if norm_type == "noam":
return noam_norm(x, epsilon)
if norm_type == "l2":
return l2_norm(x, filters=depth, epsilon=epsilon)
if norm_type == "none":
return x
raise ValueError("Parameter normalizer_fn must be one of: 'layer', 'batch',"
"'noam', 'lr', 'none'.")
|
python
|
def apply_norm(x, norm_type, depth, epsilon, layer_collection=None):
"""Apply Normalization."""
if layer_collection is not None:
assert norm_type == "layer"
if norm_type == "layer":
return layer_norm(
x, filters=depth, epsilon=epsilon, layer_collection=layer_collection)
if norm_type == "group":
return group_norm(x, filters=depth, epsilon=epsilon)
if norm_type == "batch":
return layers().BatchNormalization(epsilon=epsilon)(x)
if norm_type == "noam":
return noam_norm(x, epsilon)
if norm_type == "l2":
return l2_norm(x, filters=depth, epsilon=epsilon)
if norm_type == "none":
return x
raise ValueError("Parameter normalizer_fn must be one of: 'layer', 'batch',"
"'noam', 'lr', 'none'.")
|
[
"def",
"apply_norm",
"(",
"x",
",",
"norm_type",
",",
"depth",
",",
"epsilon",
",",
"layer_collection",
"=",
"None",
")",
":",
"if",
"layer_collection",
"is",
"not",
"None",
":",
"assert",
"norm_type",
"==",
"\"layer\"",
"if",
"norm_type",
"==",
"\"layer\"",
":",
"return",
"layer_norm",
"(",
"x",
",",
"filters",
"=",
"depth",
",",
"epsilon",
"=",
"epsilon",
",",
"layer_collection",
"=",
"layer_collection",
")",
"if",
"norm_type",
"==",
"\"group\"",
":",
"return",
"group_norm",
"(",
"x",
",",
"filters",
"=",
"depth",
",",
"epsilon",
"=",
"epsilon",
")",
"if",
"norm_type",
"==",
"\"batch\"",
":",
"return",
"layers",
"(",
")",
".",
"BatchNormalization",
"(",
"epsilon",
"=",
"epsilon",
")",
"(",
"x",
")",
"if",
"norm_type",
"==",
"\"noam\"",
":",
"return",
"noam_norm",
"(",
"x",
",",
"epsilon",
")",
"if",
"norm_type",
"==",
"\"l2\"",
":",
"return",
"l2_norm",
"(",
"x",
",",
"filters",
"=",
"depth",
",",
"epsilon",
"=",
"epsilon",
")",
"if",
"norm_type",
"==",
"\"none\"",
":",
"return",
"x",
"raise",
"ValueError",
"(",
"\"Parameter normalizer_fn must be one of: 'layer', 'batch',\"",
"\"'noam', 'lr', 'none'.\"",
")"
] |
Apply Normalization.
|
[
"Apply",
"Normalization",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L781-L799
|
train
|
Apply Normalization.
|
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,BXI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mUoxlR9h,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' + '\061' + chr(0b110111) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(52) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101101 + 0o5) + '\x31' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(0b110001) + '\061' + chr(0b11010 + 0o27), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(2217 - 2164) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110110 + 0o71) + chr(0b110011) + chr(51) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\067' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b1100 + 0o51) + chr(0b110000), 62883 - 62875), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + '\x32' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(378 - 267) + '\x37' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(48) + chr(0b10011 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(757 - 709) + chr(111) + chr(0b110011 + 0o0) + '\x37' + chr(0b100001 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(53) + chr(52), 5316 - 5308), ehT0Px3KOsy9(chr(514 - 466) + chr(0b11011 + 0o124) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(50) + chr(57 - 4), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\067' + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x33' + chr(0b100101 + 0o21), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10860 - 10749) + '\x31' + chr(0b11111 + 0o30) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(0b11011 + 0o30) + '\x31' + '\x31', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110 + 0o53) + chr(0b1010 + 0o50) + chr(0b11001 + 0o31), 30716 - 30708), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(51) + '\x32' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1288 - 1238) + '\x36' + '\066', 0o10), ehT0Px3KOsy9(chr(1685 - 1637) + '\157' + chr(1432 - 1383) + chr(53) + '\062', 41965 - 41957), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + chr(50) + '\x31' + '\x31', 651 - 643), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(0b0 + 0o63) + chr(1223 - 1175) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1161 - 1050) + chr(0b110011) + chr(0b110011) + chr(0b101101 + 0o10), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001 + 0o146) + '\x31' + chr(0b10111 + 0o35) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b100111 + 0o15) + chr(0b101110 + 0o5), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\x35' + '\x30', 8), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b110000) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101000 + 0o13) + chr(53) + '\x35', 27522 - 27514), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + '\x31' + chr(0b110100) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(0b100011 + 0o17) + chr(0b110101) + chr(0b101110 + 0o2), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\065' + chr(273 - 224), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\065' + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100000 + 0o22) + chr(55) + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b101 + 0o53) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101100 + 0o5) + '\x34' + chr(0b110110), 5438 - 5430), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + '\x36' + chr(1177 - 1126), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11010 + 0o125) + '\x33' + chr(1879 - 1828) + chr(0b111 + 0o57), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'P'), '\144' + chr(0b1100101) + '\x63' + '\x6f' + '\x64' + chr(101))(chr(12820 - 12703) + '\x74' + chr(0b100110 + 0o100) + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def bkmM_6laoqxb(OeWW0F1dBPRQ, LE5Fu6Tcl7nw, UEys4_lSwsID, Xtig2zAKpR0T, QhNZfIyyHZe2=None):
if QhNZfIyyHZe2 is not None:
assert LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x12A\xf4,\x9a'), '\x64' + '\x65' + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1100011 + 0o2))('\165' + '\164' + chr(0b1100110) + chr(0b101101) + chr(56))
if LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x12A\xf4,\x9a'), chr(0b1100100) + '\145' + chr(0b1100011) + '\157' + '\144' + chr(101))(chr(0b1110101) + chr(116) + '\146' + '\055' + chr(0b100000 + 0o30)):
return EbVYEOXA2Nzq(OeWW0F1dBPRQ, filters=UEys4_lSwsID, epsilon=Xtig2zAKpR0T, layer_collection=QhNZfIyyHZe2)
if LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x19R\xe2<\x98'), '\x64' + '\145' + chr(0b1100011) + '\x6f' + chr(582 - 482) + '\x65')('\165' + chr(6890 - 6774) + chr(0b1000111 + 0o37) + '\055' + '\x38'):
return soVcshbNn0vN(OeWW0F1dBPRQ, filters=UEys4_lSwsID, epsilon=Xtig2zAKpR0T)
if LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1cA\xf9*\x80'), '\144' + chr(0b1100101) + chr(99) + chr(9173 - 9062) + chr(0b1100100) + '\x65')('\x75' + '\x74' + '\146' + chr(45) + chr(0b111000)):
return xafqLlk3kkUe(sGi5Aql23May(), xafqLlk3kkUe(SXOLrMavuUCe(b'<A\xf9*\x80\x92\x17\x1a\xb8_\xeb\x95Va!\xd4\xb1\x14'), '\144' + chr(101) + chr(0b1100011) + chr(5320 - 5209) + '\144' + '\145')(chr(0b11100 + 0o131) + chr(3907 - 3791) + chr(7386 - 7284) + chr(0b101101) + chr(0b111 + 0o61)))(epsilon=Xtig2zAKpR0T)(OeWW0F1dBPRQ)
if LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x10O\xec$'), '\144' + chr(101) + chr(99) + '\x6f' + chr(0b101011 + 0o71) + '\x65')(chr(0b1000000 + 0o65) + '\x74' + '\146' + '\x2d' + chr(0b101100 + 0o14)):
return fiJWLgZ9moXY(OeWW0F1dBPRQ, Xtig2zAKpR0T)
if LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\x12'), chr(100) + chr(7348 - 7247) + chr(0b10100 + 0o117) + chr(0b1101111) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b101100 + 0o110) + chr(0b1100110) + '\x2d' + '\x38'):
return TW9wV0gSFoa6(OeWW0F1dBPRQ, filters=UEys4_lSwsID, epsilon=Xtig2zAKpR0T)
if LE5Fu6Tcl7nw == xafqLlk3kkUe(SXOLrMavuUCe(b'\x10O\xe3,'), chr(0b1000001 + 0o43) + chr(0b11001 + 0o114) + '\x63' + chr(0b1101111) + '\144' + '\x65')(chr(0b1110101) + chr(0b1011010 + 0o32) + chr(102) + chr(45) + chr(56)):
return OeWW0F1dBPRQ
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'.A\xff(\x85\xb9\x0c\r\xa7\x1e\xe9\x93^m4\xd1\xb7\x00\xac \x8f\xd0\x04\xa9\xa8\xa8\x13\xd7\xc8 \x88@\xc7G\x8e\x9d*\x00\t\xfeYL\xec0\x8d\xae_D\xf5\x19\xe5\x9dXc=\x9a\xf2]\xa7=\xb1\xdbM\xa5\xe5\xfa\x0c\xd1\xcfn\xcdG\xc6F\x85\xd8bH'), chr(100) + chr(2944 - 2843) + chr(3429 - 3330) + '\157' + chr(100) + chr(1708 - 1607))(chr(0b1110101) + '\x74' + chr(102) + '\x2d' + chr(0b11011 + 0o35)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
zero_add
|
def zero_add(previous_value, x, name=None, reuse=None):
"""Resnet connection with zero initialization.
Another type of resnet connection which returns previous_value + gamma * x.
gamma is a trainable scalar and initialized with zero. It is useful when a
module is plugged into a trained model and we want to make sure it matches the
original model's performance.
Args:
previous_value: A tensor.
x: A tensor.
name: name of variable scope; defaults to zero_add.
reuse: reuse scope.
Returns:
previous_value + gamma * x.
"""
with tf.variable_scope(name, default_name="zero_add", reuse=reuse):
gamma = tf.get_variable("gamma", (), initializer=tf.zeros_initializer())
return previous_value + gamma * x
|
python
|
def zero_add(previous_value, x, name=None, reuse=None):
"""Resnet connection with zero initialization.
Another type of resnet connection which returns previous_value + gamma * x.
gamma is a trainable scalar and initialized with zero. It is useful when a
module is plugged into a trained model and we want to make sure it matches the
original model's performance.
Args:
previous_value: A tensor.
x: A tensor.
name: name of variable scope; defaults to zero_add.
reuse: reuse scope.
Returns:
previous_value + gamma * x.
"""
with tf.variable_scope(name, default_name="zero_add", reuse=reuse):
gamma = tf.get_variable("gamma", (), initializer=tf.zeros_initializer())
return previous_value + gamma * x
|
[
"def",
"zero_add",
"(",
"previous_value",
",",
"x",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"zero_add\"",
",",
"reuse",
"=",
"reuse",
")",
":",
"gamma",
"=",
"tf",
".",
"get_variable",
"(",
"\"gamma\"",
",",
"(",
")",
",",
"initializer",
"=",
"tf",
".",
"zeros_initializer",
"(",
")",
")",
"return",
"previous_value",
"+",
"gamma",
"*",
"x"
] |
Resnet connection with zero initialization.
Another type of resnet connection which returns previous_value + gamma * x.
gamma is a trainable scalar and initialized with zero. It is useful when a
module is plugged into a trained model and we want to make sure it matches the
original model's performance.
Args:
previous_value: A tensor.
x: A tensor.
name: name of variable scope; defaults to zero_add.
reuse: reuse scope.
Returns:
previous_value + gamma * x.
|
[
"Resnet",
"connection",
"with",
"zero",
"initialization",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L802-L821
|
train
|
A helper function for zero addition of a tensor to a resnet connection.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJ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ufferError,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(0b0 + 0o60) + chr(111) + chr(1365 - 1316) + '\062' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(4861 - 4750) + chr(0b10010 + 0o37) + chr(0b110101) + chr(1738 - 1688), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x36' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\063' + '\x30' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(2464 - 2414) + chr(0b110111 + 0o0) + '\066', 527 - 519), ehT0Px3KOsy9(chr(292 - 244) + chr(0b1101111) + chr(0b110011) + chr(972 - 923) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\062' + '\x33', 33773 - 33765), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1013 - 965) + '\157' + '\063' + '\x34' + chr(1065 - 1013), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(332 - 280) + chr(0b110110), 10938 - 10930), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + chr(0b10000 + 0o41) + chr(2753 - 2700) + '\x35', 1138 - 1130), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + '\066', 0o10), ehT0Px3KOsy9(chr(1236 - 1188) + chr(111) + '\x32' + chr(0b100101 + 0o20) + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3111 - 3000) + chr(51) + chr(0b101 + 0o57) + chr(0b110100), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11110 + 0o23) + '\x31' + chr(0b1 + 0o65), 26515 - 26507), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x34' + chr(0b110000 + 0o4), 0b1000), ehT0Px3KOsy9(chr(700 - 652) + chr(4738 - 4627) + chr(0b11100 + 0o25) + chr(0b101001 + 0o7) + chr(2351 - 2299), 0b1000), ehT0Px3KOsy9('\060' + chr(7744 - 7633) + '\x35' + chr(2815 - 2761), 8), ehT0Px3KOsy9(chr(1244 - 1196) + '\x6f' + '\x31' + '\x31' + chr(1560 - 1507), 0o10), ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + chr(0b10111 + 0o34), 1775 - 1767), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11000 + 0o31) + chr(0b101110 + 0o7) + '\x31', 6102 - 6094), ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + '\x33' + '\061' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + '\x31' + chr(1067 - 1013) + '\x30', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\064' + chr(52), 8), ehT0Px3KOsy9(chr(936 - 888) + '\x6f' + chr(0b1011 + 0o46) + '\067' + '\x37', 0b1000), ehT0Px3KOsy9(chr(283 - 235) + '\x6f' + chr(0b110010) + chr(0b110010) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\067' + '\x37', 8), ehT0Px3KOsy9(chr(1657 - 1609) + chr(111) + '\x33' + '\x32' + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001011 + 0o44) + chr(51) + chr(0b110000) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + '\x33' + chr(55) + '\065', 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b110011) + '\060' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100100 + 0o23) + chr(0b110111), 11103 - 11095), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b11011 + 0o124) + chr(49) + chr(55) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(5029 - 4918) + '\x31' + chr(2269 - 2220) + '\065', 8), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1100000 + 0o17) + '\x33' + chr(0b101 + 0o60) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(481 - 433) + chr(2537 - 2426) + '\x33' + chr(55) + chr(0b10001 + 0o41), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\064' + chr(606 - 554), 8), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(2179 - 2130) + chr(52) + '\062', 0o10), ehT0Px3KOsy9(chr(1340 - 1292) + '\157' + chr(0b11100 + 0o25) + '\064' + '\x30', 157 - 149)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(877 - 829) + '\x6f' + chr(0b101001 + 0o14) + '\060', 53909 - 53901)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'~'), '\144' + chr(101) + chr(4407 - 4308) + chr(0b100000 + 0o117) + chr(3017 - 2917) + '\x65')('\165' + '\164' + '\x66' + chr(848 - 803) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def lfSaWqT1DgMI(twiGWW17uLKq, OeWW0F1dBPRQ, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'&\x0b\xc7\xaf\xdf\xa8?d\xbbU\x0eA\xdck'), chr(8125 - 8025) + chr(8787 - 8686) + chr(5527 - 5428) + '\x6f' + chr(6179 - 6079) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b100010 + 0o104) + chr(553 - 508) + chr(1275 - 1219)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'*\x0f\xc7\xa9\xe1\xab7e'), chr(7545 - 7445) + chr(0b11101 + 0o110) + chr(581 - 482) + chr(0b1101111) + '\x64' + chr(7265 - 7164))('\x75' + chr(7683 - 7567) + chr(0b1 + 0o145) + '\055' + '\x38'), reuse=pmC5wdSFgdFj):
nfeH4ZtvQXsW = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'7\x0b\xd8\xab\xdf'), chr(0b1100100) + chr(8128 - 8027) + chr(9484 - 9385) + chr(5445 - 5334) + '\x64' + chr(0b1001010 + 0o33))(chr(3641 - 3524) + '\x74' + '\x66' + chr(230 - 185) + chr(0b111000)), (), initializer=IDJ2eXGCBCDu.zeros_initializer())
return twiGWW17uLKq + nfeH4ZtvQXsW * OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
layer_prepostprocess
|
def layer_prepostprocess(previous_value,
x,
sequence,
dropout_rate,
norm_type,
depth,
epsilon,
default_name,
name=None,
dropout_broadcast_dims=None,
layer_collection=None):
"""Apply a sequence of functions to the input or output of a layer.
The sequence is specified as a string which may contain the following
characters:
a: add previous_value
n: apply normalization
d: apply dropout
z: zero add
For example, if sequence=="dna", then the output is
previous_value + normalize(dropout(x))
Args:
previous_value: A Tensor, to be added as a residual connection ('a')
x: A Tensor to be transformed.
sequence: a string.
dropout_rate: a float
norm_type: a string (see apply_norm())
depth: an integer (size of last dimension of x).
epsilon: a float (parameter for normalization)
default_name: a string
name: a string
dropout_broadcast_dims: an optional list of integers less than 3
specifying in which dimensions to broadcast the dropout decisions.
saves memory.
layer_collection: A tensorflow_kfac.LayerCollection. Only used by the
KFAC optimizer. Default is None.
Returns:
a Tensor
"""
with tf.variable_scope(name, default_name=default_name):
if sequence == "none":
return x
for c in sequence:
if c == "a":
x += previous_value
elif c == "z":
x = zero_add(previous_value, x)
elif c == "n":
x = apply_norm(
x, norm_type, depth, epsilon, layer_collection=layer_collection)
else:
assert c == "d", ("Unknown sequence step %s" % c)
x = dropout_with_broadcast_dims(
x, 1.0 - dropout_rate, broadcast_dims=dropout_broadcast_dims)
return x
|
python
|
def layer_prepostprocess(previous_value,
x,
sequence,
dropout_rate,
norm_type,
depth,
epsilon,
default_name,
name=None,
dropout_broadcast_dims=None,
layer_collection=None):
"""Apply a sequence of functions to the input or output of a layer.
The sequence is specified as a string which may contain the following
characters:
a: add previous_value
n: apply normalization
d: apply dropout
z: zero add
For example, if sequence=="dna", then the output is
previous_value + normalize(dropout(x))
Args:
previous_value: A Tensor, to be added as a residual connection ('a')
x: A Tensor to be transformed.
sequence: a string.
dropout_rate: a float
norm_type: a string (see apply_norm())
depth: an integer (size of last dimension of x).
epsilon: a float (parameter for normalization)
default_name: a string
name: a string
dropout_broadcast_dims: an optional list of integers less than 3
specifying in which dimensions to broadcast the dropout decisions.
saves memory.
layer_collection: A tensorflow_kfac.LayerCollection. Only used by the
KFAC optimizer. Default is None.
Returns:
a Tensor
"""
with tf.variable_scope(name, default_name=default_name):
if sequence == "none":
return x
for c in sequence:
if c == "a":
x += previous_value
elif c == "z":
x = zero_add(previous_value, x)
elif c == "n":
x = apply_norm(
x, norm_type, depth, epsilon, layer_collection=layer_collection)
else:
assert c == "d", ("Unknown sequence step %s" % c)
x = dropout_with_broadcast_dims(
x, 1.0 - dropout_rate, broadcast_dims=dropout_broadcast_dims)
return x
|
[
"def",
"layer_prepostprocess",
"(",
"previous_value",
",",
"x",
",",
"sequence",
",",
"dropout_rate",
",",
"norm_type",
",",
"depth",
",",
"epsilon",
",",
"default_name",
",",
"name",
"=",
"None",
",",
"dropout_broadcast_dims",
"=",
"None",
",",
"layer_collection",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"default_name",
")",
":",
"if",
"sequence",
"==",
"\"none\"",
":",
"return",
"x",
"for",
"c",
"in",
"sequence",
":",
"if",
"c",
"==",
"\"a\"",
":",
"x",
"+=",
"previous_value",
"elif",
"c",
"==",
"\"z\"",
":",
"x",
"=",
"zero_add",
"(",
"previous_value",
",",
"x",
")",
"elif",
"c",
"==",
"\"n\"",
":",
"x",
"=",
"apply_norm",
"(",
"x",
",",
"norm_type",
",",
"depth",
",",
"epsilon",
",",
"layer_collection",
"=",
"layer_collection",
")",
"else",
":",
"assert",
"c",
"==",
"\"d\"",
",",
"(",
"\"Unknown sequence step %s\"",
"%",
"c",
")",
"x",
"=",
"dropout_with_broadcast_dims",
"(",
"x",
",",
"1.0",
"-",
"dropout_rate",
",",
"broadcast_dims",
"=",
"dropout_broadcast_dims",
")",
"return",
"x"
] |
Apply a sequence of functions to the input or output of a layer.
The sequence is specified as a string which may contain the following
characters:
a: add previous_value
n: apply normalization
d: apply dropout
z: zero add
For example, if sequence=="dna", then the output is
previous_value + normalize(dropout(x))
Args:
previous_value: A Tensor, to be added as a residual connection ('a')
x: A Tensor to be transformed.
sequence: a string.
dropout_rate: a float
norm_type: a string (see apply_norm())
depth: an integer (size of last dimension of x).
epsilon: a float (parameter for normalization)
default_name: a string
name: a string
dropout_broadcast_dims: an optional list of integers less than 3
specifying in which dimensions to broadcast the dropout decisions.
saves memory.
layer_collection: A tensorflow_kfac.LayerCollection. Only used by the
KFAC optimizer. Default is None.
Returns:
a Tensor
|
[
"Apply",
"a",
"sequence",
"of",
"functions",
"to",
"the",
"input",
"or",
"output",
"of",
"a",
"layer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L824-L881
|
train
|
Applies a sequence of functions to the input or output of a 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,o0CgT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8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34' + chr(830 - 779), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(50) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(8413 - 8302) + chr(0b110001) + chr(50), 64121 - 64113), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1234 - 1184) + '\060' + chr(0b100011 + 0o17), 19938 - 19930), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + '\x33' + chr(0b101101 + 0o5) + chr(0b10110 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b100001 + 0o20) + chr(0b110011) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + '\067', 38926 - 38918), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b110010) + chr(0b110101 + 0o1), 44463 - 44455), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\060' + '\065', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b101010 + 0o11) + chr(2025 - 1976) + chr(1320 - 1265), 0b1000), ehT0Px3KOsy9('\060' + chr(530 - 419) + '\x33' + chr(0b110011) + chr(0b1001 + 0o47), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x34' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(0b110111) + chr(0b101 + 0o56), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(2257 - 2207) + '\x37', 64014 - 64006), ehT0Px3KOsy9(chr(1490 - 1442) + chr(111) + chr(49) + '\062' + '\x36', 8), ehT0Px3KOsy9('\x30' + chr(1987 - 1876) + '\x31' + chr(0b110011) + chr(53), 15650 - 15642), ehT0Px3KOsy9('\x30' + chr(0b100110 + 0o111) + chr(0b110011) + chr(0b100 + 0o60), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10010 + 0o135) + chr(50) + '\x36' + chr(0b11001 + 0o31), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\x35' + chr(1504 - 1452), 7456 - 7448), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b110101) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(0b10010 + 0o41) + chr(0b110011) + chr(1665 - 1610), 0b1000), ehT0Px3KOsy9(chr(1451 - 1403) + '\x6f' + chr(0b110011) + '\063' + chr(0b1 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110110) + chr(0b11001 + 0o34), 0b1000), ehT0Px3KOsy9(chr(637 - 589) + '\157' + '\062' + chr(48) + chr(612 - 561), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b1111 + 0o43), 17921 - 17913), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\x30' + chr(0b100011 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110011 + 0o1) + chr(0b101000 + 0o13), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(406 - 356) + chr(0b110111) + chr(811 - 756), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + chr(0b110001) + chr(0b110101) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + '\062' + chr(0b110001) + chr(0b1 + 0o63), 26438 - 26430), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11010 + 0o27) + chr(0b110000) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(8210 - 8099) + chr(2334 - 2283) + chr(0b110011) + chr(0b110110), 59694 - 59686), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(1185 - 1133) + chr(0b100111 + 0o12), 41699 - 41691), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(412 - 360) + chr(1684 - 1629), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b101111 + 0o3) + chr(0b100011 + 0o16) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(0b110011), 33118 - 33110), ehT0Px3KOsy9(chr(48) + chr(8776 - 8665) + '\062' + chr(364 - 311) + chr(0b110001), 49412 - 49404), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + '\x35' + chr(0b110000), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53) + chr(483 - 435), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\r'), '\x64' + '\145' + '\143' + '\157' + '\144' + chr(0b1000000 + 0o45))('\x75' + chr(7306 - 7190) + chr(0b1100110) + chr(0b10101 + 0o30) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cSTkt6vzR8DL(twiGWW17uLKq, OeWW0F1dBPRQ, blgtMYjOOQgD, iI9Z069HML_u, LE5Fu6Tcl7nw, UEys4_lSwsID, Xtig2zAKpR0T, lwdAwPGy1Grh, AIvJRzLdDfgF=None, Tovc3lDEHg6s=None, QhNZfIyyHZe2=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'U\xb7x\xeb\xb3>[3\x1a\xbc\xbbMKK'), '\x64' + chr(0b1100101) + '\143' + chr(2429 - 2318) + chr(9768 - 9668) + '\145')(chr(117) + chr(0b11010 + 0o132) + chr(0b1001001 + 0o35) + chr(1718 - 1673) + chr(56)))(AIvJRzLdDfgF, default_name=lwdAwPGy1Grh):
if blgtMYjOOQgD == xafqLlk3kkUe(SXOLrMavuUCe(b'M\xb9d\xe7'), chr(0b11010 + 0o112) + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(452 - 352) + '\145')(chr(117) + chr(2190 - 2074) + '\x66' + chr(0b101101) + chr(0b1101 + 0o53)):
return OeWW0F1dBPRQ
for qzn1Ctg9WgNh in blgtMYjOOQgD:
if qzn1Ctg9WgNh == xafqLlk3kkUe(SXOLrMavuUCe(b'B'), chr(0b1100010 + 0o2) + chr(101) + '\143' + chr(1653 - 1542) + chr(0b1010011 + 0o21) + '\x65')('\x75' + '\x74' + chr(102) + chr(0b101101) + chr(0b111000 + 0o0)):
OeWW0F1dBPRQ += twiGWW17uLKq
elif qzn1Ctg9WgNh == xafqLlk3kkUe(SXOLrMavuUCe(b'Y'), chr(0b100100 + 0o100) + chr(0b1100101) + chr(99) + chr(3365 - 3254) + '\x64' + chr(7423 - 7322))('\x75' + '\164' + '\x66' + '\x2d' + '\070'):
OeWW0F1dBPRQ = lfSaWqT1DgMI(twiGWW17uLKq, OeWW0F1dBPRQ)
elif qzn1Ctg9WgNh == xafqLlk3kkUe(SXOLrMavuUCe(b'M'), chr(0b11100 + 0o110) + '\145' + chr(99) + chr(0b1000001 + 0o56) + chr(100) + '\x65')(chr(9950 - 9833) + '\164' + chr(0b1100110) + chr(45) + chr(85 - 29)):
OeWW0F1dBPRQ = bkmM_6laoqxb(OeWW0F1dBPRQ, LE5Fu6Tcl7nw, UEys4_lSwsID, Xtig2zAKpR0T, layer_collection=QhNZfIyyHZe2)
else:
assert qzn1Ctg9WgNh == xafqLlk3kkUe(SXOLrMavuUCe(b'G'), '\144' + chr(0b1100101) + '\x63' + '\157' + '\144' + chr(0b1100101))(chr(117) + chr(2137 - 2021) + chr(102) + chr(0b101101) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'v\xb8a\xec\xbd+Yv6\xaa\xa9W^@t3}o\xc6\x89\x18\xff\xfe\x86'), chr(100) + '\145' + '\x63' + '\157' + chr(0b1010010 + 0o22) + '\145')('\165' + '\164' + '\146' + '\x2d' + chr(2910 - 2854)) % qzn1Ctg9WgNh
OeWW0F1dBPRQ = Ue76kt5RmoeT(OeWW0F1dBPRQ, 1.0 - iI9Z069HML_u, broadcast_dims=Tovc3lDEHg6s)
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
layer_preprocess
|
def layer_preprocess(layer_input, hparams, layer_collection=None):
"""Apply layer preprocessing.
See layer_prepostprocess() for details.
A hyperparameters object is passed for convenience. The hyperparameters
that may be used are:
layer_preprocess_sequence
layer_prepostprocess_dropout
norm_type
hidden_size
norm_epsilon
Args:
layer_input: a Tensor
hparams: a hyperparameters object.
layer_collection: A tensorflow_kfac.LayerCollection. Only used by the
KFAC optimizer. Default is None.
Returns:
a Tensor
"""
assert "a" not in hparams.layer_preprocess_sequence, (
"No residual connections allowed in hparams.layer_preprocess_sequence")
assert "z" not in hparams.layer_preprocess_sequence, (
"No residual connections allowed in hparams.layer_preprocess_sequence")
return layer_prepostprocess(
None,
layer_input,
sequence=hparams.layer_preprocess_sequence,
dropout_rate=hparams.layer_prepostprocess_dropout,
norm_type=hparams.norm_type,
depth=None,
epsilon=hparams.norm_epsilon,
dropout_broadcast_dims=comma_separated_string_to_integer_list(
getattr(hparams, "layer_prepostprocess_dropout_broadcast_dims", "")),
default_name="layer_prepostprocess",
layer_collection=layer_collection)
|
python
|
def layer_preprocess(layer_input, hparams, layer_collection=None):
"""Apply layer preprocessing.
See layer_prepostprocess() for details.
A hyperparameters object is passed for convenience. The hyperparameters
that may be used are:
layer_preprocess_sequence
layer_prepostprocess_dropout
norm_type
hidden_size
norm_epsilon
Args:
layer_input: a Tensor
hparams: a hyperparameters object.
layer_collection: A tensorflow_kfac.LayerCollection. Only used by the
KFAC optimizer. Default is None.
Returns:
a Tensor
"""
assert "a" not in hparams.layer_preprocess_sequence, (
"No residual connections allowed in hparams.layer_preprocess_sequence")
assert "z" not in hparams.layer_preprocess_sequence, (
"No residual connections allowed in hparams.layer_preprocess_sequence")
return layer_prepostprocess(
None,
layer_input,
sequence=hparams.layer_preprocess_sequence,
dropout_rate=hparams.layer_prepostprocess_dropout,
norm_type=hparams.norm_type,
depth=None,
epsilon=hparams.norm_epsilon,
dropout_broadcast_dims=comma_separated_string_to_integer_list(
getattr(hparams, "layer_prepostprocess_dropout_broadcast_dims", "")),
default_name="layer_prepostprocess",
layer_collection=layer_collection)
|
[
"def",
"layer_preprocess",
"(",
"layer_input",
",",
"hparams",
",",
"layer_collection",
"=",
"None",
")",
":",
"assert",
"\"a\"",
"not",
"in",
"hparams",
".",
"layer_preprocess_sequence",
",",
"(",
"\"No residual connections allowed in hparams.layer_preprocess_sequence\"",
")",
"assert",
"\"z\"",
"not",
"in",
"hparams",
".",
"layer_preprocess_sequence",
",",
"(",
"\"No residual connections allowed in hparams.layer_preprocess_sequence\"",
")",
"return",
"layer_prepostprocess",
"(",
"None",
",",
"layer_input",
",",
"sequence",
"=",
"hparams",
".",
"layer_preprocess_sequence",
",",
"dropout_rate",
"=",
"hparams",
".",
"layer_prepostprocess_dropout",
",",
"norm_type",
"=",
"hparams",
".",
"norm_type",
",",
"depth",
"=",
"None",
",",
"epsilon",
"=",
"hparams",
".",
"norm_epsilon",
",",
"dropout_broadcast_dims",
"=",
"comma_separated_string_to_integer_list",
"(",
"getattr",
"(",
"hparams",
",",
"\"layer_prepostprocess_dropout_broadcast_dims\"",
",",
"\"\"",
")",
")",
",",
"default_name",
"=",
"\"layer_prepostprocess\"",
",",
"layer_collection",
"=",
"layer_collection",
")"
] |
Apply layer preprocessing.
See layer_prepostprocess() for details.
A hyperparameters object is passed for convenience. The hyperparameters
that may be used are:
layer_preprocess_sequence
layer_prepostprocess_dropout
norm_type
hidden_size
norm_epsilon
Args:
layer_input: a Tensor
hparams: a hyperparameters object.
layer_collection: A tensorflow_kfac.LayerCollection. Only used by the
KFAC optimizer. Default is None.
Returns:
a Tensor
|
[
"Apply",
"layer",
"preprocessing",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L884-L922
|
train
|
Apply layer preprocessing.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw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,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(241 - 193) + '\x6f' + chr(0b10 + 0o60) + '\067' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1411 - 1363) + chr(3764 - 3653) + chr(51) + '\065' + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(180 - 129) + '\x36' + chr(685 - 635), 0o10), ehT0Px3KOsy9('\x30' + chr(0b100000 + 0o117) + '\062' + chr(51) + chr(0b110011), 43259 - 43251), ehT0Px3KOsy9('\x30' + chr(0b10100 + 0o133) + chr(53), 55444 - 55436), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(0b100111 + 0o11) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(813 - 765) + chr(0b1101111) + chr(1666 - 1613) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(0b110010) + chr(55) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(2050 - 1939) + chr(2434 - 2384) + chr(1490 - 1439) + chr(0b11100 + 0o24), 10118 - 10110), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\061' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(9306 - 9195) + '\062' + '\064' + '\x36', 0o10), ehT0Px3KOsy9(chr(793 - 745) + '\157' + '\063' + chr(0b10 + 0o64) + chr(0b110010 + 0o4), 43880 - 43872), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + '\x32' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10 + 0o155) + chr(55) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(0b110101) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + '\x37' + chr(2510 - 2459), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1901 - 1849) + chr(0b101101 + 0o7), 0b1000), ehT0Px3KOsy9('\x30' + chr(11920 - 11809) + chr(1689 - 1638) + '\064' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b10111 + 0o130) + chr(0b110011) + chr(0b110110) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + '\061' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001010 + 0o45) + '\061' + '\x31' + chr(0b11101 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(0b110001) + '\x36' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\064' + chr(51), 58060 - 58052), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\062' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\066' + chr(0b11000 + 0o35), 0b1000), ehT0Px3KOsy9(chr(1602 - 1554) + chr(3109 - 2998) + chr(0b110001) + chr(0b110110) + chr(2165 - 2115), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1011000 + 0o27) + chr(0b110001) + chr(96 - 46) + '\062', 8), ehT0Px3KOsy9('\x30' + chr(9430 - 9319) + '\x34' + chr(0b11 + 0o61), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\x31' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(902 - 852) + chr(51) + '\060', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2086 - 2032) + chr(2244 - 2194), 0o10), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + '\061' + '\x32' + chr(0b110011), 63222 - 63214), ehT0Px3KOsy9('\060' + chr(7126 - 7015) + chr(0b110001) + chr(80 - 29) + chr(0b10001 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + chr(2314 - 2263) + '\060' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\x34' + chr(283 - 233), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2269 - 2158) + '\x33' + chr(0b10100 + 0o40) + chr(0b110111), 40324 - 40316), ehT0Px3KOsy9(chr(0b110000) + chr(5773 - 5662) + chr(49) + '\x36' + chr(1223 - 1171), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(50) + '\062' + chr(0b110111), 49964 - 49956), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(0b110111) + chr(0b101100 + 0o12), 19886 - 19878)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b101011 + 0o12) + chr(685 - 637), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x92'), chr(100) + chr(101) + chr(0b1100011) + '\x6f' + chr(341 - 241) + chr(7704 - 7603))('\165' + chr(6914 - 6798) + chr(5272 - 5170) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def y4lunM5rYWij(bjIi5ihPeoZC, n4ljua2gi1Pr, QhNZfIyyHZe2=None):
assert xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd'), chr(900 - 800) + chr(7342 - 7241) + chr(0b1100011) + chr(11800 - 11689) + '\x64' + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(2373 - 2271) + '\x2d' + chr(1469 - 1413)) not in xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\x81\xab\xaad_\xb0@\xcf\xd4\x85\xd3'), chr(0b1100100) + chr(6562 - 6461) + chr(0b1100011) + '\x6f' + chr(0b110111 + 0o55) + chr(0b1100101))('\x75' + chr(116) + chr(10094 - 9992) + chr(45) + '\x38')), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\x84\xd2\xe9`v\xeeH\xcd\xf9\xa6\x86\x95?PC^G\x94\x9d!$\x04\xc33\xd9\x1e=S\xa8\xfc\x12:6\xe2\x8a\x97\x15\xe5\xdf\xd1\x98\xdc\xf7d|\xe2^\xe7\xe8\xb8\xc3\x86"QN^W\x93\xab=/\x06\x967\xdb\x117'), '\144' + '\x65' + '\143' + chr(0b101011 + 0o104) + '\144' + '\145')(chr(117) + chr(0b1110100) + chr(102) + '\055' + chr(2816 - 2760))
assert xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6'), chr(0b110 + 0o136) + '\x65' + '\143' + chr(111) + '\x64' + chr(6261 - 6160))(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(933 - 888) + '\x38') not in xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\x81\xab\xaad_\xb0@\xcf\xd4\x85\xd3'), chr(100) + chr(0b1000000 + 0o45) + '\x63' + chr(111) + '\x64' + chr(101))(chr(117) + chr(116) + chr(102) + chr(45) + chr(0b110000 + 0o10))), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\x84\xd2\xe9`v\xeeH\xcd\xf9\xa6\x86\x95?PC^G\x94\x9d!$\x04\xc33\xd9\x1e=S\xa8\xfc\x12:6\xe2\x8a\x97\x15\xe5\xdf\xd1\x98\xdc\xf7d|\xe2^\xe7\xe8\xb8\xc3\x86"QN^W\x93\xab=/\x06\x967\xdb\x117'), chr(5276 - 5176) + chr(101) + '\143' + '\x6f' + chr(100) + chr(101))('\x75' + '\x74' + chr(102) + chr(702 - 657) + '\x38')
return cSTkt6vzR8DL(None, bjIi5ihPeoZC, sequence=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb\x81\xab\xaad_\xb0@\xcf\xd4\x85\xd3'), '\144' + chr(101) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b100011 + 0o122) + chr(0b1000110 + 0o56) + '\x66' + chr(45) + chr(0b10111 + 0o41))), dropout_rate=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\xbc\xad\xe3V\x7f\xf7\x1d\x80\xcd\xaf\xf5'), chr(0b111101 + 0o47) + chr(0b1010001 + 0o24) + '\143' + chr(0b1010000 + 0o37) + chr(2565 - 2465) + chr(0b11 + 0o142))('\x75' + chr(116) + chr(102) + '\x2d' + '\x38')), norm_type=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xae\xc7\xddp3\xd3O\xd4\xaf\xa4\xd1'), chr(0b11010 + 0o112) + chr(0b1100101) + chr(9727 - 9628) + chr(0b1101111) + '\144' + '\145')(chr(0b1001001 + 0o54) + chr(0b1011011 + 0o31) + chr(3878 - 3776) + chr(45) + chr(0b11001 + 0o37))), depth=None, epsilon=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\xd8\xa0\xe874\xc0\\\xc2\xf6\xf9\xd1'), '\144' + chr(0b1100101) + '\x63' + chr(0b1000011 + 0o54) + chr(0b1100100) + chr(0b0 + 0o145))('\x75' + chr(0b1110100) + chr(102) + '\x2d' + chr(0b111000))), dropout_broadcast_dims=uvqYhQl2rvPp(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\x8a\x8b\xfewZ\xf7^\xdd\xe8\xa5\xd5\x82 LBXA\x93\x87\x11.\x05\x8c"\xda\x07&{\xaf\xea]2<\xa1\x83\x94\x00\xc8\xda\xd5\x86\x81'), '\144' + chr(0b1011 + 0o132) + chr(6634 - 6535) + '\x6f' + chr(0b1100100) + chr(0b1011100 + 0o11))('\165' + '\x74' + chr(9573 - 9471) + chr(0b101101) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b''), '\x64' + chr(0b1100101) + chr(5965 - 5866) + chr(0b101110 + 0o101) + '\x64' + chr(0b1100101))(chr(9946 - 9829) + chr(6748 - 6632) + chr(0b1001 + 0o135) + chr(0b10110 + 0o27) + '\070'))), default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\x8a\x8b\xfewZ\xf7^\xdd\xe8\xa5\xd5\x82 LBXA\x93\x87'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(1924 - 1813) + '\144' + '\145')(chr(2976 - 2859) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b110 + 0o62)), layer_collection=QhNZfIyyHZe2)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
layer_postprocess
|
def layer_postprocess(layer_input, layer_output, hparams):
"""Apply layer postprocessing.
See layer_prepostprocess() for details.
A hyperparameters object is passed for convenience. The hyperparameters
that may be used are:
layer_postprocess_sequence
layer_prepostprocess_dropout
norm_type
hidden_size
norm_epsilon
Args:
layer_input: a Tensor
layer_output: a Tensor
hparams: a hyperparameters object.
Returns:
a Tensor
"""
return layer_prepostprocess(
layer_input,
layer_output,
sequence=hparams.layer_postprocess_sequence,
dropout_rate=hparams.layer_prepostprocess_dropout,
norm_type=hparams.norm_type,
depth=None,
epsilon=hparams.norm_epsilon,
dropout_broadcast_dims=comma_separated_string_to_integer_list(
getattr(hparams, "layer_prepostprocess_dropout_broadcast_dims", "")),
default_name="layer_postprocess")
|
python
|
def layer_postprocess(layer_input, layer_output, hparams):
"""Apply layer postprocessing.
See layer_prepostprocess() for details.
A hyperparameters object is passed for convenience. The hyperparameters
that may be used are:
layer_postprocess_sequence
layer_prepostprocess_dropout
norm_type
hidden_size
norm_epsilon
Args:
layer_input: a Tensor
layer_output: a Tensor
hparams: a hyperparameters object.
Returns:
a Tensor
"""
return layer_prepostprocess(
layer_input,
layer_output,
sequence=hparams.layer_postprocess_sequence,
dropout_rate=hparams.layer_prepostprocess_dropout,
norm_type=hparams.norm_type,
depth=None,
epsilon=hparams.norm_epsilon,
dropout_broadcast_dims=comma_separated_string_to_integer_list(
getattr(hparams, "layer_prepostprocess_dropout_broadcast_dims", "")),
default_name="layer_postprocess")
|
[
"def",
"layer_postprocess",
"(",
"layer_input",
",",
"layer_output",
",",
"hparams",
")",
":",
"return",
"layer_prepostprocess",
"(",
"layer_input",
",",
"layer_output",
",",
"sequence",
"=",
"hparams",
".",
"layer_postprocess_sequence",
",",
"dropout_rate",
"=",
"hparams",
".",
"layer_prepostprocess_dropout",
",",
"norm_type",
"=",
"hparams",
".",
"norm_type",
",",
"depth",
"=",
"None",
",",
"epsilon",
"=",
"hparams",
".",
"norm_epsilon",
",",
"dropout_broadcast_dims",
"=",
"comma_separated_string_to_integer_list",
"(",
"getattr",
"(",
"hparams",
",",
"\"layer_prepostprocess_dropout_broadcast_dims\"",
",",
"\"\"",
")",
")",
",",
"default_name",
"=",
"\"layer_postprocess\"",
")"
] |
Apply layer postprocessing.
See layer_prepostprocess() for details.
A hyperparameters object is passed for convenience. The hyperparameters
that may be used are:
layer_postprocess_sequence
layer_prepostprocess_dropout
norm_type
hidden_size
norm_epsilon
Args:
layer_input: a Tensor
layer_output: a Tensor
hparams: a hyperparameters object.
Returns:
a Tensor
|
[
"Apply",
"layer",
"postprocessing",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L925-L957
|
train
|
Apply layer postprocessing.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OT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4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1001100 + 0o43) + chr(0b110111) + chr(0b11000 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\065' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101100 + 0o6) + chr(53) + chr(55), 56953 - 56945), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b1110 + 0o51) + '\065', 0b1000), ehT0Px3KOsy9(chr(621 - 573) + '\x6f' + chr(0b1110 + 0o44) + chr(53) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(0b110001 + 0o0) + '\064' + '\x30', 38323 - 38315), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + chr(0b11010 + 0o27) + chr(2008 - 1956) + '\063', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + '\066' + chr(0b1100 + 0o45), 59639 - 59631), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100110 + 0o14) + '\x30' + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x34' + '\063', 16918 - 16910), ehT0Px3KOsy9('\x30' + '\x6f' + chr(677 - 627) + '\x34' + chr(0b101010 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + chr(50) + chr(1550 - 1498), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x31' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11110 + 0o25) + '\064' + '\x37', 9120 - 9112), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(0b110011) + chr(61 - 6) + chr(2370 - 2321), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1110 + 0o43) + chr(0b110110) + chr(0b1111 + 0o50), 0o10), ehT0Px3KOsy9(chr(62 - 14) + chr(7675 - 7564) + '\x33' + '\x34' + chr(1228 - 1177), 36595 - 36587), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b110110) + chr(723 - 672), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(54) + '\x31', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(348 - 298) + chr(0b100110 + 0o12), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11100 + 0o32), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + '\062' + chr(407 - 358) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111110 + 0o61) + '\x33' + '\x33' + '\064', 49122 - 49114), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + '\x32' + chr(54), 19442 - 19434), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53) + chr(1763 - 1714), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\065' + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10 + 0o155) + chr(0b110010) + chr(2773 - 2719) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(1254 - 1206) + chr(10445 - 10334) + '\x32' + chr(52) + chr(0b110001), 8), ehT0Px3KOsy9(chr(1160 - 1112) + chr(0b1010 + 0o145) + chr(0b110001) + chr(0b110101) + chr(0b1111 + 0o45), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101000 + 0o7) + '\062' + chr(50) + chr(0b110 + 0o55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + chr(0b1001 + 0o51) + chr(1279 - 1231) + '\x30', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b100001 + 0o24), 52277 - 52269), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(49) + chr(2053 - 2004) + chr(0b100000 + 0o21), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(0b110001) + chr(0b110100) + chr(0b110 + 0o55), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(2713 - 2658) + chr(0b11100 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b100011 + 0o24) + '\x36', 28111 - 28103), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(2130 - 2082) + chr(111) + chr(0b110011) + '\063' + chr(0b11110 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2092 - 2041) + chr(0b110010) + chr(213 - 159), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(53) + chr(1086 - 1038), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x11'), chr(100) + chr(101) + '\143' + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(11370 - 11253) + chr(0b1101 + 0o147) + chr(0b1100110) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def VXbQBrT5nUON(bjIi5ihPeoZC, jeE3WRnsyWlA, n4ljua2gi1Pr):
return cSTkt6vzR8DL(bjIi5ihPeoZC, jeE3WRnsyWlA, sequence=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'L\xdb\xfb\xa2\xff\x0f\x02Z\xc1p\xf5]'), chr(0b1100100) + chr(0b1100101) + chr(394 - 295) + '\157' + chr(0b1001000 + 0o34) + chr(0b111000 + 0o55))(chr(0b111110 + 0o67) + chr(7598 - 7482) + chr(0b1100110) + chr(45) + chr(0b1 + 0o67))), dropout_rate=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'm\xba\xf0\x85\xfc\x1a\x13\x00\xb8v\xc4G'), chr(0b1100010 + 0o2) + '\145' + chr(0b1100011) + '\x6f' + chr(7581 - 7481) + chr(0b1100101))('\165' + '\164' + '\x66' + '\x2d' + chr(0b111000))), norm_type=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b's\xa8\x9a\xbb\xdaV7R\xec\x14\xcfc'), '\144' + chr(10176 - 10075) + '\143' + chr(8220 - 8109) + chr(2974 - 2874) + '\x65')('\x75' + chr(1603 - 1487) + chr(102) + chr(45) + chr(2037 - 1981))), depth=None, epsilon=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'J\xde\xfd\x8e\x9dQ$A\xfaM\x92c'), chr(0b1000110 + 0o36) + chr(0b1100101) + chr(0b10110 + 0o115) + chr(111) + chr(3459 - 3359) + '\x65')('\165' + '\x74' + chr(0b110100 + 0o62) + chr(0b11111 + 0o16) + '\x38')), dropout_broadcast_dims=uvqYhQl2rvPp(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'S\x8c\xd6\x98\xdd?\x13C\xe5S\xceg\xb9\x97\x8b\x18\x80\x96B#Y\xef\xaeyY\xc6\xc4\xd53\xf1\xf2\xf0|-\x00\xdc\ry\x84\xb2V\x80\xdc'), chr(0b1100100) + chr(0b1011110 + 0o7) + chr(0b100010 + 0o101) + chr(7897 - 7786) + '\144' + '\x65')(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b10001 + 0o34) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(6279 - 6179) + chr(0b1100101) + chr(99) + chr(0b11101 + 0o122) + '\x64' + '\145')(chr(0b1011001 + 0o34) + '\164' + chr(0b1100110) + chr(45) + '\070'))), default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'S\x8c\xd6\x98\xdd?\x13^\xf3W\xd1f\xa2\x84\x9c\x04\x90'), chr(0b111001 + 0o53) + '\x65' + chr(99) + chr(111) + '\144' + chr(0b1110 + 0o127))(chr(0b1001011 + 0o52) + chr(0b1110100) + chr(0b1100110) + chr(1498 - 1453) + chr(69 - 13)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_block_internal
|
def conv_block_internal(conv_fn,
inputs,
filters,
dilation_rates_and_kernel_sizes,
first_relu=True,
use_elu=False,
separabilities=None,
**kwargs):
"""A block of convolutions.
Args:
conv_fn: convolution function, e.g. conv or separable_conv.
inputs: a Tensor
filters: an Integer
dilation_rates_and_kernel_sizes: a list of tuples (dilation, (k_w, k_h))
first_relu: whether to do a relu at start (defaults to True)
use_elu: whether to use ELUs instead of ReLUs (defaults to False)
separabilities: list of separability factors (per-layer).
**kwargs: additional arguments (e.g., pooling)
Returns:
a Tensor.
"""
name = kwargs.pop("name") if "name" in kwargs else None
mask = kwargs.pop("mask") if "mask" in kwargs else None
# Usage for normalize_fn kwarg:
# if not specified, use layer norm
# if given normalize_fn=None, don't use any normalization
# if given normalize_fn=norm, use the specified norm function
use_layer_norm = "normalizer_fn" not in kwargs
norm = kwargs.pop("normalizer_fn", None)
use_normalizer_fn = use_layer_norm or norm
if use_layer_norm:
norm = lambda x, name: layer_norm(x, filters, name=name)
with tf.variable_scope(name, "conv_block", [inputs]):
cur, counter = inputs, -1
for dilation_rate, kernel_size in dilation_rates_and_kernel_sizes:
counter += 1
if first_relu or counter > 0:
cur = tf.nn.elu(cur) if use_elu else tf.nn.relu(cur)
if mask is not None:
cur *= mask
if separabilities:
cur = conv_fn(
cur,
filters,
kernel_size,
dilation_rate=dilation_rate,
name="conv_block_%d" % counter,
use_bias=norm is None,
separability=separabilities[counter],
**kwargs)
else:
cur = conv_fn(
cur,
filters,
kernel_size,
dilation_rate=dilation_rate,
name="conv_block_%d" % counter,
use_bias=norm is None,
**kwargs)
if use_normalizer_fn:
cur = norm(cur, name="conv_block_norm_%d" % counter)
return cur
|
python
|
def conv_block_internal(conv_fn,
inputs,
filters,
dilation_rates_and_kernel_sizes,
first_relu=True,
use_elu=False,
separabilities=None,
**kwargs):
"""A block of convolutions.
Args:
conv_fn: convolution function, e.g. conv or separable_conv.
inputs: a Tensor
filters: an Integer
dilation_rates_and_kernel_sizes: a list of tuples (dilation, (k_w, k_h))
first_relu: whether to do a relu at start (defaults to True)
use_elu: whether to use ELUs instead of ReLUs (defaults to False)
separabilities: list of separability factors (per-layer).
**kwargs: additional arguments (e.g., pooling)
Returns:
a Tensor.
"""
name = kwargs.pop("name") if "name" in kwargs else None
mask = kwargs.pop("mask") if "mask" in kwargs else None
# Usage for normalize_fn kwarg:
# if not specified, use layer norm
# if given normalize_fn=None, don't use any normalization
# if given normalize_fn=norm, use the specified norm function
use_layer_norm = "normalizer_fn" not in kwargs
norm = kwargs.pop("normalizer_fn", None)
use_normalizer_fn = use_layer_norm or norm
if use_layer_norm:
norm = lambda x, name: layer_norm(x, filters, name=name)
with tf.variable_scope(name, "conv_block", [inputs]):
cur, counter = inputs, -1
for dilation_rate, kernel_size in dilation_rates_and_kernel_sizes:
counter += 1
if first_relu or counter > 0:
cur = tf.nn.elu(cur) if use_elu else tf.nn.relu(cur)
if mask is not None:
cur *= mask
if separabilities:
cur = conv_fn(
cur,
filters,
kernel_size,
dilation_rate=dilation_rate,
name="conv_block_%d" % counter,
use_bias=norm is None,
separability=separabilities[counter],
**kwargs)
else:
cur = conv_fn(
cur,
filters,
kernel_size,
dilation_rate=dilation_rate,
name="conv_block_%d" % counter,
use_bias=norm is None,
**kwargs)
if use_normalizer_fn:
cur = norm(cur, name="conv_block_norm_%d" % counter)
return cur
|
[
"def",
"conv_block_internal",
"(",
"conv_fn",
",",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"first_relu",
"=",
"True",
",",
"use_elu",
"=",
"False",
",",
"separabilities",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"kwargs",
".",
"pop",
"(",
"\"name\"",
")",
"if",
"\"name\"",
"in",
"kwargs",
"else",
"None",
"mask",
"=",
"kwargs",
".",
"pop",
"(",
"\"mask\"",
")",
"if",
"\"mask\"",
"in",
"kwargs",
"else",
"None",
"# Usage for normalize_fn kwarg:",
"# if not specified, use layer norm",
"# if given normalize_fn=None, don't use any normalization",
"# if given normalize_fn=norm, use the specified norm function",
"use_layer_norm",
"=",
"\"normalizer_fn\"",
"not",
"in",
"kwargs",
"norm",
"=",
"kwargs",
".",
"pop",
"(",
"\"normalizer_fn\"",
",",
"None",
")",
"use_normalizer_fn",
"=",
"use_layer_norm",
"or",
"norm",
"if",
"use_layer_norm",
":",
"norm",
"=",
"lambda",
"x",
",",
"name",
":",
"layer_norm",
"(",
"x",
",",
"filters",
",",
"name",
"=",
"name",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"\"conv_block\"",
",",
"[",
"inputs",
"]",
")",
":",
"cur",
",",
"counter",
"=",
"inputs",
",",
"-",
"1",
"for",
"dilation_rate",
",",
"kernel_size",
"in",
"dilation_rates_and_kernel_sizes",
":",
"counter",
"+=",
"1",
"if",
"first_relu",
"or",
"counter",
">",
"0",
":",
"cur",
"=",
"tf",
".",
"nn",
".",
"elu",
"(",
"cur",
")",
"if",
"use_elu",
"else",
"tf",
".",
"nn",
".",
"relu",
"(",
"cur",
")",
"if",
"mask",
"is",
"not",
"None",
":",
"cur",
"*=",
"mask",
"if",
"separabilities",
":",
"cur",
"=",
"conv_fn",
"(",
"cur",
",",
"filters",
",",
"kernel_size",
",",
"dilation_rate",
"=",
"dilation_rate",
",",
"name",
"=",
"\"conv_block_%d\"",
"%",
"counter",
",",
"use_bias",
"=",
"norm",
"is",
"None",
",",
"separability",
"=",
"separabilities",
"[",
"counter",
"]",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"cur",
"=",
"conv_fn",
"(",
"cur",
",",
"filters",
",",
"kernel_size",
",",
"dilation_rate",
"=",
"dilation_rate",
",",
"name",
"=",
"\"conv_block_%d\"",
"%",
"counter",
",",
"use_bias",
"=",
"norm",
"is",
"None",
",",
"*",
"*",
"kwargs",
")",
"if",
"use_normalizer_fn",
":",
"cur",
"=",
"norm",
"(",
"cur",
",",
"name",
"=",
"\"conv_block_norm_%d\"",
"%",
"counter",
")",
"return",
"cur"
] |
A block of convolutions.
Args:
conv_fn: convolution function, e.g. conv or separable_conv.
inputs: a Tensor
filters: an Integer
dilation_rates_and_kernel_sizes: a list of tuples (dilation, (k_w, k_h))
first_relu: whether to do a relu at start (defaults to True)
use_elu: whether to use ELUs instead of ReLUs (defaults to False)
separabilities: list of separability factors (per-layer).
**kwargs: additional arguments (e.g., pooling)
Returns:
a Tensor.
|
[
"A",
"block",
"of",
"convolutions",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L960-L1028
|
train
|
Internal function for convolution block.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy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Error,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(0b101111 + 0o100) + chr(0b0 + 0o63) + chr(293 - 238) + chr(1266 - 1215), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\062' + '\060' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\066' + '\062', 0b1000), ehT0Px3KOsy9(chr(1049 - 1001) + '\157' + '\061' + chr(53), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x33' + chr(0b100110 + 0o21), 25127 - 25119), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\062' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(0b110010) + '\x32' + chr(0b110001 + 0o4), 63679 - 63671), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(49) + chr(2523 - 2469) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(2630 - 2578), 22697 - 22689), ehT0Px3KOsy9(chr(48) + chr(6352 - 6241) + '\x31' + '\x37' + chr(2401 - 2352), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(305 - 254) + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + '\064', 0b1000), ehT0Px3KOsy9(chr(717 - 669) + '\157' + chr(0b1011 + 0o52) + chr(50), 0o10), ehT0Px3KOsy9(chr(911 - 863) + '\x6f' + chr(51) + chr(0b110001 + 0o3) + chr(0b101 + 0o56), 41724 - 41716), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1100011 + 0o14) + chr(0b11010 + 0o27) + '\061' + '\067', 0o10), ehT0Px3KOsy9(chr(1325 - 1277) + chr(111) + '\063' + chr(55) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b110101) + chr(0b101101 + 0o4), 0o10), ehT0Px3KOsy9('\x30' + chr(6396 - 6285) + chr(1549 - 1498) + '\066' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(532 - 421) + chr(0b110010) + chr(51) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1009 - 961) + chr(0b1101111) + '\067' + '\065', 0o10), ehT0Px3KOsy9(chr(1979 - 1931) + chr(9655 - 9544) + chr(0b100001 + 0o20) + chr(1856 - 1801), 39236 - 39228), ehT0Px3KOsy9('\x30' + chr(111) + chr(2259 - 2208) + '\x31' + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1944 - 1893) + '\x32' + '\x35', 6709 - 6701), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\062' + chr(50), 30188 - 30180), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(55) + chr(0b1010 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\x32' + chr(653 - 600) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110) + chr(1128 - 1079), 0b1000), ehT0Px3KOsy9(chr(1383 - 1335) + '\157' + chr(489 - 439) + '\063' + '\x30', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(632 - 583) + '\x30', 36797 - 36789), ehT0Px3KOsy9(chr(550 - 502) + '\x6f' + chr(50) + chr(0b110010) + chr(591 - 540), 0o10), ehT0Px3KOsy9(chr(814 - 766) + '\157' + chr(2560 - 2509) + chr(818 - 770) + chr(53), 13141 - 13133), ehT0Px3KOsy9('\060' + chr(1873 - 1762) + chr(0b11 + 0o56) + '\x35' + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11101 + 0o26) + '\061' + chr(1579 - 1531), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1010011 + 0o34) + chr(51) + chr(0b110010) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + chr(54) + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b100011 + 0o21) + chr(2252 - 2201), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10001 + 0o136) + '\x31' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(51) + '\065', 53430 - 53422), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(9925 - 9814) + '\x33' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(49) + chr(0b110110) + chr(0b11110 + 0o25), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1100000 + 0o17) + chr(0b10011 + 0o42) + chr(0b10111 + 0o31), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5'), chr(6784 - 6684) + '\145' + chr(99) + chr(0b1100010 + 0o15) + chr(0b110000 + 0o64) + chr(939 - 838))('\165' + chr(0b1110100) + chr(102) + '\055' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def rZRfV7pR2b2W(g8j_K9LUbc07, vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, B5W4NvHB8_yU=ehT0Px3KOsy9(chr(48) + chr(10871 - 10760) + '\x31', 0b1000), wLdhwRIbZluc=ehT0Px3KOsy9('\x30' + '\157' + '\x30', 0o10), xzn0_ALuKp3T=None, **M8EIoTs2GJXE):
AIvJRzLdDfgF = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\xe7\x9fh'), '\144' + chr(0b111001 + 0o54) + '\143' + '\157' + '\x64' + '\145')(chr(0b100100 + 0o121) + chr(4885 - 4769) + chr(102) + '\x2d' + chr(0b111000))) if xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\xe7\x9fh'), chr(0b1100100) + chr(4084 - 3983) + chr(0b100000 + 0o103) + '\x6f' + '\x64' + '\145')(chr(0b100010 + 0o123) + chr(116) + chr(0b1100110) + chr(0b100001 + 0o14) + chr(56)) in M8EIoTs2GJXE else None
Iz1jSgUKZDvt = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\x96\xe7\x81f'), '\x64' + chr(0b1100101) + chr(219 - 120) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(117) + chr(116) + chr(102) + chr(0b100111 + 0o6) + '\x38')) if xafqLlk3kkUe(SXOLrMavuUCe(b'\x96\xe7\x81f'), '\144' + '\145' + chr(7224 - 7125) + chr(0b1101111) + chr(0b110011 + 0o61) + chr(0b1100101))(chr(117) + chr(0b110100 + 0o100) + chr(0b1110 + 0o130) + '\055' + chr(2170 - 2114)) in M8EIoTs2GJXE else None
idghEudhpDBE = xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\xe9\x80`\xbe\xba\xfc\x0fa\x0b\xb1RD'), chr(0b1000010 + 0o42) + '\x65' + chr(8809 - 8710) + chr(0b1101111) + chr(9483 - 9383) + '\145')(chr(12079 - 11962) + chr(116) + chr(0b1100110) + chr(464 - 419) + chr(0b111000)) not in M8EIoTs2GJXE
eTOwOXrckQns = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\xe9\x80`\xbe\xba\xfc\x0fa\x0b\xb1RD'), chr(0b1011111 + 0o5) + '\x65' + chr(5601 - 5502) + chr(111) + chr(234 - 134) + chr(101))(chr(117) + '\164' + chr(3670 - 3568) + '\x2d' + chr(56)), None)
Komn6912EbGZ = idghEudhpDBE or eTOwOXrckQns
if idghEudhpDBE:
def eTOwOXrckQns(OeWW0F1dBPRQ, AIvJRzLdDfgF):
return EbVYEOXA2Nzq(OeWW0F1dBPRQ, MErh319F3bgE, name=AIvJRzLdDfgF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d\xe7\x80d\xbe\xb4\xf9\x10[\n\x8d[Z\x86'), '\144' + chr(0b1100101) + chr(0b1000110 + 0o35) + chr(0b1110 + 0o141) + '\x64' + '\x65')(chr(10963 - 10846) + chr(0b1110100) + chr(102) + '\055' + '\070'))(AIvJRzLdDfgF, xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\xe9\x9c{\x80\xb4\xf9\x1ag\x12'), '\144' + '\145' + chr(0b1100011) + '\157' + chr(100) + '\145')('\165' + chr(0b1110100) + chr(7879 - 7777) + chr(0b111 + 0o46) + chr(0b110101 + 0o3)), [vXoupepMtCXU]):
(wL6S4kgnTowq, pD5Ye7vZLivj) = (vXoupepMtCXU, -ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11111 + 0o22), 8))
for (Rm2KgSQziMI2, m6gwVXy4D3Au) in Ueyko2vJujIA:
pD5Ye7vZLivj += ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49), 8)
if B5W4NvHB8_yU or pD5Ye7vZLivj > ehT0Px3KOsy9(chr(0b110000) + chr(8924 - 8813) + chr(48), 8):
wL6S4kgnTowq = IDJ2eXGCBCDu.nn.elu(wL6S4kgnTowq) if wLdhwRIbZluc else IDJ2eXGCBCDu.nn.relu(wL6S4kgnTowq)
if Iz1jSgUKZDvt is not None:
wL6S4kgnTowq *= Iz1jSgUKZDvt
if xzn0_ALuKp3T:
wL6S4kgnTowq = g8j_K9LUbc07(wL6S4kgnTowq, MErh319F3bgE, m6gwVXy4D3Au, dilation_rate=Rm2KgSQziMI2, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\xe9\x9c{\x80\xb4\xf9\x1ag\x12\xb1\x11N'), chr(0b1011111 + 0o5) + chr(0b11010 + 0o113) + chr(99) + chr(5642 - 5531) + '\x64' + chr(101))('\x75' + '\x74' + chr(102) + '\055' + chr(1634 - 1578)) % pD5Ye7vZLivj, use_bias=eTOwOXrckQns is None, separability=xzn0_ALuKp3T[pD5Ye7vZLivj], **M8EIoTs2GJXE)
else:
wL6S4kgnTowq = g8j_K9LUbc07(wL6S4kgnTowq, MErh319F3bgE, m6gwVXy4D3Au, dilation_rate=Rm2KgSQziMI2, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\xe9\x9c{\x80\xb4\xf9\x1ag\x12\xb1\x11N'), '\x64' + '\x65' + chr(99) + '\x6f' + '\144' + chr(0b1100 + 0o131))(chr(12306 - 12189) + chr(116) + chr(102) + chr(45) + chr(0b11010 + 0o36)) % pD5Ye7vZLivj, use_bias=eTOwOXrckQns is None, **M8EIoTs2GJXE)
if Komn6912EbGZ:
wL6S4kgnTowq = eTOwOXrckQns(wL6S4kgnTowq, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x98\xe9\x9c{\x80\xb4\xf9\x1ag\x12\xb1ZE\x91"\xa6L\x95'), chr(0b101100 + 0o70) + chr(101) + '\143' + chr(111) + '\144' + chr(0b1010110 + 0o17))('\x75' + chr(1225 - 1109) + '\x66' + chr(45) + chr(0b111000)) % pD5Ye7vZLivj)
return wL6S4kgnTowq
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_block
|
def conv_block(inputs, filters, dilation_rates_and_kernel_sizes, **kwargs):
"""A block of standard 2d convolutions."""
return conv_block_internal(conv, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
python
|
def conv_block(inputs, filters, dilation_rates_and_kernel_sizes, **kwargs):
"""A block of standard 2d convolutions."""
return conv_block_internal(conv, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
[
"def",
"conv_block",
"(",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"conv_block_internal",
"(",
"conv",
",",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")"
] |
A block of standard 2d convolutions.
|
[
"A",
"block",
"of",
"standard",
"2d",
"convolutions",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1031-L1034
|
train
|
A block of standard 2d convolutions.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAM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eticError,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) + '\x35' + chr(51), 19866 - 19858), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(51) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b10011 + 0o43) + chr(0b1000 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(0b110001) + chr(1785 - 1735) + chr(1823 - 1771), 25106 - 25098), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1436 - 1386) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + '\063' + chr(53) + '\062', 16367 - 16359), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(52) + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + chr(1884 - 1773) + chr(1770 - 1719) + chr(0b1 + 0o60) + chr(51), 0b1000), ehT0Px3KOsy9(chr(273 - 225) + chr(111) + chr(375 - 324) + '\060' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b110100 + 0o1) + chr(547 - 494), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1000 + 0o57) + chr(52), 26512 - 26504), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(260 - 206) + '\x35', 64526 - 64518), ehT0Px3KOsy9(chr(706 - 658) + chr(111) + chr(49) + chr(0b110010) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(55) + chr(0b1110 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x36' + '\x37', 58597 - 58589), ehT0Px3KOsy9(chr(48) + chr(4925 - 4814) + chr(51) + chr(0b110011) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x36' + chr(2556 - 2501), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(0b110010 + 0o2) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b10110 + 0o131) + chr(0b110010) + '\x34' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(0b100101 + 0o112) + '\x32' + chr(476 - 421) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(48) + chr(0b10111 + 0o32), 0b1000), ehT0Px3KOsy9('\060' + chr(9432 - 9321) + chr(272 - 221) + chr(0b1 + 0o64) + chr(48), 15628 - 15620), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(957 - 907) + chr(0b110111) + chr(2480 - 2425), 0o10), ehT0Px3KOsy9(chr(1948 - 1900) + '\157' + chr(49) + chr(1665 - 1611) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\x36' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(509 - 458) + chr(53) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1925 - 1874) + chr(0b110001) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b111010 + 0o65) + chr(948 - 895), 0o10), ehT0Px3KOsy9(chr(1589 - 1541) + chr(111) + '\062' + chr(0b100000 + 0o20) + '\061', 0b1000), ehT0Px3KOsy9(chr(728 - 680) + chr(111) + chr(51) + chr(567 - 519) + chr(0b100111 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1001010 + 0o45) + chr(50) + chr(1837 - 1783) + '\063', 36848 - 36840), ehT0Px3KOsy9('\060' + chr(8554 - 8443) + '\x33' + chr(53) + chr(165 - 116), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\x34' + chr(0b10000 + 0o42), ord("\x08")), ehT0Px3KOsy9(chr(807 - 759) + '\157' + chr(50) + chr(54), 0o10), ehT0Px3KOsy9(chr(2129 - 2081) + chr(0b1101111) + '\x33' + chr(2009 - 1956) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(1437 - 1384) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1790 - 1740) + '\x32' + chr(55), 0b1000), ehT0Px3KOsy9(chr(712 - 664) + chr(3972 - 3861) + chr(0b110 + 0o54) + chr(0b110101) + chr(1035 - 980), 0o10), ehT0Px3KOsy9(chr(608 - 560) + chr(111) + '\062' + '\066' + '\067', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\067' + chr(0b101101 + 0o11), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(0b101100 + 0o11) + chr(1316 - 1268), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x05'), chr(0b1000011 + 0o41) + '\x65' + chr(0b1100011) + chr(0b11110 + 0o121) + '\144' + chr(0b100101 + 0o100))('\165' + '\164' + '\x66' + chr(0b1 + 0o54) + chr(0b11010 + 0o36)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def UPhJ6DlDf_h1(vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE):
return rZRfV7pR2b2W(m1sWr00SVpVY, vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv1d_block
|
def conv1d_block(inputs, filters, dilation_rates_and_kernel_sizes, **kwargs):
"""A block of standard 1d convolutions."""
return conv_block_internal(conv1d, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
python
|
def conv1d_block(inputs, filters, dilation_rates_and_kernel_sizes, **kwargs):
"""A block of standard 1d convolutions."""
return conv_block_internal(conv1d, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
[
"def",
"conv1d_block",
"(",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"conv_block_internal",
"(",
"conv1d",
",",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")"
] |
A block of standard 1d convolutions.
|
[
"A",
"block",
"of",
"standard",
"1d",
"convolutions",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1037-L1040
|
train
|
A block of standard 1d convolutions.
|
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,sznFqDbNBHl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RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b110001) + chr(0b101110 + 0o4), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2063 - 2013) + '\063' + chr(907 - 859), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5630 - 5519) + chr(0b101010 + 0o7) + chr(2493 - 2441) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(823 - 774) + chr(54), 8092 - 8084), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1531 - 1477) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + '\x31' + chr(55) + chr(0b110100), 33212 - 33204), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + '\x33' + chr(51) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b101111 + 0o3) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b110001 + 0o76) + chr(391 - 342) + chr(2196 - 2147) + '\066', 46604 - 46596), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(53) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + chr(0b1100 + 0o46) + chr(309 - 258) + chr(2324 - 2275), ord("\x08")), ehT0Px3KOsy9(chr(840 - 792) + chr(111) + chr(50) + '\061' + chr(0b1011 + 0o54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11542 - 11431) + chr(55) + chr(0b110001), 14456 - 14448), ehT0Px3KOsy9(chr(2208 - 2160) + chr(111) + chr(50) + '\x32' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(2120 - 2072) + chr(8287 - 8176) + chr(2345 - 2294) + chr(55) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1376 - 1328) + '\x6f' + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b110101) + chr(0b11001 + 0o35), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000100 + 0o53) + chr(49) + '\x32' + '\060', 0b1000), ehT0Px3KOsy9(chr(51 - 3) + '\x6f' + '\x32' + chr(0b1110 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(0b100001 + 0o22) + '\065' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4891 - 4780) + chr(2121 - 2071) + '\060' + '\065', 0b1000), ehT0Px3KOsy9(chr(1948 - 1900) + chr(0b11 + 0o154) + chr(0b10011 + 0o40) + chr(655 - 601) + chr(0b100100 + 0o20), 53746 - 53738), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(49) + '\067', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1704 - 1654) + '\065' + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1468 - 1357) + chr(0b110010) + '\x34' + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100100 + 0o113) + chr(0b100101 + 0o20) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10618 - 10507) + chr(50) + chr(0b110011) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(51), 8), ehT0Px3KOsy9('\x30' + '\157' + '\x34' + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + chr(9274 - 9163) + '\063' + chr(1434 - 1380) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(742 - 693) + chr(0b110100) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1675 - 1627) + '\x6f' + chr(424 - 374) + '\062' + chr(0b100100 + 0o16), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(1410 - 1361) + chr(0b100001 + 0o20) + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100001 + 0o26) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b10001 + 0o136) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + chr(2291 - 2242) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + chr(51) + '\063' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100110 + 0o111) + '\061' + chr(1372 - 1317), 6446 - 6438), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001011 + 0o44) + '\061' + '\x35' + chr(54), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(11955 - 11844) + chr(53) + chr(0b10111 + 0o31), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'd'), chr(1496 - 1396) + chr(101) + chr(4081 - 3982) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b11011 + 0o131) + '\x66' + chr(0b11001 + 0o24) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def m5LW1eIAWoR8(vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE):
return rZRfV7pR2b2W(aXjcJrCEUeB1, vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
separable_conv_block
|
def separable_conv_block(inputs, filters, dilation_rates_and_kernel_sizes,
**kwargs):
"""A block of separable convolutions."""
return conv_block_internal(separable_conv, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
python
|
def separable_conv_block(inputs, filters, dilation_rates_and_kernel_sizes,
**kwargs):
"""A block of separable convolutions."""
return conv_block_internal(separable_conv, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
[
"def",
"separable_conv_block",
"(",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"conv_block_internal",
"(",
"separable_conv",
",",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")"
] |
A block of separable convolutions.
|
[
"A",
"block",
"of",
"separable",
"convolutions",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1043-L1047
|
train
|
A block of separable convolutions.
|
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,V5s4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BlYI2Bx4,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(51) + chr(0b110001) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(1226 - 1178) + '\x6f' + chr(181 - 130) + chr(55) + '\x34', 27574 - 27566), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(2671 - 2616) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(174 - 126) + chr(111) + chr(0b10 + 0o57) + chr(0b10000 + 0o40), 30065 - 30057), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + '\062' + '\x33' + chr(1497 - 1449), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b111 + 0o52), 0o10), ehT0Px3KOsy9(chr(1136 - 1088) + '\x6f' + chr(1066 - 1017) + '\061' + chr(0b11001 + 0o31), 57585 - 57577), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\062' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b1101 + 0o45), 45406 - 45398), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(51), 21435 - 21427), ehT0Px3KOsy9(chr(2020 - 1972) + chr(0b1101111) + '\063' + chr(0b1100 + 0o45) + chr(0b110100), 38454 - 38446), ehT0Px3KOsy9(chr(48) + '\x6f' + '\067' + chr(2373 - 2318), 0b1000), ehT0Px3KOsy9(chr(1478 - 1430) + chr(111) + chr(50) + chr(0b11010 + 0o27) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1205 - 1154) + chr(52) + chr(1104 - 1049), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + '\x32' + chr(587 - 537) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(290 - 236) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(489 - 378) + chr(0b100010 + 0o20) + '\x32' + '\063', 8), ehT0Px3KOsy9(chr(48) + chr(3520 - 3409) + chr(0b10110 + 0o34) + chr(0b110001) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + chr(7388 - 7277) + '\061' + '\063' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4422 - 4311) + chr(0b11000 + 0o34) + chr(2086 - 2033), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110010) + chr(53), 58985 - 58977), ehT0Px3KOsy9(chr(2007 - 1959) + chr(0b1101111) + '\062' + '\063' + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9450 - 9339) + chr(50) + '\067' + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2240 - 2189) + chr(1381 - 1330) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(3568 - 3457) + chr(51) + chr(1989 - 1941) + '\062', 40871 - 40863), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b110111), 56586 - 56578), ehT0Px3KOsy9(chr(502 - 454) + '\x6f' + chr(0b110011) + chr(1291 - 1238) + '\067', 0o10), ehT0Px3KOsy9(chr(1060 - 1012) + chr(0b1101111) + chr(0b11100 + 0o27) + chr(48) + '\062', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(54) + chr(1707 - 1659), 0b1000), ehT0Px3KOsy9('\060' + chr(0b111000 + 0o67) + '\x33' + chr(0b110010) + chr(756 - 701), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11365 - 11254) + chr(0b101111 + 0o3) + chr(49) + '\x37', 8), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + '\061' + '\x36' + chr(0b0 + 0o63), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + chr(0b10100 + 0o36) + chr(1936 - 1888) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2042 - 1992) + chr(1186 - 1132) + '\060', 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(4547 - 4436) + chr(0b110010) + '\064' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(49) + chr(104 - 56), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(1544 - 1490) + chr(0b11 + 0o64), 0o10), ehT0Px3KOsy9('\060' + chr(0b100001 + 0o116) + chr(0b110100) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\065' + chr(49), 40295 - 40287), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\060' + '\064', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(53) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6'), chr(100) + '\145' + '\143' + chr(0b1101111) + '\x64' + chr(9169 - 9068))(chr(8337 - 8220) + chr(0b1010101 + 0o37) + chr(102) + chr(0b100110 + 0o7) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def IMSRhAp5bpVt(vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE):
return rZRfV7pR2b2W(lTpasN2UxYY3, vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
subseparable_conv_block
|
def subseparable_conv_block(inputs, filters, dilation_rates_and_kernel_sizes,
**kwargs):
"""A block of separable convolutions."""
return conv_block_internal(subseparable_conv, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
python
|
def subseparable_conv_block(inputs, filters, dilation_rates_and_kernel_sizes,
**kwargs):
"""A block of separable convolutions."""
return conv_block_internal(subseparable_conv, inputs, filters,
dilation_rates_and_kernel_sizes, **kwargs)
|
[
"def",
"subseparable_conv_block",
"(",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"conv_block_internal",
"(",
"subseparable_conv",
",",
"inputs",
",",
"filters",
",",
"dilation_rates_and_kernel_sizes",
",",
"*",
"*",
"kwargs",
")"
] |
A block of separable convolutions.
|
[
"A",
"block",
"of",
"separable",
"convolutions",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1050-L1054
|
train
|
A block of separable convolutions.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR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SK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100000 + 0o24) + chr(952 - 901), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + chr(0b101000 + 0o13) + chr(0b101000 + 0o13) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101101 + 0o4) + chr(0b110111) + '\065', 0b1000), ehT0Px3KOsy9(chr(140 - 92) + chr(0b1101111) + chr(1858 - 1807) + '\x37' + chr(0b11010 + 0o35), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10111 + 0o34) + chr(1381 - 1331) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b100011 + 0o17) + chr(1555 - 1504), 9021 - 9013), ehT0Px3KOsy9(chr(809 - 761) + chr(0b1101111) + '\x32' + '\x33' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(0b110001) + '\064' + chr(0b0 + 0o63), 9400 - 9392), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(965 - 913) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(1804 - 1749) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(513 - 465) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(810 - 761) + '\x33' + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100010 + 0o20) + chr(0b110010) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110000) + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(1561 - 1450) + '\063' + '\x34' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(511 - 463) + '\x6f' + chr(0b10101 + 0o36) + chr(52) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110001) + chr(0b0 + 0o61), 41394 - 41386), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110100) + chr(2594 - 2542), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6697 - 6586) + '\x32' + '\x31' + chr(0b110010), 37308 - 37300), ehT0Px3KOsy9('\x30' + chr(0b1101101 + 0o2) + chr(0b111 + 0o57) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(2027 - 1972), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b10100 + 0o40) + chr(49), 8), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(52) + chr(52), 8), ehT0Px3KOsy9(chr(1127 - 1079) + chr(111) + '\066' + chr(48), 64829 - 64821), ehT0Px3KOsy9(chr(48) + '\157' + chr(592 - 542) + '\x35' + chr(0b101101 + 0o11), 16858 - 16850), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(0b1 + 0o61) + '\063' + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(49) + chr(2502 - 2448), 0o10), ehT0Px3KOsy9('\x30' + chr(10033 - 9922) + chr(50) + chr(48) + '\x31', 40372 - 40364), ehT0Px3KOsy9(chr(48) + chr(5575 - 5464) + chr(0b101001 + 0o10) + '\062' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101111 + 0o4) + chr(53) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(162 - 114) + chr(111) + '\061' + chr(54) + '\x32', 0o10), ehT0Px3KOsy9(chr(1986 - 1938) + chr(111) + chr(0b100001 + 0o20) + chr(2097 - 2048) + chr(0b100110 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(1943 - 1895) + chr(0b1101111) + '\063' + '\x35' + chr(0b100011 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011000 + 0o27) + chr(151 - 103), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111011 + 0o64) + chr(951 - 902) + chr(0b110110) + '\x36', 31107 - 31099), ehT0Px3KOsy9('\060' + chr(9521 - 9410) + '\x32' + '\x32' + chr(0b100101 + 0o22), 35251 - 35243), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(3836 - 3725) + chr(0b110010) + '\x32', 0b1000), ehT0Px3KOsy9(chr(657 - 609) + '\157' + chr(0b100001 + 0o22) + chr(50) + chr(48), 13216 - 13208), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1001 + 0o50) + chr(2247 - 2194) + chr(48), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(1764 - 1653) + '\065' + '\060', 46434 - 46426)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\r'), '\144' + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(2206 - 2106) + chr(0b1100101))(chr(0b1001110 + 0o47) + '\164' + '\146' + '\055' + chr(2463 - 2407)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def L0bIidvPuuXV(vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE):
return rZRfV7pR2b2W(WjoAbnBa0SsI, vXoupepMtCXU, MErh319F3bgE, Ueyko2vJujIA, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
pool
|
def pool(inputs, window_size, pooling_type, padding, strides=(1, 1)):
"""Pooling (supports "LEFT")."""
with tf.name_scope("pool", values=[inputs]):
static_shape = inputs.get_shape()
if not static_shape or len(static_shape) != 4:
raise ValueError("Inputs to conv must have statically known rank 4.")
# Add support for left padding.
if padding == "LEFT":
assert window_size[0] % 2 == 1 and window_size[1] % 2 == 1
if len(static_shape) == 3:
width_padding = 2 * (window_size[1] // 2)
padding_ = [[0, 0], [width_padding, 0], [0, 0]]
else:
height_padding = 2 * (window_size[0] // 2)
cond_padding = tf.cond(
tf.equal(shape_list(inputs)[2], 1), lambda: tf.constant(0),
lambda: tf.constant(2 * (window_size[1] // 2)))
width_padding = 0 if static_shape[2] == 1 else cond_padding
padding_ = [[0, 0], [height_padding, 0], [width_padding, 0], [0, 0]]
inputs = tf.pad(inputs, padding_)
inputs.set_shape([static_shape[0], None, None, static_shape[3]])
padding = "VALID"
return tf.nn.pool(inputs, window_size, pooling_type, padding, strides=strides)
|
python
|
def pool(inputs, window_size, pooling_type, padding, strides=(1, 1)):
"""Pooling (supports "LEFT")."""
with tf.name_scope("pool", values=[inputs]):
static_shape = inputs.get_shape()
if not static_shape or len(static_shape) != 4:
raise ValueError("Inputs to conv must have statically known rank 4.")
# Add support for left padding.
if padding == "LEFT":
assert window_size[0] % 2 == 1 and window_size[1] % 2 == 1
if len(static_shape) == 3:
width_padding = 2 * (window_size[1] // 2)
padding_ = [[0, 0], [width_padding, 0], [0, 0]]
else:
height_padding = 2 * (window_size[0] // 2)
cond_padding = tf.cond(
tf.equal(shape_list(inputs)[2], 1), lambda: tf.constant(0),
lambda: tf.constant(2 * (window_size[1] // 2)))
width_padding = 0 if static_shape[2] == 1 else cond_padding
padding_ = [[0, 0], [height_padding, 0], [width_padding, 0], [0, 0]]
inputs = tf.pad(inputs, padding_)
inputs.set_shape([static_shape[0], None, None, static_shape[3]])
padding = "VALID"
return tf.nn.pool(inputs, window_size, pooling_type, padding, strides=strides)
|
[
"def",
"pool",
"(",
"inputs",
",",
"window_size",
",",
"pooling_type",
",",
"padding",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"pool\"",
",",
"values",
"=",
"[",
"inputs",
"]",
")",
":",
"static_shape",
"=",
"inputs",
".",
"get_shape",
"(",
")",
"if",
"not",
"static_shape",
"or",
"len",
"(",
"static_shape",
")",
"!=",
"4",
":",
"raise",
"ValueError",
"(",
"\"Inputs to conv must have statically known rank 4.\"",
")",
"# Add support for left padding.",
"if",
"padding",
"==",
"\"LEFT\"",
":",
"assert",
"window_size",
"[",
"0",
"]",
"%",
"2",
"==",
"1",
"and",
"window_size",
"[",
"1",
"]",
"%",
"2",
"==",
"1",
"if",
"len",
"(",
"static_shape",
")",
"==",
"3",
":",
"width_padding",
"=",
"2",
"*",
"(",
"window_size",
"[",
"1",
"]",
"//",
"2",
")",
"padding_",
"=",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"width_padding",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
"else",
":",
"height_padding",
"=",
"2",
"*",
"(",
"window_size",
"[",
"0",
"]",
"//",
"2",
")",
"cond_padding",
"=",
"tf",
".",
"cond",
"(",
"tf",
".",
"equal",
"(",
"shape_list",
"(",
"inputs",
")",
"[",
"2",
"]",
",",
"1",
")",
",",
"lambda",
":",
"tf",
".",
"constant",
"(",
"0",
")",
",",
"lambda",
":",
"tf",
".",
"constant",
"(",
"2",
"*",
"(",
"window_size",
"[",
"1",
"]",
"//",
"2",
")",
")",
")",
"width_padding",
"=",
"0",
"if",
"static_shape",
"[",
"2",
"]",
"==",
"1",
"else",
"cond_padding",
"padding_",
"=",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"height_padding",
",",
"0",
"]",
",",
"[",
"width_padding",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
"inputs",
"=",
"tf",
".",
"pad",
"(",
"inputs",
",",
"padding_",
")",
"inputs",
".",
"set_shape",
"(",
"[",
"static_shape",
"[",
"0",
"]",
",",
"None",
",",
"None",
",",
"static_shape",
"[",
"3",
"]",
"]",
")",
"padding",
"=",
"\"VALID\"",
"return",
"tf",
".",
"nn",
".",
"pool",
"(",
"inputs",
",",
"window_size",
",",
"pooling_type",
",",
"padding",
",",
"strides",
"=",
"strides",
")"
] |
Pooling (supports "LEFT").
|
[
"Pooling",
"(",
"supports",
"LEFT",
")",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1057-L1080
|
train
|
Pooling supports LEFT.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAK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2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + '\061' + '\061' + chr(54), 26798 - 26790), ehT0Px3KOsy9('\x30' + '\157' + chr(459 - 408) + chr(55) + chr(1566 - 1513), 0b1000), ehT0Px3KOsy9(chr(411 - 363) + chr(111) + '\x35' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(2105 - 2057) + chr(111) + chr(50) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(2219 - 2171) + '\x6f' + chr(50) + chr(0b10111 + 0o35) + chr(0b110101), 9683 - 9675), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1642 - 1592) + chr(0b110100) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + '\x33' + chr(54) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(815 - 767) + chr(0b1010110 + 0o31) + chr(2425 - 2374) + chr(0b110110) + chr(2441 - 2388), 24316 - 24308), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11001 + 0o31) + chr(2517 - 2464) + chr(0b101010 + 0o10), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(200 - 145) + chr(52), 23495 - 23487), ehT0Px3KOsy9(chr(1018 - 970) + chr(111) + chr(0b101100 + 0o6) + chr(0b110101) + '\061', 62016 - 62008), ehT0Px3KOsy9('\x30' + chr(0b1001101 + 0o42) + chr(50) + '\061' + chr(0b100100 + 0o14), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1001110 + 0o41) + chr(53) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(1667 - 1619) + chr(7868 - 7757) + chr(51) + '\064' + chr(0b11010 + 0o35), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(55) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(476 - 426) + chr(0b101 + 0o54) + chr(0b110011), 2226 - 2218), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(51) + chr(1789 - 1734), 33192 - 33184), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(0b101011 + 0o10) + chr(50) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(1991 - 1943) + chr(7962 - 7851) + chr(0b110001) + chr(0b1101 + 0o50) + '\x31', 28488 - 28480), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11101 + 0o31) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(345 - 294) + chr(1659 - 1604) + chr(0b110110), 56273 - 56265), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + chr(0b110 + 0o55) + '\x33' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + '\061' + chr(55) + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(0b101 + 0o56) + chr(0b110111) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1548 - 1499) + '\x33' + chr(2617 - 2565), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b110101) + '\065', 21926 - 21918), ehT0Px3KOsy9(chr(1230 - 1182) + '\x6f' + chr(382 - 331) + chr(0b101000 + 0o16) + chr(1873 - 1822), 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b110011) + chr(53) + chr(0b110000), 42611 - 42603), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(9465 - 9354) + '\061' + chr(0b100110 + 0o14) + chr(2077 - 2029), ord("\x08")), ehT0Px3KOsy9(chr(751 - 703) + '\157' + chr(0b1000 + 0o53) + chr(0b11100 + 0o33) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(0b101000 + 0o13) + chr(405 - 353) + chr(0b101101 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1000101 + 0o52) + '\x32' + '\x31' + '\062', 0b1000), ehT0Px3KOsy9('\x30' + chr(908 - 797) + '\x36' + '\061', 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1 + 0o156) + '\061' + '\063' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1656 - 1608) + chr(1818 - 1707) + chr(0b10010 + 0o44) + chr(2444 - 2394), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + '\061' + chr(0b10010 + 0o42) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110110) + '\061', 0b1000), ehT0Px3KOsy9(chr(2227 - 2179) + chr(111) + '\065' + chr(0b11011 + 0o31), 0o10), ehT0Px3KOsy9(chr(70 - 22) + chr(0b1101111) + chr(0b11000 + 0o31) + chr(0b110111) + '\x34', 0b1000), ehT0Px3KOsy9(chr(1039 - 991) + chr(111) + '\063' + chr(1234 - 1180) + chr(51), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1253 - 1205) + chr(0b1010011 + 0o34) + '\065' + chr(0b10001 + 0o37), 63525 - 63517)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'`'), chr(5649 - 5549) + chr(101) + chr(0b1100011) + '\x6f' + chr(100) + chr(101))(chr(117) + chr(0b1110100) + '\x66' + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def qsPHwJ5jT7iz(vXoupepMtCXU, zk_9FDxvu_Qq, JRhBz5W8YzDa, TFLseEYASEKG, r8knJmMTTKwv=(ehT0Px3KOsy9('\060' + chr(111) + chr(133 - 84), 22403 - 22395), ehT0Px3KOsy9('\060' + '\x6f' + '\061', 8))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b' \x9cBw\xfa\xd2\x90\x9a\xda\xd9'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(111) + '\144' + chr(0b1100101))('\165' + chr(116) + chr(0b1100110) + '\x2d' + chr(0b1 + 0o67)))(xafqLlk3kkUe(SXOLrMavuUCe(b'>\x92@~'), '\144' + '\x65' + '\143' + chr(0b110110 + 0o71) + chr(9016 - 8916) + '\x65')('\165' + '\164' + chr(0b1100110) + chr(45) + '\x38'), values=[vXoupepMtCXU]):
mPvZu54qNVig = vXoupepMtCXU.get_shape()
if not mPvZu54qNVig or c2A0yzQpDQB3(mPvZu54qNVig) != ehT0Px3KOsy9(chr(48) + '\157' + '\064', 0o10):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x93_g\xd1\xd2\xd3\x81\xc5\x9c\xca\xe7@\x91Y\xe6\xaa\xa2\x1d\x16\x96\xbd\x0f\x9f|\x9e\x87\x89$\x92\x80\xeb]3KE\x1aB\x13\x84 \xdd]s\xcb\xca\xd3\xc1\x84'), '\x64' + '\x65' + '\143' + '\157' + chr(0b10111 + 0o115) + '\145')(chr(0b111011 + 0o72) + chr(0b1110100) + '\146' + '\055' + chr(56)))
if TFLseEYASEKG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xb8iF'), '\144' + '\x65' + chr(0b1001110 + 0o25) + '\157' + chr(0b1010 + 0o132) + chr(0b1001000 + 0o35))(chr(8128 - 8011) + chr(5814 - 5698) + chr(0b1100110) + chr(45) + chr(347 - 291)):
assert zk_9FDxvu_Qq[ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(348 - 300), 0o10)] % ehT0Px3KOsy9('\x30' + chr(3989 - 3878) + '\x32', 0o10) == ehT0Px3KOsy9(chr(2199 - 2151) + chr(0b10100 + 0o133) + '\061', 8) and zk_9FDxvu_Qq[ehT0Px3KOsy9('\x30' + chr(0b11110 + 0o121) + chr(0b100101 + 0o14), 8)] % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50), 8) == ehT0Px3KOsy9('\x30' + chr(0b1001110 + 0o41) + chr(1467 - 1418), 8)
if c2A0yzQpDQB3(mPvZu54qNVig) == ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011), 0b1000):
o7e_EUWc8mDu = ehT0Px3KOsy9('\x30' + chr(2379 - 2268) + chr(0b110010), 8) * (zk_9FDxvu_Qq[ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1001 + 0o50), 8)] // ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(7507 - 7396) + chr(50), 8))
CwVNnZBDjjpi = [[ehT0Px3KOsy9(chr(235 - 187) + chr(1613 - 1502) + chr(0b110000), 8), ehT0Px3KOsy9(chr(782 - 734) + '\157' + chr(0b110000), 8)], [o7e_EUWc8mDu, ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(0b100011 + 0o15), 8)], [ehT0Px3KOsy9(chr(0b110000) + chr(0b1011011 + 0o24) + '\060', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000110 + 0o51) + chr(0b110000), 8)]]
else:
KT3RMXlE4Iwi = ehT0Px3KOsy9('\x30' + '\157' + '\x32', 8) * (zk_9FDxvu_Qq[ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 8)] // ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + chr(0b10110 + 0o34), 8))
coPLmRNet_pb = IDJ2eXGCBCDu.cond(IDJ2eXGCBCDu.equal(qypPRW8fq869(vXoupepMtCXU)[ehT0Px3KOsy9(chr(408 - 360) + chr(11243 - 11132) + '\062', 8)], ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001), 8)), lambda : IDJ2eXGCBCDu.constant(ehT0Px3KOsy9(chr(462 - 414) + chr(7211 - 7100) + chr(0b110000), 8)), lambda : IDJ2eXGCBCDu.constant(ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + chr(50), 8) * (zk_9FDxvu_Qq[ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8)] // ehT0Px3KOsy9(chr(0b110000) + chr(0b10 + 0o155) + chr(0b110010), 8))))
o7e_EUWc8mDu = ehT0Px3KOsy9(chr(1407 - 1359) + '\x6f' + chr(48), 8) if mPvZu54qNVig[ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b110110 + 0o71) + chr(1721 - 1671), 8)] == ehT0Px3KOsy9(chr(48) + '\157' + '\061', 8) else coPLmRNet_pb
CwVNnZBDjjpi = [[ehT0Px3KOsy9(chr(48) + '\157' + '\x30', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(917 - 869), 8)], [KT3RMXlE4Iwi, ehT0Px3KOsy9(chr(0b110000) + chr(5509 - 5398) + chr(1112 - 1064), 8)], [o7e_EUWc8mDu, ehT0Px3KOsy9(chr(48) + chr(111) + '\060', 8)], [ehT0Px3KOsy9('\060' + chr(111) + '\x30', 8), ehT0Px3KOsy9('\060' + chr(0b1100001 + 0o16) + chr(640 - 592), 8)]]
vXoupepMtCXU = IDJ2eXGCBCDu.pad(vXoupepMtCXU, CwVNnZBDjjpi)
xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'=\x98[M\xd6\xc9\x92\x85\xcf'), chr(100) + chr(101) + '\x63' + chr(0b101011 + 0o104) + chr(100) + chr(101))(chr(0b101001 + 0o114) + chr(116) + chr(9183 - 9081) + chr(45) + chr(56)))([mPvZu54qNVig[ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8)], None, None, mPvZu54qNVig[ehT0Px3KOsy9(chr(1676 - 1628) + '\x6f' + chr(0b100001 + 0o22), 8)]])
TFLseEYASEKG = xafqLlk3kkUe(SXOLrMavuUCe(b'\x18\xbcc[\xe1'), chr(0b1100100) + chr(0b1000000 + 0o45) + '\x63' + '\157' + chr(0b1011100 + 0o10) + '\x65')(chr(13654 - 13537) + chr(116) + chr(9722 - 9620) + chr(0b11100 + 0o21) + chr(0b101011 + 0o15))
return xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'>\x92@~'), '\x64' + chr(0b1100101) + chr(0b1010010 + 0o21) + '\157' + '\144' + chr(0b11001 + 0o114))(chr(593 - 476) + '\164' + '\x66' + '\055' + '\x38'))(vXoupepMtCXU, zk_9FDxvu_Qq, JRhBz5W8YzDa, TFLseEYASEKG, strides=r8knJmMTTKwv)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_block_downsample
|
def conv_block_downsample(x,
kernel,
strides,
padding,
separability=0,
name=None,
reuse=None):
"""Implements a downwards-striding conv block, like Xception exit flow."""
with tf.variable_scope(
name, default_name="conv_block_downsample", values=[x], reuse=reuse):
hidden_size = int(x.get_shape()[-1])
res = conv_block(
x,
int(1.25 * hidden_size), [((1, 1), kernel)],
padding=padding,
strides=strides,
name="res_conv")
x = subseparable_conv_block(
x,
hidden_size, [((1, 1), kernel)],
padding=padding,
separability=separability,
name="conv0")
x = subseparable_conv_block(
x,
int(1.25 * hidden_size), [((1, 1), kernel)],
padding=padding,
separability=separability,
name="conv1")
x = pool(x, kernel, "MAX", padding, strides=strides)
x += res
x = subseparable_conv_block(
x,
2 * hidden_size, [((1, 1), kernel)],
first_relu=False,
padding=padding,
separability=separability,
name="conv2")
x = subseparable_conv_block(
x,
int(2.5 * hidden_size), [((1, 1), kernel)],
padding=padding,
separability=separability,
name="conv3")
return x
|
python
|
def conv_block_downsample(x,
kernel,
strides,
padding,
separability=0,
name=None,
reuse=None):
"""Implements a downwards-striding conv block, like Xception exit flow."""
with tf.variable_scope(
name, default_name="conv_block_downsample", values=[x], reuse=reuse):
hidden_size = int(x.get_shape()[-1])
res = conv_block(
x,
int(1.25 * hidden_size), [((1, 1), kernel)],
padding=padding,
strides=strides,
name="res_conv")
x = subseparable_conv_block(
x,
hidden_size, [((1, 1), kernel)],
padding=padding,
separability=separability,
name="conv0")
x = subseparable_conv_block(
x,
int(1.25 * hidden_size), [((1, 1), kernel)],
padding=padding,
separability=separability,
name="conv1")
x = pool(x, kernel, "MAX", padding, strides=strides)
x += res
x = subseparable_conv_block(
x,
2 * hidden_size, [((1, 1), kernel)],
first_relu=False,
padding=padding,
separability=separability,
name="conv2")
x = subseparable_conv_block(
x,
int(2.5 * hidden_size), [((1, 1), kernel)],
padding=padding,
separability=separability,
name="conv3")
return x
|
[
"def",
"conv_block_downsample",
"(",
"x",
",",
"kernel",
",",
"strides",
",",
"padding",
",",
"separability",
"=",
"0",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"conv_block_downsample\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"hidden_size",
"=",
"int",
"(",
"x",
".",
"get_shape",
"(",
")",
"[",
"-",
"1",
"]",
")",
"res",
"=",
"conv_block",
"(",
"x",
",",
"int",
"(",
"1.25",
"*",
"hidden_size",
")",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"padding",
"=",
"padding",
",",
"strides",
"=",
"strides",
",",
"name",
"=",
"\"res_conv\"",
")",
"x",
"=",
"subseparable_conv_block",
"(",
"x",
",",
"hidden_size",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"padding",
"=",
"padding",
",",
"separability",
"=",
"separability",
",",
"name",
"=",
"\"conv0\"",
")",
"x",
"=",
"subseparable_conv_block",
"(",
"x",
",",
"int",
"(",
"1.25",
"*",
"hidden_size",
")",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"padding",
"=",
"padding",
",",
"separability",
"=",
"separability",
",",
"name",
"=",
"\"conv1\"",
")",
"x",
"=",
"pool",
"(",
"x",
",",
"kernel",
",",
"\"MAX\"",
",",
"padding",
",",
"strides",
"=",
"strides",
")",
"x",
"+=",
"res",
"x",
"=",
"subseparable_conv_block",
"(",
"x",
",",
"2",
"*",
"hidden_size",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"first_relu",
"=",
"False",
",",
"padding",
"=",
"padding",
",",
"separability",
"=",
"separability",
",",
"name",
"=",
"\"conv2\"",
")",
"x",
"=",
"subseparable_conv_block",
"(",
"x",
",",
"int",
"(",
"2.5",
"*",
"hidden_size",
")",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"padding",
"=",
"padding",
",",
"separability",
"=",
"separability",
",",
"name",
"=",
"\"conv3\"",
")",
"return",
"x"
] |
Implements a downwards-striding conv block, like Xception exit flow.
|
[
"Implements",
"a",
"downwards",
"-",
"striding",
"conv",
"block",
"like",
"Xception",
"exit",
"flow",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1083-L1130
|
train
|
Implements a downwards - striding conv block like Xception exit flow.
|
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,GXwwnD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_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(0b1 + 0o156) + '\062' + '\061' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1407 - 1359) + chr(0b100001 + 0o116) + chr(49) + chr(0b100001 + 0o26) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(801 - 747) + chr(0b10111 + 0o33), 0o10), ehT0Px3KOsy9(chr(1692 - 1644) + chr(4101 - 3990) + chr(0b110010 + 0o1) + chr(50) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(946 - 893) + chr(0b101001 + 0o16), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101000 + 0o7) + chr(0b110011) + chr(1005 - 956) + chr(0b11101 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10101 + 0o34) + '\x34' + chr(804 - 754), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110110) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1459 - 1410) + chr(55) + chr(482 - 433), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\061' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2506 - 2455) + chr(0b11011 + 0o25) + chr(1499 - 1448), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + chr(1384 - 1334) + '\066' + chr(0b110101), 11877 - 11869), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(50) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(0b10101 + 0o132) + '\x32' + '\x33' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1100011 + 0o14) + chr(0b100100 + 0o22) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1281 - 1231) + chr(0b110000 + 0o1) + chr(668 - 619), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110110) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x32' + chr(0b110110), 17359 - 17351), ehT0Px3KOsy9(chr(0b110000) + chr(5311 - 5200) + chr(236 - 185) + chr(0b1110 + 0o46) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(2322 - 2267) + chr(0b1100 + 0o52), 29970 - 29962), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + '\x35' + '\x37', 8), ehT0Px3KOsy9(chr(343 - 295) + '\157' + chr(0b10100 + 0o36) + chr(54) + '\067', 34662 - 34654), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6299 - 6188) + chr(0b110101) + chr(1533 - 1480), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\x37' + chr(2196 - 2148), 28876 - 28868), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(2785 - 2674) + '\063' + chr(0b110111) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(226 - 115) + '\062' + chr(911 - 862) + chr(0b11 + 0o64), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b10 + 0o61) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b1111 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + '\062' + '\064' + '\064', 6243 - 6235), ehT0Px3KOsy9(chr(1840 - 1792) + chr(0b1101111) + '\062' + '\x37' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(0b11001 + 0o35) + chr(0b110011), 61941 - 61933), ehT0Px3KOsy9(chr(2170 - 2122) + '\157' + chr(51) + chr(1813 - 1764) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(51) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\066' + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(97 - 46) + chr(50) + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + chr(8273 - 8162) + '\066' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\067' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\x35' + chr(48), 9896 - 9888), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(54) + '\065', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1357 - 1309) + chr(11105 - 10994) + chr(980 - 927) + '\x30', 56071 - 56063)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4'), chr(100) + chr(0b100 + 0o141) + '\x63' + chr(0b1010000 + 0o37) + chr(2348 - 2248) + chr(5968 - 5867))(chr(9049 - 8932) + chr(0b110001 + 0o103) + '\146' + chr(1537 - 1492) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ydtBe0PmyCne(OeWW0F1dBPRQ, iaILEoszmqXb, r8knJmMTTKwv, TFLseEYASEKG, hWr_AfvsCMfQ=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101011 + 0o5), ord("\x08")), AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\x1a@\xbfN\xab\x0e\xd4&?\xa0\xda$\xf8'), chr(0b1100100) + chr(0b1100101) + chr(8164 - 8065) + chr(0b1101111) + chr(1068 - 968) + chr(2356 - 2255))(chr(117) + '\164' + '\146' + chr(45) + chr(0b111000)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xe9\x14\\\xa0p\xab\x0e\xde\x1a'\x9c\xd1;\xea[\xfaV\xfb\x91RJ"), chr(100) + '\x65' + '\143' + '\x6f' + chr(0b1100100) + chr(324 - 223))(chr(0b1000101 + 0o60) + chr(0b1110100) + chr(3064 - 2962) + '\x2d' + chr(56)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
qzoyXN3kdhDL = ehT0Px3KOsy9(OeWW0F1dBPRQ.get_shape()[-ehT0Px3KOsy9(chr(395 - 347) + chr(111) + chr(49), 0b1000)])
MsbwfslwLjRO = UPhJ6DlDf_h1(OeWW0F1dBPRQ, ehT0Px3KOsy9(1.25 * qzoyXN3kdhDL), [((ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101000 + 0o11), 8), ehT0Px3KOsy9('\x30' + chr(0b101110 + 0o101) + chr(0b11010 + 0o27), 8)), iaILEoszmqXb)], padding=TFLseEYASEKG, strides=r8knJmMTTKwv, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\x1eA\x89L\xa6\x0c\xc7'), chr(100) + '\x65' + chr(0b1100011) + chr(0b1101111) + '\x64' + '\x65')(chr(0b1011110 + 0o27) + '\164' + chr(102) + chr(0b101101) + chr(0b111000)))
OeWW0F1dBPRQ = L0bIidvPuuXV(OeWW0F1dBPRQ, qzoyXN3kdhDL, [((ehT0Px3KOsy9(chr(266 - 218) + '\x6f' + '\x31', 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + '\061', 8)), iaILEoszmqXb)], padding=TFLseEYASEKG, separability=hWr_AfvsCMfQ, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x14\\\xa0\x1f'), chr(3635 - 3535) + '\145' + chr(5116 - 5017) + chr(8497 - 8386) + chr(0b1100100) + chr(0b1100101))(chr(9527 - 9410) + chr(116) + '\x66' + chr(1195 - 1150) + chr(0b111000)))
OeWW0F1dBPRQ = L0bIidvPuuXV(OeWW0F1dBPRQ, ehT0Px3KOsy9(1.25 * qzoyXN3kdhDL), [((ehT0Px3KOsy9('\x30' + '\x6f' + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8)), iaILEoszmqXb)], padding=TFLseEYASEKG, separability=hWr_AfvsCMfQ, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x14\\\xa0\x1e'), chr(1251 - 1151) + chr(101) + chr(0b1100011) + chr(0b1000101 + 0o52) + chr(991 - 891) + chr(0b110100 + 0o61))(chr(11769 - 11652) + chr(116) + chr(552 - 450) + '\055' + chr(0b10110 + 0o42)))
OeWW0F1dBPRQ = qsPHwJ5jT7iz(OeWW0F1dBPRQ, iaILEoszmqXb, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7:j'), chr(0b10110 + 0o116) + '\145' + chr(99) + '\x6f' + chr(8429 - 8329) + '\x65')('\x75' + '\x74' + '\x66' + '\055' + chr(0b111000)), TFLseEYASEKG, strides=r8knJmMTTKwv)
OeWW0F1dBPRQ += MsbwfslwLjRO
OeWW0F1dBPRQ = L0bIidvPuuXV(OeWW0F1dBPRQ, ehT0Px3KOsy9(chr(1587 - 1539) + chr(0b1101111) + '\x32', 0o10) * qzoyXN3kdhDL, [((ehT0Px3KOsy9('\060' + '\157' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(7683 - 7572) + chr(2337 - 2288), 8)), iaILEoszmqXb)], first_relu=ehT0Px3KOsy9(chr(1633 - 1585) + chr(111) + chr(1958 - 1910), 8), padding=TFLseEYASEKG, separability=hWr_AfvsCMfQ, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x14\\\xa0\x1d'), chr(1097 - 997) + chr(0b1 + 0o144) + chr(99) + chr(0b1 + 0o156) + chr(7441 - 7341) + chr(8087 - 7986))('\165' + chr(116) + chr(0b100101 + 0o101) + '\055' + chr(56)))
OeWW0F1dBPRQ = L0bIidvPuuXV(OeWW0F1dBPRQ, ehT0Px3KOsy9(2.5 * qzoyXN3kdhDL), [((ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), 8), ehT0Px3KOsy9(chr(2241 - 2193) + '\157' + '\061', 8)), iaILEoszmqXb)], padding=TFLseEYASEKG, separability=hWr_AfvsCMfQ, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x14\\\xa0\x1c'), chr(0b1110 + 0o126) + '\145' + '\x63' + chr(111) + '\144' + '\145')('\165' + chr(116) + chr(0b1101 + 0o131) + '\055' + '\x38'))
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
get_timing_signal
|
def get_timing_signal(length,
min_timescale=1,
max_timescale=1e4,
num_timescales=16):
"""Create Tensor of sinusoids of different frequencies.
Args:
length: Length of the Tensor to create, i.e. Number of steps.
min_timescale: a float
max_timescale: a float
num_timescales: an int
Returns:
Tensor of shape (length, 2*num_timescales)
"""
positions = to_float(tf.range(length))
log_timescale_increment = (
math.log(max_timescale / min_timescale) / (num_timescales - 1))
inv_timescales = min_timescale * tf.exp(
to_float(tf.range(num_timescales)) * -log_timescale_increment)
scaled_time = tf.expand_dims(positions, 1) * tf.expand_dims(inv_timescales, 0)
return tf.concat([tf.sin(scaled_time), tf.cos(scaled_time)], axis=1)
|
python
|
def get_timing_signal(length,
min_timescale=1,
max_timescale=1e4,
num_timescales=16):
"""Create Tensor of sinusoids of different frequencies.
Args:
length: Length of the Tensor to create, i.e. Number of steps.
min_timescale: a float
max_timescale: a float
num_timescales: an int
Returns:
Tensor of shape (length, 2*num_timescales)
"""
positions = to_float(tf.range(length))
log_timescale_increment = (
math.log(max_timescale / min_timescale) / (num_timescales - 1))
inv_timescales = min_timescale * tf.exp(
to_float(tf.range(num_timescales)) * -log_timescale_increment)
scaled_time = tf.expand_dims(positions, 1) * tf.expand_dims(inv_timescales, 0)
return tf.concat([tf.sin(scaled_time), tf.cos(scaled_time)], axis=1)
|
[
"def",
"get_timing_signal",
"(",
"length",
",",
"min_timescale",
"=",
"1",
",",
"max_timescale",
"=",
"1e4",
",",
"num_timescales",
"=",
"16",
")",
":",
"positions",
"=",
"to_float",
"(",
"tf",
".",
"range",
"(",
"length",
")",
")",
"log_timescale_increment",
"=",
"(",
"math",
".",
"log",
"(",
"max_timescale",
"/",
"min_timescale",
")",
"/",
"(",
"num_timescales",
"-",
"1",
")",
")",
"inv_timescales",
"=",
"min_timescale",
"*",
"tf",
".",
"exp",
"(",
"to_float",
"(",
"tf",
".",
"range",
"(",
"num_timescales",
")",
")",
"*",
"-",
"log_timescale_increment",
")",
"scaled_time",
"=",
"tf",
".",
"expand_dims",
"(",
"positions",
",",
"1",
")",
"*",
"tf",
".",
"expand_dims",
"(",
"inv_timescales",
",",
"0",
")",
"return",
"tf",
".",
"concat",
"(",
"[",
"tf",
".",
"sin",
"(",
"scaled_time",
")",
",",
"tf",
".",
"cos",
"(",
"scaled_time",
")",
"]",
",",
"axis",
"=",
"1",
")"
] |
Create Tensor of sinusoids of different frequencies.
Args:
length: Length of the Tensor to create, i.e. Number of steps.
min_timescale: a float
max_timescale: a float
num_timescales: an int
Returns:
Tensor of shape (length, 2*num_timescales)
|
[
"Create",
"Tensor",
"of",
"sinusoids",
"of",
"different",
"frequencies",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1133-L1154
|
train
|
Create a Tensor of sinusoids of different frequencies.
|
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,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Ujaz9UM0,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(709 - 661) + '\157' + chr(0b11001 + 0o32) + '\x30' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + chr(2108 - 2059) + chr(51) + chr(55), 44468 - 44460), ehT0Px3KOsy9(chr(376 - 328) + chr(0b1101111) + chr(0b110010) + '\x37' + chr(48), 21570 - 21562), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b1000 + 0o55) + chr(0b101010 + 0o15), 0b1000), ehT0Px3KOsy9(chr(1570 - 1522) + '\x6f' + chr(53) + chr(1505 - 1457), 0b1000), ehT0Px3KOsy9(chr(74 - 26) + '\157' + '\x33' + chr(55) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(0b11000 + 0o31) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(54) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9076 - 8965) + '\x32' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(7712 - 7601) + chr(0b110011) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(1434 - 1386) + '\x6f' + chr(0b1110 + 0o43) + '\065' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(380 - 331) + chr(0b110011) + chr(2409 - 2355), 65301 - 65293), ehT0Px3KOsy9('\060' + chr(380 - 269) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(51) + '\x35' + chr(650 - 599), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10000 + 0o43) + '\062' + chr(52), 35380 - 35372), ehT0Px3KOsy9('\060' + chr(11412 - 11301) + chr(54) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(7667 - 7556) + '\061' + chr(0b110010) + chr(0b110 + 0o52), 0b1000), ehT0Px3KOsy9(chr(310 - 262) + '\157' + '\062' + chr(0b110011) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(690 - 641) + '\x36', 27887 - 27879), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1954 - 1904) + chr(55) + chr(52), 0o10), ehT0Px3KOsy9(chr(1086 - 1038) + '\157' + chr(49) + '\x30' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b110111), 16411 - 16403), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110011) + chr(0b10001 + 0o41), 34432 - 34424), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(1668 - 1618) + '\x34' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2251 - 2197), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\066' + '\x30', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b1111 + 0o45) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001 + 0o146) + chr(1639 - 1589) + chr(54) + chr(51), 19009 - 19001), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + chr(0b110001) + '\x32' + '\x34', 44024 - 44016), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b110011) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b11100 + 0o27) + chr(0b110101) + chr(0b10101 + 0o41), 4419 - 4411), ehT0Px3KOsy9('\060' + chr(0b10100 + 0o133) + chr(50) + '\x30' + chr(0b110110), 32984 - 32976), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b11100 + 0o31) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1531 - 1483) + chr(0b1101000 + 0o7) + '\063' + chr(0b110100) + chr(810 - 758), 61902 - 61894), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\x35' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(0b110110) + chr(0b100111 + 0o13), 5717 - 5709), ehT0Px3KOsy9('\x30' + chr(111) + chr(1417 - 1368) + chr(0b100011 + 0o24) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(0b110001) + '\x34' + '\x32', 26884 - 26876), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(679 - 630) + chr(1436 - 1383) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(694 - 641) + chr(0b110001), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\065' + chr(2166 - 2118), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8'), chr(2313 - 2213) + chr(3447 - 3346) + chr(99) + chr(0b1101111) + '\144' + '\x65')(chr(4425 - 4308) + chr(9143 - 9027) + chr(6527 - 6425) + chr(0b101101) + chr(0b1000 + 0o60)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def oKSUwCB7Yfs_(CHAOgk5VCHH_, oBkcbk4shbII=ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\061', ord("\x08")), PypK95RAsTJD=10000.0, OIfnhLMUVPqI=ehT0Px3KOsy9('\x30' + chr(0b1010101 + 0o32) + '\x32' + '\x30', 31641 - 31633)):
JVHDlleapywT = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.range(CHAOgk5VCHH_))
LGACJFiz2yKE = yhiZVkosCjBm.log(PypK95RAsTJD / oBkcbk4shbII) / (OIfnhLMUVPqI - ehT0Px3KOsy9(chr(337 - 289) + chr(111) + chr(49), 8))
qfpV8OgNk5MA = oBkcbk4shbII * IDJ2eXGCBCDu.exp(ZUL3kHBGU8Uu(IDJ2eXGCBCDu.range(OIfnhLMUVPqI)) * -LGACJFiz2yKE)
Du9ko_fYsEXa = IDJ2eXGCBCDu.expand_dims(JVHDlleapywT, ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + chr(0b1100 + 0o45), 8)) * IDJ2eXGCBCDu.expand_dims(qfpV8OgNk5MA, ehT0Px3KOsy9(chr(2259 - 2211) + '\157' + chr(1146 - 1098), 0o10))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa50\xd6\x8cI\x8f'), '\144' + '\x65' + chr(99) + chr(567 - 456) + chr(0b110010 + 0o62) + '\145')('\165' + chr(116) + chr(6819 - 6717) + chr(1183 - 1138) + '\x38'))([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb56\xd6'), chr(0b10 + 0o142) + chr(0b1010111 + 0o16) + '\143' + chr(0b100010 + 0o115) + chr(0b1011110 + 0o6) + '\x65')(chr(0b1110101) + '\x74' + chr(0b1100110) + '\x2d' + '\x38'))(Du9ko_fYsEXa), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa50\xcb'), '\144' + chr(0b110100 + 0o61) + chr(0b1100011) + chr(0b11110 + 0o121) + chr(100) + chr(0b1100101 + 0o0))(chr(8160 - 8043) + chr(116) + chr(0b1100110) + '\055' + chr(0b1010 + 0o56)))(Du9ko_fYsEXa)], axis=ehT0Px3KOsy9(chr(48) + chr(0b1100101 + 0o12) + '\x31', 8))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
add_timing_signal
|
def add_timing_signal(x, min_timescale=1, max_timescale=1e4, num_timescales=16):
"""Adds a bunch of sinusoids of different frequencies to a Tensor.
This allows attention to learn to use absolute and relative positions.
The timing signal should be added to some precursor of both the source
and the target of the attention.
The use of relative position is possible because sin(x+y) and cos(x+y) can be
expressed in terms of y, sin(x) and cos(x).
In particular, we use a geometric sequence of timescales starting with
min_timescale and ending with max_timescale. For each timescale, we
generate the two sinusoidal signals sin(timestep/timescale) and
cos(timestep/timescale). All of these sinusoids are concatenated in
the depth dimension, padded with zeros to be the same depth as the input,
and added into input.
Args:
x: a Tensor with shape [?, length, ?, depth]
min_timescale: a float
max_timescale: a float
num_timescales: an int <= depth/2
Returns:
a Tensor the same shape as x.
"""
length = shape_list(x)[1]
depth = shape_list(x)[3]
signal = get_timing_signal(length, min_timescale, max_timescale,
num_timescales)
padded_signal = tf.pad(signal, [[0, 0], [0, depth - 2 * num_timescales]])
return x + tf.reshape(padded_signal, [1, length, 1, depth])
|
python
|
def add_timing_signal(x, min_timescale=1, max_timescale=1e4, num_timescales=16):
"""Adds a bunch of sinusoids of different frequencies to a Tensor.
This allows attention to learn to use absolute and relative positions.
The timing signal should be added to some precursor of both the source
and the target of the attention.
The use of relative position is possible because sin(x+y) and cos(x+y) can be
expressed in terms of y, sin(x) and cos(x).
In particular, we use a geometric sequence of timescales starting with
min_timescale and ending with max_timescale. For each timescale, we
generate the two sinusoidal signals sin(timestep/timescale) and
cos(timestep/timescale). All of these sinusoids are concatenated in
the depth dimension, padded with zeros to be the same depth as the input,
and added into input.
Args:
x: a Tensor with shape [?, length, ?, depth]
min_timescale: a float
max_timescale: a float
num_timescales: an int <= depth/2
Returns:
a Tensor the same shape as x.
"""
length = shape_list(x)[1]
depth = shape_list(x)[3]
signal = get_timing_signal(length, min_timescale, max_timescale,
num_timescales)
padded_signal = tf.pad(signal, [[0, 0], [0, depth - 2 * num_timescales]])
return x + tf.reshape(padded_signal, [1, length, 1, depth])
|
[
"def",
"add_timing_signal",
"(",
"x",
",",
"min_timescale",
"=",
"1",
",",
"max_timescale",
"=",
"1e4",
",",
"num_timescales",
"=",
"16",
")",
":",
"length",
"=",
"shape_list",
"(",
"x",
")",
"[",
"1",
"]",
"depth",
"=",
"shape_list",
"(",
"x",
")",
"[",
"3",
"]",
"signal",
"=",
"get_timing_signal",
"(",
"length",
",",
"min_timescale",
",",
"max_timescale",
",",
"num_timescales",
")",
"padded_signal",
"=",
"tf",
".",
"pad",
"(",
"signal",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"depth",
"-",
"2",
"*",
"num_timescales",
"]",
"]",
")",
"return",
"x",
"+",
"tf",
".",
"reshape",
"(",
"padded_signal",
",",
"[",
"1",
",",
"length",
",",
"1",
",",
"depth",
"]",
")"
] |
Adds a bunch of sinusoids of different frequencies to a Tensor.
This allows attention to learn to use absolute and relative positions.
The timing signal should be added to some precursor of both the source
and the target of the attention.
The use of relative position is possible because sin(x+y) and cos(x+y) can be
expressed in terms of y, sin(x) and cos(x).
In particular, we use a geometric sequence of timescales starting with
min_timescale and ending with max_timescale. For each timescale, we
generate the two sinusoidal signals sin(timestep/timescale) and
cos(timestep/timescale). All of these sinusoids are concatenated in
the depth dimension, padded with zeros to be the same depth as the input,
and added into input.
Args:
x: a Tensor with shape [?, length, ?, depth]
min_timescale: a float
max_timescale: a float
num_timescales: an int <= depth/2
Returns:
a Tensor the same shape as x.
|
[
"Adds",
"a",
"bunch",
"of",
"sinusoids",
"of",
"different",
"frequencies",
"to",
"a",
"Tensor",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1157-L1188
|
train
|
Adds a timing signal to a Tensor x.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf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1zTRfSmY,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' + '\x6f' + '\x32' + chr(2445 - 2394) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(54) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1725 - 1676) + chr(52) + chr(51), 0b1000), ehT0Px3KOsy9(chr(123 - 75) + chr(0b1101111) + chr(55) + chr(50), 0o10), ehT0Px3KOsy9(chr(2215 - 2167) + '\x6f' + chr(2148 - 2097) + '\064' + chr(49), 30673 - 30665), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1660 - 1610) + chr(202 - 150) + chr(49), 52469 - 52461), ehT0Px3KOsy9(chr(1676 - 1628) + chr(0b1100001 + 0o16) + '\x33' + '\064' + chr(53), 5009 - 5001), ehT0Px3KOsy9(chr(1289 - 1241) + chr(111) + chr(0b110011) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010001 + 0o36) + '\061' + '\062' + chr(0b10011 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + '\x32' + '\067' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(581 - 532) + '\060' + chr(556 - 505), 17589 - 17581), ehT0Px3KOsy9('\x30' + chr(0b1011000 + 0o27) + chr(0b110011) + '\x34' + chr(0b100111 + 0o11), 63608 - 63600), ehT0Px3KOsy9(chr(1954 - 1906) + chr(0b1000 + 0o147) + '\063' + chr(162 - 109) + chr(2068 - 2017), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(458 - 404) + chr(1406 - 1353), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b11111 + 0o27) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(9627 - 9516) + chr(0b110101) + '\065', 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + '\x33' + chr(2271 - 2222) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1796 - 1745) + '\x32' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\x34' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + '\x31' + chr(53) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(288 - 177) + chr(2241 - 2190) + chr(52) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(7491 - 7380) + chr(0b11110 + 0o25) + '\x34' + chr(0b110111), 25443 - 25435), ehT0Px3KOsy9('\060' + chr(0b1101101 + 0o2) + chr(0b110011) + '\x37', 32694 - 32686), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\067' + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + chr(439 - 390) + chr(0b10101 + 0o37) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + chr(0b101010 + 0o10), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(0b11111 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(987 - 939) + chr(0b101101 + 0o102) + '\x31' + chr(0b100 + 0o63) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + chr(2164 - 2115) + '\066', 0b1000), ehT0Px3KOsy9(chr(94 - 46) + chr(0b1101111) + chr(49) + '\x35' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(411 - 356) + chr(501 - 449), 40626 - 40618), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b110101) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(1557 - 1506) + chr(1329 - 1279) + chr(0b1010 + 0o54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(5817 - 5706) + '\x33' + '\063' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1254 - 1206) + chr(10029 - 9918) + '\062' + chr(1938 - 1885), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10110 + 0o131) + chr(50) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11000 + 0o31) + chr(0b110010) + chr(0b1111 + 0o43), 49350 - 49342), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\067' + chr(2152 - 2102), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(405 - 352) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(0b110010) + chr(0b1 + 0o66), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b110101) + chr(0b100011 + 0o15), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3'), chr(5129 - 5029) + '\145' + chr(5314 - 5215) + chr(9228 - 9117) + '\144' + chr(150 - 49))(chr(0b101011 + 0o112) + chr(0b1011101 + 0o27) + '\x66' + chr(0b111 + 0o46) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def NjkvoXeKwuWV(OeWW0F1dBPRQ, oBkcbk4shbII=ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(1150 - 1039) + '\061', ord("\x08")), PypK95RAsTJD=10000.0, OIfnhLMUVPqI=ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b101 + 0o53), 62506 - 62498)):
CHAOgk5VCHH_ = qypPRW8fq869(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(980 - 932) + chr(7154 - 7043) + chr(0b100010 + 0o17), 8)]
UEys4_lSwsID = qypPRW8fq869(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011), 0o10)]
ZDvW02DvHNUc = oKSUwCB7Yfs_(CHAOgk5VCHH_, oBkcbk4shbII, PypK95RAsTJD, OIfnhLMUVPqI)
v438qD38uxYy = IDJ2eXGCBCDu.pad(ZDvW02DvHNUc, [[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1029 - 981), 8)], [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101000 + 0o10), 8), UEys4_lSwsID - ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062', 8) * OIfnhLMUVPqI]])
return OeWW0F1dBPRQ + xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xefP\x10R\x80\xd1\x80'), '\144' + chr(101) + '\x63' + chr(0b1101111) + chr(100) + chr(101))(chr(965 - 848) + chr(0b100 + 0o160) + '\146' + chr(779 - 734) + chr(56)))(v438qD38uxYy, [ehT0Px3KOsy9('\060' + chr(2762 - 2651) + '\061', 8), CHAOgk5VCHH_, ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061', 8), UEys4_lSwsID])
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
mask_from_embedding
|
def mask_from_embedding(emb):
"""Input embeddings -> padding mask.
We have hacked symbol_modality to return all-zero embeddings for padding.
Returns a mask with 0.0 in the padding positions and 1.0 elsewhere.
Args:
emb: a Tensor with shape [batch, width, height, depth].
Returns:
a 0.0/1.0 Tensor with shape [batch, width, height, 1].
"""
return weights_nonzero(tf.reduce_sum(tf.abs(emb), axis=3, keepdims=True))
|
python
|
def mask_from_embedding(emb):
"""Input embeddings -> padding mask.
We have hacked symbol_modality to return all-zero embeddings for padding.
Returns a mask with 0.0 in the padding positions and 1.0 elsewhere.
Args:
emb: a Tensor with shape [batch, width, height, depth].
Returns:
a 0.0/1.0 Tensor with shape [batch, width, height, 1].
"""
return weights_nonzero(tf.reduce_sum(tf.abs(emb), axis=3, keepdims=True))
|
[
"def",
"mask_from_embedding",
"(",
"emb",
")",
":",
"return",
"weights_nonzero",
"(",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"abs",
"(",
"emb",
")",
",",
"axis",
"=",
"3",
",",
"keepdims",
"=",
"True",
")",
")"
] |
Input embeddings -> padding mask.
We have hacked symbol_modality to return all-zero embeddings for padding.
Returns a mask with 0.0 in the padding positions and 1.0 elsewhere.
Args:
emb: a Tensor with shape [batch, width, height, depth].
Returns:
a 0.0/1.0 Tensor with shape [batch, width, height, 1].
|
[
"Input",
"embeddings",
"-",
">",
"padding",
"mask",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1191-L1202
|
train
|
Input embeddings -> padding mask.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQ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CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b111111 + 0o60) + chr(0b1101 + 0o45) + '\x32' + '\063', 13724 - 13716), ehT0Px3KOsy9('\060' + chr(1269 - 1158) + '\x32' + chr(1521 - 1470) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(846 - 794), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + chr(0b10011 + 0o37) + chr(0b1100 + 0o47) + chr(52), 29955 - 29947), ehT0Px3KOsy9('\x30' + chr(10909 - 10798) + chr(0b110001 + 0o0) + '\063' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1011 + 0o144) + '\063' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101010 + 0o5) + '\061' + chr(216 - 167), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111101 + 0o62) + '\066' + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(2557 - 2506) + '\067' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(3743 - 3632) + chr(978 - 928) + '\067' + chr(53), 29734 - 29726), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b100000 + 0o117) + '\061' + '\x36' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(4945 - 4834) + '\x33' + chr(55) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(1365 - 1315) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(0b110000 + 0o3) + chr(53) + chr(0b11011 + 0o33), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11001 + 0o31) + chr(0b110110) + chr(3018 - 2963), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110 + 0o60) + chr(376 - 322), 0b1000), ehT0Px3KOsy9(chr(2224 - 2176) + chr(0b1010 + 0o145) + '\062' + chr(0b11101 + 0o31) + chr(1578 - 1529), 59421 - 59413), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(613 - 563), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\063' + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x30' + chr(0b101001 + 0o10), 61717 - 61709), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(648 - 599) + '\x30' + chr(0b110010 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(2294 - 2246) + '\x6f' + '\062' + '\x32' + chr(0b11111 + 0o22), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2266 - 2215) + '\062' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1041 - 993) + '\157' + '\x32' + chr(0b11101 + 0o24) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x36' + '\063', 2112 - 2104), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + '\x31' + '\x33' + '\061', 0b1000), ehT0Px3KOsy9(chr(805 - 757) + chr(0b1101111) + chr(53) + chr(297 - 249), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10111 + 0o34) + chr(0b110001) + chr(0b1100 + 0o47), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000111 + 0o50) + chr(1490 - 1441) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101 + 0o54) + chr(0b10110 + 0o37) + chr(0b110010), 4231 - 4223), ehT0Px3KOsy9(chr(0b110000) + chr(8713 - 8602) + '\x32' + chr(54) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(109 - 59) + chr(0b11010 + 0o27), 8), ehT0Px3KOsy9(chr(355 - 307) + chr(5910 - 5799) + chr(0b11010 + 0o30) + '\x36' + chr(48), 40129 - 40121), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110100) + '\x32', 60520 - 60512), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(48) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(51) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(2872 - 2818) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + '\062' + chr(0b1001 + 0o54) + chr(0b101010 + 0o10), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1126 - 1078) + chr(0b1000111 + 0o50) + '\065' + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(111) + chr(6342 - 6242) + '\x65')(chr(3865 - 3748) + chr(0b110101 + 0o77) + chr(102) + '\055' + chr(0b10110 + 0o42)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def _9bVYIdQDAOg(Jm7YCQYx8Wnq):
return aMdemxOfy8Ik(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe1\xfeh\xe9;}VD\x8fY'), '\144' + chr(0b1000010 + 0o43) + chr(9154 - 9055) + chr(111) + chr(0b1001 + 0o133) + chr(0b1100101))(chr(0b1110101) + chr(12134 - 12018) + '\146' + chr(0b101101) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\xf9\x7f'), chr(0b1100100) + '\145' + chr(0b1010 + 0o131) + '\157' + '\x64' + chr(6541 - 6440))(chr(0b1011111 + 0o26) + chr(0b1101010 + 0o12) + chr(102) + chr(45) + '\x38'))(Jm7YCQYx8Wnq), axis=ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + '\063', ord("\x08")), keepdims=ehT0Px3KOsy9('\060' + chr(0b1011110 + 0o21) + '\x31', ord("\x08"))))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
length_from_embedding
|
def length_from_embedding(emb):
"""Compute the length of each sequence in the batch.
Args:
emb: a sequence embedding Tensor with shape [batch, max_time, 1, depth].
Returns:
a Tensor with shape [batch].
"""
return tf.cast(tf.reduce_sum(mask_from_embedding(emb), [1, 2, 3]), tf.int32)
|
python
|
def length_from_embedding(emb):
"""Compute the length of each sequence in the batch.
Args:
emb: a sequence embedding Tensor with shape [batch, max_time, 1, depth].
Returns:
a Tensor with shape [batch].
"""
return tf.cast(tf.reduce_sum(mask_from_embedding(emb), [1, 2, 3]), tf.int32)
|
[
"def",
"length_from_embedding",
"(",
"emb",
")",
":",
"return",
"tf",
".",
"cast",
"(",
"tf",
".",
"reduce_sum",
"(",
"mask_from_embedding",
"(",
"emb",
")",
",",
"[",
"1",
",",
"2",
",",
"3",
"]",
")",
",",
"tf",
".",
"int32",
")"
] |
Compute the length of each sequence in the batch.
Args:
emb: a sequence embedding Tensor with shape [batch, max_time, 1, depth].
Returns:
a Tensor with shape [batch].
|
[
"Compute",
"the",
"length",
"of",
"each",
"sequence",
"in",
"the",
"batch",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.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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(0b100111 + 0o14) + chr(242 - 194) + chr(0b110000), 27615 - 27607), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(0b10110 + 0o33) + chr(0b10101 + 0o41) + '\062', 9147 - 9139), ehT0Px3KOsy9(chr(560 - 512) + '\157' + chr(49) + chr(1949 - 1901) + chr(54), 45527 - 45519), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000 + 0o2) + chr(0b101 + 0o53) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10947 - 10836) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1997 - 1949) + chr(637 - 526) + '\061' + chr(49) + chr(0b110101), 6681 - 6673), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\066' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(1318 - 1207) + '\067' + chr(1342 - 1288), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + '\x31' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(1111 - 1060) + chr(0b100100 + 0o23) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(9319 - 9208) + chr(55) + chr(1675 - 1624), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110101) + chr(0b110100), 7283 - 7275), ehT0Px3KOsy9(chr(59 - 11) + chr(0b1001000 + 0o47) + chr(49) + chr(2632 - 2577) + '\067', 41640 - 41632), ehT0Px3KOsy9(chr(0b110000) + chr(5248 - 5137) + '\x32' + chr(50) + chr(1916 - 1867), 15684 - 15676), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001 + 0o0) + '\x35' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(0b110001) + '\066' + chr(703 - 655), 0o10), ehT0Px3KOsy9(chr(1936 - 1888) + '\x6f' + chr(0b110010) + '\061' + '\064', 57472 - 57464), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b11100 + 0o27) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(0b110001) + chr(0b110111) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11110 + 0o27) + chr(53), 12251 - 12243), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100100 + 0o13) + chr(0b1000 + 0o53) + '\061' + '\x32', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(49) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(2939 - 2828) + chr(0b11000 + 0o33) + chr(0b101001 + 0o13) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(11941 - 11830) + '\061' + '\x36' + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(51) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(652 - 602) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\066' + chr(0b110010), 29708 - 29700), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b101011 + 0o7) + chr(0b100111 + 0o11), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b11110 + 0o30), 48951 - 48943), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110011) + '\x34', 48831 - 48823), ehT0Px3KOsy9(chr(807 - 759) + '\157' + chr(0b110001) + chr(636 - 584) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b1110 + 0o43) + chr(0b100101 + 0o21), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100 + 0o143) + '\x32' + chr(0b110100) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1001100 + 0o43) + '\061' + chr(0b110111) + chr(0b110011), 30600 - 30592), ehT0Px3KOsy9('\060' + chr(2995 - 2884) + chr(0b110001) + '\x32' + chr(0b110110), 58723 - 58715), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\x36' + chr(0b10100 + 0o37), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b110010) + chr(0b110011) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(9871 - 9760) + chr(0b11001 + 0o32) + chr(1256 - 1203) + chr(0b110110 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b100000 + 0o23) + '\x34', 8), ehT0Px3KOsy9(chr(1687 - 1639) + '\157' + chr(0b101101 + 0o4) + '\066' + chr(55), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2179 - 2131) + chr(0b1101111) + chr(175 - 122) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xee'), chr(100) + chr(0b101101 + 0o70) + chr(0b10010 + 0o121) + '\157' + chr(0b111001 + 0o53) + chr(0b10110 + 0o117))('\x75' + chr(116) + chr(0b101111 + 0o67) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def nLLrHbia6NVY(Jm7YCQYx8Wnq):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3\x135\xf0'), chr(0b10000 + 0o124) + chr(3842 - 3741) + '\x63' + chr(0b110101 + 0o72) + '\144' + chr(101))('\x75' + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x17"\xf1a(\xafM}\x94'), chr(100) + chr(0b110111 + 0o56) + '\x63' + chr(118 - 7) + chr(0b101100 + 0o70) + chr(7606 - 7505))(chr(3453 - 3336) + chr(116) + chr(0b1100110) + chr(45) + '\x38'))(_9bVYIdQDAOg(Jm7YCQYx8Wnq), [ehT0Px3KOsy9(chr(2002 - 1954) + chr(7563 - 7452) + chr(0b110001), 60412 - 60404), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062', 8), ehT0Px3KOsy9(chr(0b110000) + chr(9536 - 9425) + chr(0b100111 + 0o14), 0b1000)]), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9\x1c2\xb70'), chr(0b110011 + 0o61) + chr(0b11010 + 0o113) + chr(99) + chr(4633 - 4522) + chr(100) + chr(0b1000110 + 0o37))('\x75' + '\x74' + chr(7585 - 7483) + chr(0b101101) + chr(0b111000))))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
relu_density_logit
|
def relu_density_logit(x, reduce_dims):
"""logit(density(x)).
Useful for histograms.
Args:
x: a Tensor, typically the output of tf.relu
reduce_dims: a list of dimensions
Returns:
a Tensor
"""
frac = tf.reduce_mean(to_float(x > 0.0), reduce_dims)
scaled = tf.log(frac + math.exp(-10)) - tf.log((1.0 - frac) + math.exp(-10))
return scaled
|
python
|
def relu_density_logit(x, reduce_dims):
"""logit(density(x)).
Useful for histograms.
Args:
x: a Tensor, typically the output of tf.relu
reduce_dims: a list of dimensions
Returns:
a Tensor
"""
frac = tf.reduce_mean(to_float(x > 0.0), reduce_dims)
scaled = tf.log(frac + math.exp(-10)) - tf.log((1.0 - frac) + math.exp(-10))
return scaled
|
[
"def",
"relu_density_logit",
"(",
"x",
",",
"reduce_dims",
")",
":",
"frac",
"=",
"tf",
".",
"reduce_mean",
"(",
"to_float",
"(",
"x",
">",
"0.0",
")",
",",
"reduce_dims",
")",
"scaled",
"=",
"tf",
".",
"log",
"(",
"frac",
"+",
"math",
".",
"exp",
"(",
"-",
"10",
")",
")",
"-",
"tf",
".",
"log",
"(",
"(",
"1.0",
"-",
"frac",
")",
"+",
"math",
".",
"exp",
"(",
"-",
"10",
")",
")",
"return",
"scaled"
] |
logit(density(x)).
Useful for histograms.
Args:
x: a Tensor, typically the output of tf.relu
reduce_dims: a list of dimensions
Returns:
a Tensor
|
[
"logit",
"(",
"density",
"(",
"x",
"))",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1233-L1247
|
train
|
logit - density of a tensor x Useful for histograms.
|
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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FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\x37' + chr(0b110111), 57601 - 57593), ehT0Px3KOsy9(chr(1500 - 1452) + '\x6f' + chr(0b101100 + 0o6) + '\060' + chr(818 - 766), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(9176 - 9065) + chr(55) + chr(0b10101 + 0o36), 15979 - 15971), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b10111 + 0o33) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1344 - 1296) + '\157' + '\x33' + chr(50) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7964 - 7853) + chr(55) + '\062', 40322 - 40314), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b111011 + 0o64) + chr(272 - 223) + '\067' + '\060', 35750 - 35742), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010011 + 0o34) + '\x33' + chr(48) + chr(0b100011 + 0o20), 59610 - 59602), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(690 - 640) + chr(0b10001 + 0o40), 8), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(2288 - 2177) + chr(0b110001) + '\065' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1909 - 1860) + '\063' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010001 + 0o36) + '\062' + chr(0b101 + 0o55) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + chr(49) + chr(51) + chr(51), 0b1000), ehT0Px3KOsy9(chr(1918 - 1870) + chr(0b1101000 + 0o7) + chr(0b110110 + 0o1) + chr(2538 - 2485), 64462 - 64454), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(2577 - 2522), 0b1000), ehT0Px3KOsy9(chr(2033 - 1985) + chr(0b1001101 + 0o42) + chr(1483 - 1434) + '\x36' + '\063', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(12145 - 12034) + chr(1768 - 1717) + chr(2675 - 2621), 8), ehT0Px3KOsy9(chr(0b110000) + chr(6802 - 6691) + '\063' + chr(0b110111) + chr(51), 0o10), ehT0Px3KOsy9(chr(573 - 525) + chr(0b1010 + 0o145) + '\063' + '\x37' + '\063', 8), ehT0Px3KOsy9(chr(878 - 830) + chr(0b1101111) + '\062' + chr(384 - 331) + chr(2901 - 2847), 0b1000), ehT0Px3KOsy9(chr(786 - 738) + chr(0b1110 + 0o141) + '\x31' + '\063' + chr(0b10000 + 0o42), 8), ehT0Px3KOsy9(chr(2041 - 1993) + '\157' + '\x31' + chr(0b110101) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(4695 - 4584) + chr(50) + chr(1555 - 1502), 0o10), ehT0Px3KOsy9(chr(164 - 116) + chr(10530 - 10419) + chr(2227 - 2177) + chr(0b110010) + chr(0b1100 + 0o46), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + chr(0b1101 + 0o45) + chr(0b1011 + 0o51) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(2073 - 2023) + chr(49) + chr(0b110111), 56131 - 56123), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\067' + '\x33', 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1001 + 0o146) + chr(1364 - 1311) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(1376 - 1327), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + chr(1756 - 1705) + chr(0b110001) + chr(0b10010 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10 + 0o57) + '\x30' + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + chr(0b110010) + chr(359 - 307) + chr(0b100111 + 0o12), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(9204 - 9093) + chr(0b110010) + '\063' + chr(0b101100 + 0o7), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(1357 - 1309), 16293 - 16285), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x35' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(1439 - 1328) + chr(0b110001) + chr(1769 - 1717) + '\x33', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(53) + chr(0b110000), 12615 - 12607)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'Q'), chr(100) + '\x65' + chr(5821 - 5722) + chr(0b1101111) + '\x64' + '\x65')(chr(1573 - 1456) + chr(116) + chr(0b1100110) + chr(0b10000 + 0o35) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def vXVYa5sXOq3Q(OeWW0F1dBPRQ, t26vd1R23Hpa):
Fk79U9CFySYh = IDJ2eXGCBCDu.reduce_mean(ZUL3kHBGU8Uu(OeWW0F1dBPRQ > 0.0), t26vd1R23Hpa)
pAyzjBVcmYDE = IDJ2eXGCBCDu.log(Fk79U9CFySYh + yhiZVkosCjBm.exp(-ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b1 + 0o61), ord("\x08")))) - IDJ2eXGCBCDu.log(1.0 - Fk79U9CFySYh + yhiZVkosCjBm.exp(-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x32', 8)))
return pAyzjBVcmYDE
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
maybe_zero_out_padding
|
def maybe_zero_out_padding(inputs, kernel_size, nonpadding_mask):
"""If necessary, zero out inputs to a conv for padding positions.
Args:
inputs: a Tensor with shape [batch, length, ...]
kernel_size: an integer or pair of integers
nonpadding_mask: a Tensor with shape [batch, length]
Returns:
Tensor of the same shape as inputs.
"""
if (kernel_size != 1 and kernel_size != (1, 1) and
nonpadding_mask is not None):
while nonpadding_mask.get_shape().ndims < inputs.get_shape().ndims:
nonpadding_mask = tf.expand_dims(nonpadding_mask, -1)
return inputs * nonpadding_mask
return inputs
|
python
|
def maybe_zero_out_padding(inputs, kernel_size, nonpadding_mask):
"""If necessary, zero out inputs to a conv for padding positions.
Args:
inputs: a Tensor with shape [batch, length, ...]
kernel_size: an integer or pair of integers
nonpadding_mask: a Tensor with shape [batch, length]
Returns:
Tensor of the same shape as inputs.
"""
if (kernel_size != 1 and kernel_size != (1, 1) and
nonpadding_mask is not None):
while nonpadding_mask.get_shape().ndims < inputs.get_shape().ndims:
nonpadding_mask = tf.expand_dims(nonpadding_mask, -1)
return inputs * nonpadding_mask
return inputs
|
[
"def",
"maybe_zero_out_padding",
"(",
"inputs",
",",
"kernel_size",
",",
"nonpadding_mask",
")",
":",
"if",
"(",
"kernel_size",
"!=",
"1",
"and",
"kernel_size",
"!=",
"(",
"1",
",",
"1",
")",
"and",
"nonpadding_mask",
"is",
"not",
"None",
")",
":",
"while",
"nonpadding_mask",
".",
"get_shape",
"(",
")",
".",
"ndims",
"<",
"inputs",
".",
"get_shape",
"(",
")",
".",
"ndims",
":",
"nonpadding_mask",
"=",
"tf",
".",
"expand_dims",
"(",
"nonpadding_mask",
",",
"-",
"1",
")",
"return",
"inputs",
"*",
"nonpadding_mask",
"return",
"inputs"
] |
If necessary, zero out inputs to a conv for padding positions.
Args:
inputs: a Tensor with shape [batch, length, ...]
kernel_size: an integer or pair of integers
nonpadding_mask: a Tensor with shape [batch, length]
Returns:
Tensor of the same shape as inputs.
|
[
"If",
"necessary",
"zero",
"out",
"inputs",
"to",
"a",
"conv",
"for",
"padding",
"positions",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1250-L1267
|
train
|
If necessary zero out inputs to a conv for padding positions.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKo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aLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(772 - 724) + chr(8891 - 8780) + chr(2612 - 2560) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(51) + '\065' + '\066', 28363 - 28355), ehT0Px3KOsy9('\060' + chr(8685 - 8574) + '\x32' + chr(0b111 + 0o54) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110110) + chr(52), 46549 - 46541), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\x33' + '\x34', 7950 - 7942), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(49) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(7635 - 7524) + chr(2132 - 2082) + '\067' + chr(268 - 220), 48682 - 48674), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b1111 + 0o41), 63833 - 63825), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10010 + 0o37) + '\062' + chr(52), 0o10), ehT0Px3KOsy9(chr(212 - 164) + chr(0b1101011 + 0o4) + chr(52) + chr(831 - 783), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(0b1001 + 0o52) + chr(52), 36858 - 36850), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\x35' + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(0b110011) + chr(0b11001 + 0o30), 65402 - 65394), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\064' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\x6f' + chr(0b100110 + 0o17) + '\x31', 62702 - 62694), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2500 - 2450) + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(52) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(0b110001) + chr(195 - 140), 0b1000), ehT0Px3KOsy9(chr(1889 - 1841) + '\157' + chr(0b1010 + 0o50) + chr(0b110011) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101011 + 0o4) + chr(0b110011) + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110110) + '\060', 52439 - 52431), ehT0Px3KOsy9(chr(303 - 255) + '\157' + chr(0b110100) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11000 + 0o31) + chr(0b110000), 51588 - 51580), ehT0Px3KOsy9(chr(0b110000) + chr(665 - 554) + chr(48), 22584 - 22576), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(1160 - 1109) + '\x33', 0b1000), ehT0Px3KOsy9(chr(1242 - 1194) + chr(111) + chr(0b101010 + 0o13) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10100 + 0o133) + chr(620 - 571) + '\x33' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1000000 + 0o57) + chr(0b101100 + 0o7) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(11379 - 11268) + '\061' + chr(0b11100 + 0o31) + chr(0b110011), 6127 - 6119), ehT0Px3KOsy9('\060' + chr(6491 - 6380) + '\061' + '\067' + chr(0b110110), 49360 - 49352), ehT0Px3KOsy9(chr(1693 - 1645) + chr(0b1101111) + chr(0b110010 + 0o1) + chr(50) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10110 + 0o35) + chr(0b110000) + '\x32', 53788 - 53780), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + '\x33' + chr(221 - 169) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b110110) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(560 - 512) + '\x6f' + '\063' + chr(781 - 729) + '\x32', 0o10), ehT0Px3KOsy9(chr(2190 - 2142) + '\157' + chr(0b1101 + 0o44), 54673 - 54665), ehT0Px3KOsy9(chr(1249 - 1201) + chr(111) + '\062' + '\067' + chr(53), 59912 - 59904), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(51) + '\062' + chr(0b1 + 0o64), 50449 - 50441), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b110111), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(1127 - 1074) + chr(0b110000), 60177 - 60169)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x08'), chr(0b1100100) + '\x65' + chr(1846 - 1747) + '\157' + chr(0b1010111 + 0o15) + chr(101))(chr(117) + chr(0b1110100) + chr(102) + chr(0b110 + 0o47) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def VtaS6yNFbbaq(vXoupepMtCXU, m6gwVXy4D3Au, UyiM64E6iSsw):
if m6gwVXy4D3Au != ehT0Px3KOsy9(chr(2015 - 1967) + chr(0b1101111) + '\061', 8) and m6gwVXy4D3Au != (ehT0Px3KOsy9(chr(622 - 574) + '\157' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(0b110001), 8)) and (UyiM64E6iSsw is not None):
while xafqLlk3kkUe(UyiM64E6iSsw.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'H\x8a\xf3Y/'), chr(100) + '\145' + chr(1641 - 1542) + chr(5112 - 5001) + chr(0b110101 + 0o57) + chr(2381 - 2280))('\165' + chr(0b1011110 + 0o26) + chr(0b1100110) + '\055' + chr(210 - 154))) < xafqLlk3kkUe(vXoupepMtCXU.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'H\x8a\xf3Y/'), chr(2557 - 2457) + chr(0b1000101 + 0o40) + '\x63' + chr(111) + '\144' + chr(754 - 653))('\165' + '\164' + chr(102) + '\055' + chr(0b111000))):
UyiM64E6iSsw = IDJ2eXGCBCDu.expand_dims(UyiM64E6iSsw, -ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001), 8))
return vXoupepMtCXU * UyiM64E6iSsw
return vXoupepMtCXU
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
dense_relu_dense
|
def dense_relu_dense(inputs,
filter_size,
output_size,
output_activation=None,
dropout=0.0,
dropout_broadcast_dims=None,
layer_collection=None,
name=None):
"""Hidden layer with RELU activation followed by linear projection."""
# layer_name is appended with "conv1" or "conv2" in this method only for
# historical reasons. These are in fact dense layers.
layer_name = "%s_{}" % name if name else "{}"
h = dense(
inputs,
filter_size,
use_bias=True,
activation=tf.nn.relu,
layer_collection=layer_collection,
name=layer_name.format("conv1"))
if dropout != 0.0:
h = dropout_with_broadcast_dims(
h, 1.0 - dropout, broadcast_dims=dropout_broadcast_dims)
o = dense(
h,
output_size,
activation=output_activation,
use_bias=True,
layer_collection=layer_collection,
name=layer_name.format("conv2"))
return o
|
python
|
def dense_relu_dense(inputs,
filter_size,
output_size,
output_activation=None,
dropout=0.0,
dropout_broadcast_dims=None,
layer_collection=None,
name=None):
"""Hidden layer with RELU activation followed by linear projection."""
# layer_name is appended with "conv1" or "conv2" in this method only for
# historical reasons. These are in fact dense layers.
layer_name = "%s_{}" % name if name else "{}"
h = dense(
inputs,
filter_size,
use_bias=True,
activation=tf.nn.relu,
layer_collection=layer_collection,
name=layer_name.format("conv1"))
if dropout != 0.0:
h = dropout_with_broadcast_dims(
h, 1.0 - dropout, broadcast_dims=dropout_broadcast_dims)
o = dense(
h,
output_size,
activation=output_activation,
use_bias=True,
layer_collection=layer_collection,
name=layer_name.format("conv2"))
return o
|
[
"def",
"dense_relu_dense",
"(",
"inputs",
",",
"filter_size",
",",
"output_size",
",",
"output_activation",
"=",
"None",
",",
"dropout",
"=",
"0.0",
",",
"dropout_broadcast_dims",
"=",
"None",
",",
"layer_collection",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"# layer_name is appended with \"conv1\" or \"conv2\" in this method only for",
"# historical reasons. These are in fact dense layers.",
"layer_name",
"=",
"\"%s_{}\"",
"%",
"name",
"if",
"name",
"else",
"\"{}\"",
"h",
"=",
"dense",
"(",
"inputs",
",",
"filter_size",
",",
"use_bias",
"=",
"True",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"layer_collection",
"=",
"layer_collection",
",",
"name",
"=",
"layer_name",
".",
"format",
"(",
"\"conv1\"",
")",
")",
"if",
"dropout",
"!=",
"0.0",
":",
"h",
"=",
"dropout_with_broadcast_dims",
"(",
"h",
",",
"1.0",
"-",
"dropout",
",",
"broadcast_dims",
"=",
"dropout_broadcast_dims",
")",
"o",
"=",
"dense",
"(",
"h",
",",
"output_size",
",",
"activation",
"=",
"output_activation",
",",
"use_bias",
"=",
"True",
",",
"layer_collection",
"=",
"layer_collection",
",",
"name",
"=",
"layer_name",
".",
"format",
"(",
"\"conv2\"",
")",
")",
"return",
"o"
] |
Hidden layer with RELU activation followed by linear projection.
|
[
"Hidden",
"layer",
"with",
"RELU",
"activation",
"followed",
"by",
"linear",
"projection",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1270-L1300
|
train
|
Hidden layer with RELU activation followed by linear projection.
|
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,ygA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EdDQ,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(0b101100 + 0o5), 58221 - 58213), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(54) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1078 - 967) + chr(0b11001 + 0o32) + chr(0b110100) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(7088 - 6977) + chr(0b110001) + chr(0b110101) + chr(49), 0b1000), ehT0Px3KOsy9(chr(392 - 344) + chr(3405 - 3294) + '\x32' + '\061' + chr(0b11100 + 0o24), 24504 - 24496), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110100) + chr(2882 - 2827), 7907 - 7899), ehT0Px3KOsy9('\060' + chr(0b1100101 + 0o12) + chr(0b110010) + chr(1743 - 1695) + chr(0b110111), 34638 - 34630), ehT0Px3KOsy9(chr(74 - 26) + '\x6f' + chr(1883 - 1832) + '\063' + chr(0b110111), 58395 - 58387), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\066' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b110110) + chr(0b110101), 54925 - 54917), ehT0Px3KOsy9('\060' + chr(3724 - 3613) + chr(0b110011) + '\063' + chr(1360 - 1310), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11101 + 0o122) + '\062' + chr(2022 - 1970), 0b1000), ehT0Px3KOsy9(chr(817 - 769) + chr(0b1101111) + chr(0b101111 + 0o2) + chr(1742 - 1687) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(2028 - 1977) + chr(0b110010) + chr(0b110000 + 0o5), 0b1000), ehT0Px3KOsy9('\060' + chr(0b110011 + 0o74) + chr(48), 13092 - 13084), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10111 + 0o33) + chr(0b100111 + 0o12) + chr(827 - 777), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(4786 - 4675) + chr(0b110011) + chr(0b110010) + chr(0b11010 + 0o33), 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(9081 - 8970) + chr(0b10101 + 0o34) + '\x36' + '\067', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110100) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1000111 + 0o50) + chr(2202 - 2152) + chr(137 - 89) + chr(2552 - 2498), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\061' + chr(51), 10115 - 10107), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10100 + 0o37) + chr(0b11000 + 0o36) + chr(0b11111 + 0o21), 0o10), ehT0Px3KOsy9(chr(1921 - 1873) + '\157' + chr(52) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(490 - 442) + chr(0b1010111 + 0o30) + chr(0b110001) + chr(1066 - 1015) + chr(0b10110 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(1410 - 1362) + '\157' + '\x31' + chr(376 - 326), 0o10), ehT0Px3KOsy9(chr(1372 - 1324) + chr(111) + chr(705 - 654) + chr(1401 - 1349) + chr(865 - 817), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1065 - 1011) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + chr(426 - 377) + '\x30' + chr(0b1010 + 0o54), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x32' + '\x34' + '\064', 0b1000), ehT0Px3KOsy9(chr(1902 - 1854) + chr(0b1101111) + chr(0b1001 + 0o51) + chr(0b110000) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1111 + 0o44) + '\060' + '\x35', 40557 - 40549), ehT0Px3KOsy9('\060' + chr(5797 - 5686) + '\x32' + chr(53) + chr(0b110110), 51314 - 51306), ehT0Px3KOsy9(chr(48) + chr(0b11011 + 0o124) + '\063' + '\x30' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\x32' + chr(0b1111 + 0o45) + chr(1413 - 1364), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + chr(50) + chr(1364 - 1312) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(12202 - 12091) + chr(1642 - 1592) + '\066' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(53) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(49) + chr(50), 8), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1100 + 0o143) + chr(0b110001 + 0o2) + chr(0b110001) + '\x35', 62291 - 62283)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + chr(48), 24191 - 24183)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'/'), chr(100) + chr(0b1100101) + '\x63' + chr(111) + '\x64' + '\x65')(chr(117) + '\164' + '\x66' + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def aUiZSK0PFIlz(vXoupepMtCXU, deybX8NJ0oEI, NOWUhJWuP8qU, LVWIrYX6ybOD=None, ag0mwEgWzjYv=0.0, Tovc3lDEHg6s=None, QhNZfIyyHZe2=None, AIvJRzLdDfgF=None):
YzJBPucQyDh2 = xafqLlk3kkUe(SXOLrMavuUCe(b'$E\\\x98\x14'), chr(100) + '\x65' + chr(0b110 + 0o135) + '\x6f' + chr(8981 - 8881) + chr(101))('\x75' + '\164' + chr(2276 - 2174) + chr(0b101101) + '\070') % AIvJRzLdDfgF if AIvJRzLdDfgF else xafqLlk3kkUe(SXOLrMavuUCe(b'zK'), '\x64' + chr(1923 - 1822) + chr(99) + chr(111) + chr(0b10001 + 0o123) + '\x65')('\165' + chr(116) + chr(8734 - 8632) + '\x2d' + chr(0b111000))
sz4HVsFVF8nL = AM71TO6gBqHa(vXoupepMtCXU, deybX8NJ0oEI, use_bias=ehT0Px3KOsy9(chr(1447 - 1399) + '\157' + '\061', 8), activation=IDJ2eXGCBCDu.nn.relu, layer_collection=QhNZfIyyHZe2, name=YzJBPucQyDh2.V4roHaS3Ppej(xafqLlk3kkUe(SXOLrMavuUCe(b'bYm\x95X'), '\x64' + '\145' + chr(0b1100011) + chr(0b10001 + 0o136) + chr(0b1100100) + chr(10081 - 9980))(chr(0b11 + 0o162) + '\x74' + '\146' + '\055' + chr(2456 - 2400))))
if ag0mwEgWzjYv != 0.0:
sz4HVsFVF8nL = Ue76kt5RmoeT(sz4HVsFVF8nL, 1.0 - ag0mwEgWzjYv, broadcast_dims=Tovc3lDEHg6s)
gb6ab8SSTLgq = AM71TO6gBqHa(sz4HVsFVF8nL, NOWUhJWuP8qU, activation=LVWIrYX6ybOD, use_bias=ehT0Px3KOsy9(chr(2085 - 2037) + '\157' + chr(0b110001), 8), layer_collection=QhNZfIyyHZe2, name=YzJBPucQyDh2.V4roHaS3Ppej(xafqLlk3kkUe(SXOLrMavuUCe(b'bYm\x95['), chr(100) + '\x65' + chr(99) + '\157' + '\144' + chr(8032 - 7931))(chr(0b111100 + 0o71) + chr(116) + '\x66' + '\055' + chr(0b101011 + 0o15))))
return gb6ab8SSTLgq
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
dense_dropconnect
|
def dense_dropconnect(inputs,
output_size,
dropconnect_dropout=0.0,
name="dense_dropconnect",
**kwargs):
"""Dense layer with dropconnect."""
if dropconnect_dropout != 0.0:
tf.logging.info("Applying dropconnect as the kernel regularization.")
kwargs["kernel_regularizer"] = functools.partial(
tf.nn.dropout, keep_prob=1.0 - dropconnect_dropout)
return dense(inputs, output_size, use_bias=True, name=name, **kwargs)
|
python
|
def dense_dropconnect(inputs,
output_size,
dropconnect_dropout=0.0,
name="dense_dropconnect",
**kwargs):
"""Dense layer with dropconnect."""
if dropconnect_dropout != 0.0:
tf.logging.info("Applying dropconnect as the kernel regularization.")
kwargs["kernel_regularizer"] = functools.partial(
tf.nn.dropout, keep_prob=1.0 - dropconnect_dropout)
return dense(inputs, output_size, use_bias=True, name=name, **kwargs)
|
[
"def",
"dense_dropconnect",
"(",
"inputs",
",",
"output_size",
",",
"dropconnect_dropout",
"=",
"0.0",
",",
"name",
"=",
"\"dense_dropconnect\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dropconnect_dropout",
"!=",
"0.0",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Applying dropconnect as the kernel regularization.\"",
")",
"kwargs",
"[",
"\"kernel_regularizer\"",
"]",
"=",
"functools",
".",
"partial",
"(",
"tf",
".",
"nn",
".",
"dropout",
",",
"keep_prob",
"=",
"1.0",
"-",
"dropconnect_dropout",
")",
"return",
"dense",
"(",
"inputs",
",",
"output_size",
",",
"use_bias",
"=",
"True",
",",
"name",
"=",
"name",
",",
"*",
"*",
"kwargs",
")"
] |
Dense layer with dropconnect.
|
[
"Dense",
"layer",
"with",
"dropconnect",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1303-L1315
|
train
|
Dense layer with dropconnect.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0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9iu2kLpS8s,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(1028 - 980) + chr(0b1101111) + chr(2429 - 2378) + chr(0b10010 + 0o42) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1835 - 1786) + chr(417 - 367) + chr(0b100011 + 0o16), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2176 - 2126) + chr(0b110000 + 0o2) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(693 - 644) + '\x37' + '\065', 44533 - 44525), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + chr(1295 - 1245) + chr(1474 - 1421) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(5505 - 5394) + '\061' + chr(0b11011 + 0o26) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7702 - 7591) + chr(0b11000 + 0o36) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b0 + 0o60) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(4637 - 4526) + chr(0b11010 + 0o31) + chr(0b110011) + chr(0b101100 + 0o13), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(50) + chr(0b110011) + chr(0b11100 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1556 - 1506) + chr(1196 - 1147) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10100 + 0o35) + '\064' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(0b10001 + 0o40), 63432 - 63424), ehT0Px3KOsy9('\x30' + chr(8446 - 8335) + '\x32' + '\066' + chr(66 - 17), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + '\063' + chr(2548 - 2493), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(339 - 285) + chr(0b100000 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(51) + chr(1235 - 1187) + chr(55), 64953 - 64945), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + '\062' + '\x37' + chr(53), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(2470 - 2418) + chr(2800 - 2747), 477 - 469), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(49) + '\x34' + '\064', 64417 - 64409), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b110000) + chr(0b110001), 39301 - 39293), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100011 + 0o20) + '\062' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1308 - 1260) + chr(111) + chr(51) + chr(52) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(0b110011) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(51) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + chr(0b101111 + 0o3) + chr(0b1100 + 0o46) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(1063 - 1015) + '\x6f' + chr(2029 - 1978) + chr(55) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b110110) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(0b100101 + 0o112) + chr(0b110010) + '\067' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(49) + chr(0b110100 + 0o3), 8), ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + '\063' + '\x31', 8), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(0b1011 + 0o46) + chr(55) + chr(0b10101 + 0o37), 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b111011 + 0o64) + chr(0b100111 + 0o16) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100001 + 0o116) + '\x31' + '\064' + chr(0b110001), 46059 - 46051), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2264 - 2215) + chr(51) + chr(1256 - 1205), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(3041 - 2930) + '\061' + chr(53), 0b1000), ehT0Px3KOsy9(chr(1850 - 1802) + '\x6f' + chr(0b110 + 0o55) + chr(1850 - 1797) + chr(0b101010 + 0o6), 0o10), ehT0Px3KOsy9(chr(1018 - 970) + chr(0b1101111) + chr(0b110010) + chr(0b110001) + chr(55), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b11000 + 0o127) + '\x35' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xca'), chr(100) + chr(0b1100101) + chr(7129 - 7030) + chr(5265 - 5154) + '\144' + chr(6987 - 6886))('\x75' + '\164' + '\x66' + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cEEsS0G6TcPW(vXoupepMtCXU, NOWUhJWuP8qU, Lr8pWhR_00uy=0.0, AIvJRzLdDfgF=xafqLlk3kkUe(SXOLrMavuUCe(b'\x804\xff\x0e\xc9\x11U\xf1\xb0\xe8\xec\x08o\xdfzQ\xb3'), chr(100) + '\x65' + chr(0b1100011) + chr(9393 - 9282) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\055' + '\x38'), **M8EIoTs2GJXE):
if Lr8pWhR_00uy != 0.0:
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7f\xd9\x05\xd9-V\xb4\xb5\xf4\xd5\x0c'), chr(2108 - 2008) + '\145' + '\x63' + chr(0b101 + 0o152) + '\x64' + '\x65')(chr(2416 - 2299) + chr(116) + chr(102) + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xa5!\xe1\x11\xd5'_\xe4\xff\xfc\xfd\x08q\xd2p\\\xa9|\xdeQD \xa1\xc6\xaaq\xf5\xd9\x9d\xdf\xfdw\x19AA)uj\x9d\xe3\x85#\xf8\x07\xcd:X\xec\xb1\xb6"), chr(0b1100100) + '\145' + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(0b1111 + 0o126))(chr(117) + chr(0b1110100) + '\x66' + chr(45) + chr(0b111000)))
M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\x8f4\xe3\x13\xc9"n\xf1\xba\xff\xfa\x0b`\xc3vH\xa2k'), '\x64' + '\x65' + chr(0b1100011) + '\157' + chr(1578 - 1478) + '\x65')('\165' + chr(0b1110100) + chr(0b1000 + 0o136) + '\055' + chr(0b100100 + 0o24))] = E6ula8_Zv1yl.partial(IDJ2eXGCBCDu.nn.ag0mwEgWzjYv, keep_prob=1.0 - Lr8pWhR_00uy)
return AM71TO6gBqHa(vXoupepMtCXU, NOWUhJWuP8qU, use_bias=ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + '\061', 8), name=AIvJRzLdDfgF, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_relu_conv
|
def conv_relu_conv(inputs,
filter_size,
output_size,
first_kernel_size=3,
second_kernel_size=3,
padding="SAME",
nonpadding_mask=None,
dropout=0.0,
name=None,
cache=None,
decode_loop_step=None):
"""Hidden layer with RELU activation followed by linear projection.
Args:
inputs: A tensor.
filter_size: An integer.
output_size: An integer.
first_kernel_size: An integer.
second_kernel_size: An integer.
padding: A string.
nonpadding_mask: A tensor.
dropout: A float.
name: A string.
cache: A dict, containing Tensors which are the results of previous
attentions, used for fast decoding.
decode_loop_step: An integer, step number of the decoding loop.
Only used for inference on TPU. If it is not None, the function
will do inplace update for the cache instead of concatenating the
current result to the cache.
Returns:
A Tensor.
"""
with tf.variable_scope(name, "conv_relu_conv", [inputs]):
inputs = maybe_zero_out_padding(inputs, first_kernel_size, nonpadding_mask)
if cache:
if decode_loop_step is None:
inputs = cache["f"] = tf.concat([cache["f"], inputs], axis=1)
else:
# Inplace update is required for inference on TPU.
# Inplace_ops only supports inplace_update on the first dimension.
# The performance of current implementation is better than updating
# the tensor by adding the result of matmul(one_hot,
# update_in_current_step)
tmp_f = tf.transpose(cache["f"], perm=[1, 0, 2])
tmp_f = inplace_ops.alias_inplace_update(
tmp_f,
decode_loop_step * tf.shape(inputs)[1],
tf.transpose(inputs, perm=[1, 0, 2]))
inputs = cache["f"] = tf.transpose(tmp_f, perm=[1, 0, 2])
inputs = cache["f"] = inputs[:, -first_kernel_size:, :]
h = tpu_conv1d(
inputs, filter_size, first_kernel_size, padding=padding, name="conv1")
if cache:
h = h[:, -1:, :]
h = tf.nn.relu(h)
if dropout != 0.0:
h = tf.nn.dropout(h, 1.0 - dropout)
h = maybe_zero_out_padding(h, second_kernel_size, nonpadding_mask)
return tpu_conv1d(
h, output_size, second_kernel_size, padding=padding, name="conv2")
|
python
|
def conv_relu_conv(inputs,
filter_size,
output_size,
first_kernel_size=3,
second_kernel_size=3,
padding="SAME",
nonpadding_mask=None,
dropout=0.0,
name=None,
cache=None,
decode_loop_step=None):
"""Hidden layer with RELU activation followed by linear projection.
Args:
inputs: A tensor.
filter_size: An integer.
output_size: An integer.
first_kernel_size: An integer.
second_kernel_size: An integer.
padding: A string.
nonpadding_mask: A tensor.
dropout: A float.
name: A string.
cache: A dict, containing Tensors which are the results of previous
attentions, used for fast decoding.
decode_loop_step: An integer, step number of the decoding loop.
Only used for inference on TPU. If it is not None, the function
will do inplace update for the cache instead of concatenating the
current result to the cache.
Returns:
A Tensor.
"""
with tf.variable_scope(name, "conv_relu_conv", [inputs]):
inputs = maybe_zero_out_padding(inputs, first_kernel_size, nonpadding_mask)
if cache:
if decode_loop_step is None:
inputs = cache["f"] = tf.concat([cache["f"], inputs], axis=1)
else:
# Inplace update is required for inference on TPU.
# Inplace_ops only supports inplace_update on the first dimension.
# The performance of current implementation is better than updating
# the tensor by adding the result of matmul(one_hot,
# update_in_current_step)
tmp_f = tf.transpose(cache["f"], perm=[1, 0, 2])
tmp_f = inplace_ops.alias_inplace_update(
tmp_f,
decode_loop_step * tf.shape(inputs)[1],
tf.transpose(inputs, perm=[1, 0, 2]))
inputs = cache["f"] = tf.transpose(tmp_f, perm=[1, 0, 2])
inputs = cache["f"] = inputs[:, -first_kernel_size:, :]
h = tpu_conv1d(
inputs, filter_size, first_kernel_size, padding=padding, name="conv1")
if cache:
h = h[:, -1:, :]
h = tf.nn.relu(h)
if dropout != 0.0:
h = tf.nn.dropout(h, 1.0 - dropout)
h = maybe_zero_out_padding(h, second_kernel_size, nonpadding_mask)
return tpu_conv1d(
h, output_size, second_kernel_size, padding=padding, name="conv2")
|
[
"def",
"conv_relu_conv",
"(",
"inputs",
",",
"filter_size",
",",
"output_size",
",",
"first_kernel_size",
"=",
"3",
",",
"second_kernel_size",
"=",
"3",
",",
"padding",
"=",
"\"SAME\"",
",",
"nonpadding_mask",
"=",
"None",
",",
"dropout",
"=",
"0.0",
",",
"name",
"=",
"None",
",",
"cache",
"=",
"None",
",",
"decode_loop_step",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"\"conv_relu_conv\"",
",",
"[",
"inputs",
"]",
")",
":",
"inputs",
"=",
"maybe_zero_out_padding",
"(",
"inputs",
",",
"first_kernel_size",
",",
"nonpadding_mask",
")",
"if",
"cache",
":",
"if",
"decode_loop_step",
"is",
"None",
":",
"inputs",
"=",
"cache",
"[",
"\"f\"",
"]",
"=",
"tf",
".",
"concat",
"(",
"[",
"cache",
"[",
"\"f\"",
"]",
",",
"inputs",
"]",
",",
"axis",
"=",
"1",
")",
"else",
":",
"# Inplace update is required for inference on TPU.",
"# Inplace_ops only supports inplace_update on the first dimension.",
"# The performance of current implementation is better than updating",
"# the tensor by adding the result of matmul(one_hot,",
"# update_in_current_step)",
"tmp_f",
"=",
"tf",
".",
"transpose",
"(",
"cache",
"[",
"\"f\"",
"]",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"tmp_f",
"=",
"inplace_ops",
".",
"alias_inplace_update",
"(",
"tmp_f",
",",
"decode_loop_step",
"*",
"tf",
".",
"shape",
"(",
"inputs",
")",
"[",
"1",
"]",
",",
"tf",
".",
"transpose",
"(",
"inputs",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
")",
"inputs",
"=",
"cache",
"[",
"\"f\"",
"]",
"=",
"tf",
".",
"transpose",
"(",
"tmp_f",
",",
"perm",
"=",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"inputs",
"=",
"cache",
"[",
"\"f\"",
"]",
"=",
"inputs",
"[",
":",
",",
"-",
"first_kernel_size",
":",
",",
":",
"]",
"h",
"=",
"tpu_conv1d",
"(",
"inputs",
",",
"filter_size",
",",
"first_kernel_size",
",",
"padding",
"=",
"padding",
",",
"name",
"=",
"\"conv1\"",
")",
"if",
"cache",
":",
"h",
"=",
"h",
"[",
":",
",",
"-",
"1",
":",
",",
":",
"]",
"h",
"=",
"tf",
".",
"nn",
".",
"relu",
"(",
"h",
")",
"if",
"dropout",
"!=",
"0.0",
":",
"h",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"h",
",",
"1.0",
"-",
"dropout",
")",
"h",
"=",
"maybe_zero_out_padding",
"(",
"h",
",",
"second_kernel_size",
",",
"nonpadding_mask",
")",
"return",
"tpu_conv1d",
"(",
"h",
",",
"output_size",
",",
"second_kernel_size",
",",
"padding",
"=",
"padding",
",",
"name",
"=",
"\"conv2\"",
")"
] |
Hidden layer with RELU activation followed by linear projection.
Args:
inputs: A tensor.
filter_size: An integer.
output_size: An integer.
first_kernel_size: An integer.
second_kernel_size: An integer.
padding: A string.
nonpadding_mask: A tensor.
dropout: A float.
name: A string.
cache: A dict, containing Tensors which are the results of previous
attentions, used for fast decoding.
decode_loop_step: An integer, step number of the decoding loop.
Only used for inference on TPU. If it is not None, the function
will do inplace update for the cache instead of concatenating the
current result to the cache.
Returns:
A Tensor.
|
[
"Hidden",
"layer",
"with",
"RELU",
"activation",
"followed",
"by",
"linear",
"projection",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1318-L1382
|
train
|
Hidden layer with RELU activation followed by linear projection.
|
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,KOHQGQ8q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,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b11100 + 0o27) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10011 + 0o44) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(2497 - 2447) + chr(0b11110 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(0b110011) + '\065' + '\060', 6512 - 6504), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(9313 - 9202) + '\062' + chr(51) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2410 - 2299) + chr(0b110011) + chr(0b110110) + '\x36', 30338 - 30330), ehT0Px3KOsy9('\060' + chr(0b1011110 + 0o21) + chr(0b110011) + '\065' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9606 - 9495) + chr(0b101 + 0o55) + chr(0b101000 + 0o16) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + chr(0b110110), 9814 - 9806), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b100000 + 0o23) + chr(2025 - 1973), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(1946 - 1896) + '\066', 38378 - 38370), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + chr(51) + chr(0b10010 + 0o36) + chr(708 - 657), 10473 - 10465), ehT0Px3KOsy9(chr(172 - 124) + '\x6f' + chr(0b11000 + 0o37) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1111 + 0o44) + chr(0b101010 + 0o6) + '\x34', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(1429 - 1377), 0b1000), ehT0Px3KOsy9(chr(382 - 334) + chr(111) + '\063' + '\061' + chr(1663 - 1612), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(55) + chr(1257 - 1206), 41280 - 41272), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(2220 - 2109) + chr(0b11111 + 0o25), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1043 - 932) + '\062' + '\x30' + chr(0b11100 + 0o24), 15428 - 15420), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(5711 - 5600) + '\x31' + '\062' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + '\x32' + '\x33' + chr(0b1010 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(1354 - 1303), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10000 + 0o42) + '\x30' + '\x30', 8), ehT0Px3KOsy9(chr(1297 - 1249) + chr(0b1010011 + 0o34) + chr(1996 - 1945) + '\066' + chr(0b100010 + 0o20), 44040 - 44032), ehT0Px3KOsy9(chr(48) + chr(6895 - 6784) + chr(1335 - 1286) + chr(50) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b110100) + chr(0b110011), 55708 - 55700), ehT0Px3KOsy9(chr(778 - 730) + chr(111) + '\061' + chr(0b10101 + 0o34) + '\x31', 6156 - 6148), ehT0Px3KOsy9(chr(1619 - 1571) + chr(111) + chr(0b1010 + 0o47) + chr(0b110010) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b110010) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4118 - 4007) + chr(50) + chr(0b110110) + chr(55), 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101100 + 0o103) + chr(1855 - 1806) + chr(0b110100) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000001 + 0o56) + chr(249 - 201), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + '\061' + chr(2515 - 2461) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(0b10001 + 0o43) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + chr(0b110011) + chr(0b110100) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1000111 + 0o50) + chr(0b110001) + '\x30' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(0b10110 + 0o35) + chr(1764 - 1710) + '\063', 0b1000), ehT0Px3KOsy9(chr(1008 - 960) + chr(0b1101111) + chr(186 - 133) + chr(475 - 426), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + chr(0b110100 + 0o1) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3'), chr(1279 - 1179) + chr(101) + chr(0b1000110 + 0o35) + '\x6f' + '\144' + chr(101))(chr(0b1110101) + chr(390 - 274) + chr(0b1100110) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def f4BPwPVg8mtF(vXoupepMtCXU, deybX8NJ0oEI, NOWUhJWuP8qU, LSFUU2kbEKFn=ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101000 + 0o13), 24403 - 24395), SS26PoJvFOCx=ehT0Px3KOsy9(chr(580 - 532) + chr(0b1101111) + '\063', 8), TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e~Z\xad'), chr(0b11100 + 0o110) + chr(3849 - 3748) + '\x63' + chr(7888 - 7777) + chr(0b1100100) + chr(0b1100101))(chr(0b111111 + 0o66) + chr(0b1110100) + chr(1790 - 1688) + '\055' + chr(976 - 920)), UyiM64E6iSsw=None, ag0mwEgWzjYv=0.0, AIvJRzLdDfgF=None, j1lPDdxcDbRB=None, Et0FYCPsowFY=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xab^e\x81\xfa\x94\x85\xd2q\xaf\xf5\xacMg'), '\144' + chr(0b101010 + 0o73) + '\x63' + chr(0b1111 + 0o140) + chr(0b1000111 + 0o35) + chr(0b101001 + 0o74))(chr(12044 - 11927) + chr(116) + chr(102) + '\x2d' + '\x38'))(AIvJRzLdDfgF, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbePy\x9e\xc4\x84\x8c\xdb[\x83\xf5\xacSt'), '\144' + '\145' + chr(0b1011010 + 0o11) + chr(0b1101111) + chr(0b1001110 + 0o26) + '\x65')('\x75' + chr(0b1110100) + chr(2674 - 2572) + '\055' + '\x38'), [vXoupepMtCXU]):
vXoupepMtCXU = VtaS6yNFbbaq(vXoupepMtCXU, LSFUU2kbEKFn, UyiM64E6iSsw)
if j1lPDdxcDbRB:
if Et0FYCPsowFY is None:
vXoupepMtCXU = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb'), chr(100) + chr(0b1100101) + '\143' + '\x6f' + chr(5384 - 5284) + '\x65')(chr(13265 - 13148) + chr(0b1110100) + chr(5425 - 5323) + chr(0b101101) + '\x38')] = IDJ2eXGCBCDu.concat([j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb'), chr(0b1100100) + chr(0b1100000 + 0o5) + '\143' + chr(11434 - 11323) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1100110) + '\055' + chr(0b100100 + 0o24))], vXoupepMtCXU], axis=ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(49), 0o10))
else:
VZT8R5RzsvNb = IDJ2eXGCBCDu.transpose(j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb'), chr(0b1000111 + 0o35) + chr(4760 - 4659) + chr(0b1000110 + 0o35) + chr(6113 - 6002) + '\144' + chr(2039 - 1938))('\x75' + '\164' + '\146' + chr(0b101101) + chr(2096 - 2040))], perm=[ehT0Px3KOsy9('\060' + '\x6f' + chr(470 - 421), 8), ehT0Px3KOsy9('\x30' + chr(7856 - 7745) + chr(0b101111 + 0o1), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010), 8)])
VZT8R5RzsvNb = GanXbkgpxGLx.alias_inplace_update(VZT8R5RzsvNb, Et0FYCPsowFY * IDJ2eXGCBCDu.nauYfLglTpcb(vXoupepMtCXU)[ehT0Px3KOsy9(chr(48) + chr(111) + '\x31', 8)], IDJ2eXGCBCDu.transpose(vXoupepMtCXU, perm=[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b100100 + 0o113) + chr(0b110000), 8), ehT0Px3KOsy9('\060' + '\157' + chr(50), 8)]))
vXoupepMtCXU = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb'), chr(8773 - 8673) + '\145' + chr(7210 - 7111) + chr(2601 - 2490) + '\x64' + chr(101))(chr(0b1110101) + chr(116) + '\x66' + '\055' + chr(0b101111 + 0o11))] = IDJ2eXGCBCDu.transpose(VZT8R5RzsvNb, perm=[ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101000 + 0o11), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + chr(6324 - 6213) + chr(136 - 86), 8)])
vXoupepMtCXU = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb'), chr(0b10110 + 0o116) + '\x65' + '\x63' + '\x6f' + chr(0b1010001 + 0o23) + chr(101))(chr(5546 - 5429) + chr(2039 - 1923) + chr(0b1010101 + 0o21) + '\055' + '\x38')] = vXoupepMtCXU[:, -LSFUU2kbEKFn:, :]
sz4HVsFVF8nL = o1rZz41nLKdE(vXoupepMtCXU, deybX8NJ0oEI, LSFUU2kbEKFn, padding=TFLseEYASEKG, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbePy\x9e\xaa'), chr(4438 - 4338) + chr(101) + '\x63' + chr(111) + chr(378 - 278) + '\x65')('\x75' + chr(116) + chr(0b100000 + 0o106) + '\x2d' + chr(0b111000)))
if j1lPDdxcDbRB:
sz4HVsFVF8nL = sz4HVsFVF8nL[:, -ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8):, :]
sz4HVsFVF8nL = IDJ2eXGCBCDu.nn.relu(sz4HVsFVF8nL)
if ag0mwEgWzjYv != 0.0:
sz4HVsFVF8nL = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(sz4HVsFVF8nL, 1.0 - ag0mwEgWzjYv)
sz4HVsFVF8nL = VtaS6yNFbbaq(sz4HVsFVF8nL, SS26PoJvFOCx, UyiM64E6iSsw)
return o1rZz41nLKdE(sz4HVsFVF8nL, NOWUhJWuP8qU, SS26PoJvFOCx, padding=TFLseEYASEKG, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbePy\x9e\xa9'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\x6f' + '\144' + '\x65')(chr(117) + '\164' + chr(0b1100110) + chr(0b1110 + 0o37) + '\x38'))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
sepconv_relu_sepconv
|
def sepconv_relu_sepconv(inputs,
filter_size,
output_size,
first_kernel_size=(1, 1),
second_kernel_size=(1, 1),
padding="LEFT",
nonpadding_mask=None,
dropout=0.0,
name=None):
"""Hidden layer with RELU activation followed by linear projection."""
with tf.variable_scope(name, "sepconv_relu_sepconv", [inputs]):
inputs = maybe_zero_out_padding(inputs, first_kernel_size, nonpadding_mask)
if inputs.get_shape().ndims == 3:
is_3d = True
inputs = tf.expand_dims(inputs, 2)
else:
is_3d = False
h = separable_conv(
inputs,
filter_size,
first_kernel_size,
activation=tf.nn.relu,
padding=padding,
name="conv1")
if dropout != 0.0:
h = tf.nn.dropout(h, 1.0 - dropout)
h = maybe_zero_out_padding(h, second_kernel_size, nonpadding_mask)
ret = separable_conv(
h, output_size, second_kernel_size, padding=padding, name="conv2")
if is_3d:
ret = tf.squeeze(ret, 2)
return ret
|
python
|
def sepconv_relu_sepconv(inputs,
filter_size,
output_size,
first_kernel_size=(1, 1),
second_kernel_size=(1, 1),
padding="LEFT",
nonpadding_mask=None,
dropout=0.0,
name=None):
"""Hidden layer with RELU activation followed by linear projection."""
with tf.variable_scope(name, "sepconv_relu_sepconv", [inputs]):
inputs = maybe_zero_out_padding(inputs, first_kernel_size, nonpadding_mask)
if inputs.get_shape().ndims == 3:
is_3d = True
inputs = tf.expand_dims(inputs, 2)
else:
is_3d = False
h = separable_conv(
inputs,
filter_size,
first_kernel_size,
activation=tf.nn.relu,
padding=padding,
name="conv1")
if dropout != 0.0:
h = tf.nn.dropout(h, 1.0 - dropout)
h = maybe_zero_out_padding(h, second_kernel_size, nonpadding_mask)
ret = separable_conv(
h, output_size, second_kernel_size, padding=padding, name="conv2")
if is_3d:
ret = tf.squeeze(ret, 2)
return ret
|
[
"def",
"sepconv_relu_sepconv",
"(",
"inputs",
",",
"filter_size",
",",
"output_size",
",",
"first_kernel_size",
"=",
"(",
"1",
",",
"1",
")",
",",
"second_kernel_size",
"=",
"(",
"1",
",",
"1",
")",
",",
"padding",
"=",
"\"LEFT\"",
",",
"nonpadding_mask",
"=",
"None",
",",
"dropout",
"=",
"0.0",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"\"sepconv_relu_sepconv\"",
",",
"[",
"inputs",
"]",
")",
":",
"inputs",
"=",
"maybe_zero_out_padding",
"(",
"inputs",
",",
"first_kernel_size",
",",
"nonpadding_mask",
")",
"if",
"inputs",
".",
"get_shape",
"(",
")",
".",
"ndims",
"==",
"3",
":",
"is_3d",
"=",
"True",
"inputs",
"=",
"tf",
".",
"expand_dims",
"(",
"inputs",
",",
"2",
")",
"else",
":",
"is_3d",
"=",
"False",
"h",
"=",
"separable_conv",
"(",
"inputs",
",",
"filter_size",
",",
"first_kernel_size",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"padding",
"=",
"padding",
",",
"name",
"=",
"\"conv1\"",
")",
"if",
"dropout",
"!=",
"0.0",
":",
"h",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"h",
",",
"1.0",
"-",
"dropout",
")",
"h",
"=",
"maybe_zero_out_padding",
"(",
"h",
",",
"second_kernel_size",
",",
"nonpadding_mask",
")",
"ret",
"=",
"separable_conv",
"(",
"h",
",",
"output_size",
",",
"second_kernel_size",
",",
"padding",
"=",
"padding",
",",
"name",
"=",
"\"conv2\"",
")",
"if",
"is_3d",
":",
"ret",
"=",
"tf",
".",
"squeeze",
"(",
"ret",
",",
"2",
")",
"return",
"ret"
] |
Hidden layer with RELU activation followed by linear projection.
|
[
"Hidden",
"layer",
"with",
"RELU",
"activation",
"followed",
"by",
"linear",
"projection",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1385-L1416
|
train
|
Hidden layer with RELU activation followed by linear projection.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9D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,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(4980 - 4869) + chr(0b11001 + 0o31) + '\x34' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + '\x33' + chr(2564 - 2510) + chr(1714 - 1664), 35676 - 35668), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(54) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(518 - 469) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(651 - 540) + '\063' + '\x35' + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101101 + 0o12) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + '\x33' + chr(0b110101) + chr(2178 - 2128), 55688 - 55680), ehT0Px3KOsy9(chr(0b110000) + chr(8116 - 8005) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(6503 - 6392) + chr(0b110011) + '\x31', 26222 - 26214), ehT0Px3KOsy9('\060' + '\x6f' + '\x36', 18854 - 18846), ehT0Px3KOsy9('\x30' + chr(0b1101011 + 0o4) + '\x33' + chr(1924 - 1871), 22891 - 22883), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\060' + chr(0b10000 + 0o40), 53604 - 53596), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32', 33517 - 33509), ehT0Px3KOsy9(chr(1504 - 1456) + chr(0b1101111) + chr(50) + chr(1335 - 1283) + chr(0b110001 + 0o0), 64923 - 64915), ehT0Px3KOsy9('\x30' + chr(5595 - 5484) + chr(1478 - 1429) + chr(0b1001 + 0o51) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b110101) + chr(1872 - 1822), 10976 - 10968), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\065', 0o10), ehT0Px3KOsy9(chr(798 - 750) + '\157' + chr(0b11100 + 0o26) + '\060' + chr(0b100 + 0o60), 53773 - 53765), ehT0Px3KOsy9(chr(73 - 25) + '\157' + chr(2478 - 2428) + '\x37', 59306 - 59298), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(6572 - 6461) + chr(0b10001 + 0o45) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + chr(0b100001 + 0o20) + chr(51), 52018 - 52010), ehT0Px3KOsy9(chr(2271 - 2223) + chr(111) + chr(0b10110 + 0o33) + chr(0b10 + 0o60) + chr(52), 8), ehT0Px3KOsy9(chr(2152 - 2104) + chr(0b1101111) + chr(50) + chr(0b110111) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(970 - 922) + '\x6f' + chr(0b11101 + 0o26) + '\x33' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(49) + chr(0b10101 + 0o40), 30498 - 30490), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b100011 + 0o15) + chr(0b1000 + 0o55), 51906 - 51898), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + '\063' + '\x30' + chr(1841 - 1789), 40860 - 40852), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(48) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b110010) + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(4877 - 4766) + chr(761 - 712) + chr(616 - 566) + chr(0b110000), 3779 - 3771), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(0b110001) + '\x36' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10010 + 0o44) + chr(0b100 + 0o62), 6056 - 6048), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1101 + 0o45) + chr(54) + chr(0b1001 + 0o54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6212 - 6101) + chr(945 - 894) + '\061' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\062' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(0b110100) + chr(294 - 241), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(49) + chr(0b11001 + 0o27) + '\060', 8), ehT0Px3KOsy9(chr(48) + chr(0b1011 + 0o144) + chr(189 - 140) + chr(0b110001) + chr(52 - 4), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + '\x31' + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(2164 - 2113) + chr(48) + chr(51), 52073 - 52065)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110 + 0o57) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x88'), '\x64' + chr(101) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(101))('\x75' + '\164' + chr(0b1010110 + 0o20) + '\055' + chr(1296 - 1240)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Aty4lY2K7XPK(vXoupepMtCXU, deybX8NJ0oEI, NOWUhJWuP8qU, LSFUU2kbEKFn=(ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8)), SS26PoJvFOCx=(ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + '\061', 8), ehT0Px3KOsy9('\060' + chr(9588 - 9477) + chr(0b11101 + 0o24), 8)), TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b'\xea\xb7\xb6Z'), chr(5877 - 5777) + chr(0b1100101) + chr(0b1100011) + '\157' + '\x64' + chr(0b101110 + 0o67))(chr(0b1010011 + 0o42) + '\164' + chr(102) + '\055' + chr(0b111000)), UyiM64E6iSsw=None, ag0mwEgWzjYv=0.0, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\x93\x82g\x8e_\x86fFu~/r\xc4'), '\144' + '\x65' + chr(99) + chr(0b1101111) + chr(5000 - 4900) + chr(0b1100101))(chr(0b1110101) + chr(2856 - 2740) + chr(102) + '\x2d' + chr(0b111000)))(AIvJRzLdDfgF, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\x97\x80m\x80S\x9c\\kcq5]\xd21\x1an\xebyF'), '\x64' + '\145' + chr(9712 - 9613) + chr(11056 - 10945) + chr(0b1100011 + 0o1) + '\145')('\165' + chr(1514 - 1398) + '\146' + '\055' + chr(0b100000 + 0o30)), [vXoupepMtCXU]):
vXoupepMtCXU = VtaS6yNFbbaq(vXoupepMtCXU, LSFUU2kbEKFn, UyiM64E6iSsw)
if xafqLlk3kkUe(vXoupepMtCXU.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\x96\x99c\x9c'), '\144' + chr(9039 - 8938) + chr(6281 - 6182) + '\x6f' + chr(100) + chr(101))(chr(0b1110101) + '\164' + '\x66' + chr(0b10000 + 0o35) + chr(56))) == ehT0Px3KOsy9('\x30' + chr(111) + chr(51), 8):
p8BacLm7v9ND = ehT0Px3KOsy9(chr(218 - 170) + chr(111) + chr(0b101100 + 0o5), 8)
vXoupepMtCXU = IDJ2eXGCBCDu.expand_dims(vXoupepMtCXU, ehT0Px3KOsy9('\060' + '\x6f' + chr(1376 - 1326), 8))
else:
p8BacLm7v9ND = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(48), 55844 - 55836)
sz4HVsFVF8nL = lTpasN2UxYY3(vXoupepMtCXU, deybX8NJ0oEI, LSFUU2kbEKFn, activation=IDJ2eXGCBCDu.nn.relu, padding=TFLseEYASEKG, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\x9d\x9ex\xde'), chr(0b111100 + 0o50) + chr(101) + chr(99) + '\x6f' + '\144' + chr(0b1100101))('\165' + chr(116) + '\x66' + chr(661 - 616) + '\070'))
if ag0mwEgWzjYv != 0.0:
sz4HVsFVF8nL = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(sz4HVsFVF8nL, 1.0 - ag0mwEgWzjYv)
sz4HVsFVF8nL = VtaS6yNFbbaq(sz4HVsFVF8nL, SS26PoJvFOCx, UyiM64E6iSsw)
VHn4CV4Ymrei = lTpasN2UxYY3(sz4HVsFVF8nL, NOWUhJWuP8qU, SS26PoJvFOCx, padding=TFLseEYASEKG, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\x9d\x9ex\xdd'), chr(0b1100100) + chr(101) + chr(2307 - 2208) + chr(0b1101111) + chr(100) + '\x65')('\x75' + '\x74' + '\x66' + chr(0b101101) + chr(56)))
if p8BacLm7v9ND:
VHn4CV4Ymrei = IDJ2eXGCBCDu.squeeze(VHn4CV4Ymrei, ehT0Px3KOsy9(chr(48) + '\157' + '\062', 8))
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_hidden_relu
|
def conv_hidden_relu(inputs,
hidden_size,
output_size,
kernel_size=(1, 1),
second_kernel_size=(1, 1),
dropout=0.0,
**kwargs):
"""Hidden layer with RELU activation followed by linear projection."""
name = kwargs.pop("name") if "name" in kwargs else None
with tf.variable_scope(name, "conv_hidden_relu", [inputs]):
if inputs.get_shape().ndims == 3:
is_3d = True
inputs = tf.expand_dims(inputs, 2)
else:
is_3d = False
conv_f1 = conv if kernel_size == (1, 1) else separable_conv
h = conv_f1(
inputs,
hidden_size,
kernel_size,
activation=tf.nn.relu,
name="conv1",
**kwargs)
if dropout != 0.0:
h = tf.nn.dropout(h, 1.0 - dropout)
conv_f2 = conv if second_kernel_size == (1, 1) else separable_conv
ret = conv_f2(h, output_size, second_kernel_size, name="conv2", **kwargs)
if is_3d:
ret = tf.squeeze(ret, 2)
return ret
|
python
|
def conv_hidden_relu(inputs,
hidden_size,
output_size,
kernel_size=(1, 1),
second_kernel_size=(1, 1),
dropout=0.0,
**kwargs):
"""Hidden layer with RELU activation followed by linear projection."""
name = kwargs.pop("name") if "name" in kwargs else None
with tf.variable_scope(name, "conv_hidden_relu", [inputs]):
if inputs.get_shape().ndims == 3:
is_3d = True
inputs = tf.expand_dims(inputs, 2)
else:
is_3d = False
conv_f1 = conv if kernel_size == (1, 1) else separable_conv
h = conv_f1(
inputs,
hidden_size,
kernel_size,
activation=tf.nn.relu,
name="conv1",
**kwargs)
if dropout != 0.0:
h = tf.nn.dropout(h, 1.0 - dropout)
conv_f2 = conv if second_kernel_size == (1, 1) else separable_conv
ret = conv_f2(h, output_size, second_kernel_size, name="conv2", **kwargs)
if is_3d:
ret = tf.squeeze(ret, 2)
return ret
|
[
"def",
"conv_hidden_relu",
"(",
"inputs",
",",
"hidden_size",
",",
"output_size",
",",
"kernel_size",
"=",
"(",
"1",
",",
"1",
")",
",",
"second_kernel_size",
"=",
"(",
"1",
",",
"1",
")",
",",
"dropout",
"=",
"0.0",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"kwargs",
".",
"pop",
"(",
"\"name\"",
")",
"if",
"\"name\"",
"in",
"kwargs",
"else",
"None",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"\"conv_hidden_relu\"",
",",
"[",
"inputs",
"]",
")",
":",
"if",
"inputs",
".",
"get_shape",
"(",
")",
".",
"ndims",
"==",
"3",
":",
"is_3d",
"=",
"True",
"inputs",
"=",
"tf",
".",
"expand_dims",
"(",
"inputs",
",",
"2",
")",
"else",
":",
"is_3d",
"=",
"False",
"conv_f1",
"=",
"conv",
"if",
"kernel_size",
"==",
"(",
"1",
",",
"1",
")",
"else",
"separable_conv",
"h",
"=",
"conv_f1",
"(",
"inputs",
",",
"hidden_size",
",",
"kernel_size",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"name",
"=",
"\"conv1\"",
",",
"*",
"*",
"kwargs",
")",
"if",
"dropout",
"!=",
"0.0",
":",
"h",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"h",
",",
"1.0",
"-",
"dropout",
")",
"conv_f2",
"=",
"conv",
"if",
"second_kernel_size",
"==",
"(",
"1",
",",
"1",
")",
"else",
"separable_conv",
"ret",
"=",
"conv_f2",
"(",
"h",
",",
"output_size",
",",
"second_kernel_size",
",",
"name",
"=",
"\"conv2\"",
",",
"*",
"*",
"kwargs",
")",
"if",
"is_3d",
":",
"ret",
"=",
"tf",
".",
"squeeze",
"(",
"ret",
",",
"2",
")",
"return",
"ret"
] |
Hidden layer with RELU activation followed by linear projection.
|
[
"Hidden",
"layer",
"with",
"RELU",
"activation",
"followed",
"by",
"linear",
"projection",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1420-L1449
|
train
|
Hidden layer with RELU activation followed by linear projection.
|
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,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kIVCGgtAN,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(2166 - 2055) + '\061' + '\064' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + chr(1406 - 1355) + '\066' + chr(0b110110), 59560 - 59552), ehT0Px3KOsy9('\x30' + chr(0b111000 + 0o67) + '\x33' + chr(48) + '\x35', 0b1000), ehT0Px3KOsy9(chr(570 - 522) + chr(0b1101111) + chr(0b110010) + chr(0b110100) + '\x32', 0o10), ehT0Px3KOsy9(chr(275 - 227) + chr(111) + chr(0b10111 + 0o33) + chr(0b110010) + chr(0b1011 + 0o47), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(682 - 633) + chr(0b110001) + chr(1609 - 1556), 0o10), ehT0Px3KOsy9('\x30' + chr(3734 - 3623) + chr(0b1010 + 0o50) + chr(0b1001 + 0o55) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(1509 - 1458), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x37' + '\x36', 42850 - 42842), ehT0Px3KOsy9(chr(0b110000) + chr(10838 - 10727) + chr(0b1 + 0o60) + chr(0b110100) + chr(0b100 + 0o55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x35' + '\x36', 19808 - 19800), ehT0Px3KOsy9(chr(48) + chr(9688 - 9577) + '\063' + chr(0b110010) + chr(52), 6002 - 5994), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(0b1100 + 0o45) + chr(0b10010 + 0o45) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(50) + chr(0b110011) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(0b110011 + 0o0) + chr(55), 0o10), ehT0Px3KOsy9(chr(2118 - 2070) + chr(0b1101111) + '\063' + chr(1120 - 1072) + chr(55), 29063 - 29055), ehT0Px3KOsy9(chr(0b110000) + chr(6302 - 6191) + chr(0b0 + 0o62) + chr(0b1111 + 0o43) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(52) + '\064', 0b1000), ehT0Px3KOsy9(chr(142 - 94) + '\157' + '\061' + chr(0b110001) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + '\062' + chr(0b110101) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(3405 - 3294) + '\063' + chr(1066 - 1015), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(1933 - 1884) + chr(54) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(55) + chr(54), 8), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + '\x32' + '\062' + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x37' + '\x31', 0o10), ehT0Px3KOsy9(chr(1091 - 1043) + '\157' + chr(50) + chr(0b100110 + 0o13) + chr(0b101101 + 0o4), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b1 + 0o60), 39624 - 39616), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\063' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + '\x32' + chr(2546 - 2494) + '\x32', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b1100 + 0o50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(902 - 849), 517 - 509), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(48) + '\x30', 554 - 546), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(453 - 404) + chr(51), 19019 - 19011), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(5357 - 5246) + chr(0b1011 + 0o46) + '\x32' + chr(1352 - 1300), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2170 - 2121) + '\x32' + '\066', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\x32' + '\067', 20152 - 20144), ehT0Px3KOsy9(chr(1526 - 1478) + chr(0b1101111) + chr(53) + chr(2249 - 2194), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10055 - 9944) + chr(0b110010) + chr(48) + '\063', 0b1000), ehT0Px3KOsy9(chr(1843 - 1795) + '\157' + chr(0b110001) + chr(50) + chr(51), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'N'), chr(9757 - 9657) + '\x65' + chr(5394 - 5295) + chr(111) + '\144' + chr(10034 - 9933))(chr(117) + chr(116) + chr(102) + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Qpoj_xPSywPr(vXoupepMtCXU, qzoyXN3kdhDL, NOWUhJWuP8qU, m6gwVXy4D3Au=(ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1110 + 0o43), 8), ehT0Px3KOsy9('\060' + chr(6332 - 6221) + chr(1561 - 1512), 8)), SS26PoJvFOCx=(ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(10860 - 10749) + chr(1661 - 1612), 8), ehT0Px3KOsy9(chr(48) + chr(11169 - 11058) + '\x31', 8)), ag0mwEgWzjYv=0.0, **M8EIoTs2GJXE):
AIvJRzLdDfgF = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\x97\xa8\xc7'), '\144' + '\x65' + chr(0b1100011) + chr(111) + chr(9935 - 9835) + '\145')('\x75' + chr(11984 - 11868) + chr(0b1100110) + '\055' + '\x38')) if xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\x97\xa8\xc7'), chr(3251 - 3151) + chr(0b1100101) + chr(99) + '\x6f' + '\x64' + chr(0b1100101))('\x75' + '\164' + chr(6139 - 6037) + chr(1105 - 1060) + chr(56)) in M8EIoTs2GJXE else None
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x16\x97\xb7\xcb\xf3/\xdav!\x12M\xbb\t\xfd'), chr(6837 - 6737) + '\x65' + chr(0b1011000 + 0o13) + '\157' + chr(0b100000 + 0o104) + chr(0b1100101))(chr(13057 - 12940) + chr(0b1011111 + 0o25) + '\146' + '\055' + chr(0b11100 + 0o34)))(AIvJRzLdDfgF, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x99\xab\xd4\xcd%\xdfw\x1a\x04@\x8b\x0b\xfds\xb2'), '\x64' + chr(0b11001 + 0o114) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(4926 - 4825))(chr(4065 - 3948) + chr(13171 - 13055) + '\x66' + '\x2d' + chr(56)), [vXoupepMtCXU]):
if xafqLlk3kkUe(vXoupepMtCXU.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\x92\xac\xcf\xe1'), '\x64' + chr(1996 - 1895) + '\143' + '\157' + '\144' + chr(4167 - 4066))('\165' + chr(9610 - 9494) + '\x66' + '\055' + chr(0b11001 + 0o37))) == ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1604 - 1553), 11711 - 11703):
p8BacLm7v9ND = ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1011010 + 0o25) + chr(0b100010 + 0o17), 8)
vXoupepMtCXU = IDJ2eXGCBCDu.expand_dims(vXoupepMtCXU, ehT0Px3KOsy9('\060' + '\x6f' + '\062', 5396 - 5388))
else:
p8BacLm7v9ND = ehT0Px3KOsy9('\060' + '\157' + chr(48), 58472 - 58464)
IfuUvqZ9_rCq = m1sWr00SVpVY if m6gwVXy4D3Au == (ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1001 + 0o50), 8)) else lTpasN2UxYY3
sz4HVsFVF8nL = IfuUvqZ9_rCq(vXoupepMtCXU, qzoyXN3kdhDL, m6gwVXy4D3Au, activation=IDJ2eXGCBCDu.nn.relu, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x99\xab\xd4\xa3'), '\x64' + chr(1890 - 1789) + chr(539 - 440) + chr(0b1101111) + '\144' + chr(101))('\165' + '\164' + chr(102) + '\055' + '\070'), **M8EIoTs2GJXE)
if ag0mwEgWzjYv != 0.0:
sz4HVsFVF8nL = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(sz4HVsFVF8nL, 1.0 - ag0mwEgWzjYv)
u9UIokAvQ1BF = m1sWr00SVpVY if SS26PoJvFOCx == (ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\061', 8)) else lTpasN2UxYY3
VHn4CV4Ymrei = u9UIokAvQ1BF(sz4HVsFVF8nL, NOWUhJWuP8qU, SS26PoJvFOCx, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x99\xab\xd4\xa0'), '\144' + chr(4910 - 4809) + '\143' + chr(10432 - 10321) + chr(100) + chr(3878 - 3777))('\x75' + '\164' + '\146' + chr(0b11011 + 0o22) + '\x38'), **M8EIoTs2GJXE)
if p8BacLm7v9ND:
VHn4CV4Ymrei = IDJ2eXGCBCDu.squeeze(VHn4CV4Ymrei, ehT0Px3KOsy9(chr(0b110000) + chr(0b11011 + 0o124) + '\x32', 8))
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_gru
|
def conv_gru(x,
kernel_size,
filters,
padding="SAME",
dilation_rate=(1, 1),
name=None,
reuse=None):
"""Convolutional GRU in 1 dimension."""
# Let's make a shorthand for conv call first.
def do_conv(args, name, bias_start, padding):
return conv(
args,
filters,
kernel_size,
padding=padding,
dilation_rate=dilation_rate,
bias_initializer=tf.constant_initializer(bias_start),
name=name)
# Here comes the GRU gate.
with tf.variable_scope(
name, default_name="conv_gru", values=[x], reuse=reuse):
reset = saturating_sigmoid(do_conv(x, "reset", 1.0, padding))
gate = saturating_sigmoid(do_conv(x, "gate", 1.0, padding))
candidate = tf.tanh(do_conv(reset * x, "candidate", 0.0, padding))
return gate * x + (1 - gate) * candidate
|
python
|
def conv_gru(x,
kernel_size,
filters,
padding="SAME",
dilation_rate=(1, 1),
name=None,
reuse=None):
"""Convolutional GRU in 1 dimension."""
# Let's make a shorthand for conv call first.
def do_conv(args, name, bias_start, padding):
return conv(
args,
filters,
kernel_size,
padding=padding,
dilation_rate=dilation_rate,
bias_initializer=tf.constant_initializer(bias_start),
name=name)
# Here comes the GRU gate.
with tf.variable_scope(
name, default_name="conv_gru", values=[x], reuse=reuse):
reset = saturating_sigmoid(do_conv(x, "reset", 1.0, padding))
gate = saturating_sigmoid(do_conv(x, "gate", 1.0, padding))
candidate = tf.tanh(do_conv(reset * x, "candidate", 0.0, padding))
return gate * x + (1 - gate) * candidate
|
[
"def",
"conv_gru",
"(",
"x",
",",
"kernel_size",
",",
"filters",
",",
"padding",
"=",
"\"SAME\"",
",",
"dilation_rate",
"=",
"(",
"1",
",",
"1",
")",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"# Let's make a shorthand for conv call first.",
"def",
"do_conv",
"(",
"args",
",",
"name",
",",
"bias_start",
",",
"padding",
")",
":",
"return",
"conv",
"(",
"args",
",",
"filters",
",",
"kernel_size",
",",
"padding",
"=",
"padding",
",",
"dilation_rate",
"=",
"dilation_rate",
",",
"bias_initializer",
"=",
"tf",
".",
"constant_initializer",
"(",
"bias_start",
")",
",",
"name",
"=",
"name",
")",
"# Here comes the GRU gate.",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"conv_gru\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"reset",
"=",
"saturating_sigmoid",
"(",
"do_conv",
"(",
"x",
",",
"\"reset\"",
",",
"1.0",
",",
"padding",
")",
")",
"gate",
"=",
"saturating_sigmoid",
"(",
"do_conv",
"(",
"x",
",",
"\"gate\"",
",",
"1.0",
",",
"padding",
")",
")",
"candidate",
"=",
"tf",
".",
"tanh",
"(",
"do_conv",
"(",
"reset",
"*",
"x",
",",
"\"candidate\"",
",",
"0.0",
",",
"padding",
")",
")",
"return",
"gate",
"*",
"x",
"+",
"(",
"1",
"-",
"gate",
")",
"*",
"candidate"
] |
Convolutional GRU in 1 dimension.
|
[
"Convolutional",
"GRU",
"in",
"1",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1452-L1478
|
train
|
Convolutional GRU in 1 dimension.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM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pdIe,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' + '\x6f' + chr(49) + '\x35' + chr(52), 40938 - 40930), ehT0Px3KOsy9('\x30' + chr(10805 - 10694) + '\063' + chr(0b11110 + 0o30) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101101 + 0o2) + '\063' + chr(0b110000) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1879 - 1829) + chr(0b101111 + 0o3), 0b1000), ehT0Px3KOsy9('\060' + chr(6929 - 6818) + '\x35' + chr(0b101 + 0o54), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(54) + chr(49), 0o10), ehT0Px3KOsy9(chr(1027 - 979) + '\157' + chr(0b110010) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(0b110000) + '\x31', 22202 - 22194), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(0b110100) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(0b110000 + 0o1) + chr(55) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(8521 - 8410) + chr(51) + chr(71 - 16), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(51) + chr(0b1 + 0o65) + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1153 - 1103) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x30' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b10011 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b100111 + 0o110) + '\x31' + chr(0b110100) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10110 + 0o33) + chr(0b110000) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(2384 - 2335) + chr(0b110110), 35845 - 35837), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111) + chr(702 - 650), 44214 - 44206), ehT0Px3KOsy9('\060' + chr(111) + chr(2442 - 2391) + chr(0b110100) + chr(0b110000), 6385 - 6377), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2294 - 2245) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(559 - 508) + chr(0b11010 + 0o27) + chr(0b110100 + 0o1), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x37' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3148 - 3037) + chr(0b110010) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + chr(0b11101 + 0o25) + chr(0b110110) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\x34' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(1148 - 1100) + chr(0b101011 + 0o104) + '\063' + chr(0b101001 + 0o11) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(48) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(48) + chr(0b101001 + 0o16), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(8417 - 8306) + chr(55 - 4) + chr(0b110110) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(1238 - 1188) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110110) + chr(0b11111 + 0o25), 25975 - 25967), ehT0Px3KOsy9(chr(592 - 544) + chr(187 - 76) + chr(2218 - 2168) + chr(53) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(761 - 712) + chr(50), 0b1000), ehT0Px3KOsy9(chr(843 - 795) + chr(111) + '\063' + '\x30', 41626 - 41618), ehT0Px3KOsy9(chr(1783 - 1735) + chr(7668 - 7557) + chr(312 - 262) + chr(248 - 200) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b1110 + 0o45) + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + chr(0b1001 + 0o51) + chr(0b110110) + chr(57 - 3), 28969 - 28961), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1585 - 1533) + chr(51), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + chr(53) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'B'), chr(0b1100100) + '\145' + '\x63' + chr(0b1010100 + 0o33) + chr(100) + chr(0b1000101 + 0o40))(chr(117) + chr(116) + '\146' + '\x2d' + chr(2740 - 2684)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def YljGhV7CBI0M(OeWW0F1dBPRQ, m6gwVXy4D3Au, MErh319F3bgE, TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b'?\xb6\x8bW'), chr(0b1100100) + '\x65' + chr(4959 - 4860) + chr(111) + chr(100) + chr(101))(chr(117) + chr(0b1100001 + 0o23) + chr(102) + '\x2d' + chr(0b111000)), Rm2KgSQziMI2=(ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001), 8)), AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
def IbWyjtRsGqDg(kJDRfRhcZHjS, AIvJRzLdDfgF, x8Wk87Fh7ykS, TFLseEYASEKG):
return m1sWr00SVpVY(kJDRfRhcZHjS, MErh319F3bgE, m6gwVXy4D3Au, padding=TFLseEYASEKG, dilation_rate=Rm2KgSQziMI2, bias_initializer=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\x98\xa8a]\x90~\xb5\xb8\x15q\x9a`\xaek\x0c-\xf4Y\x92'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(101))(chr(5950 - 5833) + '\x74' + '\146' + chr(621 - 576) + chr(1637 - 1581)))(x8Wk87Fh7ykS), name=AIvJRzLdDfgF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a\x96\xb4{H\x93|\xa4\xb8\x0f|\x9cd\xa2'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(111) + '\x64' + chr(101))('\165' + '\x74' + chr(7679 - 7577) + chr(1741 - 1696) + chr(56)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\x98\xa8dv\x96b\xb4'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(4921 - 4810) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b101011 + 0o111) + chr(0b101111 + 0o67) + chr(0b11001 + 0o24) + '\x38'), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
G0V856pwkJmZ = ZFSA0QNhg0Rd(IbWyjtRsGqDg(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e\x92\xb5w]'), chr(0b1100100) + chr(6194 - 6093) + chr(8442 - 8343) + chr(0b1100110 + 0o11) + '\x64' + chr(101))(chr(0b1110101) + chr(3116 - 3000) + chr(102) + chr(0b100111 + 0o6) + chr(1613 - 1557)), 1.0, TFLseEYASEKG))
EyiYChu32b7v = ZFSA0QNhg0Rd(IbWyjtRsGqDg(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\x96\xb2w'), chr(100) + chr(101) + '\x63' + '\x6f' + chr(0b110110 + 0o56) + chr(0b1100101))(chr(0b1110101) + chr(116) + '\x66' + chr(45) + chr(0b111000)), 1.0, TFLseEYASEKG))
X3DOc7TuFLS2 = IDJ2eXGCBCDu.tanh(IbWyjtRsGqDg(G0V856pwkJmZ * OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\x96\xa8v@\x95q\xb5\x82'), '\x64' + chr(6739 - 6638) + chr(99) + chr(0b1101111) + '\x64' + '\145')(chr(0b1110101) + chr(116) + chr(102) + chr(0b101101) + chr(0b111000)), 0.0, TFLseEYASEKG))
return EyiYChu32b7v * OeWW0F1dBPRQ + (ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31', 8) - EyiYChu32b7v) * X3DOc7TuFLS2
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
gru_feedfwd
|
def gru_feedfwd(a_t, h_prev, filters, name=None):
"""position-wise Feed-fwd GRU gates following the MPNN.
Args:
a_t: Tensor of shape [batch, length, depth] of current input
h_prev: Tensor of shape [batch, length, depth] of prev input
filters: an integer specifying number of dimensions of the filters
name: A string
Returns:
h_t: [batch, length, filters] hidden state
"""
with tf.variable_scope(name, default_name="GRU", values=[a_t, h_prev]):
# we use right matrix multiplication to handle batches
# W_z and W_r have shape 2d, d. U_z U_r have shape d,d
z_t = (
tf.sigmoid(
tpu_conv1d(a_t, filters, 1, padding="SAME", name="W_z") +
tpu_conv1d(h_prev, filters, 1, padding="SAME", name="U_z")))
r_t = (
tf.sigmoid(
tpu_conv1d(a_t, filters, 1, padding="SAME", name="W_r") +
tpu_conv1d(h_prev, filters, 1, padding="SAME", name="U_r")))
h_tilde = (
tf.tanh(
tpu_conv1d(a_t, filters, 1, padding="SAME", name="W") +
tpu_conv1d(r_t * h_prev, filters, 1, padding="SAME", name="U")))
h_t = (1. - z_t) * h_prev + z_t * h_tilde
return h_t
|
python
|
def gru_feedfwd(a_t, h_prev, filters, name=None):
"""position-wise Feed-fwd GRU gates following the MPNN.
Args:
a_t: Tensor of shape [batch, length, depth] of current input
h_prev: Tensor of shape [batch, length, depth] of prev input
filters: an integer specifying number of dimensions of the filters
name: A string
Returns:
h_t: [batch, length, filters] hidden state
"""
with tf.variable_scope(name, default_name="GRU", values=[a_t, h_prev]):
# we use right matrix multiplication to handle batches
# W_z and W_r have shape 2d, d. U_z U_r have shape d,d
z_t = (
tf.sigmoid(
tpu_conv1d(a_t, filters, 1, padding="SAME", name="W_z") +
tpu_conv1d(h_prev, filters, 1, padding="SAME", name="U_z")))
r_t = (
tf.sigmoid(
tpu_conv1d(a_t, filters, 1, padding="SAME", name="W_r") +
tpu_conv1d(h_prev, filters, 1, padding="SAME", name="U_r")))
h_tilde = (
tf.tanh(
tpu_conv1d(a_t, filters, 1, padding="SAME", name="W") +
tpu_conv1d(r_t * h_prev, filters, 1, padding="SAME", name="U")))
h_t = (1. - z_t) * h_prev + z_t * h_tilde
return h_t
|
[
"def",
"gru_feedfwd",
"(",
"a_t",
",",
"h_prev",
",",
"filters",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"GRU\"",
",",
"values",
"=",
"[",
"a_t",
",",
"h_prev",
"]",
")",
":",
"# we use right matrix multiplication to handle batches",
"# W_z and W_r have shape 2d, d. U_z U_r have shape d,d",
"z_t",
"=",
"(",
"tf",
".",
"sigmoid",
"(",
"tpu_conv1d",
"(",
"a_t",
",",
"filters",
",",
"1",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"W_z\"",
")",
"+",
"tpu_conv1d",
"(",
"h_prev",
",",
"filters",
",",
"1",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"U_z\"",
")",
")",
")",
"r_t",
"=",
"(",
"tf",
".",
"sigmoid",
"(",
"tpu_conv1d",
"(",
"a_t",
",",
"filters",
",",
"1",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"W_r\"",
")",
"+",
"tpu_conv1d",
"(",
"h_prev",
",",
"filters",
",",
"1",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"U_r\"",
")",
")",
")",
"h_tilde",
"=",
"(",
"tf",
".",
"tanh",
"(",
"tpu_conv1d",
"(",
"a_t",
",",
"filters",
",",
"1",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"W\"",
")",
"+",
"tpu_conv1d",
"(",
"r_t",
"*",
"h_prev",
",",
"filters",
",",
"1",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"U\"",
")",
")",
")",
"h_t",
"=",
"(",
"1.",
"-",
"z_t",
")",
"*",
"h_prev",
"+",
"z_t",
"*",
"h_tilde",
"return",
"h_t"
] |
position-wise Feed-fwd GRU gates following the MPNN.
Args:
a_t: Tensor of shape [batch, length, depth] of current input
h_prev: Tensor of shape [batch, length, depth] of prev input
filters: an integer specifying number of dimensions of the filters
name: A string
Returns:
h_t: [batch, length, filters] hidden state
|
[
"position",
"-",
"wise",
"Feed",
"-",
"fwd",
"GRU",
"gates",
"following",
"the",
"MPNN",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1481-L1510
|
train
|
position - wise Feed - fwd GRU gates following MPNN.
|
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,OTst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tpXu4lf,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(0b101 + 0o53) + chr(0b1101111) + chr(0b110010 + 0o1) + '\x31', 46630 - 46622), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(351 - 301) + chr(54) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(895 - 846) + '\061', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10100 + 0o36) + chr(0b1111 + 0o42), 0o10), ehT0Px3KOsy9(chr(1099 - 1051) + chr(9908 - 9797) + chr(50) + chr(1216 - 1167) + chr(0b100011 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(2300 - 2252) + chr(9641 - 9530) + '\061' + chr(2756 - 2701) + chr(753 - 700), 0b1000), ehT0Px3KOsy9(chr(1597 - 1549) + chr(2287 - 2176) + chr(50) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + chr(0b101 + 0o55) + chr(2132 - 2080) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010110 + 0o31) + '\x32' + chr(0b100010 + 0o23) + chr(50), 42102 - 42094), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(489 - 378) + chr(51) + chr(49) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(0b110010) + chr(377 - 327), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(284 - 173) + '\x31' + '\065' + chr(2499 - 2444), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b110010) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1335 - 1281) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(2250 - 2202) + chr(111) + chr(50) + chr(0b110011) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001001 + 0o46) + chr(1891 - 1842) + '\060', 0b1000), ehT0Px3KOsy9(chr(1466 - 1418) + '\x6f' + '\063' + '\x35' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111 + 0o0) + chr(51) + chr(322 - 268) + chr(0b101001 + 0o12), 0o10), ehT0Px3KOsy9('\060' + chr(0b11110 + 0o121) + chr(0b110011) + chr(2569 - 2515) + chr(2197 - 2147), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b1011 + 0o45) + chr(0b110001 + 0o1), ord("\x08")), ehT0Px3KOsy9(chr(967 - 919) + '\157' + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2574 - 2463) + chr(0b110001) + chr(0b110011) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(669 - 619) + '\x35' + chr(48), 0o10), ehT0Px3KOsy9(chr(868 - 820) + '\157' + chr(0b110001) + chr(2125 - 2074) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1009 - 898) + chr(51) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(8501 - 8390) + '\063' + chr(51) + chr(1071 - 1016), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b110001) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1899 - 1850) + chr(0b110010), 54571 - 54563), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(48) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b110011) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(250 - 200), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + '\x31' + chr(53) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(8729 - 8618) + chr(0b110011) + '\061', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1697 - 1646) + chr(0b10110 + 0o35), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\066' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + '\063' + chr(0b110100) + chr(2020 - 1966), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11510 - 11399) + chr(1936 - 1887) + chr(55) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(50) + chr(1700 - 1650), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(1319 - 1264) + chr(0b0 + 0o60), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1000000 + 0o57) + chr(0b110101) + chr(0b110000), 65329 - 65321)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'7'), chr(100) + chr(0b1100101) + chr(0b1000101 + 0o36) + chr(0b101011 + 0o104) + chr(0b1100100) + '\x65')('\165' + '\x74' + chr(6647 - 6545) + chr(1426 - 1381) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mUUflPAu3cEd(JsWrVY2lCwLb, YQSH_qEI7_gm, MErh319F3bgE, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'o\xd7{x\xeb\x1f\x7f\xc5\xf5\xbdq\x00\xe7P'), chr(6618 - 6518) + chr(0b1011111 + 0o6) + chr(99) + chr(111) + '\144' + chr(0b101110 + 0o67))(chr(0b1100111 + 0o16) + chr(12455 - 12339) + chr(0b1100110) + '\055' + chr(0b111000)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'^\xe4\\'), chr(0b1100 + 0o130) + chr(101) + chr(0b1100011) + chr(10327 - 10216) + chr(1085 - 985) + '\x65')(chr(2318 - 2201) + chr(1296 - 1180) + chr(0b1100110) + chr(0b101101) + '\070'), values=[JsWrVY2lCwLb, YQSH_qEI7_gm]):
WPgWmDLGr2x_ = IDJ2eXGCBCDu.sigmoid(o1rZz41nLKdE(JsWrVY2lCwLb, MErh319F3bgE, ehT0Px3KOsy9(chr(1698 - 1650) + chr(111) + chr(0b1011 + 0o46), 0o10), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'J\xf7DT'), chr(9194 - 9094) + chr(0b1100101) + '\143' + '\157' + chr(5084 - 4984) + chr(4550 - 4449))(chr(0b100000 + 0o125) + chr(0b1110100) + chr(0b1100110) + chr(942 - 897) + chr(0b111000)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'N\xe9s'), chr(0b1100100) + chr(0b1010101 + 0o20) + '\x63' + chr(656 - 545) + '\x64' + chr(2787 - 2686))(chr(0b1 + 0o164) + chr(5118 - 5002) + chr(1660 - 1558) + chr(45) + '\x38')) + o1rZz41nLKdE(YQSH_qEI7_gm, MErh319F3bgE, ehT0Px3KOsy9(chr(48) + chr(111) + chr(49), 8), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'J\xf7DT'), chr(9774 - 9674) + '\145' + '\143' + chr(0b1000110 + 0o51) + chr(0b1100100) + chr(101))(chr(117) + chr(116) + chr(102) + chr(0b101101) + chr(0b111000)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'L\xe9s'), chr(0b111110 + 0o46) + '\145' + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b11001 + 0o114))('\x75' + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(0b111000))))
_oVTHFogkrwb = IDJ2eXGCBCDu.sigmoid(o1rZz41nLKdE(JsWrVY2lCwLb, MErh319F3bgE, ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11010 + 0o27), 8), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'J\xf7DT'), '\144' + chr(0b1100101) + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(116) + '\x66' + chr(0b101101 + 0o0) + chr(0b111000)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'N\xe9{'), chr(100) + '\145' + chr(99) + '\157' + chr(0b1100100) + chr(542 - 441))('\165' + '\x74' + chr(6175 - 6073) + '\x2d' + chr(0b111000))) + o1rZz41nLKdE(YQSH_qEI7_gm, MErh319F3bgE, ehT0Px3KOsy9(chr(1093 - 1045) + chr(0b110001 + 0o76) + chr(294 - 245), 8), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'J\xf7DT'), chr(0b1100100) + chr(0b101100 + 0o71) + chr(0b1100011) + chr(0b111011 + 0o64) + '\144' + chr(0b1100101))(chr(11212 - 11095) + '\x74' + chr(0b11011 + 0o113) + '\055' + chr(0b111000)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'L\xe9{'), '\x64' + chr(0b1010110 + 0o17) + chr(0b1100011) + chr(0b1101111) + '\144' + '\x65')('\x75' + chr(116) + chr(0b111011 + 0o53) + '\055' + '\x38')))
LcEBeIMBjXPT = IDJ2eXGCBCDu.tanh(o1rZz41nLKdE(JsWrVY2lCwLb, MErh319F3bgE, ehT0Px3KOsy9(chr(249 - 201) + chr(0b1101111) + chr(49), 8), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'J\xf7DT'), chr(6993 - 6893) + chr(101) + chr(0b1100011) + chr(1006 - 895) + '\144' + chr(0b1010001 + 0o24))(chr(0b10010 + 0o143) + '\164' + '\146' + chr(1226 - 1181) + chr(0b110000 + 0o10)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'N'), '\x64' + '\x65' + chr(99) + chr(0b1100100 + 0o13) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(116) + chr(102) + '\055' + '\070')) + o1rZz41nLKdE(_oVTHFogkrwb * YQSH_qEI7_gm, MErh319F3bgE, ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'J\xf7DT'), chr(100) + chr(0b1100101) + chr(0b1000110 + 0o35) + chr(111) + chr(100) + '\145')(chr(0b1110101) + chr(11698 - 11582) + chr(0b1100110) + chr(45) + chr(1060 - 1004)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'L'), '\144' + chr(2613 - 2512) + '\143' + chr(111) + chr(100) + '\145')('\x75' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(56))))
RMkGeHJoGuwY = (1.0 - WPgWmDLGr2x_) * YQSH_qEI7_gm + WPgWmDLGr2x_ * LcEBeIMBjXPT
return RMkGeHJoGuwY
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_lstm
|
def conv_lstm(x,
kernel_size,
filters,
padding="SAME",
dilation_rate=(1, 1),
name=None,
reuse=None):
"""Convolutional LSTM in 1 dimension."""
with tf.variable_scope(
name, default_name="conv_lstm", values=[x], reuse=reuse):
gates = conv(
x,
4 * filters,
kernel_size,
padding=padding,
dilation_rate=dilation_rate)
g = tf.split(layer_norm(gates, 4 * filters), 4, axis=3)
new_cell = tf.sigmoid(g[0]) * x + tf.sigmoid(g[1]) * tf.tanh(g[3])
return tf.sigmoid(g[2]) * tf.tanh(new_cell)
|
python
|
def conv_lstm(x,
kernel_size,
filters,
padding="SAME",
dilation_rate=(1, 1),
name=None,
reuse=None):
"""Convolutional LSTM in 1 dimension."""
with tf.variable_scope(
name, default_name="conv_lstm", values=[x], reuse=reuse):
gates = conv(
x,
4 * filters,
kernel_size,
padding=padding,
dilation_rate=dilation_rate)
g = tf.split(layer_norm(gates, 4 * filters), 4, axis=3)
new_cell = tf.sigmoid(g[0]) * x + tf.sigmoid(g[1]) * tf.tanh(g[3])
return tf.sigmoid(g[2]) * tf.tanh(new_cell)
|
[
"def",
"conv_lstm",
"(",
"x",
",",
"kernel_size",
",",
"filters",
",",
"padding",
"=",
"\"SAME\"",
",",
"dilation_rate",
"=",
"(",
"1",
",",
"1",
")",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"conv_lstm\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"gates",
"=",
"conv",
"(",
"x",
",",
"4",
"*",
"filters",
",",
"kernel_size",
",",
"padding",
"=",
"padding",
",",
"dilation_rate",
"=",
"dilation_rate",
")",
"g",
"=",
"tf",
".",
"split",
"(",
"layer_norm",
"(",
"gates",
",",
"4",
"*",
"filters",
")",
",",
"4",
",",
"axis",
"=",
"3",
")",
"new_cell",
"=",
"tf",
".",
"sigmoid",
"(",
"g",
"[",
"0",
"]",
")",
"*",
"x",
"+",
"tf",
".",
"sigmoid",
"(",
"g",
"[",
"1",
"]",
")",
"*",
"tf",
".",
"tanh",
"(",
"g",
"[",
"3",
"]",
")",
"return",
"tf",
".",
"sigmoid",
"(",
"g",
"[",
"2",
"]",
")",
"*",
"tf",
".",
"tanh",
"(",
"new_cell",
")"
] |
Convolutional LSTM in 1 dimension.
|
[
"Convolutional",
"LSTM",
"in",
"1",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1513-L1531
|
train
|
Conv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uw0hjv33u,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 + 0o0) + chr(8246 - 8135) + '\x31' + chr(0b11 + 0o61) + '\x35', 7124 - 7116), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1738 - 1688) + '\x33' + chr(0b110110), 62817 - 62809), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\x37' + chr(0b101000 + 0o11), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + chr(50) + '\x34' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(166 - 118) + chr(0b1101111) + chr(0b10011 + 0o43) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(51) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + '\061' + '\066' + '\067', 0o10), ehT0Px3KOsy9(chr(1821 - 1773) + '\157' + '\x31' + '\064' + '\065', 8), ehT0Px3KOsy9('\x30' + chr(10134 - 10023) + '\067' + '\x31', 16938 - 16930), ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + '\x36' + chr(1787 - 1733), 45770 - 45762), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b110001) + chr(1043 - 988), 26698 - 26690), ehT0Px3KOsy9(chr(294 - 246) + chr(0b1101111) + chr(0b110011) + chr(55) + chr(1217 - 1167), ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\x37' + '\062', 0o10), ehT0Px3KOsy9(chr(510 - 462) + chr(0b10001 + 0o136) + chr(0b100011 + 0o17) + chr(48) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(115 - 64) + chr(0b100110 + 0o16) + chr(1155 - 1103), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2284 - 2234) + chr(0b110011 + 0o4) + chr(2435 - 2381), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b10101 + 0o35) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(11078 - 10967) + '\063' + '\062', 27081 - 27073), ehT0Px3KOsy9(chr(48) + chr(2021 - 1910) + '\x32' + chr(49) + '\062', 47642 - 47634), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1697 - 1647) + '\x33' + chr(485 - 436), 30076 - 30068), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(125 - 74) + chr(51), 3714 - 3706), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(0b10101 + 0o36) + chr(50), 0o10), ehT0Px3KOsy9(chr(1492 - 1444) + '\157' + chr(49) + chr(51) + chr(2207 - 2155), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b110010) + chr(0b110111), 8), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + chr(2394 - 2344) + '\061' + chr(50), 8), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(52) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(3554 - 3443) + chr(50) + '\060' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11110 + 0o22), 0o10), ehT0Px3KOsy9(chr(1592 - 1544) + chr(8033 - 7922) + '\x31' + chr(51) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100010 + 0o21) + chr(53) + chr(0b1100 + 0o46), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(174 - 121) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(432 - 380) + chr(0b111 + 0o57), 52077 - 52069), ehT0Px3KOsy9('\x30' + chr(0b1100011 + 0o14) + chr(0b110010) + chr(0b110110) + chr(52), 31173 - 31165), ehT0Px3KOsy9(chr(48) + chr(9304 - 9193) + chr(51) + chr(50) + chr(55), 58244 - 58236), ehT0Px3KOsy9(chr(48) + chr(111) + '\x35' + chr(0b1001 + 0o56), 55749 - 55741), ehT0Px3KOsy9(chr(476 - 428) + chr(111) + '\x33' + chr(0b10000 + 0o46) + '\x35', 34359 - 34351), ehT0Px3KOsy9(chr(1288 - 1240) + '\157' + chr(498 - 448) + '\062' + chr(0b1110 + 0o50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(274 - 223) + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010 + 0o1) + chr(2177 - 2129) + '\x34', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'K'), '\x64' + '\x65' + chr(3541 - 3442) + '\157' + chr(5119 - 5019) + chr(0b1100101))(chr(117) + chr(5597 - 5481) + '\146' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Sgib2TdZ9dLp(OeWW0F1dBPRQ, m6gwVXy4D3Au, MErh319F3bgE, TFLseEYASEKG=xafqLlk3kkUe(SXOLrMavuUCe(b'6\xdf\xf4\xe0'), chr(7617 - 7517) + chr(1343 - 1242) + chr(0b110001 + 0o62) + '\x6f' + chr(2653 - 2553) + '\x65')(chr(10673 - 10556) + chr(0b100101 + 0o117) + chr(102) + chr(1469 - 1424) + '\070'), Rm2KgSQziMI2=(ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(0b100111 + 0o12), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001), 8)), AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x13\xff\xcb\xccV:\x1b\x00fE,\x95J\xe1'), '\144' + chr(101) + chr(0b100100 + 0o77) + chr(111) + chr(0b101100 + 0o70) + chr(5248 - 5147))(chr(0b1001110 + 0o47) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x06\xf1\xd7\xd3h4\x04\x11T'), '\144' + chr(2540 - 2439) + chr(0b10000 + 0o123) + chr(111) + chr(0b110001 + 0o63) + '\x65')(chr(117) + chr(0b1110100) + chr(102) + chr(0b110 + 0o47) + chr(0b111000)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
D5FfJKnAV_lN = m1sWr00SVpVY(OeWW0F1dBPRQ, ehT0Px3KOsy9('\x30' + '\157' + chr(350 - 298), 2508 - 2500) * MErh319F3bgE, m6gwVXy4D3Au, padding=TFLseEYASEKG, dilation_rate=Rm2KgSQziMI2)
RWHpzFEeviFP = IDJ2eXGCBCDu.split(EbVYEOXA2Nzq(D5FfJKnAV_lN, ehT0Px3KOsy9('\x30' + '\157' + '\064', 8) * MErh319F3bgE), ehT0Px3KOsy9(chr(219 - 171) + '\157' + chr(52), 8), axis=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011 + 0o0), 58901 - 58893))
KwbdAtIatHpc = IDJ2eXGCBCDu.sigmoid(RWHpzFEeviFP[ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(48), 8)]) * OeWW0F1dBPRQ + IDJ2eXGCBCDu.sigmoid(RWHpzFEeviFP[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49), 8)]) * IDJ2eXGCBCDu.tanh(RWHpzFEeviFP[ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101000 + 0o13), 8)])
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x16\xf7\xde\xc8X1\x13'), chr(0b1100100) + chr(8424 - 8323) + chr(0b1100011) + chr(0b1010 + 0o145) + chr(4410 - 4310) + chr(0b100001 + 0o104))('\165' + chr(116) + chr(0b11110 + 0o110) + chr(1066 - 1021) + chr(0b0 + 0o70)))(RWHpzFEeviFP[ehT0Px3KOsy9('\x30' + '\x6f' + chr(50), 2862 - 2854)]) * xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x11\xff\xd7\xcd'), '\144' + '\145' + '\x63' + chr(10014 - 9903) + chr(0b1100100) + chr(0b111110 + 0o47))(chr(0b1110101) + chr(9149 - 9033) + '\x66' + chr(1099 - 1054) + '\070'))(KwbdAtIatHpc)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
diagonal_conv_gru
|
def diagonal_conv_gru(x,
kernel_size,
filters,
dropout=0.0,
name=None,
reuse=None):
"""Diagonal Convolutional GRU as in https://arxiv.org/abs/1702.08727."""
# Let's make a shorthand for conv call first.
def do_conv(args, name, bias_start):
return conv(
args,
filters,
kernel_size,
padding="SAME",
bias_initializer=tf.constant_initializer(bias_start),
name=name)
# Here comes the GRU gate.
with tf.variable_scope(
name, default_name="diagonal_conv_gru", values=[x], reuse=reuse):
reset, reset_cost = hard_sigmoid(do_conv(x, "reset", 0.5))
gate, gate_cost = hard_sigmoid(do_conv(x, "gate", 0.7))
candidate = tf.tanh(do_conv(reset * x, "candidate", 0.0))
if dropout > 0.0:
candidate = tf.nn.dropout(candidate, 1.0 - dropout)
# Diagonal shift.
shift_filters = filters // 3
base_filter = ([[0, 1, 0]] * (filters - 2 * shift_filters) +
[[1, 0, 0]] * shift_filters + [[0, 0, 1]] * shift_filters)
shift_filter = tf.constant(np.transpose(base_filter), dtype=tf.float32)
shift_filter = tf.expand_dims(tf.expand_dims(shift_filter, 0), 3)
x_shifted = tf.nn.depthwise_conv2d(
x, shift_filter, [1, 1, 1, 1], padding="SAME")
# Return the gated result and cost.
total_cost_avg = 0.5 * (reset_cost + gate_cost)
return gate * x_shifted + (1 - gate) * candidate, total_cost_avg
|
python
|
def diagonal_conv_gru(x,
kernel_size,
filters,
dropout=0.0,
name=None,
reuse=None):
"""Diagonal Convolutional GRU as in https://arxiv.org/abs/1702.08727."""
# Let's make a shorthand for conv call first.
def do_conv(args, name, bias_start):
return conv(
args,
filters,
kernel_size,
padding="SAME",
bias_initializer=tf.constant_initializer(bias_start),
name=name)
# Here comes the GRU gate.
with tf.variable_scope(
name, default_name="diagonal_conv_gru", values=[x], reuse=reuse):
reset, reset_cost = hard_sigmoid(do_conv(x, "reset", 0.5))
gate, gate_cost = hard_sigmoid(do_conv(x, "gate", 0.7))
candidate = tf.tanh(do_conv(reset * x, "candidate", 0.0))
if dropout > 0.0:
candidate = tf.nn.dropout(candidate, 1.0 - dropout)
# Diagonal shift.
shift_filters = filters // 3
base_filter = ([[0, 1, 0]] * (filters - 2 * shift_filters) +
[[1, 0, 0]] * shift_filters + [[0, 0, 1]] * shift_filters)
shift_filter = tf.constant(np.transpose(base_filter), dtype=tf.float32)
shift_filter = tf.expand_dims(tf.expand_dims(shift_filter, 0), 3)
x_shifted = tf.nn.depthwise_conv2d(
x, shift_filter, [1, 1, 1, 1], padding="SAME")
# Return the gated result and cost.
total_cost_avg = 0.5 * (reset_cost + gate_cost)
return gate * x_shifted + (1 - gate) * candidate, total_cost_avg
|
[
"def",
"diagonal_conv_gru",
"(",
"x",
",",
"kernel_size",
",",
"filters",
",",
"dropout",
"=",
"0.0",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"# Let's make a shorthand for conv call first.",
"def",
"do_conv",
"(",
"args",
",",
"name",
",",
"bias_start",
")",
":",
"return",
"conv",
"(",
"args",
",",
"filters",
",",
"kernel_size",
",",
"padding",
"=",
"\"SAME\"",
",",
"bias_initializer",
"=",
"tf",
".",
"constant_initializer",
"(",
"bias_start",
")",
",",
"name",
"=",
"name",
")",
"# Here comes the GRU gate.",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"diagonal_conv_gru\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"reset",
",",
"reset_cost",
"=",
"hard_sigmoid",
"(",
"do_conv",
"(",
"x",
",",
"\"reset\"",
",",
"0.5",
")",
")",
"gate",
",",
"gate_cost",
"=",
"hard_sigmoid",
"(",
"do_conv",
"(",
"x",
",",
"\"gate\"",
",",
"0.7",
")",
")",
"candidate",
"=",
"tf",
".",
"tanh",
"(",
"do_conv",
"(",
"reset",
"*",
"x",
",",
"\"candidate\"",
",",
"0.0",
")",
")",
"if",
"dropout",
">",
"0.0",
":",
"candidate",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"candidate",
",",
"1.0",
"-",
"dropout",
")",
"# Diagonal shift.",
"shift_filters",
"=",
"filters",
"//",
"3",
"base_filter",
"=",
"(",
"[",
"[",
"0",
",",
"1",
",",
"0",
"]",
"]",
"*",
"(",
"filters",
"-",
"2",
"*",
"shift_filters",
")",
"+",
"[",
"[",
"1",
",",
"0",
",",
"0",
"]",
"]",
"*",
"shift_filters",
"+",
"[",
"[",
"0",
",",
"0",
",",
"1",
"]",
"]",
"*",
"shift_filters",
")",
"shift_filter",
"=",
"tf",
".",
"constant",
"(",
"np",
".",
"transpose",
"(",
"base_filter",
")",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
"shift_filter",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"expand_dims",
"(",
"shift_filter",
",",
"0",
")",
",",
"3",
")",
"x_shifted",
"=",
"tf",
".",
"nn",
".",
"depthwise_conv2d",
"(",
"x",
",",
"shift_filter",
",",
"[",
"1",
",",
"1",
",",
"1",
",",
"1",
"]",
",",
"padding",
"=",
"\"SAME\"",
")",
"# Return the gated result and cost.",
"total_cost_avg",
"=",
"0.5",
"*",
"(",
"reset_cost",
"+",
"gate_cost",
")",
"return",
"gate",
"*",
"x_shifted",
"+",
"(",
"1",
"-",
"gate",
")",
"*",
"candidate",
",",
"total_cost_avg"
] |
Diagonal Convolutional GRU as in https://arxiv.org/abs/1702.08727.
|
[
"Diagonal",
"Convolutional",
"GRU",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1702",
".",
"08727",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1534-L1573
|
train
|
Diagonal Convolutional GRU.
|
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,KOHQGQ8qLDW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rOMsrOC7R_,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(0b1000 + 0o50) + chr(0b111 + 0o150) + chr(2332 - 2280) + '\063', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b1001 + 0o50) + chr(50), 51165 - 51157), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + '\x31' + chr(0b101001 + 0o15), 0b1000), ehT0Px3KOsy9('\x30' + chr(2068 - 1957) + chr(51) + chr(0b110110) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110101) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b1 + 0o65) + '\062', 57386 - 57378), ehT0Px3KOsy9('\060' + chr(0b11100 + 0o123) + '\x31' + chr(0b101011 + 0o5) + chr(0b110010), 38280 - 38272), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000 + 0o2) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(358 - 308) + chr(0b110000) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1640 - 1592) + chr(111) + chr(0b10010 + 0o40) + '\064' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(878 - 830) + chr(0b1101111) + chr(0b1001 + 0o52) + chr(487 - 438) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(2643 - 2591) + chr(840 - 786), 64391 - 64383), ehT0Px3KOsy9('\x30' + chr(0b101110 + 0o101) + chr(49) + chr(52) + chr(0b11000 + 0o32), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2248 - 2198) + chr(0b110101) + chr(0b10000 + 0o42), 59906 - 59898), ehT0Px3KOsy9('\060' + '\157' + chr(0b1111 + 0o42) + '\x35' + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + '\x31' + chr(0b110101) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1783 - 1672) + chr(399 - 349) + chr(972 - 920) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\062' + '\x37' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2232 - 2184) + '\157' + chr(2124 - 2074) + chr(1031 - 979), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + chr(0b110011 + 0o0) + '\x30' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(2227 - 2178) + chr(0b11100 + 0o25) + chr(0b1010 + 0o52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8952 - 8841) + '\064' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(3960 - 3849) + '\061' + '\060' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110100) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110100) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\x35' + '\065', 0o10), ehT0Px3KOsy9(chr(132 - 84) + chr(0b11100 + 0o123) + '\x35' + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b101111 + 0o100) + '\x32' + '\x37' + chr(0b111 + 0o55), 51923 - 51915), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\066' + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x35' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1845 - 1797) + chr(10865 - 10754) + '\064' + chr(0b110100 + 0o3), 52016 - 52008), ehT0Px3KOsy9(chr(1381 - 1333) + chr(0b110010 + 0o75) + chr(0b110010) + chr(1020 - 972) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6891 - 6780) + '\x33' + '\x33' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1010100 + 0o33) + '\063' + '\x31' + '\x33', 0b1000), ehT0Px3KOsy9(chr(1092 - 1044) + '\x6f' + '\x32' + '\x37' + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b100100 + 0o20) + '\065', 8), ehT0Px3KOsy9(chr(1096 - 1048) + '\x6f' + chr(0b110001) + chr(0b10100 + 0o37) + chr(0b0 + 0o61), 62804 - 62796), ehT0Px3KOsy9(chr(448 - 400) + chr(0b1101111) + '\063' + '\063' + '\x32', 27932 - 27924), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(9362 - 9251) + chr(0b11 + 0o56) + chr(48) + chr(53), 51556 - 51548), ehT0Px3KOsy9(chr(806 - 758) + chr(0b1001011 + 0o44) + chr(0b110001) + chr(0b110011 + 0o0) + chr(3022 - 2967), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1811 - 1763) + chr(7935 - 7824) + chr(0b11011 + 0o32) + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\r'), '\144' + '\145' + chr(0b110010 + 0o61) + chr(0b11111 + 0o120) + '\x64' + chr(101))(chr(4181 - 4064) + '\x74' + chr(0b1000110 + 0o40) + chr(0b101101) + chr(0b110110 + 0o2)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def CsXHLqbVE5xS(OeWW0F1dBPRQ, m6gwVXy4D3Au, MErh319F3bgE, ag0mwEgWzjYv=0.0, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
def IbWyjtRsGqDg(kJDRfRhcZHjS, AIvJRzLdDfgF, x8Wk87Fh7ykS):
return m1sWr00SVpVY(kJDRfRhcZHjS, MErh319F3bgE, m6gwVXy4D3Au, padding=xafqLlk3kkUe(SXOLrMavuUCe(b'p\x8bC\xb5'), chr(0b1100100) + '\145' + chr(0b111110 + 0o45) + chr(0b1101111) + '\x64' + '\145')(chr(0b111011 + 0o72) + chr(6076 - 5960) + chr(0b1100110) + '\x2d' + '\070'), bias_initializer=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'@\xa5`\x83\xdb\x13,b\xd8\xcc\xa3\xcf\x16\xc3\x0f\x06\xce\xc1q\xb7'), chr(0b1100100) + '\145' + '\143' + '\157' + chr(100) + chr(2806 - 2705))('\x75' + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(0b111000)))(x8Wk87Fh7ykS), name=AIvJRzLdDfgF)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'U\xab|\x99\xce\x10.s\xd8\xd6\xae\xc9\x12\xcf'), '\x64' + chr(0b1100101) + '\x63' + chr(0b111101 + 0o62) + chr(9642 - 9542) + chr(0b1100101))('\x75' + chr(2906 - 2790) + chr(102) + '\055' + chr(0b111000)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'G\xa3o\x97\xc0\x1c#z\xd8\xc6\xa2\xc8\x14\xf5\t\x18\xd2'), chr(0b1100100) + '\x65' + '\x63' + '\157' + chr(0b1100100) + chr(101))('\165' + '\x74' + chr(102) + '\055' + chr(0b100101 + 0o23)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
(G0V856pwkJmZ, lDVREGmNB76M) = Cb7vlZ4SetoN(IbWyjtRsGqDg(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'Q\xaf}\x95\xdb'), chr(7668 - 7568) + chr(0b1001011 + 0o32) + '\x63' + chr(0b110 + 0o151) + chr(4500 - 4400) + chr(0b101010 + 0o73))(chr(5245 - 5128) + chr(116) + '\x66' + chr(45) + '\x38'), 0.5))
(EyiYChu32b7v, qODgnND4YNfP) = Cb7vlZ4SetoN(IbWyjtRsGqDg(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'D\xabz\x95'), chr(0b1100100) + '\x65' + chr(0b111011 + 0o50) + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(3226 - 3109) + '\x74' + chr(102) + '\x2d' + '\070'), 0.7))
X3DOc7TuFLS2 = IDJ2eXGCBCDu.tanh(IbWyjtRsGqDg(G0V856pwkJmZ * OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'@\xab`\x94\xc6\x16#b\xe2'), chr(3261 - 3161) + chr(101) + '\x63' + chr(0b1000110 + 0o51) + chr(0b1011010 + 0o12) + chr(0b1100101))(chr(0b1110101) + chr(11012 - 10896) + chr(0b1100110) + '\x2d' + '\070'), 0.0))
if ag0mwEgWzjYv > 0.0:
X3DOc7TuFLS2 = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(X3DOc7TuFLS2, 1.0 - ag0mwEgWzjYv)
oWV_nrWNYejv = MErh319F3bgE // ehT0Px3KOsy9('\060' + chr(4961 - 4850) + '\063', 0b1000)
pDFnqUPZuhmT = [[ehT0Px3KOsy9('\x30' + chr(2380 - 2269) + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31', 0o10), ehT0Px3KOsy9('\x30' + chr(0b111000 + 0o67) + '\060', 8)]] * (MErh319F3bgE - ehT0Px3KOsy9(chr(339 - 291) + '\x6f' + chr(2368 - 2318), 0b1000) * oWV_nrWNYejv) + [[ehT0Px3KOsy9('\x30' + chr(111) + chr(1053 - 1004), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + chr(11177 - 11066) + '\060', 8)]] * oWV_nrWNYejv + [[ehT0Px3KOsy9('\x30' + '\x6f' + chr(567 - 519), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(48), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8)]] * oWV_nrWNYejv
U1JllBoHhLIi = IDJ2eXGCBCDu.constant(WqUC3KWvYVup.transpose(pDFnqUPZuhmT), dtype=IDJ2eXGCBCDu.float32)
U1JllBoHhLIi = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.expand_dims(U1JllBoHhLIi, ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + '\x30', 8)), ehT0Px3KOsy9('\060' + chr(4442 - 4331) + '\x33', 8))
FOIGgqKCihvN = IDJ2eXGCBCDu.nn.depthwise_conv2d(OeWW0F1dBPRQ, U1JllBoHhLIi, [ehT0Px3KOsy9(chr(1966 - 1918) + chr(4450 - 4339) + chr(49), 8), ehT0Px3KOsy9('\060' + '\157' + chr(288 - 239), 8), ehT0Px3KOsy9(chr(102 - 54) + chr(0b111111 + 0o60) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(1413 - 1364), 8)], padding=xafqLlk3kkUe(SXOLrMavuUCe(b'p\x8bC\xb5'), chr(0b1001101 + 0o27) + chr(101) + chr(99) + '\x6f' + chr(2225 - 2125) + '\x65')(chr(117) + chr(0b1011001 + 0o33) + '\146' + '\x2d' + chr(2953 - 2897)))
Q320LiL40K5o = 0.5 * (lDVREGmNB76M + qODgnND4YNfP)
return (EyiYChu32b7v * FOIGgqKCihvN + (ehT0Px3KOsy9(chr(1843 - 1795) + chr(3393 - 3282) + '\x31', 8) - EyiYChu32b7v) * X3DOc7TuFLS2, Q320LiL40K5o)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
pad_to_same_length
|
def pad_to_same_length(x, y, final_length_divisible_by=1, axis=1):
"""Pad tensors x and y on axis 1 so that they have the same length."""
if axis not in [1, 2]:
raise ValueError("Only axis=1 and axis=2 supported for now.")
with tf.name_scope("pad_to_same_length", values=[x, y]):
x_length = shape_list(x)[axis]
y_length = shape_list(y)[axis]
if (isinstance(x_length, int) and isinstance(y_length, int) and
x_length == y_length and final_length_divisible_by == 1):
return x, y
max_length = tf.maximum(x_length, y_length)
if final_length_divisible_by > 1:
# Find the nearest larger-or-equal integer divisible by given number.
max_length += final_length_divisible_by - 1
max_length //= final_length_divisible_by
max_length *= final_length_divisible_by
length_diff1 = max_length - x_length
length_diff2 = max_length - y_length
def padding_list(length_diff, arg):
if axis == 1:
return [[[0, 0], [0, length_diff]],
tf.zeros([tf.rank(arg) - 2, 2], dtype=tf.int32)]
return [[[0, 0], [0, 0], [0, length_diff]],
tf.zeros([tf.rank(arg) - 3, 2], dtype=tf.int32)]
paddings1 = tf.concat(padding_list(length_diff1, x), axis=0)
paddings2 = tf.concat(padding_list(length_diff2, y), axis=0)
res_x = tf.pad(x, paddings1)
res_y = tf.pad(y, paddings2)
# Static shapes are the same except for axis=1.
x_shape = x.shape.as_list()
x_shape[axis] = None
res_x.set_shape(x_shape)
y_shape = y.shape.as_list()
y_shape[axis] = None
res_y.set_shape(y_shape)
return res_x, res_y
|
python
|
def pad_to_same_length(x, y, final_length_divisible_by=1, axis=1):
"""Pad tensors x and y on axis 1 so that they have the same length."""
if axis not in [1, 2]:
raise ValueError("Only axis=1 and axis=2 supported for now.")
with tf.name_scope("pad_to_same_length", values=[x, y]):
x_length = shape_list(x)[axis]
y_length = shape_list(y)[axis]
if (isinstance(x_length, int) and isinstance(y_length, int) and
x_length == y_length and final_length_divisible_by == 1):
return x, y
max_length = tf.maximum(x_length, y_length)
if final_length_divisible_by > 1:
# Find the nearest larger-or-equal integer divisible by given number.
max_length += final_length_divisible_by - 1
max_length //= final_length_divisible_by
max_length *= final_length_divisible_by
length_diff1 = max_length - x_length
length_diff2 = max_length - y_length
def padding_list(length_diff, arg):
if axis == 1:
return [[[0, 0], [0, length_diff]],
tf.zeros([tf.rank(arg) - 2, 2], dtype=tf.int32)]
return [[[0, 0], [0, 0], [0, length_diff]],
tf.zeros([tf.rank(arg) - 3, 2], dtype=tf.int32)]
paddings1 = tf.concat(padding_list(length_diff1, x), axis=0)
paddings2 = tf.concat(padding_list(length_diff2, y), axis=0)
res_x = tf.pad(x, paddings1)
res_y = tf.pad(y, paddings2)
# Static shapes are the same except for axis=1.
x_shape = x.shape.as_list()
x_shape[axis] = None
res_x.set_shape(x_shape)
y_shape = y.shape.as_list()
y_shape[axis] = None
res_y.set_shape(y_shape)
return res_x, res_y
|
[
"def",
"pad_to_same_length",
"(",
"x",
",",
"y",
",",
"final_length_divisible_by",
"=",
"1",
",",
"axis",
"=",
"1",
")",
":",
"if",
"axis",
"not",
"in",
"[",
"1",
",",
"2",
"]",
":",
"raise",
"ValueError",
"(",
"\"Only axis=1 and axis=2 supported for now.\"",
")",
"with",
"tf",
".",
"name_scope",
"(",
"\"pad_to_same_length\"",
",",
"values",
"=",
"[",
"x",
",",
"y",
"]",
")",
":",
"x_length",
"=",
"shape_list",
"(",
"x",
")",
"[",
"axis",
"]",
"y_length",
"=",
"shape_list",
"(",
"y",
")",
"[",
"axis",
"]",
"if",
"(",
"isinstance",
"(",
"x_length",
",",
"int",
")",
"and",
"isinstance",
"(",
"y_length",
",",
"int",
")",
"and",
"x_length",
"==",
"y_length",
"and",
"final_length_divisible_by",
"==",
"1",
")",
":",
"return",
"x",
",",
"y",
"max_length",
"=",
"tf",
".",
"maximum",
"(",
"x_length",
",",
"y_length",
")",
"if",
"final_length_divisible_by",
">",
"1",
":",
"# Find the nearest larger-or-equal integer divisible by given number.",
"max_length",
"+=",
"final_length_divisible_by",
"-",
"1",
"max_length",
"//=",
"final_length_divisible_by",
"max_length",
"*=",
"final_length_divisible_by",
"length_diff1",
"=",
"max_length",
"-",
"x_length",
"length_diff2",
"=",
"max_length",
"-",
"y_length",
"def",
"padding_list",
"(",
"length_diff",
",",
"arg",
")",
":",
"if",
"axis",
"==",
"1",
":",
"return",
"[",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"length_diff",
"]",
"]",
",",
"tf",
".",
"zeros",
"(",
"[",
"tf",
".",
"rank",
"(",
"arg",
")",
"-",
"2",
",",
"2",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"]",
"return",
"[",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"length_diff",
"]",
"]",
",",
"tf",
".",
"zeros",
"(",
"[",
"tf",
".",
"rank",
"(",
"arg",
")",
"-",
"3",
",",
"2",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"]",
"paddings1",
"=",
"tf",
".",
"concat",
"(",
"padding_list",
"(",
"length_diff1",
",",
"x",
")",
",",
"axis",
"=",
"0",
")",
"paddings2",
"=",
"tf",
".",
"concat",
"(",
"padding_list",
"(",
"length_diff2",
",",
"y",
")",
",",
"axis",
"=",
"0",
")",
"res_x",
"=",
"tf",
".",
"pad",
"(",
"x",
",",
"paddings1",
")",
"res_y",
"=",
"tf",
".",
"pad",
"(",
"y",
",",
"paddings2",
")",
"# Static shapes are the same except for axis=1.",
"x_shape",
"=",
"x",
".",
"shape",
".",
"as_list",
"(",
")",
"x_shape",
"[",
"axis",
"]",
"=",
"None",
"res_x",
".",
"set_shape",
"(",
"x_shape",
")",
"y_shape",
"=",
"y",
".",
"shape",
".",
"as_list",
"(",
")",
"y_shape",
"[",
"axis",
"]",
"=",
"None",
"res_y",
".",
"set_shape",
"(",
"y_shape",
")",
"return",
"res_x",
",",
"res_y"
] |
Pad tensors x and y on axis 1 so that they have the same length.
|
[
"Pad",
"tensors",
"x",
"and",
"y",
"on",
"axis",
"1",
"so",
"that",
"they",
"have",
"the",
"same",
"length",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1576-L1613
|
train
|
Pads x and y on axis 1 so that they have the same length.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAM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eticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(54) + chr(0b10011 + 0o44), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1567 - 1516) + chr(51) + '\x32', 17083 - 17075), ehT0Px3KOsy9('\x30' + '\x6f' + '\x37' + '\x33', 18799 - 18791), ehT0Px3KOsy9('\060' + chr(6693 - 6582) + chr(54) + chr(55), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1000 + 0o51) + chr(53) + '\064', 0o10), ehT0Px3KOsy9(chr(1462 - 1414) + '\x6f' + chr(564 - 510) + chr(0b110001 + 0o4), ord("\x08")), ehT0Px3KOsy9(chr(1323 - 1275) + chr(0b1100100 + 0o13) + chr(51) + chr(49) + '\x37', 22849 - 22841), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100011 + 0o16) + '\x36' + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(0b110000 + 0o1) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2186 - 2075) + '\x31' + chr(0b110000 + 0o7) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7285 - 7174) + '\064' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2173 - 2121) + chr(2691 - 2636), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111000 + 0o67) + chr(0b110011) + chr(0b110111) + chr(0b11001 + 0o31), 11246 - 11238), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b110011) + '\x36' + '\x30', 44213 - 44205), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(0b10111 + 0o33) + chr(1216 - 1167) + chr(2400 - 2346), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1935 - 1884) + chr(0b110110) + chr(54), 54699 - 54691), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100111 + 0o13) + chr(0b110110) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\067' + chr(51), 37331 - 37323), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10110 + 0o35) + chr(53) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + '\062' + chr(0b110111) + chr(0b101101 + 0o6), 31453 - 31445), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(52) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010100 + 0o33) + chr(50) + '\x31' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\063' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(625 - 576) + '\x35' + '\x37', 0o10), ehT0Px3KOsy9(chr(2231 - 2183) + '\157' + chr(981 - 931) + chr(1592 - 1539) + chr(51), 0b1000), ehT0Px3KOsy9(chr(336 - 288) + '\157' + '\x31' + chr(154 - 100) + chr(1954 - 1905), ord("\x08")), ehT0Px3KOsy9(chr(1819 - 1771) + chr(111) + '\x32' + chr(0b1 + 0o66), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(1569 - 1515) + chr(0b110010), 3455 - 3447), ehT0Px3KOsy9('\x30' + chr(0b1001110 + 0o41) + '\062' + chr(0b10 + 0o63) + chr(0b1001 + 0o47), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(0b110010) + '\x30', 41491 - 41483), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\064' + chr(2156 - 2102), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b110110) + chr(0b11001 + 0o31), 8), ehT0Px3KOsy9('\060' + chr(0b100110 + 0o111) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + '\x34' + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b101110 + 0o101) + '\061' + '\061', 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b110001) + chr(1344 - 1296) + chr(49), 6130 - 6122), ehT0Px3KOsy9('\x30' + chr(7186 - 7075) + '\062' + chr(2053 - 2003), 56961 - 56953), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(2660 - 2608) + chr(52), 20530 - 20522), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110110) + chr(52), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + '\065' + '\x30', 27179 - 27171)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x19'), '\x64' + '\145' + '\143' + '\157' + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(0b111000 + 0o56) + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def F9_pMIqOthBu(OeWW0F1dBPRQ, SqiSOtYOqOJH, RMLp2QvUTh7J=ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 38619 - 38611), cRTh61qyvi24=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49), 8)):
if cRTh61qyvi24 not in [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49), 8), ehT0Px3KOsy9('\x30' + chr(0b1100111 + 0o10) + chr(0b110 + 0o54), ord("\x08"))]:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'x\xb4WNLT\xb7\x1d\\\xf0M\x04F\x94\x94\xae\x97\xce\x12\x9c\x86\x11\xad\xab\x1a\xdb\x01x\x00\xdc\xb5\xc2RcL{a|\x8bC\x19'), '\144' + '\x65' + chr(99) + chr(0b110101 + 0o72) + chr(0b1001101 + 0o27) + chr(0b100100 + 0o101))(chr(0b1110101) + '\x74' + chr(2461 - 2359) + chr(0b101101) + chr(0b101 + 0o63)))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'Y\xbbVR3F\xac\x1b_\xa8'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\x6f' + chr(100) + '\x65')(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'G\xbb_h\x18Z\x90\x07N\xa0\x19{K\x9f\x9e\xe9\x82\xde'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(8908 - 8797) + '\x64' + '\x65')('\x75' + chr(0b100 + 0o160) + chr(0b10110 + 0o120) + chr(1979 - 1934) + chr(0b101011 + 0o15)), values=[OeWW0F1dBPRQ, SqiSOtYOqOJH]):
H7qUxhVHOWEJ = qypPRW8fq869(OeWW0F1dBPRQ)[cRTh61qyvi24]
PXiJX_Hpunq1 = qypPRW8fq869(SqiSOtYOqOJH)[cRTh61qyvi24]
if PlSM16l2KDPD(H7qUxhVHOWEJ, ehT0Px3KOsy9) and PlSM16l2KDPD(PXiJX_Hpunq1, ehT0Px3KOsy9) and (H7qUxhVHOWEJ == PXiJX_Hpunq1) and (RMLp2QvUTh7J == ehT0Px3KOsy9('\060' + chr(625 - 514) + chr(296 - 247), 8)):
return (OeWW0F1dBPRQ, SqiSOtYOqOJH)
_o7pVXAdOCRy = IDJ2eXGCBCDu.maximum(H7qUxhVHOWEJ, PXiJX_Hpunq1)
if RMLp2QvUTh7J > ehT0Px3KOsy9(chr(446 - 398) + chr(111) + chr(0b110001), 8):
_o7pVXAdOCRy += RMLp2QvUTh7J - ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(5626 - 5515) + chr(0b110001), 8)
_o7pVXAdOCRy //= RMLp2QvUTh7J
_o7pVXAdOCRy *= RMLp2QvUTh7J
uDCgw_TSkSZj = _o7pVXAdOCRy - H7qUxhVHOWEJ
U31KsGleGXI3 = _o7pVXAdOCRy - PXiJX_Hpunq1
def JsKiuglRSfHq(JOXBBW_AsDvh, LTE9MPUbqSos):
if cRTh61qyvi24 == ehT0Px3KOsy9(chr(1473 - 1425) + chr(111) + '\x31', 8):
return [[[ehT0Px3KOsy9(chr(1372 - 1324) + chr(0b1101111) + chr(48), 42696 - 42688), ehT0Px3KOsy9(chr(48) + '\x6f' + '\060', 8)], [ehT0Px3KOsy9(chr(2211 - 2163) + chr(111) + '\x30', 8), JOXBBW_AsDvh]], xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'M\xbfIX\x1f'), '\x64' + chr(5148 - 5047) + chr(99) + chr(0b1101111) + '\x64' + chr(101))(chr(11226 - 11109) + chr(116) + chr(1792 - 1690) + '\x2d' + chr(0b111000)))([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'E\xbbU\\'), chr(0b1100100) + chr(101) + chr(99) + chr(111) + '\x64' + chr(101))('\165' + '\x74' + '\x66' + chr(226 - 181) + chr(56)))(LTE9MPUbqSos) - ehT0Px3KOsy9(chr(71 - 23) + '\x6f' + chr(50), 8), ehT0Px3KOsy9(chr(692 - 644) + chr(111) + chr(0b111 + 0o53), 8)], dtype=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'^\xb4O\x04^'), '\x64' + '\x65' + '\143' + chr(826 - 715) + chr(0b11 + 0o141) + chr(9035 - 8934))(chr(117) + chr(116) + chr(0b100000 + 0o106) + '\055' + '\070')))]
return [[[ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(11733 - 11622) + chr(0b110000), 8), ehT0Px3KOsy9(chr(1588 - 1540) + chr(111) + chr(0b101100 + 0o4), 8)], [ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(9177 - 9066) + chr(0b101 + 0o53), 8), ehT0Px3KOsy9(chr(0b110000) + chr(1019 - 908) + chr(48), 8)], [ehT0Px3KOsy9('\060' + chr(510 - 399) + '\x30', 8), JOXBBW_AsDvh]], xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'M\xbfIX\x1f'), chr(7198 - 7098) + chr(0b1100101) + chr(0b1100011) + chr(5680 - 5569) + chr(0b1100100) + chr(0b1001 + 0o134))('\165' + chr(10006 - 9890) + chr(1329 - 1227) + chr(0b101101) + chr(56)))([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'E\xbbU\\'), '\x64' + '\145' + '\143' + chr(111) + chr(0b1100 + 0o130) + chr(4890 - 4789))(chr(0b1000 + 0o155) + chr(11333 - 11217) + '\x66' + chr(1874 - 1829) + '\070'))(LTE9MPUbqSos) - ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b110100 + 0o73) + chr(0b110011), 49448 - 49440), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010), 8)], dtype=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'^\xb4O\x04^'), '\144' + '\x65' + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))('\165' + chr(0b1110100) + '\146' + chr(0b101101) + '\070')))]
qJzQlGCxoqp6 = IDJ2eXGCBCDu.concat(JsKiuglRSfHq(uDCgw_TSkSZj, OeWW0F1dBPRQ), axis=ehT0Px3KOsy9('\x30' + '\x6f' + chr(48), 8))
Jghv5SFCQ2P3 = IDJ2eXGCBCDu.concat(JsKiuglRSfHq(U31KsGleGXI3, SqiSOtYOqOJH), axis=ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(7945 - 7834) + '\060', 8))
vfUJ5LXRIGPX = IDJ2eXGCBCDu.pad(OeWW0F1dBPRQ, qJzQlGCxoqp6)
PyNvc1x9gXcZ = IDJ2eXGCBCDu.pad(SqiSOtYOqOJH, Jghv5SFCQ2P3)
QQEXXbdZyz6m = OeWW0F1dBPRQ.shape.as_list()
QQEXXbdZyz6m[cRTh61qyvi24] = None
xafqLlk3kkUe(vfUJ5LXRIGPX, xafqLlk3kkUe(SXOLrMavuUCe(b'D\xbfOh\x1f]\xae\x04J'), '\144' + chr(101) + chr(0b1010 + 0o131) + chr(0b1101111) + chr(0b111010 + 0o52) + chr(0b1010010 + 0o23))(chr(117) + '\x74' + '\146' + chr(45) + '\x38'))(QQEXXbdZyz6m)
aSuibRQkg9Rl = SqiSOtYOqOJH.shape.as_list()
aSuibRQkg9Rl[cRTh61qyvi24] = None
xafqLlk3kkUe(PyNvc1x9gXcZ, xafqLlk3kkUe(SXOLrMavuUCe(b'D\xbfOh\x1f]\xae\x04J'), '\x64' + chr(0b100011 + 0o102) + '\143' + '\x6f' + '\144' + chr(101))(chr(117) + chr(116) + '\146' + '\x2d' + chr(645 - 589)))(aSuibRQkg9Rl)
return (vfUJ5LXRIGPX, PyNvc1x9gXcZ)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
pad_with_zeros
|
def pad_with_zeros(logits, labels):
"""Pad labels on the length dimension to match logits length."""
with tf.name_scope("pad_with_zeros", values=[logits, labels]):
logits, labels = pad_to_same_length(logits, labels)
if len(labels.shape) == 3: # 2-d labels.
logits, labels = pad_to_same_length(logits, labels, axis=2)
return logits, labels
|
python
|
def pad_with_zeros(logits, labels):
"""Pad labels on the length dimension to match logits length."""
with tf.name_scope("pad_with_zeros", values=[logits, labels]):
logits, labels = pad_to_same_length(logits, labels)
if len(labels.shape) == 3: # 2-d labels.
logits, labels = pad_to_same_length(logits, labels, axis=2)
return logits, labels
|
[
"def",
"pad_with_zeros",
"(",
"logits",
",",
"labels",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"pad_with_zeros\"",
",",
"values",
"=",
"[",
"logits",
",",
"labels",
"]",
")",
":",
"logits",
",",
"labels",
"=",
"pad_to_same_length",
"(",
"logits",
",",
"labels",
")",
"if",
"len",
"(",
"labels",
".",
"shape",
")",
"==",
"3",
":",
"# 2-d labels.",
"logits",
",",
"labels",
"=",
"pad_to_same_length",
"(",
"logits",
",",
"labels",
",",
"axis",
"=",
"2",
")",
"return",
"logits",
",",
"labels"
] |
Pad labels on the length dimension to match logits length.
|
[
"Pad",
"labels",
"on",
"the",
"length",
"dimension",
"to",
"match",
"logits",
"length",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1616-L1622
|
train
|
Pad labels on the length dimension to match logits length.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygA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EdDQ,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(2148 - 2094) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\064' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(642 - 594) + chr(0b1000100 + 0o53) + '\063' + '\x32' + chr(0b110000), 10871 - 10863), ehT0Px3KOsy9(chr(648 - 600) + chr(0b1000011 + 0o54) + chr(0b11101 + 0o26) + chr(0b11010 + 0o33) + chr(0b10000 + 0o41), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(73 - 24) + '\x30' + '\x33', 50340 - 50332), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + chr(531 - 482) + chr(1066 - 1017) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + chr(0b110010) + chr(184 - 131) + chr(0b10010 + 0o41), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\065' + chr(1224 - 1176), 0o10), ehT0Px3KOsy9('\060' + chr(6493 - 6382) + chr(0b110111) + chr(0b110000), 12767 - 12759), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(5709 - 5598) + chr(49) + chr(0b110 + 0o54) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(695 - 647) + chr(0b1101111) + '\x36' + chr(2100 - 2051), 26993 - 26985), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + chr(0b110010) + chr(52) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1238 - 1190) + chr(111) + chr(50) + chr(0b110110), 40146 - 40138), ehT0Px3KOsy9('\060' + '\157' + chr(0b1111 + 0o44) + '\067' + chr(0b11001 + 0o35), 63875 - 63867), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100010 + 0o20) + '\060' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10 + 0o64) + chr(2246 - 2196), 2652 - 2644), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1001010 + 0o45) + chr(0b101 + 0o54) + chr(0b110101) + chr(0b11000 + 0o36), 10288 - 10280), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101110 + 0o4) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000 + 0o1) + '\x31' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7555 - 7444) + chr(988 - 937) + chr(0b110110) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(54) + chr(0b101010 + 0o7), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b110001) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + chr(0b110011) + chr(1704 - 1654) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + chr(0b100001 + 0o22) + chr(0b100001 + 0o21) + chr(0b100000 + 0o27), 8), ehT0Px3KOsy9(chr(1884 - 1836) + chr(0b101001 + 0o106) + '\x33' + chr(48) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(54) + chr(819 - 766), 8), ehT0Px3KOsy9('\060' + chr(0b1101111 + 0o0) + chr(0b110010) + chr(2499 - 2445) + chr(0b110001 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(6771 - 6660) + chr(0b110001 + 0o0) + chr(801 - 751) + '\062', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(1052 - 1002) + chr(2296 - 2246), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(50) + '\x35', 34770 - 34762), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + chr(50) + '\065' + chr(0b110011), 8), ehT0Px3KOsy9(chr(298 - 250) + chr(0b1111 + 0o140) + '\x31' + '\062' + chr(268 - 217), 35926 - 35918), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b110001) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(54) + chr(958 - 910), 0o10), ehT0Px3KOsy9(chr(739 - 691) + '\157' + chr(51) + chr(48) + chr(358 - 309), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110101) + chr(551 - 496), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + chr(0b110001) + chr(2088 - 2040) + chr(0b11111 + 0o24), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1111 + 0o44) + chr(0b1000 + 0o54) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1010111 + 0o30) + '\x32' + chr(1478 - 1423), 4678 - 4670), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2235 - 2185) + chr(902 - 848), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x35' + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b'), '\144' + chr(0b111001 + 0o54) + chr(0b110110 + 0o55) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(0b110000 + 0o105) + '\x74' + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cnO1gZ8246Uh(wF9nmvjsKjYM, uXMK81tmdpTM):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'[\xc5\xbd\x8c\x1c9\xc8\xc7H7'), chr(0b10000 + 0o124) + chr(0b10111 + 0o116) + chr(0b1100011) + chr(1909 - 1798) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(116) + chr(0b1000000 + 0o46) + '\x2d' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'E\xc5\xb4\xb64#\xdf\xc0g(T\xd3y\x8d'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b100100 + 0o113) + chr(100) + '\145')(chr(117) + chr(0b1110100) + '\x66' + chr(0b0 + 0o55) + chr(581 - 525)), values=[wF9nmvjsKjYM, uXMK81tmdpTM]):
(wF9nmvjsKjYM, uXMK81tmdpTM) = F9_pMIqOthBu(wF9nmvjsKjYM, uXMK81tmdpTM)
if c2A0yzQpDQB3(xafqLlk3kkUe(uXMK81tmdpTM, xafqLlk3kkUe(SXOLrMavuUCe(b'[\xc5\xa5\xb0%\x06\xcc\xc4l"R\xc3'), chr(0b1100100) + chr(0b111010 + 0o53) + chr(99) + chr(0b1011110 + 0o21) + chr(899 - 799) + chr(5478 - 5377))(chr(0b1110101) + chr(116) + '\146' + chr(45) + chr(0b111000)))) == ehT0Px3KOsy9(chr(2271 - 2223) + chr(0b1101110 + 0o1) + chr(0b110011), 0b1000):
(wF9nmvjsKjYM, uXMK81tmdpTM) = F9_pMIqOthBu(wF9nmvjsKjYM, uXMK81tmdpTM, axis=ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010), 27918 - 27910))
return (wF9nmvjsKjYM, uXMK81tmdpTM)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
weights_prepend_inputs_to_targets
|
def weights_prepend_inputs_to_targets(labels):
"""Assign weight 1.0 to only the "targets" portion of the labels.
Weight 1.0 is assigned to all nonzero labels past the first zero.
See prepend_mode in common_hparams.py
Args:
labels: A Tensor of int32s.
Returns:
A Tensor of floats.
"""
past_first_zero = tf.cumsum(to_float(tf.equal(labels, 0)), axis=1)
nonzero = to_float(labels)
return to_float(tf.not_equal(past_first_zero * nonzero, 0))
|
python
|
def weights_prepend_inputs_to_targets(labels):
"""Assign weight 1.0 to only the "targets" portion of the labels.
Weight 1.0 is assigned to all nonzero labels past the first zero.
See prepend_mode in common_hparams.py
Args:
labels: A Tensor of int32s.
Returns:
A Tensor of floats.
"""
past_first_zero = tf.cumsum(to_float(tf.equal(labels, 0)), axis=1)
nonzero = to_float(labels)
return to_float(tf.not_equal(past_first_zero * nonzero, 0))
|
[
"def",
"weights_prepend_inputs_to_targets",
"(",
"labels",
")",
":",
"past_first_zero",
"=",
"tf",
".",
"cumsum",
"(",
"to_float",
"(",
"tf",
".",
"equal",
"(",
"labels",
",",
"0",
")",
")",
",",
"axis",
"=",
"1",
")",
"nonzero",
"=",
"to_float",
"(",
"labels",
")",
"return",
"to_float",
"(",
"tf",
".",
"not_equal",
"(",
"past_first_zero",
"*",
"nonzero",
",",
"0",
")",
")"
] |
Assign weight 1.0 to only the "targets" portion of the labels.
Weight 1.0 is assigned to all nonzero labels past the first zero.
See prepend_mode in common_hparams.py
Args:
labels: A Tensor of int32s.
Returns:
A Tensor of floats.
|
[
"Assign",
"weight",
"1",
".",
"0",
"to",
"only",
"the",
"targets",
"portion",
"of",
"the",
"labels",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1630-L1644
|
train
|
Assign weight 1. 0 to only the targets portion of the labels.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt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ZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(5528 - 5417) + chr(0b101111 + 0o6) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + '\x32' + chr(0b110101) + '\067', 6091 - 6083), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(1020 - 909) + chr(51), 0b1000), ehT0Px3KOsy9(chr(784 - 736) + chr(111) + chr(51) + chr(0b110100) + chr(0b10 + 0o63), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9307 - 9196) + '\x31' + chr(0b101001 + 0o12) + chr(692 - 638), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b110001) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\066' + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100110 + 0o15) + '\x32' + chr(2428 - 2376), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101110 + 0o4) + '\x37' + chr(0b1001 + 0o50), 4996 - 4988), ehT0Px3KOsy9(chr(48) + chr(11045 - 10934) + chr(0b110101) + chr(0b11 + 0o64), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\065' + chr(55), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + '\066' + chr(0b1000 + 0o57), 0b1000), ehT0Px3KOsy9(chr(1757 - 1709) + chr(0b111010 + 0o65) + chr(50) + chr(51) + chr(53), 0o10), ehT0Px3KOsy9(chr(2033 - 1985) + chr(0b1101111) + chr(470 - 417) + '\x34', 11201 - 11193), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\060' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(600 - 549) + chr(0b110111) + '\x35', 61231 - 61223), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\065' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1100 + 0o143) + '\062' + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2108 - 2055) + chr(0b110001), 38152 - 38144), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(53) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b111110 + 0o61) + chr(0b110010) + '\x31' + chr(0b110000 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(0b100100 + 0o15) + chr(0b110001) + chr(0b100 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + '\x32' + chr(55) + '\062', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b1000 + 0o57) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(868 - 817) + '\x36' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5296 - 5185) + chr(315 - 260), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + chr(0b10100 + 0o35) + chr(52), 45870 - 45862), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(10220 - 10109) + chr(49) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101011 + 0o7) + chr(2878 - 2823), 13052 - 13044), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\066' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1000011 + 0o54) + chr(0b11001 + 0o32) + '\061' + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + '\x34', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(845 - 796) + chr(0b11110 + 0o25) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(50) + chr(0b110001) + '\061', 2440 - 2432), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b100101 + 0o112) + chr(0b110001) + chr(0b1000 + 0o50), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\063' + chr(55), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\066' + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\063' + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(764 - 713) + chr(53) + '\060', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + '\065' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'1'), '\144' + chr(101) + '\x63' + chr(9020 - 8909) + chr(100) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(102) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xo3BMfw3kMx6(uXMK81tmdpTM):
mIOXqxCyafAM = IDJ2eXGCBCDu.i0lzZW3r00ue(ZUL3kHBGU8Uu(IDJ2eXGCBCDu.equal(uXMK81tmdpTM, ehT0Px3KOsy9('\060' + chr(111) + chr(48), 58056 - 58048))), axis=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1100 - 1051), ord("\x08")))
R2iTLCDMqtpu = ZUL3kHBGU8Uu(uXMK81tmdpTM)
return ZUL3kHBGU8Uu(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'qD\xdb\\\x80/=\xd1\xb8'), '\144' + '\x65' + chr(720 - 621) + '\x6f' + '\144' + chr(0b1100101))('\x75' + chr(0b1100101 + 0o17) + chr(3307 - 3205) + chr(45) + '\x38'))(mIOXqxCyafAM * R2iTLCDMqtpu, ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000), 8)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
check_nonnegative
|
def check_nonnegative(value):
"""Check that the value is nonnegative."""
if isinstance(value, tf.Tensor):
with tf.control_dependencies([tf.assert_greater_equal(value, 0)]):
value = tf.identity(value)
elif value < 0:
raise ValueError("Value must be non-negative.")
return value
|
python
|
def check_nonnegative(value):
"""Check that the value is nonnegative."""
if isinstance(value, tf.Tensor):
with tf.control_dependencies([tf.assert_greater_equal(value, 0)]):
value = tf.identity(value)
elif value < 0:
raise ValueError("Value must be non-negative.")
return value
|
[
"def",
"check_nonnegative",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"tf",
".",
"Tensor",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"tf",
".",
"assert_greater_equal",
"(",
"value",
",",
"0",
")",
"]",
")",
":",
"value",
"=",
"tf",
".",
"identity",
"(",
"value",
")",
"elif",
"value",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"Value must be non-negative.\"",
")",
"return",
"value"
] |
Check that the value is nonnegative.
|
[
"Check",
"that",
"the",
"value",
"is",
"nonnegative",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1647-L1654
|
train
|
Check that the value is nonnegative.
|
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,eh4BeXwijHp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I,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(1785 - 1737) + chr(111) + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(749 - 638) + chr(0b1010 + 0o51) + '\062' + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100110 + 0o16) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(5940 - 5829) + chr(1704 - 1650) + chr(0b10010 + 0o42), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101 + 0o142) + chr(0b110001) + chr(268 - 220) + chr(2506 - 2452), 0o10), ehT0Px3KOsy9('\060' + chr(7321 - 7210) + '\066' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(197 - 86) + '\062' + chr(52) + '\x35', 44020 - 44012), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + '\x30', 18733 - 18725), ehT0Px3KOsy9(chr(48) + chr(12100 - 11989) + '\062' + chr(0b110111) + chr(51), 0b1000), ehT0Px3KOsy9(chr(1669 - 1621) + chr(8192 - 8081) + chr(0b101101 + 0o6) + chr(0b110110) + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(0b110000 + 0o77) + '\x33' + chr(0b110001) + chr(1428 - 1373), 33867 - 33859), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(4385 - 4274) + chr(49) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(215 - 167) + chr(6375 - 6264) + chr(49) + '\060' + chr(1971 - 1922), 0b1000), ehT0Px3KOsy9(chr(134 - 86) + chr(0b1101110 + 0o1) + '\x33' + chr(452 - 404) + chr(49), 44169 - 44161), ehT0Px3KOsy9(chr(2172 - 2124) + '\157' + chr(0b110010) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + chr(0b110011) + chr(0b11111 + 0o23) + '\060', 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + '\062' + chr(0b101011 + 0o13) + chr(0b110101), 57876 - 57868), ehT0Px3KOsy9(chr(1962 - 1914) + chr(111) + '\063' + chr(0b110000) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + '\x31' + '\x35' + chr(50), 0o10), ehT0Px3KOsy9(chr(1986 - 1938) + '\x6f' + '\x32' + chr(0b110000 + 0o3), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b110101) + '\x31', 6614 - 6606), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(51) + chr(0b10 + 0o56) + chr(55), 0b1000), ehT0Px3KOsy9(chr(832 - 784) + chr(0b110111 + 0o70) + chr(50) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(1522 - 1467) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(5388 - 5277) + chr(941 - 890) + '\064' + chr(50), 179 - 171), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(49) + chr(0b101101 + 0o7) + chr(0b10 + 0o64), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(1911 - 1862) + '\x32' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1211 - 1161) + chr(51) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b110000) + chr(0b110100), 64717 - 64709), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b10 + 0o61) + chr(0b110110), 59275 - 59267), ehT0Px3KOsy9(chr(48) + chr(11642 - 11531) + chr(0b110010) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(1697 - 1647) + chr(0b10001 + 0o42), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + chr(0b110011) + chr(594 - 540), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + chr(0b1011 + 0o46) + chr(0b110011) + chr(322 - 274), 23928 - 23920), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(2642 - 2531) + '\x32' + chr(0b110010) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(51) + chr(237 - 188), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(330 - 281) + '\063' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x37' + '\x36', 35781 - 35773), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b10 + 0o60) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100001 + 0o22) + chr(0b101101 + 0o6) + chr(0b110101), 65345 - 65337)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b100000 + 0o117) + chr(58 - 5) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'5'), chr(0b1100100) + chr(0b1100101) + chr(0b1000111 + 0o34) + '\157' + chr(0b1100100) + chr(0b10001 + 0o124))('\x75' + chr(116) + '\x66' + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xYBLH7D70Qu3(QmmgWUB13VCJ):
if PlSM16l2KDPD(QmmgWUB13VCJ, xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'O\xb5JG)@'), '\x64' + chr(101) + chr(2303 - 2204) + '\x6f' + chr(100) + chr(101))(chr(117) + chr(0b10000 + 0o144) + '\146' + chr(698 - 653) + chr(0b101000 + 0o20)))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'x\xbfJ@4]\xc9_\xdf\x93\xbfo/\xa5t\xbe\xd6\xaa\x0f`'), chr(0b1111 + 0o125) + chr(101) + '\143' + chr(111) + chr(100) + chr(0b1100101))('\x75' + chr(116) + chr(0b1100010 + 0o4) + '\055' + '\x38'))([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'z\xa3WQ4F\xfag\xc9\x93\xae~$\xb3N\xb5\xc4\xb6\x0b\x7f'), chr(0b1100100) + chr(0b1100001 + 0o4) + chr(0b1000100 + 0o37) + '\x6f' + '\144' + '\145')(chr(117) + '\x74' + chr(5917 - 5815) + chr(45) + '\070'))(QmmgWUB13VCJ, ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b10100 + 0o34), 8))]):
QmmgWUB13VCJ = IDJ2eXGCBCDu.identity(QmmgWUB13VCJ)
elif QmmgWUB13VCJ < ehT0Px3KOsy9('\x30' + '\157' + '\060', 8):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'M\xb1HA#\x12\xc8u\xc8\x82\xefh$\xe1\x7f\xbf\xdb\xee\x04v\x0e\xa6`\x91\x94\x03x'), '\144' + chr(101) + chr(0b1100011) + chr(0b110 + 0o151) + chr(0b1010010 + 0o22) + chr(0b101100 + 0o71))(chr(117) + chr(0b101011 + 0o111) + '\x66' + chr(0b10001 + 0o34) + chr(998 - 942)))
return QmmgWUB13VCJ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
weights_multi_problem
|
def weights_multi_problem(labels, taskid=-1):
"""Assign weight 1.0 to only the "targets" portion of the labels.
Weight 1.0 is assigned to all labels past the taskid.
Args:
labels: A Tensor of int32s.
taskid: an int32 representing the task id for a problem.
Returns:
A Tensor of floats.
Raises:
ValueError: The Task ID must be valid.
"""
taskid = check_nonnegative(taskid)
past_taskid = tf.cumsum(to_float(tf.equal(labels, taskid)), axis=1)
# Additionally zero out the task id location
past_taskid *= to_float(tf.not_equal(labels, taskid))
non_taskid = to_float(labels)
return to_float(tf.not_equal(past_taskid * non_taskid, 0))
|
python
|
def weights_multi_problem(labels, taskid=-1):
"""Assign weight 1.0 to only the "targets" portion of the labels.
Weight 1.0 is assigned to all labels past the taskid.
Args:
labels: A Tensor of int32s.
taskid: an int32 representing the task id for a problem.
Returns:
A Tensor of floats.
Raises:
ValueError: The Task ID must be valid.
"""
taskid = check_nonnegative(taskid)
past_taskid = tf.cumsum(to_float(tf.equal(labels, taskid)), axis=1)
# Additionally zero out the task id location
past_taskid *= to_float(tf.not_equal(labels, taskid))
non_taskid = to_float(labels)
return to_float(tf.not_equal(past_taskid * non_taskid, 0))
|
[
"def",
"weights_multi_problem",
"(",
"labels",
",",
"taskid",
"=",
"-",
"1",
")",
":",
"taskid",
"=",
"check_nonnegative",
"(",
"taskid",
")",
"past_taskid",
"=",
"tf",
".",
"cumsum",
"(",
"to_float",
"(",
"tf",
".",
"equal",
"(",
"labels",
",",
"taskid",
")",
")",
",",
"axis",
"=",
"1",
")",
"# Additionally zero out the task id location",
"past_taskid",
"*=",
"to_float",
"(",
"tf",
".",
"not_equal",
"(",
"labels",
",",
"taskid",
")",
")",
"non_taskid",
"=",
"to_float",
"(",
"labels",
")",
"return",
"to_float",
"(",
"tf",
".",
"not_equal",
"(",
"past_taskid",
"*",
"non_taskid",
",",
"0",
")",
")"
] |
Assign weight 1.0 to only the "targets" portion of the labels.
Weight 1.0 is assigned to all labels past the taskid.
Args:
labels: A Tensor of int32s.
taskid: an int32 representing the task id for a problem.
Returns:
A Tensor of floats.
Raises:
ValueError: The Task ID must be valid.
|
[
"Assign",
"weight",
"1",
".",
"0",
"to",
"only",
"the",
"targets",
"portion",
"of",
"the",
"labels",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1657-L1677
|
train
|
Assign weight 1. 0 to only the targets portion of the labels.
|
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,NL8dtWOpbc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Qr8gNKaIaWE,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(491 - 443) + chr(0b100100 + 0o113) + '\066' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + '\x35', 19246 - 19238), ehT0Px3KOsy9(chr(0b110000) + chr(10884 - 10773) + chr(0b100111 + 0o14) + chr(0b1001 + 0o53) + chr(2249 - 2198), 53093 - 53085), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b110100) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1586 - 1536) + chr(52) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + chr(0b110111) + chr(53), 12844 - 12836), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(405 - 294) + chr(1947 - 1898) + chr(53), 31285 - 31277), ehT0Px3KOsy9('\060' + '\157' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(54) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(1464 - 1412) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(50) + chr(1112 - 1064), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(251 - 202) + '\062' + chr(709 - 661), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(2243 - 2188) + '\062', 12458 - 12450), ehT0Px3KOsy9('\x30' + '\157' + chr(2427 - 2376) + '\x30' + chr(0b10110 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + chr(54) + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(220 - 169) + chr(0b110100), 44340 - 44332), ehT0Px3KOsy9('\x30' + chr(0b1101011 + 0o4) + chr(0b10101 + 0o36) + '\x34' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011 + 0o144) + chr(49) + '\063' + chr(0b110011 + 0o1), 35071 - 35063), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(51) + chr(2665 - 2612) + chr(0b110001 + 0o5), 0o10), ehT0Px3KOsy9('\060' + chr(1629 - 1518) + '\x33' + chr(0b10100 + 0o34) + chr(0b100 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(987 - 938) + chr(0b110110) + chr(1216 - 1165), 0b1000), ehT0Px3KOsy9(chr(1051 - 1003) + chr(0b1101111) + chr(0b110011) + chr(283 - 231) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2102 - 2053) + '\x31' + chr(0b1101 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10422 - 10311) + chr(2322 - 2271) + chr(51) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(2299 - 2188) + chr(0b110001) + chr(0b10101 + 0o37) + chr(2550 - 2495), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10110 + 0o37) + '\x34', 63049 - 63041), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(1891 - 1840) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b110000) + chr(0b101001 + 0o12), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(0b1011 + 0o46) + chr(0b110111) + chr(0b10101 + 0o40), 0o10), ehT0Px3KOsy9('\x30' + chr(12305 - 12194) + chr(0b101110 + 0o3) + '\x36' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(0b110001) + '\064' + '\x32', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\062', 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\067' + chr(48), 62321 - 62313), ehT0Px3KOsy9(chr(1234 - 1186) + chr(111) + chr(2145 - 2096) + chr(0b110011) + '\x34', 8), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(8021 - 7910) + '\x32' + chr(55) + chr(54), 0o10), ehT0Px3KOsy9(chr(1074 - 1026) + '\157' + '\061' + '\x32', 0b1000), ehT0Px3KOsy9(chr(547 - 499) + '\x6f' + chr(853 - 803) + chr(52) + '\064', 10706 - 10698), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + '\x33' + chr(0b11010 + 0o33) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + '\062' + chr(0b101000 + 0o15) + '\x31', 0o10), ehT0Px3KOsy9(chr(368 - 320) + chr(9644 - 9533) + '\x32' + chr(54) + chr(51), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2261 - 2213) + chr(6884 - 6773) + chr(0b110101) + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d'), chr(100) + chr(8354 - 8253) + '\143' + chr(290 - 179) + '\x64' + '\145')(chr(117) + '\164' + '\146' + '\055' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def p0XELPFCaUEr(uXMK81tmdpTM, tpiZFnMpWJGq=-ehT0Px3KOsy9('\060' + '\x6f' + chr(208 - 159), ord("\x08"))):
tpiZFnMpWJGq = xYBLH7D70Qu3(tpiZFnMpWJGq)
b3R6BTXQdpSs = IDJ2eXGCBCDu.i0lzZW3r00ue(ZUL3kHBGU8Uu(IDJ2eXGCBCDu.equal(uXMK81tmdpTM, tpiZFnMpWJGq)), axis=ehT0Px3KOsy9('\060' + chr(6062 - 5951) + '\061', 8))
b3R6BTXQdpSs *= ZUL3kHBGU8Uu(IDJ2eXGCBCDu.not_equal(uXMK81tmdpTM, tpiZFnMpWJGq))
CKObyskYUKzX = ZUL3kHBGU8Uu(uXMK81tmdpTM)
return ZUL3kHBGU8Uu(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b']z\x97<\xc2Lxa\x9d'), chr(0b1000101 + 0o37) + chr(1974 - 1873) + chr(2986 - 2887) + chr(0b111 + 0o150) + '\144' + '\x65')(chr(0b1001001 + 0o54) + '\164' + chr(102) + chr(0b101010 + 0o3) + chr(0b111000)))(b3R6BTXQdpSs * CKObyskYUKzX, ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110000), 8)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
weights_multi_problem_all
|
def weights_multi_problem_all(labels, taskid=-1):
"""Assign weight 1.0 to only examples from the given task."""
taskid = check_nonnegative(taskid)
weights = to_float(tf.not_equal(labels, 0))
past_taskid = tf.cumsum(to_float(tf.equal(labels, taskid)), axis=1)
# Additionally zero out the task id location
past_taskid *= to_float(tf.not_equal(labels, taskid))
non_taskid = to_float(labels)
example_mask = to_float(tf.not_equal(past_taskid * non_taskid, 0))
example_mask = tf.reduce_sum(example_mask, axis=1)
example_mask = to_float(
tf.greater(example_mask, tf.zeros_like(example_mask)))
return weights * tf.expand_dims(example_mask, axis=-1)
|
python
|
def weights_multi_problem_all(labels, taskid=-1):
"""Assign weight 1.0 to only examples from the given task."""
taskid = check_nonnegative(taskid)
weights = to_float(tf.not_equal(labels, 0))
past_taskid = tf.cumsum(to_float(tf.equal(labels, taskid)), axis=1)
# Additionally zero out the task id location
past_taskid *= to_float(tf.not_equal(labels, taskid))
non_taskid = to_float(labels)
example_mask = to_float(tf.not_equal(past_taskid * non_taskid, 0))
example_mask = tf.reduce_sum(example_mask, axis=1)
example_mask = to_float(
tf.greater(example_mask, tf.zeros_like(example_mask)))
return weights * tf.expand_dims(example_mask, axis=-1)
|
[
"def",
"weights_multi_problem_all",
"(",
"labels",
",",
"taskid",
"=",
"-",
"1",
")",
":",
"taskid",
"=",
"check_nonnegative",
"(",
"taskid",
")",
"weights",
"=",
"to_float",
"(",
"tf",
".",
"not_equal",
"(",
"labels",
",",
"0",
")",
")",
"past_taskid",
"=",
"tf",
".",
"cumsum",
"(",
"to_float",
"(",
"tf",
".",
"equal",
"(",
"labels",
",",
"taskid",
")",
")",
",",
"axis",
"=",
"1",
")",
"# Additionally zero out the task id location",
"past_taskid",
"*=",
"to_float",
"(",
"tf",
".",
"not_equal",
"(",
"labels",
",",
"taskid",
")",
")",
"non_taskid",
"=",
"to_float",
"(",
"labels",
")",
"example_mask",
"=",
"to_float",
"(",
"tf",
".",
"not_equal",
"(",
"past_taskid",
"*",
"non_taskid",
",",
"0",
")",
")",
"example_mask",
"=",
"tf",
".",
"reduce_sum",
"(",
"example_mask",
",",
"axis",
"=",
"1",
")",
"example_mask",
"=",
"to_float",
"(",
"tf",
".",
"greater",
"(",
"example_mask",
",",
"tf",
".",
"zeros_like",
"(",
"example_mask",
")",
")",
")",
"return",
"weights",
"*",
"tf",
".",
"expand_dims",
"(",
"example_mask",
",",
"axis",
"=",
"-",
"1",
")"
] |
Assign weight 1.0 to only examples from the given task.
|
[
"Assign",
"weight",
"1",
".",
"0",
"to",
"only",
"examples",
"from",
"the",
"given",
"task",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1680-L1693
|
train
|
Assign weight 1. 0 to only examples from the given task.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GA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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(48) + '\x6f' + '\x32' + '\x36' + '\061', 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(6987 - 6876) + '\x31' + chr(0b110101) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(416 - 305) + '\x31' + chr(49) + '\060', 22723 - 22715), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + chr(0b1111 + 0o41), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\063' + chr(52), 0b1000), ehT0Px3KOsy9(chr(2115 - 2067) + chr(0b1101111) + '\061' + chr(0b10111 + 0o33) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(12041 - 11930) + chr(585 - 535) + chr(55) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(240 - 189) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110 + 0o54) + '\060' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\x30' + chr(2408 - 2356), 54029 - 54021), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(546 - 496) + '\062', 0o10), ehT0Px3KOsy9(chr(340 - 292) + chr(9689 - 9578) + '\062' + chr(0b110001) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b110110) + chr(2345 - 2296), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(0b110100) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2300 - 2252) + '\157' + chr(0b110011) + '\062' + chr(1176 - 1121), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(2312 - 2262) + '\062' + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b111011 + 0o64) + '\x32' + '\x32' + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2213 - 2162) + chr(0b110001) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2042 - 1931) + chr(0b1011 + 0o51), 57771 - 57763), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\062', 34908 - 34900), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(0b110110) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(12031 - 11920) + chr(0b110010) + chr(0b110110) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(2571 - 2460) + chr(904 - 849) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b101100 + 0o5) + chr(0b110001 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1001100 + 0o43) + chr(0b0 + 0o64) + chr(0b110 + 0o55), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(1014 - 962) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\x6f' + '\061' + '\065', 57870 - 57862), ehT0Px3KOsy9('\x30' + chr(111) + '\x34' + chr(778 - 723), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101 + 0o2) + chr(202 - 151), 3974 - 3966), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1381 - 1332) + chr(1664 - 1612), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(1067 - 1015), 8), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(1015 - 966) + chr(270 - 217), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(0b110101) + chr(0b10100 + 0o41), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(52) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(0b110001) + chr(0b100111 + 0o20), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111001 + 0o66) + chr(0b11001 + 0o31) + chr(0b100110 + 0o21) + '\066', 44010 - 44002), ehT0Px3KOsy9('\x30' + chr(0b1000111 + 0o50) + chr(0b10110 + 0o35) + chr(55) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1332 - 1284) + chr(0b10001 + 0o136) + chr(0b110001) + chr(530 - 481) + chr(1885 - 1832), 8), ehT0Px3KOsy9(chr(1787 - 1739) + chr(111) + chr(0b110 + 0o61) + chr(783 - 731), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + '\x35' + chr(0b1010 + 0o46), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f'), '\144' + chr(0b1010 + 0o133) + chr(99) + '\157' + '\x64' + '\145')(chr(0b110000 + 0o105) + '\164' + chr(0b1100110) + chr(0b101101) + chr(886 - 830)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def u5ZnP0NFt6rV(uXMK81tmdpTM, tpiZFnMpWJGq=-ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1011111 + 0o20) + '\061', 0b1000)):
tpiZFnMpWJGq = xYBLH7D70Qu3(tpiZFnMpWJGq)
ZurHTci57aXw = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.not_equal(uXMK81tmdpTM, ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000), 0o10)))
b3R6BTXQdpSs = IDJ2eXGCBCDu.i0lzZW3r00ue(ZUL3kHBGU8Uu(IDJ2eXGCBCDu.equal(uXMK81tmdpTM, tpiZFnMpWJGq)), axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + '\x31', 8))
b3R6BTXQdpSs *= ZUL3kHBGU8Uu(IDJ2eXGCBCDu.not_equal(uXMK81tmdpTM, tpiZFnMpWJGq))
CKObyskYUKzX = ZUL3kHBGU8Uu(uXMK81tmdpTM)
PVHv6Xp2GFR7 = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.not_equal(b3R6BTXQdpSs * CKObyskYUKzX, ehT0Px3KOsy9(chr(65 - 17) + chr(0b101011 + 0o104) + chr(48), 8)))
PVHv6Xp2GFR7 = IDJ2eXGCBCDu.reduce_sum(PVHv6Xp2GFR7, axis=ehT0Px3KOsy9('\060' + chr(0b110010 + 0o75) + chr(0b110001), 8))
PVHv6Xp2GFR7 = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.greater(PVHv6Xp2GFR7, IDJ2eXGCBCDu.zeros_like(PVHv6Xp2GFR7)))
return ZurHTci57aXw * xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\x168I22O\xd8\xb6\xec7'), chr(100) + '\x65' + '\x63' + chr(0b1101111) + chr(0b111001 + 0o53) + chr(0b1100101))(chr(0b1110101) + chr(1977 - 1861) + chr(0b101001 + 0o75) + chr(45) + '\x38'))(PVHv6Xp2GFR7, axis=-ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100010 + 0o17), 8))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
weights_multi_problem_input
|
def weights_multi_problem_input(labels, taskid=-1):
"""Assign weight 1.0 to only the inputs for the given task."""
taskid = check_nonnegative(taskid)
weights_all_tokens = weights_multi_problem_all(labels, taskid)
weights_target = weights_multi_problem(labels, taskid)
return weights_all_tokens - weights_target
|
python
|
def weights_multi_problem_input(labels, taskid=-1):
"""Assign weight 1.0 to only the inputs for the given task."""
taskid = check_nonnegative(taskid)
weights_all_tokens = weights_multi_problem_all(labels, taskid)
weights_target = weights_multi_problem(labels, taskid)
return weights_all_tokens - weights_target
|
[
"def",
"weights_multi_problem_input",
"(",
"labels",
",",
"taskid",
"=",
"-",
"1",
")",
":",
"taskid",
"=",
"check_nonnegative",
"(",
"taskid",
")",
"weights_all_tokens",
"=",
"weights_multi_problem_all",
"(",
"labels",
",",
"taskid",
")",
"weights_target",
"=",
"weights_multi_problem",
"(",
"labels",
",",
"taskid",
")",
"return",
"weights_all_tokens",
"-",
"weights_target"
] |
Assign weight 1.0 to only the inputs for the given task.
|
[
"Assign",
"weight",
"1",
".",
"0",
"to",
"only",
"the",
"inputs",
"for",
"the",
"given",
"task",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1696-L1701
|
train
|
Assign weight 1. 0 to only the inputs for the given task.
|
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,KOHQG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xlvR,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(0b110001) + chr(2675 - 2621) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(48) + chr(55), 27307 - 27299), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(652 - 598) + chr(0b110001 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2237 - 2186) + '\063' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(2394 - 2283) + chr(0b110011) + chr(51) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1322 - 1273) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(4674 - 4563) + chr(0b110 + 0o54) + chr(0b101011 + 0o5) + chr(54), 27433 - 27425), ehT0Px3KOsy9(chr(1803 - 1755) + chr(0b1101111) + chr(0b1010 + 0o50) + '\x37' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(235 - 187) + '\157' + '\063' + '\x34' + '\x37', 49341 - 49333), ehT0Px3KOsy9(chr(1541 - 1493) + '\x6f' + '\x33' + chr(2658 - 2604) + '\067', 53966 - 53958), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(2456 - 2401) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101000 + 0o11) + chr(48) + chr(0b10 + 0o63), 0o10), ehT0Px3KOsy9(chr(48) + chr(11476 - 11365) + chr(0b110101) + '\062', 64455 - 64447), ehT0Px3KOsy9(chr(1361 - 1313) + '\x6f' + chr(0b101010 + 0o10) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2304 - 2251) + chr(53), 9126 - 9118), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\x33' + chr(0b101 + 0o54) + '\x33', 58252 - 58244), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b110100) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(941 - 890) + '\x36' + '\065', 63284 - 63276), ehT0Px3KOsy9(chr(1730 - 1682) + chr(0b110111 + 0o70) + '\061' + '\066' + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(10474 - 10363) + chr(0b110001) + '\x33' + chr(1791 - 1741), 49520 - 49512), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\062' + '\061' + chr(0b110100), 44146 - 44138), ehT0Px3KOsy9(chr(48) + chr(0b11100 + 0o123) + chr(1775 - 1724) + chr(0b110011) + chr(0b100101 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(397 - 349) + chr(1548 - 1437) + chr(53) + chr(49), 7227 - 7219), ehT0Px3KOsy9(chr(0b110000) + chr(8940 - 8829) + '\061' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(51) + chr(0b101110 + 0o11), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\066' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(0b100110 + 0o13), 8), ehT0Px3KOsy9('\060' + chr(0b111010 + 0o65) + chr(0b110001) + chr(70 - 17) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + '\063' + chr(0b100011 + 0o15) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(0b10010 + 0o37) + chr(0b110110), 40554 - 40546), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + chr(1290 - 1237) + '\061', 8), ehT0Px3KOsy9(chr(2053 - 2005) + chr(0b1101111) + chr(0b101011 + 0o7) + '\x35' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1100011 + 0o14) + chr(0b100100 + 0o15) + chr(0b1001 + 0o53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111 + 0o0) + chr(822 - 772) + chr(0b110000) + chr(582 - 532), 20166 - 20158), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(1885 - 1832) + chr(55), 62398 - 62390), ehT0Px3KOsy9(chr(1089 - 1041) + '\x6f' + chr(0b1010 + 0o47) + chr(0b110010) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(2991 - 2936) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(500 - 389) + '\x32' + chr(0b101100 + 0o13) + chr(0b101100 + 0o5), 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(0b10111 + 0o32) + '\x31' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(0b1101 + 0o45) + chr(0b100010 + 0o16) + chr(0b110111), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(0b110101) + chr(0b110000), 44010 - 44002)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'_'), '\144' + '\145' + '\x63' + '\x6f' + '\144' + chr(0b1100101))(chr(0b1010110 + 0o37) + chr(0b1110100 + 0o0) + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Fq6K8z5jGzdR(uXMK81tmdpTM, tpiZFnMpWJGq=-ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 0b1000)):
tpiZFnMpWJGq = xYBLH7D70Qu3(tpiZFnMpWJGq)
bbtpbPHfzg9e = u5ZnP0NFt6rV(uXMK81tmdpTM, tpiZFnMpWJGq)
jl0dd9gxsiwj = p0XELPFCaUEr(uXMK81tmdpTM, tpiZFnMpWJGq)
return bbtpbPHfzg9e - jl0dd9gxsiwj
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
weights_concatenated
|
def weights_concatenated(labels):
"""Assign weight 1.0 to the "target" part of the concatenated labels.
The labels look like:
source English I love you . ID1 target French Je t'aime . ID1 source
English the cat ID1 target French le chat ID1 source English ...
We want to assign weight 1.0 to all words in the target text (including the
ID1 end symbol), but not to the source text or the boilerplate. In the
above example, the target words that get positive weight are:
Je t'aime . ID1 le chat ID1
Args:
labels: a Tensor
Returns:
a Tensor
"""
eos_mask = tf.to_int32(tf.equal(labels, 1))
sentence_num = tf.cumsum(eos_mask, axis=1, exclusive=True)
in_target = tf.equal(tf.mod(sentence_num, 2), 1)
# first two tokens of each sentence are boilerplate.
sentence_num_plus_one = sentence_num + 1
shifted = tf.pad(sentence_num_plus_one,
[[0, 0], [2, 0], [0, 0], [0, 0]])[:, :-2, :, :]
nonboilerplate = tf.equal(sentence_num_plus_one, shifted)
ret = to_float(tf.logical_and(nonboilerplate, in_target))
return ret
|
python
|
def weights_concatenated(labels):
"""Assign weight 1.0 to the "target" part of the concatenated labels.
The labels look like:
source English I love you . ID1 target French Je t'aime . ID1 source
English the cat ID1 target French le chat ID1 source English ...
We want to assign weight 1.0 to all words in the target text (including the
ID1 end symbol), but not to the source text or the boilerplate. In the
above example, the target words that get positive weight are:
Je t'aime . ID1 le chat ID1
Args:
labels: a Tensor
Returns:
a Tensor
"""
eos_mask = tf.to_int32(tf.equal(labels, 1))
sentence_num = tf.cumsum(eos_mask, axis=1, exclusive=True)
in_target = tf.equal(tf.mod(sentence_num, 2), 1)
# first two tokens of each sentence are boilerplate.
sentence_num_plus_one = sentence_num + 1
shifted = tf.pad(sentence_num_plus_one,
[[0, 0], [2, 0], [0, 0], [0, 0]])[:, :-2, :, :]
nonboilerplate = tf.equal(sentence_num_plus_one, shifted)
ret = to_float(tf.logical_and(nonboilerplate, in_target))
return ret
|
[
"def",
"weights_concatenated",
"(",
"labels",
")",
":",
"eos_mask",
"=",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"equal",
"(",
"labels",
",",
"1",
")",
")",
"sentence_num",
"=",
"tf",
".",
"cumsum",
"(",
"eos_mask",
",",
"axis",
"=",
"1",
",",
"exclusive",
"=",
"True",
")",
"in_target",
"=",
"tf",
".",
"equal",
"(",
"tf",
".",
"mod",
"(",
"sentence_num",
",",
"2",
")",
",",
"1",
")",
"# first two tokens of each sentence are boilerplate.",
"sentence_num_plus_one",
"=",
"sentence_num",
"+",
"1",
"shifted",
"=",
"tf",
".",
"pad",
"(",
"sentence_num_plus_one",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"2",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"[",
":",
",",
":",
"-",
"2",
",",
":",
",",
":",
"]",
"nonboilerplate",
"=",
"tf",
".",
"equal",
"(",
"sentence_num_plus_one",
",",
"shifted",
")",
"ret",
"=",
"to_float",
"(",
"tf",
".",
"logical_and",
"(",
"nonboilerplate",
",",
"in_target",
")",
")",
"return",
"ret"
] |
Assign weight 1.0 to the "target" part of the concatenated labels.
The labels look like:
source English I love you . ID1 target French Je t'aime . ID1 source
English the cat ID1 target French le chat ID1 source English ...
We want to assign weight 1.0 to all words in the target text (including the
ID1 end symbol), but not to the source text or the boilerplate. In the
above example, the target words that get positive weight are:
Je t'aime . ID1 le chat ID1
Args:
labels: a Tensor
Returns:
a Tensor
|
[
"Assign",
"weight",
"1",
".",
"0",
"to",
"the",
"target",
"part",
"of",
"the",
"concatenated",
"labels",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1709-L1735
|
train
|
Assign weight 1. 0 to the target part of the concatenated labels.
|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3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(3100 - 2989) + '\061' + '\x34' + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2181 - 2128) + chr(1240 - 1185), 0b1000), ehT0Px3KOsy9('\060' + chr(4353 - 4242) + '\x33' + '\065' + chr(49), 62589 - 62581), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(51) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1 + 0o156) + chr(1126 - 1075) + '\067' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b110010) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(348 - 300) + '\157' + '\x32' + '\063' + '\x37', 27944 - 27936), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + chr(0b110010), 57149 - 57141), ehT0Px3KOsy9(chr(1321 - 1273) + chr(0b1101111) + chr(49) + chr(0b10111 + 0o36) + chr(2259 - 2211), 38118 - 38110), ehT0Px3KOsy9(chr(776 - 728) + chr(111) + chr(0b110000 + 0o1) + '\x32' + '\x36', 0b1000), ehT0Px3KOsy9(chr(1619 - 1571) + chr(0b111100 + 0o63) + chr(1876 - 1827) + chr(0b110000) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + '\x31' + chr(49) + chr(50), 15177 - 15169), ehT0Px3KOsy9(chr(0b110000) + chr(3443 - 3332) + chr(2044 - 1993) + '\062' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1849 - 1799) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(1456 - 1408) + '\063', 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\063' + chr(1947 - 1894) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(0b1001 + 0o50) + chr(0b100101 + 0o22) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100100 + 0o16) + chr(0b10011 + 0o41) + chr(1802 - 1753), 0o10), ehT0Px3KOsy9(chr(48) + chr(2769 - 2658) + chr(2275 - 2224) + chr(0b10111 + 0o32) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1001001 + 0o46) + chr(0b110010) + '\x31' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110000) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(54) + chr(0b10101 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(1449 - 1398) + '\x35' + chr(346 - 297), 8), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(52) + chr(0b11111 + 0o25), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(55) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(525 - 477) + '\157' + '\062' + '\x30' + '\064', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(49) + chr(49) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\063' + '\x32' + chr(1067 - 1016), 0o10), ehT0Px3KOsy9(chr(911 - 863) + '\157' + '\x32' + chr(0b110011) + chr(53), 55950 - 55942), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + '\061' + '\x36' + chr(2644 - 2591), 1668 - 1660), ehT0Px3KOsy9(chr(48) + chr(11251 - 11140) + chr(51) + chr(0b110100) + chr(0b110001 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10101 + 0o35) + chr(0b110010) + chr(53), 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(49) + chr(2453 - 2402) + '\065', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(49) + chr(0b10100 + 0o42), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1011010 + 0o25) + chr(0b110011) + chr(0b1001 + 0o55) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(1215 - 1162) + chr(1886 - 1836), 665 - 657), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101111 + 0o4) + chr(0b110000) + '\067', 25924 - 25916), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\x36' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(589 - 478) + chr(0b110001) + '\061' + chr(70 - 18), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2923 - 2812) + chr(0b100011 + 0o16) + '\061' + chr(2230 - 2177), 23830 - 23822)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(0b1101 + 0o50) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'M'), chr(3873 - 3773) + '\145' + '\143' + chr(0b1101111) + chr(5646 - 5546) + chr(0b1100101))('\x75' + chr(116) + chr(0b1100110) + chr(0b11111 + 0o16) + chr(2115 - 2059)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def c19GxpAr8Udv(uXMK81tmdpTM):
XfxHHy9okFYi = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.equal(uXMK81tmdpTM, ehT0Px3KOsy9(chr(48) + '\x6f' + chr(214 - 165), 0b1000)))
xcbgAPSqHtWS = IDJ2eXGCBCDu.i0lzZW3r00ue(XfxHHy9okFYi, axis=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10100 + 0o35), 8), exclusive=ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8))
zsh5RWyYItJi = IDJ2eXGCBCDu.equal(IDJ2eXGCBCDu.mod(xcbgAPSqHtWS, ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(127 - 77), 0b1000)), ehT0Px3KOsy9('\x30' + chr(111) + chr(1787 - 1738), 8))
RUqItnz237Dd = xcbgAPSqHtWS + ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8)
FseGXd0R6EWO = IDJ2eXGCBCDu.pad(RUqItnz237Dd, [[ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(48), 8)], [ehT0Px3KOsy9(chr(1129 - 1081) + chr(0b1101111) + chr(0b100 + 0o56), 8), ehT0Px3KOsy9(chr(1670 - 1622) + chr(111) + '\060', 8)], [ehT0Px3KOsy9(chr(537 - 489) + chr(111) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(1070 - 1022), 8)], [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1779 - 1731), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2282 - 2234), 8)]])[:, :-ehT0Px3KOsy9('\x30' + '\157' + chr(0b11110 + 0o24), 8), :, :]
_GrYjOn_Rkxc = IDJ2eXGCBCDu.equal(RUqItnz237Dd, FseGXd0R6EWO)
VHn4CV4Ymrei = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.logical_and(_GrYjOn_Rkxc, zsh5RWyYItJi))
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
padded_cross_entropy
|
def padded_cross_entropy(logits,
labels,
label_smoothing,
weights_fn=weights_nonzero,
reduce_sum=True,
cutoff=0.0,
gaussian=False):
"""Compute cross-entropy assuming 0s are padding.
Computes a loss numerator (the sum of losses), and loss denominator
(the number of non-padding tokens).
Args:
logits: a `Tensor` with shape `[batch, timesteps, vocab_size]`.
optionally a FactoredTensor.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
cutoff: a float, at which point to have no loss.
gaussian: If true, use a Gaussian distribution for label smoothing
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
Raises:
ValueError: in case of unsupported argument types.
"""
if isinstance(logits, FactoredTensor):
if gaussian:
raise ValueError("Factored padded cross entropy with Gaussian smoothing "
"is not implemented yet.")
return padded_cross_entropy_factored(
logits,
labels,
label_smoothing,
weights_fn=weights_fn,
reduce_sum=reduce_sum)
confidence = 1.0 - label_smoothing
logits_shape = shape_list(logits)
vocab_size = logits_shape[-1]
with tf.name_scope("padded_cross_entropy", values=[logits, labels]):
if len(logits_shape) == 2:
# Deal with the case where we did not insert extra dimensions due to
# TPU issues. No pad-to-same-length happens in this case.
# TODO(noam): remove this logic once TPU can handle extra dimensions.
labels = tf.reshape(labels, [-1])
else:
logits, labels = pad_with_zeros(logits, labels)
logits = tf.reshape(
logits,
shape_list(labels) + [vocab_size],
name="padded_cross_entropy_size_check")
logits = tf.cast(logits, tf.float32)
xent = smoothing_cross_entropy(
logits, labels, vocab_size, confidence, gaussian=gaussian)
weights = weights_fn(labels)
if cutoff > 0.0:
xent = tf.nn.relu(xent - cutoff)
if not reduce_sum:
return xent * weights, weights
return tf.reduce_sum(xent * weights), tf.reduce_sum(weights)
|
python
|
def padded_cross_entropy(logits,
labels,
label_smoothing,
weights_fn=weights_nonzero,
reduce_sum=True,
cutoff=0.0,
gaussian=False):
"""Compute cross-entropy assuming 0s are padding.
Computes a loss numerator (the sum of losses), and loss denominator
(the number of non-padding tokens).
Args:
logits: a `Tensor` with shape `[batch, timesteps, vocab_size]`.
optionally a FactoredTensor.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
cutoff: a float, at which point to have no loss.
gaussian: If true, use a Gaussian distribution for label smoothing
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
Raises:
ValueError: in case of unsupported argument types.
"""
if isinstance(logits, FactoredTensor):
if gaussian:
raise ValueError("Factored padded cross entropy with Gaussian smoothing "
"is not implemented yet.")
return padded_cross_entropy_factored(
logits,
labels,
label_smoothing,
weights_fn=weights_fn,
reduce_sum=reduce_sum)
confidence = 1.0 - label_smoothing
logits_shape = shape_list(logits)
vocab_size = logits_shape[-1]
with tf.name_scope("padded_cross_entropy", values=[logits, labels]):
if len(logits_shape) == 2:
# Deal with the case where we did not insert extra dimensions due to
# TPU issues. No pad-to-same-length happens in this case.
# TODO(noam): remove this logic once TPU can handle extra dimensions.
labels = tf.reshape(labels, [-1])
else:
logits, labels = pad_with_zeros(logits, labels)
logits = tf.reshape(
logits,
shape_list(labels) + [vocab_size],
name="padded_cross_entropy_size_check")
logits = tf.cast(logits, tf.float32)
xent = smoothing_cross_entropy(
logits, labels, vocab_size, confidence, gaussian=gaussian)
weights = weights_fn(labels)
if cutoff > 0.0:
xent = tf.nn.relu(xent - cutoff)
if not reduce_sum:
return xent * weights, weights
return tf.reduce_sum(xent * weights), tf.reduce_sum(weights)
|
[
"def",
"padded_cross_entropy",
"(",
"logits",
",",
"labels",
",",
"label_smoothing",
",",
"weights_fn",
"=",
"weights_nonzero",
",",
"reduce_sum",
"=",
"True",
",",
"cutoff",
"=",
"0.0",
",",
"gaussian",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"logits",
",",
"FactoredTensor",
")",
":",
"if",
"gaussian",
":",
"raise",
"ValueError",
"(",
"\"Factored padded cross entropy with Gaussian smoothing \"",
"\"is not implemented yet.\"",
")",
"return",
"padded_cross_entropy_factored",
"(",
"logits",
",",
"labels",
",",
"label_smoothing",
",",
"weights_fn",
"=",
"weights_fn",
",",
"reduce_sum",
"=",
"reduce_sum",
")",
"confidence",
"=",
"1.0",
"-",
"label_smoothing",
"logits_shape",
"=",
"shape_list",
"(",
"logits",
")",
"vocab_size",
"=",
"logits_shape",
"[",
"-",
"1",
"]",
"with",
"tf",
".",
"name_scope",
"(",
"\"padded_cross_entropy\"",
",",
"values",
"=",
"[",
"logits",
",",
"labels",
"]",
")",
":",
"if",
"len",
"(",
"logits_shape",
")",
"==",
"2",
":",
"# Deal with the case where we did not insert extra dimensions due to",
"# TPU issues. No pad-to-same-length happens in this case.",
"# TODO(noam): remove this logic once TPU can handle extra dimensions.",
"labels",
"=",
"tf",
".",
"reshape",
"(",
"labels",
",",
"[",
"-",
"1",
"]",
")",
"else",
":",
"logits",
",",
"labels",
"=",
"pad_with_zeros",
"(",
"logits",
",",
"labels",
")",
"logits",
"=",
"tf",
".",
"reshape",
"(",
"logits",
",",
"shape_list",
"(",
"labels",
")",
"+",
"[",
"vocab_size",
"]",
",",
"name",
"=",
"\"padded_cross_entropy_size_check\"",
")",
"logits",
"=",
"tf",
".",
"cast",
"(",
"logits",
",",
"tf",
".",
"float32",
")",
"xent",
"=",
"smoothing_cross_entropy",
"(",
"logits",
",",
"labels",
",",
"vocab_size",
",",
"confidence",
",",
"gaussian",
"=",
"gaussian",
")",
"weights",
"=",
"weights_fn",
"(",
"labels",
")",
"if",
"cutoff",
">",
"0.0",
":",
"xent",
"=",
"tf",
".",
"nn",
".",
"relu",
"(",
"xent",
"-",
"cutoff",
")",
"if",
"not",
"reduce_sum",
":",
"return",
"xent",
"*",
"weights",
",",
"weights",
"return",
"tf",
".",
"reduce_sum",
"(",
"xent",
"*",
"weights",
")",
",",
"tf",
".",
"reduce_sum",
"(",
"weights",
")"
] |
Compute cross-entropy assuming 0s are padding.
Computes a loss numerator (the sum of losses), and loss denominator
(the number of non-padding tokens).
Args:
logits: a `Tensor` with shape `[batch, timesteps, vocab_size]`.
optionally a FactoredTensor.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
cutoff: a float, at which point to have no loss.
gaussian: If true, use a Gaussian distribution for label smoothing
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
Raises:
ValueError: in case of unsupported argument types.
|
[
"Compute",
"cross",
"-",
"entropy",
"assuming",
"0s",
"are",
"padding",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1738-L1800
|
train
|
Computes the padded cross - entropy of the current state.
|
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(chr(48) + chr(9067 - 8956) + chr(0b110100) + chr(1046 - 993), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(48) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(650 - 602) + '\157' + chr(0b110010) + chr(0b101111 + 0o4) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3285 - 3174) + '\x33' + chr(2682 - 2628) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(137 - 84) + chr(48), 7474 - 7466), ehT0Px3KOsy9(chr(1386 - 1338) + chr(0b100001 + 0o116) + '\x32' + chr(0b1001 + 0o55) + chr(225 - 173), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001 + 0o2) + chr(1549 - 1500) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000100 + 0o53) + '\x31' + chr(0b101000 + 0o10) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(470 - 359) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x34' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(50) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(741 - 630) + chr(51) + chr(914 - 862) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b110001) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5021 - 4910) + '\062' + '\060' + chr(716 - 661), 11773 - 11765), ehT0Px3KOsy9(chr(378 - 330) + chr(0b110100 + 0o73) + chr(0b1010 + 0o47) + '\x31' + chr(0b110010), 23229 - 23221), ehT0Px3KOsy9('\060' + chr(0b101010 + 0o105) + chr(0b110001) + chr(0b1 + 0o63) + chr(0b11000 + 0o37), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1110 + 0o44) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + chr(0b110001) + chr(53) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1764 - 1716) + chr(111) + chr(0b10010 + 0o41) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\x30' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + '\062' + chr(0b110111) + chr(53), 36172 - 36164), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x36' + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8298 - 8187) + chr(51) + '\x31' + chr(1738 - 1687), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + '\061' + chr(386 - 336) + '\x35', 40422 - 40414), ehT0Px3KOsy9('\x30' + '\157' + chr(2059 - 2009) + chr(2400 - 2350), 0b1000), ehT0Px3KOsy9(chr(856 - 808) + '\x6f' + chr(0b110001) + chr(0b1010 + 0o52) + chr(0b10100 + 0o40), 58352 - 58344), ehT0Px3KOsy9('\060' + chr(5502 - 5391) + '\x31' + chr(51) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(10011 - 9900) + '\061' + '\x37', 836 - 828), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(52) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x35' + chr(48), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b110010) + chr(54), 853 - 845), ehT0Px3KOsy9(chr(1199 - 1151) + chr(0b1101111) + '\x32' + chr(0b110111) + chr(0b110100), 49440 - 49432), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\064' + chr(1244 - 1194), 45536 - 45528), ehT0Px3KOsy9(chr(2258 - 2210) + chr(0b111100 + 0o63) + chr(2268 - 2218) + '\x35' + chr(527 - 478), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101000 + 0o107) + chr(1323 - 1273) + '\x32', 8), ehT0Px3KOsy9(chr(1119 - 1071) + chr(443 - 332) + chr(2451 - 2400) + '\x35' + chr(0b110110 + 0o1), 13485 - 13477), ehT0Px3KOsy9('\x30' + chr(3874 - 3763) + '\x33' + chr(1450 - 1398) + chr(0b101000 + 0o12), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b1001 + 0o53), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b110010) + chr(0b10010 + 0o37) + chr(0b10 + 0o65), 46771 - 46763), ehT0Px3KOsy9('\060' + chr(9012 - 8901) + '\x31' + '\x34', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(9308 - 9197) + chr(2325 - 2272) + '\060', 10160 - 10152)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b'), '\x64' + chr(101) + chr(0b1100011) + chr(0b111100 + 0o63) + chr(100) + chr(0b1100101))(chr(2710 - 2593) + '\164' + chr(0b1001 + 0o135) + '\055' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def QSrDoD2cjgpU(wF9nmvjsKjYM, uXMK81tmdpTM, FSjUgdaczzRk, Pdbc6Q2jZ4RQ=aMdemxOfy8Ik, O3yRJHXcfeTa=ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(263 - 214), 0b1000), EjnQGacZaia3=0.0, vubub2fS53Qn=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10111 + 0o31), ord("\x08"))):
if PlSM16l2KDPD(wF9nmvjsKjYM, vxXu08erJJ8A):
if vubub2fS53Qn:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'c"\xfd\x85\x87\xc6\xa9"&S\xf5\x80m\xe2.G\xd1\x1at1\xce\x15\xae;f\x161\x7f\xde\x88\xe1\xd5\x16\xc12\xa8\x83y\xfc\x7fL"\xf0\xd1\x9b\xd9\xa3)rK\xfd\x8an\xa7#\x14\x92\x06t6\x9d\\\xa6%~\x013j\xc9\xdc\xf3\xd8B\xd0w\x9b\xcc'), chr(0b10100 + 0o120) + chr(1141 - 1040) + '\143' + chr(213 - 102) + chr(6255 - 6155) + chr(0b1100001 + 0o4))(chr(117) + chr(2259 - 2143) + chr(0b1100110) + '\055' + chr(0b111000)))
return BnIgkWeQqzsZ(wF9nmvjsKjYM, uXMK81tmdpTM, FSjUgdaczzRk, weights_fn=Pdbc6Q2jZ4RQ, reduce_sum=O3yRJHXcfeTa)
IGc_qm7pp85x = 1.0 - FSjUgdaczzRk
Isx8k9uq36YR = qypPRW8fq869(wF9nmvjsKjYM)
CeyMIoSyrpkQ = Isx8k9uq36YR[-ehT0Px3KOsy9(chr(48) + chr(6231 - 6120) + chr(1992 - 1943), 8)]
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'K"\xf3\x94\xb7\xc7\xaf)vF'), chr(100) + '\x65' + chr(0b1100011) + chr(4539 - 4428) + chr(0b1100100) + '\145')(chr(7580 - 7463) + chr(116) + chr(0b1100110) + '\x2d' + chr(0b101000 + 0o20)))(xafqLlk3kkUe(SXOLrMavuUCe(b'U"\xfa\x95\x8d\xd0\x93%tL\xe7\x97V\xe2$\x13\xc0\x07k;'), chr(1641 - 1541) + chr(101) + chr(3181 - 3082) + chr(0b1101111) + '\144' + chr(0b111111 + 0o46))('\x75' + chr(0b111111 + 0o65) + chr(0b1100110) + chr(0b101101) + chr(56)), values=[wF9nmvjsKjYM, uXMK81tmdpTM]):
if c2A0yzQpDQB3(Isx8k9uq36YR) == ehT0Px3KOsy9('\060' + '\157' + chr(579 - 529), 19633 - 19625):
uXMK81tmdpTM = IDJ2eXGCBCDu.reshape(uXMK81tmdpTM, [-ehT0Px3KOsy9(chr(48) + chr(8622 - 8511) + chr(49), 8)])
else:
(wF9nmvjsKjYM, uXMK81tmdpTM) = cnO1gZ8246Uh(wF9nmvjsKjYM, uXMK81tmdpTM)
wF9nmvjsKjYM = IDJ2eXGCBCDu.reshape(wF9nmvjsKjYM, qypPRW8fq869(uXMK81tmdpTM) + [CeyMIoSyrpkQ], name=xafqLlk3kkUe(SXOLrMavuUCe(b'U"\xfa\x95\x8d\xd0\x93%tL\xe7\x97V\xe2$\x13\xc0\x07k;\xe2F\xa2/w;=g\xc2\xcb\xfd'), '\144' + chr(2696 - 2595) + chr(0b110010 + 0o61) + '\157' + '\x64' + chr(0b1100101))(chr(9947 - 9830) + '\x74' + chr(0b10011 + 0o123) + chr(0b10011 + 0o32) + chr(0b10010 + 0o46)))
wF9nmvjsKjYM = IDJ2eXGCBCDu.cast(wF9nmvjsKjYM, IDJ2eXGCBCDu.float32)
_YHpmhjj_eGR = ANQl8nDw9Rk9(wF9nmvjsKjYM, uXMK81tmdpTM, CeyMIoSyrpkQ, IGc_qm7pp85x, gaussian=vubub2fS53Qn)
ZurHTci57aXw = Pdbc6Q2jZ4RQ(uXMK81tmdpTM)
if EjnQGacZaia3 > 0.0:
_YHpmhjj_eGR = IDJ2eXGCBCDu.nn.relu(_YHpmhjj_eGR - EjnQGacZaia3)
if not O3yRJHXcfeTa:
return (_YHpmhjj_eGR * ZurHTci57aXw, ZurHTci57aXw)
return (xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W&\xfa\x84\x8b\xd1\x935sN'), chr(100) + '\145' + chr(9278 - 9179) + chr(1617 - 1506) + chr(0b1100100) + '\145')(chr(0b111101 + 0o70) + chr(116) + chr(0b1100110) + chr(375 - 330) + '\x38'))(_YHpmhjj_eGR * ZurHTci57aXw), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W&\xfa\x84\x8b\xd1\x935sN'), chr(100) + chr(4642 - 4541) + '\143' + chr(7415 - 7304) + chr(100) + chr(7949 - 7848))(chr(4908 - 4791) + chr(3397 - 3281) + chr(0b110 + 0o140) + '\x2d' + '\x38'))(ZurHTci57aXw))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
padded_cross_entropy_mixture
|
def padded_cross_entropy_mixture(logits,
labels,
label_smoothing,
num_mixtures,
weights_fn=weights_nonzero,
reduce_sum=False,
cutoff=0.0,
gaussian=False,
return_best_logits=False):
"""Compute cross-entropy assuming 0s are padding.
Computes a loss numerator (the sum of losses), and loss denominator
(the number of non-padding tokens).
Computes cross-entropy for each mixture, and returns the corresponding values
for the mixture with the highest probability
Args:
logits: `Tensor` with shape `[batch * num_mixtures, timesteps, vocab_size]`.
optionally a FactoredTensor.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
num_mixtures: an integer.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
cutoff: a float, at which point to have no loss.
gaussian: If true, use a Gaussian distribution for label smoothing
return_best_logits: If true, return the logits of the mixture with highest
probabilities for an example
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
Raises:
ValueError: in case of unsupported argument types.
"""
logit_shapes = shape_list(
logits) # batch_size * num_mixtures, timesteps, 1, 1, vocab_size
batch_size = tf.cast(logit_shapes[0] / num_mixtures, dtype=tf.int32)
timesteps = logit_shapes[1]
vocab_size = logit_shapes[4]
new_shape_for_xent = [num_mixtures] + shape_list(labels)
labels = tf.tile(labels, [num_mixtures, 1, 1, 1])
xent, weights = padded_cross_entropy(logits, labels, label_smoothing,
weights_fn, reduce_sum, cutoff, gaussian)
# reshape xent and weights to have the num_mixtures as first dimension
xent = tf.reshape(xent, new_shape_for_xent)
weights = tf.reshape(weights, new_shape_for_xent[:-1])
# sum up sentence neg log probs
xent = tf.reduce_sum(xent, axis=2)
# if we need to compute the best logits
if return_best_logits:
best_mixture_indices = tf.cast(tf.argmin(xent, 0), dtype=tf.int32)
individual_element_indices = tf.range(batch_size)
stacked_mixture_element_indices = tf.stack((tf.squeeze(
best_mixture_indices, axis=[1, 2]), individual_element_indices), -1)
best_logits = tf.reshape(logits,
[num_mixtures, -1, timesteps, 1, 1, vocab_size])
best_logits = tf.gather_nd(best_logits, stacked_mixture_element_indices)
best_logits = tf.reshape(best_logits,
[batch_size, timesteps, 1, 1, vocab_size])
with tf.control_dependencies([
tf.assert_equal(
tf.shape(xent)[:3], [num_mixtures, batch_size, 1],
message="Each batch element should have a probability value for each mixture element"
)
]):
xent_min = tf.reduce_min(xent, axis=0)
xent_max = tf.reduce_max(xent, axis=0)
weights = tf.reduce_mean(weights, axis=0)
with tf.control_dependencies([
tf.assert_equal(
tf.shape(xent_min)[0], [batch_size],
message="There should be batch_size elements after selecting best mixture probabilities"
)
]):
summed_xent_min = tf.reduce_sum(xent_min)
summed_xent_max = tf.reduce_sum(xent_max)
summed_weights = tf.reduce_sum(weights)
tf.summary.scalar("mixture_xents_min", summed_xent_min / summed_weights)
tf.summary.scalar("mixture_xents_max", summed_xent_max / summed_weights)
if return_best_logits:
return summed_xent_min, summed_weights, best_logits
else:
return summed_xent_min, summed_weights
|
python
|
def padded_cross_entropy_mixture(logits,
labels,
label_smoothing,
num_mixtures,
weights_fn=weights_nonzero,
reduce_sum=False,
cutoff=0.0,
gaussian=False,
return_best_logits=False):
"""Compute cross-entropy assuming 0s are padding.
Computes a loss numerator (the sum of losses), and loss denominator
(the number of non-padding tokens).
Computes cross-entropy for each mixture, and returns the corresponding values
for the mixture with the highest probability
Args:
logits: `Tensor` with shape `[batch * num_mixtures, timesteps, vocab_size]`.
optionally a FactoredTensor.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
num_mixtures: an integer.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
cutoff: a float, at which point to have no loss.
gaussian: If true, use a Gaussian distribution for label smoothing
return_best_logits: If true, return the logits of the mixture with highest
probabilities for an example
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
Raises:
ValueError: in case of unsupported argument types.
"""
logit_shapes = shape_list(
logits) # batch_size * num_mixtures, timesteps, 1, 1, vocab_size
batch_size = tf.cast(logit_shapes[0] / num_mixtures, dtype=tf.int32)
timesteps = logit_shapes[1]
vocab_size = logit_shapes[4]
new_shape_for_xent = [num_mixtures] + shape_list(labels)
labels = tf.tile(labels, [num_mixtures, 1, 1, 1])
xent, weights = padded_cross_entropy(logits, labels, label_smoothing,
weights_fn, reduce_sum, cutoff, gaussian)
# reshape xent and weights to have the num_mixtures as first dimension
xent = tf.reshape(xent, new_shape_for_xent)
weights = tf.reshape(weights, new_shape_for_xent[:-1])
# sum up sentence neg log probs
xent = tf.reduce_sum(xent, axis=2)
# if we need to compute the best logits
if return_best_logits:
best_mixture_indices = tf.cast(tf.argmin(xent, 0), dtype=tf.int32)
individual_element_indices = tf.range(batch_size)
stacked_mixture_element_indices = tf.stack((tf.squeeze(
best_mixture_indices, axis=[1, 2]), individual_element_indices), -1)
best_logits = tf.reshape(logits,
[num_mixtures, -1, timesteps, 1, 1, vocab_size])
best_logits = tf.gather_nd(best_logits, stacked_mixture_element_indices)
best_logits = tf.reshape(best_logits,
[batch_size, timesteps, 1, 1, vocab_size])
with tf.control_dependencies([
tf.assert_equal(
tf.shape(xent)[:3], [num_mixtures, batch_size, 1],
message="Each batch element should have a probability value for each mixture element"
)
]):
xent_min = tf.reduce_min(xent, axis=0)
xent_max = tf.reduce_max(xent, axis=0)
weights = tf.reduce_mean(weights, axis=0)
with tf.control_dependencies([
tf.assert_equal(
tf.shape(xent_min)[0], [batch_size],
message="There should be batch_size elements after selecting best mixture probabilities"
)
]):
summed_xent_min = tf.reduce_sum(xent_min)
summed_xent_max = tf.reduce_sum(xent_max)
summed_weights = tf.reduce_sum(weights)
tf.summary.scalar("mixture_xents_min", summed_xent_min / summed_weights)
tf.summary.scalar("mixture_xents_max", summed_xent_max / summed_weights)
if return_best_logits:
return summed_xent_min, summed_weights, best_logits
else:
return summed_xent_min, summed_weights
|
[
"def",
"padded_cross_entropy_mixture",
"(",
"logits",
",",
"labels",
",",
"label_smoothing",
",",
"num_mixtures",
",",
"weights_fn",
"=",
"weights_nonzero",
",",
"reduce_sum",
"=",
"False",
",",
"cutoff",
"=",
"0.0",
",",
"gaussian",
"=",
"False",
",",
"return_best_logits",
"=",
"False",
")",
":",
"logit_shapes",
"=",
"shape_list",
"(",
"logits",
")",
"# batch_size * num_mixtures, timesteps, 1, 1, vocab_size",
"batch_size",
"=",
"tf",
".",
"cast",
"(",
"logit_shapes",
"[",
"0",
"]",
"/",
"num_mixtures",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"timesteps",
"=",
"logit_shapes",
"[",
"1",
"]",
"vocab_size",
"=",
"logit_shapes",
"[",
"4",
"]",
"new_shape_for_xent",
"=",
"[",
"num_mixtures",
"]",
"+",
"shape_list",
"(",
"labels",
")",
"labels",
"=",
"tf",
".",
"tile",
"(",
"labels",
",",
"[",
"num_mixtures",
",",
"1",
",",
"1",
",",
"1",
"]",
")",
"xent",
",",
"weights",
"=",
"padded_cross_entropy",
"(",
"logits",
",",
"labels",
",",
"label_smoothing",
",",
"weights_fn",
",",
"reduce_sum",
",",
"cutoff",
",",
"gaussian",
")",
"# reshape xent and weights to have the num_mixtures as first dimension",
"xent",
"=",
"tf",
".",
"reshape",
"(",
"xent",
",",
"new_shape_for_xent",
")",
"weights",
"=",
"tf",
".",
"reshape",
"(",
"weights",
",",
"new_shape_for_xent",
"[",
":",
"-",
"1",
"]",
")",
"# sum up sentence neg log probs",
"xent",
"=",
"tf",
".",
"reduce_sum",
"(",
"xent",
",",
"axis",
"=",
"2",
")",
"# if we need to compute the best logits",
"if",
"return_best_logits",
":",
"best_mixture_indices",
"=",
"tf",
".",
"cast",
"(",
"tf",
".",
"argmin",
"(",
"xent",
",",
"0",
")",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"individual_element_indices",
"=",
"tf",
".",
"range",
"(",
"batch_size",
")",
"stacked_mixture_element_indices",
"=",
"tf",
".",
"stack",
"(",
"(",
"tf",
".",
"squeeze",
"(",
"best_mixture_indices",
",",
"axis",
"=",
"[",
"1",
",",
"2",
"]",
")",
",",
"individual_element_indices",
")",
",",
"-",
"1",
")",
"best_logits",
"=",
"tf",
".",
"reshape",
"(",
"logits",
",",
"[",
"num_mixtures",
",",
"-",
"1",
",",
"timesteps",
",",
"1",
",",
"1",
",",
"vocab_size",
"]",
")",
"best_logits",
"=",
"tf",
".",
"gather_nd",
"(",
"best_logits",
",",
"stacked_mixture_element_indices",
")",
"best_logits",
"=",
"tf",
".",
"reshape",
"(",
"best_logits",
",",
"[",
"batch_size",
",",
"timesteps",
",",
"1",
",",
"1",
",",
"vocab_size",
"]",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"tf",
".",
"assert_equal",
"(",
"tf",
".",
"shape",
"(",
"xent",
")",
"[",
":",
"3",
"]",
",",
"[",
"num_mixtures",
",",
"batch_size",
",",
"1",
"]",
",",
"message",
"=",
"\"Each batch element should have a probability value for each mixture element\"",
")",
"]",
")",
":",
"xent_min",
"=",
"tf",
".",
"reduce_min",
"(",
"xent",
",",
"axis",
"=",
"0",
")",
"xent_max",
"=",
"tf",
".",
"reduce_max",
"(",
"xent",
",",
"axis",
"=",
"0",
")",
"weights",
"=",
"tf",
".",
"reduce_mean",
"(",
"weights",
",",
"axis",
"=",
"0",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"tf",
".",
"assert_equal",
"(",
"tf",
".",
"shape",
"(",
"xent_min",
")",
"[",
"0",
"]",
",",
"[",
"batch_size",
"]",
",",
"message",
"=",
"\"There should be batch_size elements after selecting best mixture probabilities\"",
")",
"]",
")",
":",
"summed_xent_min",
"=",
"tf",
".",
"reduce_sum",
"(",
"xent_min",
")",
"summed_xent_max",
"=",
"tf",
".",
"reduce_sum",
"(",
"xent_max",
")",
"summed_weights",
"=",
"tf",
".",
"reduce_sum",
"(",
"weights",
")",
"tf",
".",
"summary",
".",
"scalar",
"(",
"\"mixture_xents_min\"",
",",
"summed_xent_min",
"/",
"summed_weights",
")",
"tf",
".",
"summary",
".",
"scalar",
"(",
"\"mixture_xents_max\"",
",",
"summed_xent_max",
"/",
"summed_weights",
")",
"if",
"return_best_logits",
":",
"return",
"summed_xent_min",
",",
"summed_weights",
",",
"best_logits",
"else",
":",
"return",
"summed_xent_min",
",",
"summed_weights"
] |
Compute cross-entropy assuming 0s are padding.
Computes a loss numerator (the sum of losses), and loss denominator
(the number of non-padding tokens).
Computes cross-entropy for each mixture, and returns the corresponding values
for the mixture with the highest probability
Args:
logits: `Tensor` with shape `[batch * num_mixtures, timesteps, vocab_size]`.
optionally a FactoredTensor.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
num_mixtures: an integer.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
cutoff: a float, at which point to have no loss.
gaussian: If true, use a Gaussian distribution for label smoothing
return_best_logits: If true, return the logits of the mixture with highest
probabilities for an example
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
Raises:
ValueError: in case of unsupported argument types.
|
[
"Compute",
"cross",
"-",
"entropy",
"assuming",
"0s",
"are",
"padding",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1803-L1897
|
train
|
Computes the cross - entropy of a mixture of tokens.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,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p=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' + '\x30' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(983 - 935) + chr(0b1101111) + chr(1395 - 1346) + chr(0b11111 + 0o23) + chr(815 - 764), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\067' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(2226 - 2175) + chr(1411 - 1356), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(64 - 15) + chr(1495 - 1447) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(225 - 175) + chr(0b11001 + 0o35) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010111 + 0o30) + chr(309 - 258) + '\x30' + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + chr(0b10010 + 0o45) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + '\061' + '\065', 0b1000), ehT0Px3KOsy9(chr(1432 - 1384) + '\x6f' + chr(53) + chr(649 - 599), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\065' + '\067', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\061', 44230 - 44222), ehT0Px3KOsy9('\060' + chr(111) + chr(2319 - 2269) + chr(331 - 279), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5369 - 5258) + chr(0b110001 + 0o1) + '\066' + chr(156 - 101), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(49) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(828 - 780) + chr(111) + chr(90 - 40) + chr(1490 - 1437) + chr(0b11010 + 0o30), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(50) + chr(0b11001 + 0o32), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110110) + '\066', 20050 - 20042), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110100) + chr(0b1000 + 0o56), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(1918 - 1807) + chr(0b110001) + chr(2428 - 2376) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(0b110010) + chr(0b110100 + 0o2) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1171 - 1122) + '\x30' + chr(48), 39565 - 39557), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(0b0 + 0o62) + chr(48) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8313 - 8202) + chr(367 - 316) + '\066' + chr(2595 - 2542), 0b1000), ehT0Px3KOsy9(chr(1019 - 971) + '\x6f' + '\x33' + '\x36' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(2039 - 1990) + '\065', 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + '\x36' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\060' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + '\064' + '\060', 42451 - 42443), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\x30' + chr(50), 50548 - 50540), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(49) + '\x31' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1085 - 1037) + chr(0b1101111) + chr(1464 - 1413) + chr(1964 - 1915), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b110011) + chr(1716 - 1662), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b110000 + 0o4) + chr(0b101000 + 0o14), 0o10), ehT0Px3KOsy9(chr(48) + chr(10396 - 10285) + chr(51) + '\067' + '\063', 63994 - 63986), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + '\065' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(1336 - 1287) + '\065', 8), ehT0Px3KOsy9(chr(1617 - 1569) + '\157' + chr(2537 - 2482) + chr(0b10101 + 0o41), 33715 - 33707), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(0b10010 + 0o40) + chr(0b110000), 23789 - 23781)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + '\x30', 30868 - 30860)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe8'), chr(5281 - 5181) + '\x65' + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))(chr(8602 - 8485) + '\x74' + '\x66' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cMzzo5M2Yphp(wF9nmvjsKjYM, uXMK81tmdpTM, FSjUgdaczzRk, nRVKiXhndakY, Pdbc6Q2jZ4RQ=aMdemxOfy8Ik, O3yRJHXcfeTa=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000), 0o10), EjnQGacZaia3=0.0, vubub2fS53Qn=ehT0Px3KOsy9(chr(1731 - 1683) + chr(0b1101110 + 0o1) + chr(1410 - 1362), 8), gcvnkMzFuIhL=ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(10452 - 10341) + chr(0b100010 + 0o16), 8)):
FW3HM7N7p_qz = qypPRW8fq869(wF9nmvjsKjYM)
ix9dZyeAmUxY = IDJ2eXGCBCDu.cast(FW3HM7N7p_qz[ehT0Px3KOsy9(chr(1947 - 1899) + chr(0b1101111) + '\060', 8)] / nRVKiXhndakY, dtype=IDJ2eXGCBCDu.int32)
QNvXCjnvcnON = FW3HM7N7p_qz[ehT0Px3KOsy9(chr(0b110000) + chr(2617 - 2506) + chr(794 - 745), ord("\x08"))]
CeyMIoSyrpkQ = FW3HM7N7p_qz[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2003 - 1951), 0b1000)]
ZywO2BbxCZQa = [nRVKiXhndakY] + qypPRW8fq869(uXMK81tmdpTM)
uXMK81tmdpTM = IDJ2eXGCBCDu.tile(uXMK81tmdpTM, [nRVKiXhndakY, ehT0Px3KOsy9(chr(1768 - 1720) + chr(0b1101111) + chr(0b110001), 8), ehT0Px3KOsy9(chr(1867 - 1819) + chr(0b1101111) + chr(233 - 184), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101011 + 0o6), 8)])
(_YHpmhjj_eGR, ZurHTci57aXw) = QSrDoD2cjgpU(wF9nmvjsKjYM, uXMK81tmdpTM, FSjUgdaczzRk, Pdbc6Q2jZ4RQ, O3yRJHXcfeTa, EjnQGacZaia3, vubub2fS53Qn)
_YHpmhjj_eGR = IDJ2eXGCBCDu.reshape(_YHpmhjj_eGR, ZywO2BbxCZQa)
ZurHTci57aXw = IDJ2eXGCBCDu.reshape(ZurHTci57aXw, ZywO2BbxCZQa[:-ehT0Px3KOsy9('\060' + chr(111) + '\061', 8)])
_YHpmhjj_eGR = IDJ2eXGCBCDu.reduce_sum(_YHpmhjj_eGR, axis=ehT0Px3KOsy9(chr(1352 - 1304) + chr(111) + chr(0b11110 + 0o24), 48741 - 48733))
if gcvnkMzFuIhL:
vsy1sjgla14e = IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.argmin(_YHpmhjj_eGR, ehT0Px3KOsy9(chr(96 - 48) + '\157' + chr(48), 8)), dtype=IDJ2eXGCBCDu.int32)
UVRrkaHeV3Zu = IDJ2eXGCBCDu.range(ix9dZyeAmUxY)
RldtoPSlTAwL = IDJ2eXGCBCDu.stack((IDJ2eXGCBCDu.squeeze(vsy1sjgla14e, axis=[ehT0Px3KOsy9(chr(825 - 777) + chr(0b1101111) + '\x31', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(50), 8)]), UVRrkaHeV3Zu), -ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001), 8))
raPoGbIUqngR = IDJ2eXGCBCDu.reshape(wF9nmvjsKjYM, [nRVKiXhndakY, -ehT0Px3KOsy9(chr(48) + chr(0b111110 + 0o61) + chr(0b101010 + 0o7), 8), QNvXCjnvcnON, ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8), ehT0Px3KOsy9(chr(143 - 95) + '\157' + chr(0b110001), 8), CeyMIoSyrpkQ])
raPoGbIUqngR = IDJ2eXGCBCDu.gather_nd(raPoGbIUqngR, RldtoPSlTAwL)
raPoGbIUqngR = IDJ2eXGCBCDu.reshape(raPoGbIUqngR, [ix9dZyeAmUxY, QNvXCjnvcnON, ehT0Px3KOsy9('\x30' + '\x6f' + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(450 - 401), 8), CeyMIoSyrpkQ])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5<\xd0+7\xd9\xabc\xa9O_tzz\xd2\xe1\xc9:SU'), chr(6736 - 6636) + '\145' + chr(0b100001 + 0o102) + '\157' + '\x64' + '\145')(chr(117) + '\x74' + chr(0b1100110) + chr(45) + chr(56)))([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7 \xcd:7\xc2\x98Y\xbc_N}'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\x6f' + '\x64' + chr(0b111011 + 0o52))(chr(117) + chr(116) + '\146' + '\055' + chr(0b111000)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa82\xcb\x06#\xfa\xa0P\x99ZLs'), '\x64' + chr(101) + chr(0b101100 + 0o67) + '\x6f' + chr(0b1100100) + '\x65')('\x75' + '\x74' + '\x66' + chr(0b101101) + chr(0b111000)))(_YHpmhjj_eGR)[:ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011), 1024 - 1016)], [nRVKiXhndakY, ix9dZyeAmUxY, ehT0Px3KOsy9('\060' + chr(111) + chr(0b11111 + 0o22), 8)], message=xafqLlk3kkUe(SXOLrMavuUCe(b"\x832\xdd7e\xd4\xa6H\xaeB\x0ftx{\xda\xea\xc4'\x16U\n\xdf5\xef\x91\xd6%P\xb6Eb(9.\x96\x94\x0b,\\y\xaa:\xca&e\xc0\xa6P\xb8O\x0fw{l\x97\xea\xcb0^\x06\x0f\xd98\xf7\x80\x84(\x11\xa5L'$|0\x90"), '\144' + '\145' + '\x63' + '\157' + chr(2257 - 2157) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(10361 - 10259) + chr(0b1000 + 0o45) + chr(0b100100 + 0o24)))]):
UAp0GrGJGmT8 = IDJ2eXGCBCDu.reduce_min(_YHpmhjj_eGR, axis=ehT0Px3KOsy9(chr(1280 - 1232) + '\x6f' + chr(48), 8))
M774SrSVvzid = IDJ2eXGCBCDu.reduce_max(_YHpmhjj_eGR, axis=ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + '\x30', 8))
ZurHTci57aXw = IDJ2eXGCBCDu.reduce_mean(ZurHTci57aXw, axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000), 8))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5<\xd0+7\xd9\xabc\xa9O_tzz\xd2\xe1\xc9:SU'), chr(7653 - 7553) + chr(0b100110 + 0o77) + '\143' + '\157' + '\x64' + chr(1925 - 1824))('\x75' + '\164' + '\146' + '\055' + chr(0b101110 + 0o12)))([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7 \xcd:7\xc2\x98Y\xbc_N}'), '\144' + '\145' + '\x63' + chr(0b1101100 + 0o3) + chr(0b10010 + 0o122) + chr(7918 - 7817))(chr(117) + chr(116) + '\146' + '\x2d' + '\x38'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa82\xcb\x06#\xfa\xa0P\x99ZLs'), chr(3433 - 3333) + chr(0b1010110 + 0o17) + chr(0b1100011) + chr(111) + chr(0b1011000 + 0o14) + chr(0b1100101))(chr(0b1110101 + 0o0) + '\164' + chr(0b11 + 0o143) + chr(45) + '\x38'))(UAp0GrGJGmT8)[ehT0Px3KOsy9('\x30' + chr(5859 - 5748) + chr(0b10001 + 0o37), 8)], [ix9dZyeAmUxY], message=xafqLlk3kkUe(SXOLrMavuUCe(b'\x92;\xdb- \x96\xb4T\xa2_Cu4|\xd2\xaf\xc82BE\n\xef3\xea\x8f\x93mT\xacE/,w*\x97\xdb\x08+Ju\xb4s\xcd:)\xd3\xa4H\xa4DH1v{\xc4\xfb\x8a>_^\x16\xc52\xe6\xd5\x86?^\xa2A u7\x90\x92\x0c>'), chr(0b10011 + 0o121) + chr(101) + chr(0b110010 + 0o61) + chr(1384 - 1273) + chr(100) + chr(0b111100 + 0o51))(chr(0b111000 + 0o75) + '\x74' + chr(0b1100110) + '\x2d' + '\070'))]):
X5GsCtQNsCY1 = IDJ2eXGCBCDu.reduce_sum(UAp0GrGJGmT8)
PewlDbMA7hyf = IDJ2eXGCBCDu.reduce_sum(M774SrSVvzid)
SHqKEaooAjMb = IDJ2eXGCBCDu.reduce_sum(ZurHTci57aXw)
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb50\xdf3$\xc4'), chr(100) + chr(0b101 + 0o140) + chr(3911 - 3812) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(8104 - 8002) + chr(0b101001 + 0o4) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xab:\xc6+0\xc4\xa2c\xb5OAegA\xda\xe6\xc4'), '\144' + chr(101) + chr(0b1100011) + chr(0b110001 + 0o76) + '\144' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(9160 - 9058) + '\055' + '\x38'), X5GsCtQNsCY1 / SHqKEaooAjMb)
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb50\xdf3$\xc4'), chr(0b1100100) + chr(0b1100101) + chr(8940 - 8841) + chr(0b1101111) + chr(100) + chr(101))(chr(117) + chr(0b1110100) + '\146' + chr(1520 - 1475) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xab:\xc6+0\xc4\xa2c\xb5OAegA\xda\xee\xd2'), chr(0b1010000 + 0o24) + chr(5337 - 5236) + chr(99) + '\157' + chr(100) + chr(0b1100101))(chr(0b1101110 + 0o7) + chr(10913 - 10797) + chr(102) + '\x2d' + '\070'), PewlDbMA7hyf / SHqKEaooAjMb)
if gcvnkMzFuIhL:
return (X5GsCtQNsCY1, SHqKEaooAjMb, raPoGbIUqngR)
else:
return (X5GsCtQNsCY1, SHqKEaooAjMb)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
dml_loss
|
def dml_loss(pred, labels, weights_fn=_weights_one_third, reduce_sum=True):
"""Discretized mixture of logistics loss.
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
labels: A [batch, height, width, channels] tensor of 8-bit pixel
intensities. The computation assumes channels is 3.
weights_fn: A function of labels, returning a Tensor of shape
[batch, height, width] which weights each loss term. Default is to scale
each loss term by 1/3 so that they capture the average across channels.
reduce_sum: A boolean, to return scalar loss instead of per position.
Returns:
Tuple of loss tensors for numerator and denominator, each a scalar if
reduce_sum else of shape [batch, height, width]. The sum of their divisions
is the number of nats for each pixel in labels.
"""
real_labels = convert_rgb_to_symmetric_real(labels)
dml_loss_value = discretized_mix_logistic_loss(pred=pred, labels=real_labels)
weights = weights_fn(labels)
loss_num = weights * dml_loss_value
loss_den = weights_nonzero(weights)
if reduce_sum:
loss_num = tf.reduce_sum(loss_num)
loss_den = tf.reduce_sum(loss_den)
return loss_num, loss_den
|
python
|
def dml_loss(pred, labels, weights_fn=_weights_one_third, reduce_sum=True):
"""Discretized mixture of logistics loss.
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
labels: A [batch, height, width, channels] tensor of 8-bit pixel
intensities. The computation assumes channels is 3.
weights_fn: A function of labels, returning a Tensor of shape
[batch, height, width] which weights each loss term. Default is to scale
each loss term by 1/3 so that they capture the average across channels.
reduce_sum: A boolean, to return scalar loss instead of per position.
Returns:
Tuple of loss tensors for numerator and denominator, each a scalar if
reduce_sum else of shape [batch, height, width]. The sum of their divisions
is the number of nats for each pixel in labels.
"""
real_labels = convert_rgb_to_symmetric_real(labels)
dml_loss_value = discretized_mix_logistic_loss(pred=pred, labels=real_labels)
weights = weights_fn(labels)
loss_num = weights * dml_loss_value
loss_den = weights_nonzero(weights)
if reduce_sum:
loss_num = tf.reduce_sum(loss_num)
loss_den = tf.reduce_sum(loss_den)
return loss_num, loss_den
|
[
"def",
"dml_loss",
"(",
"pred",
",",
"labels",
",",
"weights_fn",
"=",
"_weights_one_third",
",",
"reduce_sum",
"=",
"True",
")",
":",
"real_labels",
"=",
"convert_rgb_to_symmetric_real",
"(",
"labels",
")",
"dml_loss_value",
"=",
"discretized_mix_logistic_loss",
"(",
"pred",
"=",
"pred",
",",
"labels",
"=",
"real_labels",
")",
"weights",
"=",
"weights_fn",
"(",
"labels",
")",
"loss_num",
"=",
"weights",
"*",
"dml_loss_value",
"loss_den",
"=",
"weights_nonzero",
"(",
"weights",
")",
"if",
"reduce_sum",
":",
"loss_num",
"=",
"tf",
".",
"reduce_sum",
"(",
"loss_num",
")",
"loss_den",
"=",
"tf",
".",
"reduce_sum",
"(",
"loss_den",
")",
"return",
"loss_num",
",",
"loss_den"
] |
Discretized mixture of logistics loss.
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
labels: A [batch, height, width, channels] tensor of 8-bit pixel
intensities. The computation assumes channels is 3.
weights_fn: A function of labels, returning a Tensor of shape
[batch, height, width] which weights each loss term. Default is to scale
each loss term by 1/3 so that they capture the average across channels.
reduce_sum: A boolean, to return scalar loss instead of per position.
Returns:
Tuple of loss tensors for numerator and denominator, each a scalar if
reduce_sum else of shape [batch, height, width]. The sum of their divisions
is the number of nats for each pixel in labels.
|
[
"Discretized",
"mixture",
"of",
"logistics",
"loss",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1905-L1934
|
train
|
Discretized mixture of logistics loss.
|
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,GNd6A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gDP,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(1442 - 1394) + chr(0b1101111) + chr(0b10100 + 0o35) + chr(1827 - 1776) + chr(1730 - 1675), 0o10), ehT0Px3KOsy9(chr(2185 - 2137) + chr(11079 - 10968) + chr(1690 - 1641) + chr(0b11100 + 0o33) + chr(0b10111 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\064' + '\065', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + chr(1364 - 1310) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(4427 - 4316) + '\x35' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + '\x31' + '\x30' + chr(2032 - 1984), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + chr(0b110001) + chr(50) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101010 + 0o105) + '\061' + chr(51) + chr(1929 - 1881), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b110001) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + chr(0b110011) + chr(0b100010 + 0o23) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + chr(1085 - 974) + chr(54) + chr(0b101001 + 0o13), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(54) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\x35' + chr(0b100100 + 0o23), 8), ehT0Px3KOsy9(chr(1457 - 1409) + chr(111) + chr(0b101100 + 0o6) + '\x30' + chr(0b11000 + 0o36), 9732 - 9724), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + '\x32' + chr(0b110000) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + chr(2424 - 2374) + chr(2077 - 2027) + chr(0b1 + 0o66), 0o10), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + chr(0b110011) + chr(0b110001) + chr(0b11100 + 0o27), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2059 - 2008) + chr(0b101101 + 0o5) + chr(0b10 + 0o64), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1710 - 1659) + chr(50) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011110 + 0o21) + '\x31' + chr(0b110011) + '\067', 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + '\063' + chr(54) + chr(0b110000), 11765 - 11757), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b1011 + 0o46) + '\064' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x36' + chr(903 - 853), 27650 - 27642), ehT0Px3KOsy9('\060' + chr(8174 - 8063) + chr(49) + '\063' + chr(0b10001 + 0o46), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b110100) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\062' + '\060' + '\x37', 8), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b101100 + 0o11) + '\061', 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1001001 + 0o46) + chr(1943 - 1894), 24206 - 24198), ehT0Px3KOsy9(chr(99 - 51) + '\x6f' + '\x31' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b111101 + 0o62) + '\x33' + chr(48) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111 + 0o150) + '\062' + '\x30' + chr(0b110001 + 0o6), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(668 - 618) + chr(50) + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1 + 0o156) + chr(0b110011) + '\x31' + chr(501 - 446), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(2552 - 2441) + chr(1123 - 1073) + '\x37' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(884 - 836) + chr(111) + chr(0b10010 + 0o37) + '\x32' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(0b110100) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\x31' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\x31' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1799 - 1748) + '\060' + '\x30', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'q'), chr(100) + chr(0b101111 + 0o66) + chr(0b1100011) + '\157' + chr(100) + chr(101))(chr(5425 - 5308) + '\164' + chr(0b1100110) + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hBd3KDM5G3ep(eyamnrN0elUS, uXMK81tmdpTM, Pdbc6Q2jZ4RQ=bhMMyzXUjIGj, O3yRJHXcfeTa=ehT0Px3KOsy9('\x30' + chr(4914 - 4803) + chr(0b110 + 0o53), 8)):
w0LlV58mw4JF = Frzb27ocYoFw(uXMK81tmdpTM)
HJDT_tSkD3dK = QN6E8_6_l5yS(pred=eyamnrN0elUS, labels=w0LlV58mw4JF)
ZurHTci57aXw = Pdbc6Q2jZ4RQ(uXMK81tmdpTM)
ezRZFHpxj7YX = ZurHTci57aXw * HJDT_tSkD3dK
bNn6FMpPN5Af = aMdemxOfy8Ik(ZurHTci57aXw)
if O3yRJHXcfeTa:
ezRZFHpxj7YX = IDJ2eXGCBCDu.reduce_sum(ezRZFHpxj7YX)
bNn6FMpPN5Af = IDJ2eXGCBCDu.reduce_sum(bNn6FMpPN5Af)
return (ezRZFHpxj7YX, bNn6FMpPN5Af)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
split_to_discretized_mix_logistic_params
|
def split_to_discretized_mix_logistic_params(inputs):
"""Splits input tensor into parameters of discretized mixture logistic.
Args:
inputs: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
Returns:
Tuple of unconstrained mixture probabilities, locations, scales, and
coefficient parameters of the distribution. The mixture probability has
shape [batch, height, width, num_mixtures]. Other parameters have shape
[batch, height, width, num_mixtures, 3].
"""
batch, height, width, output_dim = shape_list(inputs) # pylint: disable=unbalanced-tuple-unpacking
num_mixtures = output_dim // 10
logits, locs, log_scales, coeffs = tf.split(
inputs,
num_or_size_splits=[
num_mixtures, num_mixtures * 3, num_mixtures * 3, num_mixtures * 3
],
axis=-1)
split_shape = [batch, height, width, num_mixtures, 3]
locs = tf.reshape(locs, split_shape)
log_scales = tf.reshape(log_scales, split_shape)
log_scales = tf.maximum(log_scales, -7.)
coeffs = tf.reshape(coeffs, split_shape)
coeffs = tf.tanh(coeffs)
return logits, locs, log_scales, coeffs
|
python
|
def split_to_discretized_mix_logistic_params(inputs):
"""Splits input tensor into parameters of discretized mixture logistic.
Args:
inputs: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
Returns:
Tuple of unconstrained mixture probabilities, locations, scales, and
coefficient parameters of the distribution. The mixture probability has
shape [batch, height, width, num_mixtures]. Other parameters have shape
[batch, height, width, num_mixtures, 3].
"""
batch, height, width, output_dim = shape_list(inputs) # pylint: disable=unbalanced-tuple-unpacking
num_mixtures = output_dim // 10
logits, locs, log_scales, coeffs = tf.split(
inputs,
num_or_size_splits=[
num_mixtures, num_mixtures * 3, num_mixtures * 3, num_mixtures * 3
],
axis=-1)
split_shape = [batch, height, width, num_mixtures, 3]
locs = tf.reshape(locs, split_shape)
log_scales = tf.reshape(log_scales, split_shape)
log_scales = tf.maximum(log_scales, -7.)
coeffs = tf.reshape(coeffs, split_shape)
coeffs = tf.tanh(coeffs)
return logits, locs, log_scales, coeffs
|
[
"def",
"split_to_discretized_mix_logistic_params",
"(",
"inputs",
")",
":",
"batch",
",",
"height",
",",
"width",
",",
"output_dim",
"=",
"shape_list",
"(",
"inputs",
")",
"# pylint: disable=unbalanced-tuple-unpacking",
"num_mixtures",
"=",
"output_dim",
"//",
"10",
"logits",
",",
"locs",
",",
"log_scales",
",",
"coeffs",
"=",
"tf",
".",
"split",
"(",
"inputs",
",",
"num_or_size_splits",
"=",
"[",
"num_mixtures",
",",
"num_mixtures",
"*",
"3",
",",
"num_mixtures",
"*",
"3",
",",
"num_mixtures",
"*",
"3",
"]",
",",
"axis",
"=",
"-",
"1",
")",
"split_shape",
"=",
"[",
"batch",
",",
"height",
",",
"width",
",",
"num_mixtures",
",",
"3",
"]",
"locs",
"=",
"tf",
".",
"reshape",
"(",
"locs",
",",
"split_shape",
")",
"log_scales",
"=",
"tf",
".",
"reshape",
"(",
"log_scales",
",",
"split_shape",
")",
"log_scales",
"=",
"tf",
".",
"maximum",
"(",
"log_scales",
",",
"-",
"7.",
")",
"coeffs",
"=",
"tf",
".",
"reshape",
"(",
"coeffs",
",",
"split_shape",
")",
"coeffs",
"=",
"tf",
".",
"tanh",
"(",
"coeffs",
")",
"return",
"logits",
",",
"locs",
",",
"log_scales",
",",
"coeffs"
] |
Splits input tensor into parameters of discretized mixture logistic.
Args:
inputs: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
Returns:
Tuple of unconstrained mixture probabilities, locations, scales, and
coefficient parameters of the distribution. The mixture probability has
shape [batch, height, width, num_mixtures]. Other parameters have shape
[batch, height, width, num_mixtures, 3].
|
[
"Splits",
"input",
"tensor",
"into",
"parameters",
"of",
"discretized",
"mixture",
"logistic",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1937-L1967
|
train
|
Splits input tensor into logits locations scales and coefficients of discretized mixture logistic.
|
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,o0Cg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w8ep3k,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(1099 - 1051) + '\157' + chr(1984 - 1931) + chr(0b110011), 57297 - 57289), ehT0Px3KOsy9(chr(48) + chr(8713 - 8602) + chr(0b110111) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(1178 - 1130) + '\x6f' + chr(0b110011) + chr(49) + '\x34', 39637 - 39629), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + '\x37' + chr(0b110001), 13343 - 13335), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(526 - 477) + chr(0b100100 + 0o15) + chr(54), 0b1000), ehT0Px3KOsy9(chr(684 - 636) + chr(9557 - 9446) + '\061' + chr(0b100100 + 0o21) + chr(52), 45877 - 45869), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100111 + 0o13) + chr(853 - 804) + '\x36', 0b1000), ehT0Px3KOsy9(chr(1109 - 1061) + '\157' + chr(2063 - 2013) + chr(55 - 6) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1733 - 1682) + '\060' + '\064', 0b1000), ehT0Px3KOsy9(chr(1838 - 1790) + '\157' + chr(0b110010) + chr(54) + chr(1019 - 971), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(0b110111) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101010 + 0o5) + chr(0b110001) + chr(0b1100 + 0o47) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b100000 + 0o117) + chr(51) + chr(52) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + '\064' + chr(53), 10763 - 10755), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1010 + 0o47) + '\x31' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + '\066' + chr(1248 - 1198), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(1186 - 1137) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b110010 + 0o75) + '\x32' + chr(50) + chr(53), 0o10), ehT0Px3KOsy9(chr(294 - 246) + '\157' + chr(0b1010 + 0o51) + chr(0b110100) + '\065', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(2339 - 2286) + chr(1598 - 1545), 13278 - 13270), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1147 - 1096) + '\x37' + chr(0b110001), 54842 - 54834), ehT0Px3KOsy9('\x30' + chr(8681 - 8570) + '\x32' + chr(1086 - 1034) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(1082 - 1028) + chr(0b11110 + 0o24), 15373 - 15365), ehT0Px3KOsy9('\x30' + chr(0b1110 + 0o141) + chr(0b110110) + chr(48), 0o10), ehT0Px3KOsy9(chr(638 - 590) + chr(111) + chr(2388 - 2337) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10111 + 0o34) + chr(0b100 + 0o63) + chr(539 - 490), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101100 + 0o7) + chr(0b110000) + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(0b1011110 + 0o21) + chr(51) + '\x33' + chr(0b110111), 16471 - 16463), ehT0Px3KOsy9(chr(740 - 692) + chr(0b1101111) + '\x31' + chr(2438 - 2386) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110100) + chr(802 - 752), 51357 - 51349), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x34' + chr(1006 - 953), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(1650 - 1597) + chr(1913 - 1862), 0b1000), ehT0Px3KOsy9(chr(2166 - 2118) + chr(0b111000 + 0o67) + '\x34' + chr(243 - 188), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\067' + chr(1335 - 1281), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1906 - 1855) + chr(0b110011) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(48) + chr(0b100101 + 0o13), 43820 - 43812), ehT0Px3KOsy9(chr(138 - 90) + '\x6f' + chr(2257 - 2208) + '\x33' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(998 - 950) + chr(1288 - 1177) + '\x31' + '\063' + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + chr(0b110010) + chr(0b110001) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\066' + chr(977 - 926), 53610 - 53602)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(7934 - 7823) + '\x35' + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x05'), '\x64' + chr(0b1100101) + chr(99) + '\x6f' + chr(0b1100100) + chr(0b100101 + 0o100))(chr(0b1110101) + '\164' + '\146' + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def AdnqFRAGDeWt(vXoupepMtCXU):
(dNwAahu8tvoY, ehbUULKuygfC, mPx09rBTrGXR, ihuwPgoinqSc) = qypPRW8fq869(vXoupepMtCXU)
nRVKiXhndakY = ihuwPgoinqSc // ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\x32', 0o10)
(wF9nmvjsKjYM, wWlRsdZxY7aO, prNudPqZmplL, Mq2X4hHIvLYE) = IDJ2eXGCBCDu.split(vXoupepMtCXU, num_or_size_splits=[nRVKiXhndakY, nRVKiXhndakY * ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10011 + 0o40), 0o10), nRVKiXhndakY * ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33', 8), nRVKiXhndakY * ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(0b10100 + 0o37), 8)], axis=-ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(49), ord("\x08")))
PoqlWCnCd1V2 = [dNwAahu8tvoY, ehbUULKuygfC, mPx09rBTrGXR, nRVKiXhndakY, ehT0Px3KOsy9('\060' + chr(0b11111 + 0o120) + chr(0b11010 + 0o31), 8)]
wWlRsdZxY7aO = IDJ2eXGCBCDu.reshape(wWlRsdZxY7aO, PoqlWCnCd1V2)
prNudPqZmplL = IDJ2eXGCBCDu.reshape(prNudPqZmplL, PoqlWCnCd1V2)
prNudPqZmplL = IDJ2eXGCBCDu.maximum(prNudPqZmplL, -7.0)
Mq2X4hHIvLYE = IDJ2eXGCBCDu.reshape(Mq2X4hHIvLYE, PoqlWCnCd1V2)
Mq2X4hHIvLYE = IDJ2eXGCBCDu.tanh(Mq2X4hHIvLYE)
return (wF9nmvjsKjYM, wWlRsdZxY7aO, prNudPqZmplL, Mq2X4hHIvLYE)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
discretized_mix_logistic_loss
|
def discretized_mix_logistic_loss(pred, labels):
"""Computes negative log probability for the discretized mixture of logistics.
The distribution of a whole pixel is a mixture of 3-dimensional discretized
logistic distributions. The 3-D discretized logistic factorizes as 3 1-D
discretized logistic distributions, one for each channel. It defines
```none
P(X = x)
= sum_{k=1}^K probs[k] * P(X = x | locs[k], scales[k])
= sum_{k=1}^K probs[k] * [
prod_{c=1}^3 DiscretizedLogistic(X[c] = x[c] | means[k][c], scales[k]) ]
```
The means tensor is a linear combination of location parameters and previous
channels. The discretized logistic distribution assigns probability mass to an
event P(X=x) via logistic CDFs: P(X <= x + 0.5) - P(X < x - 0.5) for 1 < x <
254; P(X <= 0.5) for x = 0; and 1 - P(X < 245.5) for x = 255. Instead of
8-bit inputs, this implementation assumes the events are rescaled to [-1, 1].
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
labels: A [batch, height, width, channels] tensor of true pixel intensities
rescaled to [-1, 1]. The computation assumes channels is 3.
Returns:
A [batch, height, width] tensor of the negative log conditional probability
of each pixel given all previous pixels.
"""
logits, locs, log_scales, coeffs = split_to_discretized_mix_logistic_params(
pred)
# Tile labels to broadcast compute across the mixture dimension.
batch, height, width, num_mixtures = shape_list(logits) # pylint: disable=unbalanced-tuple-unpacking
labels = tf.tile(
tf.reshape(labels, [batch, height, width, 1, 3]),
[1, 1, 1, num_mixtures, 1])
# p(x) = sigmoid((x - means_i + 1/255.)/scale_i) -
# sigmoid((x - means_i - 1/255.)/scale_i)
# for each channel i. The means are linearly parameterized.
means_0 = locs[..., 0]
means_1 = locs[..., 1] + coeffs[..., 0] * labels[..., 0]
means_2 = (
locs[..., 2] + coeffs[..., 1] * labels[..., 0] +
coeffs[..., 2] * labels[..., 1])
means = tf.stack([means_0, means_1, means_2], axis=-1)
centered_labels = labels - means
inv_stdv = tf.exp(-log_scales)
plus_in = inv_stdv * (centered_labels + 1. / 255.)
min_in = inv_stdv * (centered_labels - 1. / 255.)
cdf_plus = tf.nn.sigmoid(plus_in)
cdf_min = tf.nn.sigmoid(min_in)
# Compute log probability for edge case of 0 (before scaling), 255 (before
# scaling), and all other cases respectively.
log_prob_0 = plus_in - tf.nn.softplus(plus_in)
log_prob_255 = -tf.nn.softplus(min_in)
prob_event = tf.maximum(cdf_plus - cdf_min, 1e-12)
log_prob_event = tf.log(prob_event)
# Robustly select log-prob based on numerical edge-cases: (a) [-1, -1+eps);
# (b) (1-eps, 1]; (c) NaNs during `tf.gradients` of `tf.select`, which may
# cause `tf.log(0.)`; (d) p(x) < 1e-5.
mid_in = inv_stdv * centered_labels
log_prob_event_approx = (
mid_in - log_scales - 2. * tf.nn.softplus(mid_in) - np.log(127.5))
log_probs = tf.where(
labels < -0.999, log_prob_0,
tf.where(
labels > 0.999, log_prob_255,
tf.where(prob_event > 1e-5, log_prob_event, log_prob_event_approx)))
# Sum over channels and compute log-probability of each mixture.
log_probs = tf.reduce_sum(log_probs, -1) + tf.nn.log_softmax(logits, axis=-1)
output = -tf.reduce_logsumexp(log_probs, axis=-1)
return output
|
python
|
def discretized_mix_logistic_loss(pred, labels):
"""Computes negative log probability for the discretized mixture of logistics.
The distribution of a whole pixel is a mixture of 3-dimensional discretized
logistic distributions. The 3-D discretized logistic factorizes as 3 1-D
discretized logistic distributions, one for each channel. It defines
```none
P(X = x)
= sum_{k=1}^K probs[k] * P(X = x | locs[k], scales[k])
= sum_{k=1}^K probs[k] * [
prod_{c=1}^3 DiscretizedLogistic(X[c] = x[c] | means[k][c], scales[k]) ]
```
The means tensor is a linear combination of location parameters and previous
channels. The discretized logistic distribution assigns probability mass to an
event P(X=x) via logistic CDFs: P(X <= x + 0.5) - P(X < x - 0.5) for 1 < x <
254; P(X <= 0.5) for x = 0; and 1 - P(X < 245.5) for x = 255. Instead of
8-bit inputs, this implementation assumes the events are rescaled to [-1, 1].
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
labels: A [batch, height, width, channels] tensor of true pixel intensities
rescaled to [-1, 1]. The computation assumes channels is 3.
Returns:
A [batch, height, width] tensor of the negative log conditional probability
of each pixel given all previous pixels.
"""
logits, locs, log_scales, coeffs = split_to_discretized_mix_logistic_params(
pred)
# Tile labels to broadcast compute across the mixture dimension.
batch, height, width, num_mixtures = shape_list(logits) # pylint: disable=unbalanced-tuple-unpacking
labels = tf.tile(
tf.reshape(labels, [batch, height, width, 1, 3]),
[1, 1, 1, num_mixtures, 1])
# p(x) = sigmoid((x - means_i + 1/255.)/scale_i) -
# sigmoid((x - means_i - 1/255.)/scale_i)
# for each channel i. The means are linearly parameterized.
means_0 = locs[..., 0]
means_1 = locs[..., 1] + coeffs[..., 0] * labels[..., 0]
means_2 = (
locs[..., 2] + coeffs[..., 1] * labels[..., 0] +
coeffs[..., 2] * labels[..., 1])
means = tf.stack([means_0, means_1, means_2], axis=-1)
centered_labels = labels - means
inv_stdv = tf.exp(-log_scales)
plus_in = inv_stdv * (centered_labels + 1. / 255.)
min_in = inv_stdv * (centered_labels - 1. / 255.)
cdf_plus = tf.nn.sigmoid(plus_in)
cdf_min = tf.nn.sigmoid(min_in)
# Compute log probability for edge case of 0 (before scaling), 255 (before
# scaling), and all other cases respectively.
log_prob_0 = plus_in - tf.nn.softplus(plus_in)
log_prob_255 = -tf.nn.softplus(min_in)
prob_event = tf.maximum(cdf_plus - cdf_min, 1e-12)
log_prob_event = tf.log(prob_event)
# Robustly select log-prob based on numerical edge-cases: (a) [-1, -1+eps);
# (b) (1-eps, 1]; (c) NaNs during `tf.gradients` of `tf.select`, which may
# cause `tf.log(0.)`; (d) p(x) < 1e-5.
mid_in = inv_stdv * centered_labels
log_prob_event_approx = (
mid_in - log_scales - 2. * tf.nn.softplus(mid_in) - np.log(127.5))
log_probs = tf.where(
labels < -0.999, log_prob_0,
tf.where(
labels > 0.999, log_prob_255,
tf.where(prob_event > 1e-5, log_prob_event, log_prob_event_approx)))
# Sum over channels and compute log-probability of each mixture.
log_probs = tf.reduce_sum(log_probs, -1) + tf.nn.log_softmax(logits, axis=-1)
output = -tf.reduce_logsumexp(log_probs, axis=-1)
return output
|
[
"def",
"discretized_mix_logistic_loss",
"(",
"pred",
",",
"labels",
")",
":",
"logits",
",",
"locs",
",",
"log_scales",
",",
"coeffs",
"=",
"split_to_discretized_mix_logistic_params",
"(",
"pred",
")",
"# Tile labels to broadcast compute across the mixture dimension.",
"batch",
",",
"height",
",",
"width",
",",
"num_mixtures",
"=",
"shape_list",
"(",
"logits",
")",
"# pylint: disable=unbalanced-tuple-unpacking",
"labels",
"=",
"tf",
".",
"tile",
"(",
"tf",
".",
"reshape",
"(",
"labels",
",",
"[",
"batch",
",",
"height",
",",
"width",
",",
"1",
",",
"3",
"]",
")",
",",
"[",
"1",
",",
"1",
",",
"1",
",",
"num_mixtures",
",",
"1",
"]",
")",
"# p(x) = sigmoid((x - means_i + 1/255.)/scale_i) -",
"# sigmoid((x - means_i - 1/255.)/scale_i)",
"# for each channel i. The means are linearly parameterized.",
"means_0",
"=",
"locs",
"[",
"...",
",",
"0",
"]",
"means_1",
"=",
"locs",
"[",
"...",
",",
"1",
"]",
"+",
"coeffs",
"[",
"...",
",",
"0",
"]",
"*",
"labels",
"[",
"...",
",",
"0",
"]",
"means_2",
"=",
"(",
"locs",
"[",
"...",
",",
"2",
"]",
"+",
"coeffs",
"[",
"...",
",",
"1",
"]",
"*",
"labels",
"[",
"...",
",",
"0",
"]",
"+",
"coeffs",
"[",
"...",
",",
"2",
"]",
"*",
"labels",
"[",
"...",
",",
"1",
"]",
")",
"means",
"=",
"tf",
".",
"stack",
"(",
"[",
"means_0",
",",
"means_1",
",",
"means_2",
"]",
",",
"axis",
"=",
"-",
"1",
")",
"centered_labels",
"=",
"labels",
"-",
"means",
"inv_stdv",
"=",
"tf",
".",
"exp",
"(",
"-",
"log_scales",
")",
"plus_in",
"=",
"inv_stdv",
"*",
"(",
"centered_labels",
"+",
"1.",
"/",
"255.",
")",
"min_in",
"=",
"inv_stdv",
"*",
"(",
"centered_labels",
"-",
"1.",
"/",
"255.",
")",
"cdf_plus",
"=",
"tf",
".",
"nn",
".",
"sigmoid",
"(",
"plus_in",
")",
"cdf_min",
"=",
"tf",
".",
"nn",
".",
"sigmoid",
"(",
"min_in",
")",
"# Compute log probability for edge case of 0 (before scaling), 255 (before",
"# scaling), and all other cases respectively.",
"log_prob_0",
"=",
"plus_in",
"-",
"tf",
".",
"nn",
".",
"softplus",
"(",
"plus_in",
")",
"log_prob_255",
"=",
"-",
"tf",
".",
"nn",
".",
"softplus",
"(",
"min_in",
")",
"prob_event",
"=",
"tf",
".",
"maximum",
"(",
"cdf_plus",
"-",
"cdf_min",
",",
"1e-12",
")",
"log_prob_event",
"=",
"tf",
".",
"log",
"(",
"prob_event",
")",
"# Robustly select log-prob based on numerical edge-cases: (a) [-1, -1+eps);",
"# (b) (1-eps, 1]; (c) NaNs during `tf.gradients` of `tf.select`, which may",
"# cause `tf.log(0.)`; (d) p(x) < 1e-5.",
"mid_in",
"=",
"inv_stdv",
"*",
"centered_labels",
"log_prob_event_approx",
"=",
"(",
"mid_in",
"-",
"log_scales",
"-",
"2.",
"*",
"tf",
".",
"nn",
".",
"softplus",
"(",
"mid_in",
")",
"-",
"np",
".",
"log",
"(",
"127.5",
")",
")",
"log_probs",
"=",
"tf",
".",
"where",
"(",
"labels",
"<",
"-",
"0.999",
",",
"log_prob_0",
",",
"tf",
".",
"where",
"(",
"labels",
">",
"0.999",
",",
"log_prob_255",
",",
"tf",
".",
"where",
"(",
"prob_event",
">",
"1e-5",
",",
"log_prob_event",
",",
"log_prob_event_approx",
")",
")",
")",
"# Sum over channels and compute log-probability of each mixture.",
"log_probs",
"=",
"tf",
".",
"reduce_sum",
"(",
"log_probs",
",",
"-",
"1",
")",
"+",
"tf",
".",
"nn",
".",
"log_softmax",
"(",
"logits",
",",
"axis",
"=",
"-",
"1",
")",
"output",
"=",
"-",
"tf",
".",
"reduce_logsumexp",
"(",
"log_probs",
",",
"axis",
"=",
"-",
"1",
")",
"return",
"output"
] |
Computes negative log probability for the discretized mixture of logistics.
The distribution of a whole pixel is a mixture of 3-dimensional discretized
logistic distributions. The 3-D discretized logistic factorizes as 3 1-D
discretized logistic distributions, one for each channel. It defines
```none
P(X = x)
= sum_{k=1}^K probs[k] * P(X = x | locs[k], scales[k])
= sum_{k=1}^K probs[k] * [
prod_{c=1}^3 DiscretizedLogistic(X[c] = x[c] | means[k][c], scales[k]) ]
```
The means tensor is a linear combination of location parameters and previous
channels. The discretized logistic distribution assigns probability mass to an
event P(X=x) via logistic CDFs: P(X <= x + 0.5) - P(X < x - 0.5) for 1 < x <
254; P(X <= 0.5) for x = 0; and 1 - P(X < 245.5) for x = 255. Instead of
8-bit inputs, this implementation assumes the events are rescaled to [-1, 1].
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
labels: A [batch, height, width, channels] tensor of true pixel intensities
rescaled to [-1, 1]. The computation assumes channels is 3.
Returns:
A [batch, height, width] tensor of the negative log conditional probability
of each pixel given all previous pixels.
|
[
"Computes",
"negative",
"log",
"probability",
"for",
"the",
"discretized",
"mixture",
"of",
"logistics",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L1970-L2051
|
train
|
This function computes the negative log probability for the discretized mixture of logistics.
|
Pu7Z6IJCgH3a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A6,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(1010 - 962) + chr(1132 - 1021) + chr(0b110011) + chr(51) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(51) + chr(0b101000 + 0o10) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b110011) + chr(48), 47606 - 47598), ehT0Px3KOsy9('\x30' + chr(11974 - 11863) + chr(51) + chr(2071 - 2017) + chr(0b11001 + 0o33), ord("\x08")), ehT0Px3KOsy9(chr(2152 - 2104) + '\157' + '\x33' + chr(52) + chr(1729 - 1674), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001 + 0o2) + '\061' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(7114 - 7003) + chr(0b110011) + '\064' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1039 - 991) + '\x6f' + chr(2420 - 2369) + '\x36' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + '\062' + chr(0b10110 + 0o41) + '\064', 3902 - 3894), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b100101 + 0o13) + chr(1641 - 1590), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(1501 - 1450) + chr(0b101111 + 0o6) + chr(0b10010 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(3628 - 3517) + '\x35' + chr(1894 - 1842), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + chr(0b1101 + 0o50), 16286 - 16278), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11110 + 0o24) + chr(53) + '\x32', 13503 - 13495), ehT0Px3KOsy9(chr(430 - 382) + chr(0b1011111 + 0o20) + chr(50) + '\061' + '\x33', 0b1000), ehT0Px3KOsy9(chr(494 - 446) + '\157' + chr(480 - 429) + chr(0b110000 + 0o1) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(2267 - 2214) + chr(630 - 579), 8019 - 8011), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\062' + chr(53) + '\060', 5320 - 5312), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + '\062' + chr(54) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(2073 - 2023) + '\x36' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(2031 - 1981) + '\x34' + '\x36', 16289 - 16281), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(0b101100 + 0o7) + chr(0b110100) + '\067', 8), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + chr(54) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110010) + chr(1434 - 1381), 34934 - 34926), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(50) + chr(54), 0o10), ehT0Px3KOsy9(chr(447 - 399) + chr(0b11011 + 0o124) + chr(0b11011 + 0o31) + chr(50), 0o10), ehT0Px3KOsy9(chr(1564 - 1516) + chr(0b10101 + 0o132) + chr(0b110011 + 0o0) + chr(0b110111) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b100001 + 0o24) + chr(54), 0o10), ehT0Px3KOsy9(chr(2099 - 2051) + '\x6f' + chr(0b1001 + 0o52) + chr(0b10100 + 0o40) + chr(0b101010 + 0o10), 0b1000), ehT0Px3KOsy9(chr(1190 - 1142) + chr(0b1100111 + 0o10) + '\x31' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(52) + chr(0b100011 + 0o17), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + chr(0b1010 + 0o50) + chr(2244 - 2196) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101001 + 0o12) + '\x30' + '\067', 0o10), ehT0Px3KOsy9(chr(1260 - 1212) + chr(0b101101 + 0o102) + '\061' + chr(0b110001) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1011 + 0o46) + chr(2212 - 2159) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4411 - 4300) + chr(1728 - 1677) + chr(1385 - 1335) + chr(952 - 897), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b101011 + 0o6) + chr(53) + chr(990 - 941), 0b1000), ehT0Px3KOsy9('\060' + chr(877 - 766) + chr(573 - 522) + chr(0b110110) + chr(0b1011 + 0o53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b101001 + 0o11) + '\067' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3948 - 3837) + chr(51) + chr(584 - 536) + '\066', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + chr(1248 - 1195) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5'), chr(0b1100100) + '\145' + chr(99) + '\x6f' + chr(100) + chr(101))('\x75' + '\x74' + chr(102) + chr(1462 - 1417) + chr(222 - 166)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def QN6E8_6_l5yS(eyamnrN0elUS, uXMK81tmdpTM):
(wF9nmvjsKjYM, wWlRsdZxY7aO, prNudPqZmplL, Mq2X4hHIvLYE) = AdnqFRAGDeWt(eyamnrN0elUS)
(dNwAahu8tvoY, ehbUULKuygfC, mPx09rBTrGXR, nRVKiXhndakY) = qypPRW8fq869(wF9nmvjsKjYM)
uXMK81tmdpTM = IDJ2eXGCBCDu.tile(IDJ2eXGCBCDu.reshape(uXMK81tmdpTM, [dNwAahu8tvoY, ehbUULKuygfC, mPx09rBTrGXR, ehT0Px3KOsy9(chr(612 - 564) + chr(0b101110 + 0o101) + '\x31', 27738 - 27730), ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + '\063', ord("\x08"))]), [ehT0Px3KOsy9(chr(0b110000) + chr(12039 - 11928) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\x6f' + '\x31', 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(1685 - 1574) + chr(0b0 + 0o61), 8), nRVKiXhndakY, ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + chr(49), 8)])
gaWFT0SZkWlH = wWlRsdZxY7aO[..., ehT0Px3KOsy9('\x30' + '\157' + chr(0b10000 + 0o40), 0o10)]
etOJrGjVrpdx = wWlRsdZxY7aO[..., ehT0Px3KOsy9('\060' + chr(10332 - 10221) + chr(0b110001), 8)] + Mq2X4hHIvLYE[..., ehT0Px3KOsy9(chr(575 - 527) + chr(273 - 162) + chr(0b110000), 8)] * uXMK81tmdpTM[..., ehT0Px3KOsy9(chr(48) + '\x6f' + '\x30', 8)]
Wt9bofkD7x3M = wWlRsdZxY7aO[..., ehT0Px3KOsy9('\x30' + chr(3420 - 3309) + chr(0b1101 + 0o45), 0b1000)] + Mq2X4hHIvLYE[..., ehT0Px3KOsy9(chr(48) + '\x6f' + '\061', 8)] * uXMK81tmdpTM[..., ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x30', 8)] + Mq2X4hHIvLYE[..., ehT0Px3KOsy9(chr(1950 - 1902) + chr(111) + '\062', 8)] * uXMK81tmdpTM[..., ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8)]
XCAIkNRdiX0I = IDJ2eXGCBCDu.stack([gaWFT0SZkWlH, etOJrGjVrpdx, Wt9bofkD7x3M], axis=-ehT0Px3KOsy9(chr(1745 - 1697) + '\157' + chr(0b110 + 0o53), 8))
nqyP21erp5tJ = uXMK81tmdpTM - XCAIkNRdiX0I
KESHvvMsbicC = IDJ2eXGCBCDu.exp(-prNudPqZmplL)
BAfuf9U7rZLv = KESHvvMsbicC * (nqyP21erp5tJ + 1.0 / 255.0)
DTab5j4drdM1 = KESHvvMsbicC * (nqyP21erp5tJ - 1.0 / 255.0)
VpEj858ggixY = IDJ2eXGCBCDu.nn.sigmoid(BAfuf9U7rZLv)
csBL6n6y20JY = IDJ2eXGCBCDu.nn.sigmoid(DTab5j4drdM1)
dACpXN4CRQzO = BAfuf9U7rZLv - IDJ2eXGCBCDu.nn.softplus(BAfuf9U7rZLv)
alJ4x_gUPeTL = -IDJ2eXGCBCDu.nn.softplus(DTab5j4drdM1)
CTgX7wtVL6f6 = IDJ2eXGCBCDu.maximum(VpEj858ggixY - csBL6n6y20JY, 1e-12)
fbkeb4cNGx_i = IDJ2eXGCBCDu.log(CTgX7wtVL6f6)
BnCcmb7MmX61 = KESHvvMsbicC * nqyP21erp5tJ
_qFVeY7AUXVp = BnCcmb7MmX61 - prNudPqZmplL - 2.0 * IDJ2eXGCBCDu.nn.softplus(BnCcmb7MmX61) - WqUC3KWvYVup.log(127.5)
yPp0Syg5g6oO = IDJ2eXGCBCDu.dRFAC59yQBm_(uXMK81tmdpTM < -0.999, dACpXN4CRQzO, IDJ2eXGCBCDu.dRFAC59yQBm_(uXMK81tmdpTM > 0.999, alJ4x_gUPeTL, IDJ2eXGCBCDu.dRFAC59yQBm_(CTgX7wtVL6f6 > 1e-05, fbkeb4cNGx_i, _qFVeY7AUXVp)))
yPp0Syg5g6oO = IDJ2eXGCBCDu.reduce_sum(yPp0Syg5g6oO, -ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + chr(1824 - 1775), 8)) + IDJ2eXGCBCDu.nn.log_softmax(wF9nmvjsKjYM, axis=-ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(1541 - 1430) + chr(49), 8))
e1jVqMSBZ01Y = -IDJ2eXGCBCDu.reduce_logsumexp(yPp0Syg5g6oO, axis=-ehT0Px3KOsy9(chr(48) + chr(7994 - 7883) + '\x31', 8))
return e1jVqMSBZ01Y
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
sample_from_discretized_mix_logistic
|
def sample_from_discretized_mix_logistic(pred, seed=None):
"""Sampling from a discretized mixture of logistics.
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
seed: Random seed.
Returns:
A tensor of shape [batch, height, width, 3] with real intensities scaled
between -1 and 1.
"""
logits, locs, log_scales, coeffs = split_to_discretized_mix_logistic_params(
pred)
# Sample mixture indicator given logits using the gumbel max trick.
num_mixtures = shape_list(logits)[-1]
gumbel_noise = -tf.log(-tf.log(
tf.random_uniform(
tf.shape(logits), minval=1e-5, maxval=1. - 1e-5, seed=seed)))
sel = tf.one_hot(
tf.argmax(logits + gumbel_noise, -1),
depth=num_mixtures,
dtype=tf.float32)
# Select mixture component's parameters.
sel = tf.expand_dims(sel, -1)
locs = tf.reduce_sum(locs * sel, 3)
log_scales = tf.reduce_sum(log_scales * sel, 3)
coeffs = tf.reduce_sum(coeffs * sel, 3)
# Sample from 3-D logistic & clip to interval. Note we don't round to the
# nearest 8-bit value when sampling.
uniform_noise = tf.random_uniform(
tf.shape(locs), minval=1e-5, maxval=1. - 1e-5, seed=seed)
logistic_noise = tf.log(uniform_noise) - tf.log1p(-uniform_noise)
x = locs + tf.exp(log_scales) * logistic_noise
x0 = x[..., 0]
x1 = x[..., 1] + coeffs[..., 0] * x0
x2 = x[..., 2] + coeffs[..., 1] * x0 + coeffs[..., 2] * x1
x = tf.stack([x0, x1, x2], axis=-1)
x = tf.clip_by_value(x, -1., 1.)
return x
|
python
|
def sample_from_discretized_mix_logistic(pred, seed=None):
"""Sampling from a discretized mixture of logistics.
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
seed: Random seed.
Returns:
A tensor of shape [batch, height, width, 3] with real intensities scaled
between -1 and 1.
"""
logits, locs, log_scales, coeffs = split_to_discretized_mix_logistic_params(
pred)
# Sample mixture indicator given logits using the gumbel max trick.
num_mixtures = shape_list(logits)[-1]
gumbel_noise = -tf.log(-tf.log(
tf.random_uniform(
tf.shape(logits), minval=1e-5, maxval=1. - 1e-5, seed=seed)))
sel = tf.one_hot(
tf.argmax(logits + gumbel_noise, -1),
depth=num_mixtures,
dtype=tf.float32)
# Select mixture component's parameters.
sel = tf.expand_dims(sel, -1)
locs = tf.reduce_sum(locs * sel, 3)
log_scales = tf.reduce_sum(log_scales * sel, 3)
coeffs = tf.reduce_sum(coeffs * sel, 3)
# Sample from 3-D logistic & clip to interval. Note we don't round to the
# nearest 8-bit value when sampling.
uniform_noise = tf.random_uniform(
tf.shape(locs), minval=1e-5, maxval=1. - 1e-5, seed=seed)
logistic_noise = tf.log(uniform_noise) - tf.log1p(-uniform_noise)
x = locs + tf.exp(log_scales) * logistic_noise
x0 = x[..., 0]
x1 = x[..., 1] + coeffs[..., 0] * x0
x2 = x[..., 2] + coeffs[..., 1] * x0 + coeffs[..., 2] * x1
x = tf.stack([x0, x1, x2], axis=-1)
x = tf.clip_by_value(x, -1., 1.)
return x
|
[
"def",
"sample_from_discretized_mix_logistic",
"(",
"pred",
",",
"seed",
"=",
"None",
")",
":",
"logits",
",",
"locs",
",",
"log_scales",
",",
"coeffs",
"=",
"split_to_discretized_mix_logistic_params",
"(",
"pred",
")",
"# Sample mixture indicator given logits using the gumbel max trick.",
"num_mixtures",
"=",
"shape_list",
"(",
"logits",
")",
"[",
"-",
"1",
"]",
"gumbel_noise",
"=",
"-",
"tf",
".",
"log",
"(",
"-",
"tf",
".",
"log",
"(",
"tf",
".",
"random_uniform",
"(",
"tf",
".",
"shape",
"(",
"logits",
")",
",",
"minval",
"=",
"1e-5",
",",
"maxval",
"=",
"1.",
"-",
"1e-5",
",",
"seed",
"=",
"seed",
")",
")",
")",
"sel",
"=",
"tf",
".",
"one_hot",
"(",
"tf",
".",
"argmax",
"(",
"logits",
"+",
"gumbel_noise",
",",
"-",
"1",
")",
",",
"depth",
"=",
"num_mixtures",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
"# Select mixture component's parameters.",
"sel",
"=",
"tf",
".",
"expand_dims",
"(",
"sel",
",",
"-",
"1",
")",
"locs",
"=",
"tf",
".",
"reduce_sum",
"(",
"locs",
"*",
"sel",
",",
"3",
")",
"log_scales",
"=",
"tf",
".",
"reduce_sum",
"(",
"log_scales",
"*",
"sel",
",",
"3",
")",
"coeffs",
"=",
"tf",
".",
"reduce_sum",
"(",
"coeffs",
"*",
"sel",
",",
"3",
")",
"# Sample from 3-D logistic & clip to interval. Note we don't round to the",
"# nearest 8-bit value when sampling.",
"uniform_noise",
"=",
"tf",
".",
"random_uniform",
"(",
"tf",
".",
"shape",
"(",
"locs",
")",
",",
"minval",
"=",
"1e-5",
",",
"maxval",
"=",
"1.",
"-",
"1e-5",
",",
"seed",
"=",
"seed",
")",
"logistic_noise",
"=",
"tf",
".",
"log",
"(",
"uniform_noise",
")",
"-",
"tf",
".",
"log1p",
"(",
"-",
"uniform_noise",
")",
"x",
"=",
"locs",
"+",
"tf",
".",
"exp",
"(",
"log_scales",
")",
"*",
"logistic_noise",
"x0",
"=",
"x",
"[",
"...",
",",
"0",
"]",
"x1",
"=",
"x",
"[",
"...",
",",
"1",
"]",
"+",
"coeffs",
"[",
"...",
",",
"0",
"]",
"*",
"x0",
"x2",
"=",
"x",
"[",
"...",
",",
"2",
"]",
"+",
"coeffs",
"[",
"...",
",",
"1",
"]",
"*",
"x0",
"+",
"coeffs",
"[",
"...",
",",
"2",
"]",
"*",
"x1",
"x",
"=",
"tf",
".",
"stack",
"(",
"[",
"x0",
",",
"x1",
",",
"x2",
"]",
",",
"axis",
"=",
"-",
"1",
")",
"x",
"=",
"tf",
".",
"clip_by_value",
"(",
"x",
",",
"-",
"1.",
",",
"1.",
")",
"return",
"x"
] |
Sampling from a discretized mixture of logistics.
Args:
pred: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients which linearly parameterize dependence across
channels.
seed: Random seed.
Returns:
A tensor of shape [batch, height, width, 3] with real intensities scaled
between -1 and 1.
|
[
"Sampling",
"from",
"a",
"discretized",
"mixture",
"of",
"logistics",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2054-L2100
|
train
|
Sampling from a discretized mixture of logistics.
|
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,koCeDPY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yZZT,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(2320 - 2271) + chr(54) + chr(0b110010), 14206 - 14198), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(49) + '\x30' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\063' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b1000 + 0o57) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b111 + 0o54) + chr(0b110010) + chr(310 - 260), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(52) + chr(521 - 471), 26569 - 26561), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\x34' + chr(50), 59278 - 59270), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(3506 - 3395) + '\x31' + '\066' + '\x32', 8), ehT0Px3KOsy9('\060' + chr(10678 - 10567) + chr(54) + chr(2173 - 2123), 64900 - 64892), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b11111 + 0o120) + chr(1774 - 1725) + '\x30' + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b110011 + 0o74) + '\x31' + '\063' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(9247 - 9136) + '\067', 6385 - 6377), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b10111 + 0o130) + chr(0b110010) + chr(632 - 577) + chr(451 - 396), 4917 - 4909), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(9317 - 9206) + chr(50) + chr(0b110001) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b101 + 0o55) + chr(0b11000 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1934 - 1879) + chr(0b101000 + 0o15), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2046 - 1995) + '\060' + chr(709 - 660), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b110010) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x34' + chr(0b101100 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(835 - 786) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\061' + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + chr(0b1101 + 0o44) + '\067' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(49) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1 + 0o61) + chr(1938 - 1884) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(12182 - 12071) + chr(0b100000 + 0o22) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(4394 - 4283) + '\x32' + chr(49) + chr(0b101101 + 0o10), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101001 + 0o6) + chr(0b1101 + 0o44) + '\x35' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6638 - 6527) + '\x33' + chr(0b100 + 0o54) + '\x35', 27741 - 27733), ehT0Px3KOsy9('\060' + '\x6f' + chr(1452 - 1399) + '\x32', 13023 - 13015), ehT0Px3KOsy9(chr(48) + chr(2941 - 2830) + chr(50) + chr(0b11100 + 0o31) + chr(1319 - 1268), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1521 - 1472) + chr(0b1111 + 0o43) + '\x36', 38337 - 38329), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b110010) + '\x31' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1505 - 1457) + chr(0b10 + 0o155) + chr(0b110001) + chr(0b1111 + 0o47) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b110110 + 0o71) + chr(51) + chr(0b110101) + chr(0b0 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11000 + 0o32) + chr(0b101100 + 0o12) + '\x33', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11100 + 0o32) + chr(1375 - 1323), 43229 - 43221), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + '\x31' + '\x30', 37351 - 37343), ehT0Px3KOsy9('\x30' + chr(114 - 3) + '\062' + '\x35' + '\x36', 20739 - 20731)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\065' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\\'), chr(6310 - 6210) + '\145' + chr(9598 - 9499) + chr(0b1101111) + chr(100) + chr(1011 - 910))('\x75' + chr(10563 - 10447) + '\146' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def sgF0tcOMKn5V(eyamnrN0elUS, cEhryM0YPR0h=None):
(wF9nmvjsKjYM, wWlRsdZxY7aO, prNudPqZmplL, Mq2X4hHIvLYE) = AdnqFRAGDeWt(eyamnrN0elUS)
nRVKiXhndakY = qypPRW8fq869(wF9nmvjsKjYM)[-ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(2253 - 2204), ord("\x08"))]
zdBGPnQ8RuZl = -IDJ2eXGCBCDu.log(-IDJ2eXGCBCDu.log(IDJ2eXGCBCDu.random_uniform(IDJ2eXGCBCDu.nauYfLglTpcb(wF9nmvjsKjYM), minval=1e-05, maxval=1.0 - 1e-05, seed=cEhryM0YPR0h)))
l5III7jgLmWx = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(IDJ2eXGCBCDu.argmax(wF9nmvjsKjYM + zdBGPnQ8RuZl, -ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8)), depth=nRVKiXhndakY, dtype=IDJ2eXGCBCDu.float32)
l5III7jgLmWx = IDJ2eXGCBCDu.expand_dims(l5III7jgLmWx, -ehT0Px3KOsy9('\060' + chr(111) + '\x31', 8))
wWlRsdZxY7aO = IDJ2eXGCBCDu.reduce_sum(wWlRsdZxY7aO * l5III7jgLmWx, ehT0Px3KOsy9(chr(328 - 280) + chr(111) + chr(0b110011), ord("\x08")))
prNudPqZmplL = IDJ2eXGCBCDu.reduce_sum(prNudPqZmplL * l5III7jgLmWx, ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + '\063', 8))
Mq2X4hHIvLYE = IDJ2eXGCBCDu.reduce_sum(Mq2X4hHIvLYE * l5III7jgLmWx, ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33', 8))
IwLzS_ADlxQz = IDJ2eXGCBCDu.random_uniform(IDJ2eXGCBCDu.nauYfLglTpcb(wWlRsdZxY7aO), minval=1e-05, maxval=1.0 - 1e-05, seed=cEhryM0YPR0h)
eaj3gH1TsY02 = IDJ2eXGCBCDu.log(IwLzS_ADlxQz) - IDJ2eXGCBCDu.log1p(-IwLzS_ADlxQz)
OeWW0F1dBPRQ = wWlRsdZxY7aO + IDJ2eXGCBCDu.exp(prNudPqZmplL) * eaj3gH1TsY02
MTHwGDA8i59t = OeWW0F1dBPRQ[..., ehT0Px3KOsy9('\060' + '\157' + '\x30', 0b1000)]
pci1T9SDshKa = OeWW0F1dBPRQ[..., ehT0Px3KOsy9('\x30' + chr(0b1001 + 0o146) + '\x31', 8)] + Mq2X4hHIvLYE[..., ehT0Px3KOsy9(chr(48) + '\157' + chr(48), 8)] * MTHwGDA8i59t
OVXzvB9BcGF_ = OeWW0F1dBPRQ[..., ehT0Px3KOsy9('\060' + '\x6f' + '\x32', 0o10)] + Mq2X4hHIvLYE[..., ehT0Px3KOsy9('\060' + chr(111) + chr(49), 8)] * MTHwGDA8i59t + Mq2X4hHIvLYE[..., ehT0Px3KOsy9('\x30' + chr(4565 - 4454) + '\x32', 8)] * pci1T9SDshKa
OeWW0F1dBPRQ = IDJ2eXGCBCDu.stack([MTHwGDA8i59t, pci1T9SDshKa, OVXzvB9BcGF_], axis=-ehT0Px3KOsy9('\x30' + '\x6f' + chr(1505 - 1456), 8))
OeWW0F1dBPRQ = IDJ2eXGCBCDu.clip_by_value(OeWW0F1dBPRQ, -1.0, 1.0)
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
smoothing_cross_entropy
|
def smoothing_cross_entropy(logits,
labels,
vocab_size,
confidence,
gaussian=False):
"""Cross entropy with label smoothing to limit over-confidence.
Args:
logits: Tensor of shape [batch_size, ?, ?, ?, vocab_size].
labels: Tensor of shape [batch_size, ?, ?, ?].
vocab_size: Tensor representing the size of the vocabulary.
confidence: Used to determine on and off values for label smoothing.
If `gaussian` is true, `confidence` is the variance to the Gaussian
distribution.
gaussian: Uses a Gaussian distribution for label smoothing
Returns:
Tensor of shape [batch_size, ?, ?, ?].
"""
with tf.name_scope("smoothing_cross_entropy", values=[logits, labels]):
# Low confidence is given to all non-true labels, uniformly.
low_confidence = (1.0 - confidence) / to_float(vocab_size - 1)
# Normalizing constant is the best cross-entropy value with soft targets.
# We subtract it just for readability, makes no difference on learning.
normalizing = -(
confidence * tf.log(confidence) + to_float(vocab_size - 1) *
low_confidence * tf.log(low_confidence + 1e-20))
if gaussian and confidence > 0.0:
labels = tf.cast(labels, tf.float32)
normal_dist = tfp.distributions.Normal(loc=labels, scale=confidence)
# Locations to evaluate the probability distributions.
soft_targets = normal_dist.prob(
tf.cast(tf.range(vocab_size), tf.float32)[:, None, None, None, None])
# Reordering soft_targets from [vocab_size, batch_size, ?, ?, ?] to match
# logits: [batch_size, ?, ?, ?, vocab_size]
soft_targets = tf.transpose(soft_targets, perm=[1, 2, 3, 4, 0])
else:
soft_targets = tf.one_hot(
tf.cast(labels, tf.int32),
depth=vocab_size,
on_value=confidence,
off_value=low_confidence)
xentropy = tf.nn.softmax_cross_entropy_with_logits_v2(
logits=logits, labels=soft_targets)
return xentropy - normalizing
|
python
|
def smoothing_cross_entropy(logits,
labels,
vocab_size,
confidence,
gaussian=False):
"""Cross entropy with label smoothing to limit over-confidence.
Args:
logits: Tensor of shape [batch_size, ?, ?, ?, vocab_size].
labels: Tensor of shape [batch_size, ?, ?, ?].
vocab_size: Tensor representing the size of the vocabulary.
confidence: Used to determine on and off values for label smoothing.
If `gaussian` is true, `confidence` is the variance to the Gaussian
distribution.
gaussian: Uses a Gaussian distribution for label smoothing
Returns:
Tensor of shape [batch_size, ?, ?, ?].
"""
with tf.name_scope("smoothing_cross_entropy", values=[logits, labels]):
# Low confidence is given to all non-true labels, uniformly.
low_confidence = (1.0 - confidence) / to_float(vocab_size - 1)
# Normalizing constant is the best cross-entropy value with soft targets.
# We subtract it just for readability, makes no difference on learning.
normalizing = -(
confidence * tf.log(confidence) + to_float(vocab_size - 1) *
low_confidence * tf.log(low_confidence + 1e-20))
if gaussian and confidence > 0.0:
labels = tf.cast(labels, tf.float32)
normal_dist = tfp.distributions.Normal(loc=labels, scale=confidence)
# Locations to evaluate the probability distributions.
soft_targets = normal_dist.prob(
tf.cast(tf.range(vocab_size), tf.float32)[:, None, None, None, None])
# Reordering soft_targets from [vocab_size, batch_size, ?, ?, ?] to match
# logits: [batch_size, ?, ?, ?, vocab_size]
soft_targets = tf.transpose(soft_targets, perm=[1, 2, 3, 4, 0])
else:
soft_targets = tf.one_hot(
tf.cast(labels, tf.int32),
depth=vocab_size,
on_value=confidence,
off_value=low_confidence)
xentropy = tf.nn.softmax_cross_entropy_with_logits_v2(
logits=logits, labels=soft_targets)
return xentropy - normalizing
|
[
"def",
"smoothing_cross_entropy",
"(",
"logits",
",",
"labels",
",",
"vocab_size",
",",
"confidence",
",",
"gaussian",
"=",
"False",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"smoothing_cross_entropy\"",
",",
"values",
"=",
"[",
"logits",
",",
"labels",
"]",
")",
":",
"# Low confidence is given to all non-true labels, uniformly.",
"low_confidence",
"=",
"(",
"1.0",
"-",
"confidence",
")",
"/",
"to_float",
"(",
"vocab_size",
"-",
"1",
")",
"# Normalizing constant is the best cross-entropy value with soft targets.",
"# We subtract it just for readability, makes no difference on learning.",
"normalizing",
"=",
"-",
"(",
"confidence",
"*",
"tf",
".",
"log",
"(",
"confidence",
")",
"+",
"to_float",
"(",
"vocab_size",
"-",
"1",
")",
"*",
"low_confidence",
"*",
"tf",
".",
"log",
"(",
"low_confidence",
"+",
"1e-20",
")",
")",
"if",
"gaussian",
"and",
"confidence",
">",
"0.0",
":",
"labels",
"=",
"tf",
".",
"cast",
"(",
"labels",
",",
"tf",
".",
"float32",
")",
"normal_dist",
"=",
"tfp",
".",
"distributions",
".",
"Normal",
"(",
"loc",
"=",
"labels",
",",
"scale",
"=",
"confidence",
")",
"# Locations to evaluate the probability distributions.",
"soft_targets",
"=",
"normal_dist",
".",
"prob",
"(",
"tf",
".",
"cast",
"(",
"tf",
".",
"range",
"(",
"vocab_size",
")",
",",
"tf",
".",
"float32",
")",
"[",
":",
",",
"None",
",",
"None",
",",
"None",
",",
"None",
"]",
")",
"# Reordering soft_targets from [vocab_size, batch_size, ?, ?, ?] to match",
"# logits: [batch_size, ?, ?, ?, vocab_size]",
"soft_targets",
"=",
"tf",
".",
"transpose",
"(",
"soft_targets",
",",
"perm",
"=",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"0",
"]",
")",
"else",
":",
"soft_targets",
"=",
"tf",
".",
"one_hot",
"(",
"tf",
".",
"cast",
"(",
"labels",
",",
"tf",
".",
"int32",
")",
",",
"depth",
"=",
"vocab_size",
",",
"on_value",
"=",
"confidence",
",",
"off_value",
"=",
"low_confidence",
")",
"xentropy",
"=",
"tf",
".",
"nn",
".",
"softmax_cross_entropy_with_logits_v2",
"(",
"logits",
"=",
"logits",
",",
"labels",
"=",
"soft_targets",
")",
"return",
"xentropy",
"-",
"normalizing"
] |
Cross entropy with label smoothing to limit over-confidence.
Args:
logits: Tensor of shape [batch_size, ?, ?, ?, vocab_size].
labels: Tensor of shape [batch_size, ?, ?, ?].
vocab_size: Tensor representing the size of the vocabulary.
confidence: Used to determine on and off values for label smoothing.
If `gaussian` is true, `confidence` is the variance to the Gaussian
distribution.
gaussian: Uses a Gaussian distribution for label smoothing
Returns:
Tensor of shape [batch_size, ?, ?, ?].
|
[
"Cross",
"entropy",
"with",
"label",
"smoothing",
"to",
"limit",
"over",
"-",
"confidence",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2103-L2149
|
train
|
Cross entropy with label smoothing.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4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Q,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(1967 - 1919) + chr(0b1000100 + 0o53) + '\x32' + '\066' + chr(51), 58369 - 58361), ehT0Px3KOsy9('\x30' + chr(7083 - 6972) + chr(0b110010) + chr(0b1101 + 0o43) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010 + 0o0) + chr(1955 - 1906) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + '\x34' + chr(800 - 752), ord("\x08")), ehT0Px3KOsy9(chr(1912 - 1864) + chr(0b1101111) + chr(0b1101 + 0o44) + chr(0b1111 + 0o50) + chr(0b100010 + 0o22), 65108 - 65100), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b101101 + 0o10) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(196 - 145) + chr(55) + chr(52), 21949 - 21941), ehT0Px3KOsy9(chr(1577 - 1529) + chr(111) + '\061' + '\x34' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1967 - 1912) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11010 + 0o27) + chr(0b10101 + 0o40) + chr(50), 8147 - 8139), ehT0Px3KOsy9(chr(631 - 583) + chr(0b1010000 + 0o37) + chr(50) + chr(1311 - 1260), 62405 - 62397), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(1217 - 1164), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(49) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\060' + chr(0b1100 + 0o51), 33164 - 33156), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10110 + 0o32), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2474 - 2424) + '\065' + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\066' + '\064', 43334 - 43326), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\060' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + '\067' + chr(48), 0b1000), ehT0Px3KOsy9(chr(94 - 46) + '\x6f' + '\x33' + chr(54) + chr(691 - 636), 0o10), ehT0Px3KOsy9('\x30' + chr(1076 - 965) + '\066' + '\x36', 50982 - 50974), ehT0Px3KOsy9(chr(1194 - 1146) + chr(1581 - 1470) + '\062' + chr(1413 - 1364) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(51) + '\065' + chr(620 - 567), 20247 - 20239), ehT0Px3KOsy9(chr(2264 - 2216) + chr(1509 - 1398) + chr(0b11001 + 0o31) + chr(0b0 + 0o65) + chr(1201 - 1151), 0b1000), ehT0Px3KOsy9(chr(639 - 591) + chr(111) + chr(49) + chr(48) + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\065' + chr(0b11011 + 0o26), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101101 + 0o12) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b110000) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + '\063' + '\062' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(0b110001 + 0o1) + '\066' + chr(0b100111 + 0o20), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x33' + chr(727 - 674), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(49) + chr(55) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + '\061' + chr(0b10110 + 0o35) + chr(2308 - 2257), 0o10), ehT0Px3KOsy9(chr(1277 - 1229) + chr(0b1101111) + '\063' + chr(136 - 86) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9869 - 9758) + '\x32' + '\x30' + '\067', 2996 - 2988), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(48) + chr(51), 0b1000), ehT0Px3KOsy9(chr(709 - 661) + '\157' + chr(0b1010 + 0o51) + chr(0b110111) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\x31' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(0b110011) + '\x35' + chr(50), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9d'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\157' + chr(0b1101 + 0o127) + '\145')(chr(6446 - 6329) + chr(116 - 0) + chr(102) + chr(182 - 137) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ANQl8nDw9Rk9(wF9nmvjsKjYM, uXMK81tmdpTM, CeyMIoSyrpkQ, IGc_qm7pp85x, vubub2fS53Qn=ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(48), 8)):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd\xe7\xe1E#\x1e\x9f\x0eN\x0f'), chr(4705 - 4605) + chr(5741 - 5640) + chr(99) + '\157' + chr(100) + chr(101))(chr(0b1011000 + 0o35) + chr(0b111110 + 0o66) + '\146' + chr(0b101101) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xc0\xeb\xe3O\x08\x05\x95\x0fY5p\x7f'6s\xf6\xd1/w\x8a\x98F\xf4"), chr(100) + '\145' + chr(0b1001110 + 0o25) + chr(111) + '\144' + chr(101))(chr(117) + chr(0b1110100) + '\146' + '\055' + '\070'), values=[wF9nmvjsKjYM, uXMK81tmdpTM]):
N85Epcpm6Plm = (1.0 - IGc_qm7pp85x) / ZUL3kHBGU8Uu(CeyMIoSyrpkQ - ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31', 0b1000))
eLQKsWJGRREN = -(IGc_qm7pp85x * IDJ2eXGCBCDu.log(IGc_qm7pp85x) + ZUL3kHBGU8Uu(CeyMIoSyrpkQ - ehT0Px3KOsy9('\060' + '\157' + '\x31', 8)) * N85Epcpm6Plm * IDJ2eXGCBCDu.log(N85Epcpm6Plm + 1e-20))
if vubub2fS53Qn and IGc_qm7pp85x > 0.0:
uXMK81tmdpTM = IDJ2eXGCBCDu.cast(uXMK81tmdpTM, IDJ2eXGCBCDu.float32)
_hUbdAfBKPn_ = Ys555qziAbad.distributions.Normal(loc=uXMK81tmdpTM, scale=IGc_qm7pp85x)
EL5Xrd20ua0y = _hUbdAfBKPn_.prob(IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.range(CeyMIoSyrpkQ), IDJ2eXGCBCDu.float32)[:, None, None, None, None])
EL5Xrd20ua0y = IDJ2eXGCBCDu.transpose(EL5Xrd20ua0y, perm=[ehT0Px3KOsy9('\060' + '\x6f' + '\061', 8), ehT0Px3KOsy9(chr(48) + chr(1404 - 1293) + chr(641 - 591), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011), 8), ehT0Px3KOsy9(chr(1447 - 1399) + '\157' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(161 - 113) + chr(0b1101111) + '\060', 8)])
else:
EL5Xrd20ua0y = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(IDJ2eXGCBCDu.cast(uXMK81tmdpTM, IDJ2eXGCBCDu.int32), depth=CeyMIoSyrpkQ, on_value=IGc_qm7pp85x, off_value=N85Epcpm6Plm)
HDJwAreLmKfd = IDJ2eXGCBCDu.nn.softmax_cross_entropy_with_logits_v2(logits=wF9nmvjsKjYM, labels=EL5Xrd20ua0y)
return HDJwAreLmKfd - eLQKsWJGRREN
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
global_pool_1d
|
def global_pool_1d(inputs, pooling_type="MAX", mask=None):
"""Pool elements across the last dimension.
Useful to convert a list of vectors into a single vector so as
to get a representation of a set.
Args:
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
pooling_type: the pooling type to use, MAX or AVR
mask: A tensor of shape [batch_size, sequence_length] containing a
mask for the inputs with 1's for existing elements, and 0's elsewhere.
Returns:
A tensor of shape [batch_size, input_dims] containing the sequences of
transformed vectors.
"""
with tf.name_scope("global_pool", values=[inputs]):
if mask is not None:
mask = tf.expand_dims(mask, axis=2)
inputs = tf.multiply(inputs, mask)
if pooling_type == "MAX":
# A tf.pool can be used here, but reduce is cleaner
output = tf.reduce_max(inputs, axis=1)
elif pooling_type == "AVR":
if mask is not None:
# Some elems are dummy elems so we can't just reduce the average.
output = tf.reduce_sum(inputs, axis=1)
num_elems = tf.reduce_sum(mask, axis=1, keepdims=True)
output = tf.div(output, tf.maximum(num_elems, 1))
else:
output = tf.reduce_mean(inputs, axis=1)
return output
|
python
|
def global_pool_1d(inputs, pooling_type="MAX", mask=None):
"""Pool elements across the last dimension.
Useful to convert a list of vectors into a single vector so as
to get a representation of a set.
Args:
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
pooling_type: the pooling type to use, MAX or AVR
mask: A tensor of shape [batch_size, sequence_length] containing a
mask for the inputs with 1's for existing elements, and 0's elsewhere.
Returns:
A tensor of shape [batch_size, input_dims] containing the sequences of
transformed vectors.
"""
with tf.name_scope("global_pool", values=[inputs]):
if mask is not None:
mask = tf.expand_dims(mask, axis=2)
inputs = tf.multiply(inputs, mask)
if pooling_type == "MAX":
# A tf.pool can be used here, but reduce is cleaner
output = tf.reduce_max(inputs, axis=1)
elif pooling_type == "AVR":
if mask is not None:
# Some elems are dummy elems so we can't just reduce the average.
output = tf.reduce_sum(inputs, axis=1)
num_elems = tf.reduce_sum(mask, axis=1, keepdims=True)
output = tf.div(output, tf.maximum(num_elems, 1))
else:
output = tf.reduce_mean(inputs, axis=1)
return output
|
[
"def",
"global_pool_1d",
"(",
"inputs",
",",
"pooling_type",
"=",
"\"MAX\"",
",",
"mask",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"global_pool\"",
",",
"values",
"=",
"[",
"inputs",
"]",
")",
":",
"if",
"mask",
"is",
"not",
"None",
":",
"mask",
"=",
"tf",
".",
"expand_dims",
"(",
"mask",
",",
"axis",
"=",
"2",
")",
"inputs",
"=",
"tf",
".",
"multiply",
"(",
"inputs",
",",
"mask",
")",
"if",
"pooling_type",
"==",
"\"MAX\"",
":",
"# A tf.pool can be used here, but reduce is cleaner",
"output",
"=",
"tf",
".",
"reduce_max",
"(",
"inputs",
",",
"axis",
"=",
"1",
")",
"elif",
"pooling_type",
"==",
"\"AVR\"",
":",
"if",
"mask",
"is",
"not",
"None",
":",
"# Some elems are dummy elems so we can't just reduce the average.",
"output",
"=",
"tf",
".",
"reduce_sum",
"(",
"inputs",
",",
"axis",
"=",
"1",
")",
"num_elems",
"=",
"tf",
".",
"reduce_sum",
"(",
"mask",
",",
"axis",
"=",
"1",
",",
"keepdims",
"=",
"True",
")",
"output",
"=",
"tf",
".",
"div",
"(",
"output",
",",
"tf",
".",
"maximum",
"(",
"num_elems",
",",
"1",
")",
")",
"else",
":",
"output",
"=",
"tf",
".",
"reduce_mean",
"(",
"inputs",
",",
"axis",
"=",
"1",
")",
"return",
"output"
] |
Pool elements across the last dimension.
Useful to convert a list of vectors into a single vector so as
to get a representation of a set.
Args:
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
pooling_type: the pooling type to use, MAX or AVR
mask: A tensor of shape [batch_size, sequence_length] containing a
mask for the inputs with 1's for existing elements, and 0's elsewhere.
Returns:
A tensor of shape [batch_size, input_dims] containing the sequences of
transformed vectors.
|
[
"Pool",
"elements",
"across",
"the",
"last",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2152-L2186
|
train
|
This function is used to reduce the number of elements across the last dimension.
|
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' + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\x32' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1110 + 0o141) + chr(50) + chr(2640 - 2588) + chr(0b1001 + 0o50), 0o10), ehT0Px3KOsy9('\x30' + chr(11016 - 10905) + '\x31' + chr(0b110000) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(0b110010) + '\064' + '\065', 0b1000), ehT0Px3KOsy9(chr(1477 - 1429) + '\157' + '\x35' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2361 - 2312) + chr(0b110000 + 0o3) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1916 - 1865) + chr(0b110000) + chr(0b10 + 0o60), 0o10), ehT0Px3KOsy9('\060' + chr(0b100001 + 0o116) + '\x36' + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(787 - 732) + chr(54), 0o10), ehT0Px3KOsy9(chr(1854 - 1806) + '\x6f' + chr(54) + chr(1753 - 1701), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b100101 + 0o112) + '\063' + chr(53) + chr(0b110000 + 0o2), 39275 - 39267), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + chr(0b101011 + 0o10) + chr(0b110011) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(2261 - 2213) + chr(0b100 + 0o55), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x34' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b10001 + 0o136) + chr(0b110001) + chr(0b101010 + 0o11) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + '\063' + chr(281 - 227) + chr(0b100000 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(0b10 + 0o62) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(2010 - 1957), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1000 + 0o53) + '\x30' + chr(55), 62315 - 62307), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1000 + 0o53) + chr(0b110000) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x36' + chr(2368 - 2317), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\061' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11111 + 0o27) + '\x36', 0o10), ehT0Px3KOsy9(chr(1601 - 1553) + '\157' + '\062' + chr(548 - 493) + chr(0b1111 + 0o43), 7054 - 7046), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + '\x31' + '\x37' + chr(49), 17276 - 17268), ehT0Px3KOsy9('\x30' + '\157' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4126 - 4015) + chr(51) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(2401 - 2347), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b1 + 0o65), 0b1000), ehT0Px3KOsy9(chr(1181 - 1133) + '\157' + chr(810 - 759) + '\065' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\062' + chr(0b101101 + 0o12), 0b1000), ehT0Px3KOsy9(chr(1689 - 1641) + chr(0b1101111 + 0o0) + chr(1838 - 1788) + '\x35' + chr(51), 47934 - 47926), ehT0Px3KOsy9(chr(848 - 800) + chr(1702 - 1591) + chr(51) + '\x33' + '\066', 8), ehT0Px3KOsy9(chr(1668 - 1620) + chr(0b101111 + 0o100) + chr(50) + chr(53) + chr(0b110110), 7706 - 7698), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1565 - 1515) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\064' + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + chr(0b101010 + 0o10) + chr(0b11 + 0o64) + chr(0b110000), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + '\065' + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'-'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + chr(101))(chr(8347 - 8230) + chr(116) + chr(7701 - 7599) + chr(45) + chr(2014 - 1958)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def eMNw25YCTzmX(vXoupepMtCXU, JRhBz5W8YzDa=xafqLlk3kkUe(SXOLrMavuUCe(b'N\x12\xf9'), chr(100) + '\145' + chr(9355 - 9256) + '\157' + '\x64' + '\x65')('\x75' + chr(0b1100001 + 0o23) + '\x66' + chr(45) + chr(828 - 772)), Iz1jSgUKZDvt=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'm2\xcc$\xfa\\;\xadB{'), chr(0b1011001 + 0o13) + chr(0b1010 + 0o133) + chr(99) + chr(111) + chr(5840 - 5740) + '\x65')(chr(117) + chr(116) + chr(0b1100110) + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'd?\xce#\xc4C\x07\xb2]qR'), '\x64' + '\x65' + '\143' + chr(6735 - 6624) + chr(100) + chr(0b100100 + 0o101))(chr(11998 - 11881) + chr(0b111001 + 0o73) + chr(102) + chr(1436 - 1391) + chr(0b1101 + 0o53)), values=[vXoupepMtCXU]):
if Iz1jSgUKZDvt is not None:
Iz1jSgUKZDvt = IDJ2eXGCBCDu.expand_dims(Iz1jSgUKZDvt, axis=ehT0Px3KOsy9('\x30' + '\x6f' + '\062', 0b1000))
vXoupepMtCXU = IDJ2eXGCBCDu.multiply(vXoupepMtCXU, Iz1jSgUKZDvt)
if JRhBz5W8YzDa == xafqLlk3kkUe(SXOLrMavuUCe(b'N\x12\xf9'), '\x64' + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(100) + chr(101))('\x75' + chr(116) + chr(7130 - 7028) + '\x2d' + '\070'):
e1jVqMSBZ01Y = IDJ2eXGCBCDu.reduce_max(vXoupepMtCXU, axis=ehT0Px3KOsy9('\060' + chr(0b101111 + 0o100) + '\x31', 10802 - 10794))
elif JRhBz5W8YzDa == xafqLlk3kkUe(SXOLrMavuUCe(b'B\x05\xf3'), '\x64' + chr(0b1010 + 0o133) + '\143' + '\157' + '\x64' + chr(0b1001110 + 0o27))(chr(0b1000000 + 0o65) + chr(116) + '\146' + '\055' + chr(0b11011 + 0o35)):
if Iz1jSgUKZDvt is not None:
e1jVqMSBZ01Y = IDJ2eXGCBCDu.reduce_sum(vXoupepMtCXU, axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101101 + 0o2) + chr(762 - 713), 8))
wbkQuTTClFX8 = IDJ2eXGCBCDu.reduce_sum(Iz1jSgUKZDvt, axis=ehT0Px3KOsy9('\060' + '\157' + '\061', 8), keepdims=ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(49), 8))
e1jVqMSBZ01Y = IDJ2eXGCBCDu.div(e1jVqMSBZ01Y, IDJ2eXGCBCDu.maximum(wbkQuTTClFX8, ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(49), 8)))
else:
e1jVqMSBZ01Y = IDJ2eXGCBCDu.reduce_mean(vXoupepMtCXU, axis=ehT0Px3KOsy9(chr(0b110000) + chr(6198 - 6087) + '\061', 8))
return e1jVqMSBZ01Y
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
running_global_pool_1d
|
def running_global_pool_1d(inputs, pooling_type="MAX"):
"""Same global pool, but only for the elements up to the current element.
Useful for outputs where the state of future elements is not known.
Takes no mask as all elements up to the current element are assumed to exist.
Currently only supports maximum. Equivalent to using a lower triangle bias.
Args:
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
pooling_type: Pooling type to use. Currently only supports 'MAX'.
Returns:
A tensor of shape [batch_size, sequence_length, input_dims] containing the
running 'totals'.
"""
del pooling_type
with tf.name_scope("running_global_pool", values=[inputs]):
scan_fct = tf.maximum
# Permute inputs so seq_length is first.
elems = tf.transpose(inputs, [1, 0, 2])
# Perform scan.
cumulatives = tf.scan(scan_fct, elems, swap_memory=True)
# Permute output to get back to original order.
output = tf.transpose(cumulatives, [1, 0, 2])
return output
|
python
|
def running_global_pool_1d(inputs, pooling_type="MAX"):
"""Same global pool, but only for the elements up to the current element.
Useful for outputs where the state of future elements is not known.
Takes no mask as all elements up to the current element are assumed to exist.
Currently only supports maximum. Equivalent to using a lower triangle bias.
Args:
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
pooling_type: Pooling type to use. Currently only supports 'MAX'.
Returns:
A tensor of shape [batch_size, sequence_length, input_dims] containing the
running 'totals'.
"""
del pooling_type
with tf.name_scope("running_global_pool", values=[inputs]):
scan_fct = tf.maximum
# Permute inputs so seq_length is first.
elems = tf.transpose(inputs, [1, 0, 2])
# Perform scan.
cumulatives = tf.scan(scan_fct, elems, swap_memory=True)
# Permute output to get back to original order.
output = tf.transpose(cumulatives, [1, 0, 2])
return output
|
[
"def",
"running_global_pool_1d",
"(",
"inputs",
",",
"pooling_type",
"=",
"\"MAX\"",
")",
":",
"del",
"pooling_type",
"with",
"tf",
".",
"name_scope",
"(",
"\"running_global_pool\"",
",",
"values",
"=",
"[",
"inputs",
"]",
")",
":",
"scan_fct",
"=",
"tf",
".",
"maximum",
"# Permute inputs so seq_length is first.",
"elems",
"=",
"tf",
".",
"transpose",
"(",
"inputs",
",",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"# Perform scan.",
"cumulatives",
"=",
"tf",
".",
"scan",
"(",
"scan_fct",
",",
"elems",
",",
"swap_memory",
"=",
"True",
")",
"# Permute output to get back to original order.",
"output",
"=",
"tf",
".",
"transpose",
"(",
"cumulatives",
",",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"return",
"output"
] |
Same global pool, but only for the elements up to the current element.
Useful for outputs where the state of future elements is not known.
Takes no mask as all elements up to the current element are assumed to exist.
Currently only supports maximum. Equivalent to using a lower triangle bias.
Args:
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
pooling_type: Pooling type to use. Currently only supports 'MAX'.
Returns:
A tensor of shape [batch_size, sequence_length, input_dims] containing the
running 'totals'.
|
[
"Same",
"global",
"pool",
"but",
"only",
"for",
"the",
"elements",
"up",
"to",
"the",
"current",
"element",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2189-L2214
|
train
|
Same global pool but only for the elements up to the current element.
|
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,O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4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\064' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b110111) + chr(0b1101 + 0o45), 0o10), ehT0Px3KOsy9(chr(48) + chr(11762 - 11651) + chr(0b11 + 0o57) + chr(0b110011), 3209 - 3201), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + '\063' + chr(55) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + chr(0b101011 + 0o10) + chr(0b101011 + 0o13) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100 + 0o153) + '\062' + chr(0b1000 + 0o53) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(9042 - 8931) + chr(2318 - 2268) + '\066' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10011 + 0o40) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(2253 - 2204) + chr(0b110110) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\066' + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + chr(51) + '\x33' + chr(2536 - 2482), 50406 - 50398), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\x35' + chr(0b0 + 0o66), 0o10), ehT0Px3KOsy9(chr(402 - 354) + '\157' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(0b110010) + chr(0b101000 + 0o13) + '\x31', 30490 - 30482), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10001 + 0o40) + chr(1749 - 1699) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11955 - 11844) + '\x32' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(403 - 355) + chr(111) + chr(0b10000 + 0o41) + chr(0b10110 + 0o32) + '\x32', 10546 - 10538), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b101011 + 0o10) + chr(2493 - 2443), 0b1000), ehT0Px3KOsy9(chr(1614 - 1566) + chr(9656 - 9545) + chr(0b110001) + '\x35' + chr(0b100010 + 0o24), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(50) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\x33' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(51) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10241 - 10130) + chr(0b1100 + 0o46) + chr(0b101101 + 0o12) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + '\063' + chr(0b110110) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b100000 + 0o21) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(706 - 656) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110 + 0o54) + '\x37' + chr(0b110011), 12733 - 12725), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + chr(53) + chr(0b1 + 0o63), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(0b110010) + '\067' + chr(0b11101 + 0o25), 8), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + chr(0b110101) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(50) + chr(1423 - 1369), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100001 + 0o24) + chr(1617 - 1565), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(2110 - 2058), 8), ehT0Px3KOsy9(chr(933 - 885) + chr(5026 - 4915) + chr(0b100001 + 0o20) + '\064' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b1111 + 0o47) + chr(0b110101), 20776 - 20768), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100010 + 0o17) + chr(53) + '\x30', 0o10), ehT0Px3KOsy9(chr(416 - 368) + '\x6f' + chr(52) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1025 - 974) + '\067' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + chr(49) + chr(1750 - 1695) + chr(1969 - 1921), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(0b110010) + chr(789 - 735), 61288 - 61280)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(844 - 733) + chr(0b110101) + chr(0b101101 + 0o3), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xce'), '\144' + chr(101) + chr(0b1100 + 0o127) + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(116) + chr(2326 - 2224) + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def SXub7MYCXwfH(vXoupepMtCXU, JRhBz5W8YzDa=xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xfbK'), '\x64' + chr(7118 - 7017) + chr(4212 - 4113) + chr(0b1101111) + chr(100) + chr(101))(chr(0b1001001 + 0o54) + chr(2724 - 2608) + chr(0b1100110) + chr(0b101101) + chr(56))):
del JRhBz5W8YzDa
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e\xdb~\x9a\xa8\xee\xd7s\x05S'), chr(0b1000011 + 0o41) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(101))(chr(0b1110101) + chr(0b1110010 + 0o2) + chr(0b110000 + 0o66) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x92\xcf}\x91\x9e\xf3\xd3C\x12Z\xb1\x8ce\xf5\tf-\xf5\x02'), chr(0b1100100) + chr(0b1000101 + 0o40) + chr(0b1100011) + '\x6f' + chr(2256 - 2156) + chr(101))(chr(0b1110101) + '\x74' + '\146' + chr(45) + '\x38'), values=[vXoupepMtCXU]):
rmiaub1iQ1I8 = IDJ2eXGCBCDu.maximum
z3PcWqQQ__QP = IDJ2eXGCBCDu.transpose(vXoupepMtCXU, [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010), 64470 - 64462)])
R0yGNiT9vnFq = IDJ2eXGCBCDu.scan(rmiaub1iQ1I8, z3PcWqQQ__QP, swap_memory=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b0 + 0o61), 8))
e1jVqMSBZ01Y = IDJ2eXGCBCDu.transpose(R0yGNiT9vnFq, [ehT0Px3KOsy9(chr(1148 - 1100) + '\157' + chr(0b110001 + 0o0), 8), ehT0Px3KOsy9(chr(1182 - 1134) + chr(0b1101111) + chr(1878 - 1830), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2316 - 2266), 8)])
return e1jVqMSBZ01Y
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
gated_linear_unit_layer
|
def gated_linear_unit_layer(x, name=None):
"""Gated linear unit layer.
Paper: Language Modeling with Gated Convolutional Networks.
Link: https://arxiv.org/abs/1612.08083
x = Wx * sigmoid(W'x).
Args:
x: A tensor
name: A string
Returns:
A tensor of the same shape as x.
"""
with tf.variable_scope(name, default_name="glu_layer", values=[x]):
depth = shape_list(x)[-1]
x = layers().Dense(depth * 2, activation=None)(x)
x, gating_x = tf.split(x, 2, axis=-1)
return x * tf.nn.sigmoid(gating_x)
|
python
|
def gated_linear_unit_layer(x, name=None):
"""Gated linear unit layer.
Paper: Language Modeling with Gated Convolutional Networks.
Link: https://arxiv.org/abs/1612.08083
x = Wx * sigmoid(W'x).
Args:
x: A tensor
name: A string
Returns:
A tensor of the same shape as x.
"""
with tf.variable_scope(name, default_name="glu_layer", values=[x]):
depth = shape_list(x)[-1]
x = layers().Dense(depth * 2, activation=None)(x)
x, gating_x = tf.split(x, 2, axis=-1)
return x * tf.nn.sigmoid(gating_x)
|
[
"def",
"gated_linear_unit_layer",
"(",
"x",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"glu_layer\"",
",",
"values",
"=",
"[",
"x",
"]",
")",
":",
"depth",
"=",
"shape_list",
"(",
"x",
")",
"[",
"-",
"1",
"]",
"x",
"=",
"layers",
"(",
")",
".",
"Dense",
"(",
"depth",
"*",
"2",
",",
"activation",
"=",
"None",
")",
"(",
"x",
")",
"x",
",",
"gating_x",
"=",
"tf",
".",
"split",
"(",
"x",
",",
"2",
",",
"axis",
"=",
"-",
"1",
")",
"return",
"x",
"*",
"tf",
".",
"nn",
".",
"sigmoid",
"(",
"gating_x",
")"
] |
Gated linear unit layer.
Paper: Language Modeling with Gated Convolutional Networks.
Link: https://arxiv.org/abs/1612.08083
x = Wx * sigmoid(W'x).
Args:
x: A tensor
name: A string
Returns:
A tensor of the same shape as x.
|
[
"Gated",
"linear",
"unit",
"layer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2217-L2235
|
train
|
Gated linear unit 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,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzM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aWE,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(229 - 181) + chr(0b1101111) + chr(0b10010 + 0o41) + chr(2220 - 2166) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6091 - 5980) + chr(49) + chr(0b111 + 0o51) + '\061', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(292 - 243) + chr(0b10111 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + chr(1687 - 1637) + '\x37' + chr(55), 63676 - 63668), ehT0Px3KOsy9('\060' + '\157' + chr(2007 - 1957) + chr(0b110011) + chr(0b100001 + 0o22), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110 + 0o151) + chr(0b100001 + 0o20) + chr(52) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100011 + 0o14) + '\x36' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10010 + 0o37) + '\062' + chr(1973 - 1921), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\x32' + chr(0b11101 + 0o23), 0b1000), ehT0Px3KOsy9('\x30' + chr(5928 - 5817) + chr(0b110011) + chr(629 - 578) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(2576 - 2525) + chr(0b101 + 0o54) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(1018 - 907) + '\x33' + chr(0b110101) + chr(54), 12503 - 12495), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1430 - 1380) + chr(0b110001) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\064' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(49) + chr(0b110011 + 0o2) + chr(0b110010), 39296 - 39288), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1469 - 1419), ord("\x08")), ehT0Px3KOsy9(chr(1121 - 1073) + chr(0b101 + 0o152) + '\060', 16021 - 16013), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + chr(0b110010 + 0o1) + '\x37' + chr(2194 - 2142), 13164 - 13156), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(1158 - 1109) + chr(0b100110 + 0o15), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(1637 - 1585) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11111 + 0o22) + chr(48) + chr(516 - 461), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(990 - 941) + chr(52) + '\x32', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(693 - 644) + chr(49) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(51) + '\x34' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1287 - 1239) + chr(436 - 325) + chr(2301 - 2250) + '\x35' + chr(0b101001 + 0o13), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\065' + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + chr(0b110001) + chr(0b110100) + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110000 + 0o3) + '\x34' + '\x34', 8), ehT0Px3KOsy9('\060' + chr(5922 - 5811) + chr(0b111 + 0o54) + chr(1285 - 1235) + chr(0b11110 + 0o30), 37135 - 37127), ehT0Px3KOsy9(chr(0b110000) + chr(1968 - 1857) + chr(1894 - 1843) + chr(0b10111 + 0o36) + chr(1056 - 1008), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\x35' + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1875 - 1825) + chr(55) + chr(0b1110 + 0o44), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(51) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(50) + '\064' + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\x30', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b1001 + 0o50) + chr(1459 - 1411) + chr(0b1001 + 0o56), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110111) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b110100) + '\066', 38003 - 37995), ehT0Px3KOsy9(chr(1512 - 1464) + chr(3964 - 3853) + chr(1936 - 1887) + '\x32', 32668 - 32660), ehT0Px3KOsy9('\060' + chr(2700 - 2589) + chr(51) + chr(642 - 592) + chr(0b110101), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + chr(0b10010 + 0o43) + chr(0b101100 + 0o4), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd8'), chr(0b1011001 + 0o13) + '\x65' + chr(0b1100011) + chr(0b1010001 + 0o36) + chr(100) + chr(8155 - 8054))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(0b110100 + 0o4)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def QiG4znWM0uEV(OeWW0F1dBPRQ, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x80 >\xd6\xfa\x01[1\x8f\xab\xa8\x81\xf9\xc0'), chr(0b110101 + 0o57) + chr(3886 - 3785) + chr(99) + chr(3057 - 2946) + chr(4717 - 4617) + '\x65')('\x75' + chr(0b1110100) + chr(0b1100100 + 0o2) + chr(45) + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x91-9\xe0\xf7\x02N1\xa2'), chr(0b100001 + 0o103) + '\x65' + chr(99) + '\x6f' + '\x64' + chr(4730 - 4629))(chr(13618 - 13501) + chr(1282 - 1166) + chr(102) + chr(625 - 580) + chr(225 - 169)), values=[OeWW0F1dBPRQ]):
UEys4_lSwsID = qypPRW8fq869(OeWW0F1dBPRQ)[-ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b10001 + 0o136) + chr(49), ord("\x08"))]
OeWW0F1dBPRQ = sGi5Aql23May().Dense(UEys4_lSwsID * ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + '\x32', 8), activation=None)(OeWW0F1dBPRQ)
(OeWW0F1dBPRQ, _5j2mbyYd5IU) = IDJ2eXGCBCDu.split(OeWW0F1dBPRQ, ehT0Px3KOsy9(chr(1847 - 1799) + chr(0b1011101 + 0o22) + chr(2432 - 2382), 8), axis=-ehT0Px3KOsy9('\x30' + chr(4065 - 3954) + '\x31', 8))
return OeWW0F1dBPRQ * xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'\x85(+\xd2\xf4\nS'), chr(0b1010011 + 0o21) + chr(0b101110 + 0o67) + chr(3984 - 3885) + chr(0b1101001 + 0o6) + '\144' + chr(101))('\165' + chr(116) + '\x66' + chr(45) + chr(0b111000)))(_5j2mbyYd5IU)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
sru_with_scan
|
def sru_with_scan(x,
num_layers=2,
activation=None,
initial_state=None,
name=None,
reuse=None):
"""SRU cell as in https://arxiv.org/abs/1709.02755.
This implementation uses tf.scan and can incur overhead, see the full SRU
function doc for details and an implementation that is sometimes faster.
Args:
x: A tensor of shape [batch, ..., channels] ; ... is treated as time.
num_layers: How many SRU layers; default is 2 as results for 1 disappoint.
activation: Optional activation function, try tf.nn.tanh or tf.nn.relu.
initial_state: Optional initial c-state, set to zeros if None.
name: Optional name, "sru" by default.
reuse: Optional reuse.
Returns:
A tensor of the same shape as x.
Raises:
ValueError: if num_layers is not positive.
"""
if num_layers < 1:
raise ValueError("Number of layers must be positive: %d" % num_layers)
with tf.variable_scope(name, default_name="sru", values=[x], reuse=reuse):
# We assume x is [batch, ..., channels] and treat all ... as time.
x_shape = shape_list(x)
x = tf.reshape(x, [x_shape[0], -1, x_shape[-1]])
x = tf.transpose(x, [1, 0, 2]) # Scan assumes time on axis 0.
initial_state = initial_state or tf.zeros([x_shape[0], x_shape[-1]])
# SRU state manipulation function.
def next_state(cur_state, args_tup):
cur_x_times_one_minus_f, cur_f = args_tup
return cur_f * cur_state + cur_x_times_one_minus_f
# Calculate SRU on each layer.
for i in range(num_layers):
# The parallel part of the SRU.
x_orig = x
x, f, r = tf.split(
layers().Dense(3 * x_shape[-1], name="kernel_%d" % i)(x), 3, axis=-1)
f, r = tf.sigmoid(f), tf.sigmoid(r)
x_times_one_minus_f = x * (1.0 - f) # Compute in parallel for speed.
# Calculate states.
c_states = tf.scan(
next_state, (x_times_one_minus_f, f),
initializer=initial_state,
parallel_iterations=2,
name="scan_%d" % i)
# Final output.
if activation is not None:
c_states = activation(c_states)
h = c_states * r + (1.0 - r) * x_orig
x = h # Next layer.
# Transpose back to batch-major.
x = tf.transpose(x, [1, 0, 2])
return tf.reshape(x, x_shape)
|
python
|
def sru_with_scan(x,
num_layers=2,
activation=None,
initial_state=None,
name=None,
reuse=None):
"""SRU cell as in https://arxiv.org/abs/1709.02755.
This implementation uses tf.scan and can incur overhead, see the full SRU
function doc for details and an implementation that is sometimes faster.
Args:
x: A tensor of shape [batch, ..., channels] ; ... is treated as time.
num_layers: How many SRU layers; default is 2 as results for 1 disappoint.
activation: Optional activation function, try tf.nn.tanh or tf.nn.relu.
initial_state: Optional initial c-state, set to zeros if None.
name: Optional name, "sru" by default.
reuse: Optional reuse.
Returns:
A tensor of the same shape as x.
Raises:
ValueError: if num_layers is not positive.
"""
if num_layers < 1:
raise ValueError("Number of layers must be positive: %d" % num_layers)
with tf.variable_scope(name, default_name="sru", values=[x], reuse=reuse):
# We assume x is [batch, ..., channels] and treat all ... as time.
x_shape = shape_list(x)
x = tf.reshape(x, [x_shape[0], -1, x_shape[-1]])
x = tf.transpose(x, [1, 0, 2]) # Scan assumes time on axis 0.
initial_state = initial_state or tf.zeros([x_shape[0], x_shape[-1]])
# SRU state manipulation function.
def next_state(cur_state, args_tup):
cur_x_times_one_minus_f, cur_f = args_tup
return cur_f * cur_state + cur_x_times_one_minus_f
# Calculate SRU on each layer.
for i in range(num_layers):
# The parallel part of the SRU.
x_orig = x
x, f, r = tf.split(
layers().Dense(3 * x_shape[-1], name="kernel_%d" % i)(x), 3, axis=-1)
f, r = tf.sigmoid(f), tf.sigmoid(r)
x_times_one_minus_f = x * (1.0 - f) # Compute in parallel for speed.
# Calculate states.
c_states = tf.scan(
next_state, (x_times_one_minus_f, f),
initializer=initial_state,
parallel_iterations=2,
name="scan_%d" % i)
# Final output.
if activation is not None:
c_states = activation(c_states)
h = c_states * r + (1.0 - r) * x_orig
x = h # Next layer.
# Transpose back to batch-major.
x = tf.transpose(x, [1, 0, 2])
return tf.reshape(x, x_shape)
|
[
"def",
"sru_with_scan",
"(",
"x",
",",
"num_layers",
"=",
"2",
",",
"activation",
"=",
"None",
",",
"initial_state",
"=",
"None",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"if",
"num_layers",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"\"Number of layers must be positive: %d\"",
"%",
"num_layers",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"sru\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"# We assume x is [batch, ..., channels] and treat all ... as time.",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"x_shape",
"[",
"0",
"]",
",",
"-",
"1",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
"x",
"=",
"tf",
".",
"transpose",
"(",
"x",
",",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"# Scan assumes time on axis 0.",
"initial_state",
"=",
"initial_state",
"or",
"tf",
".",
"zeros",
"(",
"[",
"x_shape",
"[",
"0",
"]",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
"# SRU state manipulation function.",
"def",
"next_state",
"(",
"cur_state",
",",
"args_tup",
")",
":",
"cur_x_times_one_minus_f",
",",
"cur_f",
"=",
"args_tup",
"return",
"cur_f",
"*",
"cur_state",
"+",
"cur_x_times_one_minus_f",
"# Calculate SRU on each layer.",
"for",
"i",
"in",
"range",
"(",
"num_layers",
")",
":",
"# The parallel part of the SRU.",
"x_orig",
"=",
"x",
"x",
",",
"f",
",",
"r",
"=",
"tf",
".",
"split",
"(",
"layers",
"(",
")",
".",
"Dense",
"(",
"3",
"*",
"x_shape",
"[",
"-",
"1",
"]",
",",
"name",
"=",
"\"kernel_%d\"",
"%",
"i",
")",
"(",
"x",
")",
",",
"3",
",",
"axis",
"=",
"-",
"1",
")",
"f",
",",
"r",
"=",
"tf",
".",
"sigmoid",
"(",
"f",
")",
",",
"tf",
".",
"sigmoid",
"(",
"r",
")",
"x_times_one_minus_f",
"=",
"x",
"*",
"(",
"1.0",
"-",
"f",
")",
"# Compute in parallel for speed.",
"# Calculate states.",
"c_states",
"=",
"tf",
".",
"scan",
"(",
"next_state",
",",
"(",
"x_times_one_minus_f",
",",
"f",
")",
",",
"initializer",
"=",
"initial_state",
",",
"parallel_iterations",
"=",
"2",
",",
"name",
"=",
"\"scan_%d\"",
"%",
"i",
")",
"# Final output.",
"if",
"activation",
"is",
"not",
"None",
":",
"c_states",
"=",
"activation",
"(",
"c_states",
")",
"h",
"=",
"c_states",
"*",
"r",
"+",
"(",
"1.0",
"-",
"r",
")",
"*",
"x_orig",
"x",
"=",
"h",
"# Next layer.",
"# Transpose back to batch-major.",
"x",
"=",
"tf",
".",
"transpose",
"(",
"x",
",",
"[",
"1",
",",
"0",
",",
"2",
"]",
")",
"return",
"tf",
".",
"reshape",
"(",
"x",
",",
"x_shape",
")"
] |
SRU cell as in https://arxiv.org/abs/1709.02755.
This implementation uses tf.scan and can incur overhead, see the full SRU
function doc for details and an implementation that is sometimes faster.
Args:
x: A tensor of shape [batch, ..., channels] ; ... is treated as time.
num_layers: How many SRU layers; default is 2 as results for 1 disappoint.
activation: Optional activation function, try tf.nn.tanh or tf.nn.relu.
initial_state: Optional initial c-state, set to zeros if None.
name: Optional name, "sru" by default.
reuse: Optional reuse.
Returns:
A tensor of the same shape as x.
Raises:
ValueError: if num_layers is not positive.
|
[
"SRU",
"cell",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1709",
".",
"02755",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2238-L2298
|
train
|
SRU cell with scan.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNG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hLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(2066 - 2018) + '\157' + chr(0b110011) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b101 + 0o60) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\065' + chr(1562 - 1509), 0o10), ehT0Px3KOsy9(chr(1579 - 1531) + '\x6f' + '\065' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b101 + 0o62) + chr(981 - 931), 0o10), ehT0Px3KOsy9(chr(2148 - 2100) + chr(111) + chr(0b110010) + chr(0b110111) + chr(0b10100 + 0o34), 8020 - 8012), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1332 - 1281) + '\x36' + chr(51), 11225 - 11217), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + '\066' + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(54) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(11043 - 10932) + chr(0b10101 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + '\x32' + chr(1452 - 1402) + chr(0b101001 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1101 + 0o46) + chr(0b101 + 0o57) + chr(189 - 141), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1001110 + 0o41) + '\x31' + '\x35' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + chr(0b100110 + 0o14) + chr(643 - 589) + '\x30', 8), ehT0Px3KOsy9('\x30' + chr(2858 - 2747) + chr(0b110010) + '\061' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(0b100001 + 0o20) + chr(0b101 + 0o57) + chr(945 - 890), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b101000 + 0o16) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5438 - 5327) + chr(49) + chr(49) + chr(906 - 856), 0b1000), ehT0Px3KOsy9(chr(1001 - 953) + chr(9447 - 9336) + '\x32' + '\062', 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1010111 + 0o30) + chr(0b110110) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b101110 + 0o4) + '\066', 0o10), ehT0Px3KOsy9(chr(586 - 538) + '\157' + chr(49) + '\x35' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\x34' + chr(809 - 756), 2489 - 2481), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b10000 + 0o46) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + '\x32' + chr(49) + chr(0b110010), 44546 - 44538), ehT0Px3KOsy9(chr(981 - 933) + '\157' + chr(55) + '\x30', 24861 - 24853), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + '\x32' + chr(0b110011) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11100 + 0o123) + '\063' + '\064' + chr(1481 - 1430), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1322 - 1211) + '\063' + chr(2007 - 1957) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b110001) + chr(0b110001 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + '\066' + chr(0b100011 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(51) + chr(0b100001 + 0o26) + chr(0b110001), 54308 - 54300), ehT0Px3KOsy9(chr(0b110000) + chr(10954 - 10843) + chr(0b10101 + 0o37) + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100001 + 0o22) + chr(0b110010) + chr(2356 - 2301), 33034 - 33026), ehT0Px3KOsy9(chr(0b110000) + chr(0b100 + 0o153) + chr(0b110010 + 0o1) + chr(2110 - 2055) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\x31' + chr(1008 - 954), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\062' + chr(0b10010 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11000 + 0o127) + '\061' + chr(55) + '\066', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1559 - 1511) + chr(5204 - 5093) + chr(53) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'5'), '\144' + chr(0b0 + 0o145) + chr(0b1100011) + chr(0b1101111) + chr(0b101 + 0o137) + chr(0b1100101))(chr(117) + '\164' + chr(0b1100110) + '\055' + chr(2726 - 2670)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def X382m8WW_W5L(OeWW0F1dBPRQ, uftkTXJyNORO=ehT0Px3KOsy9('\x30' + '\157' + chr(197 - 147), 0o10), _GyOifGFZyk1=None, jXyGqlVq68Bb=None, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
if uftkTXJyNORO < ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11 + 0o56), 0b1000):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'Uu\xc4\x8fO\x08\x98\x9cQ\x90hf\xee\x85\x1e\xc3\xa9\n\x809f\x114\x0f\xc5\x80\xe5K\xf1\x97\xb9yV\xc3\x01\xf2\x99'), '\144' + chr(101) + '\143' + chr(4620 - 4509) + chr(0b1100100) + '\145')('\x75' + chr(0b1001010 + 0o52) + chr(0b1100101 + 0o1) + chr(0b101101) + chr(0b111000)) % uftkTXJyNORO)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'ma\xdb\x84K\x18\xd4\x96h\xc3gh\xe7\x85'), '\144' + '\x65' + chr(2962 - 2863) + '\157' + chr(0b1100 + 0o130) + '\x65')(chr(117) + '\x74' + chr(0b1100110) + chr(0b100010 + 0o13) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'hr\xdc'), chr(0b1100100) + chr(101) + chr(882 - 783) + '\157' + '\x64' + chr(0b111011 + 0o52))('\165' + chr(116) + '\146' + '\x2d' + '\x38'), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [QQEXXbdZyz6m[ehT0Px3KOsy9('\x30' + chr(0b10101 + 0o132) + chr(0b11011 + 0o25), 8)], -ehT0Px3KOsy9('\x30' + chr(11715 - 11604) + chr(0b110001), 8), QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + '\x31', 8)]])
OeWW0F1dBPRQ = IDJ2eXGCBCDu.transpose(OeWW0F1dBPRQ, [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1011 + 0o46), 8), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + '\060', 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b110010), 8)])
jXyGqlVq68Bb = jXyGqlVq68Bb or IDJ2eXGCBCDu.zeros([QQEXXbdZyz6m[ehT0Px3KOsy9(chr(48) + '\x6f' + '\x30', 8)], QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(0b110001), 8)]])
def l7yOP9uqtsC4(m6imapQzSyPP, OHSbC2z_Laqb):
(umLd6rKPecz5, Q_hUq55eXAEo) = OHSbC2z_Laqb
return Q_hUq55eXAEo * m6imapQzSyPP + umLd6rKPecz5
for WVxHKyX45z_L in vQr8gNKaIaWE(uftkTXJyNORO):
XcTftErM3GSZ = OeWW0F1dBPRQ
(OeWW0F1dBPRQ, EGyt1xfPT1P6, JWG5qApaeJkp) = IDJ2eXGCBCDu.split(sGi5Aql23May().Dense(ehT0Px3KOsy9('\x30' + chr(5404 - 5293) + '\x33', 0b1000) * QQEXXbdZyz6m[-ehT0Px3KOsy9('\x30' + chr(0b110 + 0o151) + chr(0b10001 + 0o40), 8)], name=xafqLlk3kkUe(SXOLrMavuUCe(b'pe\xdb\x83O\x16\xe7\xd6S'), chr(7731 - 7631) + chr(0b111111 + 0o46) + '\x63' + chr(0b1011011 + 0o24) + '\x64' + '\x65')(chr(117) + chr(0b1101010 + 0o12) + chr(9151 - 9049) + '\x2d' + chr(56)) % WVxHKyX45z_L)(OeWW0F1dBPRQ), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(899 - 848), 8), axis=-ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(968 - 919), 8))
(EGyt1xfPT1P6, JWG5qApaeJkp) = (IDJ2eXGCBCDu.sigmoid(EGyt1xfPT1P6), IDJ2eXGCBCDu.sigmoid(JWG5qApaeJkp))
cUBOyCazpI8_ = OeWW0F1dBPRQ * (1.0 - EGyt1xfPT1P6)
epkGIjB6AhLl = IDJ2eXGCBCDu.scan(l7yOP9uqtsC4, (cUBOyCazpI8_, EGyt1xfPT1P6), initializer=jXyGqlVq68Bb, parallel_iterations=ehT0Px3KOsy9('\060' + chr(111) + chr(50), 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'hc\xc8\x83u_\xdc'), chr(9906 - 9806) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\144' + chr(0b1100101))('\165' + chr(116) + chr(102) + chr(0b100 + 0o51) + chr(2766 - 2710)) % WVxHKyX45z_L)
if _GyOifGFZyk1 is not None:
epkGIjB6AhLl = _GyOifGFZyk1(epkGIjB6AhLl)
sz4HVsFVF8nL = epkGIjB6AhLl * JWG5qApaeJkp + (1.0 - JWG5qApaeJkp) * XcTftErM3GSZ
OeWW0F1dBPRQ = sz4HVsFVF8nL
OeWW0F1dBPRQ = IDJ2eXGCBCDu.transpose(OeWW0F1dBPRQ, [ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + '\061', 8), ehT0Px3KOsy9('\x30' + chr(0b1000101 + 0o52) + chr(1742 - 1694), 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\062', 8)])
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'ie\xda\x85K\n\xdd'), chr(7880 - 7780) + '\145' + chr(0b1100 + 0o127) + chr(0b1100101 + 0o12) + '\144' + chr(101))(chr(0b1101000 + 0o15) + chr(0b10 + 0o162) + '\146' + chr(0b101101) + '\x38'))(OeWW0F1dBPRQ, QQEXXbdZyz6m)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
sru
|
def sru(x,
num_layers=2,
activation=None,
initial_state=None,
name=None,
reuse=None):
"""SRU cell as in https://arxiv.org/abs/1709.02755.
As defined in the paper:
(1) x'_t = W x_t
(2) f_t = sigmoid(Wf x_t + bf)
(3) r_t = sigmoid(Wr x_t + br)
(4) c_t = f_t * c_{t-1} + (1 - f_t) * x'_t
(5) h_t = r_t * activation(c_t) + (1 - r_t) * x_t
This version uses functional ops to be faster on GPUs with TF-1.9+.
Args:
x: A tensor of shape [batch, ..., channels] ; ... is treated as time.
num_layers: How many SRU layers; default is 2 as results for 1 disappoint.
activation: Optional activation function, try tf.nn.tanh or tf.nn.relu.
initial_state: Optional initial c-state, set to zeros if None.
name: Optional name, "sru" by default.
reuse: Optional reuse.
Returns:
A tensor of the same shape as x.
Raises:
ValueError: if num_layers is not positive.
"""
if num_layers < 1:
raise ValueError("Number of layers must be positive: %d" % num_layers)
if is_xla_compiled(): # On TPU the XLA does a good job with while.
return sru_with_scan(x, num_layers, activation, initial_state, name, reuse)
try:
from tensorflow.contrib.recurrent.python.ops import functional_rnn # pylint: disable=g-import-not-at-top
except ImportError:
tf.logging.info("functional_rnn not found, using sru_with_scan instead")
return sru_with_scan(x, num_layers, activation, initial_state, name, reuse)
with tf.variable_scope(name, default_name="sru", values=[x], reuse=reuse):
# We assume x is [batch, ..., channels] and treat all ... as time.
x_shape = shape_list(x)
x = tf.reshape(x, [x_shape[0], -1, x_shape[-1]])
initial_state = initial_state or tf.zeros([x_shape[0], x_shape[-1]])
cell = CumsumprodCell(initial_state)
# Calculate SRU on each layer.
for i in range(num_layers):
# The parallel part of the SRU.
x_orig = x
x, f, r = tf.split(
layers().Dense(3 * x_shape[-1], name="kernel_%d" % i)(x), 3, axis=-1)
f, r = tf.sigmoid(f), tf.sigmoid(r)
x_times_one_minus_f = x * (1.0 - f) # Compute in parallel for speed.
# Calculate states.
concat = tf.concat([x_times_one_minus_f, f], axis=-1)
c_states, _ = functional_rnn.functional_rnn(
cell, concat, time_major=False)
# Final output.
if activation is not None:
c_states = activation(c_states)
h = c_states * r + (1.0 - r) * x_orig
x = h # Next layer.
return tf.reshape(x, x_shape)
|
python
|
def sru(x,
num_layers=2,
activation=None,
initial_state=None,
name=None,
reuse=None):
"""SRU cell as in https://arxiv.org/abs/1709.02755.
As defined in the paper:
(1) x'_t = W x_t
(2) f_t = sigmoid(Wf x_t + bf)
(3) r_t = sigmoid(Wr x_t + br)
(4) c_t = f_t * c_{t-1} + (1 - f_t) * x'_t
(5) h_t = r_t * activation(c_t) + (1 - r_t) * x_t
This version uses functional ops to be faster on GPUs with TF-1.9+.
Args:
x: A tensor of shape [batch, ..., channels] ; ... is treated as time.
num_layers: How many SRU layers; default is 2 as results for 1 disappoint.
activation: Optional activation function, try tf.nn.tanh or tf.nn.relu.
initial_state: Optional initial c-state, set to zeros if None.
name: Optional name, "sru" by default.
reuse: Optional reuse.
Returns:
A tensor of the same shape as x.
Raises:
ValueError: if num_layers is not positive.
"""
if num_layers < 1:
raise ValueError("Number of layers must be positive: %d" % num_layers)
if is_xla_compiled(): # On TPU the XLA does a good job with while.
return sru_with_scan(x, num_layers, activation, initial_state, name, reuse)
try:
from tensorflow.contrib.recurrent.python.ops import functional_rnn # pylint: disable=g-import-not-at-top
except ImportError:
tf.logging.info("functional_rnn not found, using sru_with_scan instead")
return sru_with_scan(x, num_layers, activation, initial_state, name, reuse)
with tf.variable_scope(name, default_name="sru", values=[x], reuse=reuse):
# We assume x is [batch, ..., channels] and treat all ... as time.
x_shape = shape_list(x)
x = tf.reshape(x, [x_shape[0], -1, x_shape[-1]])
initial_state = initial_state or tf.zeros([x_shape[0], x_shape[-1]])
cell = CumsumprodCell(initial_state)
# Calculate SRU on each layer.
for i in range(num_layers):
# The parallel part of the SRU.
x_orig = x
x, f, r = tf.split(
layers().Dense(3 * x_shape[-1], name="kernel_%d" % i)(x), 3, axis=-1)
f, r = tf.sigmoid(f), tf.sigmoid(r)
x_times_one_minus_f = x * (1.0 - f) # Compute in parallel for speed.
# Calculate states.
concat = tf.concat([x_times_one_minus_f, f], axis=-1)
c_states, _ = functional_rnn.functional_rnn(
cell, concat, time_major=False)
# Final output.
if activation is not None:
c_states = activation(c_states)
h = c_states * r + (1.0 - r) * x_orig
x = h # Next layer.
return tf.reshape(x, x_shape)
|
[
"def",
"sru",
"(",
"x",
",",
"num_layers",
"=",
"2",
",",
"activation",
"=",
"None",
",",
"initial_state",
"=",
"None",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"if",
"num_layers",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"\"Number of layers must be positive: %d\"",
"%",
"num_layers",
")",
"if",
"is_xla_compiled",
"(",
")",
":",
"# On TPU the XLA does a good job with while.",
"return",
"sru_with_scan",
"(",
"x",
",",
"num_layers",
",",
"activation",
",",
"initial_state",
",",
"name",
",",
"reuse",
")",
"try",
":",
"from",
"tensorflow",
".",
"contrib",
".",
"recurrent",
".",
"python",
".",
"ops",
"import",
"functional_rnn",
"# pylint: disable=g-import-not-at-top",
"except",
"ImportError",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"functional_rnn not found, using sru_with_scan instead\"",
")",
"return",
"sru_with_scan",
"(",
"x",
",",
"num_layers",
",",
"activation",
",",
"initial_state",
",",
"name",
",",
"reuse",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"sru\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"# We assume x is [batch, ..., channels] and treat all ... as time.",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"x_shape",
"[",
"0",
"]",
",",
"-",
"1",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
"initial_state",
"=",
"initial_state",
"or",
"tf",
".",
"zeros",
"(",
"[",
"x_shape",
"[",
"0",
"]",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
"cell",
"=",
"CumsumprodCell",
"(",
"initial_state",
")",
"# Calculate SRU on each layer.",
"for",
"i",
"in",
"range",
"(",
"num_layers",
")",
":",
"# The parallel part of the SRU.",
"x_orig",
"=",
"x",
"x",
",",
"f",
",",
"r",
"=",
"tf",
".",
"split",
"(",
"layers",
"(",
")",
".",
"Dense",
"(",
"3",
"*",
"x_shape",
"[",
"-",
"1",
"]",
",",
"name",
"=",
"\"kernel_%d\"",
"%",
"i",
")",
"(",
"x",
")",
",",
"3",
",",
"axis",
"=",
"-",
"1",
")",
"f",
",",
"r",
"=",
"tf",
".",
"sigmoid",
"(",
"f",
")",
",",
"tf",
".",
"sigmoid",
"(",
"r",
")",
"x_times_one_minus_f",
"=",
"x",
"*",
"(",
"1.0",
"-",
"f",
")",
"# Compute in parallel for speed.",
"# Calculate states.",
"concat",
"=",
"tf",
".",
"concat",
"(",
"[",
"x_times_one_minus_f",
",",
"f",
"]",
",",
"axis",
"=",
"-",
"1",
")",
"c_states",
",",
"_",
"=",
"functional_rnn",
".",
"functional_rnn",
"(",
"cell",
",",
"concat",
",",
"time_major",
"=",
"False",
")",
"# Final output.",
"if",
"activation",
"is",
"not",
"None",
":",
"c_states",
"=",
"activation",
"(",
"c_states",
")",
"h",
"=",
"c_states",
"*",
"r",
"+",
"(",
"1.0",
"-",
"r",
")",
"*",
"x_orig",
"x",
"=",
"h",
"# Next layer.",
"return",
"tf",
".",
"reshape",
"(",
"x",
",",
"x_shape",
")"
] |
SRU cell as in https://arxiv.org/abs/1709.02755.
As defined in the paper:
(1) x'_t = W x_t
(2) f_t = sigmoid(Wf x_t + bf)
(3) r_t = sigmoid(Wr x_t + br)
(4) c_t = f_t * c_{t-1} + (1 - f_t) * x'_t
(5) h_t = r_t * activation(c_t) + (1 - r_t) * x_t
This version uses functional ops to be faster on GPUs with TF-1.9+.
Args:
x: A tensor of shape [batch, ..., channels] ; ... is treated as time.
num_layers: How many SRU layers; default is 2 as results for 1 disappoint.
activation: Optional activation function, try tf.nn.tanh or tf.nn.relu.
initial_state: Optional initial c-state, set to zeros if None.
name: Optional name, "sru" by default.
reuse: Optional reuse.
Returns:
A tensor of the same shape as x.
Raises:
ValueError: if num_layers is not positive.
|
[
"SRU",
"cell",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1709",
".",
"02755",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2322-L2386
|
train
|
SRU cell as in the paper.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,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U,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(455 - 407) + chr(2359 - 2248) + chr(0b10001 + 0o45) + chr(1015 - 962), 57636 - 57628), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(0b110011) + chr(2121 - 2073), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000 + 0o2) + chr(51) + chr(0b11100 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + '\x33' + chr(387 - 339) + chr(50), 43032 - 43024), ehT0Px3KOsy9(chr(828 - 780) + '\x6f' + '\065' + '\x30', 3364 - 3356), ehT0Px3KOsy9(chr(1076 - 1028) + chr(0b1101100 + 0o3) + chr(0b10 + 0o61) + '\063' + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110100) + chr(0b110111), 24485 - 24477), ehT0Px3KOsy9('\060' + '\157' + chr(0b1100 + 0o45) + chr(0b110000) + chr(0b101111 + 0o2), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\061' + chr(0b101110 + 0o10), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1958 - 1847) + chr(0b110010) + chr(0b110000) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b110010 + 0o75) + '\063' + chr(51) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(54) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(2003 - 1955) + '\157' + '\063' + '\062' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b100 + 0o61) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b100111 + 0o110) + '\x31' + chr(0b101011 + 0o12) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + '\062' + '\x37' + chr(95 - 43), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(1308 - 1255) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x34' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + chr(0b1001 + 0o52) + chr(0b10110 + 0o40) + chr(0b11011 + 0o26), 0o10), ehT0Px3KOsy9(chr(1366 - 1318) + chr(111) + '\x33' + chr(49) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x37' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b101101 + 0o4) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(2003 - 1892) + chr(0b110001) + '\063' + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(2398 - 2348) + '\062' + chr(0b111 + 0o51), 42283 - 42275), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(855 - 805) + '\x31' + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b101110 + 0o2) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1751 - 1701) + chr(0b110001) + '\060', 0o10), ehT0Px3KOsy9(chr(1849 - 1801) + chr(0b10111 + 0o130) + chr(0b1011 + 0o50) + chr(721 - 670) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1188 - 1140) + chr(0b1101111) + chr(0b110011) + chr(0b110010) + chr(0b11101 + 0o32), 0o10), ehT0Px3KOsy9('\x30' + chr(0b100101 + 0o112) + '\x32' + '\067' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(573 - 523) + '\x32' + '\x33', 38096 - 38088), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(0b110010) + chr(0b110011) + chr(1306 - 1253), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + chr(50) + chr(655 - 607) + chr(0b10000 + 0o46), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(2164 - 2109) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(5222 - 5111) + chr(0b110010) + '\x30' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + '\x33' + chr(0b101100 + 0o10) + chr(0b1001 + 0o52), 55960 - 55952), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(0b110011) + chr(49) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(1252 - 1204), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x35' + chr(0b110000), 46094 - 46086), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(5332 - 5221) + chr(50) + chr(55) + '\064', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2149 - 2101) + chr(111) + '\x35' + chr(571 - 523), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b'), '\144' + chr(8665 - 8564) + chr(0b1100011) + chr(5350 - 5239) + '\144' + chr(0b1100101))('\x75' + chr(116) + chr(0b1100110) + chr(0b11101 + 0o20) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def lJ3cevsGH9U4(OeWW0F1dBPRQ, uftkTXJyNORO=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062', 53978 - 53970), _GyOifGFZyk1=None, jXyGqlVq68Bb=None, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
if uftkTXJyNORO < ehT0Px3KOsy9(chr(48) + chr(6085 - 5974) + chr(49), ord("\x08")):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'{\xed\xf4\xa0M\xae\x87.(\xa6\xb3S\xab\n\x19\xcf\x8c\t\x84\xbd\nj<\xf5\xa97\xe7\xad\xbe\xcf\xfa\xeb\xe3F\xa3\xc6\xab'), chr(100) + '\x65' + chr(99) + chr(111) + chr(0b1001011 + 0o31) + '\145')(chr(0b1100011 + 0o22) + chr(0b1110100) + '\146' + chr(0b101101) + chr(56)) % uftkTXJyNORO)
if GayarD_wafnb():
return X382m8WW_W5L(OeWW0F1dBPRQ, uftkTXJyNORO, _GyOifGFZyk1, jXyGqlVq68Bb, AIvJRzLdDfgF, pmC5wdSFgdFj)
try:
(SIqf1OyBqg0O,) = (xafqLlk3kkUe(xafqLlk3kkUe(xafqLlk3kkUe(xafqLlk3kkUe(xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'A\xfd\xf7\xb1G\xae\xc1-!\xf1\xf1Q\xbd\x01\x1f\xce\xc5\x06\xdf\xbc\x1b)+\xe2\xfb"\xe6\xaa\xf9\xcb\xea\xe9\xee\x13\xed\xcd\xa0`\x9b'), '\x64' + '\145' + chr(2898 - 2799) + '\x6f' + chr(7886 - 7786) + '\145')(chr(13552 - 13435) + '\x74' + '\x66' + chr(1820 - 1775) + chr(0b1000 + 0o60)), xafqLlk3kkUe(SXOLrMavuUCe(b'S\xed\xf7\xa1\\\xb5\xc8//\xea\x80@\xbc\x01'), chr(0b1 + 0o143) + '\x65' + '\x63' + chr(7028 - 6917) + chr(0b1100100) + '\x65')(chr(0b11111 + 0o126) + chr(0b110 + 0o156) + chr(5888 - 5786) + '\x2d' + chr(0b111000))), xafqLlk3kkUe(SXOLrMavuUCe(b'V\xf7\xf7\xb6Z\xb5\xc5'), '\144' + '\145' + '\x63' + chr(8342 - 8231) + '\144' + chr(0b1100101))('\165' + '\x74' + chr(0b1100110) + chr(1129 - 1084) + chr(56))), xafqLlk3kkUe(SXOLrMavuUCe(b'G\xfd\xfa\xb7Z\xae\xc2/:'), chr(2901 - 2801) + chr(0b1100101) + chr(6723 - 6624) + chr(0b101101 + 0o102) + '\x64' + chr(878 - 777))(chr(0b1001000 + 0o55) + chr(0b1110100) + chr(2784 - 2682) + chr(57 - 12) + chr(0b111000))), xafqLlk3kkUe(SXOLrMavuUCe(b'E\xe1\xed\xaaG\xb2'), chr(100) + '\145' + chr(9079 - 8980) + '\157' + chr(0b1010011 + 0o21) + chr(0b10101 + 0o120))(chr(0b1110101) + '\164' + chr(0b1011 + 0o133) + chr(45) + chr(0b111000))), xafqLlk3kkUe(SXOLrMavuUCe(b'Z\xe8\xea'), chr(0b101001 + 0o73) + chr(0b1010011 + 0o22) + chr(99) + chr(0b1101111) + chr(0b101001 + 0o73) + '\x65')(chr(117) + '\x74' + chr(0b1011110 + 0o10) + chr(45) + '\x38')), xafqLlk3kkUe(SXOLrMavuUCe(b'S\xed\xf7\xa1\\\xb5\xc8//\xea\x80@\xbc\x01'), '\x64' + chr(1643 - 1542) + '\x63' + chr(8743 - 8632) + chr(0b1100100) + '\145')('\x75' + '\x74' + chr(0b1100110) + '\055' + '\x38')),)
except yROw0HWBk0Qc:
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'f\xaf\xd1\xba]\xbf\xc0v$\xea\x85Y'), chr(0b1000000 + 0o44) + '\145' + '\x63' + chr(111) + '\x64' + chr(0b111010 + 0o53))(chr(117) + chr(0b1110100) + chr(102) + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'S\xed\xf7\xa1\\\xb5\xc8//\xea\x80@\xbc\x01K\xd2\xc3\x10\xd1\xa8\x11?0\xf4\xa5g\xfd\xad\xbe\xd5\xf4\xbd\xf5\x0e\xf6\xbc\xb8y\x9c\xd4j\xeb\xfa\xa3F\xfc\xce/=\xf2\xbaS\xb6'), '\x64' + '\145' + chr(6936 - 6837) + chr(4555 - 4444) + chr(0b1100100) + '\x65')('\165' + chr(0b1011110 + 0o26) + chr(102) + '\x2d' + chr(0b111000)))
return X382m8WW_W5L(OeWW0F1dBPRQ, uftkTXJyNORO, _GyOifGFZyk1, jXyGqlVq68Bb, AIvJRzLdDfgF, pmC5wdSFgdFj)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'C\xf9\xeb\xabI\xbe\xcb$\x11\xf5\xbc]\xa2\n'), '\x64' + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(117) + chr(116) + chr(0b10011 + 0o123) + chr(45) + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'F\xea\xec'), chr(0b1100100) + chr(0b101 + 0o140) + chr(0b1001011 + 0o30) + chr(111) + chr(0b1011010 + 0o12) + '\x65')('\165' + chr(8465 - 8349) + chr(0b1100110) + '\x2d' + chr(788 - 732)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [QQEXXbdZyz6m[ehT0Px3KOsy9(chr(834 - 786) + chr(111) + '\x30', 52132 - 52124)], -ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1011 + 0o46), 8), QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(1355 - 1307) + chr(0b1011111 + 0o20) + chr(375 - 326), 8)]])
jXyGqlVq68Bb = jXyGqlVq68Bb or IDJ2eXGCBCDu.zeros([QQEXXbdZyz6m[ehT0Px3KOsy9(chr(745 - 697) + '\x6f' + chr(163 - 115), 8)], QQEXXbdZyz6m[-ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8)]])
XQrM8eZytga5 = ID3QTynuH7XQ(jXyGqlVq68Bb)
for WVxHKyX45z_L in vQr8gNKaIaWE(uftkTXJyNORO):
XcTftErM3GSZ = OeWW0F1dBPRQ
(OeWW0F1dBPRQ, EGyt1xfPT1P6, JWG5qApaeJkp) = IDJ2eXGCBCDu.split(sGi5Aql23May().Dense(ehT0Px3KOsy9(chr(967 - 919) + '\157' + chr(0b110011), 47591 - 47583) * QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001), 8)], name=xafqLlk3kkUe(SXOLrMavuUCe(b'^\xfd\xeb\xacM\xb0\xf8d*'), chr(1963 - 1863) + '\x65' + chr(0b1100011) + chr(0b111011 + 0o64) + chr(0b1100100) + '\x65')(chr(117) + chr(0b101000 + 0o114) + chr(102) + chr(0b0 + 0o55) + chr(2323 - 2267)) % WVxHKyX45z_L)(OeWW0F1dBPRQ), ehT0Px3KOsy9('\x30' + chr(111) + chr(51), 8), axis=-ehT0Px3KOsy9('\060' + chr(0b10100 + 0o133) + chr(0b101 + 0o54), 8))
(EGyt1xfPT1P6, JWG5qApaeJkp) = (IDJ2eXGCBCDu.sigmoid(EGyt1xfPT1P6), IDJ2eXGCBCDu.sigmoid(JWG5qApaeJkp))
cUBOyCazpI8_ = OeWW0F1dBPRQ * (1.0 - EGyt1xfPT1P6)
n6iOk5pPXJg1 = IDJ2eXGCBCDu.concat([cUBOyCazpI8_, EGyt1xfPT1P6], axis=-ehT0Px3KOsy9('\060' + '\157' + chr(0b110001), 8))
(epkGIjB6AhLl, VNGQdHSFPrso) = SIqf1OyBqg0O.functional_rnn(XQrM8eZytga5, n6iOk5pPXJg1, time_major=ehT0Px3KOsy9('\060' + '\157' + chr(0b11100 + 0o24), 8))
if _GyOifGFZyk1 is not None:
epkGIjB6AhLl = _GyOifGFZyk1(epkGIjB6AhLl)
sz4HVsFVF8nL = epkGIjB6AhLl * JWG5qApaeJkp + (1.0 - JWG5qApaeJkp) * XcTftErM3GSZ
OeWW0F1dBPRQ = sz4HVsFVF8nL
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'G\xfd\xea\xaaI\xac\xc2'), chr(100) + chr(0b1010011 + 0o22) + chr(0b1100011) + '\157' + chr(8599 - 8499) + '\x65')('\165' + chr(0b1110100) + chr(102) + '\x2d' + chr(0b111000)))(OeWW0F1dBPRQ, QQEXXbdZyz6m)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
linear_set_layer
|
def linear_set_layer(layer_size,
inputs,
context=None,
activation_fn=tf.nn.relu,
dropout=0.0,
name=None):
"""Basic layer type for doing funky things with sets.
Applies a linear transformation to each element in the input set.
If a context is supplied, it is concatenated with the inputs.
e.g. One can use global_pool_1d to get a representation of the set which
can then be used as the context for the next layer.
TODO: Add bias add (or control the biases used).
Args:
layer_size: Dimension to transform the input vectors to.
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
context: A tensor of shape [batch_size, context_dims] containing a global
statistic about the set.
activation_fn: The activation function to use.
dropout: Dropout probability.
name: name.
Returns:
Tensor of shape [batch_size, sequence_length, output_dims] containing the
sequences of transformed vectors.
"""
with tf.variable_scope(
name, default_name="linear_set_layer", values=[inputs]):
# Apply 1D convolution to apply linear filter to each element
# along the 2nd dimension.
outputs = conv1d(inputs, layer_size, 1, activation=None, name="set_conv")
# Apply the context if it exists.
if context is not None:
# Unfortunately tf doesn't support broadcasting via concat, but we can
# simply add the transformed context to get the same effect.
if len(context.get_shape().as_list()) == 2:
context = tf.expand_dims(context, axis=1)
cont_tfm = conv1d(
context, layer_size, 1, activation=None, name="cont_conv")
outputs += cont_tfm
if activation_fn is not None:
outputs = activation_fn(outputs)
if dropout != 0.0:
outputs = tf.nn.dropout(outputs, 1.0 - dropout)
return outputs
|
python
|
def linear_set_layer(layer_size,
inputs,
context=None,
activation_fn=tf.nn.relu,
dropout=0.0,
name=None):
"""Basic layer type for doing funky things with sets.
Applies a linear transformation to each element in the input set.
If a context is supplied, it is concatenated with the inputs.
e.g. One can use global_pool_1d to get a representation of the set which
can then be used as the context for the next layer.
TODO: Add bias add (or control the biases used).
Args:
layer_size: Dimension to transform the input vectors to.
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
context: A tensor of shape [batch_size, context_dims] containing a global
statistic about the set.
activation_fn: The activation function to use.
dropout: Dropout probability.
name: name.
Returns:
Tensor of shape [batch_size, sequence_length, output_dims] containing the
sequences of transformed vectors.
"""
with tf.variable_scope(
name, default_name="linear_set_layer", values=[inputs]):
# Apply 1D convolution to apply linear filter to each element
# along the 2nd dimension.
outputs = conv1d(inputs, layer_size, 1, activation=None, name="set_conv")
# Apply the context if it exists.
if context is not None:
# Unfortunately tf doesn't support broadcasting via concat, but we can
# simply add the transformed context to get the same effect.
if len(context.get_shape().as_list()) == 2:
context = tf.expand_dims(context, axis=1)
cont_tfm = conv1d(
context, layer_size, 1, activation=None, name="cont_conv")
outputs += cont_tfm
if activation_fn is not None:
outputs = activation_fn(outputs)
if dropout != 0.0:
outputs = tf.nn.dropout(outputs, 1.0 - dropout)
return outputs
|
[
"def",
"linear_set_layer",
"(",
"layer_size",
",",
"inputs",
",",
"context",
"=",
"None",
",",
"activation_fn",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"dropout",
"=",
"0.0",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"linear_set_layer\"",
",",
"values",
"=",
"[",
"inputs",
"]",
")",
":",
"# Apply 1D convolution to apply linear filter to each element",
"# along the 2nd dimension.",
"outputs",
"=",
"conv1d",
"(",
"inputs",
",",
"layer_size",
",",
"1",
",",
"activation",
"=",
"None",
",",
"name",
"=",
"\"set_conv\"",
")",
"# Apply the context if it exists.",
"if",
"context",
"is",
"not",
"None",
":",
"# Unfortunately tf doesn't support broadcasting via concat, but we can",
"# simply add the transformed context to get the same effect.",
"if",
"len",
"(",
"context",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
")",
"==",
"2",
":",
"context",
"=",
"tf",
".",
"expand_dims",
"(",
"context",
",",
"axis",
"=",
"1",
")",
"cont_tfm",
"=",
"conv1d",
"(",
"context",
",",
"layer_size",
",",
"1",
",",
"activation",
"=",
"None",
",",
"name",
"=",
"\"cont_conv\"",
")",
"outputs",
"+=",
"cont_tfm",
"if",
"activation_fn",
"is",
"not",
"None",
":",
"outputs",
"=",
"activation_fn",
"(",
"outputs",
")",
"if",
"dropout",
"!=",
"0.0",
":",
"outputs",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"outputs",
",",
"1.0",
"-",
"dropout",
")",
"return",
"outputs"
] |
Basic layer type for doing funky things with sets.
Applies a linear transformation to each element in the input set.
If a context is supplied, it is concatenated with the inputs.
e.g. One can use global_pool_1d to get a representation of the set which
can then be used as the context for the next layer.
TODO: Add bias add (or control the biases used).
Args:
layer_size: Dimension to transform the input vectors to.
inputs: A tensor of shape [batch_size, sequence_length, input_dims]
containing the sequences of input vectors.
context: A tensor of shape [batch_size, context_dims] containing a global
statistic about the set.
activation_fn: The activation function to use.
dropout: Dropout probability.
name: name.
Returns:
Tensor of shape [batch_size, sequence_length, output_dims] containing the
sequences of transformed vectors.
|
[
"Basic",
"layer",
"type",
"for",
"doing",
"funky",
"things",
"with",
"sets",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2389-L2440
|
train
|
Basic layer type for doing funky things with sets.
|
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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BmUpv,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) + '\061' + '\x30' + chr(0b110101), 22999 - 22991), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b11111 + 0o120) + chr(50) + chr(49) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(0b1000 + 0o51) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b110001 + 0o3) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101101 + 0o2) + '\x33' + '\064' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7773 - 7662) + chr(51) + chr(0b11000 + 0o35) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\x35' + chr(957 - 902), 21793 - 21785), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1000 + 0o52) + chr(51) + chr(2406 - 2355), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101001 + 0o12) + chr(0b10011 + 0o36) + chr(1450 - 1397), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x34' + '\063', 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(0b110001) + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b110100) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + '\061' + '\062' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1214 - 1166) + '\157' + chr(0b101011 + 0o10) + '\066' + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1736 - 1687) + chr(0b110101 + 0o0) + chr(0b10011 + 0o44), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1322 - 1272) + '\x31' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(0b110001) + '\062' + chr(54), 0b1000), ehT0Px3KOsy9(chr(1167 - 1119) + chr(6329 - 6218) + '\x32' + chr(0b110101) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(48) + chr(0b11111 + 0o30), 61158 - 61150), ehT0Px3KOsy9('\060' + '\157' + chr(0b10100 + 0o35) + chr(54) + chr(0b1000 + 0o51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + chr(0b10100 + 0o36) + chr(298 - 248) + chr(0b110111), 48971 - 48963), ehT0Px3KOsy9(chr(2215 - 2167) + chr(0b1101111) + '\x32' + chr(0b110001) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(2219 - 2171) + chr(0b1101111) + chr(0b110010) + chr(0b100001 + 0o25) + chr(0b110011), 4772 - 4764), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + chr(0b10011 + 0o36) + chr(2610 - 2556) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(1013 - 962) + chr(51) + '\064', 2768 - 2760), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b110111) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1651 - 1603) + chr(0b1101111) + chr(1551 - 1501) + chr(635 - 580) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b110011) + chr(2084 - 2035) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1114 - 1066) + chr(0b1001001 + 0o46) + '\065' + chr(1161 - 1110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b110101) + '\061', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(405 - 294) + chr(0b110011) + chr(0b110010) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(0b1110 + 0o43) + chr(49), 29044 - 29036), ehT0Px3KOsy9(chr(2225 - 2177) + '\x6f' + chr(49) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(1978 - 1925) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + '\x35' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(3044 - 2933) + chr(0b1100 + 0o46) + '\x30' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\064' + chr(0b1110 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(52) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1 + 0o62) + chr(2252 - 2203) + '\063', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(134 - 86) + chr(0b110001 + 0o76) + chr(0b110101) + chr(0b101111 + 0o1), 3329 - 3321)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'k'), '\x64' + chr(0b1100101) + '\x63' + chr(111) + chr(6591 - 6491) + chr(2499 - 2398))(chr(117) + chr(0b1110100) + chr(0b111010 + 0o54) + '\x2d' + chr(2424 - 2368)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def g9GmF8Lp2vRy(QBdOw8CcCaaS, vXoupepMtCXU, vUUG4_3aIqQC=None, csxIq5qGbfRm=xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'7\xe8%\xd7'), chr(5288 - 5188) + chr(101) + chr(2838 - 2739) + chr(0b1101111) + '\x64' + '\x65')(chr(0b1110101) + chr(1493 - 1377) + '\x66' + chr(45) + '\x38')), ag0mwEgWzjYv=0.0, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'3\xec;\xcb\x80\x8b\x03\xfe\x92\x10\x10\xc9#\x91'), chr(0b110010 + 0o62) + chr(101) + '\143' + chr(111) + chr(7753 - 7653) + chr(0b1100101))(chr(0b1100110 + 0o17) + '\x74' + chr(0b111101 + 0o51) + chr(0b101010 + 0o3) + chr(0b111000)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b")\xe4'\xc7\x80\x9b0\xe8\xa8\x17,\xca2\x8d\n\xf8"), chr(4909 - 4809) + chr(2786 - 2685) + chr(0b1010001 + 0o22) + '\x6f' + chr(5345 - 5245) + chr(0b1100101))('\x75' + '\164' + chr(8523 - 8421) + chr(117 - 72) + '\070'), values=[vXoupepMtCXU]):
Dx_DllZ8uCko = aXjcJrCEUeB1(vXoupepMtCXU, QBdOw8CcCaaS, ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(0b11011 + 0o26), 0b1000), activation=None, name=xafqLlk3kkUe(SXOLrMavuUCe(b'6\xe8=\xfd\x82\x86\x01\xed'), '\x64' + chr(0b1100101) + chr(99) + chr(0b101000 + 0o107) + chr(100) + chr(0b111 + 0o136))('\165' + '\164' + '\146' + '\055' + chr(862 - 806)))
if vUUG4_3aIqQC is not None:
if c2A0yzQpDQB3(xafqLlk3kkUe(vUUG4_3aIqQC.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'$\xfe\x16\xce\x88\x9a\x1b'), chr(2675 - 2575) + chr(101) + '\x63' + chr(0b1010111 + 0o30) + chr(0b1010111 + 0o15) + '\145')('\165' + chr(0b1101010 + 0o12) + chr(2403 - 2301) + chr(0b101101) + chr(56)))()) == ehT0Px3KOsy9(chr(48) + '\157' + '\062', ord("\x08")):
vUUG4_3aIqQC = IDJ2eXGCBCDu.expand_dims(vUUG4_3aIqQC, axis=ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061', 8))
db6Xy_q1pV7m = aXjcJrCEUeB1(vUUG4_3aIqQC, QBdOw8CcCaaS, ehT0Px3KOsy9('\x30' + '\x6f' + chr(49), 8), activation=None, name=xafqLlk3kkUe(SXOLrMavuUCe(b"&\xe2'\xd6\xbe\x8a\x00\xf5\xbb"), chr(100) + '\x65' + chr(0b1100011) + chr(111) + chr(100) + '\145')(chr(11452 - 11335) + '\x74' + chr(102) + '\055' + chr(56)))
Dx_DllZ8uCko += db6Xy_q1pV7m
if csxIq5qGbfRm is not None:
Dx_DllZ8uCko = csxIq5qGbfRm(Dx_DllZ8uCko)
if ag0mwEgWzjYv != 0.0:
Dx_DllZ8uCko = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(Dx_DllZ8uCko, 1.0 - ag0mwEgWzjYv)
return Dx_DllZ8uCko
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
ravanbakhsh_set_layer
|
def ravanbakhsh_set_layer(layer_size,
inputs,
mask=None,
sequential=False,
activation_fn=tf.nn.tanh,
dropout=0.0,
name=None):
"""Layer from Deep Sets paper: https://arxiv.org/abs/1611.04500 .
More parameter-efficient version of a linear-set-layer with context.
Args:
layer_size: Dimension to transform the input vectors to.
inputs: A tensor of shape [batch_size, sequence_length, vector]
containing the sequences of input vectors.
mask: A tensor of shape [batch_size, sequence_length] containing a
mask for the inputs with 1's for existing elements, and 0's elsewhere.
sequential: If true, will use a running global pool so each element will
only depend on those before it. Set true if this layer is being used in
an output sequence.
activation_fn: The activation function to use.
dropout: dropout.
name: name.
Returns:
Tensor of shape [batch_size, sequence_length, vector] containing the
sequences of transformed vectors.
"""
del dropout
with tf.variable_scope(name, "ravanbakhsh_set_layer", [inputs]):
if sequential:
return linear_set_layer(
layer_size,
inputs - running_global_pool_1d(inputs),
activation_fn=activation_fn,
name=name)
return linear_set_layer(
layer_size,
inputs - tf.expand_dims(global_pool_1d(inputs, mask=mask), axis=1),
activation_fn=activation_fn,
name=name)
|
python
|
def ravanbakhsh_set_layer(layer_size,
inputs,
mask=None,
sequential=False,
activation_fn=tf.nn.tanh,
dropout=0.0,
name=None):
"""Layer from Deep Sets paper: https://arxiv.org/abs/1611.04500 .
More parameter-efficient version of a linear-set-layer with context.
Args:
layer_size: Dimension to transform the input vectors to.
inputs: A tensor of shape [batch_size, sequence_length, vector]
containing the sequences of input vectors.
mask: A tensor of shape [batch_size, sequence_length] containing a
mask for the inputs with 1's for existing elements, and 0's elsewhere.
sequential: If true, will use a running global pool so each element will
only depend on those before it. Set true if this layer is being used in
an output sequence.
activation_fn: The activation function to use.
dropout: dropout.
name: name.
Returns:
Tensor of shape [batch_size, sequence_length, vector] containing the
sequences of transformed vectors.
"""
del dropout
with tf.variable_scope(name, "ravanbakhsh_set_layer", [inputs]):
if sequential:
return linear_set_layer(
layer_size,
inputs - running_global_pool_1d(inputs),
activation_fn=activation_fn,
name=name)
return linear_set_layer(
layer_size,
inputs - tf.expand_dims(global_pool_1d(inputs, mask=mask), axis=1),
activation_fn=activation_fn,
name=name)
|
[
"def",
"ravanbakhsh_set_layer",
"(",
"layer_size",
",",
"inputs",
",",
"mask",
"=",
"None",
",",
"sequential",
"=",
"False",
",",
"activation_fn",
"=",
"tf",
".",
"nn",
".",
"tanh",
",",
"dropout",
"=",
"0.0",
",",
"name",
"=",
"None",
")",
":",
"del",
"dropout",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"\"ravanbakhsh_set_layer\"",
",",
"[",
"inputs",
"]",
")",
":",
"if",
"sequential",
":",
"return",
"linear_set_layer",
"(",
"layer_size",
",",
"inputs",
"-",
"running_global_pool_1d",
"(",
"inputs",
")",
",",
"activation_fn",
"=",
"activation_fn",
",",
"name",
"=",
"name",
")",
"return",
"linear_set_layer",
"(",
"layer_size",
",",
"inputs",
"-",
"tf",
".",
"expand_dims",
"(",
"global_pool_1d",
"(",
"inputs",
",",
"mask",
"=",
"mask",
")",
",",
"axis",
"=",
"1",
")",
",",
"activation_fn",
"=",
"activation_fn",
",",
"name",
"=",
"name",
")"
] |
Layer from Deep Sets paper: https://arxiv.org/abs/1611.04500 .
More parameter-efficient version of a linear-set-layer with context.
Args:
layer_size: Dimension to transform the input vectors to.
inputs: A tensor of shape [batch_size, sequence_length, vector]
containing the sequences of input vectors.
mask: A tensor of shape [batch_size, sequence_length] containing a
mask for the inputs with 1's for existing elements, and 0's elsewhere.
sequential: If true, will use a running global pool so each element will
only depend on those before it. Set true if this layer is being used in
an output sequence.
activation_fn: The activation function to use.
dropout: dropout.
name: name.
Returns:
Tensor of shape [batch_size, sequence_length, vector] containing the
sequences of transformed vectors.
|
[
"Layer",
"from",
"Deep",
"Sets",
"paper",
":",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1611",
".",
"04500",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2443-L2483
|
train
|
A linear - set layer from Deep Sets paper.
|
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,Q6d3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VKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(1646 - 1594) + chr(1364 - 1311), 0o10), ehT0Px3KOsy9(chr(2188 - 2140) + '\x6f' + chr(49) + chr(0b100101 + 0o15) + chr(0b101 + 0o55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x30' + chr(0b10000 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(51 - 3) + chr(7348 - 7237) + '\x32' + '\064' + '\065', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100010 + 0o20) + chr(639 - 586) + chr(0b100101 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(8467 - 8356) + chr(0b101110 + 0o3) + chr(0b1111 + 0o47) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(53) + chr(1161 - 1112), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\062' + chr(0b110001), 25144 - 25136), ehT0Px3KOsy9('\x30' + chr(6489 - 6378) + '\062' + '\x37' + '\x32', 14390 - 14382), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b100101 + 0o112) + '\x31' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100 + 0o143) + chr(0b110011) + chr(51) + chr(1715 - 1661), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b11 + 0o57) + chr(0b110011) + chr(0b100010 + 0o21), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(673 - 623) + '\x34' + chr(379 - 329), 58819 - 58811), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(0b110010) + chr(0b110111) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\063' + chr(1755 - 1707), ord("\x08")), ehT0Px3KOsy9(chr(741 - 693) + '\157' + '\x33' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b110010), 29989 - 29981), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(6160 - 6049) + chr(0b110001) + chr(0b110111) + chr(2312 - 2263), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1100 + 0o47) + chr(53) + chr(0b110111), 19387 - 19379), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1247 - 1198) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\x33' + chr(54), 54140 - 54132), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b110001) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2446 - 2392) + chr(0b1000 + 0o55), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010011 + 0o34) + chr(50) + '\064' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x30' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(1727 - 1679) + chr(4555 - 4444) + '\061' + chr(0b101000 + 0o15) + chr(55), 6949 - 6941), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(0b110001) + chr(522 - 470) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(351 - 301) + '\x32' + chr(514 - 465), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b110010) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(1027 - 978) + chr(52) + chr(2284 - 2229), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b110110) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(5859 - 5748) + '\061' + chr(0b100000 + 0o24) + chr(55), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(85 - 34) + chr(0b110001) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + chr(1249 - 1200) + '\060' + chr(0b10101 + 0o42), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11010 + 0o30) + chr(0b110101) + chr(145 - 97), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101110 + 0o1) + chr(0b101110 + 0o3) + '\067' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(2156 - 2108) + '\x6f' + chr(0b110011) + chr(0b110001) + chr(0b1 + 0o64), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(6137 - 6026) + chr(0b110011) + chr(1948 - 1896) + chr(1842 - 1787), 43398 - 43390), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(731 - 676) + chr(557 - 506), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + '\064' + chr(1541 - 1492), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1055 - 1002) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), chr(100) + chr(0b101 + 0o140) + chr(0b10011 + 0o120) + '\x6f' + chr(0b101111 + 0o65) + chr(3228 - 3127))(chr(0b1110101) + chr(11514 - 11398) + '\146' + chr(0b10100 + 0o31) + chr(0b1010 + 0o56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def d2IIh7ajv14p(QBdOw8CcCaaS, vXoupepMtCXU, Iz1jSgUKZDvt=None, i2BeHGBgK1at=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2116 - 2068), 0o10), csxIq5qGbfRm=xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd13-\xcd'), chr(6061 - 5961) + chr(0b1100101) + '\143' + chr(0b1101111) + '\144' + chr(0b1100101))('\x75' + chr(0b1000 + 0o154) + '\146' + chr(669 - 624) + chr(2472 - 2416))), ag0mwEgWzjYv=0.0, AIvJRzLdDfgF=None):
del ag0mwEgWzjYv
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd331\xcc\xcf\x14\xc5\xf4\xe5~\xbd\xf4\xd2\xdb'), '\x64' + chr(3496 - 3395) + chr(0b1100011) + '\x6f' + '\x64' + chr(4628 - 4527))(chr(0b11101 + 0o130) + '\164' + chr(0b1100110) + chr(1927 - 1882) + chr(0b110100 + 0o4)))(AIvJRzLdDfgF, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd735\xc4\xc0\x14\xc8\xfa\xd2~\xb6\xc4\xd1\xdb\xacDv\x18\x96j,'), chr(100) + chr(8594 - 8493) + chr(99) + chr(111) + chr(0b1010000 + 0o24) + chr(0b1100101))(chr(0b101101 + 0o110) + chr(6488 - 6372) + chr(777 - 675) + '\055' + chr(2354 - 2298)), [vXoupepMtCXU]):
if i2BeHGBgK1at:
return g9GmF8Lp2vRy(QBdOw8CcCaaS, vXoupepMtCXU - SXub7MYCXwfH(vXoupepMtCXU), activation_fn=csxIq5qGbfRm, name=AIvJRzLdDfgF)
return g9GmF8Lp2vRy(QBdOw8CcCaaS, vXoupepMtCXU - xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0*3\xc4\xc0\x12\xf6\xf5\xd3`\xad'), '\144' + chr(3296 - 3195) + chr(0b111010 + 0o51) + chr(111) + chr(0b11111 + 0o105) + '\x65')(chr(117) + '\x74' + chr(102) + chr(45) + '\070'))(eMNw25YCTzmX(vXoupepMtCXU, mask=Iz1jSgUKZDvt), axis=ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001), 0b1000)), activation_fn=csxIq5qGbfRm, name=AIvJRzLdDfgF)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
fn_device_dependency_dict
|
def fn_device_dependency_dict():
"""State container for fn_device_dependency."""
default_graph = tf.get_default_graph()
if not hasattr(default_graph, "dependency_dict"):
default_graph.dependency_dict = collections.defaultdict(list)
return default_graph.dependency_dict
|
python
|
def fn_device_dependency_dict():
"""State container for fn_device_dependency."""
default_graph = tf.get_default_graph()
if not hasattr(default_graph, "dependency_dict"):
default_graph.dependency_dict = collections.defaultdict(list)
return default_graph.dependency_dict
|
[
"def",
"fn_device_dependency_dict",
"(",
")",
":",
"default_graph",
"=",
"tf",
".",
"get_default_graph",
"(",
")",
"if",
"not",
"hasattr",
"(",
"default_graph",
",",
"\"dependency_dict\"",
")",
":",
"default_graph",
".",
"dependency_dict",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"return",
"default_graph",
".",
"dependency_dict"
] |
State container for fn_device_dependency.
|
[
"State",
"container",
"for",
"fn_device_dependency",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_lay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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(54) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(51) + chr(500 - 445) + chr(0b11 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + chr(0b110101) + chr(0b101100 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1992 - 1941) + chr(52) + chr(1496 - 1447), 0o10), ehT0Px3KOsy9('\x30' + chr(8345 - 8234) + chr(0b110011) + chr(54) + '\064', 0o10), ehT0Px3KOsy9(chr(205 - 157) + '\x6f' + chr(0b110010) + chr(53) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\061' + chr(1014 - 961), 0b1000), ehT0Px3KOsy9(chr(1206 - 1158) + chr(111) + '\063' + '\062' + '\x31', 42757 - 42749), ehT0Px3KOsy9(chr(247 - 199) + '\157' + chr(49) + chr(2612 - 2558) + chr(0b101110 + 0o2), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11100 + 0o123) + chr(49) + chr(775 - 723) + chr(1470 - 1417), 2155 - 2147), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(0b110101) + chr(0b110001), 28264 - 28256), ehT0Px3KOsy9(chr(48) + chr(9851 - 9740) + '\062' + chr(1467 - 1419) + chr(0b1000 + 0o50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(52) + '\x32', 1974 - 1966), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(51) + chr(2280 - 2232), 0o10), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + chr(0b1101 + 0o46) + chr(0b1011 + 0o50) + chr(763 - 714), ord("\x08")), ehT0Px3KOsy9(chr(62 - 14) + chr(0b1101111) + chr(298 - 248) + '\063' + chr(52), 50374 - 50366), ehT0Px3KOsy9('\x30' + chr(5869 - 5758) + '\063' + chr(0b110110) + '\x34', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\064' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8803 - 8692) + '\062' + chr(0b100100 + 0o14), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9528 - 9417) + chr(0b100110 + 0o13) + '\067' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(10742 - 10631) + '\x32' + chr(0b110100) + chr(2094 - 2040), 35605 - 35597), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\062' + chr(53), 2026 - 2018), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b1011 + 0o51) + '\061', 8), ehT0Px3KOsy9('\060' + chr(5127 - 5016) + chr(0b110011) + chr(1085 - 1032) + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b110011) + chr(0b1110 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10011 + 0o37) + '\062' + chr(1120 - 1067), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(1450 - 1398) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(2249 - 2195) + chr(0b110001 + 0o3), 8), ehT0Px3KOsy9(chr(1025 - 977) + chr(10433 - 10322) + chr(0b110001) + chr(0b110100) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(49) + chr(48) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + chr(0b110011) + chr(0b1011 + 0o51) + '\x35', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1181 - 1132) + '\065' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(1400 - 1345) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(5621 - 5510) + chr(51) + '\065' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7415 - 7304) + chr(481 - 431) + chr(0b110101) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(462 - 411) + chr(1992 - 1944) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b101100 + 0o12) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1011 + 0o51) + chr(52), 59989 - 59981), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x35' + chr(0b110111), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x19'), chr(100) + chr(101) + '\x63' + chr(111) + '\x64' + chr(0b1100101))(chr(117) + chr(0b1000100 + 0o60) + chr(102) + chr(0b101010 + 0o3) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def BO9TVfWhcwJj():
ElI1_FyHuBGR = IDJ2eXGCBCDu.get_default_graph()
if not lot1PSoAwYhj(ElI1_FyHuBGR, xafqLlk3kkUe(SXOLrMavuUCe(b'S\x9dZ\x84\x9a\xc9\xa8\xbf\x13\x1cv\xe4\xcb\xbb\xad'), '\x64' + chr(6091 - 5990) + chr(646 - 547) + '\x6f' + chr(0b1100100) + '\x65')(chr(0b1000001 + 0o64) + chr(11825 - 11709) + '\x66' + chr(0b11001 + 0o24) + chr(56))):
ElI1_FyHuBGR.XBJRKGVenx_y = FGhnnwoh1Dd8.defaultdict(YyaZ4tpXu4lf)
return xafqLlk3kkUe(ElI1_FyHuBGR, xafqLlk3kkUe(SXOLrMavuUCe(b'o\xba`\xb3\xbf\xea\x9b\xb4\x1e\x1dv\xf9'), '\x64' + '\x65' + chr(0b101100 + 0o67) + chr(111) + chr(0b1100100) + chr(0b1010001 + 0o24))(chr(117) + chr(0b1010110 + 0o36) + chr(0b11101 + 0o111) + chr(0b10100 + 0o31) + chr(0b111000)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
fn_device_dependency
|
def fn_device_dependency(name, device=""):
"""Add control deps for name and device."""
key = name + "_" + device
outs = []
def body():
with tf.control_dependencies(fn_device_dependency_dict()[key]):
yield outs
assert outs
deps = outs
if isinstance(outs[0], (list, tuple)):
assert len(outs) == 1
deps = outs[0]
fn_device_dependency_dict()[key] = deps
if device:
with tf.device(device):
return body()
else:
return body()
|
python
|
def fn_device_dependency(name, device=""):
"""Add control deps for name and device."""
key = name + "_" + device
outs = []
def body():
with tf.control_dependencies(fn_device_dependency_dict()[key]):
yield outs
assert outs
deps = outs
if isinstance(outs[0], (list, tuple)):
assert len(outs) == 1
deps = outs[0]
fn_device_dependency_dict()[key] = deps
if device:
with tf.device(device):
return body()
else:
return body()
|
[
"def",
"fn_device_dependency",
"(",
"name",
",",
"device",
"=",
"\"\"",
")",
":",
"key",
"=",
"name",
"+",
"\"_\"",
"+",
"device",
"outs",
"=",
"[",
"]",
"def",
"body",
"(",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"fn_device_dependency_dict",
"(",
")",
"[",
"key",
"]",
")",
":",
"yield",
"outs",
"assert",
"outs",
"deps",
"=",
"outs",
"if",
"isinstance",
"(",
"outs",
"[",
"0",
"]",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"assert",
"len",
"(",
"outs",
")",
"==",
"1",
"deps",
"=",
"outs",
"[",
"0",
"]",
"fn_device_dependency_dict",
"(",
")",
"[",
"key",
"]",
"=",
"deps",
"if",
"device",
":",
"with",
"tf",
".",
"device",
"(",
"device",
")",
":",
"return",
"body",
"(",
")",
"else",
":",
"return",
"body",
"(",
")"
] |
Add control deps for name and device.
|
[
"Add",
"control",
"deps",
"for",
"name",
"and",
"device",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2495-L2515
|
train
|
Add control deps for name and device.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,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,q1QCh3W88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xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b10001 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(5854 - 5743) + chr(1314 - 1265) + chr(0b110101) + '\x30', 49564 - 49556), ehT0Px3KOsy9(chr(2023 - 1975) + chr(4791 - 4680) + chr(0b100011 + 0o21) + '\x37', 22626 - 22618), ehT0Px3KOsy9(chr(515 - 467) + '\x6f' + chr(0b110011) + chr(51), 58612 - 58604), ehT0Px3KOsy9('\060' + '\x6f' + chr(721 - 672) + chr(49), 23188 - 23180), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\066' + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(4262 - 4151) + chr(0b100111 + 0o13) + chr(1842 - 1787) + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(49) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\064' + chr(2715 - 2662), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(586 - 534) + chr(2833 - 2779), 41880 - 41872), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b101 + 0o57) + '\066', 35922 - 35914), ehT0Px3KOsy9('\x30' + chr(0b110001 + 0o76) + chr(0b10110 + 0o33) + chr(53) + chr(1308 - 1254), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53) + chr(513 - 464), 0b1000), ehT0Px3KOsy9(chr(576 - 528) + chr(0b1101111) + chr(0b1100 + 0o45) + chr(1017 - 965) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + chr(51) + chr(0b110010) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\064', 40309 - 40301), ehT0Px3KOsy9(chr(658 - 610) + '\157' + '\x36' + chr(0b101111 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(1664 - 1616) + '\x6f' + chr(1578 - 1528) + chr(0b110000) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(1119 - 1071) + chr(0b1101111) + '\x36' + '\x35', 14837 - 14829), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b110011) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(9930 - 9819) + chr(52) + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b1010 + 0o53) + chr(0b110010), 24266 - 24258), ehT0Px3KOsy9(chr(1465 - 1417) + chr(9467 - 9356) + chr(944 - 895) + '\060' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(857 - 809) + chr(0b1101111) + chr(49) + chr(2209 - 2159) + chr(0b0 + 0o65), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1034 - 982) + chr(0b110110), 8), ehT0Px3KOsy9(chr(401 - 353) + '\157' + chr(1621 - 1571) + chr(49) + chr(0b1111 + 0o45), 15457 - 15449), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\x34', 50609 - 50601), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + '\062' + '\066' + chr(1354 - 1306), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b110111) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(1304 - 1193) + chr(53) + chr(828 - 779), 8), ehT0Px3KOsy9(chr(48) + chr(1698 - 1587) + '\063' + chr(0b101101 + 0o3) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(5800 - 5689) + chr(51) + chr(54) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2190 - 2079) + chr(51) + '\x37' + chr(1229 - 1175), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101 + 0o152) + chr(0b1111 + 0o43) + chr(0b110001 + 0o1) + chr(51), 10284 - 10276), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101 + 0o56) + chr(49) + chr(0b101010 + 0o6), 0b1000), ehT0Px3KOsy9(chr(2245 - 2197) + chr(0b1101111) + chr(0b11 + 0o60) + chr(0b101101 + 0o5) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1103 - 1055) + chr(3537 - 3426) + chr(1051 - 996) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1010 - 899) + chr(51) + chr(1360 - 1312) + chr(0b111 + 0o54), 50258 - 50250), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(51) + chr(51), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1054 - 1006) + chr(0b1101111) + chr(53) + chr(802 - 754), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'<'), chr(100) + chr(101) + chr(0b1100011) + chr(1736 - 1625) + chr(0b1011000 + 0o14) + '\145')(chr(0b110000 + 0o105) + chr(116) + chr(102) + chr(1190 - 1145) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def GrTuwLuNBg9s(AIvJRzLdDfgF, v9dZPx26KxBP=xafqLlk3kkUe(SXOLrMavuUCe(b''), chr(3702 - 3602) + chr(2934 - 2833) + chr(0b101110 + 0o65) + chr(2664 - 2553) + chr(0b1100100) + '\x65')(chr(0b1000101 + 0o60) + '\164' + '\x66' + '\x2d' + chr(529 - 473))):
K3J4ZwSlE0sT = AIvJRzLdDfgF + xafqLlk3kkUe(SXOLrMavuUCe(b'M'), '\x64' + chr(101) + chr(99) + chr(0b1001001 + 0o46) + chr(7530 - 7430) + chr(101))('\165' + '\164' + chr(0b1100110) + chr(1566 - 1521) + chr(0b111000)) + v9dZPx26KxBP
_VexQtc8sfoI = []
def TD8C81EGml3n():
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'q\x07Io{\x1f\xd2\xd4AC\xd6\x0bG\x03\xb1zW\xeeP\xa9'), chr(100) + chr(0b101111 + 0o66) + '\x63' + chr(0b110011 + 0o74) + chr(868 - 768) + '\145')(chr(0b110101 + 0o100) + '\164' + '\x66' + '\x2d' + chr(0b111000)))(BO9TVfWhcwJj()[K3J4ZwSlE0sT]):
yield _VexQtc8sfoI
assert _VexQtc8sfoI
tiOm_0evs6u1 = _VexQtc8sfoI
if PlSM16l2KDPD(_VexQtc8sfoI[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x30', 0b1000)], (YyaZ4tpXu4lf, KNyTy8rYcwji)):
assert c2A0yzQpDQB3(_VexQtc8sfoI) == ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11 + 0o56), 8)
tiOm_0evs6u1 = _VexQtc8sfoI[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1922 - 1874), 8)]
BO9TVfWhcwJj()[K3J4ZwSlE0sT] = tiOm_0evs6u1
if v9dZPx26KxBP:
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'v\rQrj\x15'), '\x64' + chr(0b1010011 + 0o22) + chr(0b11100 + 0o107) + chr(4156 - 4045) + '\x64' + chr(0b100 + 0o141))(chr(0b1110101) + chr(116) + '\x66' + chr(0b101101) + '\x38'))(v9dZPx26KxBP):
return TD8C81EGml3n()
else:
return TD8C81EGml3n()
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
underlying_variable_ref
|
def underlying_variable_ref(t):
"""Find the underlying variable ref.
Traverses through Identity, ReadVariableOp, and Enter ops.
Stops when op type has Variable or VarHandle in name.
Args:
t: a Tensor
Returns:
a Tensor that is a variable ref, or None on error.
"""
while t.op.type in ["Identity", "ReadVariableOp", "Enter"]:
t = t.op.inputs[0]
op_type = t.op.type
if "Variable" in op_type or "VarHandle" in op_type:
return t
else:
return None
|
python
|
def underlying_variable_ref(t):
"""Find the underlying variable ref.
Traverses through Identity, ReadVariableOp, and Enter ops.
Stops when op type has Variable or VarHandle in name.
Args:
t: a Tensor
Returns:
a Tensor that is a variable ref, or None on error.
"""
while t.op.type in ["Identity", "ReadVariableOp", "Enter"]:
t = t.op.inputs[0]
op_type = t.op.type
if "Variable" in op_type or "VarHandle" in op_type:
return t
else:
return None
|
[
"def",
"underlying_variable_ref",
"(",
"t",
")",
":",
"while",
"t",
".",
"op",
".",
"type",
"in",
"[",
"\"Identity\"",
",",
"\"ReadVariableOp\"",
",",
"\"Enter\"",
"]",
":",
"t",
"=",
"t",
".",
"op",
".",
"inputs",
"[",
"0",
"]",
"op_type",
"=",
"t",
".",
"op",
".",
"type",
"if",
"\"Variable\"",
"in",
"op_type",
"or",
"\"VarHandle\"",
"in",
"op_type",
":",
"return",
"t",
"else",
":",
"return",
"None"
] |
Find the underlying variable ref.
Traverses through Identity, ReadVariableOp, and Enter ops.
Stops when op type has Variable or VarHandle in name.
Args:
t: a Tensor
Returns:
a Tensor that is a variable ref, or None on error.
|
[
"Find",
"the",
"underlying",
"variable",
"ref",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2518-L2537
|
train
|
Finds the underlying variable ref.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY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9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b11010 + 0o125) + chr(0b110101) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(0b110011) + '\x34' + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010010 + 0o35) + chr(0b110001) + chr(0b110101) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\062' + chr(0b100 + 0o54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11110 + 0o24) + chr(0b10 + 0o56) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1041 - 993) + '\157' + chr(52) + chr(0b0 + 0o67), 42457 - 42449), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7285 - 7174) + chr(0b110101) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10000 + 0o137) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(0b10110 + 0o34) + chr(0b1101 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10831 - 10720) + chr(0b110010 + 0o4) + chr(0b110111), 43221 - 43213), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(0b101001 + 0o10) + chr(0b11 + 0o60) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + '\x33' + '\x36' + chr(233 - 185), 45929 - 45921), ehT0Px3KOsy9(chr(48) + '\157' + '\x35' + chr(0b10000 + 0o42), 8), ehT0Px3KOsy9('\x30' + chr(9506 - 9395) + chr(1992 - 1941) + chr(718 - 663) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + '\x31' + '\066' + '\x30', 59536 - 59528), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100111 + 0o13) + '\x30' + chr(1275 - 1224), 0b1000), ehT0Px3KOsy9(chr(1951 - 1903) + chr(5584 - 5473) + chr(0b110010) + '\064' + chr(1812 - 1760), 0b1000), ehT0Px3KOsy9(chr(1859 - 1811) + '\x6f' + '\x33' + chr(2128 - 2074) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(11543 - 11432) + chr(0b100111 + 0o13) + chr(0b100000 + 0o25) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(1160 - 1105), 42707 - 42699), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(3822 - 3711) + chr(2601 - 2546), 8), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(0b101001 + 0o12) + '\063', 13500 - 13492), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b110111) + chr(2006 - 1952), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(1489 - 1434), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3564 - 3453) + chr(0b110001) + chr(2154 - 2105) + chr(1343 - 1295), 64969 - 64961), ehT0Px3KOsy9(chr(714 - 666) + '\x6f' + '\062' + chr(0b110010) + chr(0b100 + 0o55), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(10155 - 10044) + chr(178 - 129) + chr(0b110000), 51129 - 51121), ehT0Px3KOsy9(chr(227 - 179) + chr(0b101010 + 0o105) + chr(0b110001) + chr(52) + '\067', 5468 - 5460), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100001 + 0o22) + chr(0b11011 + 0o26) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(8334 - 8223) + chr(49) + '\x37' + chr(1490 - 1437), 0b1000), ehT0Px3KOsy9(chr(922 - 874) + chr(10204 - 10093) + '\061' + chr(1322 - 1267) + '\x35', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101101 + 0o4) + chr(0b110011) + '\060', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(2604 - 2552) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(0b11010 + 0o32) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b110100) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(0b110011) + chr(0b110001) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b111110 + 0o61) + '\065' + chr(0b11010 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(416 - 363), 7639 - 7631)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1000 + 0o147) + '\065' + '\x30', 32304 - 32296)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x07'), '\x64' + '\145' + chr(728 - 629) + chr(0b1101111) + chr(0b1011111 + 0o5) + chr(101))(chr(117) + '\x74' + '\146' + chr(1484 - 1439) + chr(0b10100 + 0o44)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def qfjiM2fc8GSi(YeT3l7JgTbWR):
while xafqLlk3kkUe(YeT3l7JgTbWR.op, xafqLlk3kkUe(SXOLrMavuUCe(b'^\x8a=\xbd\xfcBGhjFG.'), chr(0b11000 + 0o114) + chr(0b10111 + 0o116) + chr(7232 - 7133) + chr(0b11100 + 0o123) + chr(100) + '\145')(chr(7161 - 7044) + chr(116) + chr(102) + chr(45) + chr(0b111000))) in [xafqLlk3kkUe(SXOLrMavuUCe(b'`\x83\t\xbe\xf1NdS'), chr(0b1100100) + chr(0b1100010 + 0o3) + chr(9376 - 9277) + chr(0b1101111) + chr(0b1001100 + 0o30) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(4386 - 4284) + '\055' + chr(620 - 564)), xafqLlk3kkUe(SXOLrMavuUCe(b'{\x82\r\xb4\xd3FbCfq[=\xbfZ'), chr(740 - 640) + chr(0b1100101) + chr(0b1100011) + chr(11698 - 11587) + chr(0b1100100) + chr(1190 - 1089))(chr(117) + '\164' + '\146' + chr(0b10001 + 0o34) + chr(2609 - 2553)), xafqLlk3kkUe(SXOLrMavuUCe(b'l\x89\x18\xb5\xf7'), chr(100) + '\x65' + '\143' + chr(111) + chr(100) + chr(0b1010101 + 0o20))(chr(0b111101 + 0o70) + chr(0b1110100) + chr(0b110110 + 0o60) + chr(0b101101) + chr(56))]:
YeT3l7JgTbWR = YeT3l7JgTbWR.op.vXoupepMtCXU[ehT0Px3KOsy9('\x30' + chr(111) + '\x30', 30878 - 30870)]
Z2snvw94fARv = YeT3l7JgTbWR.op.wmQmyeWBmUpv
if xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\x86\x1e\xb9\xe4E|O'), chr(0b1001100 + 0o30) + chr(101) + chr(0b101 + 0o136) + chr(8743 - 8632) + '\144' + chr(0b1100 + 0o131))('\x75' + '\x74' + '\146' + '\x2d' + chr(0b111000)) in Z2snvw94fARv or xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\x86\x1e\x98\xe4ItFb'), chr(9233 - 9133) + chr(0b1001100 + 0o31) + chr(0b1010000 + 0o23) + chr(3875 - 3764) + chr(8340 - 8240) + '\x65')('\165' + '\x74' + chr(0b1100110) + '\055' + '\070') in Z2snvw94fARv:
return YeT3l7JgTbWR
else:
return None
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
underlying_variable
|
def underlying_variable(t):
"""Find the underlying tf.Variable object.
Args:
t: a Tensor
Returns:
tf.Variable.
"""
t = underlying_variable_ref(t)
assert t is not None
# make sure that the graph has a variable index and that it is up-to-date
if not hasattr(tf.get_default_graph(), "var_index"):
tf.get_default_graph().var_index = {}
var_index = tf.get_default_graph().var_index
for v in tf.global_variables()[len(var_index):]:
var_index[v.name] = v
return var_index[t.name]
|
python
|
def underlying_variable(t):
"""Find the underlying tf.Variable object.
Args:
t: a Tensor
Returns:
tf.Variable.
"""
t = underlying_variable_ref(t)
assert t is not None
# make sure that the graph has a variable index and that it is up-to-date
if not hasattr(tf.get_default_graph(), "var_index"):
tf.get_default_graph().var_index = {}
var_index = tf.get_default_graph().var_index
for v in tf.global_variables()[len(var_index):]:
var_index[v.name] = v
return var_index[t.name]
|
[
"def",
"underlying_variable",
"(",
"t",
")",
":",
"t",
"=",
"underlying_variable_ref",
"(",
"t",
")",
"assert",
"t",
"is",
"not",
"None",
"# make sure that the graph has a variable index and that it is up-to-date",
"if",
"not",
"hasattr",
"(",
"tf",
".",
"get_default_graph",
"(",
")",
",",
"\"var_index\"",
")",
":",
"tf",
".",
"get_default_graph",
"(",
")",
".",
"var_index",
"=",
"{",
"}",
"var_index",
"=",
"tf",
".",
"get_default_graph",
"(",
")",
".",
"var_index",
"for",
"v",
"in",
"tf",
".",
"global_variables",
"(",
")",
"[",
"len",
"(",
"var_index",
")",
":",
"]",
":",
"var_index",
"[",
"v",
".",
"name",
"]",
"=",
"v",
"return",
"var_index",
"[",
"t",
".",
"name",
"]"
] |
Find the underlying tf.Variable object.
Args:
t: a Tensor
Returns:
tf.Variable.
|
[
"Find",
"the",
"underlying",
"tf",
".",
"Variable",
"object",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2540-L2557
|
train
|
Find the underlying tf. Variable object. naccesse
|
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,DXjfarvgF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Ue,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(0b110010 + 0o75) + '\x37' + chr(0b11010 + 0o27), 0o10), ehT0Px3KOsy9('\x30' + chr(8125 - 8014) + chr(2143 - 2094) + chr(0b110001) + chr(0b100010 + 0o21), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(12275 - 12164) + '\061' + chr(0b101 + 0o55) + chr(1136 - 1083), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\063' + chr(0b110100), 17543 - 17535), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(1011 - 956) + '\x30', 0o10), ehT0Px3KOsy9(chr(2254 - 2206) + chr(0b110 + 0o151) + chr(0b11100 + 0o27) + '\x31' + '\066', 43598 - 43590), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1100 + 0o46) + '\x33' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(2219 - 2171) + chr(6826 - 6715) + chr(0b110011) + '\x31' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10721 - 10610) + chr(0b110001) + chr(2078 - 2024) + '\063', 54388 - 54380), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(1277 - 1226) + '\x32' + '\066', 28568 - 28560), ehT0Px3KOsy9(chr(0b110000) + chr(9359 - 9248) + chr(2351 - 2301) + chr(0b110110) + chr(55), 0o10), ehT0Px3KOsy9(chr(1514 - 1466) + chr(0b100110 + 0o111) + '\061' + '\x31' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(4087 - 3976) + chr(0b11111 + 0o22) + chr(2383 - 2332) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x37' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\x36' + chr(593 - 541), 14396 - 14388), ehT0Px3KOsy9('\060' + chr(0b10 + 0o155) + chr(50) + chr(51) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(11524 - 11413) + chr(2379 - 2324) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101011 + 0o7) + chr(739 - 688) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + '\x31' + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100100 + 0o17) + chr(0b101111 + 0o3) + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(9291 - 9180) + chr(0b110000 + 0o3) + chr(2141 - 2092) + chr(1081 - 1027), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\063' + '\x31', 0o10), ehT0Px3KOsy9('\x30' + chr(755 - 644) + chr(0b110011 + 0o0) + chr(0b10010 + 0o40) + '\066', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(1959 - 1906) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(2313 - 2262) + chr(1647 - 1599) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(1964 - 1915) + chr(1610 - 1557) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110010) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110100 + 0o3) + '\x37', 14915 - 14907), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(702 - 652) + '\067' + chr(1433 - 1385), 16129 - 16121), ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + '\x33' + chr(48) + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(8487 - 8376) + '\064' + chr(0b1111 + 0o47), 0o10), ehT0Px3KOsy9(chr(958 - 910) + '\157' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\x34' + chr(2492 - 2437), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1011 + 0o50) + chr(55), 19672 - 19664), ehT0Px3KOsy9('\060' + '\157' + chr(54) + chr(0b10111 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(3427 - 3316) + chr(0b10 + 0o61) + '\064' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b110001) + '\x30' + chr(0b100001 + 0o26), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(0b101 + 0o54), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(959 - 911) + chr(0b100011 + 0o114) + chr(1407 - 1354) + chr(1488 - 1440), 47907 - 47899)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x17'), '\x64' + '\x65' + '\x63' + '\157' + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b11001 + 0o115) + chr(943 - 898) + chr(1064 - 1008)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def lYFsi8hoO1sq(YeT3l7JgTbWR):
YeT3l7JgTbWR = qfjiM2fc8GSi(YeT3l7JgTbWR)
assert YeT3l7JgTbWR is not None
if not lot1PSoAwYhj(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'^.?\n\xf8\x1d\xa8\xfb\xba\x1f\xa2\xe8-,\x98D\xf7'), chr(100) + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + '\145')('\x75' + '\164' + chr(102) + chr(0b101101) + chr(0b10 + 0o66)))(), xafqLlk3kkUe(SXOLrMavuUCe(b'O*9\n\xf5\x16\xaa\xff\xb7'), chr(0b100001 + 0o103) + '\x65' + '\143' + chr(0b1101111) + chr(902 - 802) + '\145')(chr(0b1110101) + chr(116) + '\146' + chr(45) + '\070')):
IDJ2eXGCBCDu.get_default_graph().O3UtvupPvWTs = {}
O3UtvupPvWTs = IDJ2eXGCBCDu.get_default_graph().O3UtvupPvWTs
for cMbll0QYhULo in xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"^'$7\xfd\x14\x91\xec\xae\x01\xbf\xd6(2\x9cG"), chr(0b1100100) + '\145' + '\x63' + chr(111) + '\144' + chr(9318 - 9217))(chr(117) + chr(116) + chr(8385 - 8283) + chr(0b11101 + 0o20) + chr(0b10010 + 0o46)))()[c2A0yzQpDQB3(O3UtvupPvWTs):]:
O3UtvupPvWTs[cMbll0QYhULo.AIvJRzLdDfgF] = cMbll0QYhULo
return O3UtvupPvWTs[xafqLlk3kkUe(YeT3l7JgTbWR, xafqLlk3kkUe(SXOLrMavuUCe(b'x\x02=\x1f\xce\x02\x82\xfe\x8b\x15\xb1\xf1'), chr(0b1100100) + '\x65' + chr(0b1011001 + 0o12) + chr(0b1101111) + chr(0b111101 + 0o47) + '\145')(chr(8429 - 8312) + '\x74' + chr(1814 - 1712) + chr(0b101101) + chr(0b1111 + 0o51)))]
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
approximate_split
|
def approximate_split(x, num_splits, axis=0):
"""Split approximately equally into num_splits parts.
Args:
x: a Tensor
num_splits: an integer
axis: an integer.
Returns:
a list of num_splits Tensors.
"""
size = shape_list(x)[axis]
size_splits = [tf.div(size + i, num_splits) for i in range(num_splits)]
return tf.split(x, size_splits, axis=axis)
|
python
|
def approximate_split(x, num_splits, axis=0):
"""Split approximately equally into num_splits parts.
Args:
x: a Tensor
num_splits: an integer
axis: an integer.
Returns:
a list of num_splits Tensors.
"""
size = shape_list(x)[axis]
size_splits = [tf.div(size + i, num_splits) for i in range(num_splits)]
return tf.split(x, size_splits, axis=axis)
|
[
"def",
"approximate_split",
"(",
"x",
",",
"num_splits",
",",
"axis",
"=",
"0",
")",
":",
"size",
"=",
"shape_list",
"(",
"x",
")",
"[",
"axis",
"]",
"size_splits",
"=",
"[",
"tf",
".",
"div",
"(",
"size",
"+",
"i",
",",
"num_splits",
")",
"for",
"i",
"in",
"range",
"(",
"num_splits",
")",
"]",
"return",
"tf",
".",
"split",
"(",
"x",
",",
"size_splits",
",",
"axis",
"=",
"axis",
")"
] |
Split approximately equally into num_splits parts.
Args:
x: a Tensor
num_splits: an integer
axis: an integer.
Returns:
a list of num_splits Tensors.
|
[
"Split",
"approximately",
"equally",
"into",
"num_splits",
"parts",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2560-L2573
|
train
|
Split appro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hjv33u,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(241 - 193) + chr(0b110101 + 0o72) + chr(50) + chr(53) + chr(0b1 + 0o65), ord("\x08")), ehT0Px3KOsy9(chr(1073 - 1025) + chr(0b1101111) + chr(194 - 142) + '\x37', 65324 - 65316), ehT0Px3KOsy9('\060' + chr(111) + '\x37', 64066 - 64058), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1414 - 1365) + '\067' + chr(0b110001 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b111 + 0o54) + '\x30' + chr(484 - 431), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b110100) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + chr(0b100101 + 0o14) + '\x36' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(5130 - 5019) + chr(0b110010) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b110010) + chr(0b1011 + 0o50) + chr(0b10011 + 0o35), 131 - 123), ehT0Px3KOsy9(chr(1677 - 1629) + '\157' + '\063' + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(1021 - 910) + chr(0b110010) + '\x37' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1000011 + 0o54) + chr(49) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1058 - 1007) + chr(0b10110 + 0o36) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b110001) + chr(0b11010 + 0o30), 0b1000), ehT0Px3KOsy9(chr(658 - 610) + chr(111) + '\x33' + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(644 - 594) + chr(802 - 747), 0b1000), ehT0Px3KOsy9('\x30' + chr(4100 - 3989) + chr(296 - 246) + chr(875 - 826) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1011110 + 0o21) + chr(0b1101 + 0o46) + chr(0b11010 + 0o26) + chr(0b101110 + 0o6), 25432 - 25424), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b110 + 0o151) + '\065' + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + '\x33' + '\x36' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2186 - 2137) + '\x33' + '\060', 11992 - 11984), ehT0Px3KOsy9('\x30' + chr(1666 - 1555) + '\x33' + '\x33' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + '\062' + '\x35' + chr(2077 - 2022), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(1402 - 1351) + chr(0b101000 + 0o10) + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + chr(3872 - 3761) + chr(1767 - 1717) + '\x31' + chr(0b100011 + 0o24), 0b1000), ehT0Px3KOsy9(chr(1229 - 1181) + chr(0b1010011 + 0o34) + '\064' + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + '\062' + '\x30' + '\066', 43333 - 43325), ehT0Px3KOsy9('\x30' + chr(111) + chr(1499 - 1450) + chr(54) + chr(2448 - 2397), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101001 + 0o6) + chr(0b1100 + 0o47) + chr(0b1011 + 0o45) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + '\064' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\x30' + chr(948 - 898), 0b1000), ehT0Px3KOsy9(chr(1437 - 1389) + '\x6f' + '\066' + chr(1972 - 1923), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b1100 + 0o53) + chr(0b1000 + 0o55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + chr(0b110110) + chr(2764 - 2710), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(8018 - 7907) + '\062' + chr(0b10100 + 0o40) + chr(882 - 831), 0o10), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + chr(2441 - 2391) + chr(0b110001) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(54) + chr(0b100101 + 0o14), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b11111 + 0o21) + chr(1365 - 1313), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(53) + '\x30', 45259 - 45251)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x80'), chr(100) + chr(1277 - 1176) + chr(8986 - 8887) + chr(111) + chr(8438 - 8338) + '\x65')('\165' + chr(0b1110100) + chr(0b111001 + 0o55) + chr(868 - 823) + chr(2173 - 2117)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def OSY0RsHrOdKF(OeWW0F1dBPRQ, NbAbkov2L4m5, cRTh61qyvi24=ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + '\x30', 0o10)):
NLcc3BCJnQka = qypPRW8fq869(OeWW0F1dBPRQ)[cRTh61qyvi24]
Zrx3vta8wLOx = [IDJ2eXGCBCDu.div(NLcc3BCJnQka + WVxHKyX45z_L, NbAbkov2L4m5) for WVxHKyX45z_L in vQr8gNKaIaWE(NbAbkov2L4m5)]
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xddWk\x16g'), '\144' + chr(101) + chr(99) + chr(111) + '\144' + chr(0b100100 + 0o101))(chr(9877 - 9760) + '\x74' + '\x66' + chr(0b10000 + 0o35) + chr(1573 - 1517)))(OeWW0F1dBPRQ, Zrx3vta8wLOx, axis=cRTh61qyvi24)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
smoothing_cross_entropy_factored_grad
|
def smoothing_cross_entropy_factored_grad(op, dy):
"""Gradient function for smoothing_cross_entropy_factored."""
a = op.inputs[0]
b = op.inputs[1]
labels = op.inputs[2]
confidence = op.inputs[3]
num_splits = 16
vocab_size = shape_list(b)[0]
labels = approximate_split(labels, num_splits)
a = approximate_split(a, num_splits)
dy = approximate_split(dy, num_splits)
b_grad = None
a_grad_parts = []
deps = []
for part in range(num_splits):
with tf.control_dependencies(deps):
logits = tf.matmul(a[part], b, transpose_b=True)
output_part = smoothing_cross_entropy(logits, labels[part], vocab_size,
confidence)
a_grad_part, b_grad_part = tf.gradients(
ys=[output_part], xs=[a[part], b], grad_ys=[dy[part]])
a_grad_parts.append(a_grad_part)
if part > 0:
b_grad += b_grad_part
else:
b_grad = b_grad_part
deps = [b_grad, a_grad_part]
a_grad = tf.concat(a_grad_parts, 0)
return a_grad, b_grad, None, None
|
python
|
def smoothing_cross_entropy_factored_grad(op, dy):
"""Gradient function for smoothing_cross_entropy_factored."""
a = op.inputs[0]
b = op.inputs[1]
labels = op.inputs[2]
confidence = op.inputs[3]
num_splits = 16
vocab_size = shape_list(b)[0]
labels = approximate_split(labels, num_splits)
a = approximate_split(a, num_splits)
dy = approximate_split(dy, num_splits)
b_grad = None
a_grad_parts = []
deps = []
for part in range(num_splits):
with tf.control_dependencies(deps):
logits = tf.matmul(a[part], b, transpose_b=True)
output_part = smoothing_cross_entropy(logits, labels[part], vocab_size,
confidence)
a_grad_part, b_grad_part = tf.gradients(
ys=[output_part], xs=[a[part], b], grad_ys=[dy[part]])
a_grad_parts.append(a_grad_part)
if part > 0:
b_grad += b_grad_part
else:
b_grad = b_grad_part
deps = [b_grad, a_grad_part]
a_grad = tf.concat(a_grad_parts, 0)
return a_grad, b_grad, None, None
|
[
"def",
"smoothing_cross_entropy_factored_grad",
"(",
"op",
",",
"dy",
")",
":",
"a",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"b",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"labels",
"=",
"op",
".",
"inputs",
"[",
"2",
"]",
"confidence",
"=",
"op",
".",
"inputs",
"[",
"3",
"]",
"num_splits",
"=",
"16",
"vocab_size",
"=",
"shape_list",
"(",
"b",
")",
"[",
"0",
"]",
"labels",
"=",
"approximate_split",
"(",
"labels",
",",
"num_splits",
")",
"a",
"=",
"approximate_split",
"(",
"a",
",",
"num_splits",
")",
"dy",
"=",
"approximate_split",
"(",
"dy",
",",
"num_splits",
")",
"b_grad",
"=",
"None",
"a_grad_parts",
"=",
"[",
"]",
"deps",
"=",
"[",
"]",
"for",
"part",
"in",
"range",
"(",
"num_splits",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"deps",
")",
":",
"logits",
"=",
"tf",
".",
"matmul",
"(",
"a",
"[",
"part",
"]",
",",
"b",
",",
"transpose_b",
"=",
"True",
")",
"output_part",
"=",
"smoothing_cross_entropy",
"(",
"logits",
",",
"labels",
"[",
"part",
"]",
",",
"vocab_size",
",",
"confidence",
")",
"a_grad_part",
",",
"b_grad_part",
"=",
"tf",
".",
"gradients",
"(",
"ys",
"=",
"[",
"output_part",
"]",
",",
"xs",
"=",
"[",
"a",
"[",
"part",
"]",
",",
"b",
"]",
",",
"grad_ys",
"=",
"[",
"dy",
"[",
"part",
"]",
"]",
")",
"a_grad_parts",
".",
"append",
"(",
"a_grad_part",
")",
"if",
"part",
">",
"0",
":",
"b_grad",
"+=",
"b_grad_part",
"else",
":",
"b_grad",
"=",
"b_grad_part",
"deps",
"=",
"[",
"b_grad",
",",
"a_grad_part",
"]",
"a_grad",
"=",
"tf",
".",
"concat",
"(",
"a_grad_parts",
",",
"0",
")",
"return",
"a_grad",
",",
"b_grad",
",",
"None",
",",
"None"
] |
Gradient function for smoothing_cross_entropy_factored.
|
[
"Gradient",
"function",
"for",
"smoothing_cross_entropy_factored",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2625-L2653
|
train
|
Gradient function for smoothing_cross_entropy_factored.
|
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,KOH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6CxlvR,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(52) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011 + 0o144) + chr(50) + '\x30' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(48) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101110 + 0o101) + chr(0b100001 + 0o20) + '\x35' + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x34' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + chr(0b110001) + chr(0b1100 + 0o53) + chr(0b1011 + 0o50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2275 - 2225) + '\067' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000000 + 0o57) + chr(0b110001) + chr(0b101000 + 0o11) + chr(357 - 302), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1100 + 0o46) + chr(1493 - 1441) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101101 + 0o4) + chr(2107 - 2057) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11100 + 0o123) + chr(0b10 + 0o61) + chr(0b110100) + chr(0b101000 + 0o17), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10 + 0o155) + chr(0b100001 + 0o22) + chr(94 - 40) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010 + 0o145) + '\064' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(0b110001) + chr(0b110111) + chr(1840 - 1789), 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(3530 - 3419) + chr(51) + chr(1750 - 1695), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(1122 - 1073) + '\061' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(468 - 420) + '\x6f' + '\067' + chr(0b10011 + 0o43), 52861 - 52853), ehT0Px3KOsy9('\060' + chr(0b110001 + 0o76) + '\x31' + chr(0b110110) + chr(2175 - 2124), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(0b1 + 0o61) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(2326 - 2275) + '\x31' + chr(49), 34830 - 34822), ehT0Px3KOsy9(chr(1520 - 1472) + chr(0b101110 + 0o101) + chr(0b110010) + '\x35' + chr(164 - 112), 52054 - 52046), ehT0Px3KOsy9(chr(728 - 680) + chr(111) + chr(0b10001 + 0o41) + chr(0b10011 + 0o36) + chr(0b110100), 4042 - 4034), ehT0Px3KOsy9('\060' + chr(5761 - 5650) + chr(1131 - 1082) + chr(48) + chr(0b101000 + 0o11), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b110101) + chr(49), 16526 - 16518), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010 + 0o2) + chr(0b110000), 37862 - 37854), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100110 + 0o15) + chr(2090 - 2036) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(734 - 685) + '\065' + '\x32', 796 - 788), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2385 - 2335) + chr(50) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(6235 - 6124) + chr(0b100011 + 0o17) + chr(0b110100) + chr(50), 46568 - 46560), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1010 + 0o47) + '\x37' + chr(0b11111 + 0o21), 0b1000), ehT0Px3KOsy9(chr(411 - 363) + '\157' + '\x31' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(52) + '\066', 38651 - 38643), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(50) + '\x30' + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(54) + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(246 - 197) + chr(0b110001) + chr(0b101110 + 0o7), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101101 + 0o2) + chr(1837 - 1786) + chr(1124 - 1075) + chr(0b110001 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\x34' + '\x32', 8), ehT0Px3KOsy9(chr(2178 - 2130) + chr(10116 - 10005) + chr(2055 - 2004) + chr(0b110 + 0o56) + chr(0b10001 + 0o44), 0o10), ehT0Px3KOsy9(chr(1512 - 1464) + chr(0b10000 + 0o137) + '\x32' + chr(0b110110) + '\x30', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(53) + chr(0b100010 + 0o16), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\n'), '\x64' + '\x65' + chr(99) + chr(111) + chr(0b1100100) + chr(101))('\165' + chr(3116 - 3000) + chr(102) + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def loS8oJFEX9LP(C8dAr6Ujq2Tn, Jz3111tD_9m4):
XPh1qbAgrPgG = C8dAr6Ujq2Tn.vXoupepMtCXU[ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x30', 25577 - 25569)]
wmN3dvez4qzC = C8dAr6Ujq2Tn.vXoupepMtCXU[ehT0Px3KOsy9(chr(1521 - 1473) + '\x6f' + '\061', 0o10)]
uXMK81tmdpTM = C8dAr6Ujq2Tn.vXoupepMtCXU[ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32', 59430 - 59422)]
IGc_qm7pp85x = C8dAr6Ujq2Tn.vXoupepMtCXU[ehT0Px3KOsy9('\060' + '\157' + chr(51), 0b1000)]
NbAbkov2L4m5 = ehT0Px3KOsy9(chr(1318 - 1270) + '\x6f' + '\x32' + chr(48), 46733 - 46725)
CeyMIoSyrpkQ = qypPRW8fq869(wmN3dvez4qzC)[ehT0Px3KOsy9('\x30' + chr(111) + '\x30', 8)]
uXMK81tmdpTM = OSY0RsHrOdKF(uXMK81tmdpTM, NbAbkov2L4m5)
XPh1qbAgrPgG = OSY0RsHrOdKF(XPh1qbAgrPgG, NbAbkov2L4m5)
Jz3111tD_9m4 = OSY0RsHrOdKF(Jz3111tD_9m4, NbAbkov2L4m5)
iQJlHExjRgj4 = None
iWwI8BGnHtYg = []
tiOm_0evs6u1 = []
for kZUV3FyMs20M in vQr8gNKaIaWE(NbAbkov2L4m5):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'G\xee\xee\x1fW\x14\xd3\x10\xc44\x97\x97M\x1fz&]\x1a\xb6\xba'), chr(0b110010 + 0o62) + chr(0b1100101) + '\x63' + chr(4486 - 4375) + chr(0b1001001 + 0o33) + chr(101))('\165' + chr(10379 - 10263) + '\x66' + chr(0b101101) + '\x38'))(tiOm_0evs6u1):
wF9nmvjsKjYM = IDJ2eXGCBCDu.matmul(XPh1qbAgrPgG[kZUV3FyMs20M], wmN3dvez4qzC, transpose_b=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49), 8))
LZJ_etZ8o7ij = ANQl8nDw9Rk9(wF9nmvjsKjYM, uXMK81tmdpTM[kZUV3FyMs20M], CeyMIoSyrpkQ, IGc_qm7pp85x)
(zvF_rL3R_Klt, rbGIPCnyLJhr) = IDJ2eXGCBCDu.gradients(ys=[LZJ_etZ8o7ij], xs=[XPh1qbAgrPgG[kZUV3FyMs20M], wmN3dvez4qzC], grad_ys=[Jz3111tD_9m4[kZUV3FyMs20M]])
xafqLlk3kkUe(iWwI8BGnHtYg, xafqLlk3kkUe(SXOLrMavuUCe(b'E\xf1\xf0\x0eK\x1f'), chr(3971 - 3871) + chr(0b1100101) + chr(0b111110 + 0o45) + chr(0b1001000 + 0o47) + chr(0b10101 + 0o117) + '\x65')(chr(117) + chr(0b100001 + 0o123) + chr(102) + chr(1742 - 1697) + '\070'))(zvF_rL3R_Klt)
if kZUV3FyMs20M > ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(3728 - 3617) + chr(1808 - 1760), 8):
iQJlHExjRgj4 += rbGIPCnyLJhr
else:
iQJlHExjRgj4 = rbGIPCnyLJhr
tiOm_0evs6u1 = [iQJlHExjRgj4, zvF_rL3R_Klt]
qozynNHDa7DY = IDJ2eXGCBCDu.concat(iWwI8BGnHtYg, ehT0Px3KOsy9(chr(1940 - 1892) + chr(0b1000 + 0o147) + '\060', 8))
return (qozynNHDa7DY, iQJlHExjRgj4, None, None)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
smoothing_cross_entropy_factored
|
def smoothing_cross_entropy_factored(a, b, labels, confidence):
"""Memory-efficient computation of smoothing cross-entropy.
Avoids realizing the entire logits matrix at once.
Args:
a: a Tensor with shape [batch, inner_dim]
b: a Tensor with shape [vocab_size, inner_dim]
labels: an integer Tensor with shape [batch]
confidence: a float
Returns:
A Tensor with shape [batch]
"""
num_splits = 16
vocab_size = shape_list(b)[0]
labels = approximate_split(labels, num_splits)
a = approximate_split(a, num_splits)
parts = []
for part in range(num_splits):
with tf.control_dependencies(parts[-1:]):
logits = tf.matmul(a[part], b, transpose_b=True)
parts.append(
smoothing_cross_entropy(logits, labels[part], vocab_size, confidence))
return tf.concat(parts, 0)
|
python
|
def smoothing_cross_entropy_factored(a, b, labels, confidence):
"""Memory-efficient computation of smoothing cross-entropy.
Avoids realizing the entire logits matrix at once.
Args:
a: a Tensor with shape [batch, inner_dim]
b: a Tensor with shape [vocab_size, inner_dim]
labels: an integer Tensor with shape [batch]
confidence: a float
Returns:
A Tensor with shape [batch]
"""
num_splits = 16
vocab_size = shape_list(b)[0]
labels = approximate_split(labels, num_splits)
a = approximate_split(a, num_splits)
parts = []
for part in range(num_splits):
with tf.control_dependencies(parts[-1:]):
logits = tf.matmul(a[part], b, transpose_b=True)
parts.append(
smoothing_cross_entropy(logits, labels[part], vocab_size, confidence))
return tf.concat(parts, 0)
|
[
"def",
"smoothing_cross_entropy_factored",
"(",
"a",
",",
"b",
",",
"labels",
",",
"confidence",
")",
":",
"num_splits",
"=",
"16",
"vocab_size",
"=",
"shape_list",
"(",
"b",
")",
"[",
"0",
"]",
"labels",
"=",
"approximate_split",
"(",
"labels",
",",
"num_splits",
")",
"a",
"=",
"approximate_split",
"(",
"a",
",",
"num_splits",
")",
"parts",
"=",
"[",
"]",
"for",
"part",
"in",
"range",
"(",
"num_splits",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"parts",
"[",
"-",
"1",
":",
"]",
")",
":",
"logits",
"=",
"tf",
".",
"matmul",
"(",
"a",
"[",
"part",
"]",
",",
"b",
",",
"transpose_b",
"=",
"True",
")",
"parts",
".",
"append",
"(",
"smoothing_cross_entropy",
"(",
"logits",
",",
"labels",
"[",
"part",
"]",
",",
"vocab_size",
",",
"confidence",
")",
")",
"return",
"tf",
".",
"concat",
"(",
"parts",
",",
"0",
")"
] |
Memory-efficient computation of smoothing cross-entropy.
Avoids realizing the entire logits matrix at once.
Args:
a: a Tensor with shape [batch, inner_dim]
b: a Tensor with shape [vocab_size, inner_dim]
labels: an integer Tensor with shape [batch]
confidence: a float
Returns:
A Tensor with shape [batch]
|
[
"Memory",
"-",
"efficient",
"computation",
"of",
"smoothing",
"cross",
"-",
"entropy",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2661-L2685
|
train
|
Memory - efficient computation of smoothing cross - entropy.
|
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('\x30' + chr(111) + chr(1235 - 1186) + '\061' + chr(0b110 + 0o52), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1343 - 1291), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1216 - 1167) + chr(1400 - 1347), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(1948 - 1837) + chr(0b110100) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\065' + chr(53), 41066 - 41058), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10110 + 0o35) + chr(1036 - 981) + chr(52), 2331 - 2323), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(517 - 468) + chr(53) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(740 - 691) + '\067' + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1000100 + 0o53) + chr(134 - 83) + '\062' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100011 + 0o14) + chr(942 - 892) + chr(1152 - 1097) + chr(0b101111 + 0o10), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(0b101001 + 0o11) + chr(1022 - 967) + chr(55), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110111 + 0o70) + chr(0b110101) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(7627 - 7516) + '\063' + chr(0b10101 + 0o35) + '\063', 49668 - 49660), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(0b100110 + 0o15) + '\060' + chr(0b110111), 44060 - 44052), ehT0Px3KOsy9('\060' + '\157' + chr(980 - 930) + chr(0b101001 + 0o13) + chr(0b101001 + 0o15), 57113 - 57105), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b1111 + 0o47) + chr(0b101111 + 0o6), 25465 - 25457), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(55) + chr(1169 - 1118), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b100111 + 0o110) + chr(49) + '\x36' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b111 + 0o52) + chr(48) + '\066', 26502 - 26494), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(1179 - 1126) + chr(992 - 942), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(76 - 21), 8), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(10417 - 10306) + '\x34' + chr(1948 - 1895), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(2379 - 2330) + chr(0b10100 + 0o35) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + chr(50) + chr(54) + chr(796 - 745), 24193 - 24185), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(823 - 712) + chr(0b101110 + 0o6) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1391 - 1342) + '\x30' + chr(0b110010), 25122 - 25114), ehT0Px3KOsy9(chr(158 - 110) + chr(111) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9494 - 9383) + chr(49) + chr(0b110000) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110100) + '\061', 8), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + '\063' + chr(0b110010) + '\063', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(805 - 754) + '\060' + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(8714 - 8603) + chr(50) + chr(0b0 + 0o66) + chr(2491 - 2438), 56948 - 56940), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(751 - 700), 17457 - 17449), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + '\061' + '\x34' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(0b100001 + 0o20) + chr(769 - 720) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101110 + 0o101) + '\x31' + chr(55) + chr(0b110101), 16610 - 16602), ehT0Px3KOsy9(chr(48) + chr(0b1010101 + 0o32) + chr(53) + chr(0b1001 + 0o53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(1799 - 1751) + '\x37', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(1819 - 1766) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'f'), chr(0b1100100) + '\145' + chr(0b101011 + 0o70) + '\x6f' + chr(0b10110 + 0o116) + chr(0b1100101))(chr(5155 - 5038) + chr(0b1110100) + '\146' + '\x2d' + chr(2097 - 2041)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Uww_gAFg9N5t(XPh1qbAgrPgG, wmN3dvez4qzC, uXMK81tmdpTM, IGc_qm7pp85x):
NbAbkov2L4m5 = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1521 - 1471) + '\060', 8)
CeyMIoSyrpkQ = qypPRW8fq869(wmN3dvez4qzC)[ehT0Px3KOsy9(chr(48) + chr(111) + '\060', 0o10)]
uXMK81tmdpTM = OSY0RsHrOdKF(uXMK81tmdpTM, NbAbkov2L4m5)
XPh1qbAgrPgG = OSY0RsHrOdKF(XPh1qbAgrPgG, NbAbkov2L4m5)
gIfWK5W_pmM4 = []
for kZUV3FyMs20M in vQr8gNKaIaWE(NbAbkov2L4m5):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'+kcU\x9f\x93\x06$\xb4\xdaw\xdaC\xb7\xa2\xc8\x96\x92\x105'), chr(100) + chr(0b1100101) + '\143' + chr(0b1101111) + chr(100) + chr(0b110011 + 0o62))(chr(13043 - 12926) + chr(116) + '\x66' + chr(0b101101) + chr(0b1 + 0o67)))(gIfWK5W_pmM4[-ehT0Px3KOsy9(chr(2179 - 2131) + chr(111) + chr(0b110001 + 0o0), ord("\x08")):]):
wF9nmvjsKjYM = IDJ2eXGCBCDu.matmul(XPh1qbAgrPgG[kZUV3FyMs20M], wmN3dvez4qzC, transpose_b=ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + '\061', 8))
xafqLlk3kkUe(gIfWK5W_pmM4, xafqLlk3kkUe(SXOLrMavuUCe(b')t}D\x83\x98'), chr(0b1001111 + 0o25) + '\x65' + chr(6731 - 6632) + chr(0b1101111) + chr(0b1100100) + '\145')('\x75' + chr(0b1110100) + chr(5591 - 5489) + chr(45) + chr(0b11101 + 0o33)))(ANQl8nDw9Rk9(wF9nmvjsKjYM, uXMK81tmdpTM[kZUV3FyMs20M], CeyMIoSyrpkQ, IGc_qm7pp85x))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'+kcB\x8c\x88'), '\144' + chr(0b1000000 + 0o45) + '\143' + chr(0b1101111) + '\x64' + chr(0b110101 + 0o60))(chr(0b1010001 + 0o44) + '\164' + chr(8896 - 8794) + '\x2d' + chr(121 - 65)))(gIfWK5W_pmM4, ehT0Px3KOsy9('\x30' + chr(0b100001 + 0o116) + chr(0b110000), 8))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
padded_cross_entropy_factored
|
def padded_cross_entropy_factored(factored_logits,
labels,
label_smoothing,
weights_fn=weights_nonzero,
reduce_sum=True):
"""Memory-efficient computation of smoothing cross-entropy.
Avoids realizing the entire logits matrix at once.
Args:
factored_logits: a `FactoredTensor` representing a Tensor
with shape `[batch, timesteps, vocab_size]`.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
"""
a = factored_logits.a
b = factored_logits.b
confidence = 1.0 - label_smoothing
with tf.name_scope("padded_cross_entropy_factored", values=[a, b, labels]):
labels_flat = tf.reshape(labels, [-1])
a_flat = tf.reshape(a, [-1, shape_list(b)[1]])
xent = smoothing_cross_entropy_factored(a_flat, b, labels_flat,
tf.convert_to_tensor(confidence))
xent = tf.reshape(xent, shape_list(labels))
weights = weights_fn(labels)
if not reduce_sum:
return xent * weights, weights
return tf.reduce_sum(xent * weights), tf.reduce_sum(weights)
|
python
|
def padded_cross_entropy_factored(factored_logits,
labels,
label_smoothing,
weights_fn=weights_nonzero,
reduce_sum=True):
"""Memory-efficient computation of smoothing cross-entropy.
Avoids realizing the entire logits matrix at once.
Args:
factored_logits: a `FactoredTensor` representing a Tensor
with shape `[batch, timesteps, vocab_size]`.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
"""
a = factored_logits.a
b = factored_logits.b
confidence = 1.0 - label_smoothing
with tf.name_scope("padded_cross_entropy_factored", values=[a, b, labels]):
labels_flat = tf.reshape(labels, [-1])
a_flat = tf.reshape(a, [-1, shape_list(b)[1]])
xent = smoothing_cross_entropy_factored(a_flat, b, labels_flat,
tf.convert_to_tensor(confidence))
xent = tf.reshape(xent, shape_list(labels))
weights = weights_fn(labels)
if not reduce_sum:
return xent * weights, weights
return tf.reduce_sum(xent * weights), tf.reduce_sum(weights)
|
[
"def",
"padded_cross_entropy_factored",
"(",
"factored_logits",
",",
"labels",
",",
"label_smoothing",
",",
"weights_fn",
"=",
"weights_nonzero",
",",
"reduce_sum",
"=",
"True",
")",
":",
"a",
"=",
"factored_logits",
".",
"a",
"b",
"=",
"factored_logits",
".",
"b",
"confidence",
"=",
"1.0",
"-",
"label_smoothing",
"with",
"tf",
".",
"name_scope",
"(",
"\"padded_cross_entropy_factored\"",
",",
"values",
"=",
"[",
"a",
",",
"b",
",",
"labels",
"]",
")",
":",
"labels_flat",
"=",
"tf",
".",
"reshape",
"(",
"labels",
",",
"[",
"-",
"1",
"]",
")",
"a_flat",
"=",
"tf",
".",
"reshape",
"(",
"a",
",",
"[",
"-",
"1",
",",
"shape_list",
"(",
"b",
")",
"[",
"1",
"]",
"]",
")",
"xent",
"=",
"smoothing_cross_entropy_factored",
"(",
"a_flat",
",",
"b",
",",
"labels_flat",
",",
"tf",
".",
"convert_to_tensor",
"(",
"confidence",
")",
")",
"xent",
"=",
"tf",
".",
"reshape",
"(",
"xent",
",",
"shape_list",
"(",
"labels",
")",
")",
"weights",
"=",
"weights_fn",
"(",
"labels",
")",
"if",
"not",
"reduce_sum",
":",
"return",
"xent",
"*",
"weights",
",",
"weights",
"return",
"tf",
".",
"reduce_sum",
"(",
"xent",
"*",
"weights",
")",
",",
"tf",
".",
"reduce_sum",
"(",
"weights",
")"
] |
Memory-efficient computation of smoothing cross-entropy.
Avoids realizing the entire logits matrix at once.
Args:
factored_logits: a `FactoredTensor` representing a Tensor
with shape `[batch, timesteps, vocab_size]`.
labels: an integer `Tensor` with shape `[batch, timesteps]`.
label_smoothing: a floating point `Scalar`.
weights_fn: A function from labels to weights.
reduce_sum: a Boolean, whether to sum at the end or not.
Returns:
loss_numerator: a `Scalar`. Sum of losses.
loss_denominator: a `Scalar. The number of non-padding target tokens.
|
[
"Memory",
"-",
"efficient",
"computation",
"of",
"smoothing",
"cross",
"-",
"entropy",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2688-L2721
|
train
|
Memory - efficient computation of smoothing cross - entropy.
|
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,SBRjvO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Ma,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(0b11010 + 0o26) + chr(111) + chr(51) + chr(228 - 178) + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(0b11111 + 0o120) + chr(2358 - 2307) + chr(54) + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(50) + '\063' + '\065', 58537 - 58529), ehT0Px3KOsy9('\x30' + chr(0b1101111 + 0o0) + '\061' + chr(0b110111) + '\x32', 63029 - 63021), ehT0Px3KOsy9(chr(1950 - 1902) + chr(0b110100 + 0o73) + '\x31' + chr(53) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010111 + 0o30) + chr(50) + chr(0b110101) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(1158 - 1103) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11770 - 11659) + '\061' + '\060' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(54) + chr(0b110101), 59269 - 59261), ehT0Px3KOsy9('\060' + '\157' + chr(1825 - 1773) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(556 - 507) + chr(0b110010 + 0o1), 13042 - 13034), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + '\x32' + chr(52) + '\x30', 45002 - 44994), ehT0Px3KOsy9(chr(1859 - 1811) + chr(0b1101111) + chr(49) + chr(1059 - 1007) + '\067', 0b1000), ehT0Px3KOsy9(chr(1605 - 1557) + chr(111) + '\063' + '\061' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(49) + chr(1149 - 1098), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + '\x34' + chr(504 - 453), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b0 + 0o62) + '\062', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(0b110110) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11110 + 0o121) + '\x30', 0b1000), ehT0Px3KOsy9(chr(83 - 35) + '\x6f' + chr(50) + '\066' + '\x37', 14094 - 14086), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(49) + chr(1985 - 1933) + chr(0b11011 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(50) + '\x32' + chr(0b110110), 36440 - 36432), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110001) + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(8763 - 8652) + chr(0b100111 + 0o14) + chr(917 - 866) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1276 - 1228) + chr(0b1101101 + 0o2) + chr(0b100100 + 0o21) + chr(0b10001 + 0o41), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1733 - 1683), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + '\061' + chr(1419 - 1365), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x35' + chr(0b110000), 53 - 45), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100101 + 0o16) + chr(2307 - 2254) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110101) + chr(0b111 + 0o54), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1100100 + 0o13) + '\063' + '\x34' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(2085 - 2036) + '\x36' + chr(795 - 741), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(793 - 742) + chr(806 - 751) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x36' + chr(53), 8), ehT0Px3KOsy9(chr(491 - 443) + '\157' + chr(51) + chr(0b101 + 0o62), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1000011 + 0o54) + '\062' + chr(52), 54940 - 54932), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(1847 - 1797) + '\061' + '\x30', 55499 - 55491), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b11001 + 0o126) + chr(1964 - 1914) + chr(52) + chr(0b110110), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + chr(0b110000 + 0o0), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa'), chr(100) + '\x65' + chr(666 - 567) + '\x6f' + '\x64' + chr(101))(chr(0b1110101) + chr(0b111110 + 0o66) + chr(102) + chr(0b101101) + chr(656 - 600)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def BnIgkWeQqzsZ(Sjw4kbDQvNmN, uXMK81tmdpTM, FSjUgdaczzRk, Pdbc6Q2jZ4RQ=aMdemxOfy8Ik, O3yRJHXcfeTa=ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), 44150 - 44142)):
XPh1qbAgrPgG = Sjw4kbDQvNmN.a
wmN3dvez4qzC = Sjw4kbDQvNmN.b
IGc_qm7pp85x = 1.0 - FSjUgdaczzRk
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xba\x97\xf0\x1f7\xdeQ\xd0g&'), chr(100) + '\x65' + chr(99) + '\157' + chr(100) + chr(0b1100101))(chr(117) + '\x74' + '\x66' + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4\x97\xf9\x1e\r\xc9m\xdce,FRT\xc5\t\xbd\xf9\xcc\xe2\t_\xd1\x07\xf5\xbd\xb0Xgj'), chr(0b100100 + 0o100) + '\145' + '\x63' + chr(111) + chr(100) + '\x65')(chr(117) + chr(0b0 + 0o164) + chr(0b1100110) + chr(197 - 152) + '\070'), values=[XPh1qbAgrPgG, wmN3dvez4qzC, uXMK81tmdpTM]):
nbAWhxHturO4 = IDJ2eXGCBCDu.reshape(uXMK81tmdpTM, [-ehT0Px3KOsy9('\060' + chr(0b101011 + 0o104) + '\x31', 8)])
SH6d_Dq89E3G = IDJ2eXGCBCDu.reshape(XPh1qbAgrPgG, [-ehT0Px3KOsy9('\060' + chr(111) + '\061', 8), qypPRW8fq869(wmN3dvez4qzC)[ehT0Px3KOsy9(chr(48) + chr(7366 - 7255) + chr(0b11110 + 0o23), 8)]])
_YHpmhjj_eGR = Uww_gAFg9N5t(SH6d_Dq89E3G, wmN3dvez4qzC, nbAWhxHturO4, IDJ2eXGCBCDu.convert_to_tensor(IGc_qm7pp85x))
_YHpmhjj_eGR = IDJ2eXGCBCDu.reshape(_YHpmhjj_eGR, qypPRW8fq869(uXMK81tmdpTM))
ZurHTci57aXw = Pdbc6Q2jZ4RQ(uXMK81tmdpTM)
if not O3yRJHXcfeTa:
return (_YHpmhjj_eGR * ZurHTci57aXw, ZurHTci57aXw)
return (xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6\x93\xf9\x0f\x0b\xc8m\xccb.'), chr(100) + '\x65' + chr(0b1000001 + 0o42) + chr(8095 - 7984) + chr(0b1100100) + chr(101))(chr(0b1111 + 0o146) + chr(116) + chr(6190 - 6088) + '\x2d' + chr(56)))(_YHpmhjj_eGR * ZurHTci57aXw), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6\x93\xf9\x0f\x0b\xc8m\xccb.'), chr(0b1011110 + 0o6) + chr(0b1001101 + 0o30) + chr(4649 - 4550) + '\157' + '\144' + chr(101))('\165' + '\x74' + chr(1591 - 1489) + chr(0b10011 + 0o32) + chr(0b101 + 0o63)))(ZurHTci57aXw))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
fn_with_custom_grad
|
def fn_with_custom_grad(grad_fn, use_global_vars=False):
"""Decorator to create a subgraph with a custom gradient function.
The subgraph created by the decorated function is NOT put in a Defun and so
does not suffer from the limitations of the Defun (all subgraph ops on the
same device, no summaries).
Args:
grad_fn: function with signature
(inputs, variables, outputs, output_grads) -> (grad_inputs, grad_vars),
all of which are lists of Tensors.
use_global_vars: if True, variables will be the global variables created.
If False, will be the trainable variables.
Returns:
Decorator for function such that the gradient is defined by grad_fn.
"""
def dec(fn):
@functools.wraps(fn)
def wrapped(*args):
return _fn_with_custom_grad(
fn, args, grad_fn, use_global_vars=use_global_vars)
return wrapped
return dec
|
python
|
def fn_with_custom_grad(grad_fn, use_global_vars=False):
"""Decorator to create a subgraph with a custom gradient function.
The subgraph created by the decorated function is NOT put in a Defun and so
does not suffer from the limitations of the Defun (all subgraph ops on the
same device, no summaries).
Args:
grad_fn: function with signature
(inputs, variables, outputs, output_grads) -> (grad_inputs, grad_vars),
all of which are lists of Tensors.
use_global_vars: if True, variables will be the global variables created.
If False, will be the trainable variables.
Returns:
Decorator for function such that the gradient is defined by grad_fn.
"""
def dec(fn):
@functools.wraps(fn)
def wrapped(*args):
return _fn_with_custom_grad(
fn, args, grad_fn, use_global_vars=use_global_vars)
return wrapped
return dec
|
[
"def",
"fn_with_custom_grad",
"(",
"grad_fn",
",",
"use_global_vars",
"=",
"False",
")",
":",
"def",
"dec",
"(",
"fn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"wrapped",
"(",
"*",
"args",
")",
":",
"return",
"_fn_with_custom_grad",
"(",
"fn",
",",
"args",
",",
"grad_fn",
",",
"use_global_vars",
"=",
"use_global_vars",
")",
"return",
"wrapped",
"return",
"dec"
] |
Decorator to create a subgraph with a custom gradient function.
The subgraph created by the decorated function is NOT put in a Defun and so
does not suffer from the limitations of the Defun (all subgraph ops on the
same device, no summaries).
Args:
grad_fn: function with signature
(inputs, variables, outputs, output_grads) -> (grad_inputs, grad_vars),
all of which are lists of Tensors.
use_global_vars: if True, variables will be the global variables created.
If False, will be the trainable variables.
Returns:
Decorator for function such that the gradient is defined by grad_fn.
|
[
"Decorator",
"to",
"create",
"a",
"subgraph",
"with",
"a",
"custom",
"gradient",
"function",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2724-L2751
|
train
|
Decorator to create a subgraph with a custom gradient 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,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5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zQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b10101 + 0o34) + chr(52), 36791 - 36783), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10110 + 0o36) + '\x32', 0o10), ehT0Px3KOsy9(chr(757 - 709) + '\157' + chr(50) + chr(0b11001 + 0o35) + '\061', 0o10), ehT0Px3KOsy9(chr(512 - 464) + chr(111) + '\x31' + '\064' + '\060', 9919 - 9911), ehT0Px3KOsy9(chr(1601 - 1553) + chr(111) + chr(0b110100) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(2273 - 2225), 31157 - 31149), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + '\061' + chr(52), 5127 - 5119), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + chr(0b100010 + 0o20) + chr(0b110000) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100100 + 0o13) + '\062' + chr(0b110111) + chr(0b100101 + 0o20), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(51) + chr(0b110110) + chr(0b101111 + 0o3), 0o10), ehT0Px3KOsy9(chr(1366 - 1318) + chr(10928 - 10817) + chr(1019 - 968) + '\063' + chr(0b110010), 64068 - 64060), ehT0Px3KOsy9(chr(1922 - 1874) + '\x6f' + chr(50) + chr(0b110010) + chr(2688 - 2633), 0o10), ehT0Px3KOsy9(chr(1178 - 1130) + chr(0b1101111) + '\061' + chr(0b10 + 0o60) + chr(2563 - 2512), 26487 - 26479), ehT0Px3KOsy9('\x30' + '\157' + chr(1115 - 1064) + '\065' + chr(49), 0o10), ehT0Px3KOsy9(chr(1075 - 1027) + chr(111) + chr(1119 - 1070) + '\064', 25958 - 25950), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b110001) + chr(0b100111 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(107 - 59) + '\157' + chr(0b110010) + chr(1472 - 1422) + '\x31', 0o10), ehT0Px3KOsy9(chr(270 - 222) + chr(0b1010111 + 0o30) + chr(0b101000 + 0o10), 8), ehT0Px3KOsy9('\x30' + chr(5439 - 5328) + chr(1684 - 1635) + '\061' + chr(2435 - 2385), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6691 - 6580) + '\063' + chr(0b110110) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110 + 0o151) + chr(1843 - 1792) + chr(0b110000) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + chr(1418 - 1369) + chr(0b110010) + '\063', 8), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + chr(51) + '\x36' + chr(0b1010 + 0o51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7578 - 7467) + chr(49) + '\x37' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(356 - 308) + chr(0b1100100 + 0o13) + chr(0b110011) + '\x34' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(4336 - 4225) + '\063' + chr(0b110001 + 0o2) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b101011 + 0o104) + chr(50) + '\064' + chr(0b11011 + 0o25), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101101 + 0o10) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x36' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(52) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b110001) + '\062' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + '\062' + chr(0b10000 + 0o47), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110001) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1974 - 1923) + chr(0b110110) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + '\066' + chr(53 - 1), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(617 - 566) + chr(2627 - 2572) + chr(0b110110), 7524 - 7516), ehT0Px3KOsy9(chr(0b110000) + chr(7427 - 7316) + chr(1335 - 1286) + chr(1580 - 1525) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + chr(0b110010) + '\062' + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\062' + '\065' + chr(50), 56162 - 56154), ehT0Px3KOsy9(chr(273 - 225) + chr(0b1101111) + chr(1153 - 1102) + '\x32' + '\060', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + chr(0b1 + 0o64) + chr(1775 - 1727), 11702 - 11694)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'b'), chr(8485 - 8385) + chr(651 - 550) + chr(99) + chr(0b1101111) + chr(100) + chr(101))('\165' + chr(3936 - 3820) + chr(0b1100110) + chr(490 - 445) + chr(2305 - 2249)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Goed01Eusnl4(mOK0n0L9FPZ0, oOX_6NbHc_6S=ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110000), 8)):
def lYfuR8oSO7rp(wDsB9Ho570J9):
@xafqLlk3kkUe(E6ula8_Zv1yl, xafqLlk3kkUe(SXOLrMavuUCe(b'/w\xfe\x01nZ\xea\xde\x8f\xba\xb5\xa6'), '\x64' + chr(2934 - 2833) + chr(5234 - 5135) + chr(0b1101111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(0b1000010 + 0o62) + chr(6173 - 6071) + '\x2d' + chr(0b111000)))(wDsB9Ho570J9)
def BoeK7hZPPy4I(*kJDRfRhcZHjS):
return _52W_AP2o6zD(wDsB9Ho570J9, kJDRfRhcZHjS, mOK0n0L9FPZ0, use_global_vars=oOX_6NbHc_6S)
return BoeK7hZPPy4I
return lYfuR8oSO7rp
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
_fn_with_custom_grad
|
def _fn_with_custom_grad(fn, inputs, grad_fn, use_global_vars=False):
"""Create a subgraph with a custom gradient.
Args:
fn: function that takes inputs as arguments and produces 1 or more Tensors.
inputs: list<Tensor>, will be passed as fn(*inputs).
grad_fn: function with signature
(inputs, vars, outputs, output_grads) -> (grad_inputs, grad_vars),
all of which are lists of Tensors.
use_global_vars: if True, variables will be the global variables created.
If False, will be the trainable variables.
Returns:
fn(*inputs)
"""
vs = tf.get_variable_scope()
get_vars_fn = (
vs.global_variables if use_global_vars else vs.trainable_variables)
len_before_vars = len(get_vars_fn())
inputs = list(inputs)
outputs = fn(*inputs)
train_vars = get_vars_fn()[len_before_vars:]
if grad_fn is None:
return outputs
if not isinstance(outputs, (tuple, list)):
outputs = [outputs]
outputs = list(outputs)
defun_inputs = [inputs, train_vars, outputs]
def custom_grad_fn(op, *dys):
"""Custom grad fn applying grad_fn for identity Defun."""
fn_inputs, fn_vars, fn_outputs = tf.contrib.framework.nest.pack_sequence_as(
defun_inputs, list(op.inputs))
dys = list(dys)
assert len(fn_outputs) == len(outputs)
assert len(fn_outputs) == len(dys)
grad_inputs, grad_vars = grad_fn(fn_inputs, fn_vars, fn_outputs, dys)
grad_outputs = [None] * len(fn_outputs)
return tuple(grad_inputs + grad_vars + grad_outputs)
# The Defun takes as input the original inputs, the trainable variables
# created in fn, and the outputs. In the forward it passes through the
# outputs. In the backwards, it produces gradients for the original inputs
# and the trainable variables.
in_types = [t.dtype for t in inputs]
out_types = [t.dtype for t in outputs]
var_types = [t.dtype for t in train_vars]
@function.Defun(
*(in_types + var_types + out_types),
func_name="identity_custom_grad%d" % ops.uid(),
python_grad_func=custom_grad_fn,
shape_func=lambda _: [t.get_shape() for t in outputs])
def identity(*args):
_, _, outs = tf.contrib.framework.nest.pack_sequence_as(defun_inputs, args)
return tuple([tf.identity(t) for t in outs])
flat_inputs = tf.contrib.framework.nest.flatten(defun_inputs)
id_out = identity(*flat_inputs)
return id_out
|
python
|
def _fn_with_custom_grad(fn, inputs, grad_fn, use_global_vars=False):
"""Create a subgraph with a custom gradient.
Args:
fn: function that takes inputs as arguments and produces 1 or more Tensors.
inputs: list<Tensor>, will be passed as fn(*inputs).
grad_fn: function with signature
(inputs, vars, outputs, output_grads) -> (grad_inputs, grad_vars),
all of which are lists of Tensors.
use_global_vars: if True, variables will be the global variables created.
If False, will be the trainable variables.
Returns:
fn(*inputs)
"""
vs = tf.get_variable_scope()
get_vars_fn = (
vs.global_variables if use_global_vars else vs.trainable_variables)
len_before_vars = len(get_vars_fn())
inputs = list(inputs)
outputs = fn(*inputs)
train_vars = get_vars_fn()[len_before_vars:]
if grad_fn is None:
return outputs
if not isinstance(outputs, (tuple, list)):
outputs = [outputs]
outputs = list(outputs)
defun_inputs = [inputs, train_vars, outputs]
def custom_grad_fn(op, *dys):
"""Custom grad fn applying grad_fn for identity Defun."""
fn_inputs, fn_vars, fn_outputs = tf.contrib.framework.nest.pack_sequence_as(
defun_inputs, list(op.inputs))
dys = list(dys)
assert len(fn_outputs) == len(outputs)
assert len(fn_outputs) == len(dys)
grad_inputs, grad_vars = grad_fn(fn_inputs, fn_vars, fn_outputs, dys)
grad_outputs = [None] * len(fn_outputs)
return tuple(grad_inputs + grad_vars + grad_outputs)
# The Defun takes as input the original inputs, the trainable variables
# created in fn, and the outputs. In the forward it passes through the
# outputs. In the backwards, it produces gradients for the original inputs
# and the trainable variables.
in_types = [t.dtype for t in inputs]
out_types = [t.dtype for t in outputs]
var_types = [t.dtype for t in train_vars]
@function.Defun(
*(in_types + var_types + out_types),
func_name="identity_custom_grad%d" % ops.uid(),
python_grad_func=custom_grad_fn,
shape_func=lambda _: [t.get_shape() for t in outputs])
def identity(*args):
_, _, outs = tf.contrib.framework.nest.pack_sequence_as(defun_inputs, args)
return tuple([tf.identity(t) for t in outs])
flat_inputs = tf.contrib.framework.nest.flatten(defun_inputs)
id_out = identity(*flat_inputs)
return id_out
|
[
"def",
"_fn_with_custom_grad",
"(",
"fn",
",",
"inputs",
",",
"grad_fn",
",",
"use_global_vars",
"=",
"False",
")",
":",
"vs",
"=",
"tf",
".",
"get_variable_scope",
"(",
")",
"get_vars_fn",
"=",
"(",
"vs",
".",
"global_variables",
"if",
"use_global_vars",
"else",
"vs",
".",
"trainable_variables",
")",
"len_before_vars",
"=",
"len",
"(",
"get_vars_fn",
"(",
")",
")",
"inputs",
"=",
"list",
"(",
"inputs",
")",
"outputs",
"=",
"fn",
"(",
"*",
"inputs",
")",
"train_vars",
"=",
"get_vars_fn",
"(",
")",
"[",
"len_before_vars",
":",
"]",
"if",
"grad_fn",
"is",
"None",
":",
"return",
"outputs",
"if",
"not",
"isinstance",
"(",
"outputs",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"outputs",
"=",
"[",
"outputs",
"]",
"outputs",
"=",
"list",
"(",
"outputs",
")",
"defun_inputs",
"=",
"[",
"inputs",
",",
"train_vars",
",",
"outputs",
"]",
"def",
"custom_grad_fn",
"(",
"op",
",",
"*",
"dys",
")",
":",
"\"\"\"Custom grad fn applying grad_fn for identity Defun.\"\"\"",
"fn_inputs",
",",
"fn_vars",
",",
"fn_outputs",
"=",
"tf",
".",
"contrib",
".",
"framework",
".",
"nest",
".",
"pack_sequence_as",
"(",
"defun_inputs",
",",
"list",
"(",
"op",
".",
"inputs",
")",
")",
"dys",
"=",
"list",
"(",
"dys",
")",
"assert",
"len",
"(",
"fn_outputs",
")",
"==",
"len",
"(",
"outputs",
")",
"assert",
"len",
"(",
"fn_outputs",
")",
"==",
"len",
"(",
"dys",
")",
"grad_inputs",
",",
"grad_vars",
"=",
"grad_fn",
"(",
"fn_inputs",
",",
"fn_vars",
",",
"fn_outputs",
",",
"dys",
")",
"grad_outputs",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"fn_outputs",
")",
"return",
"tuple",
"(",
"grad_inputs",
"+",
"grad_vars",
"+",
"grad_outputs",
")",
"# The Defun takes as input the original inputs, the trainable variables",
"# created in fn, and the outputs. In the forward it passes through the",
"# outputs. In the backwards, it produces gradients for the original inputs",
"# and the trainable variables.",
"in_types",
"=",
"[",
"t",
".",
"dtype",
"for",
"t",
"in",
"inputs",
"]",
"out_types",
"=",
"[",
"t",
".",
"dtype",
"for",
"t",
"in",
"outputs",
"]",
"var_types",
"=",
"[",
"t",
".",
"dtype",
"for",
"t",
"in",
"train_vars",
"]",
"@",
"function",
".",
"Defun",
"(",
"*",
"(",
"in_types",
"+",
"var_types",
"+",
"out_types",
")",
",",
"func_name",
"=",
"\"identity_custom_grad%d\"",
"%",
"ops",
".",
"uid",
"(",
")",
",",
"python_grad_func",
"=",
"custom_grad_fn",
",",
"shape_func",
"=",
"lambda",
"_",
":",
"[",
"t",
".",
"get_shape",
"(",
")",
"for",
"t",
"in",
"outputs",
"]",
")",
"def",
"identity",
"(",
"*",
"args",
")",
":",
"_",
",",
"_",
",",
"outs",
"=",
"tf",
".",
"contrib",
".",
"framework",
".",
"nest",
".",
"pack_sequence_as",
"(",
"defun_inputs",
",",
"args",
")",
"return",
"tuple",
"(",
"[",
"tf",
".",
"identity",
"(",
"t",
")",
"for",
"t",
"in",
"outs",
"]",
")",
"flat_inputs",
"=",
"tf",
".",
"contrib",
".",
"framework",
".",
"nest",
".",
"flatten",
"(",
"defun_inputs",
")",
"id_out",
"=",
"identity",
"(",
"*",
"flat_inputs",
")",
"return",
"id_out"
] |
Create a subgraph with a custom gradient.
Args:
fn: function that takes inputs as arguments and produces 1 or more Tensors.
inputs: list<Tensor>, will be passed as fn(*inputs).
grad_fn: function with signature
(inputs, vars, outputs, output_grads) -> (grad_inputs, grad_vars),
all of which are lists of Tensors.
use_global_vars: if True, variables will be the global variables created.
If False, will be the trainable variables.
Returns:
fn(*inputs)
|
[
"Create",
"a",
"subgraph",
"with",
"a",
"custom",
"gradient",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2754-L2817
|
train
|
Create a subgraph with a custom gradient.
|
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,Rou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SoAwYhj,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(0b1010 + 0o47) + chr(0b110010) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(4920 - 4809) + chr(1316 - 1266) + '\x30' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1049 - 1000) + '\065' + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(1859 - 1748) + chr(1712 - 1663) + chr(0b110101) + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(0b100100 + 0o16) + chr(925 - 872) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(65 - 16) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + chr(51) + '\066' + chr(2578 - 2525), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2082 - 2031) + chr(54) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(0b110001) + chr(2300 - 2245) + chr(1726 - 1677), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + chr(0b110 + 0o57), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + chr(0b11101 + 0o26) + '\060' + chr(53), 44300 - 44292), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(11221 - 11110) + chr(50) + chr(1019 - 966), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9017 - 8906) + chr(0b10011 + 0o36) + '\x34' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4505 - 4394) + chr(0b110100) + chr(0b100111 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + chr(50) + chr(0b110110 + 0o1) + chr(244 - 192), ord("\x08")), ehT0Px3KOsy9(chr(1361 - 1313) + chr(111) + chr(0b101010 + 0o10) + '\065' + chr(454 - 401), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + '\x33' + '\x36' + chr(885 - 831), 8), ehT0Px3KOsy9('\x30' + chr(4095 - 3984) + chr(0b110100) + '\060', 19499 - 19491), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(472 - 420) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(0b11101 + 0o26) + chr(0b1010 + 0o54) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b1 + 0o61) + chr(73 - 21), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100 + 0o54), 8337 - 8329), ehT0Px3KOsy9('\060' + '\157' + chr(0b110111) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b101101 + 0o102) + chr(0b10110 + 0o34) + chr(0b110011) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + chr(2131 - 2082) + '\062' + chr(2454 - 2403), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(3989 - 3878) + chr(1062 - 1012) + chr(0b11111 + 0o25) + chr(1213 - 1163), 30080 - 30072), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1461 - 1407) + chr(0b100100 + 0o21), 0b1000), ehT0Px3KOsy9(chr(112 - 64) + chr(111) + chr(50) + '\060' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1394 - 1346) + chr(0b1000000 + 0o57) + '\x32' + chr(2450 - 2395) + chr(607 - 558), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\060' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(419 - 364) + chr(0b1100 + 0o47), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(1872 - 1823), ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(487 - 376) + '\061' + chr(2002 - 1954), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(50) + chr(477 - 423), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(1306 - 1258) + '\157' + chr(0b110011) + chr(217 - 165) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + chr(49) + '\063' + chr(48), 0o10), ehT0Px3KOsy9(chr(1099 - 1051) + '\157' + chr(1576 - 1527) + chr(0b110101) + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10100 + 0o35) + chr(2569 - 2516) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1786 - 1738) + chr(4687 - 4576) + '\063' + '\x34' + chr(53), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + '\065' + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'z'), '\x64' + '\x65' + chr(9634 - 9535) + chr(0b1101111) + '\x64' + chr(101))(chr(0b11100 + 0o131) + chr(0b1110100) + chr(102) + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def _52W_AP2o6zD(wDsB9Ho570J9, vXoupepMtCXU, mOK0n0L9FPZ0, oOX_6NbHc_6S=ehT0Px3KOsy9('\060' + '\157' + chr(0b110000), 8)):
qGaVI8v_Oz7A = IDJ2eXGCBCDu.get_variable_scope()
oPb6i0CeXm_d = qGaVI8v_Oz7A.global_variables if oOX_6NbHc_6S else qGaVI8v_Oz7A.trainable_variables
hj4oeVX5nggz = c2A0yzQpDQB3(oPb6i0CeXm_d())
vXoupepMtCXU = YyaZ4tpXu4lf(vXoupepMtCXU)
Dx_DllZ8uCko = wDsB9Ho570J9(*vXoupepMtCXU)
ZgpvgqZTqQh4 = oPb6i0CeXm_d()[hj4oeVX5nggz:]
if mOK0n0L9FPZ0 is None:
return Dx_DllZ8uCko
if not PlSM16l2KDPD(Dx_DllZ8uCko, (KNyTy8rYcwji, YyaZ4tpXu4lf)):
Dx_DllZ8uCko = [Dx_DllZ8uCko]
Dx_DllZ8uCko = YyaZ4tpXu4lf(Dx_DllZ8uCko)
yl829eKkqG8M = [vXoupepMtCXU, ZgpvgqZTqQh4, Dx_DllZ8uCko]
def BxB6gVmaxkyr(C8dAr6Ujq2Tn, *yIYaXZU2hEO8):
(hohtbsurMMGf, EBDY_7ELl7Jb, x_oFYuBkAcV_) = IDJ2eXGCBCDu.contrib.framework.nest.pack_sequence_as(yl829eKkqG8M, YyaZ4tpXu4lf(C8dAr6Ujq2Tn.vXoupepMtCXU))
yIYaXZU2hEO8 = YyaZ4tpXu4lf(yIYaXZU2hEO8)
assert c2A0yzQpDQB3(x_oFYuBkAcV_) == c2A0yzQpDQB3(Dx_DllZ8uCko)
assert c2A0yzQpDQB3(x_oFYuBkAcV_) == c2A0yzQpDQB3(yIYaXZU2hEO8)
(yuSXpDt_ejO4, VHg_4JGTyJv5) = mOK0n0L9FPZ0(hohtbsurMMGf, EBDY_7ELl7Jb, x_oFYuBkAcV_, yIYaXZU2hEO8)
MEhZULtFGl5p = [None] * c2A0yzQpDQB3(x_oFYuBkAcV_)
return KNyTy8rYcwji(yuSXpDt_ejO4 + VHg_4JGTyJv5 + MEhZULtFGl5p)
sZjg4O4EqXeB = [YeT3l7JgTbWR.jSV9IKnemH7K for YeT3l7JgTbWR in vXoupepMtCXU]
K6gLLxL4cxTY = [YeT3l7JgTbWR.jSV9IKnemH7K for YeT3l7JgTbWR in Dx_DllZ8uCko]
bfgddwndoutg = [YeT3l7JgTbWR.jSV9IKnemH7K for YeT3l7JgTbWR in ZgpvgqZTqQh4]
@xafqLlk3kkUe(bBC93MgSHzUB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xe2\x0f\x1d\xc2'), '\144' + '\x65' + chr(99) + chr(0b101000 + 0o107) + chr(0b0 + 0o144) + chr(6467 - 6366))(chr(5288 - 5171) + '\164' + '\146' + chr(45) + chr(0b1110 + 0o52)))(*sZjg4O4EqXeB + bfgddwndoutg + K6gLLxL4cxTY, func_name=xafqLlk3kkUe(SXOLrMavuUCe(b'=\xe3\x0c\x06\xd8\xe6\x81\x8f&f\xb0f\x17J\xd1\xf2\x91R\x00\x95\xf1d'), '\x64' + '\x65' + chr(99) + chr(0b1000001 + 0o56) + chr(0b101101 + 0o67) + chr(0b1100101))(chr(0b101 + 0o160) + chr(0b1110100) + '\x66' + chr(0b1 + 0o54) + chr(0b100110 + 0o22)) % xafqLlk3kkUe(_nu2um5Q5WJf, xafqLlk3kkUe(SXOLrMavuUCe(b'\x19\xcc\x02%\xde\xbd\xc0\xb3/k\xbfg'), chr(0b100010 + 0o102) + '\145' + chr(99) + chr(111) + '\x64' + chr(3008 - 2907))(chr(117) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(), python_grad_func=BxB6gVmaxkyr, shape_func=lambda VNGQdHSFPrso: [xafqLlk3kkUe(YeT3l7JgTbWR, xafqLlk3kkUe(SXOLrMavuUCe(b'3\xe2\x1d7\xdf\xe7\x94\x86\x1c'), chr(0b1100100) + chr(2999 - 2898) + '\143' + chr(0b1101111) + '\144' + '\x65')('\x75' + '\164' + chr(0b1100110) + chr(0b101101) + chr(56)))() for YeT3l7JgTbWR in Dx_DllZ8uCko])
def vFUG5mKXcvYG(*kJDRfRhcZHjS):
(VNGQdHSFPrso, VNGQdHSFPrso, _VexQtc8sfoI) = IDJ2eXGCBCDu.contrib.framework.nest.pack_sequence_as(yl829eKkqG8M, kJDRfRhcZHjS)
return KNyTy8rYcwji([xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'"\xc1</\x99\xe2\xbe\xae\x1as\x9cR'), chr(0b1100100) + '\145' + chr(0b1100011) + '\157' + '\x64' + chr(7832 - 7731))(chr(0b1110101) + chr(0b10 + 0o162) + '\146' + chr(1200 - 1155) + chr(56)))(YeT3l7JgTbWR) for YeT3l7JgTbWR in _VexQtc8sfoI])
UDayTsSxee6X = IDJ2eXGCBCDu.contrib.framework.nest.flatten(yl829eKkqG8M)
ZOFkXDc2idGk = vFUG5mKXcvYG(*UDayTsSxee6X)
return ZOFkXDc2idGk
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
conv_hidden_relu_memory_efficient
|
def conv_hidden_relu_memory_efficient(x,
filter_size,
epsilon=1e-6,
forget=True,
test_vars=None,
name=None):
"""LayerNorm, Conv, ReLU, Conv.
All convolutions have kernel size 1.
returns conv(relu(conv(layer_norm(x))))
Args:
x: input Tensor with shape [batch, length, io_size]
filter_size: an integer - size of the hidden layer.
epsilon: a float (for layer norm)
forget: a boolean - forget forwards activations and recompute on backprop
test_vars: optional tuple of variables for testing purposes
name: an optional string
Returns:
a Tensor with shape [batch, length, io_size]
"""
io_size = x.get_shape().as_list()[-1]
def forward_internal(x, f1, f2, scale, bias):
"""Forward function."""
# split batch-wise to avoid exhausting memory in cast the batch is large
# and the hidden layer is large.
num_splits = 4
x_flat = tf.reshape(x, [-1, 1, shape_list(x)[2]])
xs = approximate_split(x_flat, num_splits)
ys = []
for i in range(num_splits):
with tf.control_dependencies(ys[-1:]):
n = layer_norm_compute(xs[i], epsilon, scale, bias)
y = tf.nn.conv1d(n, f1, 1, "SAME")
y = tf.nn.relu(y)
y = tf.nn.conv1d(y, f2, 1, "SAME")
ys.append(y)
y = tf.concat(ys, 0)
y = tf.reshape(y, shape_list(x))
return y
key = ("conv_hidden_relu_memory_efficient %s" % epsilon)
if not forget:
forward_fn = forward_internal
elif key in _function_cache:
forward_fn = _function_cache[key]
else:
@function.Defun(compiled=True)
def grad_fn(x, f1, f2, scale, bias, dy):
"""Gradient for efficiency."""
with tf.control_dependencies([dy]):
num_splits = 4
x_shape = shape_list(x)
flat_shape = [-1, 1, x_shape[2]]
x = tf.reshape(x, flat_shape)
dy = tf.reshape(dy, flat_shape)
xs = approximate_split(x, num_splits)
dys = approximate_split(dy, num_splits)
dxs = []
df1 = 0
df2 = 0
dscale = 0
dbias = 0
deps = []
for i in range(num_splits):
with tf.control_dependencies(deps):
n = layer_norm_compute(xs[i], epsilon, scale, bias)
y = tf.nn.conv1d(n, f1, 1, "SAME")
y = tf.nn.relu(y)
y = tf.nn.conv1d(y, f2, 1, "SAME")
dxi, pdf1, pdf2, pdscale, pdbias = tf.gradients(
ys=[y], xs=[xs[i], f1, f2, scale, bias], grad_ys=[dys[i]])
df1 += pdf1
df2 += pdf2
dscale += pdscale
dbias += pdbias
dxs.append(dxi)
deps = [dxi, df1, df2, dscale, dbias]
with tf.control_dependencies(deps):
dx = tf.concat(dxs, 0)
dx = tf.reshape(dx, x_shape)
return dx, df1, df2, dscale, dbias
@function.Defun(
grad_func=grad_fn, compiled=True, separate_compiled_gradients=True)
def forward_fn(x, f1, f2, scale, bias):
return forward_internal(x, f1, f2, scale, bias)
with tf.variable_scope(name, default_name="ffn2", values=[x]):
# TODO(noam): it would be nice to save memory by casting x to float16
# here, but this causes problems with the gradients. Figure out if there
# is a way to leave the gradients as float32.
if test_vars is not None:
f1, f2, scale, bias = list(test_vars)
else:
f1 = tf.get_variable("f1", [1, io_size, filter_size])
f2 = tf.get_variable("f2", [1, filter_size, io_size])
scale, bias = layer_norm_vars(io_size)
if forget:
y = forward_fn(x, f1, f2, scale, bias)
else:
y = forward_internal(x, f1, f2, scale, bias)
y.set_shape(x.get_shape())
return y
|
python
|
def conv_hidden_relu_memory_efficient(x,
filter_size,
epsilon=1e-6,
forget=True,
test_vars=None,
name=None):
"""LayerNorm, Conv, ReLU, Conv.
All convolutions have kernel size 1.
returns conv(relu(conv(layer_norm(x))))
Args:
x: input Tensor with shape [batch, length, io_size]
filter_size: an integer - size of the hidden layer.
epsilon: a float (for layer norm)
forget: a boolean - forget forwards activations and recompute on backprop
test_vars: optional tuple of variables for testing purposes
name: an optional string
Returns:
a Tensor with shape [batch, length, io_size]
"""
io_size = x.get_shape().as_list()[-1]
def forward_internal(x, f1, f2, scale, bias):
"""Forward function."""
# split batch-wise to avoid exhausting memory in cast the batch is large
# and the hidden layer is large.
num_splits = 4
x_flat = tf.reshape(x, [-1, 1, shape_list(x)[2]])
xs = approximate_split(x_flat, num_splits)
ys = []
for i in range(num_splits):
with tf.control_dependencies(ys[-1:]):
n = layer_norm_compute(xs[i], epsilon, scale, bias)
y = tf.nn.conv1d(n, f1, 1, "SAME")
y = tf.nn.relu(y)
y = tf.nn.conv1d(y, f2, 1, "SAME")
ys.append(y)
y = tf.concat(ys, 0)
y = tf.reshape(y, shape_list(x))
return y
key = ("conv_hidden_relu_memory_efficient %s" % epsilon)
if not forget:
forward_fn = forward_internal
elif key in _function_cache:
forward_fn = _function_cache[key]
else:
@function.Defun(compiled=True)
def grad_fn(x, f1, f2, scale, bias, dy):
"""Gradient for efficiency."""
with tf.control_dependencies([dy]):
num_splits = 4
x_shape = shape_list(x)
flat_shape = [-1, 1, x_shape[2]]
x = tf.reshape(x, flat_shape)
dy = tf.reshape(dy, flat_shape)
xs = approximate_split(x, num_splits)
dys = approximate_split(dy, num_splits)
dxs = []
df1 = 0
df2 = 0
dscale = 0
dbias = 0
deps = []
for i in range(num_splits):
with tf.control_dependencies(deps):
n = layer_norm_compute(xs[i], epsilon, scale, bias)
y = tf.nn.conv1d(n, f1, 1, "SAME")
y = tf.nn.relu(y)
y = tf.nn.conv1d(y, f2, 1, "SAME")
dxi, pdf1, pdf2, pdscale, pdbias = tf.gradients(
ys=[y], xs=[xs[i], f1, f2, scale, bias], grad_ys=[dys[i]])
df1 += pdf1
df2 += pdf2
dscale += pdscale
dbias += pdbias
dxs.append(dxi)
deps = [dxi, df1, df2, dscale, dbias]
with tf.control_dependencies(deps):
dx = tf.concat(dxs, 0)
dx = tf.reshape(dx, x_shape)
return dx, df1, df2, dscale, dbias
@function.Defun(
grad_func=grad_fn, compiled=True, separate_compiled_gradients=True)
def forward_fn(x, f1, f2, scale, bias):
return forward_internal(x, f1, f2, scale, bias)
with tf.variable_scope(name, default_name="ffn2", values=[x]):
# TODO(noam): it would be nice to save memory by casting x to float16
# here, but this causes problems with the gradients. Figure out if there
# is a way to leave the gradients as float32.
if test_vars is not None:
f1, f2, scale, bias = list(test_vars)
else:
f1 = tf.get_variable("f1", [1, io_size, filter_size])
f2 = tf.get_variable("f2", [1, filter_size, io_size])
scale, bias = layer_norm_vars(io_size)
if forget:
y = forward_fn(x, f1, f2, scale, bias)
else:
y = forward_internal(x, f1, f2, scale, bias)
y.set_shape(x.get_shape())
return y
|
[
"def",
"conv_hidden_relu_memory_efficient",
"(",
"x",
",",
"filter_size",
",",
"epsilon",
"=",
"1e-6",
",",
"forget",
"=",
"True",
",",
"test_vars",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"io_size",
"=",
"x",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
"-",
"1",
"]",
"def",
"forward_internal",
"(",
"x",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
")",
":",
"\"\"\"Forward function.\"\"\"",
"# split batch-wise to avoid exhausting memory in cast the batch is large",
"# and the hidden layer is large.",
"num_splits",
"=",
"4",
"x_flat",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"1",
",",
"shape_list",
"(",
"x",
")",
"[",
"2",
"]",
"]",
")",
"xs",
"=",
"approximate_split",
"(",
"x_flat",
",",
"num_splits",
")",
"ys",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"num_splits",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"ys",
"[",
"-",
"1",
":",
"]",
")",
":",
"n",
"=",
"layer_norm_compute",
"(",
"xs",
"[",
"i",
"]",
",",
"epsilon",
",",
"scale",
",",
"bias",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"conv1d",
"(",
"n",
",",
"f1",
",",
"1",
",",
"\"SAME\"",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"relu",
"(",
"y",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"conv1d",
"(",
"y",
",",
"f2",
",",
"1",
",",
"\"SAME\"",
")",
"ys",
".",
"append",
"(",
"y",
")",
"y",
"=",
"tf",
".",
"concat",
"(",
"ys",
",",
"0",
")",
"y",
"=",
"tf",
".",
"reshape",
"(",
"y",
",",
"shape_list",
"(",
"x",
")",
")",
"return",
"y",
"key",
"=",
"(",
"\"conv_hidden_relu_memory_efficient %s\"",
"%",
"epsilon",
")",
"if",
"not",
"forget",
":",
"forward_fn",
"=",
"forward_internal",
"elif",
"key",
"in",
"_function_cache",
":",
"forward_fn",
"=",
"_function_cache",
"[",
"key",
"]",
"else",
":",
"@",
"function",
".",
"Defun",
"(",
"compiled",
"=",
"True",
")",
"def",
"grad_fn",
"(",
"x",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
",",
"dy",
")",
":",
"\"\"\"Gradient for efficiency.\"\"\"",
"with",
"tf",
".",
"control_dependencies",
"(",
"[",
"dy",
"]",
")",
":",
"num_splits",
"=",
"4",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"flat_shape",
"=",
"[",
"-",
"1",
",",
"1",
",",
"x_shape",
"[",
"2",
"]",
"]",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"flat_shape",
")",
"dy",
"=",
"tf",
".",
"reshape",
"(",
"dy",
",",
"flat_shape",
")",
"xs",
"=",
"approximate_split",
"(",
"x",
",",
"num_splits",
")",
"dys",
"=",
"approximate_split",
"(",
"dy",
",",
"num_splits",
")",
"dxs",
"=",
"[",
"]",
"df1",
"=",
"0",
"df2",
"=",
"0",
"dscale",
"=",
"0",
"dbias",
"=",
"0",
"deps",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"num_splits",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"deps",
")",
":",
"n",
"=",
"layer_norm_compute",
"(",
"xs",
"[",
"i",
"]",
",",
"epsilon",
",",
"scale",
",",
"bias",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"conv1d",
"(",
"n",
",",
"f1",
",",
"1",
",",
"\"SAME\"",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"relu",
"(",
"y",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"conv1d",
"(",
"y",
",",
"f2",
",",
"1",
",",
"\"SAME\"",
")",
"dxi",
",",
"pdf1",
",",
"pdf2",
",",
"pdscale",
",",
"pdbias",
"=",
"tf",
".",
"gradients",
"(",
"ys",
"=",
"[",
"y",
"]",
",",
"xs",
"=",
"[",
"xs",
"[",
"i",
"]",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
"]",
",",
"grad_ys",
"=",
"[",
"dys",
"[",
"i",
"]",
"]",
")",
"df1",
"+=",
"pdf1",
"df2",
"+=",
"pdf2",
"dscale",
"+=",
"pdscale",
"dbias",
"+=",
"pdbias",
"dxs",
".",
"append",
"(",
"dxi",
")",
"deps",
"=",
"[",
"dxi",
",",
"df1",
",",
"df2",
",",
"dscale",
",",
"dbias",
"]",
"with",
"tf",
".",
"control_dependencies",
"(",
"deps",
")",
":",
"dx",
"=",
"tf",
".",
"concat",
"(",
"dxs",
",",
"0",
")",
"dx",
"=",
"tf",
".",
"reshape",
"(",
"dx",
",",
"x_shape",
")",
"return",
"dx",
",",
"df1",
",",
"df2",
",",
"dscale",
",",
"dbias",
"@",
"function",
".",
"Defun",
"(",
"grad_func",
"=",
"grad_fn",
",",
"compiled",
"=",
"True",
",",
"separate_compiled_gradients",
"=",
"True",
")",
"def",
"forward_fn",
"(",
"x",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
")",
":",
"return",
"forward_internal",
"(",
"x",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"ffn2\"",
",",
"values",
"=",
"[",
"x",
"]",
")",
":",
"# TODO(noam): it would be nice to save memory by casting x to float16",
"# here, but this causes problems with the gradients. Figure out if there",
"# is a way to leave the gradients as float32.",
"if",
"test_vars",
"is",
"not",
"None",
":",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
"=",
"list",
"(",
"test_vars",
")",
"else",
":",
"f1",
"=",
"tf",
".",
"get_variable",
"(",
"\"f1\"",
",",
"[",
"1",
",",
"io_size",
",",
"filter_size",
"]",
")",
"f2",
"=",
"tf",
".",
"get_variable",
"(",
"\"f2\"",
",",
"[",
"1",
",",
"filter_size",
",",
"io_size",
"]",
")",
"scale",
",",
"bias",
"=",
"layer_norm_vars",
"(",
"io_size",
")",
"if",
"forget",
":",
"y",
"=",
"forward_fn",
"(",
"x",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
")",
"else",
":",
"y",
"=",
"forward_internal",
"(",
"x",
",",
"f1",
",",
"f2",
",",
"scale",
",",
"bias",
")",
"y",
".",
"set_shape",
"(",
"x",
".",
"get_shape",
"(",
")",
")",
"return",
"y"
] |
LayerNorm, Conv, ReLU, Conv.
All convolutions have kernel size 1.
returns conv(relu(conv(layer_norm(x))))
Args:
x: input Tensor with shape [batch, length, io_size]
filter_size: an integer - size of the hidden layer.
epsilon: a float (for layer norm)
forget: a boolean - forget forwards activations and recompute on backprop
test_vars: optional tuple of variables for testing purposes
name: an optional string
Returns:
a Tensor with shape [batch, length, io_size]
|
[
"LayerNorm",
"Conv",
"ReLU",
"Conv",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2823-L2930
|
train
|
A memory - efficient version of the conv_hidden_relu_memory_efficient 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,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6A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gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\x37' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1957 - 1906) + chr(53 - 4) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110011) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1100 + 0o45) + '\x35' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1658 - 1607) + chr(0b110001) + '\x31', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110111) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100111 + 0o12) + '\x36' + chr(0b110110), 28757 - 28749), ehT0Px3KOsy9(chr(0b110000) + chr(10791 - 10680) + chr(1641 - 1590) + chr(0b1010 + 0o51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100101 + 0o14) + '\060' + chr(1237 - 1187), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(11483 - 11372) + chr(1426 - 1375) + chr(51), 8), ehT0Px3KOsy9('\060' + chr(11724 - 11613) + chr(1155 - 1104) + '\067' + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1320 - 1266) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + chr(51) + chr(52) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6890 - 6779) + chr(0b110001) + chr(2569 - 2516) + '\x36', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(48) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(2598 - 2544) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\x32' + chr(0b110110) + chr(0b101000 + 0o13), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(1230 - 1180) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(0b1110 + 0o45) + chr(0b110101), 58896 - 58888), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b110001 + 0o2) + chr(1556 - 1507) + chr(167 - 119), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\064' + '\066', 0b1000), ehT0Px3KOsy9(chr(1726 - 1678) + '\157' + chr(663 - 614) + '\062' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b11000 + 0o127) + chr(0b110001) + chr(55) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b110100) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(5481 - 5370) + '\x31' + chr(49) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1535 - 1486) + chr(0b110100) + chr(0b110000), 48148 - 48140), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1785 - 1736) + chr(0b110001) + chr(2681 - 2629), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11289 - 11178) + chr(0b110001) + chr(793 - 740) + '\x30', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b100110 + 0o14) + chr(2017 - 1964), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + '\x31' + chr(0b1110 + 0o43) + chr(1248 - 1198), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(11222 - 11111) + chr(49) + chr(48) + chr(0b110010), 8), ehT0Px3KOsy9(chr(295 - 247) + '\x6f' + chr(0b10111 + 0o32) + chr(2888 - 2834) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + chr(0b11101 + 0o26) + '\x30' + chr(1571 - 1523), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6010 - 5899) + '\x31' + chr(0b110010) + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + '\065' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + '\064' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1480 - 1431) + '\x33' + chr(1772 - 1720), 8), ehT0Px3KOsy9('\060' + chr(9676 - 9565) + chr(0b110011 + 0o0) + chr(49) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11110 + 0o25) + '\x34' + chr(663 - 610), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(4540 - 4429) + chr(0b110001 + 0o4) + chr(1227 - 1179), 51484 - 51476)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'R'), chr(0b1100100) + chr(3922 - 3821) + '\x63' + chr(111) + chr(0b1100100) + chr(9480 - 9379))('\165' + '\164' + chr(0b1100110) + chr(0b101101) + chr(0b100101 + 0o23)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def dYEE7HUMxDWO(OeWW0F1dBPRQ, deybX8NJ0oEI, Xtig2zAKpR0T=1e-06, gzDCc4ZGw399=ehT0Px3KOsy9('\x30' + chr(0b1111 + 0o140) + '\x31', ord("\x08")), G7LtXfpgc0_p=None, AIvJRzLdDfgF=None):
pq_j3NUgls4Z = OeWW0F1dBPRQ.get_shape().as_list()[-ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8)]
def aTc0qCLJflHa(OeWW0F1dBPRQ, dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10):
NbAbkov2L4m5 = ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(4019 - 3908) + '\064', 0b1000)
mstS6zVd22Jf = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9('\x30' + '\157' + chr(0b10010 + 0o37), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8), qypPRW8fq869(OeWW0F1dBPRQ)[ehT0Px3KOsy9('\060' + chr(7117 - 7006) + chr(0b110010), 14384 - 14376)]])
f0GvdYMiCwc9 = OSY0RsHrOdKF(mstS6zVd22Jf, NbAbkov2L4m5)
oCqQNfCOTQKb = []
for WVxHKyX45z_L in vQr8gNKaIaWE(NbAbkov2L4m5):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xa12\x1c\xbbU\x1aD&~\x8bQ\x8f\n\xa7\x1e\xd08\xf8\xbb'), '\144' + chr(0b1100101) + chr(99) + chr(0b1101111) + '\144' + '\145')('\165' + chr(12873 - 12757) + chr(2936 - 2834) + chr(45) + '\x38'))(oCqQNfCOTQKb[-ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8):]):
m1NkCryOw9Bx = hwU74GPyNW1U(f0GvdYMiCwc9[WVxHKyX45z_L], Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10)
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.conv1d(m1NkCryOw9Bx, dHCiiTHxprsx, ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8), xafqLlk3kkUe(SXOLrMavuUCe(b'/\x8f\x11-'), chr(0b1100100) + chr(0b11000 + 0o115) + '\x63' + '\x6f' + '\144' + chr(101))('\x75' + '\164' + chr(0b1100110) + chr(0b1010 + 0o43) + chr(0b1100 + 0o54)))
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.relu(SqiSOtYOqOJH)
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.conv1d(SqiSOtYOqOJH, TOKPLFshP24Y, ehT0Px3KOsy9('\060' + '\x6f' + chr(555 - 506), 8), xafqLlk3kkUe(SXOLrMavuUCe(b'/\x8f\x11-'), chr(6254 - 6154) + chr(0b1100101) + '\x63' + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1000110 + 0o57) + chr(0b11 + 0o161) + '\x66' + chr(0b1010 + 0o43) + chr(56)))
xafqLlk3kkUe(oCqQNfCOTQKb, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\xbe,\r\xa7^'), '\144' + chr(0b10110 + 0o117) + chr(5372 - 5273) + chr(111) + chr(0b110000 + 0o64) + chr(0b100001 + 0o104))(chr(117) + chr(0b1000010 + 0o62) + chr(102) + chr(0b1110 + 0o37) + chr(56)))(SqiSOtYOqOJH)
SqiSOtYOqOJH = IDJ2eXGCBCDu.concat(oCqQNfCOTQKb, ehT0Px3KOsy9(chr(1921 - 1873) + chr(6756 - 6645) + chr(0b110000), 0o10))
SqiSOtYOqOJH = IDJ2eXGCBCDu.reshape(SqiSOtYOqOJH, qypPRW8fq869(OeWW0F1dBPRQ))
return SqiSOtYOqOJH
K3J4ZwSlE0sT = xafqLlk3kkUe(SXOLrMavuUCe(b"\x1f\xa12\x1e\x96R\x1f\x7f&~\x95k\x93\x0b\xae\x05\xec<\xf8\xa5I&\x069-\x06*\x01\xb6#'\x1f\xb4<t\xd9"), chr(0b1010011 + 0o21) + chr(101) + chr(0b1100011) + chr(0b1010 + 0o145) + chr(0b1100100) + '\x65')(chr(117) + chr(0b1110100) + '\146' + '\055' + chr(56)) % Xtig2zAKpR0T
if not gzDCc4ZGw399:
qq3l7ooygutA = aTc0qCLJflHa
elif K3J4ZwSlE0sT in L3JeO8Sw6TYw:
qq3l7ooygutA = L3JeO8Sw6TYw[K3J4ZwSlE0sT]
else:
@xafqLlk3kkUe(bBC93MgSHzUB, xafqLlk3kkUe(SXOLrMavuUCe(b'8\xab:\x1d\xa7'), chr(0b10100 + 0o120) + chr(0b11011 + 0o112) + chr(0b1100011) + chr(0b1101111) + '\x64' + '\145')(chr(11160 - 11043) + chr(7530 - 7414) + chr(0b11100 + 0o112) + chr(0b101101) + chr(56)))(compiled=ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(0b110001), 8))
def mOK0n0L9FPZ0(OeWW0F1dBPRQ, dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10, Jz3111tD_9m4):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xa12\x1c\xbbU\x1aD&~\x8bQ\x8f\n\xa7\x1e\xd08\xf8\xbb'), '\144' + '\145' + chr(99) + '\x6f' + chr(0b1011101 + 0o7) + chr(0b10111 + 0o116))('\165' + chr(0b1110100) + '\x66' + chr(0b10110 + 0o27) + chr(0b11110 + 0o32)))([Jz3111tD_9m4]):
NbAbkov2L4m5 = ehT0Px3KOsy9('\x30' + chr(11672 - 11561) + chr(0b100100 + 0o20), 8)
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
fNoCxCGdOSXx = [-ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(4110 - 3999) + chr(0b10010 + 0o37), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061', 8), QQEXXbdZyz6m[ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(9212 - 9101) + chr(0b101101 + 0o5), 8)]]
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, fNoCxCGdOSXx)
Jz3111tD_9m4 = IDJ2eXGCBCDu.reshape(Jz3111tD_9m4, fNoCxCGdOSXx)
f0GvdYMiCwc9 = OSY0RsHrOdKF(OeWW0F1dBPRQ, NbAbkov2L4m5)
yIYaXZU2hEO8 = OSY0RsHrOdKF(Jz3111tD_9m4, NbAbkov2L4m5)
FTRwgwypylJ5 = []
aErGifEY7vln = ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(48), 8)
MkHOrU0zWWFm = ehT0Px3KOsy9(chr(612 - 564) + '\x6f' + '\x30', 8)
XxtOReHbUFDH = ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000), 8)
fFe4Uq40Sxpy = ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8)
tiOm_0evs6u1 = []
for WVxHKyX45z_L in vQr8gNKaIaWE(NbAbkov2L4m5):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xa12\x1c\xbbU\x1aD&~\x8bQ\x8f\n\xa7\x1e\xd08\xf8\xbb'), '\x64' + '\x65' + chr(0b1100011) + '\x6f' + '\x64' + chr(101))('\x75' + chr(0b1100110 + 0o16) + chr(2994 - 2892) + '\x2d' + chr(0b1000 + 0o60)))(tiOm_0evs6u1):
m1NkCryOw9Bx = hwU74GPyNW1U(f0GvdYMiCwc9[WVxHKyX45z_L], Xtig2zAKpR0T, xjPLimsZRgb9, IKTrMTySqz10)
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.conv1d(m1NkCryOw9Bx, dHCiiTHxprsx, ehT0Px3KOsy9(chr(1015 - 967) + '\157' + chr(0b10100 + 0o35), 8), xafqLlk3kkUe(SXOLrMavuUCe(b'/\x8f\x11-'), chr(0b1100011 + 0o1) + chr(0b1100101) + '\143' + '\157' + chr(0b100001 + 0o103) + chr(9794 - 9693))('\165' + '\x74' + chr(102) + '\055' + chr(0b110001 + 0o7)))
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.relu(SqiSOtYOqOJH)
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.conv1d(SqiSOtYOqOJH, TOKPLFshP24Y, ehT0Px3KOsy9(chr(1035 - 987) + chr(0b1001111 + 0o40) + chr(0b110001), 8), xafqLlk3kkUe(SXOLrMavuUCe(b'/\x8f\x11-'), '\x64' + chr(101) + '\x63' + chr(0b1101111) + chr(7964 - 7864) + chr(5777 - 5676))('\x75' + chr(0b1110100) + '\146' + '\055' + '\070'))
(bKMJwFrzUNkU, ozrFPepHNlFY, a2NNygxBcWeU, hkdwakVDFmdb, y_wc1IVLMMhJ) = IDJ2eXGCBCDu.gradients(ys=[SqiSOtYOqOJH], xs=[f0GvdYMiCwc9[WVxHKyX45z_L], dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10], grad_ys=[yIYaXZU2hEO8[WVxHKyX45z_L]])
aErGifEY7vln += ozrFPepHNlFY
MkHOrU0zWWFm += a2NNygxBcWeU
XxtOReHbUFDH += hkdwakVDFmdb
fFe4Uq40Sxpy += y_wc1IVLMMhJ
xafqLlk3kkUe(FTRwgwypylJ5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\xbe,\r\xa7^'), '\x64' + chr(885 - 784) + chr(0b1100011) + chr(0b1101111) + '\x64' + '\x65')(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(0b100011 + 0o12) + '\x38'))(bKMJwFrzUNkU)
tiOm_0evs6u1 = [bKMJwFrzUNkU, aErGifEY7vln, MkHOrU0zWWFm, XxtOReHbUFDH, fFe4Uq40Sxpy]
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\xa12\x1c\xbbU\x1aD&~\x8bQ\x8f\n\xa7\x1e\xd08\xf8\xbb'), '\144' + chr(101) + chr(0b1100011) + chr(8358 - 8247) + '\144' + chr(7021 - 6920))('\165' + chr(116) + chr(7005 - 6903) + '\x2d' + chr(56)))(tiOm_0evs6u1):
yGt1PN0KO3VY = IDJ2eXGCBCDu.concat(FTRwgwypylJ5, ehT0Px3KOsy9('\x30' + chr(0b1101010 + 0o5) + chr(1348 - 1300), 8))
yGt1PN0KO3VY = IDJ2eXGCBCDu.reshape(yGt1PN0KO3VY, QQEXXbdZyz6m)
return (yGt1PN0KO3VY, aErGifEY7vln, MkHOrU0zWWFm, XxtOReHbUFDH, fFe4Uq40Sxpy)
@xafqLlk3kkUe(bBC93MgSHzUB, xafqLlk3kkUe(SXOLrMavuUCe(b'8\xab:\x1d\xa7'), '\144' + chr(0b1100101) + '\143' + chr(0b1101111) + '\144' + chr(0b1100101))('\165' + chr(0b1110100) + '\146' + chr(0b101101) + '\x38'))(grad_func=mOK0n0L9FPZ0, compiled=ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(9044 - 8933) + '\x31', 8), separate_compiled_gradients=ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31', 8))
def qq3l7ooygutA(OeWW0F1dBPRQ, dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10):
return aTc0qCLJflHa(OeWW0F1dBPRQ, dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\n\xaf.\x01\xa8X\x1a~\x1dh\x98[\x91\x0b'), chr(100) + chr(986 - 885) + chr(0b111000 + 0o53) + chr(8353 - 8242) + '\x64' + '\x65')(chr(5482 - 5365) + chr(0b11 + 0o161) + chr(0b1100110) + '\x2d' + chr(2164 - 2108)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a\xa82Z'), chr(0b1100100) + chr(101) + chr(4500 - 4401) + chr(0b101000 + 0o107) + chr(100) + chr(6287 - 6186))('\165' + '\164' + chr(102) + '\x2d' + chr(545 - 489)), values=[OeWW0F1dBPRQ]):
if G7LtXfpgc0_p is not None:
(dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10) = YyaZ4tpXu4lf(G7LtXfpgc0_p)
else:
dHCiiTHxprsx = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a\xff'), chr(5963 - 5863) + chr(101) + chr(99) + chr(9919 - 9808) + '\x64' + chr(0b1100101))(chr(0b1100000 + 0o25) + chr(116) + chr(0b1100110) + chr(0b101101) + '\x38'), [ehT0Px3KOsy9(chr(769 - 721) + chr(111) + chr(0b110001), 8), pq_j3NUgls4Z, deybX8NJ0oEI])
TOKPLFshP24Y = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a\xfc'), chr(0b1100100) + chr(0b1100101) + '\143' + '\157' + chr(100) + chr(0b1100100 + 0o1))(chr(117) + chr(0b1110100) + chr(102) + '\x2d' + '\x38'), [ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8), deybX8NJ0oEI, pq_j3NUgls4Z])
(xjPLimsZRgb9, IKTrMTySqz10) = odQDHnrcnffS(pq_j3NUgls4Z)
if gzDCc4ZGw399:
SqiSOtYOqOJH = qq3l7ooygutA(OeWW0F1dBPRQ, dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10)
else:
SqiSOtYOqOJH = aTc0qCLJflHa(OeWW0F1dBPRQ, dHCiiTHxprsx, TOKPLFshP24Y, xjPLimsZRgb9, IKTrMTySqz10)
xafqLlk3kkUe(SqiSOtYOqOJH, xafqLlk3kkUe(SXOLrMavuUCe(b"\x0f\xab(7\xbaR\x17k'"), chr(7450 - 7350) + chr(101) + chr(337 - 238) + chr(0b11001 + 0o126) + chr(0b1100100) + chr(1287 - 1186))(chr(0b11110 + 0o127) + chr(116) + chr(102) + chr(1487 - 1442) + chr(56)))(xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b"\x1b\xab(7\xbaR\x17k'"), chr(100) + chr(0b101111 + 0o66) + chr(0b1100011) + '\157' + chr(100) + chr(101))('\x75' + '\164' + '\x66' + '\055' + chr(480 - 424)))())
return SqiSOtYOqOJH
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
shape_list
|
def shape_list(x):
"""Return list of dims, statically where possible."""
x = tf.convert_to_tensor(x)
# If unknown rank, return dynamic shape
if x.get_shape().dims is None:
return tf.shape(x)
static = x.get_shape().as_list()
shape = tf.shape(x)
ret = []
for i, dim in enumerate(static):
if dim is None:
dim = shape[i]
ret.append(dim)
return ret
|
python
|
def shape_list(x):
"""Return list of dims, statically where possible."""
x = tf.convert_to_tensor(x)
# If unknown rank, return dynamic shape
if x.get_shape().dims is None:
return tf.shape(x)
static = x.get_shape().as_list()
shape = tf.shape(x)
ret = []
for i, dim in enumerate(static):
if dim is None:
dim = shape[i]
ret.append(dim)
return ret
|
[
"def",
"shape_list",
"(",
"x",
")",
":",
"x",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"x",
")",
"# If unknown rank, return dynamic shape",
"if",
"x",
".",
"get_shape",
"(",
")",
".",
"dims",
"is",
"None",
":",
"return",
"tf",
".",
"shape",
"(",
"x",
")",
"static",
"=",
"x",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"shape",
"=",
"tf",
".",
"shape",
"(",
"x",
")",
"ret",
"=",
"[",
"]",
"for",
"i",
",",
"dim",
"in",
"enumerate",
"(",
"static",
")",
":",
"if",
"dim",
"is",
"None",
":",
"dim",
"=",
"shape",
"[",
"i",
"]",
"ret",
".",
"append",
"(",
"dim",
")",
"return",
"ret"
] |
Return list of dims, statically where possible.
|
[
"Return",
"list",
"of",
"dims",
"statically",
"where",
"possible",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2933-L2949
|
train
|
Return list of dims statically where possible.
|
Pu7Z6IJCgH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KLA6,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(482 - 432) + chr(52) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(638 - 588) + chr(53) + chr(53), 32235 - 32227), ehT0Px3KOsy9('\060' + chr(0b10010 + 0o135) + chr(0b11110 + 0o24) + chr(53) + chr(0b1101 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b101111 + 0o100) + chr(0b1000 + 0o52) + chr(50) + chr(2369 - 2316), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(0b110100) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1804 - 1755) + '\066' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b10101 + 0o40) + chr(49), 0b1000), ehT0Px3KOsy9(chr(145 - 97) + '\157' + chr(0b110001) + '\x33' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000111 + 0o50) + chr(49) + chr(3002 - 2947) + '\x36', 48570 - 48562), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(8781 - 8670) + chr(0b110011) + chr(1358 - 1303), 26822 - 26814), ehT0Px3KOsy9(chr(815 - 767) + '\x6f' + '\x33' + chr(263 - 208), 8), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(52) + chr(0b1100 + 0o50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x36' + chr(0b110100), 49983 - 49975), ehT0Px3KOsy9(chr(0b110000) + chr(0b100011 + 0o114) + chr(634 - 584) + '\064' + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(2223 - 2175) + chr(0b111100 + 0o63) + '\063' + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1833 - 1785) + chr(111) + '\x33' + chr(2157 - 2109) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\x32' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11001 + 0o33) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(50) + '\x33' + chr(0b10001 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x34' + chr(0b11100 + 0o32), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1001 + 0o51) + '\062' + '\067', 775 - 767), ehT0Px3KOsy9(chr(624 - 576) + chr(8390 - 8279) + chr(51) + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011111 + 0o20) + chr(0b101001 + 0o10) + chr(0b110110) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(9062 - 8951) + chr(0b110001) + '\060' + '\065', 50083 - 50075), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(54) + '\x31', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\x30' + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b110101) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(773 - 725) + '\157' + chr(0b110011) + chr(0b110100) + chr(0b10 + 0o57), 53982 - 53974), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b100011 + 0o17) + '\x37', 60497 - 60489), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11011 + 0o30) + '\060' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(54) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1807 - 1759) + chr(0b1011 + 0o144) + '\x34' + chr(54), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + '\x36' + chr(0b0 + 0o60), 8), ehT0Px3KOsy9(chr(197 - 149) + '\x6f' + chr(0b100110 + 0o13) + chr(0b11011 + 0o27) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\x35' + chr(48), 63748 - 63740), ehT0Px3KOsy9(chr(113 - 65) + chr(1291 - 1180) + chr(50) + chr(0b10100 + 0o35) + chr(0b11000 + 0o35), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b1111 + 0o44) + chr(575 - 520), 27112 - 27104), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x35' + '\x33', 0o10), ehT0Px3KOsy9(chr(565 - 517) + chr(8440 - 8329) + chr(1519 - 1464) + chr(2219 - 2169), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(576 - 528) + chr(0b1101111) + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a'), '\x64' + chr(958 - 857) + chr(8744 - 8645) + chr(111) + '\144' + '\x65')('\x75' + chr(1614 - 1498) + chr(102) + '\055' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def qypPRW8fq869(OeWW0F1dBPRQ):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.convert_to_tensor(OeWW0F1dBPRQ)
if xafqLlk3kkUe(OeWW0F1dBPRQ.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0\xc4\xc7\xe6'), chr(0b1100100) + chr(5574 - 5473) + '\x63' + chr(0b1101111) + '\x64' + chr(4150 - 4049))('\x75' + chr(0b111111 + 0o65) + chr(0b1100110) + '\x2d' + chr(56))) is None:
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xca\xcc\xdf\xcc\x04<\x8e2*o|\x86'), chr(2133 - 2033) + '\145' + '\x63' + chr(0b101111 + 0o100) + '\x64' + chr(0b1100101))(chr(0b11010 + 0o133) + chr(0b101010 + 0o112) + '\x66' + '\x2d' + '\x38'))(OeWW0F1dBPRQ)
NqVJWtGuekkN = OeWW0F1dBPRQ.get_shape().as_list()
nauYfLglTpcb = IDJ2eXGCBCDu.nauYfLglTpcb(OeWW0F1dBPRQ)
VHn4CV4Ymrei = []
for (WVxHKyX45z_L, Nl_JhL3qUwSN) in YlkZvXL8qwsX(NqVJWtGuekkN):
if Nl_JhL3qUwSN is None:
Nl_JhL3qUwSN = nauYfLglTpcb[WVxHKyX45z_L]
xafqLlk3kkUe(VHn4CV4Ymrei, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xdd\xda\xf0\x0c\x14'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(1140 - 1029) + chr(0b11001 + 0o113) + chr(101))(chr(0b1110101) + chr(5081 - 4965) + '\146' + chr(45) + chr(2936 - 2880)))(Nl_JhL3qUwSN)
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
sample_with_temperature
|
def sample_with_temperature(logits, temperature, sampling_keep_top_k=-1):
"""Either argmax or random sampling.
Args:
logits: a Tensor.
temperature: a float 0.0=argmax 1.0=random
sampling_keep_top_k: If not -1, only sample from the top k logits.
Returns:
a Tensor with one fewer dimension than logits.
"""
if temperature == 0.0:
# TF argmax doesn't handle >5 dimensions, so we reshape here.
logits_shape = shape_list(logits)
argmax = tf.argmax(tf.reshape(logits, [-1, logits_shape[-1]]), axis=1)
return tf.reshape(argmax, logits_shape[:-1])
else:
assert temperature > 0.0
if sampling_keep_top_k != -1:
if sampling_keep_top_k <= 0:
raise ValueError("sampling_keep_top_k must either be -1 or positive.")
vocab_size = shape_list(logits)[1]
k_largest = tf.contrib.nn.nth_element(
logits, n=sampling_keep_top_k, reverse=True)
k_largest = tf.tile(tf.reshape(k_largest, [-1, 1]), [1, vocab_size])
# Force every position that is not in the top k to have probability near
# 0 by setting the logit to be very negative.
logits = tf.where(tf.less_equal(logits, k_largest),
tf.ones_like(logits)*-1e6, logits)
reshaped_logits = (
tf.reshape(logits, [-1, shape_list(logits)[-1]]) / temperature)
choices = tf.multinomial(reshaped_logits, 1)
choices = tf.reshape(choices,
shape_list(logits)[:logits.get_shape().ndims - 1])
return choices
|
python
|
def sample_with_temperature(logits, temperature, sampling_keep_top_k=-1):
"""Either argmax or random sampling.
Args:
logits: a Tensor.
temperature: a float 0.0=argmax 1.0=random
sampling_keep_top_k: If not -1, only sample from the top k logits.
Returns:
a Tensor with one fewer dimension than logits.
"""
if temperature == 0.0:
# TF argmax doesn't handle >5 dimensions, so we reshape here.
logits_shape = shape_list(logits)
argmax = tf.argmax(tf.reshape(logits, [-1, logits_shape[-1]]), axis=1)
return tf.reshape(argmax, logits_shape[:-1])
else:
assert temperature > 0.0
if sampling_keep_top_k != -1:
if sampling_keep_top_k <= 0:
raise ValueError("sampling_keep_top_k must either be -1 or positive.")
vocab_size = shape_list(logits)[1]
k_largest = tf.contrib.nn.nth_element(
logits, n=sampling_keep_top_k, reverse=True)
k_largest = tf.tile(tf.reshape(k_largest, [-1, 1]), [1, vocab_size])
# Force every position that is not in the top k to have probability near
# 0 by setting the logit to be very negative.
logits = tf.where(tf.less_equal(logits, k_largest),
tf.ones_like(logits)*-1e6, logits)
reshaped_logits = (
tf.reshape(logits, [-1, shape_list(logits)[-1]]) / temperature)
choices = tf.multinomial(reshaped_logits, 1)
choices = tf.reshape(choices,
shape_list(logits)[:logits.get_shape().ndims - 1])
return choices
|
[
"def",
"sample_with_temperature",
"(",
"logits",
",",
"temperature",
",",
"sampling_keep_top_k",
"=",
"-",
"1",
")",
":",
"if",
"temperature",
"==",
"0.0",
":",
"# TF argmax doesn't handle >5 dimensions, so we reshape here.",
"logits_shape",
"=",
"shape_list",
"(",
"logits",
")",
"argmax",
"=",
"tf",
".",
"argmax",
"(",
"tf",
".",
"reshape",
"(",
"logits",
",",
"[",
"-",
"1",
",",
"logits_shape",
"[",
"-",
"1",
"]",
"]",
")",
",",
"axis",
"=",
"1",
")",
"return",
"tf",
".",
"reshape",
"(",
"argmax",
",",
"logits_shape",
"[",
":",
"-",
"1",
"]",
")",
"else",
":",
"assert",
"temperature",
">",
"0.0",
"if",
"sampling_keep_top_k",
"!=",
"-",
"1",
":",
"if",
"sampling_keep_top_k",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"sampling_keep_top_k must either be -1 or positive.\"",
")",
"vocab_size",
"=",
"shape_list",
"(",
"logits",
")",
"[",
"1",
"]",
"k_largest",
"=",
"tf",
".",
"contrib",
".",
"nn",
".",
"nth_element",
"(",
"logits",
",",
"n",
"=",
"sampling_keep_top_k",
",",
"reverse",
"=",
"True",
")",
"k_largest",
"=",
"tf",
".",
"tile",
"(",
"tf",
".",
"reshape",
"(",
"k_largest",
",",
"[",
"-",
"1",
",",
"1",
"]",
")",
",",
"[",
"1",
",",
"vocab_size",
"]",
")",
"# Force every position that is not in the top k to have probability near",
"# 0 by setting the logit to be very negative.",
"logits",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"less_equal",
"(",
"logits",
",",
"k_largest",
")",
",",
"tf",
".",
"ones_like",
"(",
"logits",
")",
"*",
"-",
"1e6",
",",
"logits",
")",
"reshaped_logits",
"=",
"(",
"tf",
".",
"reshape",
"(",
"logits",
",",
"[",
"-",
"1",
",",
"shape_list",
"(",
"logits",
")",
"[",
"-",
"1",
"]",
"]",
")",
"/",
"temperature",
")",
"choices",
"=",
"tf",
".",
"multinomial",
"(",
"reshaped_logits",
",",
"1",
")",
"choices",
"=",
"tf",
".",
"reshape",
"(",
"choices",
",",
"shape_list",
"(",
"logits",
")",
"[",
":",
"logits",
".",
"get_shape",
"(",
")",
".",
"ndims",
"-",
"1",
"]",
")",
"return",
"choices"
] |
Either argmax or random sampling.
Args:
logits: a Tensor.
temperature: a float 0.0=argmax 1.0=random
sampling_keep_top_k: If not -1, only sample from the top k logits.
Returns:
a Tensor with one fewer dimension than logits.
|
[
"Either",
"argmax",
"or",
"random",
"sampling",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor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pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\065' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(765 - 654) + '\063' + chr(2535 - 2481) + chr(2905 - 2850), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(49) + chr(0b11101 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(493 - 444) + '\x32' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + chr(0b110100), 38629 - 38621), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(1318 - 1263) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1258 - 1205) + chr(0b101011 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(53) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(0b110011) + chr(51) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(10995 - 10884) + chr(0b101 + 0o54) + chr(0b101100 + 0o13) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(1347 - 1299) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1100110 + 0o11) + '\x33' + chr(0b10010 + 0o44) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1001010 + 0o45) + chr(2000 - 1949) + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(996 - 947) + chr(0b110001) + '\x35', 15729 - 15721), ehT0Px3KOsy9(chr(0b110000) + chr(4902 - 4791) + chr(0b10001 + 0o41) + chr(0b101010 + 0o15) + chr(1145 - 1096), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(2085 - 2035) + '\x30', 56278 - 56270), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b101111 + 0o100) + chr(0b1011 + 0o47) + chr(48) + chr(0b110 + 0o53), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\062' + chr(0b10001 + 0o44) + chr(50), 8), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(49) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\064' + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + chr(0b110001) + '\063' + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b100111 + 0o17) + chr(943 - 888), 8), ehT0Px3KOsy9(chr(2126 - 2078) + chr(12071 - 11960) + '\x31' + chr(522 - 472) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(5133 - 5022) + chr(0b110001) + '\x37' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b1110 + 0o44) + chr(55) + chr(0b10001 + 0o41), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\061' + '\065' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10110 + 0o34) + '\x33' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + chr(51) + '\062' + '\x37', 33498 - 33490), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\067' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(458 - 409) + chr(1042 - 987) + '\064', 8), ehT0Px3KOsy9('\060' + chr(8075 - 7964) + '\063' + chr(52) + chr(814 - 760), 0o10), ehT0Px3KOsy9(chr(2065 - 2017) + '\x6f' + chr(0b11101 + 0o25) + '\x37' + '\x32', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2229 - 2179) + chr(0b110101 + 0o2) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(904 - 856) + chr(3792 - 3681) + chr(1018 - 969) + chr(48) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2499 - 2448) + chr(49) + chr(54), 62012 - 62004), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11101 + 0o32) + '\060', 9041 - 9033), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(0b1100 + 0o53) + chr(0b110101), 8), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(2412 - 2359) + chr(53), 34359 - 34351), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + '\063' + chr(657 - 609), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b100100 + 0o113) + chr(0b110101) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2'), '\144' + '\x65' + '\x63' + '\x6f' + chr(0b1101 + 0o127) + chr(0b1100101))(chr(0b10 + 0o163) + '\x74' + chr(0b101011 + 0o73) + '\x2d' + chr(2052 - 1996)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def n5vFg_I1o1WL(wF9nmvjsKjYM, uICaXvjWrxGa, ygu_6heT37hV=-ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(2264 - 2215), 0o10)):
if uICaXvjWrxGa == 0.0:
Isx8k9uq36YR = qypPRW8fq869(wF9nmvjsKjYM)
ZVhyXLrjMqpt = IDJ2eXGCBCDu.argmax(IDJ2eXGCBCDu.reshape(wF9nmvjsKjYM, [-ehT0Px3KOsy9(chr(1060 - 1012) + '\x6f' + chr(776 - 727), 8), Isx8k9uq36YR[-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001), 8)]]), axis=ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061', 8))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9e\x929;e\xce\xd8'), chr(7800 - 7700) + chr(0b111101 + 0o50) + chr(0b1100000 + 0o3) + chr(0b1101111) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1110100) + '\x66' + '\055' + chr(0b100111 + 0o21)))(ZVhyXLrjMqpt, Isx8k9uq36YR[:-ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8)])
else:
assert uICaXvjWrxGa > 0.0
if ygu_6heT37hV != -ehT0Px3KOsy9('\060' + '\157' + chr(0b1 + 0o60), 8):
if ygu_6heT37hV <= ehT0Px3KOsy9(chr(48) + '\157' + chr(0b111 + 0o51), ord("\x08")):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"\x9f\x96'#h\xd7\xd3J\xf5\xb7\x1c\xa2\x86\xac9\xd6 \xde\xc1\xe9\x8f,\x84 \\\xdf\x00\xee\xbf\x1f\x0e\xc6\xd8\xdac\xe3\t\x9d\xc2j\xcc\x87% m\xca\xd4[\xcf\xf2"), '\144' + chr(4061 - 3960) + chr(99) + '\157' + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(1083 - 967) + chr(0b1100010 + 0o4) + chr(45) + chr(0b101100 + 0o14)))
CeyMIoSyrpkQ = qypPRW8fq869(wF9nmvjsKjYM)[ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49), 8)]
WT3A5vfIqkW8 = IDJ2eXGCBCDu.contrib.nn.nth_element(wF9nmvjsKjYM, n=ygu_6heT37hV, reverse=ehT0Px3KOsy9('\060' + chr(4740 - 4629) + '\061', 8))
WT3A5vfIqkW8 = IDJ2eXGCBCDu.tile(IDJ2eXGCBCDu.reshape(WT3A5vfIqkW8, [-ehT0Px3KOsy9('\x30' + chr(8156 - 8045) + chr(49), 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + chr(400 - 351), 8)]), [ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + '\x31', 8), CeyMIoSyrpkQ])
wF9nmvjsKjYM = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.less_equal(wF9nmvjsKjYM, WT3A5vfIqkW8), IDJ2eXGCBCDu.ones_like(wF9nmvjsKjYM) * -1000000.0, wF9nmvjsKjYM)
Wpf5bhZujfAz = IDJ2eXGCBCDu.reshape(wF9nmvjsKjYM, [-ehT0Px3KOsy9(chr(2179 - 2131) + chr(111) + chr(0b110001), 8), qypPRW8fq869(wF9nmvjsKjYM)[-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1423 - 1374), 8)]]) / uICaXvjWrxGa
XPnoMuK4S7nS = IDJ2eXGCBCDu.multinomial(Wpf5bhZujfAz, ehT0Px3KOsy9('\x30' + '\x6f' + chr(807 - 758), 8))
XPnoMuK4S7nS = IDJ2eXGCBCDu.reshape(XPnoMuK4S7nS, qypPRW8fq869(wF9nmvjsKjYM)[:wF9nmvjsKjYM.get_shape().ndims - ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001), 8)])
return XPnoMuK4S7nS
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
ones_matrix_band_part
|
def ones_matrix_band_part(rows, cols, num_lower, num_upper, out_shape=None):
"""Matrix band part of ones.
Args:
rows: int determining number of rows in output
cols: int
num_lower: int, maximum distance backward. Negative values indicate
unlimited.
num_upper: int, maximum distance forward. Negative values indicate
unlimited.
out_shape: shape to reshape output by.
Returns:
Tensor of size rows * cols reshaped into shape out_shape.
"""
if all([isinstance(el, int) for el in [rows, cols, num_lower, num_upper]]):
# Needed info is constant, so we construct in numpy
if num_lower < 0:
num_lower = rows - 1
if num_upper < 0:
num_upper = cols - 1
lower_mask = np.tri(cols, rows, num_lower).T
upper_mask = np.tri(rows, cols, num_upper)
band = np.ones((rows, cols)) * lower_mask * upper_mask
if out_shape:
band = band.reshape(out_shape)
band = tf.constant(band, tf.float32)
else:
band = tf.matrix_band_part(
tf.ones([rows, cols]), tf.cast(num_lower, tf.int64),
tf.cast(num_upper, tf.int64))
if out_shape:
band = tf.reshape(band, out_shape)
return band
|
python
|
def ones_matrix_band_part(rows, cols, num_lower, num_upper, out_shape=None):
"""Matrix band part of ones.
Args:
rows: int determining number of rows in output
cols: int
num_lower: int, maximum distance backward. Negative values indicate
unlimited.
num_upper: int, maximum distance forward. Negative values indicate
unlimited.
out_shape: shape to reshape output by.
Returns:
Tensor of size rows * cols reshaped into shape out_shape.
"""
if all([isinstance(el, int) for el in [rows, cols, num_lower, num_upper]]):
# Needed info is constant, so we construct in numpy
if num_lower < 0:
num_lower = rows - 1
if num_upper < 0:
num_upper = cols - 1
lower_mask = np.tri(cols, rows, num_lower).T
upper_mask = np.tri(rows, cols, num_upper)
band = np.ones((rows, cols)) * lower_mask * upper_mask
if out_shape:
band = band.reshape(out_shape)
band = tf.constant(band, tf.float32)
else:
band = tf.matrix_band_part(
tf.ones([rows, cols]), tf.cast(num_lower, tf.int64),
tf.cast(num_upper, tf.int64))
if out_shape:
band = tf.reshape(band, out_shape)
return band
|
[
"def",
"ones_matrix_band_part",
"(",
"rows",
",",
"cols",
",",
"num_lower",
",",
"num_upper",
",",
"out_shape",
"=",
"None",
")",
":",
"if",
"all",
"(",
"[",
"isinstance",
"(",
"el",
",",
"int",
")",
"for",
"el",
"in",
"[",
"rows",
",",
"cols",
",",
"num_lower",
",",
"num_upper",
"]",
"]",
")",
":",
"# Needed info is constant, so we construct in numpy",
"if",
"num_lower",
"<",
"0",
":",
"num_lower",
"=",
"rows",
"-",
"1",
"if",
"num_upper",
"<",
"0",
":",
"num_upper",
"=",
"cols",
"-",
"1",
"lower_mask",
"=",
"np",
".",
"tri",
"(",
"cols",
",",
"rows",
",",
"num_lower",
")",
".",
"T",
"upper_mask",
"=",
"np",
".",
"tri",
"(",
"rows",
",",
"cols",
",",
"num_upper",
")",
"band",
"=",
"np",
".",
"ones",
"(",
"(",
"rows",
",",
"cols",
")",
")",
"*",
"lower_mask",
"*",
"upper_mask",
"if",
"out_shape",
":",
"band",
"=",
"band",
".",
"reshape",
"(",
"out_shape",
")",
"band",
"=",
"tf",
".",
"constant",
"(",
"band",
",",
"tf",
".",
"float32",
")",
"else",
":",
"band",
"=",
"tf",
".",
"matrix_band_part",
"(",
"tf",
".",
"ones",
"(",
"[",
"rows",
",",
"cols",
"]",
")",
",",
"tf",
".",
"cast",
"(",
"num_lower",
",",
"tf",
".",
"int64",
")",
",",
"tf",
".",
"cast",
"(",
"num_upper",
",",
"tf",
".",
"int64",
")",
")",
"if",
"out_shape",
":",
"band",
"=",
"tf",
".",
"reshape",
"(",
"band",
",",
"out_shape",
")",
"return",
"band"
] |
Matrix band part of ones.
Args:
rows: int determining number of rows in output
cols: int
num_lower: int, maximum distance backward. Negative values indicate
unlimited.
num_upper: int, maximum distance forward. Negative values indicate
unlimited.
out_shape: shape to reshape output by.
Returns:
Tensor of size rows * cols reshaped into shape out_shape.
|
[
"Matrix",
"band",
"part",
"of",
"ones",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3000-L3034
|
train
|
Matrix band part of ones.
|
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,sR2s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CAbiJWkL,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(1977 - 1929) + chr(0b1101111) + '\x32' + '\x36' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x36' + chr(2259 - 2208), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1000 + 0o52) + chr(50) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100101 + 0o15) + chr(998 - 946) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100110 + 0o13) + chr(0b1100 + 0o45) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1906 - 1857) + '\x31', 1381 - 1373), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(2366 - 2255) + chr(51) + chr(911 - 863) + chr(0b110111), 46667 - 46659), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(2066 - 2017) + chr(1164 - 1112) + chr(1280 - 1230), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001100 + 0o43) + '\x33' + '\x34', 26235 - 26227), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1100111 + 0o10) + chr(0b110011) + chr(1214 - 1162) + chr(0b10010 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(1710 - 1662) + chr(0b1101111) + chr(1044 - 993) + chr(0b110000 + 0o2) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x34' + chr(1041 - 992), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(1705 - 1653) + '\060', 1984 - 1976), ehT0Px3KOsy9(chr(1101 - 1053) + chr(111) + chr(0b101001 + 0o10) + '\066' + '\x30', 12913 - 12905), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(883 - 834) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b11110 + 0o27) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1527 - 1478) + chr(1337 - 1287) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(0b100000 + 0o27) + chr(2573 - 2521), 53095 - 53087), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11101 + 0o24) + '\x36' + chr(0b1111 + 0o45), 27843 - 27835), ehT0Px3KOsy9(chr(1125 - 1077) + chr(0b1000110 + 0o51) + chr(0b1110 + 0o44) + '\062' + chr(0b110000), 8), ehT0Px3KOsy9(chr(340 - 292) + chr(5114 - 5003) + '\x32' + chr(1280 - 1227) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(2271 - 2220) + chr(0b11110 + 0o23) + chr(1839 - 1787), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b100110 + 0o14) + '\x37', 8), ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + '\061' + chr(0b110011) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b110001) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(2483 - 2372) + chr(1897 - 1848) + '\x33' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b1010 + 0o54) + chr(48), 0o10), ehT0Px3KOsy9(chr(1913 - 1865) + chr(0b11111 + 0o120) + '\x31', 0o10), ehT0Px3KOsy9(chr(595 - 547) + chr(0b111001 + 0o66) + chr(0b100101 + 0o14) + chr(0b11101 + 0o27), 5928 - 5920), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(52) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101111 + 0o4) + chr(0b110110) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(55) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b10000 + 0o45) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + chr(0b10111 + 0o37) + chr(0b100100 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\157' + chr(2448 - 2397) + '\063' + chr(0b100001 + 0o17), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\061' + chr(475 - 422), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(55) + chr(0b110100), 32987 - 32979), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110 + 0o53) + chr(162 - 112) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8365 - 8254) + '\x32' + chr(53) + chr(1563 - 1514), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1587 - 1536) + chr(1504 - 1452) + chr(0b11111 + 0o21), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + chr(0b10000 + 0o40), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f'), chr(3655 - 3555) + chr(1415 - 1314) + chr(0b100011 + 0o100) + chr(9571 - 9460) + '\x64' + '\x65')(chr(117) + chr(0b111000 + 0o74) + chr(0b1100110) + '\055' + chr(1615 - 1559)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def tBWNBiW7gQoN(rAoIgjmAxUis, AIgvIWQd9onz, a5laCBwaNT1i, qJRxzs_Pjob3, wjefSqyQUekw=None):
if Dl48nj1rbi23([PlSM16l2KDPD(cWbTN_IfhLP1, ehT0Px3KOsy9) for cWbTN_IfhLP1 in [rAoIgjmAxUis, AIgvIWQd9onz, a5laCBwaNT1i, qJRxzs_Pjob3]]):
if a5laCBwaNT1i < ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110000), ord("\x08")):
a5laCBwaNT1i = rAoIgjmAxUis - ehT0Px3KOsy9('\x30' + chr(2474 - 2363) + '\x31', 8)
if qJRxzs_Pjob3 < ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(1795 - 1684) + '\x30', 8):
qJRxzs_Pjob3 = AIgvIWQd9onz - ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1110 + 0o43), 8)
v_c30DSbehEt = WqUC3KWvYVup.tri(AIgvIWQd9onz, rAoIgjmAxUis, a5laCBwaNT1i).T
dzLMUFuDh2oC = WqUC3KWvYVup.tri(rAoIgjmAxUis, AIgvIWQd9onz, qJRxzs_Pjob3)
qPae4yutWzz4 = WqUC3KWvYVup.ones((rAoIgjmAxUis, AIgvIWQd9onz)) * v_c30DSbehEt * dzLMUFuDh2oC
if wjefSqyQUekw:
qPae4yutWzz4 = qPae4yutWzz4.reshape(wjefSqyQUekw)
qPae4yutWzz4 = IDJ2eXGCBCDu.constant(qPae4yutWzz4, IDJ2eXGCBCDu.float32)
else:
qPae4yutWzz4 = IDJ2eXGCBCDu.matrix_band_part(IDJ2eXGCBCDu.ones([rAoIgjmAxUis, AIgvIWQd9onz]), IDJ2eXGCBCDu.cast(a5laCBwaNT1i, IDJ2eXGCBCDu.int64), IDJ2eXGCBCDu.cast(qJRxzs_Pjob3, IDJ2eXGCBCDu.int64))
if wjefSqyQUekw:
qPae4yutWzz4 = IDJ2eXGCBCDu.reshape(qPae4yutWzz4, wjefSqyQUekw)
return qPae4yutWzz4
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
reshape_like_all_dims
|
def reshape_like_all_dims(a, b):
"""Reshapes a to match the shape of b."""
ret = tf.reshape(a, tf.shape(b))
if not tf.executing_eagerly():
ret.set_shape(b.get_shape())
return ret
|
python
|
def reshape_like_all_dims(a, b):
"""Reshapes a to match the shape of b."""
ret = tf.reshape(a, tf.shape(b))
if not tf.executing_eagerly():
ret.set_shape(b.get_shape())
return ret
|
[
"def",
"reshape_like_all_dims",
"(",
"a",
",",
"b",
")",
":",
"ret",
"=",
"tf",
".",
"reshape",
"(",
"a",
",",
"tf",
".",
"shape",
"(",
"b",
")",
")",
"if",
"not",
"tf",
".",
"executing_eagerly",
"(",
")",
":",
"ret",
".",
"set_shape",
"(",
"b",
".",
"get_shape",
"(",
")",
")",
"return",
"ret"
] |
Reshapes a to match the shape of b.
|
[
"Reshapes",
"a",
"to",
"match",
"the",
"shape",
"of",
"b",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3037-L3042
|
train
|
Reshapes a to match the shape of b.
|
Pu7Z6IJC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ZqKLA6,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) + '\062' + chr(54) + chr(1252 - 1198), 27515 - 27507), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001010 + 0o45) + chr(0b100100 + 0o15) + chr(0b10100 + 0o42) + chr(50), 0b1000), ehT0Px3KOsy9(chr(823 - 775) + chr(0b1101111) + chr(1534 - 1483) + chr(55) + '\063', 0o10), ehT0Px3KOsy9(chr(1384 - 1336) + '\x6f' + chr(0b110011) + chr(0b11010 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101101 + 0o5) + chr(0b11111 + 0o23) + chr(0b11011 + 0o30), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\x31' + '\067', 0o10), ehT0Px3KOsy9(chr(716 - 668) + '\157' + chr(0b110010) + '\x34' + '\065', 48801 - 48793), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(770 - 715) + chr(0b100111 + 0o12), 51852 - 51844), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(0b110000) + chr(748 - 700), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b110010) + chr(0b11011 + 0o32) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5396 - 5285) + '\063' + '\067' + chr(311 - 262), 8), ehT0Px3KOsy9(chr(0b110000) + chr(3053 - 2942) + chr(1444 - 1393) + chr(55) + chr(0b110100), 12629 - 12621), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\064' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6348 - 6237) + chr(0b110011) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b10110 + 0o131) + chr(2293 - 2244) + chr(50) + chr(0b10001 + 0o41), 0o10), ehT0Px3KOsy9(chr(2145 - 2097) + chr(12252 - 12141) + chr(51) + chr(0b110100) + chr(2015 - 1967), 0o10), ehT0Px3KOsy9(chr(2299 - 2251) + chr(2881 - 2770) + chr(51) + '\064' + '\065', 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + '\063' + chr(51) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2238 - 2127) + chr(0b1100 + 0o53) + chr(52), 57382 - 57374), ehT0Px3KOsy9(chr(97 - 49) + '\157' + chr(50) + chr(48) + '\x35', 0b1000), ehT0Px3KOsy9(chr(1895 - 1847) + chr(0b1101111) + '\x33' + chr(0b110100) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b101111 + 0o3) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(4021 - 3910) + chr(0b1000 + 0o53) + chr(1719 - 1665), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(662 - 608) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1000111 + 0o50) + chr(0b1001 + 0o51) + '\x30' + chr(237 - 186), 44493 - 44485), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + chr(0b10101 + 0o34) + '\063' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101001 + 0o6) + chr(840 - 789) + chr(49) + '\x30', 61449 - 61441), ehT0Px3KOsy9('\060' + chr(111) + chr(475 - 421) + '\064', 62325 - 62317), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(0b110110) + chr(2955 - 2900), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10974 - 10863) + '\063' + chr(0b11 + 0o61), 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + '\x33' + chr(1844 - 1795) + '\064', 0o10), ehT0Px3KOsy9(chr(1040 - 992) + '\157' + '\x32' + chr(48) + chr(0b11100 + 0o25), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(1766 - 1715) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(2026 - 1915) + chr(0b1001 + 0o53) + chr(0b11100 + 0o25), 38815 - 38807), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(1975 - 1864) + chr(0b110010) + chr(0b10 + 0o63) + chr(0b100011 + 0o17), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + chr(50) + '\x30' + chr(1922 - 1869), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + '\062' + '\062', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(0b110111) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(5022 - 4911) + chr(1783 - 1733) + '\x33' + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1125 - 1071) + chr(0b110001 + 0o4), 49240 - 49232)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(6342 - 6231) + chr(53) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x98'), chr(7859 - 7759) + chr(0b1101 + 0o130) + '\x63' + chr(0b100101 + 0o112) + chr(0b1100100) + chr(101))('\165' + '\164' + chr(0b1011110 + 0o10) + chr(0b101101) + chr(0b101010 + 0o16)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Bmv1k1pgxaj1(XPh1qbAgrPgG, wmN3dvez4qzC):
VHn4CV4Ymrei = IDJ2eXGCBCDu.reshape(XPh1qbAgrPgG, IDJ2eXGCBCDu.nauYfLglTpcb(wmN3dvez4qzC))
if not xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3\n\x9e}\xe6;\xcc\x97\xa7\xf2\x9c\x9dGy \x8c\x9c'), chr(0b10000 + 0o124) + '\x65' + chr(99) + '\157' + chr(100) + '\145')(chr(3974 - 3857) + '\x74' + chr(0b1100110) + '\x2d' + '\x38'))():
xafqLlk3kkUe(VHn4CV4Ymrei, xafqLlk3kkUe(SXOLrMavuUCe(b"\xc5\x17\x8fA\xe0'\xc4\x89\xa5"), chr(0b1100100) + '\x65' + '\x63' + chr(0b1100111 + 0o10) + chr(100) + chr(3639 - 3538))('\x75' + chr(0b101010 + 0o112) + chr(9906 - 9804) + chr(0b101101) + chr(0b100111 + 0o21)))(xafqLlk3kkUe(wmN3dvez4qzC, xafqLlk3kkUe(SXOLrMavuUCe(b"\xd1\x17\x8fA\xe0'\xc4\x89\xa5"), '\x64' + chr(0b1011001 + 0o14) + '\x63' + '\157' + '\144' + chr(0b1100101))('\x75' + '\164' + '\x66' + chr(45) + chr(553 - 497)))())
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
recompute_grad
|
def recompute_grad(fn):
"""Decorator that recomputes the function on the backwards pass.
Args:
fn: a function that takes Tensors (all as positional arguments) and returns
a tuple of Tensors.
Returns:
A wrapped fn that is identical to fn when called, but its activations will
be discarded and recomputed on the backwards pass (i.e. on a call to
tf.gradients).
"""
@functools.wraps(fn)
def wrapped(*args):
return _recompute_grad(fn, args)
return wrapped
|
python
|
def recompute_grad(fn):
"""Decorator that recomputes the function on the backwards pass.
Args:
fn: a function that takes Tensors (all as positional arguments) and returns
a tuple of Tensors.
Returns:
A wrapped fn that is identical to fn when called, but its activations will
be discarded and recomputed on the backwards pass (i.e. on a call to
tf.gradients).
"""
@functools.wraps(fn)
def wrapped(*args):
return _recompute_grad(fn, args)
return wrapped
|
[
"def",
"recompute_grad",
"(",
"fn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"wrapped",
"(",
"*",
"args",
")",
":",
"return",
"_recompute_grad",
"(",
"fn",
",",
"args",
")",
"return",
"wrapped"
] |
Decorator that recomputes the function on the backwards pass.
Args:
fn: a function that takes Tensors (all as positional arguments) and returns
a tuple of Tensors.
Returns:
A wrapped fn that is identical to fn when called, but its activations will
be discarded and recomputed on the backwards pass (i.e. on a call to
tf.gradients).
|
[
"Decorator",
"that",
"recomputes",
"the",
"function",
"on",
"the",
"backwards",
"pass",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3045-L3062
|
train
|
Decorator that recomputes the gradient of a function on the backwards pass.
|
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,SBRjvOU1ufV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nh40_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(710 - 660) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1502 - 1454) + chr(1024 - 913) + chr(0b110010) + chr(0b110111) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(736 - 683) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1100 + 0o143) + chr(1984 - 1934) + chr(0b10010 + 0o41) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(50) + chr(2073 - 2018), 0b1000), ehT0Px3KOsy9(chr(2197 - 2149) + '\x6f' + '\x32' + '\062' + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110001) + chr(498 - 449), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1966 - 1916) + chr(0b110001) + '\060', 0b1000), ehT0Px3KOsy9(chr(942 - 894) + chr(4014 - 3903) + chr(0b100 + 0o57) + chr(0b110000) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1 + 0o156) + chr(0b110011) + '\x31' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(10519 - 10408) + chr(50) + chr(51) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(5693 - 5582) + chr(555 - 504) + chr(0b110100) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + '\066' + chr(0b110110), 24854 - 24846), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + chr(0b110011 + 0o0) + chr(0b100100 + 0o14) + chr(0b110000), 38903 - 38895), ehT0Px3KOsy9(chr(0b110000) + chr(8639 - 8528) + '\x32' + '\x33' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(50) + chr(55) + chr(1175 - 1126), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001100 + 0o43) + '\061' + '\065' + '\x33', 3825 - 3817), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(734 - 684) + '\x36' + chr(0b110100), 10822 - 10814), ehT0Px3KOsy9(chr(1984 - 1936) + chr(0b1010000 + 0o37) + chr(791 - 741) + chr(0b10101 + 0o37) + chr(2091 - 2038), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(51) + chr(826 - 773), 0b1000), ehT0Px3KOsy9(chr(1875 - 1827) + chr(0b11000 + 0o127) + '\x31' + chr(0b110000) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1900 - 1852) + chr(0b1101111) + chr(417 - 368) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11000 + 0o127) + '\063' + chr(51) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(871 - 821) + '\x34' + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + chr(1703 - 1592) + chr(0b100 + 0o57) + chr(0b11111 + 0o27) + chr(0b110000 + 0o2), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x34' + chr(0b11 + 0o60), 0o10), ehT0Px3KOsy9('\x30' + chr(0b10 + 0o155) + chr(49) + chr(0b101011 + 0o14), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10000 + 0o41) + chr(2985 - 2930) + '\066', 18166 - 18158), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101000 + 0o7) + chr(2119 - 2067) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(0b110011) + chr(51) + chr(1428 - 1375), 8), ehT0Px3KOsy9('\x30' + chr(9550 - 9439) + '\x32' + chr(0b110010) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2260 - 2149) + chr(0b100001 + 0o20) + '\065' + chr(50), 7666 - 7658), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(0b10110 + 0o40) + '\061', 50356 - 50348), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(7267 - 7156) + chr(0b110011) + '\064' + chr(0b1011 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(0b100 + 0o57) + chr(50) + chr(0b110111), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1111 + 0o42) + chr(0b1110 + 0o42) + chr(498 - 450), 36262 - 36254), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + chr(0b110010) + chr(0b1111 + 0o50) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(1417 - 1363) + chr(0b101 + 0o54), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(773 - 724) + chr(0b11101 + 0o32) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9651 - 9540) + chr(1216 - 1167) + '\x34' + chr(0b110011), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + '\065' + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'y'), chr(100) + chr(101) + chr(0b1100011) + chr(0b1101111) + '\144' + '\x65')('\165' + chr(10319 - 10203) + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mQ6JXoUNxTzH(wDsB9Ho570J9):
@xafqLlk3kkUe(E6ula8_Zv1yl, xafqLlk3kkUe(SXOLrMavuUCe(b'4\xeeg\xfa\x9a\xc8\xaf\xd1\xf6\x86\xf5\xd1'), '\x64' + chr(0b1100101) + '\143' + chr(111) + chr(0b1100100) + chr(0b1010000 + 0o25))(chr(0b100 + 0o161) + chr(116) + chr(0b101001 + 0o75) + '\055' + '\x38'))(wDsB9Ho570J9)
def BoeK7hZPPy4I(*kJDRfRhcZHjS):
return jWYAIAN_TS0l(wDsB9Ho570J9, kJDRfRhcZHjS)
return BoeK7hZPPy4I
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
_recompute_grad
|
def _recompute_grad(fn, args):
"""See recompute_grad."""
cached_vs = []
cached_arg_scope = []
def grad_fn(inputs, variables, outputs, output_grads):
"""Recompute outputs for gradient computation."""
del outputs
variables = [underlying_variable_ref(v) for v in variables]
# Recompute outputs
with tf.control_dependencies(output_grads):
with tf.contrib.framework.arg_scope(cached_arg_scope[0]):
with tf.variable_scope(cached_vs[0], reuse=True):
outputs = fn(*inputs)
if not isinstance(outputs, (list, tuple)):
outputs = [outputs]
outputs = list(outputs)
grads = tf.gradients(outputs, inputs + variables, output_grads)
grad_inputs = grads[:len(inputs)]
grad_vars = grads[len(inputs):]
# TODO(rsepassi): Make fn_with_custom_grad work with bfloat16.
# If the input gradients are bfloat16, it's assumed the variables are
# bfloat16. This is a hack to ensure that grad_vars are the right type.
if grad_inputs[0].dtype == tf.bfloat16:
grad_vars = [tf.cast(grad_var, tf.bfloat16) for grad_var in grad_vars]
return grad_inputs, grad_vars
@fn_with_custom_grad(grad_fn)
def fn_with_recompute(*args):
cached_vs.append(tf.get_variable_scope())
cached_arg_scope.append(tf.contrib.framework.current_arg_scope())
return fn(*args)
return fn_with_recompute(*args)
|
python
|
def _recompute_grad(fn, args):
"""See recompute_grad."""
cached_vs = []
cached_arg_scope = []
def grad_fn(inputs, variables, outputs, output_grads):
"""Recompute outputs for gradient computation."""
del outputs
variables = [underlying_variable_ref(v) for v in variables]
# Recompute outputs
with tf.control_dependencies(output_grads):
with tf.contrib.framework.arg_scope(cached_arg_scope[0]):
with tf.variable_scope(cached_vs[0], reuse=True):
outputs = fn(*inputs)
if not isinstance(outputs, (list, tuple)):
outputs = [outputs]
outputs = list(outputs)
grads = tf.gradients(outputs, inputs + variables, output_grads)
grad_inputs = grads[:len(inputs)]
grad_vars = grads[len(inputs):]
# TODO(rsepassi): Make fn_with_custom_grad work with bfloat16.
# If the input gradients are bfloat16, it's assumed the variables are
# bfloat16. This is a hack to ensure that grad_vars are the right type.
if grad_inputs[0].dtype == tf.bfloat16:
grad_vars = [tf.cast(grad_var, tf.bfloat16) for grad_var in grad_vars]
return grad_inputs, grad_vars
@fn_with_custom_grad(grad_fn)
def fn_with_recompute(*args):
cached_vs.append(tf.get_variable_scope())
cached_arg_scope.append(tf.contrib.framework.current_arg_scope())
return fn(*args)
return fn_with_recompute(*args)
|
[
"def",
"_recompute_grad",
"(",
"fn",
",",
"args",
")",
":",
"cached_vs",
"=",
"[",
"]",
"cached_arg_scope",
"=",
"[",
"]",
"def",
"grad_fn",
"(",
"inputs",
",",
"variables",
",",
"outputs",
",",
"output_grads",
")",
":",
"\"\"\"Recompute outputs for gradient computation.\"\"\"",
"del",
"outputs",
"variables",
"=",
"[",
"underlying_variable_ref",
"(",
"v",
")",
"for",
"v",
"in",
"variables",
"]",
"# Recompute outputs",
"with",
"tf",
".",
"control_dependencies",
"(",
"output_grads",
")",
":",
"with",
"tf",
".",
"contrib",
".",
"framework",
".",
"arg_scope",
"(",
"cached_arg_scope",
"[",
"0",
"]",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"cached_vs",
"[",
"0",
"]",
",",
"reuse",
"=",
"True",
")",
":",
"outputs",
"=",
"fn",
"(",
"*",
"inputs",
")",
"if",
"not",
"isinstance",
"(",
"outputs",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"outputs",
"=",
"[",
"outputs",
"]",
"outputs",
"=",
"list",
"(",
"outputs",
")",
"grads",
"=",
"tf",
".",
"gradients",
"(",
"outputs",
",",
"inputs",
"+",
"variables",
",",
"output_grads",
")",
"grad_inputs",
"=",
"grads",
"[",
":",
"len",
"(",
"inputs",
")",
"]",
"grad_vars",
"=",
"grads",
"[",
"len",
"(",
"inputs",
")",
":",
"]",
"# TODO(rsepassi): Make fn_with_custom_grad work with bfloat16.",
"# If the input gradients are bfloat16, it's assumed the variables are",
"# bfloat16. This is a hack to ensure that grad_vars are the right type.",
"if",
"grad_inputs",
"[",
"0",
"]",
".",
"dtype",
"==",
"tf",
".",
"bfloat16",
":",
"grad_vars",
"=",
"[",
"tf",
".",
"cast",
"(",
"grad_var",
",",
"tf",
".",
"bfloat16",
")",
"for",
"grad_var",
"in",
"grad_vars",
"]",
"return",
"grad_inputs",
",",
"grad_vars",
"@",
"fn_with_custom_grad",
"(",
"grad_fn",
")",
"def",
"fn_with_recompute",
"(",
"*",
"args",
")",
":",
"cached_vs",
".",
"append",
"(",
"tf",
".",
"get_variable_scope",
"(",
")",
")",
"cached_arg_scope",
".",
"append",
"(",
"tf",
".",
"contrib",
".",
"framework",
".",
"current_arg_scope",
"(",
")",
")",
"return",
"fn",
"(",
"*",
"args",
")",
"return",
"fn_with_recompute",
"(",
"*",
"args",
")"
] |
See recompute_grad.
|
[
"See",
"recompute_grad",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3065-L3100
|
train
|
Recompute gradients for gradient computation.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvso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vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1905 - 1857) + chr(7663 - 7552) + '\061' + chr(0b10000 + 0o44) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + '\x35' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(6803 - 6692) + chr(53) + chr(1408 - 1355), 8606 - 8598), ehT0Px3KOsy9('\x30' + chr(0b1011011 + 0o24) + chr(2147 - 2096) + '\066' + chr(0b100100 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(133 - 83) + chr(2262 - 2209), ord("\x08")), ehT0Px3KOsy9(chr(834 - 786) + '\157' + chr(50) + chr(50) + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b100001 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b10100 + 0o133) + '\x33' + chr(49) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b11011 + 0o124) + '\062' + chr(0b10101 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(12148 - 12037) + chr(0b110010) + chr(54) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1821 - 1773) + chr(10547 - 10436) + chr(1615 - 1564) + '\064' + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\062' + '\x35' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110101) + chr(0b11101 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\x32' + chr(1368 - 1319) + chr(766 - 717), 54288 - 54280), ehT0Px3KOsy9(chr(384 - 336) + chr(10763 - 10652) + '\x32' + chr(0b110111) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + '\x33' + '\061' + '\063', 11211 - 11203), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b110011) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5489 - 5378) + '\x33' + chr(0b110110) + chr(0b1110 + 0o43), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2615 - 2504) + chr(0b110010) + chr(0b110010 + 0o2) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1001011 + 0o44) + chr(614 - 565) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b111 + 0o57) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\x37' + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + chr(2230 - 2181) + chr(1554 - 1506) + '\065', 48866 - 48858), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b110100) + chr(1176 - 1121), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2129 - 2080) + '\x34' + chr(2045 - 1993), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\066' + chr(0b100010 + 0o21), 0o10), ehT0Px3KOsy9(chr(773 - 725) + chr(11699 - 11588) + chr(49) + chr(1399 - 1348) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\066' + chr(2302 - 2253), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b101 + 0o56) + chr(0b110001) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(428 - 317) + '\x31' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\063' + chr(0b111 + 0o52), 8), ehT0Px3KOsy9(chr(1480 - 1432) + chr(0b1101111) + chr(49) + chr(0b1101 + 0o50) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010 + 0o0) + chr(0b110011) + chr(503 - 449), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11110 + 0o121) + '\x32' + '\064' + chr(386 - 337), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(2131 - 2020) + chr(51) + '\x31' + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(48) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(104 - 53) + chr(0b11110 + 0o23) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + '\062' + '\x34' + chr(1210 - 1161), 8), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(1145 - 1096) + chr(0b110010) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(1713 - 1602) + '\063' + '\x33' + '\066', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(6864 - 6753) + chr(0b10101 + 0o40) + chr(2049 - 2001), 44450 - 44442)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'M'), chr(4894 - 4794) + chr(0b1100101) + '\143' + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(0b1001101 + 0o50) + chr(116) + '\x66' + chr(0b101101) + chr(0b100 + 0o64)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def jWYAIAN_TS0l(wDsB9Ho570J9, kJDRfRhcZHjS):
ouX3T2UoatOL = []
RCrn4lp7hGWQ = []
def mOK0n0L9FPZ0(vXoupepMtCXU, DaDu8eJMPmzT, Dx_DllZ8uCko, BdyBBK1MBgYM):
del Dx_DllZ8uCko
DaDu8eJMPmzT = [qfjiM2fc8GSi(cMbll0QYhULo) for cMbll0QYhULo in DaDu8eJMPmzT]
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\xc3C\x82g\xfa}\x93r\xd3\x94\xcbA\xed\xdd\xa5:\x98\xc7z'), '\x64' + '\145' + chr(0b110000 + 0o63) + '\x6f' + chr(0b1100100) + chr(5677 - 5576))('\x75' + '\x74' + chr(0b1100110) + chr(0b10110 + 0o27) + chr(2449 - 2393)))(BdyBBK1MBgYM):
with xafqLlk3kkUe(IDJ2eXGCBCDu.contrib.framework, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xdeJ\xa9f\xf6~\xbcs'), chr(0b1100100) + chr(0b1100101) + chr(0b10 + 0o141) + chr(111) + chr(3352 - 3252) + '\145')(chr(3951 - 3834) + chr(0b1110100) + chr(102) + '\x2d' + chr(116 - 60)))(RCrn4lp7hGWQ[ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b11000 + 0o127) + chr(48), 0o10)]):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\xcd_\x9ft\xf7}\xa9I\xc5\x87\xc1_\xec'), '\x64' + chr(101) + chr(99) + '\157' + '\x64' + '\x65')('\x75' + chr(11374 - 11258) + chr(9235 - 9133) + '\055' + chr(2463 - 2407)))(ouX3T2UoatOL[ehT0Px3KOsy9('\060' + chr(111) + '\060', 8)], reuse=ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 0o10)):
Dx_DllZ8uCko = wDsB9Ho570J9(*vXoupepMtCXU)
if not PlSM16l2KDPD(Dx_DllZ8uCko, (YyaZ4tpXu4lf, KNyTy8rYcwji)):
Dx_DllZ8uCko = [Dx_DllZ8uCko]
Dx_DllZ8uCko = YyaZ4tpXu4lf(Dx_DllZ8uCko)
W1s0NiRRDIwA = IDJ2eXGCBCDu.gradients(Dx_DllZ8uCko, vXoupepMtCXU + DaDu8eJMPmzT, BdyBBK1MBgYM)
yuSXpDt_ejO4 = W1s0NiRRDIwA[:c2A0yzQpDQB3(vXoupepMtCXU)]
VHg_4JGTyJv5 = W1s0NiRRDIwA[c2A0yzQpDQB3(vXoupepMtCXU):]
if xafqLlk3kkUe(yuSXpDt_ejO4[ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + '\060', 8)], xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xff{\xcf\\\xde\x7f\xa9{\xfe\xd3\xe5'), chr(0b110010 + 0o62) + chr(0b1011001 + 0o14) + chr(9609 - 9510) + chr(0b1101111) + chr(9643 - 9543) + chr(0b10001 + 0o124))(chr(117) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56))) == xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\xcaA\x99t\xe1 \xfa'), chr(0b1010100 + 0o20) + chr(0b1100101) + chr(99) + '\x6f' + chr(100) + chr(101))(chr(0b1100011 + 0o22) + '\x74' + '\x66' + chr(710 - 665) + '\070')):
VHg_4JGTyJv5 = [IDJ2eXGCBCDu.cast(ocosRn8hZFTC, IDJ2eXGCBCDu.bfloat16) for ocosRn8hZFTC in VHg_4JGTyJv5]
return (yuSXpDt_ejO4, VHg_4JGTyJv5)
@Goed01Eusnl4(mOK0n0L9FPZ0)
def sqpGsxcSDKfN(*kJDRfRhcZHjS):
xafqLlk3kkUe(ouX3T2UoatOL, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xdc]\x93{\xf1'), chr(0b1011 + 0o131) + '\x65' + chr(99) + '\x6f' + chr(0b1100100) + '\145')(chr(9824 - 9707) + chr(0b1110100) + '\x66' + '\055' + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\xc9Y\xa9c\xf4c\xa5w\xd4\x88\xcbp\xfa\xdb\xa4)\x94'), chr(6279 - 6179) + '\145' + chr(0b1010 + 0o131) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(10088 - 9971) + chr(8549 - 8433) + '\x66' + '\x2d' + chr(0b100 + 0o64)))())
xafqLlk3kkUe(RCrn4lp7hGWQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xdc]\x93{\xf1'), chr(100) + '\x65' + '\x63' + chr(5494 - 5383) + chr(2602 - 2502) + chr(0b1100101))(chr(0b1110101) + chr(0b1011111 + 0o25) + chr(0b1100110) + '\055' + chr(2938 - 2882)))(xafqLlk3kkUe(IDJ2eXGCBCDu.contrib.framework, xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\xd9_\x84p\xfbe\x93w\xc4\x83\xf1\\\xea\xd7\xbb<'), '\144' + chr(0b10111 + 0o116) + chr(99) + chr(0b1011 + 0o144) + chr(0b1100100) + chr(101))(chr(7054 - 6937) + chr(116) + '\146' + chr(45) + chr(0b101010 + 0o16)))())
return wDsB9Ho570J9(*kJDRfRhcZHjS)
return sqpGsxcSDKfN(*kJDRfRhcZHjS)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
dense
|
def dense(x, units, **kwargs):
"""Identical to layers.dense."""
layer_collection = kwargs.pop("layer_collection", None)
activations = layers().Dense(units, **kwargs)(x)
if layer_collection:
# We need to find the layer parameters using scope name for the layer, so
# check that the layer is named. Otherwise parameters for different layers
# may get mixed up.
layer_name = tf.get_variable_scope().name
if (not layer_name) or ("name" not in kwargs):
raise ValueError(
"Variable scope and layer name cannot be empty. Actual: "
"variable_scope={}, layer name={}".format(
layer_name, kwargs.get("name", None)))
layer_name += "/" + kwargs["name"]
layer_params = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES,
scope=layer_name)
assert layer_params
if len(layer_params) == 1:
layer_params = layer_params[0]
tf.logging.info(
"Registering dense layer to collection for tensor: {}".format(
layer_params))
x_shape = x.shape.as_list()
if len(x_shape) == 3:
# Handle [batch, time, depth] inputs by folding batch and time into
# one dimension: reshaping inputs to [batchxtime, depth].
x_2d = tf.reshape(x, [-1, x_shape[2]])
activations_shape = activations.shape.as_list()
activations_2d = tf.reshape(activations, [-1, activations_shape[2]])
layer_collection.register_fully_connected_multi(
layer_params, x_2d, activations_2d, num_uses=x_shape[1])
activations = tf.reshape(activations_2d, activations_shape)
else:
layer_collection.register_fully_connected(layer_params, x, activations)
return activations
|
python
|
def dense(x, units, **kwargs):
"""Identical to layers.dense."""
layer_collection = kwargs.pop("layer_collection", None)
activations = layers().Dense(units, **kwargs)(x)
if layer_collection:
# We need to find the layer parameters using scope name for the layer, so
# check that the layer is named. Otherwise parameters for different layers
# may get mixed up.
layer_name = tf.get_variable_scope().name
if (not layer_name) or ("name" not in kwargs):
raise ValueError(
"Variable scope and layer name cannot be empty. Actual: "
"variable_scope={}, layer name={}".format(
layer_name, kwargs.get("name", None)))
layer_name += "/" + kwargs["name"]
layer_params = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES,
scope=layer_name)
assert layer_params
if len(layer_params) == 1:
layer_params = layer_params[0]
tf.logging.info(
"Registering dense layer to collection for tensor: {}".format(
layer_params))
x_shape = x.shape.as_list()
if len(x_shape) == 3:
# Handle [batch, time, depth] inputs by folding batch and time into
# one dimension: reshaping inputs to [batchxtime, depth].
x_2d = tf.reshape(x, [-1, x_shape[2]])
activations_shape = activations.shape.as_list()
activations_2d = tf.reshape(activations, [-1, activations_shape[2]])
layer_collection.register_fully_connected_multi(
layer_params, x_2d, activations_2d, num_uses=x_shape[1])
activations = tf.reshape(activations_2d, activations_shape)
else:
layer_collection.register_fully_connected(layer_params, x, activations)
return activations
|
[
"def",
"dense",
"(",
"x",
",",
"units",
",",
"*",
"*",
"kwargs",
")",
":",
"layer_collection",
"=",
"kwargs",
".",
"pop",
"(",
"\"layer_collection\"",
",",
"None",
")",
"activations",
"=",
"layers",
"(",
")",
".",
"Dense",
"(",
"units",
",",
"*",
"*",
"kwargs",
")",
"(",
"x",
")",
"if",
"layer_collection",
":",
"# We need to find the layer parameters using scope name for the layer, so",
"# check that the layer is named. Otherwise parameters for different layers",
"# may get mixed up.",
"layer_name",
"=",
"tf",
".",
"get_variable_scope",
"(",
")",
".",
"name",
"if",
"(",
"not",
"layer_name",
")",
"or",
"(",
"\"name\"",
"not",
"in",
"kwargs",
")",
":",
"raise",
"ValueError",
"(",
"\"Variable scope and layer name cannot be empty. Actual: \"",
"\"variable_scope={}, layer name={}\"",
".",
"format",
"(",
"layer_name",
",",
"kwargs",
".",
"get",
"(",
"\"name\"",
",",
"None",
")",
")",
")",
"layer_name",
"+=",
"\"/\"",
"+",
"kwargs",
"[",
"\"name\"",
"]",
"layer_params",
"=",
"tf",
".",
"get_collection",
"(",
"tf",
".",
"GraphKeys",
".",
"GLOBAL_VARIABLES",
",",
"scope",
"=",
"layer_name",
")",
"assert",
"layer_params",
"if",
"len",
"(",
"layer_params",
")",
"==",
"1",
":",
"layer_params",
"=",
"layer_params",
"[",
"0",
"]",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Registering dense layer to collection for tensor: {}\"",
".",
"format",
"(",
"layer_params",
")",
")",
"x_shape",
"=",
"x",
".",
"shape",
".",
"as_list",
"(",
")",
"if",
"len",
"(",
"x_shape",
")",
"==",
"3",
":",
"# Handle [batch, time, depth] inputs by folding batch and time into",
"# one dimension: reshaping inputs to [batchxtime, depth].",
"x_2d",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"x_shape",
"[",
"2",
"]",
"]",
")",
"activations_shape",
"=",
"activations",
".",
"shape",
".",
"as_list",
"(",
")",
"activations_2d",
"=",
"tf",
".",
"reshape",
"(",
"activations",
",",
"[",
"-",
"1",
",",
"activations_shape",
"[",
"2",
"]",
"]",
")",
"layer_collection",
".",
"register_fully_connected_multi",
"(",
"layer_params",
",",
"x_2d",
",",
"activations_2d",
",",
"num_uses",
"=",
"x_shape",
"[",
"1",
"]",
")",
"activations",
"=",
"tf",
".",
"reshape",
"(",
"activations_2d",
",",
"activations_shape",
")",
"else",
":",
"layer_collection",
".",
"register_fully_connected",
"(",
"layer_params",
",",
"x",
",",
"activations",
")",
"return",
"activations"
] |
Identical to layers.dense.
|
[
"Identical",
"to",
"layers",
".",
"dense",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3103-L3141
|
train
|
Identical to layers. dense.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,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6IV0tyJQ,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(2295 - 2247) + chr(6119 - 6008) + chr(0b110011) + chr(0b110101) + '\065', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100000 + 0o23) + chr(0b110010) + chr(0b11101 + 0o30), 0b1000), ehT0Px3KOsy9(chr(567 - 519) + chr(0b1101111) + chr(0b11 + 0o56) + '\062' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1937 - 1826) + chr(51) + chr(0b110111) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(55) + chr(0b1010 + 0o52), 16530 - 16522), ehT0Px3KOsy9(chr(1649 - 1601) + chr(0b10001 + 0o136) + chr(49) + chr(0b110 + 0o55) + chr(2098 - 2046), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b101011 + 0o7) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1306 - 1258) + chr(111) + chr(0b100000 + 0o22) + chr(1187 - 1134) + chr(0b110 + 0o55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + chr(51) + '\065' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(3953 - 3842) + chr(0b10010 + 0o41) + '\060' + '\064', 16287 - 16279), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011100 + 0o23) + chr(0b110111) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1330 - 1281) + '\x32' + chr(0b101001 + 0o10), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(838 - 785) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\x36' + chr(2647 - 2594), 48174 - 48166), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101101 + 0o5) + chr(1051 - 997), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\067', 0o10), ehT0Px3KOsy9(chr(200 - 152) + chr(0b1010111 + 0o30) + chr(50) + '\062' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\062' + chr(144 - 91), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011011 + 0o24) + '\061' + '\065' + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + chr(0b1100 + 0o53), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b111 + 0o52) + chr(2379 - 2329) + '\x30', 0b1000), ehT0Px3KOsy9(chr(1395 - 1347) + '\157' + chr(0b110010) + '\x34' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(0b110011) + '\061' + chr(0b11101 + 0o26), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x36' + chr(49), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(2257 - 2207) + chr(55), 0b1000), ehT0Px3KOsy9(chr(1371 - 1323) + chr(111) + '\x32' + '\x31' + chr(48), 0b1000), ehT0Px3KOsy9(chr(1869 - 1821) + chr(0b110001 + 0o76) + chr(0b100 + 0o57) + chr(0b110110) + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b101000 + 0o15) + chr(0b1110 + 0o43), 8), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + '\063' + chr(0b110010 + 0o1), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(0b101110 + 0o5) + chr(0b11001 + 0o27) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1100 + 0o47) + '\x31' + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + chr(0b1 + 0o61) + chr(54) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2270 - 2215) + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(11504 - 11393) + '\x32' + '\064' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(50) + '\x32', 38366 - 38358), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1100100 + 0o13) + '\x34' + chr(1647 - 1595), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1462 - 1408) + chr(0b110111), 42562 - 42554), ehT0Px3KOsy9('\060' + chr(1150 - 1039) + '\062' + chr(50) + chr(0b110000), 9902 - 9894), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b110010) + chr(0b110100), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1594 - 1546) + chr(111) + chr(53) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc3'), chr(0b1010000 + 0o24) + chr(101) + chr(0b1100011) + chr(0b0 + 0o157) + '\144' + chr(0b11101 + 0o110))('\165' + chr(0b1011011 + 0o31) + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def AM71TO6gBqHa(OeWW0F1dBPRQ, pMSSZNED5Vsi, **M8EIoTs2GJXE):
QhNZfIyyHZe2 = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\xb4(\x98\x0e\x03\xf1\xc4\x85\xa8^2]}\x9ax'), '\144' + chr(101) + chr(7921 - 7822) + chr(0b1101111) + '\144' + '\145')('\165' + '\x74' + '\x66' + '\x2d' + '\070'), None)
mgDWDDVSXPyH = sGi5Aql23May().Dense(pMSSZNED5Vsi, **M8EIoTs2GJXE)(OeWW0F1dBPRQ)
if QhNZfIyyHZe2:
YzJBPucQyDh2 = IDJ2eXGCBCDu.get_variable_scope().AIvJRzLdDfgF
if not YzJBPucQyDh2 or xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\xb4<\x98'), '\x64' + chr(0b1100101) + '\143' + chr(12022 - 11911) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(2792 - 2676) + chr(0b1100110) + chr(45) + chr(0b111000)) not in M8EIoTs2GJXE:
raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"\xbb\xb4#\x94\x1d>\xfe\xce\xc9\xb7X>Yq\xd5wq\xf2\xf5\x06f)\xc6\xb9\xd1\xf9\xe9\x99\x8c;\xa3\xaf\xd8S\xcd\xa6\x04U\xf5\xb4\x88\xb8!\x89\x05r\xb2\xea\x8a\xb0N0E.\xd5`~\xe4\xbc\x0be<\xc6\x94\x82\xf4\xe7\x84\x8c&\xbb\xb3\x9a\x1d\xce\xb3]R\xe2\xb4\x83\xb4<\x98A'\xef"), chr(0b1100100) + chr(0b101000 + 0o75) + chr(99) + chr(0b1100100 + 0o13) + chr(100) + '\x65')('\165' + '\x74' + '\146' + chr(0b10000 + 0o35) + chr(0b10111 + 0o41)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb\xe1#\x924=\xc1\x98\xb9\xb4^;'), chr(7311 - 7211) + chr(0b10000 + 0o125) + '\143' + chr(0b1001101 + 0o42) + '\x64' + chr(0b1100101))(chr(117) + '\164' + chr(102) + chr(45) + chr(0b111000)))(YzJBPucQyDh2, xafqLlk3kkUe(M8EIoTs2GJXE, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a\xb0%'), chr(0b1100100) + '\145' + chr(99) + chr(0b10101 + 0o132) + '\144' + '\145')('\165' + '\x74' + chr(0b1101 + 0o131) + chr(45) + chr(0b10000 + 0o50)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\xb4<\x98'), chr(0b1010001 + 0o23) + chr(101) + '\143' + chr(0b1001101 + 0o42) + '\x64' + chr(101))('\x75' + chr(0b1110100) + chr(0b1001111 + 0o27) + chr(0b111 + 0o46) + chr(0b111000)), None)))
YzJBPucQyDh2 += xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2'), chr(5902 - 5802) + chr(101) + chr(3089 - 2990) + '\x6f' + chr(100) + chr(101))('\165' + '\x74' + chr(0b1001111 + 0o27) + '\x2d' + '\x38') + M8EIoTs2GJXE[xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\xb4<\x98'), '\144' + chr(0b1000101 + 0o40) + '\x63' + chr(111) + chr(100) + chr(101))('\x75' + chr(3892 - 3776) + chr(102) + '\055' + '\070')]
YakCII_8mbLD = IDJ2eXGCBCDu.get_collection(IDJ2eXGCBCDu.GraphKeys.GLOBAL_VARIABLES, scope=YzJBPucQyDh2)
assert YakCII_8mbLD
if c2A0yzQpDQB3(YakCII_8mbLD) == ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1753 - 1704), 15085 - 15077):
YakCII_8mbLD = YakCII_8mbLD[ehT0Px3KOsy9(chr(48) + chr(111) + '\060', 0o10)]
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe\xe2\x19\x85\t?\xf5\x9c\x83\xa8a:'), chr(0b100001 + 0o103) + '\x65' + chr(0b1000011 + 0o40) + chr(111) + '\x64' + chr(0b110010 + 0o63))(chr(0b1110101) + '\x74' + '\x66' + '\055' + chr(0b111000)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\xb06\x94\x0f(\xf7\xd9\x80\xaa\\qMq\x9bez\xb6\xb9\x0b~5\xd1\xeb\x85\xf8\xa8\x97\x86w\xac\xab\xd5I\xcb\xbdJ\x17\xf6\xfb\x9f\xf5%\x98\x12/\xfd\xd9\xd3\xe4@,'), '\x64' + '\x65' + '\x63' + '\157' + chr(0b1000011 + 0o41) + chr(101))('\x75' + '\x74' + chr(0b100011 + 0o103) + '\x2d' + chr(0b110100 + 0o4)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb\xe1#\x924=\xc1\x98\xb9\xb4^;'), chr(2625 - 2525) + '\x65' + '\143' + chr(0b1011 + 0o144) + '\144' + chr(0b1100101))('\x75' + chr(4276 - 4160) + chr(0b1001011 + 0o33) + chr(45) + chr(1110 - 1054)))(YakCII_8mbLD))
QQEXXbdZyz6m = OeWW0F1dBPRQ.shape.as_list()
if c2A0yzQpDQB3(QQEXXbdZyz6m) == ehT0Px3KOsy9('\x30' + chr(111) + chr(2055 - 2004), ord("\x08")):
tLQTe3tfYHVt = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(656 - 608) + chr(111) + chr(1043 - 994), 8), QQEXXbdZyz6m[ehT0Px3KOsy9(chr(1179 - 1131) + chr(0b111101 + 0o62) + chr(50), ord("\x08"))]])
I2rztMNesZWs = mgDWDDVSXPyH.shape.as_list()
BUzKkQ6ejUE4 = IDJ2eXGCBCDu.reshape(mgDWDDVSXPyH, [-ehT0Px3KOsy9(chr(48) + chr(111) + '\x31', 8), I2rztMNesZWs[ehT0Px3KOsy9('\060' + '\157' + '\x32', 8)]])
xafqLlk3kkUe(QhNZfIyyHZe2, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f\xb06\x94\x0f(\xf7\xd9\xb6\xa2N=Em\xaaup\xf8\xbb\x0fd$\xc6\xaf\xae\xfa\xfd\x98\x9dr'), chr(0b1001000 + 0o34) + '\x65' + chr(0b1100011) + chr(11044 - 10933) + chr(100) + chr(101))(chr(117) + chr(13122 - 13006) + chr(6536 - 6434) + chr(0b1010 + 0o43) + '\070'))(YakCII_8mbLD, tLQTe3tfYHVt, BUzKkQ6ejUE4, num_uses=QQEXXbdZyz6m[ehT0Px3KOsy9(chr(48) + chr(1983 - 1872) + '\x31', 8)])
mgDWDDVSXPyH = IDJ2eXGCBCDu.reshape(BUzKkQ6ejUE4, I2rztMNesZWs)
else:
xafqLlk3kkUe(QhNZfIyyHZe2, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f\xb06\x94\x0f(\xf7\xd9\xb6\xa2N=Em\xaaup\xf8\xbb\x0fd$\xc6\xaf'), '\x64' + '\145' + chr(99) + '\x6f' + chr(0b1000 + 0o134) + chr(101))('\x75' + '\164' + '\x66' + '\x2d' + '\070'))(YakCII_8mbLD, OeWW0F1dBPRQ, mgDWDDVSXPyH)
return mgDWDDVSXPyH
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
batch_dense
|
def batch_dense(inputs,
units,
activation=None,
kernel_initializer=None,
reuse=None,
name=None):
"""Multiply a batch of input matrices by a batch of parameter matrices.
Each input matrix is multiplied by the corresponding parameter matrix.
This is useful in a mixture-of-experts where the batch represents different
experts with different inputs.
Args:
inputs: a Tensor with shape [batch, length, input_units]
units: an integer
activation: an optional activation function to apply to the output
kernel_initializer: an optional initializer
reuse: whether to reuse the varaible scope
name: an optional string
Returns:
a Tensor with shape [batch, length, units]
Raises:
ValueError: if the "batch" or "input_units" dimensions of inputs are not
statically known.
"""
inputs_shape = shape_list(inputs)
if len(inputs_shape) != 3:
raise ValueError("inputs must have 3 dimensions")
batch = inputs_shape[0]
input_units = inputs_shape[2]
if not isinstance(batch, int) or not isinstance(input_units, int):
raise ValueError("inputs must have static dimensions 0 and 2")
with tf.variable_scope(
name,
default_name="batch_dense",
values=[inputs],
reuse=reuse,
dtype=inputs.dtype):
if kernel_initializer is None:
kernel_initializer = tf.random_normal_initializer(
stddev=input_units**-0.5)
w = tf.get_variable(
"w", [batch, input_units, units],
initializer=kernel_initializer,
dtype=inputs.dtype)
y = tf.matmul(inputs, w)
if activation is not None:
y = activation(y)
return y
|
python
|
def batch_dense(inputs,
units,
activation=None,
kernel_initializer=None,
reuse=None,
name=None):
"""Multiply a batch of input matrices by a batch of parameter matrices.
Each input matrix is multiplied by the corresponding parameter matrix.
This is useful in a mixture-of-experts where the batch represents different
experts with different inputs.
Args:
inputs: a Tensor with shape [batch, length, input_units]
units: an integer
activation: an optional activation function to apply to the output
kernel_initializer: an optional initializer
reuse: whether to reuse the varaible scope
name: an optional string
Returns:
a Tensor with shape [batch, length, units]
Raises:
ValueError: if the "batch" or "input_units" dimensions of inputs are not
statically known.
"""
inputs_shape = shape_list(inputs)
if len(inputs_shape) != 3:
raise ValueError("inputs must have 3 dimensions")
batch = inputs_shape[0]
input_units = inputs_shape[2]
if not isinstance(batch, int) or not isinstance(input_units, int):
raise ValueError("inputs must have static dimensions 0 and 2")
with tf.variable_scope(
name,
default_name="batch_dense",
values=[inputs],
reuse=reuse,
dtype=inputs.dtype):
if kernel_initializer is None:
kernel_initializer = tf.random_normal_initializer(
stddev=input_units**-0.5)
w = tf.get_variable(
"w", [batch, input_units, units],
initializer=kernel_initializer,
dtype=inputs.dtype)
y = tf.matmul(inputs, w)
if activation is not None:
y = activation(y)
return y
|
[
"def",
"batch_dense",
"(",
"inputs",
",",
"units",
",",
"activation",
"=",
"None",
",",
"kernel_initializer",
"=",
"None",
",",
"reuse",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"inputs_shape",
"=",
"shape_list",
"(",
"inputs",
")",
"if",
"len",
"(",
"inputs_shape",
")",
"!=",
"3",
":",
"raise",
"ValueError",
"(",
"\"inputs must have 3 dimensions\"",
")",
"batch",
"=",
"inputs_shape",
"[",
"0",
"]",
"input_units",
"=",
"inputs_shape",
"[",
"2",
"]",
"if",
"not",
"isinstance",
"(",
"batch",
",",
"int",
")",
"or",
"not",
"isinstance",
"(",
"input_units",
",",
"int",
")",
":",
"raise",
"ValueError",
"(",
"\"inputs must have static dimensions 0 and 2\"",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"batch_dense\"",
",",
"values",
"=",
"[",
"inputs",
"]",
",",
"reuse",
"=",
"reuse",
",",
"dtype",
"=",
"inputs",
".",
"dtype",
")",
":",
"if",
"kernel_initializer",
"is",
"None",
":",
"kernel_initializer",
"=",
"tf",
".",
"random_normal_initializer",
"(",
"stddev",
"=",
"input_units",
"**",
"-",
"0.5",
")",
"w",
"=",
"tf",
".",
"get_variable",
"(",
"\"w\"",
",",
"[",
"batch",
",",
"input_units",
",",
"units",
"]",
",",
"initializer",
"=",
"kernel_initializer",
",",
"dtype",
"=",
"inputs",
".",
"dtype",
")",
"y",
"=",
"tf",
".",
"matmul",
"(",
"inputs",
",",
"w",
")",
"if",
"activation",
"is",
"not",
"None",
":",
"y",
"=",
"activation",
"(",
"y",
")",
"return",
"y"
] |
Multiply a batch of input matrices by a batch of parameter matrices.
Each input matrix is multiplied by the corresponding parameter matrix.
This is useful in a mixture-of-experts where the batch represents different
experts with different inputs.
Args:
inputs: a Tensor with shape [batch, length, input_units]
units: an integer
activation: an optional activation function to apply to the output
kernel_initializer: an optional initializer
reuse: whether to reuse the varaible scope
name: an optional string
Returns:
a Tensor with shape [batch, length, units]
Raises:
ValueError: if the "batch" or "input_units" dimensions of inputs are not
statically known.
|
[
"Multiply",
"a",
"batch",
"of",
"input",
"matrices",
"by",
"a",
"batch",
"of",
"parameter",
"matrices",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3144-L3195
|
train
|
Multiply a batch of input matrices by a batch of parameter matrices.
|
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,Iiw8L0M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N,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(0b0 + 0o61) + chr(0b101001 + 0o12) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1837 - 1789) + chr(0b1101111) + chr(0b1000 + 0o51) + chr(1852 - 1801) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1602 - 1553) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b101011 + 0o14) + chr(1792 - 1742), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10010 + 0o37) + '\064' + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b110111) + chr(94 - 43), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b110001) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\066' + chr(866 - 818), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(2778 - 2725) + '\065', 0b1000), ehT0Px3KOsy9(chr(2203 - 2155) + chr(8514 - 8403) + '\062' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(0b1101 + 0o44) + chr(0b110101) + '\062', 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(0b110010) + '\x34' + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + '\x32' + chr(1748 - 1694) + chr(0b100110 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(174 - 121) + chr(1994 - 1942), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b1011 + 0o54) + '\x33', 25352 - 25344), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10101 + 0o36) + chr(1492 - 1439) + chr(2213 - 2158), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + chr(2356 - 2305) + chr(54) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b10111 + 0o33) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1011110 + 0o21) + chr(0b110010) + '\x32' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1926 - 1878) + '\x6f' + '\x34' + chr(54), 39772 - 39764), ehT0Px3KOsy9(chr(1421 - 1373) + chr(0b1010101 + 0o32) + chr(0b1011 + 0o54) + chr(0b1101 + 0o43), 62090 - 62082), ehT0Px3KOsy9(chr(48) + chr(0b110001 + 0o76) + chr(49) + chr(0b110010 + 0o5) + chr(0b10 + 0o65), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(0b10101 + 0o36) + chr(0b110001) + chr(778 - 727), 0b1000), ehT0Px3KOsy9('\060' + chr(12004 - 11893) + chr(0b110001) + '\060' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(193 - 145) + '\x6f' + chr(0b110001) + chr(0b11110 + 0o25) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(346 - 298) + chr(111) + chr(51) + chr(0b100011 + 0o20) + chr(468 - 417), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b1001 + 0o51) + chr(0b110100), 39479 - 39471), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\064' + chr(0b11010 + 0o33), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110000 + 0o1) + chr(0b110010), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(52) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(51) + chr(1097 - 1042), 8), ehT0Px3KOsy9(chr(48) + chr(11282 - 11171) + '\062' + chr(0b110010), 31346 - 31338), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110101) + chr(0b100111 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(59 - 4) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6755 - 6644) + chr(0b110010) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110101 + 0o72) + chr(0b101100 + 0o5) + '\x35' + chr(55), 8459 - 8451), ehT0Px3KOsy9(chr(275 - 227) + chr(0b1101111) + chr(0b110011) + '\064' + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + chr(51) + '\061' + chr(2136 - 2087), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11010 + 0o31) + chr(556 - 505) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(49) + chr(0b11100 + 0o32), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + chr(0b1111 + 0o41), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'u'), chr(100) + '\145' + '\x63' + chr(0b1100011 + 0o14) + chr(0b1100100) + chr(0b1011100 + 0o11))(chr(0b10110 + 0o137) + chr(116) + '\146' + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def l1xSJ_C6Nk8C(vXoupepMtCXU, pMSSZNED5Vsi, _GyOifGFZyk1=None, yTYoQGLIQD0u=None, pmC5wdSFgdFj=None, AIvJRzLdDfgF=None):
VgP_McURhCb5 = qypPRW8fq869(vXoupepMtCXU)
if c2A0yzQpDQB3(VgP_McURhCb5) != ehT0Px3KOsy9(chr(950 - 902) + '\x6f' + '\063', 25626 - 25618):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'21\xfa\xcf\x11\x08j\x9dXe\x1e\x86\xde\xcd\x8d\x8a\xd4\xa4\xb3BQ\x12\xae*+\xb2\xbb\x8b9'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(0b1101 + 0o142) + chr(0b110100 + 0o60) + chr(101))(chr(4660 - 4543) + chr(0b111001 + 0o73) + chr(2987 - 2885) + chr(0b101101) + chr(0b111000)))
dNwAahu8tvoY = VgP_McURhCb5[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(669 - 621), 64221 - 64213)]
VCCQQbY3djWO = VgP_McURhCb5[ehT0Px3KOsy9('\060' + chr(111) + chr(2325 - 2275), 0b1000)]
if not PlSM16l2KDPD(dNwAahu8tvoY, ehT0Px3KOsy9) or not PlSM16l2KDPD(VCCQQbY3djWO, ehT0Px3KOsy9):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'21\xfa\xcf\x11\x08j\x9dXe\x1e\x86\xde\xcd\x8d\x8a\xd4\xe4\xe7GL\x16\xa8d<\xb2\xb9\x80$\x906}\x07\x0b5_\xc2\xa8\xb1*{m'), chr(0b1100000 + 0o4) + chr(0b10010 + 0o123) + chr(1320 - 1221) + '\157' + chr(0b111101 + 0o47) + '\x65')('\x75' + chr(0b1110100) + '\x66' + chr(555 - 510) + chr(0b10110 + 0o42)))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'->\xf8\xd3\x04\x19&\x95re\t\xc9\xc6\xc9'), chr(0b1001 + 0o133) + chr(101) + chr(6998 - 6899) + '\x6f' + chr(0b1100100) + chr(4956 - 4855))(chr(117) + '\164' + chr(102) + chr(45) + chr(629 - 573)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'9>\xfe\xd9\r$.\x95Ce\x0f'), '\x64' + '\145' + chr(5980 - 5881) + '\x6f' + '\x64' + chr(0b1100101))(chr(0b1101000 + 0o15) + '\164' + chr(0b1010111 + 0o17) + chr(1740 - 1695) + '\070'), values=[vXoupepMtCXU], reuse=pmC5wdSFgdFj, dtype=xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'1\x0c\xdc\x83,0$\x95@^]\xed'), chr(2440 - 2340) + chr(0b100010 + 0o103) + '\143' + chr(0b1101111) + chr(7807 - 7707) + chr(4787 - 4686))(chr(0b1001110 + 0o47) + '\x74' + '\146' + chr(0b11000 + 0o25) + chr(0b110011 + 0o5)))):
if yTYoQGLIQD0u is None:
yTYoQGLIQD0u = IDJ2eXGCBCDu.random_normal_initializer(stddev=VCCQQbY3djWO ** (-0.5))
AOfzRywRzEXp = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b','), '\x64' + chr(101) + chr(0b1100011) + '\157' + chr(100) + '\x65')(chr(117) + chr(0b1110100) + chr(2879 - 2777) + '\x2d' + chr(56)), [dNwAahu8tvoY, VCCQQbY3djWO, pMSSZNED5Vsi], initializer=yTYoQGLIQD0u, dtype=vXoupepMtCXU.jSV9IKnemH7K)
SqiSOtYOqOJH = IDJ2eXGCBCDu.matmul(vXoupepMtCXU, AOfzRywRzEXp)
if _GyOifGFZyk1 is not None:
SqiSOtYOqOJH = _GyOifGFZyk1(SqiSOtYOqOJH)
return SqiSOtYOqOJH
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
mix
|
def mix(x1,
x2,
steps,
is_training,
min_prob=0.0,
max_prob=1.0,
mode="lin",
simple=False,
broadcast_last=False):
"""Mix starting with x2, mixing mixing, going towards x1."""
with tf.name_scope("mix"):
if not is_training:
if max_prob >= 1.0:
return x1
alpha_shape = shape_list(x1)
if broadcast_last:
alpha_shape = alpha_shape[:-1] + [1]
alpha = tf.random_uniform(alpha_shape)
alpha = to_float(tf.less(alpha, max_prob))
return alpha * x1 + (1.0 - alpha) * x2
def get_res():
"""Create the result.
Separate function to speed it up later (see below).
Returns:
Tensor of mixed inputs.
"""
if mode == "lin":
alpha_p = inverse_lin_decay(steps)
else:
alpha_p = inverse_exp_decay(steps)
alpha_p = alpha_p * (max_prob - min_prob) + min_prob
if simple:
return alpha_p * x1 + (1.0 - alpha_p) * x2
alpha_shape = shape_list(x1)
if broadcast_last:
alpha_shape = alpha_shape[:-1] + [1]
alpha = tf.random_uniform(alpha_shape)
alpha = to_float(tf.less(alpha, alpha_p))
return alpha * x1 + (1.0 - alpha) * x2
if max_prob < 1.0:
return get_res()
# Prevent sampling after steps is passed to speed it up.
if is_xla_compiled():
return get_res()
else:
cur_step = tf.train.get_global_step()
if cur_step is None:
return x1 # Step not available, probably eval mode, don't mix.
return tf.cond(tf.less(cur_step, steps), get_res, lambda: x1)
|
python
|
def mix(x1,
x2,
steps,
is_training,
min_prob=0.0,
max_prob=1.0,
mode="lin",
simple=False,
broadcast_last=False):
"""Mix starting with x2, mixing mixing, going towards x1."""
with tf.name_scope("mix"):
if not is_training:
if max_prob >= 1.0:
return x1
alpha_shape = shape_list(x1)
if broadcast_last:
alpha_shape = alpha_shape[:-1] + [1]
alpha = tf.random_uniform(alpha_shape)
alpha = to_float(tf.less(alpha, max_prob))
return alpha * x1 + (1.0 - alpha) * x2
def get_res():
"""Create the result.
Separate function to speed it up later (see below).
Returns:
Tensor of mixed inputs.
"""
if mode == "lin":
alpha_p = inverse_lin_decay(steps)
else:
alpha_p = inverse_exp_decay(steps)
alpha_p = alpha_p * (max_prob - min_prob) + min_prob
if simple:
return alpha_p * x1 + (1.0 - alpha_p) * x2
alpha_shape = shape_list(x1)
if broadcast_last:
alpha_shape = alpha_shape[:-1] + [1]
alpha = tf.random_uniform(alpha_shape)
alpha = to_float(tf.less(alpha, alpha_p))
return alpha * x1 + (1.0 - alpha) * x2
if max_prob < 1.0:
return get_res()
# Prevent sampling after steps is passed to speed it up.
if is_xla_compiled():
return get_res()
else:
cur_step = tf.train.get_global_step()
if cur_step is None:
return x1 # Step not available, probably eval mode, don't mix.
return tf.cond(tf.less(cur_step, steps), get_res, lambda: x1)
|
[
"def",
"mix",
"(",
"x1",
",",
"x2",
",",
"steps",
",",
"is_training",
",",
"min_prob",
"=",
"0.0",
",",
"max_prob",
"=",
"1.0",
",",
"mode",
"=",
"\"lin\"",
",",
"simple",
"=",
"False",
",",
"broadcast_last",
"=",
"False",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"mix\"",
")",
":",
"if",
"not",
"is_training",
":",
"if",
"max_prob",
">=",
"1.0",
":",
"return",
"x1",
"alpha_shape",
"=",
"shape_list",
"(",
"x1",
")",
"if",
"broadcast_last",
":",
"alpha_shape",
"=",
"alpha_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"1",
"]",
"alpha",
"=",
"tf",
".",
"random_uniform",
"(",
"alpha_shape",
")",
"alpha",
"=",
"to_float",
"(",
"tf",
".",
"less",
"(",
"alpha",
",",
"max_prob",
")",
")",
"return",
"alpha",
"*",
"x1",
"+",
"(",
"1.0",
"-",
"alpha",
")",
"*",
"x2",
"def",
"get_res",
"(",
")",
":",
"\"\"\"Create the result.\n\n Separate function to speed it up later (see below).\n\n Returns:\n Tensor of mixed inputs.\n \"\"\"",
"if",
"mode",
"==",
"\"lin\"",
":",
"alpha_p",
"=",
"inverse_lin_decay",
"(",
"steps",
")",
"else",
":",
"alpha_p",
"=",
"inverse_exp_decay",
"(",
"steps",
")",
"alpha_p",
"=",
"alpha_p",
"*",
"(",
"max_prob",
"-",
"min_prob",
")",
"+",
"min_prob",
"if",
"simple",
":",
"return",
"alpha_p",
"*",
"x1",
"+",
"(",
"1.0",
"-",
"alpha_p",
")",
"*",
"x2",
"alpha_shape",
"=",
"shape_list",
"(",
"x1",
")",
"if",
"broadcast_last",
":",
"alpha_shape",
"=",
"alpha_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"1",
"]",
"alpha",
"=",
"tf",
".",
"random_uniform",
"(",
"alpha_shape",
")",
"alpha",
"=",
"to_float",
"(",
"tf",
".",
"less",
"(",
"alpha",
",",
"alpha_p",
")",
")",
"return",
"alpha",
"*",
"x1",
"+",
"(",
"1.0",
"-",
"alpha",
")",
"*",
"x2",
"if",
"max_prob",
"<",
"1.0",
":",
"return",
"get_res",
"(",
")",
"# Prevent sampling after steps is passed to speed it up.",
"if",
"is_xla_compiled",
"(",
")",
":",
"return",
"get_res",
"(",
")",
"else",
":",
"cur_step",
"=",
"tf",
".",
"train",
".",
"get_global_step",
"(",
")",
"if",
"cur_step",
"is",
"None",
":",
"return",
"x1",
"# Step not available, probably eval mode, don't mix.",
"return",
"tf",
".",
"cond",
"(",
"tf",
".",
"less",
"(",
"cur_step",
",",
"steps",
")",
",",
"get_res",
",",
"lambda",
":",
"x1",
")"
] |
Mix starting with x2, mixing mixing, going towards x1.
|
[
"Mix",
"starting",
"with",
"x2",
"mixing",
"mixing",
"going",
"towards",
"x1",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3198-L3251
|
train
|
Mix starting with x1 and going towards x2.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,j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ef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1375 - 1327) + chr(0b10110 + 0o131) + chr(0b1100 + 0o45) + chr(604 - 550) + chr(414 - 364), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\x36' + '\067', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + '\x32' + chr(0b101000 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(0b100011 + 0o16) + '\060' + chr(0b1110 + 0o43), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101001 + 0o16) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(1207 - 1152) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\060' + chr(0b11001 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(0b110111) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3265 - 3154) + chr(0b110001) + '\x37' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(238 - 127) + chr(0b110011) + chr(51) + chr(1427 - 1376), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(1049 - 938) + chr(0b11011 + 0o27) + chr(0b110010) + chr(0b11010 + 0o30), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1759 - 1708) + '\063' + chr(0b1111 + 0o47), 0b1000), ehT0Px3KOsy9('\x30' + chr(9653 - 9542) + '\063' + '\x31' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(255 - 207) + chr(111) + '\x31' + chr(54), 328 - 320), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + '\062' + chr(50) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100100 + 0o17) + '\066' + chr(1311 - 1262), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2640 - 2588) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(804 - 755) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x34' + chr(0b110110 + 0o1), 0b1000), ehT0Px3KOsy9(chr(1836 - 1788) + chr(9256 - 9145) + chr(1203 - 1153) + chr(50) + '\x35', 3756 - 3748), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1010 + 0o47) + chr(0b110110), 8), ehT0Px3KOsy9(chr(602 - 554) + chr(0b1101111) + chr(1432 - 1382) + '\065' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7859 - 7748) + '\x31' + chr(48) + chr(619 - 571), 44959 - 44951), ehT0Px3KOsy9(chr(1076 - 1028) + chr(0b1101111) + chr(0b110010) + chr(52) + '\062', 41231 - 41223), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\060' + chr(52), 30216 - 30208), ehT0Px3KOsy9('\x30' + chr(111) + chr(2318 - 2268) + chr(0b110001) + chr(0b10000 + 0o42), 0o10), ehT0Px3KOsy9(chr(824 - 776) + chr(0b1101111) + '\062' + '\x34' + '\066', 26552 - 26544), ehT0Px3KOsy9('\060' + '\x6f' + chr(595 - 545) + '\061', 36408 - 36400), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(0b1101 + 0o46) + chr(0b110000) + chr(1065 - 1014), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11101 + 0o24) + chr(0b10010 + 0o41) + chr(2218 - 2164), 28725 - 28717), ehT0Px3KOsy9('\060' + '\x6f' + '\061', 16963 - 16955), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063', 0b1000), ehT0Px3KOsy9(chr(2124 - 2076) + chr(0b1101111) + chr(0b110100) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + chr(51) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(49) + chr(2598 - 2547), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2050 - 2001) + '\x34' + '\067', 0o10), ehT0Px3KOsy9(chr(1967 - 1919) + chr(111) + '\061' + chr(0b110010) + chr(1715 - 1665), 11295 - 11287), ehT0Px3KOsy9('\x30' + chr(111) + chr(616 - 563) + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000 + 0o1) + '\x37' + chr(2678 - 2623), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1924 - 1875) + chr(0b110011) + chr(0b110100), 63574 - 63566)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(53) + '\x30', 57045 - 57037)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\\'), '\144' + '\145' + chr(0b1000011 + 0o40) + '\x6f' + chr(4052 - 3952) + chr(9672 - 9571))('\x75' + chr(0b1110100) + chr(0b11110 + 0o110) + chr(1336 - 1291) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def _U4bvDyR9Ymw(pci1T9SDshKa, OVXzvB9BcGF_, v0VhEmlMsO_l, XQJVi3cQFN5l, CXtIYqBuzWEe=0.0, s2nwXaO84kRa=1.0, holLFgwB7vsP=xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e\x1e{'), '\x64' + '\x65' + chr(0b11001 + 0o112) + '\157' + chr(100) + chr(101))(chr(1718 - 1601) + chr(116) + chr(0b1010010 + 0o24) + chr(45) + chr(56)), qtz76ii74seh=ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(48), 52652 - 52644), ltXvYUEwixl3=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8)):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\x16x$aJ\xa0W\x0b\xbe'), chr(0b1100100) + chr(1886 - 1785) + '\x63' + '\x6f' + chr(100) + '\x65')(chr(117) + '\x74' + chr(102) + chr(0b10001 + 0o34) + chr(3019 - 2963)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x1em'), '\x64' + '\145' + chr(99) + '\x6f' + chr(100) + chr(0b11110 + 0o107))(chr(3655 - 3538) + '\x74' + '\146' + chr(0b1 + 0o54) + '\070')):
if not XQJVi3cQFN5l:
if s2nwXaO84kRa >= 1.0:
return pci1T9SDshKa
r6m29h8zd78K = qypPRW8fq869(pci1T9SDshKa)
if ltXvYUEwixl3:
r6m29h8zd78K = r6m29h8zd78K[:-ehT0Px3KOsy9(chr(978 - 930) + '\157' + chr(1777 - 1728), 8)] + [ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8)]
gDUX9w35YHFE = IDJ2eXGCBCDu.random_uniform(r6m29h8zd78K)
gDUX9w35YHFE = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.less(gDUX9w35YHFE, s2nwXaO84kRa))
return gDUX9w35YHFE * pci1T9SDshKa + (1.0 - gDUX9w35YHFE) * OVXzvB9BcGF_
def rgByBRdRLpNw():
if holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e\x1e{'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + chr(6829 - 6729) + chr(0b1011100 + 0o11))('\165' + '\x74' + '\x66' + chr(45) + chr(56)):
sNcVMY9Wn0M8 = q3RBXZ5T5TaL(v0VhEmlMsO_l)
else:
sNcVMY9Wn0M8 = Z2x1tq3Owbeb(v0VhEmlMsO_l)
sNcVMY9Wn0M8 = sNcVMY9Wn0M8 * (s2nwXaO84kRa - CXtIYqBuzWEe) + CXtIYqBuzWEe
if qtz76ii74seh:
return sNcVMY9Wn0M8 * pci1T9SDshKa + (1.0 - sNcVMY9Wn0M8) * OVXzvB9BcGF_
r6m29h8zd78K = qypPRW8fq869(pci1T9SDshKa)
if ltXvYUEwixl3:
r6m29h8zd78K = r6m29h8zd78K[:-ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 8)] + [ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + '\061', 8)]
gDUX9w35YHFE = IDJ2eXGCBCDu.random_uniform(r6m29h8zd78K)
gDUX9w35YHFE = ZUL3kHBGU8Uu(IDJ2eXGCBCDu.less(gDUX9w35YHFE, sNcVMY9Wn0M8))
return gDUX9w35YHFE * pci1T9SDshKa + (1.0 - gDUX9w35YHFE) * OVXzvB9BcGF_
if s2nwXaO84kRa < 1.0:
return rgByBRdRLpNw()
if GayarD_wafnb():
return rgByBRdRLpNw()
else:
bkW5rU3Pg6b9 = IDJ2eXGCBCDu.train.get_global_step()
if bkW5rU3Pg6b9 is None:
return pci1T9SDshKa
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x11\x18{%'), chr(100) + '\145' + chr(0b10111 + 0o114) + '\x6f' + '\x64' + '\145')(chr(0b111011 + 0o72) + chr(0b110 + 0o156) + '\146' + chr(1426 - 1381) + chr(0b111000)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e\x12f2'), chr(0b10110 + 0o116) + chr(0b0 + 0o145) + chr(99) + '\x6f' + '\144' + chr(0b1011110 + 0o7))('\x75' + chr(116) + '\146' + '\055' + '\x38'))(bkW5rU3Pg6b9, v0VhEmlMsO_l), rgByBRdRLpNw, lambda : pci1T9SDshKa)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
brelu
|
def brelu(x):
"""Bipolar ReLU as in https://arxiv.org/abs/1709.04054."""
x_shape = shape_list(x)
x1, x2 = tf.split(tf.reshape(x, x_shape[:-1] + [-1, 2]), 2, axis=-1)
y1 = tf.nn.relu(x1)
y2 = -tf.nn.relu(-x2)
return tf.reshape(tf.concat([y1, y2], axis=-1), x_shape)
|
python
|
def brelu(x):
"""Bipolar ReLU as in https://arxiv.org/abs/1709.04054."""
x_shape = shape_list(x)
x1, x2 = tf.split(tf.reshape(x, x_shape[:-1] + [-1, 2]), 2, axis=-1)
y1 = tf.nn.relu(x1)
y2 = -tf.nn.relu(-x2)
return tf.reshape(tf.concat([y1, y2], axis=-1), x_shape)
|
[
"def",
"brelu",
"(",
"x",
")",
":",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"x1",
",",
"x2",
"=",
"tf",
".",
"split",
"(",
"tf",
".",
"reshape",
"(",
"x",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"-",
"1",
",",
"2",
"]",
")",
",",
"2",
",",
"axis",
"=",
"-",
"1",
")",
"y1",
"=",
"tf",
".",
"nn",
".",
"relu",
"(",
"x1",
")",
"y2",
"=",
"-",
"tf",
".",
"nn",
".",
"relu",
"(",
"-",
"x2",
")",
"return",
"tf",
".",
"reshape",
"(",
"tf",
".",
"concat",
"(",
"[",
"y1",
",",
"y2",
"]",
",",
"axis",
"=",
"-",
"1",
")",
",",
"x_shape",
")"
] |
Bipolar ReLU as in https://arxiv.org/abs/1709.04054.
|
[
"Bipolar",
"ReLU",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1709",
".",
"04054",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3254-L3260
|
train
|
Bipolar ReLU as in https://arxiv. org. abs.
|
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,Q6d3QdTENf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LEDU,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(471 - 423) + '\x6f' + '\x33' + chr(1476 - 1424) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(619 - 571) + chr(9821 - 9710) + chr(0b110001 + 0o2) + '\x30' + chr(0b11101 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(53) + chr(0b10 + 0o57), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1465 - 1414) + chr(55) + '\x33', 47008 - 47000), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(53) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111001 + 0o66) + chr(0b110001 + 0o1) + chr(50) + chr(1337 - 1285), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1917 - 1868) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110100) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x35' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1126 - 1078) + chr(111) + '\063' + '\x31' + chr(143 - 95), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + '\x31' + chr(2499 - 2447) + chr(48), 54935 - 54927), ehT0Px3KOsy9(chr(892 - 844) + '\157' + chr(0b110001) + '\x32' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1708 - 1660) + chr(0b1001 + 0o146) + '\061', 40154 - 40146), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + '\064' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100100 + 0o13) + '\x32' + chr(780 - 731) + '\x30', 22277 - 22269), ehT0Px3KOsy9('\x30' + chr(4252 - 4141) + chr(0b110001) + '\x33' + chr(0b11100 + 0o24), 58960 - 58952), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(5961 - 5850) + chr(1903 - 1852) + chr(49) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1243 - 1192) + chr(806 - 756) + chr(1621 - 1573), 15028 - 15020), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\065' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(2361 - 2310) + '\x30', 8), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + '\062' + chr(398 - 344) + chr(0b100011 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(566 - 518) + chr(0b1010 + 0o145) + chr(0b110001) + chr(0b110111) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x35' + chr(0b11111 + 0o21), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(2015 - 1964) + chr(2211 - 2162) + chr(0b110011 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6541 - 6430) + chr(50) + chr(48) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + '\x31' + '\x36' + chr(0b101111 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000101 + 0o52) + '\x33' + chr(0b101 + 0o56) + chr(0b110011), 8441 - 8433), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + chr(0b110011) + chr(983 - 932), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\x31' + chr(2176 - 2126), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(471 - 360) + chr(2333 - 2283) + chr(0b11110 + 0o24) + chr(0b1100 + 0o47), 7783 - 7775), ehT0Px3KOsy9('\x30' + '\157' + '\061' + '\066' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6723 - 6612) + '\x33' + '\x32' + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(10757 - 10646) + '\061' + '\065' + chr(0b1 + 0o63), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1758 - 1709) + chr(1742 - 1692), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1011101 + 0o22) + '\x31' + chr(0b110011) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b101011 + 0o7) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + '\062' + chr(689 - 638) + chr(2707 - 2653), 8922 - 8914), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(2091 - 2036) + chr(780 - 727), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(0b101100 + 0o5) + chr(0b110001) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\x34' + '\061', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + '\x35' + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9'), chr(4273 - 4173) + chr(384 - 283) + chr(1628 - 1529) + chr(0b11111 + 0o120) + '\144' + chr(0b111010 + 0o53))(chr(117) + chr(0b1110100) + chr(102) + chr(1844 - 1799) + chr(218 - 162)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def kf6hjqSsmJZM(OeWW0F1dBPRQ):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
(pci1T9SDshKa, OVXzvB9BcGF_) = IDJ2eXGCBCDu.split(IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, QQEXXbdZyz6m[:-ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 8)] + [-ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + chr(171 - 121), 17088 - 17080)]), ehT0Px3KOsy9(chr(0b110000) + chr(3745 - 3634) + '\x32', 8), axis=-ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(49), 8))
bdlzQNguJ1X_ = IDJ2eXGCBCDu.nn.relu(pci1T9SDshKa)
dgC_QAONOODe = -IDJ2eXGCBCDu.nn.relu(-OVXzvB9BcGF_)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\xa0\xda\x93I\xe4h'), chr(100) + chr(101) + '\143' + '\x6f' + chr(6542 - 6442) + chr(0b1010000 + 0o25))('\165' + chr(116) + chr(1915 - 1813) + '\x2d' + chr(0b11010 + 0o36)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x84\xaa\xc7\x98I\xe0'), chr(100) + chr(101) + '\143' + '\157' + chr(100) + chr(3107 - 3006))(chr(13007 - 12890) + '\x74' + '\x66' + '\055' + chr(0b1001 + 0o57)))([bdlzQNguJ1X_, dgC_QAONOODe], axis=-ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b100 + 0o153) + '\061', 8)), QQEXXbdZyz6m)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
belu
|
def belu(x):
"""Bipolar ELU as in https://arxiv.org/abs/1709.04054."""
x_shape = shape_list(x)
x1, x2 = tf.split(tf.reshape(x, x_shape[:-1] + [-1, 2]), 2, axis=-1)
y1 = tf.nn.elu(x1)
y2 = -tf.nn.elu(-x2)
return tf.reshape(tf.concat([y1, y2], axis=-1), x_shape)
|
python
|
def belu(x):
"""Bipolar ELU as in https://arxiv.org/abs/1709.04054."""
x_shape = shape_list(x)
x1, x2 = tf.split(tf.reshape(x, x_shape[:-1] + [-1, 2]), 2, axis=-1)
y1 = tf.nn.elu(x1)
y2 = -tf.nn.elu(-x2)
return tf.reshape(tf.concat([y1, y2], axis=-1), x_shape)
|
[
"def",
"belu",
"(",
"x",
")",
":",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"x1",
",",
"x2",
"=",
"tf",
".",
"split",
"(",
"tf",
".",
"reshape",
"(",
"x",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"-",
"1",
",",
"2",
"]",
")",
",",
"2",
",",
"axis",
"=",
"-",
"1",
")",
"y1",
"=",
"tf",
".",
"nn",
".",
"elu",
"(",
"x1",
")",
"y2",
"=",
"-",
"tf",
".",
"nn",
".",
"elu",
"(",
"-",
"x2",
")",
"return",
"tf",
".",
"reshape",
"(",
"tf",
".",
"concat",
"(",
"[",
"y1",
",",
"y2",
"]",
",",
"axis",
"=",
"-",
"1",
")",
",",
"x_shape",
")"
] |
Bipolar ELU as in https://arxiv.org/abs/1709.04054.
|
[
"Bipolar",
"ELU",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1709",
".",
"04054",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e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0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2358 - 2307) + '\x32' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101101 + 0o4) + '\x37' + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50), 57846 - 57838), ehT0Px3KOsy9('\060' + chr(2729 - 2618) + '\063' + chr(54) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(2799 - 2688) + chr(51) + '\x34' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b110001) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7059 - 6948) + '\063' + chr(679 - 630) + chr(52), 0o10), ehT0Px3KOsy9(chr(344 - 296) + '\157' + '\x32' + '\x34' + chr(51), 43460 - 43452), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b11011 + 0o124) + '\x32' + chr(2566 - 2511) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(0b110 + 0o54) + chr(444 - 391) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\x34' + chr(1668 - 1620), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + '\x31' + '\x34' + '\x36', 37126 - 37118), ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + chr(49) + chr(53) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(1493 - 1442) + '\x33', 11980 - 11972), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + '\061' + '\x32' + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(0b10100 + 0o35) + chr(0b110011) + chr(0b1101 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + '\x32', 0b1000), ehT0Px3KOsy9(chr(1397 - 1349) + chr(111) + '\067' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1816 - 1766) + chr(1532 - 1484) + chr(0b1101 + 0o43), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9431 - 9320) + chr(0b110001) + chr(0b110010), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1095 - 1045) + chr(0b110010) + chr(0b10011 + 0o36), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(255 - 205) + chr(399 - 350) + chr(0b10010 + 0o42), 60069 - 60061), ehT0Px3KOsy9(chr(529 - 481) + chr(111) + '\063' + chr(0b110100) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b101000 + 0o13) + chr(0b110111) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1000 + 0o52) + '\066' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\x37' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(2628 - 2517) + chr(823 - 774) + chr(0b110110) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1031 - 980) + '\061' + chr(0b0 + 0o60), 61563 - 61555), ehT0Px3KOsy9(chr(1738 - 1690) + chr(0b1010010 + 0o35) + chr(0b101110 + 0o5) + '\064' + '\063', 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + '\x33' + '\065' + chr(0b110101), 9849 - 9841), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\064' + chr(2227 - 2179), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b110001) + chr(0b110001), 44226 - 44218), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b110011) + '\x36', 8), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(1338 - 1289) + chr(53) + chr(2353 - 2300), 0o10), ehT0Px3KOsy9(chr(1255 - 1207) + chr(11913 - 11802) + chr(339 - 290) + chr(50) + chr(153 - 105), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4624 - 4513) + chr(1845 - 1796) + chr(941 - 890) + chr(0b10100 + 0o37), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8354 - 8243) + '\062' + chr(2618 - 2566) + chr(0b110010 + 0o2), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b100000 + 0o26) + chr(49), 62998 - 62990), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(2789 - 2734) + chr(0b1110 + 0o47), 0o10), ehT0Px3KOsy9(chr(1645 - 1597) + '\x6f' + chr(51) + '\065' + chr(2705 - 2652), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1261 - 1213) + '\x6f' + '\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' + chr(0b1100101) + '\143' + chr(0b1101111) + '\x64' + chr(101))('\165' + chr(11903 - 11787) + chr(0b1100110) + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def tTtzf3pWNaRK(OeWW0F1dBPRQ):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
(pci1T9SDshKa, OVXzvB9BcGF_) = IDJ2eXGCBCDu.split(IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, QQEXXbdZyz6m[:-ehT0Px3KOsy9(chr(274 - 226) + '\x6f' + '\061', 7957 - 7949)] + [-ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062', 8)]), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10000 + 0o42), 8), axis=-ehT0Px3KOsy9('\x30' + chr(10199 - 10088) + chr(1406 - 1357), 8))
bdlzQNguJ1X_ = IDJ2eXGCBCDu.nn.elu(pci1T9SDshKa)
dgC_QAONOODe = -IDJ2eXGCBCDu.nn.elu(-OVXzvB9BcGF_)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5\x1eq\x98\x86\xba\xa9'), '\x64' + chr(101) + '\143' + chr(111) + '\x64' + chr(1401 - 1300))(chr(0b101101 + 0o110) + chr(6410 - 6294) + chr(3816 - 3714) + '\055' + '\x38'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4\x14l\x93\x86\xbe'), chr(2749 - 2649) + chr(0b1100101) + '\x63' + '\157' + chr(0b1100100) + '\x65')(chr(2483 - 2366) + chr(9325 - 9209) + chr(0b11000 + 0o116) + chr(0b101101) + chr(56)))([bdlzQNguJ1X_, dgC_QAONOODe], axis=-ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8)), QQEXXbdZyz6m)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
gelu
|
def gelu(x):
"""Gaussian Error Linear Unit.
This is a smoother version of the RELU.
Original paper: https://arxiv.org/abs/1606.08415
Args:
x: float Tensor to perform activation.
Returns:
x with the GELU activation applied.
"""
cdf = 0.5 * (1.0 + tf.tanh(
(np.sqrt(2 / np.pi) * (x + 0.044715 * tf.pow(x, 3)))))
return x * cdf
|
python
|
def gelu(x):
"""Gaussian Error Linear Unit.
This is a smoother version of the RELU.
Original paper: https://arxiv.org/abs/1606.08415
Args:
x: float Tensor to perform activation.
Returns:
x with the GELU activation applied.
"""
cdf = 0.5 * (1.0 + tf.tanh(
(np.sqrt(2 / np.pi) * (x + 0.044715 * tf.pow(x, 3)))))
return x * cdf
|
[
"def",
"gelu",
"(",
"x",
")",
":",
"cdf",
"=",
"0.5",
"*",
"(",
"1.0",
"+",
"tf",
".",
"tanh",
"(",
"(",
"np",
".",
"sqrt",
"(",
"2",
"/",
"np",
".",
"pi",
")",
"*",
"(",
"x",
"+",
"0.044715",
"*",
"tf",
".",
"pow",
"(",
"x",
",",
"3",
")",
")",
")",
")",
")",
"return",
"x",
"*",
"cdf"
] |
Gaussian Error Linear Unit.
This is a smoother version of the RELU.
Original paper: https://arxiv.org/abs/1606.08415
Args:
x: float Tensor to perform activation.
Returns:
x with the GELU activation applied.
|
[
"Gaussian",
"Error",
"Linear",
"Unit",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3272-L3286
|
train
|
Gaussian Error Linear Unit.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0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kKPdt5d,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) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(504 - 453) + chr(0b110111) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b110010) + chr(50), 39917 - 39909), ehT0Px3KOsy9('\x30' + chr(9269 - 9158) + chr(0b110011) + chr(0b1011 + 0o53) + chr(499 - 448), 21562 - 21554), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + '\x32' + chr(0b10001 + 0o41) + chr(0b101101 + 0o4), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\x37' + '\x33', 0o10), ehT0Px3KOsy9(chr(2019 - 1971) + '\x6f' + chr(0b110001) + chr(2537 - 2482) + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1643 - 1592) + chr(0b110000) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1101 + 0o50) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1867 - 1812) + chr(2331 - 2278), 33228 - 33220), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(9143 - 9032) + '\063' + chr(55) + chr(1329 - 1275), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\064' + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100 + 0o56) + '\067' + chr(1854 - 1800), 58739 - 58731), ehT0Px3KOsy9(chr(269 - 221) + chr(7586 - 7475) + chr(0b110011) + chr(50) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(3366 - 3255) + chr(0b11010 + 0o31) + '\x34' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1476 - 1428) + '\x6f' + chr(0b101000 + 0o13) + chr(0b11011 + 0o27) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101000 + 0o12) + '\x33' + '\x36', 43672 - 43664), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\064' + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b110011) + chr(575 - 526), 15611 - 15603), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + '\x37' + '\x35', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(329 - 279) + '\x34', 8), ehT0Px3KOsy9(chr(2042 - 1994) + chr(0b1101111) + chr(49) + chr(0b110100) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x36' + chr(51), 0o10), ehT0Px3KOsy9(chr(337 - 289) + '\x6f' + chr(0b110100) + chr(52), 49509 - 49501), ehT0Px3KOsy9(chr(2253 - 2205) + '\x6f' + chr(50) + '\067' + '\065', 59026 - 59018), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\067' + chr(2591 - 2536), ord("\x08")), ehT0Px3KOsy9(chr(2230 - 2182) + chr(111) + '\062' + chr(48) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x33' + chr(1827 - 1776), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(49) + chr(0b110000) + chr(1975 - 1920), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\066' + chr(0b1010 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8249 - 8138) + chr(51) + '\063' + '\065', 0o10), ehT0Px3KOsy9(chr(1121 - 1073) + chr(0b1101111) + chr(53) + chr(49), 8), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b101101 + 0o102) + chr(1944 - 1895) + chr(0b10 + 0o60) + chr(2334 - 2284), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10 + 0o61) + '\x37' + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101101 + 0o5) + chr(51) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\x33' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101001 + 0o12) + chr(2243 - 2192) + chr(2448 - 2393), 0o10), ehT0Px3KOsy9('\060' + chr(6543 - 6432) + '\x34' + chr(1857 - 1804), 54611 - 54603), ehT0Px3KOsy9('\060' + chr(0b1000010 + 0o55) + chr(52) + chr(1543 - 1489), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\157' + chr(0b11010 + 0o31) + chr(0b11100 + 0o26) + chr(51), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(244 - 191) + chr(65 - 17), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'('), chr(0b1001101 + 0o27) + chr(7496 - 7395) + '\143' + '\x6f' + chr(100) + chr(0b1011010 + 0o13))(chr(0b1000011 + 0o62) + chr(116) + chr(0b1100110) + chr(0b101101) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hIvP1_WpXHYm(OeWW0F1dBPRQ):
YnzFFFn14pPC = 0.5 * (1.0 + IDJ2eXGCBCDu.tanh(WqUC3KWvYVup.sqrt(ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(12049 - 11938) + chr(50), ord("\x08")) / WqUC3KWvYVup.pi) * (OeWW0F1dBPRQ + 0.044715 * IDJ2eXGCBCDu.pow(OeWW0F1dBPRQ, ehT0Px3KOsy9('\060' + chr(111) + '\063', 54889 - 54881)))))
return OeWW0F1dBPRQ * YnzFFFn14pPC
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
nac
|
def nac(x, depth, name=None, reuse=None):
"""NAC as in https://arxiv.org/abs/1808.00508."""
with tf.variable_scope(name, default_name="nac", values=[x], reuse=reuse):
x_shape = shape_list(x)
w = tf.get_variable("w", [x_shape[-1], depth])
m = tf.get_variable("m", [x_shape[-1], depth])
w = tf.tanh(w) * tf.nn.sigmoid(m)
x_flat = tf.reshape(x, [-1, x_shape[-1]])
res_flat = tf.matmul(x_flat, w)
return tf.reshape(res_flat, x_shape[:-1] + [depth])
|
python
|
def nac(x, depth, name=None, reuse=None):
"""NAC as in https://arxiv.org/abs/1808.00508."""
with tf.variable_scope(name, default_name="nac", values=[x], reuse=reuse):
x_shape = shape_list(x)
w = tf.get_variable("w", [x_shape[-1], depth])
m = tf.get_variable("m", [x_shape[-1], depth])
w = tf.tanh(w) * tf.nn.sigmoid(m)
x_flat = tf.reshape(x, [-1, x_shape[-1]])
res_flat = tf.matmul(x_flat, w)
return tf.reshape(res_flat, x_shape[:-1] + [depth])
|
[
"def",
"nac",
"(",
"x",
",",
"depth",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"nac\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"w",
"=",
"tf",
".",
"get_variable",
"(",
"\"w\"",
",",
"[",
"x_shape",
"[",
"-",
"1",
"]",
",",
"depth",
"]",
")",
"m",
"=",
"tf",
".",
"get_variable",
"(",
"\"m\"",
",",
"[",
"x_shape",
"[",
"-",
"1",
"]",
",",
"depth",
"]",
")",
"w",
"=",
"tf",
".",
"tanh",
"(",
"w",
")",
"*",
"tf",
".",
"nn",
".",
"sigmoid",
"(",
"m",
")",
"x_flat",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
"res_flat",
"=",
"tf",
".",
"matmul",
"(",
"x_flat",
",",
"w",
")",
"return",
"tf",
".",
"reshape",
"(",
"res_flat",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"depth",
"]",
")"
] |
NAC as in https://arxiv.org/abs/1808.00508.
|
[
"NAC",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1808",
".",
"00508",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3289-L3298
|
train
|
NAC as in https://arxiv. org / abs / 1808. 00508.
|
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,jI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xiBOH72k,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) + '\063' + chr(50) + chr(2210 - 2162), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(261 - 207) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110011) + chr(49) + '\065', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x32' + '\063', 46521 - 46513), ehT0Px3KOsy9(chr(0b110000) + chr(1115 - 1004) + chr(0b110101) + chr(126 - 71), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\061' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(130 - 82) + '\157' + '\x33' + '\067' + '\062', 0o10), ehT0Px3KOsy9(chr(1928 - 1880) + chr(0b1101000 + 0o7) + chr(0b101010 + 0o10) + chr(0b110010) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(2095 - 2047) + chr(0b1101111) + '\x32' + '\x36', 0b1000), ehT0Px3KOsy9(chr(206 - 158) + '\157' + chr(49) + chr(1937 - 1887) + chr(0b10001 + 0o37), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11100 + 0o26) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111101 + 0o62) + '\x37' + chr(508 - 459), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(3975 - 3864) + chr(1791 - 1740), 0o10), ehT0Px3KOsy9(chr(48) + chr(3582 - 3471) + chr(1775 - 1724) + '\063' + chr(842 - 787), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011110 + 0o21) + chr(0b11000 + 0o37) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\x35' + chr(1951 - 1897), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + '\x32' + '\x34' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(1959 - 1911) + chr(5109 - 4998) + '\x32' + chr(0b110100) + chr(0b10001 + 0o42), 25228 - 25220), ehT0Px3KOsy9(chr(244 - 196) + chr(1760 - 1649) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b11010 + 0o30) + '\x37', 0o10), ehT0Px3KOsy9(chr(1363 - 1315) + chr(0b1000011 + 0o54) + chr(143 - 94) + chr(51) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(5869 - 5758) + chr(0b11101 + 0o24) + chr(0b110101) + chr(0b111 + 0o57), 8), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + '\065' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(0b1110 + 0o45) + chr(0b110011) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + chr(49) + '\067' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(601 - 490) + chr(0b10001 + 0o42) + '\063' + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x34' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\067' + '\x31', 29523 - 29515), ehT0Px3KOsy9(chr(1412 - 1364) + chr(0b1101111) + chr(0b110010) + '\066' + chr(48), 21082 - 21074), ehT0Px3KOsy9(chr(1249 - 1201) + chr(0b1101111) + chr(0b101 + 0o56) + chr(0b110010) + chr(100 - 49), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + '\x36' + chr(0b100101 + 0o17), 32731 - 32723), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101100 + 0o6) + chr(0b110011) + '\x31', 29548 - 29540), ehT0Px3KOsy9(chr(1723 - 1675) + chr(111) + chr(2392 - 2342) + chr(2032 - 1982) + '\x33', 63686 - 63678), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(398 - 287) + chr(0b1001 + 0o51) + chr(0b10011 + 0o37) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1234 - 1185) + chr(1858 - 1809) + chr(0b110010 + 0o1), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1111 + 0o140) + chr(65 - 15) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b100011 + 0o20) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(2668 - 2613) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101010 + 0o105) + chr(0b110010) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + '\062' + chr(55) + chr(0b1001 + 0o51), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + chr(2191 - 2138) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe'), chr(100) + '\x65' + '\143' + chr(0b1100000 + 0o17) + chr(100) + '\145')('\165' + chr(116) + chr(0b1011101 + 0o11) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def GY11u5J3xrRp(OeWW0F1dBPRQ, UEys4_lSwsID, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6Q\xbf\xbaN\xab\x96\xf2I#pVs\xba'), chr(3943 - 3843) + '\x65' + chr(2357 - 2258) + chr(7596 - 7485) + chr(100) + '\x65')(chr(117) + '\164' + '\x66' + chr(421 - 376) + chr(1857 - 1801)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbeQ\xae'), chr(0b1100010 + 0o2) + chr(534 - 433) + '\x63' + chr(111) + '\144' + chr(0b1100101))('\x75' + chr(0b11011 + 0o131) + chr(8114 - 8012) + '\055' + chr(2371 - 2315)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
AOfzRywRzEXp = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa7'), chr(100) + chr(0b100010 + 0o103) + chr(0b110011 + 0o60) + chr(111) + chr(0b100110 + 0o76) + '\145')(chr(117) + chr(0b1000110 + 0o56) + chr(3068 - 2966) + chr(1712 - 1667) + chr(56)), [QQEXXbdZyz6m[-ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 0o10)], UEys4_lSwsID])
r8ufID9JCHnI = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd'), chr(100) + chr(0b101110 + 0o67) + '\x63' + '\157' + chr(3294 - 3194) + chr(474 - 373))('\165' + chr(116) + chr(102) + '\x2d' + '\070'), [QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + '\061', 8)], UEys4_lSwsID])
AOfzRywRzEXp = IDJ2eXGCBCDu.tanh(AOfzRywRzEXp) * IDJ2eXGCBCDu.nn.sigmoid(r8ufID9JCHnI)
mstS6zVd22Jf = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8), QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + '\x31', 8)]])
JhUOaYWCELwm = IDJ2eXGCBCDu.matmul(mstS6zVd22Jf, AOfzRywRzEXp)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa2U\xbe\xbbN\xb9\x9f'), '\x64' + chr(0b101100 + 0o71) + chr(0b10010 + 0o121) + chr(111) + chr(0b1011000 + 0o14) + chr(101))(chr(117) + chr(11993 - 11877) + chr(0b10011 + 0o123) + '\055' + chr(56)))(JhUOaYWCELwm, QQEXXbdZyz6m[:-ehT0Px3KOsy9(chr(48) + chr(111) + '\061', 8)] + [UEys4_lSwsID])
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
nalu
|
def nalu(x, depth, epsilon=1e-30, name=None, reuse=None):
"""NALU as in https://arxiv.org/abs/1808.00508."""
with tf.variable_scope(name, default_name="nalu", values=[x], reuse=reuse):
x_shape = shape_list(x)
x_flat = tf.reshape(x, [-1, x_shape[-1]])
gw = tf.get_variable("w", [x_shape[-1], depth])
g = tf.nn.sigmoid(tf.matmul(x_flat, gw))
g = tf.reshape(g, x_shape[:-1] + [depth])
a = nac(x, depth, name="nac_lin")
log_x = tf.log(tf.abs(x) + epsilon)
m = nac(log_x, depth, name="nac_log")
return g * a + (1 - g) * tf.exp(m)
|
python
|
def nalu(x, depth, epsilon=1e-30, name=None, reuse=None):
"""NALU as in https://arxiv.org/abs/1808.00508."""
with tf.variable_scope(name, default_name="nalu", values=[x], reuse=reuse):
x_shape = shape_list(x)
x_flat = tf.reshape(x, [-1, x_shape[-1]])
gw = tf.get_variable("w", [x_shape[-1], depth])
g = tf.nn.sigmoid(tf.matmul(x_flat, gw))
g = tf.reshape(g, x_shape[:-1] + [depth])
a = nac(x, depth, name="nac_lin")
log_x = tf.log(tf.abs(x) + epsilon)
m = nac(log_x, depth, name="nac_log")
return g * a + (1 - g) * tf.exp(m)
|
[
"def",
"nalu",
"(",
"x",
",",
"depth",
",",
"epsilon",
"=",
"1e-30",
",",
"name",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"nalu\"",
",",
"values",
"=",
"[",
"x",
"]",
",",
"reuse",
"=",
"reuse",
")",
":",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"x_flat",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"x_shape",
"[",
"-",
"1",
"]",
"]",
")",
"gw",
"=",
"tf",
".",
"get_variable",
"(",
"\"w\"",
",",
"[",
"x_shape",
"[",
"-",
"1",
"]",
",",
"depth",
"]",
")",
"g",
"=",
"tf",
".",
"nn",
".",
"sigmoid",
"(",
"tf",
".",
"matmul",
"(",
"x_flat",
",",
"gw",
")",
")",
"g",
"=",
"tf",
".",
"reshape",
"(",
"g",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"depth",
"]",
")",
"a",
"=",
"nac",
"(",
"x",
",",
"depth",
",",
"name",
"=",
"\"nac_lin\"",
")",
"log_x",
"=",
"tf",
".",
"log",
"(",
"tf",
".",
"abs",
"(",
"x",
")",
"+",
"epsilon",
")",
"m",
"=",
"nac",
"(",
"log_x",
",",
"depth",
",",
"name",
"=",
"\"nac_log\"",
")",
"return",
"g",
"*",
"a",
"+",
"(",
"1",
"-",
"g",
")",
"*",
"tf",
".",
"exp",
"(",
"m",
")"
] |
NALU as in https://arxiv.org/abs/1808.00508.
|
[
"NALU",
"as",
"in",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1808",
".",
"00508",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3301-L3312
|
train
|
NALU as in the arXiv. org.
|
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,NL8dtWOpbc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Qr8gNKaIaWE,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(690 - 639) + '\x33' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110010 + 0o75) + '\x34' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b11001 + 0o33) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11100 + 0o25) + '\063' + '\067', 824 - 816), ehT0Px3KOsy9(chr(1974 - 1926) + '\157' + chr(837 - 786) + chr(731 - 682) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + chr(0b1001 + 0o52) + chr(2021 - 1968) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(0b110100) + '\064', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110000) + '\067', 0b1000), ehT0Px3KOsy9(chr(1000 - 952) + chr(0b1101111) + chr(0b110011) + chr(1610 - 1557) + '\067', 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(394 - 344) + chr(0b101101 + 0o7) + chr(621 - 569), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(184 - 133) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(2061 - 2013) + chr(1700 - 1589) + '\063' + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(2034 - 1923) + '\x31' + '\x35' + chr(861 - 810), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(50) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + '\x34' + chr(0b11100 + 0o32), 24504 - 24496), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2141 - 2089) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10000 + 0o42) + chr(49), 18871 - 18863), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10 + 0o64) + chr(49), 63155 - 63147), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1963 - 1913) + chr(2058 - 2009) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\x33' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(0b10001 + 0o41) + '\x34', 45356 - 45348), ehT0Px3KOsy9(chr(673 - 625) + '\157' + '\061' + chr(1110 - 1058) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9038 - 8927) + chr(1562 - 1512) + chr(0b101100 + 0o11) + '\062', 22585 - 22577), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(51), 24265 - 24257), ehT0Px3KOsy9('\060' + chr(111) + '\067' + chr(1988 - 1938), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1768 - 1719) + '\x37' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b100010 + 0o20) + chr(1183 - 1131), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\062' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\x34' + '\064', 8), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + '\063' + '\x37' + chr(53), 15942 - 15934), ehT0Px3KOsy9('\x30' + chr(0b1100100 + 0o13) + '\x37' + chr(0b11011 + 0o32), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\x6f' + chr(0b11111 + 0o24) + chr(0b110111) + chr(0b10110 + 0o34), 0o10), ehT0Px3KOsy9(chr(48) + chr(3939 - 3828) + chr(0b10001 + 0o42) + chr(0b101011 + 0o10) + '\062', 1020 - 1012), ehT0Px3KOsy9(chr(1917 - 1869) + chr(0b1011000 + 0o27) + chr(0b100110 + 0o13) + chr(0b100001 + 0o26) + chr(1200 - 1151), 56783 - 56775), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(757 - 709) + chr(9120 - 9009) + chr(0b10100 + 0o37) + chr(731 - 679) + chr(84 - 33), 63179 - 63171), ehT0Px3KOsy9('\x30' + chr(7574 - 7463) + '\066' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(2304 - 2256) + chr(111) + chr(0b11110 + 0o24) + '\x31', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110101) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + '\062' + chr(0b110100 + 0o1) + chr(0b100111 + 0o16), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + '\x35' + chr(48), 52665 - 52657)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf5'), '\144' + chr(466 - 365) + chr(0b10101 + 0o116) + '\x6f' + '\x64' + chr(101))(chr(7234 - 7117) + chr(0b10 + 0o162) + chr(6638 - 6536) + chr(0b101101) + chr(1476 - 1420)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cfKH3tOAlOyt(OeWW0F1dBPRQ, UEys4_lSwsID, Xtig2zAKpR0T=1e-30, AIvJRzLdDfgF=None, pmC5wdSFgdFj=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xadD\xd76\xa8\x8fH"\xb0\xd7\xfdw\x1b2'), chr(0b100111 + 0o75) + '\x65' + chr(0b100100 + 0o77) + chr(111) + chr(100) + chr(101))('\x75' + chr(1705 - 1589) + '\x66' + chr(0b101101) + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5D\xc9*'), chr(1519 - 1419) + chr(2336 - 2235) + '\143' + chr(0b11110 + 0o121) + chr(3908 - 3808) + '\x65')('\165' + chr(0b1110100) + chr(0b11000 + 0o116) + chr(0b101100 + 0o1) + chr(0b110001 + 0o7)), values=[OeWW0F1dBPRQ], reuse=pmC5wdSFgdFj):
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
mstS6zVd22Jf = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10010 + 0o37), 0b1000), QQEXXbdZyz6m[-ehT0Px3KOsy9('\060' + chr(111) + '\061', 8)]])
KH8fTulOhXFb = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xac'), chr(0b1100100) + chr(231 - 130) + '\x63' + chr(0b1101111) + '\144' + chr(0b1100101))(chr(1382 - 1265) + chr(0b1100011 + 0o21) + chr(8802 - 8700) + chr(45) + chr(3101 - 3045)), [QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1 + 0o156) + '\061', 8)], UEys4_lSwsID])
RWHpzFEeviFP = IDJ2eXGCBCDu.nn.sigmoid(IDJ2eXGCBCDu.matmul(mstS6zVd22Jf, KH8fTulOhXFb))
RWHpzFEeviFP = IDJ2eXGCBCDu.reshape(RWHpzFEeviFP, QQEXXbdZyz6m[:-ehT0Px3KOsy9('\060' + chr(111) + '\x31', 8)] + [UEys4_lSwsID])
XPh1qbAgrPgG = GY11u5J3xrRp(OeWW0F1dBPRQ, UEys4_lSwsID, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5D\xc6\x00\xa5\x84J'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + chr(100) + chr(101))('\165' + '\x74' + '\146' + chr(1069 - 1024) + chr(56)))
P9B3e_M3QNn4 = IDJ2eXGCBCDu.log(IDJ2eXGCBCDu.abs(OeWW0F1dBPRQ) + Xtig2zAKpR0T)
r8ufID9JCHnI = GY11u5J3xrRp(P9B3e_M3QNn4, UEys4_lSwsID, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5D\xc6\x00\xa5\x82C'), chr(0b1001111 + 0o25) + chr(0b10100 + 0o121) + chr(2996 - 2897) + chr(0b1101111) + chr(4143 - 4043) + '\145')(chr(117) + '\x74' + chr(102) + chr(0b101101) + chr(0b111000)))
return RWHpzFEeviFP * XPh1qbAgrPgG + (ehT0Px3KOsy9('\060' + chr(8190 - 8079) + '\061', 8) - RWHpzFEeviFP) * xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe]\xd5'), chr(0b1100100) + chr(3868 - 3767) + chr(0b101010 + 0o71) + '\157' + '\x64' + chr(4042 - 3941))(chr(117) + chr(0b1001110 + 0o46) + '\146' + '\055' + chr(0b111000)))(r8ufID9JCHnI)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
argmax_with_score
|
def argmax_with_score(logits, axis=None):
"""Argmax along with the value."""
axis = axis or len(logits.get_shape()) - 1
predictions = tf.argmax(logits, axis=axis)
logits_shape = shape_list(logits)
prefix_shape, vocab_size = logits_shape[:-1], logits_shape[-1]
prefix_size = 1
for d in prefix_shape:
prefix_size *= d
# Flatten to extract scores
flat_logits = tf.reshape(logits, [prefix_size, vocab_size])
flat_predictions = tf.reshape(predictions, [prefix_size])
flat_indices = tf.stack(
[tf.range(tf.to_int64(prefix_size)),
tf.to_int64(flat_predictions)],
axis=1)
flat_scores = tf.gather_nd(flat_logits, flat_indices)
# Unflatten
scores = tf.reshape(flat_scores, prefix_shape)
return predictions, scores
|
python
|
def argmax_with_score(logits, axis=None):
"""Argmax along with the value."""
axis = axis or len(logits.get_shape()) - 1
predictions = tf.argmax(logits, axis=axis)
logits_shape = shape_list(logits)
prefix_shape, vocab_size = logits_shape[:-1], logits_shape[-1]
prefix_size = 1
for d in prefix_shape:
prefix_size *= d
# Flatten to extract scores
flat_logits = tf.reshape(logits, [prefix_size, vocab_size])
flat_predictions = tf.reshape(predictions, [prefix_size])
flat_indices = tf.stack(
[tf.range(tf.to_int64(prefix_size)),
tf.to_int64(flat_predictions)],
axis=1)
flat_scores = tf.gather_nd(flat_logits, flat_indices)
# Unflatten
scores = tf.reshape(flat_scores, prefix_shape)
return predictions, scores
|
[
"def",
"argmax_with_score",
"(",
"logits",
",",
"axis",
"=",
"None",
")",
":",
"axis",
"=",
"axis",
"or",
"len",
"(",
"logits",
".",
"get_shape",
"(",
")",
")",
"-",
"1",
"predictions",
"=",
"tf",
".",
"argmax",
"(",
"logits",
",",
"axis",
"=",
"axis",
")",
"logits_shape",
"=",
"shape_list",
"(",
"logits",
")",
"prefix_shape",
",",
"vocab_size",
"=",
"logits_shape",
"[",
":",
"-",
"1",
"]",
",",
"logits_shape",
"[",
"-",
"1",
"]",
"prefix_size",
"=",
"1",
"for",
"d",
"in",
"prefix_shape",
":",
"prefix_size",
"*=",
"d",
"# Flatten to extract scores",
"flat_logits",
"=",
"tf",
".",
"reshape",
"(",
"logits",
",",
"[",
"prefix_size",
",",
"vocab_size",
"]",
")",
"flat_predictions",
"=",
"tf",
".",
"reshape",
"(",
"predictions",
",",
"[",
"prefix_size",
"]",
")",
"flat_indices",
"=",
"tf",
".",
"stack",
"(",
"[",
"tf",
".",
"range",
"(",
"tf",
".",
"to_int64",
"(",
"prefix_size",
")",
")",
",",
"tf",
".",
"to_int64",
"(",
"flat_predictions",
")",
"]",
",",
"axis",
"=",
"1",
")",
"flat_scores",
"=",
"tf",
".",
"gather_nd",
"(",
"flat_logits",
",",
"flat_indices",
")",
"# Unflatten",
"scores",
"=",
"tf",
".",
"reshape",
"(",
"flat_scores",
",",
"prefix_shape",
")",
"return",
"predictions",
",",
"scores"
] |
Argmax along with the value.
|
[
"Argmax",
"along",
"with",
"the",
"value",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3315-L3338
|
train
|
Argmax along with the value.
|
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,sznFqDbNBHl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RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1010000 + 0o37) + '\x33' + chr(0b100011 + 0o15) + chr(1959 - 1908), 0b1000), ehT0Px3KOsy9(chr(76 - 28) + chr(7793 - 7682) + chr(0b110011) + chr(0b110110) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + '\060' + chr(49), 14823 - 14815), ehT0Px3KOsy9(chr(48) + chr(10613 - 10502) + '\061' + '\064' + chr(265 - 217), 0o10), ehT0Px3KOsy9(chr(194 - 146) + chr(4462 - 4351) + '\x31' + chr(0b110011) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + chr(2639 - 2587) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(257 - 209) + '\157' + chr(2057 - 2007) + '\063' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(1690 - 1641) + chr(1552 - 1498) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(0b1001 + 0o52) + '\064' + '\062', 34561 - 34553), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + '\x36' + chr(1072 - 1021), 0b1000), ehT0Px3KOsy9(chr(2247 - 2199) + chr(0b1101111) + chr(0b110011) + chr(48) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(0b100010 + 0o21) + chr(0b110 + 0o54) + chr(0b10 + 0o61), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b110000) + chr(54), 6580 - 6572), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\063' + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(4997 - 4886) + chr(0b100001 + 0o22) + '\x34' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(370 - 322) + '\157' + chr(0b10 + 0o57) + chr(257 - 209), 5026 - 5018), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(2181 - 2133) + chr(3375 - 3264) + chr(1833 - 1783) + chr(0b1100 + 0o52) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + chr(50) + '\063' + chr(0b110000), 61226 - 61218), ehT0Px3KOsy9('\060' + chr(4266 - 4155) + '\x33' + chr(0b100110 + 0o21) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\x34' + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100000 + 0o21) + chr(0b110101) + chr(2110 - 2057), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(5329 - 5218) + '\x32' + chr(0b1010 + 0o53), 53914 - 53906), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + '\063' + chr(1741 - 1692) + chr(0b11001 + 0o32), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(53) + '\x35', 14670 - 14662), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10011 + 0o40) + chr(0b100 + 0o57) + '\x32', 0b1000), ehT0Px3KOsy9(chr(1063 - 1015) + chr(1326 - 1215) + chr(2732 - 2677) + chr(0b10110 + 0o37), 0b1000), ehT0Px3KOsy9(chr(1222 - 1174) + chr(0b1101111) + chr(0b110010) + '\063' + '\x37', 61408 - 61400), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b111 + 0o53) + '\x36', 0b1000), ehT0Px3KOsy9(chr(111 - 63) + '\x6f' + '\063' + '\x31' + chr(48), 43310 - 43302), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(49) + chr(0b110000), 8), ehT0Px3KOsy9(chr(48) + chr(322 - 211) + chr(51) + chr(54) + chr(1119 - 1071), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8833 - 8722) + chr(0b110010) + chr(0b110011) + chr(0b11000 + 0o36), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\061' + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b1001 + 0o53) + '\062', 8), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1001001 + 0o46) + chr(0b1001 + 0o56) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(48) + chr(0b10011 + 0o41), 0o10), ehT0Px3KOsy9(chr(274 - 226) + chr(0b1110 + 0o141) + '\062' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + '\x31' + '\x36' + chr(54), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\x35' + chr(55), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xed'), chr(100) + '\145' + '\x63' + '\157' + chr(0b111101 + 0o47) + '\x65')(chr(8424 - 8307) + '\x74' + chr(0b1100110) + chr(0b11001 + 0o24) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Nt_dIdLTcLcL(wF9nmvjsKjYM, cRTh61qyvi24=None):
cRTh61qyvi24 = cRTh61qyvi24 or c2A0yzQpDQB3(wF9nmvjsKjYM.get_shape()) - ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001), 4213 - 4205)
qIQi_VFCIFZL = IDJ2eXGCBCDu.argmax(wF9nmvjsKjYM, axis=cRTh61qyvi24)
Isx8k9uq36YR = qypPRW8fq869(wF9nmvjsKjYM)
(qnZMKiEqGlaE, CeyMIoSyrpkQ) = (Isx8k9uq36YR[:-ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1000100 + 0o53) + chr(49), 8)], Isx8k9uq36YR[-ehT0Px3KOsy9(chr(125 - 77) + '\x6f' + chr(49), 8)])
f9ipfVvdAqeI = ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 8)
for pd3lxn9vqWxp in qnZMKiEqGlaE:
f9ipfVvdAqeI *= pd3lxn9vqWxp
mQgwxqmMBPjj = IDJ2eXGCBCDu.reshape(wF9nmvjsKjYM, [f9ipfVvdAqeI, CeyMIoSyrpkQ])
myAkZN3N8rPX = IDJ2eXGCBCDu.reshape(qIQi_VFCIFZL, [f9ipfVvdAqeI])
AmKoPXmweaxq = IDJ2eXGCBCDu.stack([IDJ2eXGCBCDu.range(IDJ2eXGCBCDu.to_int64(f9ipfVvdAqeI)), IDJ2eXGCBCDu.to_int64(myAkZN3N8rPX)], axis=ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8))
ueV8TvBPeUpy = IDJ2eXGCBCDu.gather_nd(mQgwxqmMBPjj, AmKoPXmweaxq)
b8rpGniBNUPr = IDJ2eXGCBCDu.reshape(ueV8TvBPeUpy, qnZMKiEqGlaE)
return (qIQi_VFCIFZL, b8rpGniBNUPr)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
top_kth_iterative
|
def top_kth_iterative(x, k):
"""Compute the k-th top element of x on the last axis iteratively.
This assumes values in x are non-negative, rescale if needed.
It is often faster than tf.nn.top_k for small k, especially if k < 30.
Note: this does not support back-propagation, it stops gradients!
Args:
x: a Tensor of non-negative numbers of type float.
k: a python integer.
Returns:
a float tensor of the same shape as x but with 1 on the last axis
that contains the k-th largest number in x.
"""
# The iterative computation is as follows:
#
# cur_x = x
# for _ in range(k):
# top_x = maximum of elements of cur_x on the last axis
# cur_x = cur_x where cur_x < top_x and 0 everywhere else (top elements)
#
# We encode this computation in a TF graph using tf.foldl, so the inner
# part of the above loop is called "next_x" and tf.foldl does the loop.
def next_x(cur_x, _):
top_x = tf.reduce_max(cur_x, axis=-1, keep_dims=True)
return cur_x * to_float(cur_x < top_x)
# We only do k-1 steps of the loop and compute the final max separately.
fin_x = tf.foldl(next_x, tf.range(k - 1), initializer=tf.stop_gradient(x),
parallel_iterations=2, back_prop=False)
return tf.stop_gradient(tf.reduce_max(fin_x, axis=-1, keep_dims=True))
|
python
|
def top_kth_iterative(x, k):
"""Compute the k-th top element of x on the last axis iteratively.
This assumes values in x are non-negative, rescale if needed.
It is often faster than tf.nn.top_k for small k, especially if k < 30.
Note: this does not support back-propagation, it stops gradients!
Args:
x: a Tensor of non-negative numbers of type float.
k: a python integer.
Returns:
a float tensor of the same shape as x but with 1 on the last axis
that contains the k-th largest number in x.
"""
# The iterative computation is as follows:
#
# cur_x = x
# for _ in range(k):
# top_x = maximum of elements of cur_x on the last axis
# cur_x = cur_x where cur_x < top_x and 0 everywhere else (top elements)
#
# We encode this computation in a TF graph using tf.foldl, so the inner
# part of the above loop is called "next_x" and tf.foldl does the loop.
def next_x(cur_x, _):
top_x = tf.reduce_max(cur_x, axis=-1, keep_dims=True)
return cur_x * to_float(cur_x < top_x)
# We only do k-1 steps of the loop and compute the final max separately.
fin_x = tf.foldl(next_x, tf.range(k - 1), initializer=tf.stop_gradient(x),
parallel_iterations=2, back_prop=False)
return tf.stop_gradient(tf.reduce_max(fin_x, axis=-1, keep_dims=True))
|
[
"def",
"top_kth_iterative",
"(",
"x",
",",
"k",
")",
":",
"# The iterative computation is as follows:",
"#",
"# cur_x = x",
"# for _ in range(k):",
"# top_x = maximum of elements of cur_x on the last axis",
"# cur_x = cur_x where cur_x < top_x and 0 everywhere else (top elements)",
"#",
"# We encode this computation in a TF graph using tf.foldl, so the inner",
"# part of the above loop is called \"next_x\" and tf.foldl does the loop.",
"def",
"next_x",
"(",
"cur_x",
",",
"_",
")",
":",
"top_x",
"=",
"tf",
".",
"reduce_max",
"(",
"cur_x",
",",
"axis",
"=",
"-",
"1",
",",
"keep_dims",
"=",
"True",
")",
"return",
"cur_x",
"*",
"to_float",
"(",
"cur_x",
"<",
"top_x",
")",
"# We only do k-1 steps of the loop and compute the final max separately.",
"fin_x",
"=",
"tf",
".",
"foldl",
"(",
"next_x",
",",
"tf",
".",
"range",
"(",
"k",
"-",
"1",
")",
",",
"initializer",
"=",
"tf",
".",
"stop_gradient",
"(",
"x",
")",
",",
"parallel_iterations",
"=",
"2",
",",
"back_prop",
"=",
"False",
")",
"return",
"tf",
".",
"stop_gradient",
"(",
"tf",
".",
"reduce_max",
"(",
"fin_x",
",",
"axis",
"=",
"-",
"1",
",",
"keep_dims",
"=",
"True",
")",
")"
] |
Compute the k-th top element of x on the last axis iteratively.
This assumes values in x are non-negative, rescale if needed.
It is often faster than tf.nn.top_k for small k, especially if k < 30.
Note: this does not support back-propagation, it stops gradients!
Args:
x: a Tensor of non-negative numbers of type float.
k: a python integer.
Returns:
a float tensor of the same shape as x but with 1 on the last axis
that contains the k-th largest number in x.
|
[
"Compute",
"the",
"k",
"-",
"th",
"top",
"element",
"of",
"x",
"on",
"the",
"last",
"axis",
"iteratively",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3345-L3375
|
train
|
Compute the k - th top element of x on the last axis iteratively.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0h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S9P6_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(0b100110 + 0o12) + chr(0b1101111) + chr(0b110001) + '\060' + chr(0b10100 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(80 - 26) + '\066', 12428 - 12420), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(1466 - 1412) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\065' + chr(0b110011 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(973 - 922) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + chr(0b110010) + '\x37' + '\x36', 10324 - 10316), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + '\062' + chr(0b110101) + chr(2349 - 2295), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(0b1101 + 0o47) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + '\063' + chr(48) + chr(0b1001 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100110 + 0o111) + chr(1733 - 1683) + chr(0b101101 + 0o7) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10 + 0o60) + '\067' + '\x34', 55705 - 55697), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(167 - 113) + chr(302 - 252), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + '\x36' + '\064', 75 - 67), ehT0Px3KOsy9('\x30' + '\157' + chr(430 - 381) + chr(0b110100) + chr(0b10010 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(883 - 832) + '\x30' + chr(2787 - 2734), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b111 + 0o54) + chr(0b110011) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(0b101 + 0o55) + chr(473 - 418) + chr(159 - 111), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\064' + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + chr(0b110010) + chr(48) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(0b101 + 0o54) + chr(55) + chr(0b110000), 16833 - 16825), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b110 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(1642 - 1594) + chr(111) + '\x31' + chr(54) + '\064', 8), ehT0Px3KOsy9(chr(899 - 851) + chr(0b1101111) + '\063' + chr(529 - 474), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7093 - 6982) + chr(0b10111 + 0o34) + chr(50) + chr(2285 - 2233), ord("\x08")), ehT0Px3KOsy9(chr(1609 - 1561) + chr(0b1101111) + '\x31' + chr(48) + chr(0b10001 + 0o43), 8), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1000010 + 0o55) + chr(0b10010 + 0o37) + chr(48) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(1275 - 1227) + chr(0b1101111) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(646 - 598) + '\157' + chr(0b110010) + chr(49) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(2907 - 2853) + '\064', 0o10), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + '\x31' + chr(0b110110) + '\x30', 0o10), ehT0Px3KOsy9(chr(2271 - 2223) + chr(111) + '\x31' + chr(0b10110 + 0o40) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(2626 - 2571) + '\065', 4825 - 4817), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110001) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(49) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + '\064' + chr(489 - 437), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(0b10111 + 0o34) + chr(0b0 + 0o64), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(48) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\067' + chr(51), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1945 - 1897) + chr(0b1001011 + 0o44) + chr(0b10101 + 0o40) + chr(0b1111 + 0o41), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'j'), chr(100) + chr(0b10100 + 0o121) + '\x63' + chr(111) + chr(0b1100100) + chr(2789 - 2688))(chr(5481 - 5364) + '\x74' + '\x66' + chr(1453 - 1408) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def rzPgvS0Ymxr7(OeWW0F1dBPRQ, OolUPRJhRaJd):
def XJ5ZCLyI93aS(EVAOItfNIMCl, VNGQdHSFPrso):
fVsjeSxpT6vT = IDJ2eXGCBCDu.reduce_max(EVAOItfNIMCl, axis=-ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11000 + 0o31), 0o10), keep_dims=ehT0Px3KOsy9(chr(476 - 428) + chr(3004 - 2893) + '\x31', 8))
return EVAOItfNIMCl * ZUL3kHBGU8Uu(EVAOItfNIMCl < fVsjeSxpT6vT)
JgPOHvzPeDSx = IDJ2eXGCBCDu.foldl(XJ5ZCLyI93aS, IDJ2eXGCBCDu.range(OolUPRJhRaJd - ehT0Px3KOsy9(chr(48) + chr(251 - 140) + '\061', 8)), initializer=IDJ2eXGCBCDu.stop_gradient(OeWW0F1dBPRQ), parallel_iterations=ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10000 + 0o42), 8), back_prop=ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(0b110000), 46513 - 46505))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'7\x02\xdc\x1d\x83\xd9\xdc\xc4\xa4\xca\xd9\x9c\x00'), '\x64' + chr(6762 - 6661) + chr(99) + '\x6f' + '\x64' + chr(3509 - 3408))(chr(117) + '\164' + '\x66' + chr(0b101101) + chr(0b10010 + 0o46)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'6\x13\xd7\x18\xbf\xdb\xf1\xc8\xa1\xdb'), chr(2161 - 2061) + chr(101) + chr(0b1010000 + 0o23) + chr(0b1101111) + chr(8226 - 8126) + chr(0b1011000 + 0o15))('\x75' + '\164' + chr(3588 - 3486) + chr(0b101101) + '\070'))(JgPOHvzPeDSx, axis=-ehT0Px3KOsy9('\060' + chr(111) + chr(0b100100 + 0o15), 8), keep_dims=ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), 8)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
top_1_tpu
|
def top_1_tpu(inputs):
"""find max and argmax over the last dimension.
Works well on TPU
Args:
inputs: A tensor with shape [..., depth]
Returns:
values: a Tensor with shape [...]
indices: a Tensor with shape [...]
"""
inputs_max = tf.reduce_max(inputs, axis=-1, keepdims=True)
mask = tf.to_int32(tf.equal(inputs_max, inputs))
index = tf.range(tf.shape(inputs)[-1]) * mask
return tf.squeeze(inputs_max, -1), tf.reduce_max(index, axis=-1)
|
python
|
def top_1_tpu(inputs):
"""find max and argmax over the last dimension.
Works well on TPU
Args:
inputs: A tensor with shape [..., depth]
Returns:
values: a Tensor with shape [...]
indices: a Tensor with shape [...]
"""
inputs_max = tf.reduce_max(inputs, axis=-1, keepdims=True)
mask = tf.to_int32(tf.equal(inputs_max, inputs))
index = tf.range(tf.shape(inputs)[-1]) * mask
return tf.squeeze(inputs_max, -1), tf.reduce_max(index, axis=-1)
|
[
"def",
"top_1_tpu",
"(",
"inputs",
")",
":",
"inputs_max",
"=",
"tf",
".",
"reduce_max",
"(",
"inputs",
",",
"axis",
"=",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"mask",
"=",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"equal",
"(",
"inputs_max",
",",
"inputs",
")",
")",
"index",
"=",
"tf",
".",
"range",
"(",
"tf",
".",
"shape",
"(",
"inputs",
")",
"[",
"-",
"1",
"]",
")",
"*",
"mask",
"return",
"tf",
".",
"squeeze",
"(",
"inputs_max",
",",
"-",
"1",
")",
",",
"tf",
".",
"reduce_max",
"(",
"index",
",",
"axis",
"=",
"-",
"1",
")"
] |
find max and argmax over the last dimension.
Works well on TPU
Args:
inputs: A tensor with shape [..., depth]
Returns:
values: a Tensor with shape [...]
indices: a Tensor with shape [...]
|
[
"find",
"max",
"and",
"argmax",
"over",
"the",
"last",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3378-L3393
|
train
|
find max and argmax over the last dimension. TPU
Works well on TPU
Works well on TPU
Works well on TPU
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5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0yzQpDQB3,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(1739 - 1691) + chr(0b1101111) + chr(49) + '\063' + '\x32', 31661 - 31653), ehT0Px3KOsy9(chr(1803 - 1755) + chr(111) + chr(0b10011 + 0o40) + chr(0b1001 + 0o51), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + '\x33' + chr(0b0 + 0o65) + chr(2303 - 2249), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(1485 - 1430), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100001 + 0o16) + chr(0b1100 + 0o46) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2284 - 2235) + chr(1764 - 1709) + chr(0b11000 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\x33' + chr(464 - 416), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b110 + 0o54) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\067' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(655 - 607) + chr(51), 42262 - 42254), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110010) + chr(1310 - 1260), 33971 - 33963), ehT0Px3KOsy9(chr(48) + chr(0b111001 + 0o66) + chr(0b10011 + 0o40) + chr(0b110000) + '\x35', 15167 - 15159), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b110101) + chr(0b11000 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(679 - 631) + chr(111) + chr(0b110010) + chr(0b100000 + 0o22) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1110 + 0o43) + chr(0b101101 + 0o6) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\064' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + '\064' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b100101 + 0o112) + chr(52) + chr(48), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b110001) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1 + 0o62) + chr(0b110111) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(11594 - 11483) + chr(533 - 481) + chr(1799 - 1748), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2511 - 2400) + chr(0b10010 + 0o41) + chr(55) + chr(0b110000), 19938 - 19930), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + chr(1307 - 1258) + chr(0b110111) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b11100 + 0o33) + chr(1210 - 1160), 0o10), ehT0Px3KOsy9(chr(1488 - 1440) + chr(111) + chr(50) + chr(55) + chr(0b110111), 52836 - 52828), ehT0Px3KOsy9('\060' + '\x6f' + '\067' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(51) + chr(0b101001 + 0o15) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + chr(1797 - 1748) + '\x37' + chr(0b100011 + 0o17), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x34' + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\061' + '\062', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(51) + chr(1965 - 1912) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(3760 - 3649) + '\x37' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\x33' + chr(1751 - 1702), 42612 - 42604), ehT0Px3KOsy9('\060' + chr(111) + chr(1616 - 1566) + chr(48) + chr(51), 8), ehT0Px3KOsy9(chr(1844 - 1796) + chr(0b1101111) + chr(0b1110 + 0o46) + chr(0b110011), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(2176 - 2127) + chr(49) + chr(0b100110 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(1713 - 1665) + '\x6f' + chr(590 - 539) + chr(1523 - 1471) + chr(1973 - 1925), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + '\x33' + chr(0b11 + 0o55) + chr(1656 - 1606), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110000 + 0o77) + '\065' + '\067', 20944 - 20936), ehT0Px3KOsy9('\060' + chr(111) + chr(1360 - 1311) + chr(55) + chr(0b110000 + 0o1), 566 - 558)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + chr(0b110000), 64281 - 64273)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b't'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + '\144' + '\145')(chr(0b1011101 + 0o30) + chr(2532 - 2416) + chr(102) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mgtr8lsOGXed(vXoupepMtCXU):
nQ7i74sJAI76 = IDJ2eXGCBCDu.reduce_max(vXoupepMtCXU, axis=-ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 0b1000), keepdims=ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(2056 - 1945) + '\x31', 8))
Iz1jSgUKZDvt = IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.equal(nQ7i74sJAI76, vXoupepMtCXU))
XdowRbJKZWL9 = IDJ2eXGCBCDu.range(IDJ2eXGCBCDu.nauYfLglTpcb(vXoupepMtCXU)[-ehT0Px3KOsy9(chr(1673 - 1625) + chr(111) + chr(279 - 230), 8)]) * Iz1jSgUKZDvt
return (xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b')k\x9bjs\x02\xfd'), chr(0b1100100) + chr(0b100111 + 0o76) + '\143' + '\x6f' + '\144' + '\145')('\165' + chr(10116 - 10000) + chr(9177 - 9075) + chr(0b101101) + chr(0b100110 + 0o22)))(nQ7i74sJAI76, -ehT0Px3KOsy9(chr(0b110000) + chr(9851 - 9740) + chr(2305 - 2256), 8)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'(\x7f\x8azu\x1d\xc7=\x1d\xfb'), chr(0b1100100) + chr(0b100 + 0o141) + chr(9666 - 9567) + chr(111) + chr(0b111111 + 0o45) + '\145')('\x75' + '\x74' + '\146' + chr(45) + chr(0b101001 + 0o17)))(XdowRbJKZWL9, axis=-ehT0Px3KOsy9('\060' + chr(0b100100 + 0o113) + chr(0b110001), 8)))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
index_last_dim_with_indices
|
def index_last_dim_with_indices(x, indices):
"""Use indices to index into the last axis of x.
This can be useful for recovering the actual probabilities of a sample from a
probability distribution.
Args:
x: Tensor, n-d.
indices: Tensor, (n-1)-d, where the dimension sizes match the first (n-1)
dimensions of x. The values of indices will be used to index into the last
axis of x.
Returns:
Tensor, (n-1)-d.
"""
assert len(x.shape) == len(indices.shape) + 1
x_shape = shape_list(x)
vocab_size = x_shape[-1]
flat_x = tf.reshape(x, [list_product(x_shape[:-1]), vocab_size])
flat_indices = tf.reshape(indices, [list_product(x_shape[:-1])])
idx = tf.stack(
[
tf.range(tf.to_int64(shape_list(flat_indices)[0])),
tf.to_int64(flat_indices)
],
axis=1)
flat_x_idx = tf.gather_nd(flat_x, idx)
x_idx = tf.reshape(flat_x_idx, x_shape[:-1])
return x_idx
|
python
|
def index_last_dim_with_indices(x, indices):
"""Use indices to index into the last axis of x.
This can be useful for recovering the actual probabilities of a sample from a
probability distribution.
Args:
x: Tensor, n-d.
indices: Tensor, (n-1)-d, where the dimension sizes match the first (n-1)
dimensions of x. The values of indices will be used to index into the last
axis of x.
Returns:
Tensor, (n-1)-d.
"""
assert len(x.shape) == len(indices.shape) + 1
x_shape = shape_list(x)
vocab_size = x_shape[-1]
flat_x = tf.reshape(x, [list_product(x_shape[:-1]), vocab_size])
flat_indices = tf.reshape(indices, [list_product(x_shape[:-1])])
idx = tf.stack(
[
tf.range(tf.to_int64(shape_list(flat_indices)[0])),
tf.to_int64(flat_indices)
],
axis=1)
flat_x_idx = tf.gather_nd(flat_x, idx)
x_idx = tf.reshape(flat_x_idx, x_shape[:-1])
return x_idx
|
[
"def",
"index_last_dim_with_indices",
"(",
"x",
",",
"indices",
")",
":",
"assert",
"len",
"(",
"x",
".",
"shape",
")",
"==",
"len",
"(",
"indices",
".",
"shape",
")",
"+",
"1",
"x_shape",
"=",
"shape_list",
"(",
"x",
")",
"vocab_size",
"=",
"x_shape",
"[",
"-",
"1",
"]",
"flat_x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"list_product",
"(",
"x_shape",
"[",
":",
"-",
"1",
"]",
")",
",",
"vocab_size",
"]",
")",
"flat_indices",
"=",
"tf",
".",
"reshape",
"(",
"indices",
",",
"[",
"list_product",
"(",
"x_shape",
"[",
":",
"-",
"1",
"]",
")",
"]",
")",
"idx",
"=",
"tf",
".",
"stack",
"(",
"[",
"tf",
".",
"range",
"(",
"tf",
".",
"to_int64",
"(",
"shape_list",
"(",
"flat_indices",
")",
"[",
"0",
"]",
")",
")",
",",
"tf",
".",
"to_int64",
"(",
"flat_indices",
")",
"]",
",",
"axis",
"=",
"1",
")",
"flat_x_idx",
"=",
"tf",
".",
"gather_nd",
"(",
"flat_x",
",",
"idx",
")",
"x_idx",
"=",
"tf",
".",
"reshape",
"(",
"flat_x_idx",
",",
"x_shape",
"[",
":",
"-",
"1",
"]",
")",
"return",
"x_idx"
] |
Use indices to index into the last axis of x.
This can be useful for recovering the actual probabilities of a sample from a
probability distribution.
Args:
x: Tensor, n-d.
indices: Tensor, (n-1)-d, where the dimension sizes match the first (n-1)
dimensions of x. The values of indices will be used to index into the last
axis of x.
Returns:
Tensor, (n-1)-d.
|
[
"Use",
"indices",
"to",
"index",
"into",
"the",
"last",
"axis",
"of",
"x",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3396-L3429
|
train
|
Use indices to index into the last axis of x.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvs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Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1116 - 1068) + chr(0b11010 + 0o125) + '\061' + chr(0b110111) + chr(0b101100 + 0o6), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), 11022 - 11014), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + chr(0b11000 + 0o31) + chr(0b100001 + 0o17) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\066' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(2101 - 2053) + chr(0b11 + 0o154) + chr(52) + chr(2968 - 2913), 0b1000), ehT0Px3KOsy9('\x30' + chr(3158 - 3047) + chr(2299 - 2249) + chr(0b110010) + '\065', 13483 - 13475), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b100101 + 0o14) + chr(0b10011 + 0o36), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7982 - 7871) + chr(1129 - 1079) + chr(0b110001 + 0o1) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(1910 - 1861) + '\x30', 4913 - 4905), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b101001 + 0o106) + chr(601 - 551) + chr(0b11010 + 0o32) + chr(2479 - 2427), 0b1000), ehT0Px3KOsy9(chr(1433 - 1385) + chr(111) + chr(0b100111 + 0o12) + chr(1648 - 1594) + chr(371 - 320), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b100101 + 0o14) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(54), 14333 - 14325), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(1230 - 1181) + chr(48) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11 + 0o63) + chr(578 - 530), ord("\x08")), ehT0Px3KOsy9(chr(167 - 119) + chr(469 - 358) + chr(0b101010 + 0o11) + '\x37' + '\067', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b101100 + 0o6) + '\060' + chr(1219 - 1164), 4398 - 4390), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\x36' + chr(0b111 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8775 - 8664) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + '\x33' + '\x34' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100001 + 0o22) + '\x37' + chr(1854 - 1805), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1889 - 1838) + '\x37' + '\x31', 8), ehT0Px3KOsy9('\060' + chr(0b1101001 + 0o6) + chr(341 - 286) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1914 - 1865) + chr(752 - 700) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b111101 + 0o62) + chr(50) + chr(1816 - 1764) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(53) + chr(0b1000 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\061' + chr(1797 - 1747), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(50) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(54) + chr(0b100 + 0o63), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110000 + 0o3) + chr(51) + '\064', 0b1000), ehT0Px3KOsy9(chr(1389 - 1341) + '\157' + chr(49) + chr(0b101000 + 0o12) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x35' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(7913 - 7802) + '\062' + chr(48) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(10197 - 10086) + chr(1703 - 1652) + '\067' + chr(0b11 + 0o63), 5165 - 5157), ehT0Px3KOsy9('\x30' + chr(4346 - 4235) + '\x36' + chr(1615 - 1562), ord("\x08")), ehT0Px3KOsy9(chr(1775 - 1727) + '\157' + '\x32' + chr(0b1010 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(1397 - 1349) + '\157' + chr(1564 - 1514) + chr(956 - 906) + chr(51), 0o10), ehT0Px3KOsy9(chr(1485 - 1437) + chr(111) + chr(0b11010 + 0o31) + '\066' + chr(1514 - 1465), 46054 - 46046), ehT0Px3KOsy9(chr(1717 - 1669) + '\157' + chr(0b110001) + chr(0b0 + 0o61) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(5525 - 5414) + '\063' + chr(0b110010) + chr(0b11111 + 0o30), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1505 - 1457) + chr(111) + chr(53) + chr(2041 - 1993), 23534 - 23526)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'T'), chr(100) + chr(0b1100101) + chr(99) + chr(1121 - 1010) + chr(0b1100100) + '\145')(chr(0b1011100 + 0o31) + '\x74' + chr(0b1100110) + '\055' + chr(0b10010 + 0o46)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def oRGMhvQeXo8N(OeWW0F1dBPRQ, pIcoaXENl5Pw):
assert c2A0yzQpDQB3(xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14`7hA\xd9\xee\xfd\x9c\xd4\x10*'), chr(7927 - 7827) + chr(101) + '\x63' + chr(131 - 20) + chr(0b1100100) + chr(371 - 270))('\x75' + '\x74' + chr(102) + chr(1504 - 1459) + chr(858 - 802)))) == c2A0yzQpDQB3(xafqLlk3kkUe(pIcoaXENl5Pw, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14`7hA\xd9\xee\xfd\x9c\xd4\x10*'), chr(100) + chr(101) + chr(138 - 39) + chr(7163 - 7052) + chr(100) + chr(0b1100101))('\x75' + '\164' + chr(0b1011101 + 0o11) + chr(0b101100 + 0o1) + '\x38'))) + ehT0Px3KOsy9(chr(1904 - 1856) + chr(111) + '\061', 8)
QQEXXbdZyz6m = qypPRW8fq869(OeWW0F1dBPRQ)
CeyMIoSyrpkQ = QQEXXbdZyz6m[-ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 8)]
P3dJde4zOufD = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [qltV2nt0Wgch(QQEXXbdZyz6m[:-ehT0Px3KOsy9('\060' + chr(11182 - 11071) + '\061', 8)]), CeyMIoSyrpkQ])
AmKoPXmweaxq = IDJ2eXGCBCDu.reshape(pIcoaXENl5Pw, [qltV2nt0Wgch(QQEXXbdZyz6m[:-ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b110001), 8)])])
YlqusYB6InkM = IDJ2eXGCBCDu.stack([IDJ2eXGCBCDu.range(IDJ2eXGCBCDu.to_int64(qypPRW8fq869(AmKoPXmweaxq)[ehT0Px3KOsy9(chr(119 - 71) + chr(7492 - 7381) + chr(48), 0o10)])), IDJ2eXGCBCDu.to_int64(AmKoPXmweaxq)], axis=ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b1011 + 0o46), 8))
BjD5RpbGBJys = IDJ2eXGCBCDu.gather_nd(P3dJde4zOufD, YlqusYB6InkM)
lnS29g1qSw2N = IDJ2eXGCBCDu.reshape(BjD5RpbGBJys, QQEXXbdZyz6m[:-ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061', 8)])
return lnS29g1qSw2N
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
should_generate_summaries
|
def should_generate_summaries():
"""Is this an appropriate context to generate summaries.
Returns:
a boolean
"""
name_scope = tf.contrib.framework.get_name_scope()
if name_scope and "while/" in name_scope:
# Summaries don't work well within tf.while_loop()
return False
if tf.get_variable_scope().reuse:
# Avoid generating separate summaries for different data shards
return False
return True
|
python
|
def should_generate_summaries():
"""Is this an appropriate context to generate summaries.
Returns:
a boolean
"""
name_scope = tf.contrib.framework.get_name_scope()
if name_scope and "while/" in name_scope:
# Summaries don't work well within tf.while_loop()
return False
if tf.get_variable_scope().reuse:
# Avoid generating separate summaries for different data shards
return False
return True
|
[
"def",
"should_generate_summaries",
"(",
")",
":",
"name_scope",
"=",
"tf",
".",
"contrib",
".",
"framework",
".",
"get_name_scope",
"(",
")",
"if",
"name_scope",
"and",
"\"while/\"",
"in",
"name_scope",
":",
"# Summaries don't work well within tf.while_loop()",
"return",
"False",
"if",
"tf",
".",
"get_variable_scope",
"(",
")",
".",
"reuse",
":",
"# Avoid generating separate summaries for different data shards",
"return",
"False",
"return",
"True"
] |
Is this an appropriate context to generate summaries.
Returns:
a boolean
|
[
"Is",
"this",
"an",
"appropriate",
"context",
"to",
"generate",
"summaries",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3432-L3445
|
train
|
Returns True if the current context should generate summaries.
|
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,BXIwDAS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xlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1746 - 1698) + chr(111) + chr(0b101011 + 0o6) + chr(1143 - 1091) + '\x35', 53711 - 53703), ehT0Px3KOsy9(chr(48) + chr(12293 - 12182) + '\062' + chr(2551 - 2498) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1282 - 1227) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x36' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(1329 - 1218) + chr(51) + '\x36' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(0b100110 + 0o12) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + chr(1188 - 1137) + '\x31' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + '\062' + chr(0b110101) + chr(0b10100 + 0o41), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b10100 + 0o41) + '\061', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1804 - 1756) + chr(0b1001010 + 0o45) + chr(51) + chr(52) + '\061', 55334 - 55326), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b110010) + chr(0b110010) + chr(0b11101 + 0o25), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101101 + 0o2) + '\067' + chr(2134 - 2086), 24508 - 24500), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110100) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1112 - 1063) + chr(0b100010 + 0o25) + chr(2691 - 2637), 43370 - 43362), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110011) + chr(0b1110 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11110 + 0o26) + '\061', 46189 - 46181), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b10101 + 0o35) + chr(0b1010 + 0o47), 17981 - 17973), ehT0Px3KOsy9(chr(344 - 296) + chr(0b1101111) + chr(1448 - 1398) + chr(0b100010 + 0o21) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b10001 + 0o136) + chr(0b10101 + 0o35) + chr(253 - 200) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b11100 + 0o30) + '\065', 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(1078 - 967) + '\062' + '\061' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(49) + '\x33' + chr(48), 7790 - 7782), ehT0Px3KOsy9(chr(48) + '\157' + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1683 - 1635) + '\157' + '\065' + chr(0b101111 + 0o6), 31866 - 31858), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10100 + 0o43) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8586 - 8475) + chr(49) + '\x36' + '\x30', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b110001) + chr(1492 - 1440), 31329 - 31321), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100001 + 0o20) + chr(0b100101 + 0o14) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(48) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(0b110010) + chr(1370 - 1317) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b110100) + chr(0b10100 + 0o42), 0b1000), ehT0Px3KOsy9(chr(834 - 786) + chr(111) + chr(54) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(2315 - 2204) + chr(0b100010 + 0o17) + '\x36', 52432 - 52424), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100101 + 0o12) + chr(1678 - 1628) + chr(2139 - 2084) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(7812 - 7701) + chr(2533 - 2482) + chr(0b110000) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + chr(50) + '\063' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(1458 - 1410) + chr(0b1101110 + 0o1) + chr(0b11001 + 0o31) + chr(0b101111 + 0o4) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101100 + 0o10), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(3916 - 3805) + '\065' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'K'), chr(0b1001110 + 0o26) + chr(101) + chr(0b1100011) + '\157' + chr(100) + chr(0b1100101))(chr(12525 - 12408) + '\164' + chr(0b1011 + 0o133) + chr(1437 - 1392) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def H4ULKp1EV7uq():
fH1Q96ONzG3o = IDJ2eXGCBCDu.contrib.framework.get_name_scope()
if fH1Q96ONzG3o and xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\xc7T\x9e\x91\xef'), chr(0b1100100) + chr(0b1001100 + 0o31) + chr(99) + chr(0b1100100 + 0o13) + '\144' + chr(0b1100101))(chr(0b1100011 + 0o22) + chr(0b1110100) + chr(7809 - 7707) + chr(45) + chr(0b111000)) in fH1Q96ONzG3o:
return ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(0b100 + 0o54), ord("\x08"))
if xafqLlk3kkUe(IDJ2eXGCBCDu.get_variable_scope(), xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\xcaH\x81\x91'), '\x64' + '\x65' + '\x63' + '\157' + chr(100) + '\145')('\165' + '\164' + chr(102) + '\055' + chr(0b111000))):
return ehT0Px3KOsy9(chr(48) + chr(10193 - 10082) + '\x30', 8)
return ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), ord("\x08"))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
reshape_like
|
def reshape_like(a, b):
"""Reshapes a to match the shape of b in all but the last dimension."""
ret = tf.reshape(a, tf.concat([tf.shape(b)[:-1], tf.shape(a)[-1:]], 0))
if not tf.executing_eagerly():
ret.set_shape(b.get_shape().as_list()[:-1] + a.get_shape().as_list()[-1:])
return ret
|
python
|
def reshape_like(a, b):
"""Reshapes a to match the shape of b in all but the last dimension."""
ret = tf.reshape(a, tf.concat([tf.shape(b)[:-1], tf.shape(a)[-1:]], 0))
if not tf.executing_eagerly():
ret.set_shape(b.get_shape().as_list()[:-1] + a.get_shape().as_list()[-1:])
return ret
|
[
"def",
"reshape_like",
"(",
"a",
",",
"b",
")",
":",
"ret",
"=",
"tf",
".",
"reshape",
"(",
"a",
",",
"tf",
".",
"concat",
"(",
"[",
"tf",
".",
"shape",
"(",
"b",
")",
"[",
":",
"-",
"1",
"]",
",",
"tf",
".",
"shape",
"(",
"a",
")",
"[",
"-",
"1",
":",
"]",
"]",
",",
"0",
")",
")",
"if",
"not",
"tf",
".",
"executing_eagerly",
"(",
")",
":",
"ret",
".",
"set_shape",
"(",
"b",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
":",
"-",
"1",
"]",
"+",
"a",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
"-",
"1",
":",
"]",
")",
"return",
"ret"
] |
Reshapes a to match the shape of b in all but the last dimension.
|
[
"Reshapes",
"a",
"to",
"match",
"the",
"shape",
"of",
"b",
"in",
"all",
"but",
"the",
"last",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3448-L3453
|
train
|
Reshapes a to match the shape of b in all but the last dimension.
|
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,hr2QaoivbF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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(48) + '\157' + '\x31' + chr(68 - 16) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1868 - 1813) + chr(1228 - 1178), 65166 - 65158), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(458 - 403), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\066' + chr(936 - 883), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(51) + chr(55) + chr(1021 - 972), 0o10), ehT0Px3KOsy9(chr(48) + chr(4921 - 4810) + '\x35' + chr(2837 - 2783), 0b1000), ehT0Px3KOsy9(chr(1911 - 1863) + chr(0b1101111) + chr(0b110110) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4636 - 4525) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(0b110111) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110101) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(2708 - 2655) + chr(2111 - 2056), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1510 - 1461) + '\x31' + chr(2424 - 2373), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(51) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110011) + '\x34', 37193 - 37185), ehT0Px3KOsy9(chr(884 - 836) + chr(0b1101111) + chr(1037 - 986) + '\065' + chr(49), 0o10), ehT0Px3KOsy9(chr(675 - 627) + '\x6f' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(0b101111 + 0o6) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(1205 - 1094) + '\063' + chr(0b110110) + chr(0b101100 + 0o5), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000111 + 0o50) + '\063' + chr(55) + chr(0b1011 + 0o50), 0o10), ehT0Px3KOsy9(chr(181 - 133) + chr(0b1101111) + chr(0b11110 + 0o26) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\060' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(2019 - 1971) + '\157' + '\x32' + '\x37' + chr(0b100001 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b111 + 0o54) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + '\065' + chr(1001 - 953), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011001 + 0o26) + chr(1032 - 981) + chr(0b110011) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b1111 + 0o50) + chr(2698 - 2644), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(52) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000 + 0o1) + chr(1659 - 1608) + chr(1668 - 1619), 27672 - 27664), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1357 - 1307) + '\x35' + '\067', 15339 - 15331), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + '\x33' + '\x36', 25342 - 25334), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(1896 - 1785) + '\062' + chr(0b11 + 0o61) + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(5893 - 5782) + chr(50) + chr(0b110011) + chr(1298 - 1249), 37250 - 37242), ehT0Px3KOsy9(chr(0b110000) + chr(6008 - 5897) + '\061' + chr(0b110010) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + '\x36' + chr(55), 0o10), ehT0Px3KOsy9(chr(1747 - 1699) + chr(111) + chr(1221 - 1172) + '\x35' + '\x33', 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(112 - 62) + chr(0b101101 + 0o3), 0o10), ehT0Px3KOsy9(chr(941 - 893) + chr(0b1101111) + chr(0b10100 + 0o35) + chr(0b110100) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11111 + 0o120) + chr(0b110110) + '\063', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11010 + 0o31) + '\062' + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6692 - 6581) + chr(0b110010) + chr(50) + chr(0b110100), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + chr(0b101100 + 0o4), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'I'), chr(0b1100100) + '\145' + '\143' + chr(2846 - 2735) + chr(0b1000001 + 0o43) + '\x65')(chr(117) + chr(0b11100 + 0o130) + '\x66' + '\x2d' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def syObW_2iNuuK(XPh1qbAgrPgG, wmN3dvez4qzC):
VHn4CV4Ymrei = IDJ2eXGCBCDu.reshape(XPh1qbAgrPgG, IDJ2eXGCBCDu.concat([IDJ2eXGCBCDu.nauYfLglTpcb(wmN3dvez4qzC)[:-ehT0Px3KOsy9(chr(0b110000) + chr(0b10001 + 0o136) + '\x31', ord("\x08"))], IDJ2eXGCBCDu.nauYfLglTpcb(XPh1qbAgrPgG)[-ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(49), 8):]], ehT0Px3KOsy9(chr(0b110000) + chr(0b1101001 + 0o6) + chr(0b101 + 0o53), 0o10)))
if not xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02Bb\x16\x8cZZk\\wJ*\xfc\xf9\x9bh\x12'), chr(100) + chr(101) + '\x63' + chr(0b1101000 + 0o7) + '\144' + '\145')(chr(0b1100110 + 0o17) + '\x74' + '\x66' + chr(45) + '\x38'))():
xafqLlk3kkUe(VHn4CV4Ymrei, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14_s*\x8aFRu^'), '\x64' + chr(101) + '\143' + '\x6f' + '\144' + chr(0b1100101))(chr(117) + '\164' + '\146' + chr(45) + '\070'))(xafqLlk3kkUe(wmN3dvez4qzC.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'\x06IX\x19\x90]G'), chr(0b1100100) + chr(101) + '\x63' + '\157' + '\144' + '\x65')('\x75' + '\x74' + '\x66' + chr(0b100010 + 0o13) + chr(0b111000)))()[:-ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(192 - 81) + chr(0b110001 + 0o0), 8)] + xafqLlk3kkUe(XPh1qbAgrPgG.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'\x06IX\x19\x90]G'), chr(2159 - 2059) + chr(5846 - 5745) + chr(0b101 + 0o136) + chr(0b1101111) + chr(2740 - 2640) + chr(0b1100101))(chr(7656 - 7539) + '\x74' + chr(0b1001111 + 0o27) + chr(0b10101 + 0o30) + '\070'))()[-ehT0Px3KOsy9('\060' + chr(111) + '\061', 8):])
return VHn4CV4Ymrei
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
summarize_video
|
def summarize_video(video, prefix, max_outputs=1):
"""Summarize the video using image summaries starting with prefix."""
video_shape = shape_list(video)
if len(video_shape) != 5:
raise ValueError("Assuming videos given as tensors in the format "
"[batch, time, height, width, channels] but got one "
"of shape: %s" % str(video_shape))
if tf.executing_eagerly():
return
if video.get_shape().as_list()[1] is None:
tf.summary.image(
"%s_last_frame" % prefix,
tf.cast(video[:, -1, :, :, :], tf.uint8),
max_outputs=max_outputs)
else:
for k in range(video_shape[1]):
tf.summary.image(
"%s_frame_%d" % (prefix, k),
tf.cast(video[:, k, :, :, :], tf.uint8),
max_outputs=max_outputs)
|
python
|
def summarize_video(video, prefix, max_outputs=1):
"""Summarize the video using image summaries starting with prefix."""
video_shape = shape_list(video)
if len(video_shape) != 5:
raise ValueError("Assuming videos given as tensors in the format "
"[batch, time, height, width, channels] but got one "
"of shape: %s" % str(video_shape))
if tf.executing_eagerly():
return
if video.get_shape().as_list()[1] is None:
tf.summary.image(
"%s_last_frame" % prefix,
tf.cast(video[:, -1, :, :, :], tf.uint8),
max_outputs=max_outputs)
else:
for k in range(video_shape[1]):
tf.summary.image(
"%s_frame_%d" % (prefix, k),
tf.cast(video[:, k, :, :, :], tf.uint8),
max_outputs=max_outputs)
|
[
"def",
"summarize_video",
"(",
"video",
",",
"prefix",
",",
"max_outputs",
"=",
"1",
")",
":",
"video_shape",
"=",
"shape_list",
"(",
"video",
")",
"if",
"len",
"(",
"video_shape",
")",
"!=",
"5",
":",
"raise",
"ValueError",
"(",
"\"Assuming videos given as tensors in the format \"",
"\"[batch, time, height, width, channels] but got one \"",
"\"of shape: %s\"",
"%",
"str",
"(",
"video_shape",
")",
")",
"if",
"tf",
".",
"executing_eagerly",
"(",
")",
":",
"return",
"if",
"video",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
"1",
"]",
"is",
"None",
":",
"tf",
".",
"summary",
".",
"image",
"(",
"\"%s_last_frame\"",
"%",
"prefix",
",",
"tf",
".",
"cast",
"(",
"video",
"[",
":",
",",
"-",
"1",
",",
":",
",",
":",
",",
":",
"]",
",",
"tf",
".",
"uint8",
")",
",",
"max_outputs",
"=",
"max_outputs",
")",
"else",
":",
"for",
"k",
"in",
"range",
"(",
"video_shape",
"[",
"1",
"]",
")",
":",
"tf",
".",
"summary",
".",
"image",
"(",
"\"%s_frame_%d\"",
"%",
"(",
"prefix",
",",
"k",
")",
",",
"tf",
".",
"cast",
"(",
"video",
"[",
":",
",",
"k",
",",
":",
",",
":",
",",
":",
"]",
",",
"tf",
".",
"uint8",
")",
",",
"max_outputs",
"=",
"max_outputs",
")"
] |
Summarize the video using image summaries starting with prefix.
|
[
"Summarize",
"the",
"video",
"using",
"image",
"summaries",
"starting",
"with",
"prefix",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3456-L3475
|
train
|
Summarize the video using image summaries starting with prefix.
|
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,N5Ee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QpDQB3,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(363 - 314) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + chr(10416 - 10305) + chr(0b11110 + 0o23) + chr(0b11001 + 0o34) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1495 - 1447) + chr(3416 - 3305) + '\061' + chr(0b1101 + 0o51) + chr(0b100110 + 0o12), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(52) + chr(0b1100 + 0o46), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\x30' + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\x30' + chr(1736 - 1685), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b110101) + '\x30', 11019 - 11011), ehT0Px3KOsy9(chr(140 - 92) + chr(111) + chr(0b1100 + 0o53), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(53) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(7693 - 7582) + chr(879 - 830) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100011 + 0o14) + chr(0b110001) + chr(0b110010) + chr(1668 - 1616), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\060' + chr(0b10101 + 0o42), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1035 - 984) + chr(517 - 463) + '\060', 5155 - 5147), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100111 + 0o13) + '\060' + chr(0b101001 + 0o11), 11592 - 11584), ehT0Px3KOsy9(chr(48) + chr(11966 - 11855) + chr(0b110010) + chr(0b100100 + 0o17) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1110 + 0o141) + chr(0b1010 + 0o47) + chr(0b10110 + 0o32) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(1064 - 1012) + chr(1612 - 1564), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(268 - 217) + '\x35' + chr(0b11100 + 0o25), 0b1000), ehT0Px3KOsy9(chr(160 - 112) + chr(0b10011 + 0o134) + '\x35' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b111101 + 0o62) + chr(0b110000 + 0o7) + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b100011 + 0o16) + chr(51) + chr(0b110011 + 0o2), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(48) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b111 + 0o53) + chr(0b110110) + chr(0b1010 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(509 - 461) + chr(0b10110 + 0o131) + '\x33' + chr(0b1101 + 0o50) + chr(49), 8), ehT0Px3KOsy9(chr(760 - 712) + chr(111) + '\x32' + chr(0b110101) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10 + 0o61) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1101 + 0o44) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + '\063' + chr(0b10100 + 0o37), 304 - 296), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b1001 + 0o56) + '\060', 39375 - 39367), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b101101 + 0o102) + chr(2380 - 2329) + '\x33' + chr(2120 - 2065), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(49) + chr(51) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1011010 + 0o25) + chr(51) + chr(48) + chr(0b110111), 8), ehT0Px3KOsy9(chr(1516 - 1468) + '\x6f' + chr(50) + '\063' + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + chr(51) + '\x31' + chr(0b110110), 54778 - 54770), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1000 + 0o57) + chr(915 - 867), 61786 - 61778), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1001 + 0o51) + '\x30' + '\067', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(53) + chr(2376 - 2325), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\x32' + '\x30' + chr(0b11110 + 0o31), 8), ehT0Px3KOsy9(chr(48) + chr(0b1010010 + 0o35) + '\x31', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(5096 - 4985) + '\x35' + chr(0b110000), 4563 - 4555)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'!'), chr(0b1011000 + 0o14) + '\x65' + chr(3461 - 3362) + '\157' + chr(0b1010100 + 0o20) + chr(101))(chr(0b1110101) + chr(0b10011 + 0o141) + chr(5172 - 5070) + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Wpx7t0O4dQfE(lADoCDXuSFEg, K1Ha0XjJTAE7, i7r136MIYrlH=ehT0Px3KOsy9(chr(108 - 60) + chr(0b1101111) + '\061', 8)):
yK64m0eFyaVx = qypPRW8fq869(lADoCDXuSFEg)
if c2A0yzQpDQB3(yK64m0eFyaVx) != ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101), 0b1000):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"N\x1a\x03\x17+*\x06`\x0b{=\xa3\x95\xed\xe9a\x07\x80__3\xe4\xd2\x9a\x8alm\xf5\xcb\xb0*\xb4\xb9\xa7V\xa7\x9fd\xe2!i\x06\x02\x0f'7H\\Il \xa4\x98\xae\xba5\t\x84L\x16}\xac\xd6\x80\xcdp|\xb7\x98\xa81\xa3\xed\xa6\x14\xa7\x88d\xe6oa\x0c\x1c\x11\x1bc\nr_-3\xa8\x84\xa2\xf5/\x05\xc9F\\}\xb7\xdb\x88\xda}2\xbb\x9d\xac"), chr(4562 - 4462) + chr(0b1100101) + chr(1072 - 973) + '\157' + chr(878 - 778) + chr(0b1000010 + 0o43))('\x75' + '\164' + '\x66' + chr(0b10011 + 0o32) + chr(2242 - 2186)) % M8_cKLkHVB2V(yK64m0eFyaVx))
if xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'j\x11\x15\x0137\x01iLR1\xa6\x97\xe7\xe8-\x19'), chr(100) + chr(101) + '\x63' + '\x6f' + chr(100) + '\145')('\x75' + chr(116) + '\146' + '\055' + chr(56)))():
return
if xafqLlk3kkUe(lADoCDXuSFEg.get_shape(), xafqLlk3kkUe(SXOLrMavuUCe(b'n\x1a/\x0e/0\x1c'), chr(0b1100100) + '\145' + '\x63' + chr(111) + '\x64' + '\x65')(chr(0b100000 + 0o125) + chr(2791 - 2675) + chr(102) + chr(516 - 471) + chr(2902 - 2846)))()[ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1100 + 0o45), 8)] is None:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'F\r\x1d#\x0e\x14\x0eDZ\x7f:\xb7'), '\144' + chr(1944 - 1843) + chr(0b101110 + 0o65) + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(117) + chr(116) + chr(102) + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b"*\x1a/\x0e'0\x1cXM\x7f5\xaa\x95"), chr(100) + chr(101) + '\143' + chr(111) + '\x64' + chr(101))(chr(0b1100101 + 0o20) + chr(0b1110100) + chr(1759 - 1657) + chr(0b101101) + chr(56)) % K1Ha0XjJTAE7, xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'l\x08\x03\x16'), '\144' + '\145' + chr(0b11 + 0o140) + chr(111) + '\x64' + chr(0b1100101))('\165' + chr(5486 - 5370) + chr(0b101111 + 0o67) + '\x2d' + '\x38'))(lADoCDXuSFEg[:, -ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(49), 8), :, :, :], xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'z\x00\x1e\x16~'), chr(0b1100100) + chr(101) + '\143' + chr(0b1101101 + 0o2) + chr(100) + '\x65')(chr(0b1011001 + 0o34) + '\x74' + chr(102) + chr(45) + chr(0b10101 + 0o43)))), max_outputs=i7r136MIYrlH)
else:
for OolUPRJhRaJd in vQr8gNKaIaWE(yK64m0eFyaVx[ehT0Px3KOsy9(chr(586 - 538) + chr(111) + chr(0b100 + 0o55), 8)]):
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'F\r\x1d#\x0e\x14\x0eDZ\x7f:\xb7'), chr(0b1011001 + 0o13) + chr(101) + chr(7833 - 7734) + '\x6f' + chr(100) + chr(0b1100101))(chr(2356 - 2239) + '\x74' + '\x66' + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'*\x1a/\x044"\x05bt(0'), chr(0b101100 + 0o70) + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b1100100) + '\x65')('\x75' + chr(10887 - 10771) + chr(102) + chr(45) + '\x38') % (K1Ha0XjJTAE7, OolUPRJhRaJd), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'l\x08\x03\x16'), chr(0b111 + 0o135) + '\145' + chr(0b1010111 + 0o14) + chr(111) + chr(0b1100100) + chr(0b1001011 + 0o32))(chr(1936 - 1819) + '\164' + chr(102) + chr(0b101101) + chr(0b11100 + 0o34)))(lADoCDXuSFEg[:, OolUPRJhRaJd, :, :, :], xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'z\x00\x1e\x16~'), '\144' + '\x65' + chr(0b1010100 + 0o17) + chr(6199 - 6088) + chr(100) + chr(101))(chr(7955 - 7838) + '\164' + '\146' + '\055' + chr(2029 - 1973)))), max_outputs=i7r136MIYrlH)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
cast_like
|
def cast_like(x, y):
"""Cast x to y's dtype, if necessary."""
x = tf.convert_to_tensor(x)
y = tf.convert_to_tensor(y)
if x.dtype.base_dtype == y.dtype.base_dtype:
return x
cast_x = tf.cast(x, y.dtype)
if cast_x.device != x.device:
x_name = "(eager Tensor)"
try:
x_name = x.name
except AttributeError:
pass
tf.logging.warning("Cast for %s may induce copy from '%s' to '%s'", x_name,
x.device, cast_x.device)
return cast_x
|
python
|
def cast_like(x, y):
"""Cast x to y's dtype, if necessary."""
x = tf.convert_to_tensor(x)
y = tf.convert_to_tensor(y)
if x.dtype.base_dtype == y.dtype.base_dtype:
return x
cast_x = tf.cast(x, y.dtype)
if cast_x.device != x.device:
x_name = "(eager Tensor)"
try:
x_name = x.name
except AttributeError:
pass
tf.logging.warning("Cast for %s may induce copy from '%s' to '%s'", x_name,
x.device, cast_x.device)
return cast_x
|
[
"def",
"cast_like",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"x",
")",
"y",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"y",
")",
"if",
"x",
".",
"dtype",
".",
"base_dtype",
"==",
"y",
".",
"dtype",
".",
"base_dtype",
":",
"return",
"x",
"cast_x",
"=",
"tf",
".",
"cast",
"(",
"x",
",",
"y",
".",
"dtype",
")",
"if",
"cast_x",
".",
"device",
"!=",
"x",
".",
"device",
":",
"x_name",
"=",
"\"(eager Tensor)\"",
"try",
":",
"x_name",
"=",
"x",
".",
"name",
"except",
"AttributeError",
":",
"pass",
"tf",
".",
"logging",
".",
"warning",
"(",
"\"Cast for %s may induce copy from '%s' to '%s'\"",
",",
"x_name",
",",
"x",
".",
"device",
",",
"cast_x",
".",
"device",
")",
"return",
"cast_x"
] |
Cast x to y's dtype, if necessary.
|
[
"Cast",
"x",
"to",
"y",
"s",
"dtype",
"if",
"necessary",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3478-L3495
|
train
|
Cast x to y s dtype if necessary.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLt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tLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b110111) + '\x30', 41089 - 41081), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + '\064' + chr(970 - 917), 16368 - 16360), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11011 + 0o30) + chr(414 - 364) + chr(134 - 86), ord("\x08")), ehT0Px3KOsy9(chr(1243 - 1195) + chr(111) + chr(708 - 659) + chr(0b110010) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1591 - 1543) + chr(0b1011110 + 0o21) + chr(51) + '\063' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(51) + chr(55), 0o10), ehT0Px3KOsy9('\060' + chr(3783 - 3672) + chr(0b1011 + 0o46) + '\067' + chr(767 - 713), 0o10), ehT0Px3KOsy9(chr(718 - 670) + '\x6f' + '\061' + '\067' + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(7184 - 7073) + chr(49) + chr(0b110001 + 0o5) + '\x30', 48764 - 48756), ehT0Px3KOsy9(chr(1495 - 1447) + chr(0b10110 + 0o131) + chr(49) + chr(1787 - 1736) + chr(0b1100 + 0o53), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b101 + 0o152) + chr(0b110010) + chr(0b110100) + chr(0b10001 + 0o37), 28482 - 28474), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(1994 - 1945) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(48) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\x34' + chr(536 - 487), 0o10), ehT0Px3KOsy9(chr(2258 - 2210) + chr(0b1100010 + 0o15) + '\x32' + chr(0b1101 + 0o50) + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110110) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(8524 - 8413) + chr(0b110011 + 0o0) + chr(0b10 + 0o64) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b11100 + 0o123) + chr(0b110010) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1835 - 1785) + chr(55) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(155 - 104) + '\064' + chr(0b1001 + 0o56), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001011 + 0o44) + chr(2402 - 2351) + chr(51) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + '\x31' + chr(0b110 + 0o53), 50792 - 50784), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b110001) + chr(2188 - 2136) + chr(0b110100), 20707 - 20699), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100001 + 0o22), 0b1000), ehT0Px3KOsy9('\060' + chr(6633 - 6522) + '\x33' + chr(54) + chr(1036 - 983), 36463 - 36455), ehT0Px3KOsy9('\060' + chr(8381 - 8270) + '\x32' + chr(2127 - 2075) + '\x32', 40867 - 40859), ehT0Px3KOsy9(chr(953 - 905) + chr(0b1001111 + 0o40) + '\061' + chr(1121 - 1071) + chr(0b11111 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1 + 0o156) + chr(49) + '\060', 0o10), ehT0Px3KOsy9(chr(930 - 882) + chr(111) + chr(0b110010) + chr(51) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b110110) + chr(0b101110 + 0o10), 0b1000), ehT0Px3KOsy9('\x30' + chr(8053 - 7942) + chr(0b1111 + 0o43), 44984 - 44976), ehT0Px3KOsy9(chr(48) + chr(0b1101 + 0o142) + chr(0b110001) + chr(1234 - 1186) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101111 + 0o4) + chr(52) + '\067', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b110110) + '\x30', 64103 - 64095), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11001 + 0o32) + chr(54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(2267 - 2219) + chr(0b1101111) + chr(0b110011) + chr(0b101100 + 0o10) + chr(0b100001 + 0o26), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(55) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + chr(728 - 679) + chr(600 - 549) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(11039 - 10928) + chr(50) + '\064' + '\060', 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110101) + chr(0b100101 + 0o16), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(1097 - 1049), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'V'), '\x64' + '\145' + '\143' + chr(8398 - 8287) + chr(0b1100100) + chr(0b101 + 0o140))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def QzW8kYNS1xWf(OeWW0F1dBPRQ, SqiSOtYOqOJH):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.convert_to_tensor(OeWW0F1dBPRQ)
SqiSOtYOqOJH = IDJ2eXGCBCDu.convert_to_tensor(SqiSOtYOqOJH)
if xafqLlk3kkUe(OeWW0F1dBPRQ.dtype, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a\xc4\xa33\x85\xfb\n\x05\x00:'), '\x64' + '\x65' + '\143' + chr(111) + chr(100) + chr(3202 - 3101))(chr(0b110110 + 0o77) + chr(3879 - 3763) + chr(0b1100110) + chr(0b100001 + 0o14) + '\070')) == xafqLlk3kkUe(SqiSOtYOqOJH.dtype, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a\xc4\xa33\x85\xfb\n\x05\x00:'), '\144' + chr(0b1010101 + 0o20) + chr(0b1011100 + 0o7) + chr(0b1101111) + chr(0b111011 + 0o51) + chr(0b1100101))(chr(8038 - 7921) + '\164' + chr(879 - 777) + '\055' + chr(0b111000))):
return OeWW0F1dBPRQ
GN38CwVAMJ3q = IDJ2eXGCBCDu.cast(OeWW0F1dBPRQ, SqiSOtYOqOJH.jSV9IKnemH7K)
if xafqLlk3kkUe(GN38CwVAMJ3q, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xc0\xa6?\xb9\xfa'), chr(0b1100000 + 0o4) + '\145' + chr(9540 - 9441) + '\157' + '\144' + '\x65')(chr(0b101001 + 0o114) + chr(0b1001111 + 0o45) + chr(102) + '\x2d' + '\070')) != xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xc0\xa6?\xb9\xfa'), chr(100) + chr(0b100111 + 0o76) + chr(0b1010111 + 0o14) + chr(111) + chr(0b110000 + 0o64) + chr(0b111010 + 0o53))(chr(117) + chr(116) + chr(10379 - 10277) + chr(0b101101) + chr(0b111000))):
cNhmR9BVACvl = xafqLlk3kkUe(SXOLrMavuUCe(b'P\xc0\xb11\xbf\xed^(\x151\xd3\xe3\xf7\x88'), chr(0b1100100) + chr(10122 - 10021) + chr(99) + chr(0b110010 + 0o75) + chr(0b1010100 + 0o20) + chr(0b1100101))('\x75' + chr(9393 - 9277) + chr(9733 - 9631) + chr(45) + chr(0b111000))
try:
cNhmR9BVACvl = OeWW0F1dBPRQ.AIvJRzLdDfgF
except sHOWSIAKtU58:
pass
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\xc4\xa28\xb3\xf1\x19'), chr(9073 - 8973) + chr(0b1100101) + '\143' + '\157' + '\x64' + chr(0b1000011 + 0o42))(chr(0b1110101) + chr(0b101100 + 0o110) + chr(0b1100110) + chr(0b10111 + 0o26) + chr(0b101111 + 0o11)))(xafqLlk3kkUe(SXOLrMavuUCe(b';\xc4\xa3"\xfa\xf9\x11\x0ePz\xd3\xac\xe8\xc0\xd3\x13\x98|\xde\x92\xbf\xecD`\x9a\xd2,(\xfa\x84m-\xc7\xd7\xd1\x94]}\xd4DX\x82\xf5%\xfd'), chr(0b101111 + 0o65) + chr(0b11000 + 0o115) + chr(0b1 + 0o142) + chr(0b1101111) + chr(0b1011010 + 0o12) + '\145')(chr(117) + chr(0b1110100) + '\x66' + chr(45) + chr(56)), cNhmR9BVACvl, xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xc0\xa6?\xb9\xfa'), '\144' + chr(9477 - 9376) + chr(0b101101 + 0o66) + chr(111) + chr(8430 - 8330) + chr(101))(chr(0b11101 + 0o130) + chr(116) + chr(8342 - 8240) + chr(45) + '\070')), xafqLlk3kkUe(GN38CwVAMJ3q, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xc0\xa6?\xb9\xfa'), chr(0b1100000 + 0o4) + '\145' + chr(99) + chr(111) + '\144' + chr(0b1100101))(chr(117) + chr(0b1110100) + '\x66' + '\055' + chr(0b111000))))
return GN38CwVAMJ3q
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
make_even_size
|
def make_even_size(x):
"""Pad x to be even-sized on axis 1 and 2, but only if necessary."""
x_shape = x.get_shape().as_list()
assert len(x_shape) > 2, "Only 3+-dimensional tensors supported."
shape = [dim if dim is not None else -1 for dim in x_shape]
new_shape = x_shape # To make sure constant shapes remain constant.
if x_shape[1] is not None:
new_shape[1] = 2 * int(math.ceil(x_shape[1] * 0.5))
if x_shape[2] is not None:
new_shape[2] = 2 * int(math.ceil(x_shape[2] * 0.5))
if shape[1] % 2 == 0 and shape[2] % 2 == 0:
return x
if shape[1] % 2 == 0:
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=2)
x.set_shape(new_shape)
return x
if shape[2] % 2 == 0:
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=1)
x.set_shape(new_shape)
return x
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=1)
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=2)
x.set_shape(new_shape)
return x
|
python
|
def make_even_size(x):
"""Pad x to be even-sized on axis 1 and 2, but only if necessary."""
x_shape = x.get_shape().as_list()
assert len(x_shape) > 2, "Only 3+-dimensional tensors supported."
shape = [dim if dim is not None else -1 for dim in x_shape]
new_shape = x_shape # To make sure constant shapes remain constant.
if x_shape[1] is not None:
new_shape[1] = 2 * int(math.ceil(x_shape[1] * 0.5))
if x_shape[2] is not None:
new_shape[2] = 2 * int(math.ceil(x_shape[2] * 0.5))
if shape[1] % 2 == 0 and shape[2] % 2 == 0:
return x
if shape[1] % 2 == 0:
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=2)
x.set_shape(new_shape)
return x
if shape[2] % 2 == 0:
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=1)
x.set_shape(new_shape)
return x
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=1)
x, _ = pad_to_same_length(x, x, final_length_divisible_by=2, axis=2)
x.set_shape(new_shape)
return x
|
[
"def",
"make_even_size",
"(",
"x",
")",
":",
"x_shape",
"=",
"x",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"assert",
"len",
"(",
"x_shape",
")",
">",
"2",
",",
"\"Only 3+-dimensional tensors supported.\"",
"shape",
"=",
"[",
"dim",
"if",
"dim",
"is",
"not",
"None",
"else",
"-",
"1",
"for",
"dim",
"in",
"x_shape",
"]",
"new_shape",
"=",
"x_shape",
"# To make sure constant shapes remain constant.",
"if",
"x_shape",
"[",
"1",
"]",
"is",
"not",
"None",
":",
"new_shape",
"[",
"1",
"]",
"=",
"2",
"*",
"int",
"(",
"math",
".",
"ceil",
"(",
"x_shape",
"[",
"1",
"]",
"*",
"0.5",
")",
")",
"if",
"x_shape",
"[",
"2",
"]",
"is",
"not",
"None",
":",
"new_shape",
"[",
"2",
"]",
"=",
"2",
"*",
"int",
"(",
"math",
".",
"ceil",
"(",
"x_shape",
"[",
"2",
"]",
"*",
"0.5",
")",
")",
"if",
"shape",
"[",
"1",
"]",
"%",
"2",
"==",
"0",
"and",
"shape",
"[",
"2",
"]",
"%",
"2",
"==",
"0",
":",
"return",
"x",
"if",
"shape",
"[",
"1",
"]",
"%",
"2",
"==",
"0",
":",
"x",
",",
"_",
"=",
"pad_to_same_length",
"(",
"x",
",",
"x",
",",
"final_length_divisible_by",
"=",
"2",
",",
"axis",
"=",
"2",
")",
"x",
".",
"set_shape",
"(",
"new_shape",
")",
"return",
"x",
"if",
"shape",
"[",
"2",
"]",
"%",
"2",
"==",
"0",
":",
"x",
",",
"_",
"=",
"pad_to_same_length",
"(",
"x",
",",
"x",
",",
"final_length_divisible_by",
"=",
"2",
",",
"axis",
"=",
"1",
")",
"x",
".",
"set_shape",
"(",
"new_shape",
")",
"return",
"x",
"x",
",",
"_",
"=",
"pad_to_same_length",
"(",
"x",
",",
"x",
",",
"final_length_divisible_by",
"=",
"2",
",",
"axis",
"=",
"1",
")",
"x",
",",
"_",
"=",
"pad_to_same_length",
"(",
"x",
",",
"x",
",",
"final_length_divisible_by",
"=",
"2",
",",
"axis",
"=",
"2",
")",
"x",
".",
"set_shape",
"(",
"new_shape",
")",
"return",
"x"
] |
Pad x to be even-sized on axis 1 and 2, but only if necessary.
|
[
"Pad",
"x",
"to",
"be",
"even",
"-",
"sized",
"on",
"axis",
"1",
"and",
"2",
"but",
"only",
"if",
"necessary",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3498-L3521
|
train
|
Pad x to be even - sized on axis 1 and 2 but only if necessary.
|
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,yROw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ZtaORwo4,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(0b1 + 0o57) + chr(0b1101111) + '\x31' + chr(0b110001) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1091 - 1042) + chr(0b11100 + 0o25) + chr(0b1010 + 0o50), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\065' + chr(1947 - 1894), 8405 - 8397), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\062' + chr(0b100010 + 0o17) + '\065', 47672 - 47664), ehT0Px3KOsy9(chr(48) + '\157' + chr(1724 - 1674) + chr(0b101000 + 0o12) + chr(1622 - 1567), 20308 - 20300), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(1073 - 1025) + chr(685 - 633), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\x33' + '\065' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1147 - 1099) + chr(6393 - 6282) + chr(50) + chr(0b11011 + 0o33), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b100001 + 0o17) + chr(0b10110 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(50) + '\x37' + chr(0b110011), 34261 - 34253), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101100 + 0o6) + '\x36' + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(8487 - 8376) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101001 + 0o6) + '\063' + chr(51) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + chr(0b110010 + 0o3) + '\x37', 59308 - 59300), ehT0Px3KOsy9(chr(605 - 557) + '\x6f' + chr(0b101011 + 0o10) + '\x30' + chr(50), 982 - 974), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10001 + 0o41) + '\067' + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x33' + '\x36', 46048 - 46040), ehT0Px3KOsy9(chr(2287 - 2239) + chr(0b110010 + 0o75) + '\061' + chr(50) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b10 + 0o60) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(2300 - 2247) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(51) + '\x36' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\x32' + chr(0b101110 + 0o11), 8), ehT0Px3KOsy9(chr(314 - 266) + chr(8110 - 7999) + chr(0b110011) + '\062' + '\065', 8), ehT0Px3KOsy9(chr(1062 - 1014) + '\157' + chr(2171 - 2121) + chr(0b110001) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b11110 + 0o121) + chr(50) + chr(0b110000 + 0o6) + chr(1929 - 1881), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(989 - 940) + chr(55), 52828 - 52820), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + '\x32' + '\x33' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110101) + chr(1058 - 1003), 44886 - 44878), ehT0Px3KOsy9('\x30' + chr(0b100110 + 0o111) + chr(1632 - 1583) + chr(2464 - 2414), 17915 - 17907), ehT0Px3KOsy9(chr(0b110000) + chr(7494 - 7383) + chr(0b110001) + chr(0b110 + 0o61) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(581 - 530) + chr(566 - 518) + chr(699 - 648), 53896 - 53888), ehT0Px3KOsy9('\060' + chr(10113 - 10002) + chr(520 - 465) + chr(0b110101), 54354 - 54346), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1011001 + 0o26) + chr(51) + '\x36' + '\x37', 54325 - 54317), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101011 + 0o7) + chr(0b110101) + '\x33', 63778 - 63770), ehT0Px3KOsy9('\060' + chr(9038 - 8927) + chr(0b110000 + 0o1) + '\x37' + chr(1429 - 1381), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101010 + 0o5) + chr(50) + '\x30' + '\x34', 8), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + '\x33' + chr(1799 - 1750) + '\x35', 25072 - 25064), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110000) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(2440 - 2390) + '\x31', 25615 - 25607), ehT0Px3KOsy9('\060' + chr(1156 - 1045) + chr(2926 - 2871) + chr(0b100100 + 0o21), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10001 + 0o44) + chr(1074 - 1026), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'`'), chr(100) + chr(0b1100101) + chr(0b1010110 + 0o15) + chr(0b1101011 + 0o4) + chr(3880 - 3780) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(102) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Ba7Nv7XOZPsa(OeWW0F1dBPRQ):
QQEXXbdZyz6m = OeWW0F1dBPRQ.get_shape().as_list()
assert c2A0yzQpDQB3(QQEXXbdZyz6m) > ehT0Px3KOsy9(chr(0b110000) + chr(6081 - 5970) + chr(50), 0b1000), xafqLlk3kkUe(SXOLrMavuUCe(b'\x01$A\xf4\xb7\xb7\xc1;\xe2\xd2\xd8f\xb6\\\xab\xd6\xf07\xb9M\x86\xf2\xbb\xfd\xdf}\xe9\x8fy\x08\xb3M\x98\xd9\x0c\xe1\xa9\xaf'), '\144' + chr(0b1010010 + 0o23) + '\143' + chr(10944 - 10833) + chr(100) + chr(0b1 + 0o144))(chr(0b10000 + 0o145) + chr(116) + chr(102) + chr(0b1100 + 0o41) + '\x38')
nauYfLglTpcb = [Nl_JhL3qUwSN if Nl_JhL3qUwSN is not None else -ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11110 + 0o23), 0b1000) for Nl_JhL3qUwSN in QQEXXbdZyz6m]
P7dVzv6_yXeE = QQEXXbdZyz6m
if QQEXXbdZyz6m[ehT0Px3KOsy9('\060' + '\157' + chr(49), 8)] is not None:
P7dVzv6_yXeE[ehT0Px3KOsy9('\x30' + chr(111) + '\061', 8)] = ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010), 8) * ehT0Px3KOsy9(yhiZVkosCjBm.ceil(QQEXXbdZyz6m[ehT0Px3KOsy9('\x30' + '\x6f' + '\061', 8)] * 0.5))
if QQEXXbdZyz6m[ehT0Px3KOsy9('\x30' + chr(0b111001 + 0o66) + chr(50), 8)] is not None:
P7dVzv6_yXeE[ehT0Px3KOsy9(chr(48) + chr(111) + chr(50), 8)] = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(450 - 400), 8) * ehT0Px3KOsy9(yhiZVkosCjBm.ceil(QQEXXbdZyz6m[ehT0Px3KOsy9(chr(48) + chr(0b1101011 + 0o4) + '\062', 8)] * 0.5))
if nauYfLglTpcb[ehT0Px3KOsy9(chr(1595 - 1547) + chr(0b1 + 0o156) + chr(2326 - 2277), 8)] % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101 + 0o55), 8) == ehT0Px3KOsy9(chr(774 - 726) + chr(0b1101111) + chr(177 - 129), ord("\x08")) and nauYfLglTpcb[ehT0Px3KOsy9(chr(1061 - 1013) + chr(7319 - 7208) + chr(1802 - 1752), 8)] % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010), 8) == ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1556 - 1508), 8):
return OeWW0F1dBPRQ
if nauYfLglTpcb[ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001), 8)] % ehT0Px3KOsy9(chr(48) + chr(0b100 + 0o153) + chr(1947 - 1897), 8) == ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x30', 8):
(OeWW0F1dBPRQ, VNGQdHSFPrso) = F9_pMIqOthBu(OeWW0F1dBPRQ, OeWW0F1dBPRQ, final_length_divisible_by=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010), 8), axis=ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(0b1 + 0o61), 8))
xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'=/Y\xd2\xe4\xec\x8bf\xe3'), '\144' + chr(7071 - 6970) + chr(99) + chr(0b100001 + 0o116) + '\x64' + '\145')(chr(0b11000 + 0o135) + chr(6445 - 6329) + chr(0b1100110) + '\055' + '\x38'))(P7dVzv6_yXeE)
return OeWW0F1dBPRQ
if nauYfLglTpcb[ehT0Px3KOsy9(chr(1137 - 1089) + chr(111) + chr(50), 8)] % ehT0Px3KOsy9(chr(48) + chr(111) + chr(61 - 11), 8) == ehT0Px3KOsy9(chr(0b110000) + chr(0b1000000 + 0o57) + chr(0b110000), 8):
(OeWW0F1dBPRQ, VNGQdHSFPrso) = F9_pMIqOthBu(OeWW0F1dBPRQ, OeWW0F1dBPRQ, final_length_divisible_by=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50), 8), axis=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31', 8))
xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'=/Y\xd2\xe4\xec\x8bf\xe3'), chr(0b1100100) + chr(101) + chr(99) + chr(7804 - 7693) + chr(100) + '\x65')(chr(11686 - 11569) + chr(116) + '\146' + chr(0b10111 + 0o26) + chr(0b111000)))(P7dVzv6_yXeE)
return OeWW0F1dBPRQ
(OeWW0F1dBPRQ, VNGQdHSFPrso) = F9_pMIqOthBu(OeWW0F1dBPRQ, OeWW0F1dBPRQ, final_length_divisible_by=ehT0Px3KOsy9(chr(48) + chr(6659 - 6548) + chr(0b110010), 8), axis=ehT0Px3KOsy9('\060' + '\157' + chr(49), 8))
(OeWW0F1dBPRQ, VNGQdHSFPrso) = F9_pMIqOthBu(OeWW0F1dBPRQ, OeWW0F1dBPRQ, final_length_divisible_by=ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50), 8), axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10101 + 0o35), 8))
xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'=/Y\xd2\xe4\xec\x8bf\xe3'), chr(100) + chr(101) + '\143' + chr(0b1110 + 0o141) + '\x64' + '\145')(chr(0b110 + 0o157) + '\164' + chr(0b101110 + 0o70) + '\055' + chr(56)))(P7dVzv6_yXeE)
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
sliced_gan_loss
|
def sliced_gan_loss(input1,
input2,
discriminator,
num_vecs,
do_random_vecs=True,
do_tanh=True,
return_logits=False):
"""Loss inspired by the sliced WGAN paper: https://arxiv.org/abs/1804.01947.
Puts input1 and input2 through the provided discriminator to get logits.
Then, computes num_vecs random projections of the logits, sorts them on
the batch dimension and returns the L2 loss between the sorted vectors.
See the above-mentioned paper for the reasoning behind it.
Args:
input1: first discriminator inputs.
input2: second discriminator inputs.
discriminator: inputs -> logits function.
num_vecs: how many random vectors to use for projections.
do_random_vecs: whether to use random vectors or just tanh of the logits.
do_tanh: if true (default) we'll also just use tanh of the logits.
return_logits: Whether or not to return the logits.
Returns:
The generator loss, i.e., the sliced approximation of the distance between
the projected distributions (warning: discriminator should maximize it).
"""
with tf.variable_scope("sliced_gan"):
with tf.variable_scope("discriminator"):
logits1 = discriminator(input1)
with tf.variable_scope("discriminator", reuse=True):
logits2 = discriminator(input2)
if do_random_vecs:
random_vecs = tf.nn.l2_normalize(
tf.random_uniform([shape_list(logits1)[-1], num_vecs]), axis=0)
def get_sorted_projections(x):
"""Make projections of x and sort them on the batch dimension."""
x = tf.reshape(x, [-1, shape_list(x)[-1]])
batch_size = shape_list(x)[0]
if do_random_vecs and do_tanh:
n = tf.nn.l2_normalize(x, axis=1)
proj = tf.concat([tf.matmul(n, random_vecs), tf.tanh(n)], axis=1)
elif do_random_vecs:
n = tf.nn.l2_normalize(x, axis=1)
proj = tf.matmul(n, random_vecs)
else:
proj = tf.tanh(x)
proj = tf.transpose(proj, [1, 0]) # [num_vecs, batch] after this.
if is_xla_compiled():
proj_dtype = proj.dtype
proj = tf.cast(proj, tf.bfloat16)
# Currently TPU only supports 1-D top_k calls.
map_fn = lambda x: tf.nn.top_k(x, k=batch_size, sorted=True)[0]
values = tf.map_fn(map_fn, proj)
values = tf.cast(values, proj_dtype)
else:
values, _ = tf.nn.top_k(proj, k=batch_size, sorted=True)
return values
proj1 = get_sorted_projections(logits1)
proj2 = get_sorted_projections(logits2)
dist = tf.reduce_mean(tf.squared_difference(proj1, proj2))
if return_logits:
return dist, logits1, logits2
return dist
|
python
|
def sliced_gan_loss(input1,
input2,
discriminator,
num_vecs,
do_random_vecs=True,
do_tanh=True,
return_logits=False):
"""Loss inspired by the sliced WGAN paper: https://arxiv.org/abs/1804.01947.
Puts input1 and input2 through the provided discriminator to get logits.
Then, computes num_vecs random projections of the logits, sorts them on
the batch dimension and returns the L2 loss between the sorted vectors.
See the above-mentioned paper for the reasoning behind it.
Args:
input1: first discriminator inputs.
input2: second discriminator inputs.
discriminator: inputs -> logits function.
num_vecs: how many random vectors to use for projections.
do_random_vecs: whether to use random vectors or just tanh of the logits.
do_tanh: if true (default) we'll also just use tanh of the logits.
return_logits: Whether or not to return the logits.
Returns:
The generator loss, i.e., the sliced approximation of the distance between
the projected distributions (warning: discriminator should maximize it).
"""
with tf.variable_scope("sliced_gan"):
with tf.variable_scope("discriminator"):
logits1 = discriminator(input1)
with tf.variable_scope("discriminator", reuse=True):
logits2 = discriminator(input2)
if do_random_vecs:
random_vecs = tf.nn.l2_normalize(
tf.random_uniform([shape_list(logits1)[-1], num_vecs]), axis=0)
def get_sorted_projections(x):
"""Make projections of x and sort them on the batch dimension."""
x = tf.reshape(x, [-1, shape_list(x)[-1]])
batch_size = shape_list(x)[0]
if do_random_vecs and do_tanh:
n = tf.nn.l2_normalize(x, axis=1)
proj = tf.concat([tf.matmul(n, random_vecs), tf.tanh(n)], axis=1)
elif do_random_vecs:
n = tf.nn.l2_normalize(x, axis=1)
proj = tf.matmul(n, random_vecs)
else:
proj = tf.tanh(x)
proj = tf.transpose(proj, [1, 0]) # [num_vecs, batch] after this.
if is_xla_compiled():
proj_dtype = proj.dtype
proj = tf.cast(proj, tf.bfloat16)
# Currently TPU only supports 1-D top_k calls.
map_fn = lambda x: tf.nn.top_k(x, k=batch_size, sorted=True)[0]
values = tf.map_fn(map_fn, proj)
values = tf.cast(values, proj_dtype)
else:
values, _ = tf.nn.top_k(proj, k=batch_size, sorted=True)
return values
proj1 = get_sorted_projections(logits1)
proj2 = get_sorted_projections(logits2)
dist = tf.reduce_mean(tf.squared_difference(proj1, proj2))
if return_logits:
return dist, logits1, logits2
return dist
|
[
"def",
"sliced_gan_loss",
"(",
"input1",
",",
"input2",
",",
"discriminator",
",",
"num_vecs",
",",
"do_random_vecs",
"=",
"True",
",",
"do_tanh",
"=",
"True",
",",
"return_logits",
"=",
"False",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"sliced_gan\"",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"discriminator\"",
")",
":",
"logits1",
"=",
"discriminator",
"(",
"input1",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"\"discriminator\"",
",",
"reuse",
"=",
"True",
")",
":",
"logits2",
"=",
"discriminator",
"(",
"input2",
")",
"if",
"do_random_vecs",
":",
"random_vecs",
"=",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"tf",
".",
"random_uniform",
"(",
"[",
"shape_list",
"(",
"logits1",
")",
"[",
"-",
"1",
"]",
",",
"num_vecs",
"]",
")",
",",
"axis",
"=",
"0",
")",
"def",
"get_sorted_projections",
"(",
"x",
")",
":",
"\"\"\"Make projections of x and sort them on the batch dimension.\"\"\"",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"shape_list",
"(",
"x",
")",
"[",
"-",
"1",
"]",
"]",
")",
"batch_size",
"=",
"shape_list",
"(",
"x",
")",
"[",
"0",
"]",
"if",
"do_random_vecs",
"and",
"do_tanh",
":",
"n",
"=",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"x",
",",
"axis",
"=",
"1",
")",
"proj",
"=",
"tf",
".",
"concat",
"(",
"[",
"tf",
".",
"matmul",
"(",
"n",
",",
"random_vecs",
")",
",",
"tf",
".",
"tanh",
"(",
"n",
")",
"]",
",",
"axis",
"=",
"1",
")",
"elif",
"do_random_vecs",
":",
"n",
"=",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"x",
",",
"axis",
"=",
"1",
")",
"proj",
"=",
"tf",
".",
"matmul",
"(",
"n",
",",
"random_vecs",
")",
"else",
":",
"proj",
"=",
"tf",
".",
"tanh",
"(",
"x",
")",
"proj",
"=",
"tf",
".",
"transpose",
"(",
"proj",
",",
"[",
"1",
",",
"0",
"]",
")",
"# [num_vecs, batch] after this.",
"if",
"is_xla_compiled",
"(",
")",
":",
"proj_dtype",
"=",
"proj",
".",
"dtype",
"proj",
"=",
"tf",
".",
"cast",
"(",
"proj",
",",
"tf",
".",
"bfloat16",
")",
"# Currently TPU only supports 1-D top_k calls.",
"map_fn",
"=",
"lambda",
"x",
":",
"tf",
".",
"nn",
".",
"top_k",
"(",
"x",
",",
"k",
"=",
"batch_size",
",",
"sorted",
"=",
"True",
")",
"[",
"0",
"]",
"values",
"=",
"tf",
".",
"map_fn",
"(",
"map_fn",
",",
"proj",
")",
"values",
"=",
"tf",
".",
"cast",
"(",
"values",
",",
"proj_dtype",
")",
"else",
":",
"values",
",",
"_",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"proj",
",",
"k",
"=",
"batch_size",
",",
"sorted",
"=",
"True",
")",
"return",
"values",
"proj1",
"=",
"get_sorted_projections",
"(",
"logits1",
")",
"proj2",
"=",
"get_sorted_projections",
"(",
"logits2",
")",
"dist",
"=",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"squared_difference",
"(",
"proj1",
",",
"proj2",
")",
")",
"if",
"return_logits",
":",
"return",
"dist",
",",
"logits1",
",",
"logits2",
"return",
"dist"
] |
Loss inspired by the sliced WGAN paper: https://arxiv.org/abs/1804.01947.
Puts input1 and input2 through the provided discriminator to get logits.
Then, computes num_vecs random projections of the logits, sorts them on
the batch dimension and returns the L2 loss between the sorted vectors.
See the above-mentioned paper for the reasoning behind it.
Args:
input1: first discriminator inputs.
input2: second discriminator inputs.
discriminator: inputs -> logits function.
num_vecs: how many random vectors to use for projections.
do_random_vecs: whether to use random vectors or just tanh of the logits.
do_tanh: if true (default) we'll also just use tanh of the logits.
return_logits: Whether or not to return the logits.
Returns:
The generator loss, i.e., the sliced approximation of the distance between
the projected distributions (warning: discriminator should maximize it).
|
[
"Loss",
"inspired",
"by",
"the",
"sliced",
"WGAN",
"paper",
":",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1804",
".",
"01947",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3524-L3594
|
train
|
Returns the L2 loss inspired by the sliced WGAN paper.
|
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,QWgp4EL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16l2KDPD,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 + 0o0) + chr(111) + '\061' + '\062' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(51) + chr(0b110000), 24996 - 24988), ehT0Px3KOsy9(chr(1238 - 1190) + chr(0b1101111) + '\063' + '\062' + chr(0b11110 + 0o27), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(6865 - 6754) + chr(51) + '\x33' + chr(55), 54294 - 54286), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(672 - 622) + chr(0b110 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(1360 - 1312) + chr(11239 - 11128) + chr(0b1001 + 0o54) + chr(54), 59981 - 59973), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(1478 - 1426) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(216 - 105) + chr(0b110001) + '\063' + chr(1938 - 1884), 0o10), ehT0Px3KOsy9('\x30' + chr(4729 - 4618) + chr(0b100000 + 0o22) + chr(52) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(2056 - 2008) + chr(0b11100 + 0o123) + chr(0b101010 + 0o10) + chr(2040 - 1989) + chr(49), 17214 - 17206), ehT0Px3KOsy9(chr(0b110000) + chr(2393 - 2282) + chr(1415 - 1364) + '\x32' + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011111 + 0o20) + chr(51) + '\x33' + chr(1111 - 1062), 11486 - 11478), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\x32' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1000110 + 0o51) + '\066' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b110110) + chr(0b100111 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11101 + 0o26) + chr(0b101000 + 0o12) + chr(0b10001 + 0o37), 8), ehT0Px3KOsy9(chr(408 - 360) + chr(765 - 654) + chr(0b10011 + 0o36) + '\065' + chr(502 - 450), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(1125 - 1071) + '\060', 8), ehT0Px3KOsy9(chr(2001 - 1953) + '\x6f' + '\x32' + chr(0b110011) + chr(0b1101 + 0o46), 64167 - 64159), ehT0Px3KOsy9('\x30' + chr(4833 - 4722) + chr(2187 - 2137) + chr(0b11111 + 0o26) + chr(52), 37432 - 37424), ehT0Px3KOsy9(chr(196 - 148) + '\157' + chr(50) + chr(52) + chr(54), 52663 - 52655), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(0b110001) + '\062' + chr(0b11010 + 0o30), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100110 + 0o13) + chr(1373 - 1320) + chr(1020 - 971), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + '\x33' + chr(0b110000) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1 + 0o156) + chr(0b101001 + 0o12) + chr(1140 - 1088) + chr(0b110110), 50049 - 50041), ehT0Px3KOsy9('\060' + chr(0b1011111 + 0o20) + chr(0b101111 + 0o3) + '\064' + chr(0b11111 + 0o30), 0o10), ehT0Px3KOsy9(chr(1003 - 955) + chr(4985 - 4874) + '\x32' + chr(1071 - 1023) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + chr(0b110011) + chr(0b110100) + chr(1184 - 1133), 37198 - 37190), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + chr(49) + chr(0b1 + 0o62) + chr(0b101 + 0o55), 9000 - 8992), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(766 - 718) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1111 + 0o41), 0b1000), ehT0Px3KOsy9(chr(2270 - 2222) + chr(111) + chr(1469 - 1418) + chr(179 - 127) + chr(0b10 + 0o60), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11011 + 0o124) + chr(0b101000 + 0o12) + chr(51), 0b1000), ehT0Px3KOsy9(chr(106 - 58) + '\x6f' + '\062' + '\x33' + chr(0b101100 + 0o4), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(2111 - 2063) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(2073 - 2020) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(670 - 622) + chr(11560 - 11449) + chr(1720 - 1671) + chr(54) + '\061', 24984 - 24976), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(1040 - 986) + chr(0b10111 + 0o35), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100010 + 0o17) + chr(1074 - 1021) + chr(956 - 903), 42174 - 42166)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'z'), chr(2307 - 2207) + '\x65' + chr(0b1010001 + 0o22) + '\x6f' + chr(0b1100100) + '\x65')('\x75' + chr(2222 - 2106) + chr(0b11011 + 0o113) + chr(0b11110 + 0o17) + chr(2774 - 2718)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def GN4Tm0EsaJ94(VhV0XRIswVYW, RofA8vBZe5aE, PgtWWoVsho2z, hTEyyHjXooRf, XzPpERxRGC_T=ehT0Px3KOsy9('\x30' + chr(111) + chr(49), 0b1000), ODaX2v4vkgYw=ehT0Px3KOsy9(chr(353 - 305) + '\157' + chr(49), 8), HiKnNP2WmSNT=ehT0Px3KOsy9('\060' + chr(0b100100 + 0o113) + '\060', 8)):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'"\xf9\xa7\xb6\xf4LL;\xfd\xea\xb3\xb6\xe7U'), chr(0b1100100) + chr(101) + '\x63' + chr(111) + '\144' + chr(101))(chr(0b11000 + 0o135) + chr(0b1110100) + chr(0b1100110) + chr(0b11011 + 0o22) + chr(0b101100 + 0o14)))(xafqLlk3kkUe(SXOLrMavuUCe(b"'\xf4\xbc\xbc\xf0J\x7f9\xc3\xf7"), chr(100) + '\145' + chr(99) + '\157' + chr(2358 - 2258) + '\x65')('\165' + chr(116) + '\146' + chr(45) + '\070')):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'"\xf9\xa7\xb6\xf4LL;\xfd\xea\xb3\xb6\xe7U'), '\x64' + '\145' + chr(5313 - 5214) + chr(111) + chr(4537 - 4437) + chr(0b1000001 + 0o44))('\x75' + chr(0b1110100) + '\x66' + '\x2d' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'0\xf1\xa6\xbc\xe7GM7\xcc\xf8\xa4\xb6\xe5'), '\x64' + '\x65' + '\x63' + '\157' + chr(0b1100001 + 0o3) + '\x65')(chr(117) + chr(0b1110010 + 0o2) + '\146' + chr(1941 - 1896) + chr(0b111000))):
_Sp9tFglcSlm = PgtWWoVsho2z(VhV0XRIswVYW)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'"\xf9\xa7\xb6\xf4LL;\xfd\xea\xb3\xb6\xe7U'), '\144' + '\145' + chr(0b1100011) + '\157' + '\x64' + chr(6338 - 6237))(chr(4419 - 4302) + '\x74' + chr(102) + chr(0b101101) + chr(783 - 727)))(xafqLlk3kkUe(SXOLrMavuUCe(b'0\xf1\xa6\xbc\xe7GM7\xcc\xf8\xa4\xb6\xe5'), chr(0b11011 + 0o111) + chr(101) + '\x63' + chr(111) + chr(9432 - 9332) + chr(0b100011 + 0o102))('\165' + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56)), reuse=ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49), 8)):
aBWqnBcL6YSU = PgtWWoVsho2z(RofA8vBZe5aE)
if XzPpERxRGC_T:
yQOgFr9wny7e = IDJ2eXGCBCDu.nn.l2_normalize(IDJ2eXGCBCDu.random_uniform([qypPRW8fq869(_Sp9tFglcSlm)[-ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b110011 + 0o74) + chr(49), 8)], hTEyyHjXooRf]), axis=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x30', 8))
def FO2Hq8UP_mfB(OeWW0F1dBPRQ):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101010 + 0o7), 8), qypPRW8fq869(OeWW0F1dBPRQ)[-ehT0Px3KOsy9(chr(1716 - 1668) + chr(0b1101 + 0o142) + chr(0b110001), 8)]])
ix9dZyeAmUxY = qypPRW8fq869(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(98 - 50), 8)]
if XzPpERxRGC_T and ODaX2v4vkgYw:
m1NkCryOw9Bx = IDJ2eXGCBCDu.nn.l2_normalize(OeWW0F1dBPRQ, axis=ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101110 + 0o3), 8))
yyoDvjRTEt6X = IDJ2eXGCBCDu.concat([IDJ2eXGCBCDu.matmul(m1NkCryOw9Bx, yQOgFr9wny7e), IDJ2eXGCBCDu.tanh(m1NkCryOw9Bx)], axis=ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + chr(321 - 272), 8))
elif XzPpERxRGC_T:
m1NkCryOw9Bx = IDJ2eXGCBCDu.nn.l2_normalize(OeWW0F1dBPRQ, axis=ehT0Px3KOsy9(chr(1040 - 992) + chr(111) + '\061', 8))
yyoDvjRTEt6X = IDJ2eXGCBCDu.matmul(m1NkCryOw9Bx, yQOgFr9wny7e)
else:
yyoDvjRTEt6X = IDJ2eXGCBCDu.tanh(OeWW0F1dBPRQ)
yyoDvjRTEt6X = IDJ2eXGCBCDu.transpose(yyoDvjRTEt6X, [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101000 + 0o11), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(118 - 70), 8)])
if GayarD_wafnb():
Hejs6i8sMP1N = yyoDvjRTEt6X.jSV9IKnemH7K
yyoDvjRTEt6X = IDJ2eXGCBCDu.cast(yyoDvjRTEt6X, IDJ2eXGCBCDu.bfloat16)
def wyesm0YLHJR_(OeWW0F1dBPRQ):
return xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b' \xf7\xa5\x80\xfe'), '\144' + '\145' + chr(99) + chr(0b1100000 + 0o17) + '\x64' + chr(101))(chr(0b1110101) + '\164' + chr(0b1100110) + '\x2d' + chr(0b101100 + 0o14)))(OeWW0F1dBPRQ, k=ix9dZyeAmUxY, sorted=ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + '\061', 8))[ehT0Px3KOsy9(chr(794 - 746) + chr(111) + chr(843 - 795), 8)]
SPnCNu54H1db = IDJ2eXGCBCDu.wyesm0YLHJR_(wyesm0YLHJR_, yyoDvjRTEt6X)
SPnCNu54H1db = IDJ2eXGCBCDu.cast(SPnCNu54H1db, Hejs6i8sMP1N)
else:
(SPnCNu54H1db, VNGQdHSFPrso) = IDJ2eXGCBCDu.nn.top_k(yyoDvjRTEt6X, k=ix9dZyeAmUxY, sorted=ehT0Px3KOsy9('\x30' + chr(111) + '\061', 8))
return SPnCNu54H1db
VohMGmnr0D31 = FO2Hq8UP_mfB(_Sp9tFglcSlm)
UlkKJdadUDSr = FO2Hq8UP_mfB(aBWqnBcL6YSU)
ydho_1U2EnKK = IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.squared_difference(VohMGmnr0D31, UlkKJdadUDSr))
if HiKnNP2WmSNT:
return (ydho_1U2EnKK, _Sp9tFglcSlm, aBWqnBcL6YSU)
return ydho_1U2EnKK
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
deep_discriminator
|
def deep_discriminator(x,
batch_norm,
is_training,
filters=64,
filter_size=4,
stride=2,
output_size=1024):
"""Discriminator architecture based on InfoGAN."""
with tf.variable_scope(
"discriminator", initializer=tf.random_normal_initializer(stddev=0.02)):
batch_size, height, width = shape_list(x)[:3] # pylint: disable=unbalanced-tuple-unpacking
net = layers().Conv2D(
filters, filter_size, strides=stride, padding="SAME", name="conv1")(x)
net = lrelu(net)
net = layers().Conv2D(
2 * filters,
filter_size,
strides=stride,
padding="SAME",
name="conv2")(net)
# [bs, h/4, w/4, 128]
if batch_norm:
net = layers().BatchNormalization(
training=is_training, momentum=0.999, name="d_bn2")(net)
net = lrelu(net)
size = height * width
x_shape = x.get_shape().as_list()
if x_shape[1] is None or x_shape[2] is None:
net = tf.reduce_mean(net, axis=[1, 2])
else:
net = tf.reshape(net, [batch_size, size * 8])
net = layers().Dense(output_size, name="d_fc3")(net)
if batch_norm:
net = layers().BatchNormalization(
training=is_training, momentum=0.999, name="d_bn3")(net)
net = lrelu(net)
return net
|
python
|
def deep_discriminator(x,
batch_norm,
is_training,
filters=64,
filter_size=4,
stride=2,
output_size=1024):
"""Discriminator architecture based on InfoGAN."""
with tf.variable_scope(
"discriminator", initializer=tf.random_normal_initializer(stddev=0.02)):
batch_size, height, width = shape_list(x)[:3] # pylint: disable=unbalanced-tuple-unpacking
net = layers().Conv2D(
filters, filter_size, strides=stride, padding="SAME", name="conv1")(x)
net = lrelu(net)
net = layers().Conv2D(
2 * filters,
filter_size,
strides=stride,
padding="SAME",
name="conv2")(net)
# [bs, h/4, w/4, 128]
if batch_norm:
net = layers().BatchNormalization(
training=is_training, momentum=0.999, name="d_bn2")(net)
net = lrelu(net)
size = height * width
x_shape = x.get_shape().as_list()
if x_shape[1] is None or x_shape[2] is None:
net = tf.reduce_mean(net, axis=[1, 2])
else:
net = tf.reshape(net, [batch_size, size * 8])
net = layers().Dense(output_size, name="d_fc3")(net)
if batch_norm:
net = layers().BatchNormalization(
training=is_training, momentum=0.999, name="d_bn3")(net)
net = lrelu(net)
return net
|
[
"def",
"deep_discriminator",
"(",
"x",
",",
"batch_norm",
",",
"is_training",
",",
"filters",
"=",
"64",
",",
"filter_size",
"=",
"4",
",",
"stride",
"=",
"2",
",",
"output_size",
"=",
"1024",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"discriminator\"",
",",
"initializer",
"=",
"tf",
".",
"random_normal_initializer",
"(",
"stddev",
"=",
"0.02",
")",
")",
":",
"batch_size",
",",
"height",
",",
"width",
"=",
"shape_list",
"(",
"x",
")",
"[",
":",
"3",
"]",
"# pylint: disable=unbalanced-tuple-unpacking",
"net",
"=",
"layers",
"(",
")",
".",
"Conv2D",
"(",
"filters",
",",
"filter_size",
",",
"strides",
"=",
"stride",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"conv1\"",
")",
"(",
"x",
")",
"net",
"=",
"lrelu",
"(",
"net",
")",
"net",
"=",
"layers",
"(",
")",
".",
"Conv2D",
"(",
"2",
"*",
"filters",
",",
"filter_size",
",",
"strides",
"=",
"stride",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"conv2\"",
")",
"(",
"net",
")",
"# [bs, h/4, w/4, 128]",
"if",
"batch_norm",
":",
"net",
"=",
"layers",
"(",
")",
".",
"BatchNormalization",
"(",
"training",
"=",
"is_training",
",",
"momentum",
"=",
"0.999",
",",
"name",
"=",
"\"d_bn2\"",
")",
"(",
"net",
")",
"net",
"=",
"lrelu",
"(",
"net",
")",
"size",
"=",
"height",
"*",
"width",
"x_shape",
"=",
"x",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"if",
"x_shape",
"[",
"1",
"]",
"is",
"None",
"or",
"x_shape",
"[",
"2",
"]",
"is",
"None",
":",
"net",
"=",
"tf",
".",
"reduce_mean",
"(",
"net",
",",
"axis",
"=",
"[",
"1",
",",
"2",
"]",
")",
"else",
":",
"net",
"=",
"tf",
".",
"reshape",
"(",
"net",
",",
"[",
"batch_size",
",",
"size",
"*",
"8",
"]",
")",
"net",
"=",
"layers",
"(",
")",
".",
"Dense",
"(",
"output_size",
",",
"name",
"=",
"\"d_fc3\"",
")",
"(",
"net",
")",
"if",
"batch_norm",
":",
"net",
"=",
"layers",
"(",
")",
".",
"BatchNormalization",
"(",
"training",
"=",
"is_training",
",",
"momentum",
"=",
"0.999",
",",
"name",
"=",
"\"d_bn3\"",
")",
"(",
"net",
")",
"net",
"=",
"lrelu",
"(",
"net",
")",
"return",
"net"
] |
Discriminator architecture based on InfoGAN.
|
[
"Discriminator",
"architecture",
"based",
"on",
"InfoGAN",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3601-L3637
|
train
|
Discriminator architecture based on InfoGAN.
|
Pu7Z6IJCgH3a,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6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b110 + 0o57) + chr(0b1100 + 0o44), 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\x31' + chr(55) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1665 - 1615) + chr(0b10 + 0o57) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1001111 + 0o40) + chr(1311 - 1260) + '\064' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\x32' + chr(0b11111 + 0o23) + chr(0b1001 + 0o47), 36356 - 36348), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + '\065' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + '\061' + '\x33' + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(5828 - 5717) + chr(49) + '\x34' + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + '\x31' + chr(0b110001) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(411 - 363) + chr(111) + chr(499 - 449) + chr(142 - 88) + '\x37', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110100) + chr(1434 - 1382), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + '\063' + chr(303 - 249) + chr(392 - 339), 0b1000), ehT0Px3KOsy9(chr(1864 - 1816) + '\x6f' + '\062' + '\067' + chr(0b1010 + 0o55), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100010 + 0o17) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(4907 - 4796) + chr(51) + chr(0b110000) + chr(0b11111 + 0o25), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2944 - 2833) + chr(0b110011) + chr(0b110110) + '\x33', 60024 - 60016), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x32' + '\064', 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b100111 + 0o110) + chr(0b100111 + 0o15) + chr(55), 28634 - 28626), ehT0Px3KOsy9(chr(824 - 776) + '\157' + chr(0b110010) + chr(49) + chr(1124 - 1073), 8), ehT0Px3KOsy9(chr(0b110000) + chr(6237 - 6126) + chr(0b1000 + 0o51) + chr(0b110010) + chr(0b10 + 0o63), 13660 - 13652), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1110 + 0o44) + chr(1405 - 1351) + chr(1080 - 1025), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b11011 + 0o34) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(386 - 338) + '\157' + chr(0b0 + 0o62) + chr(0b100000 + 0o23) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(8002 - 7891) + '\063' + chr(0b0 + 0o62) + '\061', 0o10), ehT0Px3KOsy9(chr(2094 - 2046) + chr(1501 - 1390) + chr(348 - 299) + '\x32' + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10100 + 0o36) + chr(0b1101 + 0o43) + chr(53), 0b1000), ehT0Px3KOsy9(chr(1098 - 1050) + chr(8867 - 8756) + '\x31' + chr(494 - 441) + chr(0b10100 + 0o36), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\x33' + '\066' + chr(1658 - 1609), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100 + 0o60) + chr(1620 - 1566), 0b1000), ehT0Px3KOsy9('\x30' + chr(2701 - 2590) + chr(0b110011) + chr(0b110011) + chr(1949 - 1896), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b1011 + 0o52) + chr(0b101000 + 0o15), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\064' + '\062', 8), ehT0Px3KOsy9(chr(920 - 872) + chr(111) + chr(2512 - 2461) + chr(215 - 167) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(0b100011 + 0o16) + chr(0b11111 + 0o26), 32875 - 32867), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b100000 + 0o117) + '\061' + '\067' + chr(1995 - 1944), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + chr(458 - 408) + '\x37' + '\065', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(65 - 15) + chr(0b1111 + 0o44) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110100) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(10418 - 10307) + chr(0b11011 + 0o30) + chr(0b110101) + '\066', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(870 - 822) + '\157' + chr(716 - 663) + chr(1289 - 1241), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6'), chr(100) + chr(0b101110 + 0o67) + chr(0b10001 + 0o122) + '\x6f' + chr(0b1100100) + '\x65')('\165' + '\x74' + chr(102) + '\x2d' + chr(0b1101 + 0o53)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def QemJfNeSL2LN(OeWW0F1dBPRQ, NA3RHDNXnGdK, XQJVi3cQFN5l, MErh319F3bgE=ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + chr(1754 - 1705) + '\060' + chr(48), 0b1000), deybX8NJ0oEI=ehT0Px3KOsy9(chr(797 - 749) + chr(0b1111 + 0o140) + chr(344 - 292), ord("\x08")), VKQ5wcD30goF=ehT0Px3KOsy9('\060' + chr(0b111100 + 0o63) + chr(0b11 + 0o57), ord("\x08")), NOWUhJWuP8qU=ehT0Px3KOsy9('\060' + chr(6737 - 6626) + chr(0b110010) + chr(48) + chr(0b110000) + '\060', 13298 - 13290)):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9e\x1d\xe9\xe2\x84\xf2E:=;\xd4K\x85\xda'), '\144' + chr(0b11101 + 0o110) + chr(99) + '\157' + chr(100) + '\145')(chr(5570 - 5453) + '\164' + '\x66' + '\x2d' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c\x15\xe8\xe8\x97\xf9D6\x0c)\xc3K\x87'), chr(0b1010 + 0o132) + '\x65' + chr(0b1011100 + 0o7) + chr(111) + chr(8405 - 8305) + chr(0b100010 + 0o103))('\165' + chr(5516 - 5400) + chr(102) + '\x2d' + chr(0b11101 + 0o33)), initializer=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a\x1d\xf5\xef\x8a\xfdv1\r:\xdaE\x99\xe0f\xaa\x9a\xa0N\xea9\xde\x85\xff\xa3'), '\144' + chr(9274 - 9173) + '\143' + '\157' + chr(100) + chr(0b1100101 + 0o0))(chr(5112 - 4995) + '\x74' + chr(102) + '\x2d' + chr(0b100011 + 0o25)))(stddev=0.02)):
(ix9dZyeAmUxY, ehbUULKuygfC, mPx09rBTrGXR) = qypPRW8fq869(OeWW0F1dBPRQ)[:ehT0Px3KOsy9('\060' + chr(111) + '\x33', 438 - 430)]
DyzboKL9cczb = sGi5Aql23May().Conv2D(MErh319F3bgE, deybX8NJ0oEI, strides=VKQ5wcD30goF, padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb=\xd6\xce'), '\144' + '\x65' + '\143' + '\157' + '\x64' + '\x65')(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b1110 + 0o37) + '\070'), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b\x13\xf5\xfd\xd4'), chr(2193 - 2093) + '\x65' + '\x63' + chr(111) + chr(0b0 + 0o144) + chr(101))(chr(175 - 58) + '\x74' + chr(0b1010100 + 0o22) + chr(46 - 1) + '\070'))(OeWW0F1dBPRQ)
DyzboKL9cczb = cTCWPzYxG6P7(DyzboKL9cczb)
DyzboKL9cczb = sGi5Aql23May().Conv2D(ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010), 8) * MErh319F3bgE, deybX8NJ0oEI, strides=VKQ5wcD30goF, padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb=\xd6\xce'), chr(0b1100100) + chr(0b1100101) + chr(0b11 + 0o140) + chr(2828 - 2717) + chr(0b1100001 + 0o3) + '\x65')('\165' + '\x74' + chr(102) + chr(0b101101) + chr(56)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b\x13\xf5\xfd\xd7'), '\x64' + chr(101) + '\x63' + chr(8506 - 8395) + chr(0b1100100) + chr(0b100011 + 0o102))('\x75' + chr(0b101110 + 0o106) + chr(102) + chr(0b11001 + 0o24) + chr(0b11011 + 0o35)))(DyzboKL9cczb)
if NA3RHDNXnGdK:
DyzboKL9cczb = sGi5Aql23May().BatchNormalization(training=XQJVi3cQFN5l, momentum=0.999, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c#\xf9\xe5\xd7'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\157' + chr(0b1100100) + chr(101))(chr(0b1110010 + 0o3) + '\164' + chr(0b1100110) + chr(0b10111 + 0o26) + chr(0b100100 + 0o24)))(DyzboKL9cczb)
DyzboKL9cczb = cTCWPzYxG6P7(DyzboKL9cczb)
NLcc3BCJnQka = ehbUULKuygfC * mPx09rBTrGXR
QQEXXbdZyz6m = OeWW0F1dBPRQ.get_shape().as_list()
if QQEXXbdZyz6m[ehT0Px3KOsy9(chr(48) + '\157' + chr(727 - 678), ord("\x08"))] is None or QQEXXbdZyz6m[ehT0Px3KOsy9('\060' + '\157' + chr(0b110010), 8)] is None:
DyzboKL9cczb = IDJ2eXGCBCDu.reduce_mean(DyzboKL9cczb, axis=[ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8), ehT0Px3KOsy9(chr(1770 - 1722) + chr(0b1011100 + 0o23) + chr(254 - 204), 8)])
else:
DyzboKL9cczb = IDJ2eXGCBCDu.reshape(DyzboKL9cczb, [ix9dZyeAmUxY, NLcc3BCJnQka * ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110000), 47506 - 47498)])
DyzboKL9cczb = sGi5Aql23May().Dense(NOWUhJWuP8qU, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c#\xfd\xe8\xd6'), chr(0b110 + 0o136) + chr(0b1010110 + 0o17) + '\143' + chr(0b111 + 0o150) + chr(1950 - 1850) + '\145')('\165' + chr(7299 - 7183) + chr(0b101000 + 0o76) + chr(1955 - 1910) + '\x38'))(DyzboKL9cczb)
if NA3RHDNXnGdK:
DyzboKL9cczb = sGi5Aql23May().BatchNormalization(training=XQJVi3cQFN5l, momentum=0.999, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c#\xf9\xe5\xd6'), '\144' + chr(0b1100101) + '\x63' + '\x6f' + chr(100) + chr(101))(chr(0b100111 + 0o116) + chr(116) + chr(0b1100110) + chr(0b100011 + 0o12) + chr(0b10000 + 0o50)))(DyzboKL9cczb)
DyzboKL9cczb = cTCWPzYxG6P7(DyzboKL9cczb)
return DyzboKL9cczb
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/common_layers.py
|
instance_norm
|
def instance_norm(x):
"""Instance normalization layer."""
with tf.variable_scope("instance_norm"):
epsilon = 1e-5
mean, var = tf.nn.moments(x, [1, 2], keep_dims=True)
scale = tf.get_variable(
"scale", [x.get_shape()[-1]],
initializer=tf.truncated_normal_initializer(mean=1.0, stddev=0.02))
offset = tf.get_variable(
"offset", [x.get_shape()[-1]], initializer=tf.constant_initializer(0.0))
out = scale * tf.div(x - mean, tf.sqrt(var + epsilon)) + offset
return out
|
python
|
def instance_norm(x):
"""Instance normalization layer."""
with tf.variable_scope("instance_norm"):
epsilon = 1e-5
mean, var = tf.nn.moments(x, [1, 2], keep_dims=True)
scale = tf.get_variable(
"scale", [x.get_shape()[-1]],
initializer=tf.truncated_normal_initializer(mean=1.0, stddev=0.02))
offset = tf.get_variable(
"offset", [x.get_shape()[-1]], initializer=tf.constant_initializer(0.0))
out = scale * tf.div(x - mean, tf.sqrt(var + epsilon)) + offset
return out
|
[
"def",
"instance_norm",
"(",
"x",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"instance_norm\"",
")",
":",
"epsilon",
"=",
"1e-5",
"mean",
",",
"var",
"=",
"tf",
".",
"nn",
".",
"moments",
"(",
"x",
",",
"[",
"1",
",",
"2",
"]",
",",
"keep_dims",
"=",
"True",
")",
"scale",
"=",
"tf",
".",
"get_variable",
"(",
"\"scale\"",
",",
"[",
"x",
".",
"get_shape",
"(",
")",
"[",
"-",
"1",
"]",
"]",
",",
"initializer",
"=",
"tf",
".",
"truncated_normal_initializer",
"(",
"mean",
"=",
"1.0",
",",
"stddev",
"=",
"0.02",
")",
")",
"offset",
"=",
"tf",
".",
"get_variable",
"(",
"\"offset\"",
",",
"[",
"x",
".",
"get_shape",
"(",
")",
"[",
"-",
"1",
"]",
"]",
",",
"initializer",
"=",
"tf",
".",
"constant_initializer",
"(",
"0.0",
")",
")",
"out",
"=",
"scale",
"*",
"tf",
".",
"div",
"(",
"x",
"-",
"mean",
",",
"tf",
".",
"sqrt",
"(",
"var",
"+",
"epsilon",
")",
")",
"+",
"offset",
"return",
"out"
] |
Instance normalization layer.
|
[
"Instance",
"normalization",
"layer",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3640-L3652
|
train
|
Instance normalization layer.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6r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,QC9iu2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110010 + 0o3) + '\x30', 0b1000), ehT0Px3KOsy9(chr(735 - 687) + '\x6f' + chr(51) + '\066' + chr(0b11111 + 0o21), 12354 - 12346), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(7311 - 7200) + chr(1672 - 1621) + chr(0b110000) + chr(0b11011 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1110 + 0o141) + chr(0b1100 + 0o47) + chr(55) + chr(2356 - 2304), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(0b110000 + 0o1) + chr(1679 - 1624), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(86 - 33) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000 + 0o1) + '\063' + chr(2247 - 2197), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100110 + 0o14) + chr(1507 - 1458) + chr(1308 - 1260), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b100000 + 0o20) + chr(2710 - 2655), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + '\061' + chr(0b110000) + '\067', 60349 - 60341), ehT0Px3KOsy9('\060' + '\157' + chr(0b100110 + 0o15) + chr(0b110001), 55590 - 55582), ehT0Px3KOsy9(chr(48) + chr(0b1101001 + 0o6) + chr(0b110010) + chr(0b1000 + 0o55) + '\066', 21441 - 21433), ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(1965 - 1914) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\063' + '\x32', 30143 - 30135), ehT0Px3KOsy9(chr(1529 - 1481) + '\157' + chr(2056 - 2005) + '\064' + '\062', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b11001 + 0o126) + '\061' + chr(2473 - 2420) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\x33' + chr(49) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2723 - 2670) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b0 + 0o62) + chr(0b11111 + 0o23) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2135 - 2085) + '\061' + chr(55), 10410 - 10402), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b110001) + '\x34' + chr(0b11111 + 0o22), 5007 - 4999), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11010 + 0o27) + '\067' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + chr(0b0 + 0o62) + chr(0b11100 + 0o26) + chr(0b111 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + chr(0b111110 + 0o61) + chr(55) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(0b101000 + 0o12) + chr(0b101000 + 0o12) + chr(719 - 665), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + '\060' + chr(53), 3381 - 3373), ehT0Px3KOsy9(chr(574 - 526) + chr(111) + '\061' + chr(0b100011 + 0o22) + '\061', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063', 53451 - 53443), ehT0Px3KOsy9(chr(1574 - 1526) + '\157' + '\066' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b10100 + 0o133) + '\x31' + chr(0b11011 + 0o25) + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110110) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\067' + chr(511 - 459), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(54) + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\x37' + chr(54), 0o10), ehT0Px3KOsy9(chr(1399 - 1351) + chr(111) + chr(51) + chr(2171 - 2121) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(839 - 790) + chr(0b110111) + chr(0b1110 + 0o45), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8721 - 8610) + chr(0b110001) + '\x31' + '\060', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(498 - 450) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000011 + 0o54) + '\x33' + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(12102 - 11991) + '\063' + chr(1858 - 1807) + '\067', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + chr(0b111 + 0o56) + chr(0b101101 + 0o3), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x86'), '\x64' + chr(101) + '\143' + chr(0b1010110 + 0o31) + chr(0b1100100) + chr(0b11001 + 0o114))(chr(0b1110101) + '\164' + chr(0b1100110) + '\055' + chr(2521 - 2465)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def FEobd0bbF9xL(OeWW0F1dBPRQ):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\x91\xb2\x95\xae\x0b6\xed\x984z\xc1m\xff'), chr(100) + chr(101) + chr(0b1010111 + 0o14) + chr(0b101 + 0o152) + chr(0b1100100) + chr(5651 - 5550))(chr(117) + chr(0b1110100) + chr(0b1100011 + 0o3) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1\x9e\xb3\x88\xae\x079\xed\x98)v\xdcp'), chr(0b1100100) + chr(0b111010 + 0o53) + chr(0b11101 + 0o106) + '\x6f' + chr(0b1100100) + chr(0b111010 + 0o53))('\x75' + '\x74' + chr(0b11010 + 0o114) + '\055' + '\070')):
Xtig2zAKpR0T = 1e-05
(aJhItC_Vawlw, l38lb8xQZNsE) = IDJ2eXGCBCDu.nn.moments(OeWW0F1dBPRQ, [ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\062', ord("\x08"))], keep_dims=ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001), 8))
xjPLimsZRgb9 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x93\xa1\x90\xaa'), chr(933 - 833) + chr(0b1011101 + 0o10) + '\143' + chr(0b101101 + 0o102) + '\144' + '\145')('\165' + chr(0b101110 + 0o106) + chr(0b1100110) + '\055' + '\x38'), [OeWW0F1dBPRQ.get_shape()[-ehT0Px3KOsy9('\x30' + '\157' + '\x31', 8)]], initializer=IDJ2eXGCBCDu.truncated_normal_initializer(mean=1.0, stddev=0.02))
VRaYxwVeIO1g = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7\x96\xa6\x8f\xaa\x1d'), chr(0b100 + 0o140) + chr(101) + '\143' + '\x6f' + chr(0b10100 + 0o120) + chr(0b1100101))(chr(4683 - 4566) + '\164' + chr(102) + '\055' + '\070'), [OeWW0F1dBPRQ.get_shape()[-ehT0Px3KOsy9('\060' + chr(111) + chr(2114 - 2065), 8)]], initializer=IDJ2eXGCBCDu.constant_initializer(0.0))
UkrMp_I0RDmo = xjPLimsZRgb9 * IDJ2eXGCBCDu.div(OeWW0F1dBPRQ - aJhItC_Vawlw, IDJ2eXGCBCDu.sqrt(l38lb8xQZNsE + Xtig2zAKpR0T)) + VRaYxwVeIO1g
return UkrMp_I0RDmo
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.