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/trax/inputs.py
|
batch_fun
|
def batch_fun(dataset, training, shapes, target_names, num_devices,
batch_size_per_device=32, batch_size=None, eval_batch_size=32,
bucket_length=32, buckets=None,
batch_shuffle_size=128, max_eval_length=None):
"""Batching function."""
del target_names
# Batch size is batch_size_per_device * num_devices unless given directly.
batch_size = batch_size or batch_size_per_device * num_devices
# If bucketing is not specified, check if target shapes are variable.
cur_batch_size = batch_size if training else eval_batch_size
# Make cur_batch_size divisible by num_devices.
cur_batch_size = max(cur_batch_size // num_devices, 1) * num_devices
# Create heuristic buckets is none are specified.
if buckets is None:
variable_target_shapes = False
target_shape = shapes[1]
for dim in target_shape:
if dim is None:
variable_target_shapes = True
tf.logging.info("Heuristically setting bucketing to %s based on shapes "
"of target tensors." % variable_target_shapes)
if variable_target_shapes:
bucket_boundaries = [bucket_length // 4, bucket_length // 2,
bucket_length, bucket_length * 2,
bucket_length * 4, bucket_length * 8,
bucket_length * 16]
# We will pad to boundaries which pads to bucket_boundary - 1: add 1 here.
bucket_boundaries = [b + 1 for b in bucket_boundaries]
if not training:
max_eval_length = max_eval_length or bucket_length * 32
bucket_boundaries[-1] = max_eval_length
bucket_batch_sizes = [cur_batch_size * 4, cur_batch_size * 2,
cur_batch_size, cur_batch_size // 2,
cur_batch_size // 4, cur_batch_size // 8,
cur_batch_size // 16, 1]
if not training:
bucket_batch_sizes[-2] = cur_batch_size // max_eval_length
# Make batch sizes divisible by num_devices.
bucket_batch_sizes = [max(b // num_devices, 1) * num_devices
for b in bucket_batch_sizes]
buckets = (bucket_boundaries, bucket_batch_sizes)
if buckets:
tf.logging.info("Bucketing with buckets %s." % str(buckets))
def example_length(_, target):
return tf.shape(target)[0]
boundaries, batch_sizes = buckets
dataset = dataset.apply(tf.data.experimental.bucket_by_sequence_length(
example_length, boundaries, batch_sizes,
pad_to_bucket_boundary=True))
else:
dataset = dataset.padded_batch(cur_batch_size, shapes)
if training:
return dataset.shuffle(batch_shuffle_size)
return dataset
|
python
|
def batch_fun(dataset, training, shapes, target_names, num_devices,
batch_size_per_device=32, batch_size=None, eval_batch_size=32,
bucket_length=32, buckets=None,
batch_shuffle_size=128, max_eval_length=None):
"""Batching function."""
del target_names
# Batch size is batch_size_per_device * num_devices unless given directly.
batch_size = batch_size or batch_size_per_device * num_devices
# If bucketing is not specified, check if target shapes are variable.
cur_batch_size = batch_size if training else eval_batch_size
# Make cur_batch_size divisible by num_devices.
cur_batch_size = max(cur_batch_size // num_devices, 1) * num_devices
# Create heuristic buckets is none are specified.
if buckets is None:
variable_target_shapes = False
target_shape = shapes[1]
for dim in target_shape:
if dim is None:
variable_target_shapes = True
tf.logging.info("Heuristically setting bucketing to %s based on shapes "
"of target tensors." % variable_target_shapes)
if variable_target_shapes:
bucket_boundaries = [bucket_length // 4, bucket_length // 2,
bucket_length, bucket_length * 2,
bucket_length * 4, bucket_length * 8,
bucket_length * 16]
# We will pad to boundaries which pads to bucket_boundary - 1: add 1 here.
bucket_boundaries = [b + 1 for b in bucket_boundaries]
if not training:
max_eval_length = max_eval_length or bucket_length * 32
bucket_boundaries[-1] = max_eval_length
bucket_batch_sizes = [cur_batch_size * 4, cur_batch_size * 2,
cur_batch_size, cur_batch_size // 2,
cur_batch_size // 4, cur_batch_size // 8,
cur_batch_size // 16, 1]
if not training:
bucket_batch_sizes[-2] = cur_batch_size // max_eval_length
# Make batch sizes divisible by num_devices.
bucket_batch_sizes = [max(b // num_devices, 1) * num_devices
for b in bucket_batch_sizes]
buckets = (bucket_boundaries, bucket_batch_sizes)
if buckets:
tf.logging.info("Bucketing with buckets %s." % str(buckets))
def example_length(_, target):
return tf.shape(target)[0]
boundaries, batch_sizes = buckets
dataset = dataset.apply(tf.data.experimental.bucket_by_sequence_length(
example_length, boundaries, batch_sizes,
pad_to_bucket_boundary=True))
else:
dataset = dataset.padded_batch(cur_batch_size, shapes)
if training:
return dataset.shuffle(batch_shuffle_size)
return dataset
|
[
"def",
"batch_fun",
"(",
"dataset",
",",
"training",
",",
"shapes",
",",
"target_names",
",",
"num_devices",
",",
"batch_size_per_device",
"=",
"32",
",",
"batch_size",
"=",
"None",
",",
"eval_batch_size",
"=",
"32",
",",
"bucket_length",
"=",
"32",
",",
"buckets",
"=",
"None",
",",
"batch_shuffle_size",
"=",
"128",
",",
"max_eval_length",
"=",
"None",
")",
":",
"del",
"target_names",
"# Batch size is batch_size_per_device * num_devices unless given directly.",
"batch_size",
"=",
"batch_size",
"or",
"batch_size_per_device",
"*",
"num_devices",
"# If bucketing is not specified, check if target shapes are variable.",
"cur_batch_size",
"=",
"batch_size",
"if",
"training",
"else",
"eval_batch_size",
"# Make cur_batch_size divisible by num_devices.",
"cur_batch_size",
"=",
"max",
"(",
"cur_batch_size",
"//",
"num_devices",
",",
"1",
")",
"*",
"num_devices",
"# Create heuristic buckets is none are specified.",
"if",
"buckets",
"is",
"None",
":",
"variable_target_shapes",
"=",
"False",
"target_shape",
"=",
"shapes",
"[",
"1",
"]",
"for",
"dim",
"in",
"target_shape",
":",
"if",
"dim",
"is",
"None",
":",
"variable_target_shapes",
"=",
"True",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Heuristically setting bucketing to %s based on shapes \"",
"\"of target tensors.\"",
"%",
"variable_target_shapes",
")",
"if",
"variable_target_shapes",
":",
"bucket_boundaries",
"=",
"[",
"bucket_length",
"//",
"4",
",",
"bucket_length",
"//",
"2",
",",
"bucket_length",
",",
"bucket_length",
"*",
"2",
",",
"bucket_length",
"*",
"4",
",",
"bucket_length",
"*",
"8",
",",
"bucket_length",
"*",
"16",
"]",
"# We will pad to boundaries which pads to bucket_boundary - 1: add 1 here.",
"bucket_boundaries",
"=",
"[",
"b",
"+",
"1",
"for",
"b",
"in",
"bucket_boundaries",
"]",
"if",
"not",
"training",
":",
"max_eval_length",
"=",
"max_eval_length",
"or",
"bucket_length",
"*",
"32",
"bucket_boundaries",
"[",
"-",
"1",
"]",
"=",
"max_eval_length",
"bucket_batch_sizes",
"=",
"[",
"cur_batch_size",
"*",
"4",
",",
"cur_batch_size",
"*",
"2",
",",
"cur_batch_size",
",",
"cur_batch_size",
"//",
"2",
",",
"cur_batch_size",
"//",
"4",
",",
"cur_batch_size",
"//",
"8",
",",
"cur_batch_size",
"//",
"16",
",",
"1",
"]",
"if",
"not",
"training",
":",
"bucket_batch_sizes",
"[",
"-",
"2",
"]",
"=",
"cur_batch_size",
"//",
"max_eval_length",
"# Make batch sizes divisible by num_devices.",
"bucket_batch_sizes",
"=",
"[",
"max",
"(",
"b",
"//",
"num_devices",
",",
"1",
")",
"*",
"num_devices",
"for",
"b",
"in",
"bucket_batch_sizes",
"]",
"buckets",
"=",
"(",
"bucket_boundaries",
",",
"bucket_batch_sizes",
")",
"if",
"buckets",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Bucketing with buckets %s.\"",
"%",
"str",
"(",
"buckets",
")",
")",
"def",
"example_length",
"(",
"_",
",",
"target",
")",
":",
"return",
"tf",
".",
"shape",
"(",
"target",
")",
"[",
"0",
"]",
"boundaries",
",",
"batch_sizes",
"=",
"buckets",
"dataset",
"=",
"dataset",
".",
"apply",
"(",
"tf",
".",
"data",
".",
"experimental",
".",
"bucket_by_sequence_length",
"(",
"example_length",
",",
"boundaries",
",",
"batch_sizes",
",",
"pad_to_bucket_boundary",
"=",
"True",
")",
")",
"else",
":",
"dataset",
"=",
"dataset",
".",
"padded_batch",
"(",
"cur_batch_size",
",",
"shapes",
")",
"if",
"training",
":",
"return",
"dataset",
".",
"shuffle",
"(",
"batch_shuffle_size",
")",
"return",
"dataset"
] |
Batching function.
|
[
"Batching",
"function",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/inputs.py#L262-L316
|
train
|
Batching 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,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1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gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(741 - 693) + '\x6f' + chr(1105 - 1056) + chr(1830 - 1782) + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b10000 + 0o42) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b100101 + 0o14) + chr(0b101000 + 0o15), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(51) + chr(449 - 394) + chr(0b110110), 34064 - 34056), ehT0Px3KOsy9(chr(2146 - 2098) + chr(0b11001 + 0o126) + '\x31' + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9700 - 9589) + '\x32' + chr(0b110011) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b111 + 0o56) + chr(0b101 + 0o53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011111 + 0o20) + chr(0b110001) + chr(0b11011 + 0o34) + '\067', 24126 - 24118), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + '\x31' + chr(1381 - 1329) + chr(0b11000 + 0o33), 32894 - 32886), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b110 + 0o54) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(618 - 570) + chr(6143 - 6032) + chr(49) + chr(54) + chr(0b1100 + 0o46), 0o10), ehT0Px3KOsy9(chr(308 - 260) + '\x6f' + '\061' + '\060' + chr(50), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1010 + 0o47) + chr(0b110 + 0o57) + chr(719 - 671), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(10810 - 10699) + chr(0b101110 + 0o3) + '\066' + chr(53), 4500 - 4492), ehT0Px3KOsy9(chr(48) + chr(774 - 663) + chr(52) + '\061', 0o10), ehT0Px3KOsy9(chr(1258 - 1210) + '\x6f' + chr(0b11111 + 0o22) + chr(0b110000) + chr(0b101100 + 0o11), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(1097 - 1049) + chr(0b1101111) + chr(0b110011) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(50) + chr(1348 - 1296), 26041 - 26033), ehT0Px3KOsy9(chr(2040 - 1992) + chr(0b11010 + 0o125) + '\061' + chr(1409 - 1356) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1111 + 0o50) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(0b110101) + chr(0b101110 + 0o5), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(5624 - 5513) + chr(0b100010 + 0o21) + chr(49) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(2074 - 2026) + chr(9737 - 9626) + '\x31' + chr(48), 16268 - 16260), ehT0Px3KOsy9(chr(444 - 396) + chr(111) + chr(0b100001 + 0o20) + '\066', 5280 - 5272), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(51) + chr(49) + chr(0b100000 + 0o27), 42009 - 42001), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\065' + chr(0b100111 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10100 + 0o37) + '\065' + chr(0b100101 + 0o13), 0o10), ehT0Px3KOsy9(chr(126 - 78) + '\157' + chr(0b100011 + 0o20) + chr(52) + '\x32', 50246 - 50238), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b110110) + chr(0b110110), 50504 - 50496), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\x32' + chr(2338 - 2286), 19665 - 19657), ehT0Px3KOsy9(chr(672 - 624) + chr(0b1101111) + chr(826 - 775) + chr(580 - 525) + chr(2243 - 2190), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(54) + chr(0b11101 + 0o23), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\065' + chr(0b11 + 0o63), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\066' + chr(54), 21045 - 21037), ehT0Px3KOsy9(chr(2299 - 2251) + chr(111) + chr(1652 - 1598) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1820 - 1709) + chr(1920 - 1867) + chr(53), 10805 - 10797), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + '\063' + chr(0b110000) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001 + 0o5) + chr(1089 - 1035), 8), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(10337 - 10226) + chr(50) + chr(53) + '\065', 35586 - 35578)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'l'), chr(4498 - 4398) + '\145' + chr(0b11001 + 0o112) + '\157' + '\144' + '\145')(chr(117) + chr(0b1110100) + chr(8246 - 8144) + '\055' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def CjOj_M_CoAjS(xQt6gV9VfTO3, H15mhcYcioqz, OVHEymXlQYjG, xEjzlji2f7bf, eK0vLxsq0cly, RWCpFJp5Mi5z=ehT0Px3KOsy9(chr(48) + chr(2692 - 2581) + chr(0b100010 + 0o22) + chr(242 - 194), 0o10), ix9dZyeAmUxY=None, aCHA9MHY0KlX=ehT0Px3KOsy9(chr(48) + '\157' + chr(2591 - 2539) + chr(0b110000), 8), srtJwWjdcntc=ehT0Px3KOsy9(chr(1061 - 1013) + '\157' + chr(0b110100) + chr(48), 8), rMH7GU_csUsK=None, snLbXjHTDTlY=ehT0Px3KOsy9('\x30' + chr(2246 - 2135) + '\062' + '\x30' + '\x30', 50248 - 50240), Rw1f0kIeInRL=None):
del xEjzlji2f7bf
ix9dZyeAmUxY = ix9dZyeAmUxY or RWCpFJp5Mi5z * eK0vLxsq0cly
AAOD69wsrfa1 = ix9dZyeAmUxY if H15mhcYcioqz else aCHA9MHY0KlX
AAOD69wsrfa1 = tsdjvlgh9gDP(AAOD69wsrfa1 // eK0vLxsq0cly, ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 51102 - 51094)) * eK0vLxsq0cly
if rMH7GU_csUsK is None:
Cl0L5qxNwXmt = ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x30', ord("\x08"))
nk7Ena0OgGVQ = OVHEymXlQYjG[ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001), 8)]
for Nl_JhL3qUwSN in nk7Ena0OgGVQ:
if Nl_JhL3qUwSN is None:
Cl0L5qxNwXmt = ehT0Px3KOsy9(chr(677 - 629) + chr(0b1101101 + 0o2) + chr(0b110001), 8)
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x11g\x85\x86\x06\xfeOH\t\xb9()'), '\x64' + '\x65' + '\143' + chr(111) + chr(100) + '\145')('\x75' + chr(3025 - 2909) + '\146' + '\055' + chr(0b11001 + 0o37)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\n5\xb8\x8c\x1a\xee\\\x16\x00\xb4\x1e.\x11UR Vm\xbd\x01X\x0b\xaa}m\xa4\xcb\x9c\x8b\x183\xdd\xc4A\x16\x17^\xe6T\xcc15\xa9\xde\x1c\xf3\x08\x0c\x0b\xb4\x02'\x1bUN#\x02m\xb5\x1dXN\xbc(z\xaa\xc0\x9b\x8d\x04'\xd3"), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(0b10000 + 0o137) + chr(8915 - 8815) + chr(0b110100 + 0o61))(chr(117) + '\x74' + chr(0b1000001 + 0o45) + chr(0b101101) + '\x38') % Cl0L5qxNwXmt)
if Cl0L5qxNwXmt:
LX8EwN6jwJEW = [srtJwWjdcntc // ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(52), 48311 - 48303), srtJwWjdcntc // ehT0Px3KOsy9('\060' + '\157' + chr(0b101110 + 0o4), 37154 - 37146), srtJwWjdcntc, srtJwWjdcntc * ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1000001 + 0o56) + chr(521 - 471), 8), srtJwWjdcntc * ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(4741 - 4630) + '\064', 8), srtJwWjdcntc * ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101111 + 0o2) + '\x30', 8), srtJwWjdcntc * ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(50) + chr(0b110000), 0b1000)]
LX8EwN6jwJEW = [wmN3dvez4qzC + ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), 8) for wmN3dvez4qzC in LX8EwN6jwJEW]
if not H15mhcYcioqz:
Rw1f0kIeInRL = Rw1f0kIeInRL or srtJwWjdcntc * ehT0Px3KOsy9(chr(48) + chr(6366 - 6255) + chr(52) + chr(0b110000), 8)
LX8EwN6jwJEW[-ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11010 + 0o27), 8)] = Rw1f0kIeInRL
R_ihBYlGpH1c = [AAOD69wsrfa1 * ehT0Px3KOsy9(chr(48) + '\157' + '\x34', 8), AAOD69wsrfa1 * ehT0Px3KOsy9('\x30' + '\157' + '\062', 8), AAOD69wsrfa1, AAOD69wsrfa1 // ehT0Px3KOsy9(chr(352 - 304) + chr(111) + chr(50), 8), AAOD69wsrfa1 // ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110100 + 0o0), 8), AAOD69wsrfa1 // ehT0Px3KOsy9(chr(1028 - 980) + chr(0b1101 + 0o142) + chr(49) + '\x30', 8), AAOD69wsrfa1 // ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(677 - 627) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + chr(0b11111 + 0o120) + chr(0b100000 + 0o21), 8)]
if not H15mhcYcioqz:
R_ihBYlGpH1c[-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32', 8)] = AAOD69wsrfa1 // Rw1f0kIeInRL
R_ihBYlGpH1c = [tsdjvlgh9gDP(wmN3dvez4qzC // eK0vLxsq0cly, ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8)) * eK0vLxsq0cly for wmN3dvez4qzC in R_ihBYlGpH1c]
rMH7GU_csUsK = (LX8EwN6jwJEW, R_ihBYlGpH1c)
if rMH7GU_csUsK:
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\x11g\x85\x86\x06\xfeOH\t\xb9()'), chr(5005 - 4905) + chr(8061 - 7960) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(101))(chr(0b1001011 + 0o52) + '\164' + '\x66' + chr(313 - 268) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\x00%\xae\x95\x16\xe9A\x11\x04\xf5\x05+\x1c\x1d\x01'Wz\xbf\nKX\xe8-}\xe1"), chr(100) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(603 - 558) + chr(0b111000)) % M8_cKLkHVB2V(rMH7GU_csUsK))
def fEAdJgn5yxLX(VNGQdHSFPrso, GR1581dR5rDS):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b',1\xb8\xa7\x15\xd1O\x137\xa5\x11 '), '\x64' + '\x65' + chr(0b11101 + 0o106) + chr(0b101001 + 0o106) + '\144' + chr(101))(chr(0b1110101) + chr(10921 - 10805) + '\146' + chr(0b101101) + chr(2520 - 2464)))(GR1581dR5rDS)[ehT0Px3KOsy9('\060' + '\157' + chr(927 - 879), 8)]
(n7rrZRZYkBNq, vUD9kCH9I6mb) = rMH7GU_csUsK
xQt6gV9VfTO3 = xQt6gV9VfTO3.apply(IDJ2eXGCBCDu.data.experimental.bucket_by_sequence_length(fEAdJgn5yxLX, n7rrZRZYkBNq, vUD9kCH9I6mb, pad_to_bucket_boundary=ehT0Px3KOsy9(chr(385 - 337) + chr(0b1101111) + '\x31', 8)))
else:
xQt6gV9VfTO3 = xQt6gV9VfTO3.padded_batch(AAOD69wsrfa1, OVHEymXlQYjG)
if H15mhcYcioqz:
return xafqLlk3kkUe(xQt6gV9VfTO3, xafqLlk3kkUe(SXOLrMavuUCe(b'18\xb8\x98\x15\xf1M'), '\x64' + chr(6935 - 6834) + chr(2938 - 2839) + chr(111) + chr(0b1000000 + 0o44) + chr(0b1100101))(chr(117) + chr(116) + chr(0b1010010 + 0o24) + chr(0b1 + 0o54) + chr(56)))(snLbXjHTDTlY)
return xQt6gV9VfTO3
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/inputs.py
|
lm1b_preprocess
|
def lm1b_preprocess(dataset, training,
max_target_length=-1, max_eval_target_length=-1):
"""Preprocessing for LM1B: filter out targets exceeding maximum length."""
def target_right_length(_, target):
return tf.less(tf.shape(target)[0], max_target_length + 1)
def eval_target_right_length(_, target):
return tf.less(tf.shape(target)[0], max_eval_target_length + 1)
if max_target_length > 0 and training:
dataset = dataset.filter(target_right_length)
if max_eval_target_length > 0 and not training:
dataset = dataset.filter(eval_target_right_length)
return dataset
|
python
|
def lm1b_preprocess(dataset, training,
max_target_length=-1, max_eval_target_length=-1):
"""Preprocessing for LM1B: filter out targets exceeding maximum length."""
def target_right_length(_, target):
return tf.less(tf.shape(target)[0], max_target_length + 1)
def eval_target_right_length(_, target):
return tf.less(tf.shape(target)[0], max_eval_target_length + 1)
if max_target_length > 0 and training:
dataset = dataset.filter(target_right_length)
if max_eval_target_length > 0 and not training:
dataset = dataset.filter(eval_target_right_length)
return dataset
|
[
"def",
"lm1b_preprocess",
"(",
"dataset",
",",
"training",
",",
"max_target_length",
"=",
"-",
"1",
",",
"max_eval_target_length",
"=",
"-",
"1",
")",
":",
"def",
"target_right_length",
"(",
"_",
",",
"target",
")",
":",
"return",
"tf",
".",
"less",
"(",
"tf",
".",
"shape",
"(",
"target",
")",
"[",
"0",
"]",
",",
"max_target_length",
"+",
"1",
")",
"def",
"eval_target_right_length",
"(",
"_",
",",
"target",
")",
":",
"return",
"tf",
".",
"less",
"(",
"tf",
".",
"shape",
"(",
"target",
")",
"[",
"0",
"]",
",",
"max_eval_target_length",
"+",
"1",
")",
"if",
"max_target_length",
">",
"0",
"and",
"training",
":",
"dataset",
"=",
"dataset",
".",
"filter",
"(",
"target_right_length",
")",
"if",
"max_eval_target_length",
">",
"0",
"and",
"not",
"training",
":",
"dataset",
"=",
"dataset",
".",
"filter",
"(",
"eval_target_right_length",
")",
"return",
"dataset"
] |
Preprocessing for LM1B: filter out targets exceeding maximum length.
|
[
"Preprocessing",
"for",
"LM1B",
":",
"filter",
"out",
"targets",
"exceeding",
"maximum",
"length",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/inputs.py#L337-L353
|
train
|
Preprocessing for LM1B.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,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,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(1390 - 1342) + chr(111) + chr(0b110011) + chr(2383 - 2328) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100010 + 0o15) + chr(51) + chr(51) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\064' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100100 + 0o113) + chr(0b110011) + '\063' + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\066' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(2198 - 2148) + '\063' + chr(0b11001 + 0o27), 48008 - 48000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + chr(0b110010) + chr(0b11111 + 0o27) + chr(1642 - 1588), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1118 - 1063) + chr(0b11100 + 0o32), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b100110 + 0o15) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(50) + chr(53) + chr(1475 - 1421), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + '\x33' + '\x32', 8), ehT0Px3KOsy9(chr(1582 - 1534) + chr(0b11010 + 0o125) + '\061' + chr(0b101110 + 0o5) + chr(0b110101), 60013 - 60005), ehT0Px3KOsy9(chr(983 - 935) + chr(0b1101111) + chr(0b110101) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100 + 0o153) + chr(0b110010) + chr(49) + chr(0b110111), 18339 - 18331), ehT0Px3KOsy9(chr(48) + chr(11751 - 11640) + chr(2432 - 2379), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + '\063' + '\065', 32 - 24), ehT0Px3KOsy9(chr(123 - 75) + '\157' + chr(0b110001) + '\x32' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1593 - 1482) + chr(0b10010 + 0o40) + '\x34' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b110110) + '\067', 20935 - 20927), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\x32' + chr(54), 39291 - 39283), ehT0Px3KOsy9('\x30' + chr(0b1011000 + 0o27) + '\x31' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(11821 - 11710) + chr(833 - 783) + chr(1198 - 1150) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(2577 - 2524) + chr(0b1010 + 0o52), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\067', 38217 - 38209), ehT0Px3KOsy9(chr(1407 - 1359) + chr(0b1101111) + '\061' + chr(0b110111) + '\060', 0o10), ehT0Px3KOsy9(chr(316 - 268) + chr(111) + '\061' + '\067' + '\x31', 36275 - 36267), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100001 + 0o20) + chr(1562 - 1507) + chr(114 - 64), ord("\x08")), ehT0Px3KOsy9(chr(77 - 29) + chr(0b110110 + 0o71) + '\061' + chr(48) + chr(2402 - 2351), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100110 + 0o15) + '\066' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1469 - 1415), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + '\x33' + chr(0b110 + 0o55) + '\x31', 8), ehT0Px3KOsy9(chr(48) + chr(11967 - 11856) + chr(0b1100 + 0o46) + chr(1473 - 1425) + chr(0b101111 + 0o2), 8), ehT0Px3KOsy9(chr(1510 - 1462) + chr(11739 - 11628) + '\x33' + chr(0b10010 + 0o41) + chr(0b110000 + 0o0), 0o10), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(0b110010) + chr(0b100101 + 0o16) + chr(0b101110 + 0o2), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(54) + '\067', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\x31' + chr(2728 - 2673), 20076 - 20068), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b110111 + 0o70) + chr(0b110001) + '\x34' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(1687 - 1638) + chr(54) + chr(1607 - 1553), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + '\063' + chr(0b110110) + chr(105 - 52), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + '\065' + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(111) + chr(100) + '\145')(chr(0b1110 + 0o147) + chr(0b1001000 + 0o54) + chr(5070 - 4968) + chr(45) + chr(1399 - 1343)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def fCC9YJMLFtR7(xQt6gV9VfTO3, H15mhcYcioqz, _93hATE4geR3=-ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49), 39355 - 39347), T0z2wvgAch4L=-ehT0Px3KOsy9('\060' + chr(4775 - 4664) + chr(0b101111 + 0o2), 8)):
def WNkZBomNTsdj(VNGQdHSFPrso, GR1581dR5rDS):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x92\xbc\x12\xa9'), '\144' + chr(0b1100101) + chr(1023 - 924) + chr(7237 - 7126) + chr(6168 - 6068) + chr(0b1100101))(chr(0b110010 + 0o103) + '\164' + chr(8908 - 8806) + chr(0b1111 + 0o36) + chr(0b111000)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x90\xb8\x14\x83Q\xd4\xd1R\x8f\xde\xb9?'), '\144' + chr(0b1010111 + 0o16) + chr(99) + chr(5698 - 5587) + chr(0b1100100) + chr(0b1100101))(chr(0b111 + 0o156) + '\164' + chr(0b1100110) + chr(45) + chr(1050 - 994)))(GR1581dR5rDS)[ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + '\060', 44745 - 44737)], _93hATE4geR3 + ehT0Px3KOsy9('\060' + chr(111) + chr(0b101111 + 0o2), 8))
def vu_RmdD2YzDA(VNGQdHSFPrso, GR1581dR5rDS):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x92\xbc\x12\xa9'), chr(0b1100100) + chr(0b1100101) + chr(0b1000010 + 0o41) + '\x6f' + chr(0b1100100) + chr(0b1100101))('\x75' + chr(0b10010 + 0o142) + chr(102) + chr(0b10010 + 0o33) + '\x38'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x90\xb8\x14\x83Q\xd4\xd1R\x8f\xde\xb9?'), '\x64' + '\145' + chr(2182 - 2083) + chr(111) + chr(0b1100100) + '\145')(chr(0b1011110 + 0o27) + '\164' + chr(0b11011 + 0o113) + '\055' + chr(0b100011 + 0o25)))(GR1581dR5rDS)[ehT0Px3KOsy9('\x30' + chr(111) + '\060', 8)], T0z2wvgAch4L + ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', 8))
if _93hATE4geR3 > ehT0Px3KOsy9(chr(462 - 414) + '\157' + chr(0b110000), 8) and H15mhcYcioqz:
xQt6gV9VfTO3 = xQt6gV9VfTO3.hi1V0ySZcNds(WNkZBomNTsdj)
if T0z2wvgAch4L > ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2051 - 2003), 8) and (not H15mhcYcioqz):
xQt6gV9VfTO3 = xQt6gV9VfTO3.hi1V0ySZcNds(vu_RmdD2YzDA)
return xQt6gV9VfTO3
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/inputs.py
|
shuffle_and_batch_data
|
def shuffle_and_batch_data(dataset,
target_names,
features_info,
training,
num_devices,
shuffle_buffer_size=1024,
preprocess_fun=no_preprocess):
"""Shuffle and batch the given dataset."""
def append_targets(example):
"""Append targets to the example dictionary. Needed for Keras."""
if len(target_names) == 1:
return (example, example[target_names[0]])
targets = {}
for name in target_names:
targets[name] = example[name]
return (example, targets)
dataset = dataset.map(append_targets)
if training:
dataset = dataset.repeat()
# Skip a random fraction at the beginning of the stream. The skip is
# essential for synchronous highly-parallel training to avoid multiple
# replicas reading the same data in lock-step.
dataset = dataset.skip(random.randint(0, _MAX_SKIP_EXAMPLES))
dataset = preprocess_fun(dataset, training)
shapes = {k: features_info[k].shape for k in features_info}
shapes = (shapes, shapes[target_names[0]])
dataset = dataset.shuffle(shuffle_buffer_size)
dataset = batch_fun(dataset, training, shapes, target_names, num_devices)
return dataset.prefetch(2)
|
python
|
def shuffle_and_batch_data(dataset,
target_names,
features_info,
training,
num_devices,
shuffle_buffer_size=1024,
preprocess_fun=no_preprocess):
"""Shuffle and batch the given dataset."""
def append_targets(example):
"""Append targets to the example dictionary. Needed for Keras."""
if len(target_names) == 1:
return (example, example[target_names[0]])
targets = {}
for name in target_names:
targets[name] = example[name]
return (example, targets)
dataset = dataset.map(append_targets)
if training:
dataset = dataset.repeat()
# Skip a random fraction at the beginning of the stream. The skip is
# essential for synchronous highly-parallel training to avoid multiple
# replicas reading the same data in lock-step.
dataset = dataset.skip(random.randint(0, _MAX_SKIP_EXAMPLES))
dataset = preprocess_fun(dataset, training)
shapes = {k: features_info[k].shape for k in features_info}
shapes = (shapes, shapes[target_names[0]])
dataset = dataset.shuffle(shuffle_buffer_size)
dataset = batch_fun(dataset, training, shapes, target_names, num_devices)
return dataset.prefetch(2)
|
[
"def",
"shuffle_and_batch_data",
"(",
"dataset",
",",
"target_names",
",",
"features_info",
",",
"training",
",",
"num_devices",
",",
"shuffle_buffer_size",
"=",
"1024",
",",
"preprocess_fun",
"=",
"no_preprocess",
")",
":",
"def",
"append_targets",
"(",
"example",
")",
":",
"\"\"\"Append targets to the example dictionary. Needed for Keras.\"\"\"",
"if",
"len",
"(",
"target_names",
")",
"==",
"1",
":",
"return",
"(",
"example",
",",
"example",
"[",
"target_names",
"[",
"0",
"]",
"]",
")",
"targets",
"=",
"{",
"}",
"for",
"name",
"in",
"target_names",
":",
"targets",
"[",
"name",
"]",
"=",
"example",
"[",
"name",
"]",
"return",
"(",
"example",
",",
"targets",
")",
"dataset",
"=",
"dataset",
".",
"map",
"(",
"append_targets",
")",
"if",
"training",
":",
"dataset",
"=",
"dataset",
".",
"repeat",
"(",
")",
"# Skip a random fraction at the beginning of the stream. The skip is",
"# essential for synchronous highly-parallel training to avoid multiple",
"# replicas reading the same data in lock-step.",
"dataset",
"=",
"dataset",
".",
"skip",
"(",
"random",
".",
"randint",
"(",
"0",
",",
"_MAX_SKIP_EXAMPLES",
")",
")",
"dataset",
"=",
"preprocess_fun",
"(",
"dataset",
",",
"training",
")",
"shapes",
"=",
"{",
"k",
":",
"features_info",
"[",
"k",
"]",
".",
"shape",
"for",
"k",
"in",
"features_info",
"}",
"shapes",
"=",
"(",
"shapes",
",",
"shapes",
"[",
"target_names",
"[",
"0",
"]",
"]",
")",
"dataset",
"=",
"dataset",
".",
"shuffle",
"(",
"shuffle_buffer_size",
")",
"dataset",
"=",
"batch_fun",
"(",
"dataset",
",",
"training",
",",
"shapes",
",",
"target_names",
",",
"num_devices",
")",
"return",
"dataset",
".",
"prefetch",
"(",
"2",
")"
] |
Shuffle and batch the given dataset.
|
[
"Shuffle",
"and",
"batch",
"the",
"given",
"dataset",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/inputs.py#L357-L385
|
train
|
Shuffle and batch the given dataset.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsT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ssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(52) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111001 + 0o66) + '\x34' + chr(0b110101 + 0o2), 46159 - 46151), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b10001 + 0o42) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(575 - 464) + chr(0b110010) + chr(0b101000 + 0o12) + chr(0b110101), 3419 - 3411), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110001) + '\x35' + chr(0b11000 + 0o34), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011111 + 0o20) + chr(51) + '\061' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\065' + chr(615 - 567), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b100101 + 0o112) + chr(0b110101) + '\064', 22024 - 22016), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110111), 31962 - 31954), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(49) + chr(967 - 917), 0o10), ehT0Px3KOsy9(chr(874 - 826) + chr(111) + chr(454 - 401) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000 + 0o147) + '\x33' + chr(51) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(349 - 300) + chr(50) + chr(0b101000 + 0o14), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(5324 - 5213) + chr(0b110001 + 0o0) + '\x35' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(49) + chr(1245 - 1190), 0b1000), ehT0Px3KOsy9(chr(48) + chr(9814 - 9703) + '\x32' + chr(0b10011 + 0o36) + '\062', 8), ehT0Px3KOsy9(chr(1002 - 954) + chr(9366 - 9255) + '\064' + '\x37', 8), ehT0Px3KOsy9(chr(1669 - 1621) + chr(0b1101111) + chr(0b100111 + 0o14) + '\063' + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(12147 - 12036) + chr(0b110101) + '\060', 0o10), ehT0Px3KOsy9(chr(2091 - 2043) + chr(0b1101111) + '\061' + chr(515 - 464) + '\063', 0o10), ehT0Px3KOsy9(chr(1729 - 1681) + chr(111) + '\061' + '\x30' + '\x33', 0o10), ehT0Px3KOsy9(chr(1155 - 1107) + '\x6f' + chr(2059 - 2006) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\x35' + chr(54), 0o10), ehT0Px3KOsy9(chr(1453 - 1405) + chr(0b11000 + 0o127) + chr(0b110010) + '\061' + chr(0b101100 + 0o5), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1834 - 1780) + chr(599 - 549), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(5408 - 5297) + '\x33' + chr(2000 - 1952) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(4863 - 4752) + '\x33' + '\062' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(1618 - 1570) + '\157' + '\x32' + chr(0b101011 + 0o10) + chr(0b0 + 0o60), 0b1000), ehT0Px3KOsy9(chr(2089 - 2041) + '\157' + chr(330 - 281) + chr(54) + chr(1766 - 1718), 32031 - 32023), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(142 - 90) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11 + 0o61) + '\067', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(49) + chr(224 - 169), 0b1000), ehT0Px3KOsy9(chr(140 - 92) + chr(308 - 197) + chr(53) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + '\061' + '\067' + chr(0b1111 + 0o43), 22912 - 22904), ehT0Px3KOsy9(chr(48) + chr(0b110111 + 0o70) + chr(50) + '\065' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + chr(2520 - 2469) + chr(0b10001 + 0o37) + '\063', 57534 - 57526), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(1476 - 1425) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\x31' + chr(553 - 504), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(545 - 492) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), chr(100) + chr(2348 - 2247) + chr(0b1100011) + chr(111) + '\x64' + chr(5377 - 5276))(chr(10274 - 10157) + chr(0b1110100) + '\x66' + chr(881 - 836) + chr(0b111000 + 0o0)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def lcM9yAEWxzEh(xQt6gV9VfTO3, xEjzlji2f7bf, VmNccqBk7Msl, H15mhcYcioqz, eK0vLxsq0cly, ETi1MWPlKt6h=ehT0Px3KOsy9(chr(1699 - 1651) + chr(111) + chr(652 - 602) + chr(680 - 632) + chr(48) + '\x30', 0o10), NPMzomeOCXYH=iCMO3mPxA7PZ):
def RUyVFghp0aLq(kP4qaKv0ZkGv):
if c2A0yzQpDQB3(xEjzlji2f7bf) == ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + '\x31', 0o10):
return (kP4qaKv0ZkGv, kP4qaKv0ZkGv[xEjzlji2f7bf[ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1154 - 1106), ord("\x08"))]])
xIEmRseySp3z = {}
for AIvJRzLdDfgF in xEjzlji2f7bf:
xIEmRseySp3z[AIvJRzLdDfgF] = kP4qaKv0ZkGv[AIvJRzLdDfgF]
return (kP4qaKv0ZkGv, xIEmRseySp3z)
xQt6gV9VfTO3 = xQt6gV9VfTO3.map(RUyVFghp0aLq)
if H15mhcYcioqz:
xQt6gV9VfTO3 = xQt6gV9VfTO3.repeat()
xQt6gV9VfTO3 = xQt6gV9VfTO3.skip(drxw09AdRdci.FXbppO8HYrND(ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(48), 8), BtFwvKDGizgY))
xQt6gV9VfTO3 = NPMzomeOCXYH(xQt6gV9VfTO3, H15mhcYcioqz)
OVHEymXlQYjG = {OolUPRJhRaJd: VmNccqBk7Msl[OolUPRJhRaJd].nauYfLglTpcb for OolUPRJhRaJd in VmNccqBk7Msl}
OVHEymXlQYjG = (OVHEymXlQYjG, OVHEymXlQYjG[xEjzlji2f7bf[ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(48), 8)]])
xQt6gV9VfTO3 = xQt6gV9VfTO3.shuffle(ETi1MWPlKt6h)
xQt6gV9VfTO3 = CjOj_M_CoAjS(xQt6gV9VfTO3, H15mhcYcioqz, OVHEymXlQYjG, xEjzlji2f7bf, eK0vLxsq0cly)
return xafqLlk3kkUe(xQt6gV9VfTO3, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5U<\xf3\t\xbf\x0bD'), chr(2105 - 2005) + '\x65' + chr(99) + '\x6f' + '\x64' + chr(0b1001111 + 0o26))(chr(0b10001 + 0o144) + '\x74' + '\146' + chr(45) + '\070'))(ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1609 - 1559), 0o10))
|
tensorflow/tensor2tensor
|
tensor2tensor/trax/inputs.py
|
_train_and_eval_batches
|
def _train_and_eval_batches(dataset, data_dir, input_name, num_devices):
"""Return train and eval batches with input name and shape."""
(train_data, eval_data, features_info, keys) = train_and_eval_dataset(
dataset, data_dir)
input_names, target_names = keys[0], keys[1]
train_batches = shuffle_and_batch_data(
train_data, target_names, features_info, training=True,
num_devices=num_devices)
train_eval_batches = shuffle_and_batch_data( # Data for eval-on-train.
train_data, target_names, features_info, training=False,
num_devices=num_devices)
eval_batches = shuffle_and_batch_data(
eval_data, target_names, features_info, training=False,
num_devices=num_devices)
input_name = input_name or input_names[0]
input_shape = features_info[input_name].shape
return (train_batches, train_eval_batches, eval_batches,
input_name, list(input_shape))
|
python
|
def _train_and_eval_batches(dataset, data_dir, input_name, num_devices):
"""Return train and eval batches with input name and shape."""
(train_data, eval_data, features_info, keys) = train_and_eval_dataset(
dataset, data_dir)
input_names, target_names = keys[0], keys[1]
train_batches = shuffle_and_batch_data(
train_data, target_names, features_info, training=True,
num_devices=num_devices)
train_eval_batches = shuffle_and_batch_data( # Data for eval-on-train.
train_data, target_names, features_info, training=False,
num_devices=num_devices)
eval_batches = shuffle_and_batch_data(
eval_data, target_names, features_info, training=False,
num_devices=num_devices)
input_name = input_name or input_names[0]
input_shape = features_info[input_name].shape
return (train_batches, train_eval_batches, eval_batches,
input_name, list(input_shape))
|
[
"def",
"_train_and_eval_batches",
"(",
"dataset",
",",
"data_dir",
",",
"input_name",
",",
"num_devices",
")",
":",
"(",
"train_data",
",",
"eval_data",
",",
"features_info",
",",
"keys",
")",
"=",
"train_and_eval_dataset",
"(",
"dataset",
",",
"data_dir",
")",
"input_names",
",",
"target_names",
"=",
"keys",
"[",
"0",
"]",
",",
"keys",
"[",
"1",
"]",
"train_batches",
"=",
"shuffle_and_batch_data",
"(",
"train_data",
",",
"target_names",
",",
"features_info",
",",
"training",
"=",
"True",
",",
"num_devices",
"=",
"num_devices",
")",
"train_eval_batches",
"=",
"shuffle_and_batch_data",
"(",
"# Data for eval-on-train.",
"train_data",
",",
"target_names",
",",
"features_info",
",",
"training",
"=",
"False",
",",
"num_devices",
"=",
"num_devices",
")",
"eval_batches",
"=",
"shuffle_and_batch_data",
"(",
"eval_data",
",",
"target_names",
",",
"features_info",
",",
"training",
"=",
"False",
",",
"num_devices",
"=",
"num_devices",
")",
"input_name",
"=",
"input_name",
"or",
"input_names",
"[",
"0",
"]",
"input_shape",
"=",
"features_info",
"[",
"input_name",
"]",
".",
"shape",
"return",
"(",
"train_batches",
",",
"train_eval_batches",
",",
"eval_batches",
",",
"input_name",
",",
"list",
"(",
"input_shape",
")",
")"
] |
Return train and eval batches with input name and shape.
|
[
"Return",
"train",
"and",
"eval",
"batches",
"with",
"input",
"name",
"and",
"shape",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/inputs.py#L388-L405
|
train
|
Return train and eval batches with input name and shape.
|
Pu7Z6IJCgH3a,vcEHXBQX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Uz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,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(9485 - 9374) + '\x33' + chr(0b110100) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\x36' + chr(0b110111), 30898 - 30890), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + '\062' + '\066' + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + '\062' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + '\061' + chr(1869 - 1819) + chr(1849 - 1801), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + '\061' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110100) + chr(0b1101 + 0o46), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(321 - 267) + chr(0b1111 + 0o50), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(1673 - 1562) + '\x31' + chr(619 - 571) + '\063', 23567 - 23559), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + '\062' + chr(0b110011) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(1750 - 1697) + chr(750 - 696), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\065' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + '\063' + chr(830 - 782) + chr(0b1011 + 0o50), 0b1000), ehT0Px3KOsy9(chr(614 - 566) + chr(111) + '\063' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b110001) + chr(49), 3512 - 3504), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b111000 + 0o67) + chr(0b1 + 0o64) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\060' + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + '\x33', 0b1000), ehT0Px3KOsy9(chr(61 - 13) + chr(344 - 233) + '\061' + chr(0b110100) + '\063', 24342 - 24334), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(10188 - 10077) + '\063' + '\063' + '\063', 28447 - 28439), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(50) + chr(48) + chr(52), 8), ehT0Px3KOsy9('\060' + chr(10502 - 10391) + '\065' + chr(844 - 794), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2637 - 2526) + chr(0b11010 + 0o31) + chr(0b10110 + 0o40) + chr(0b1011 + 0o51), 40395 - 40387), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b11110 + 0o27) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(246 - 196) + chr(690 - 641) + chr(0b10001 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(9766 - 9655) + '\062' + '\061' + '\060', 36419 - 36411), ehT0Px3KOsy9('\060' + chr(2031 - 1920) + chr(2007 - 1957) + chr(2563 - 2508) + '\067', 42510 - 42502), ehT0Px3KOsy9(chr(2294 - 2246) + chr(111) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(0b110101) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110111) + chr(1841 - 1791), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(854 - 804) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x33' + '\x30', 53866 - 53858), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + '\065' + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(10031 - 9920) + '\063' + chr(50) + '\x36', 8), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(50) + '\066' + chr(0b11101 + 0o25), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(341 - 290) + '\063' + chr(0b1 + 0o63), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\064' + chr(0b10 + 0o61), 18986 - 18978), ehT0Px3KOsy9(chr(1733 - 1685) + chr(0b1101111) + '\x32' + '\066' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(2203 - 2155) + chr(0b1101111) + '\063' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9225 - 9114) + chr(0b1111 + 0o44) + chr(0b100011 + 0o15) + chr(110 - 62), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b111101 + 0o62) + chr(53) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xcd'), chr(0b1100100) + '\145' + chr(7214 - 7115) + chr(0b1101111 + 0o0) + chr(8289 - 8189) + chr(0b1100101))(chr(117) + chr(0b1000011 + 0o61) + '\146' + '\055' + chr(0b101100 + 0o14)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def AAEGeRVs7aFT(xQt6gV9VfTO3, kVFRD544hi_1, T1P2HfUVrGuW, eK0vLxsq0cly):
(sW8AagBcZuuj, lFsSHWR5AXWi, VmNccqBk7Msl, w8H8C9ec5BO1) = cA_PIO9aKoOR(xQt6gV9VfTO3, kVFRD544hi_1)
(CMC8pWw9JJzH, xEjzlji2f7bf) = (w8H8C9ec5BO1[ehT0Px3KOsy9('\060' + chr(111) + chr(0b110000), ord("\x08"))], w8H8C9ec5BO1[ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + chr(1360 - 1311), 0b1000)])
K4VUJHAd1wl8 = lcM9yAEWxzEh(sW8AagBcZuuj, xEjzlji2f7bf, VmNccqBk7Msl, training=ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8), num_devices=eK0vLxsq0cly)
WsS9H6uHiqxt = lcM9yAEWxzEh(sW8AagBcZuuj, xEjzlji2f7bf, VmNccqBk7Msl, training=ehT0Px3KOsy9(chr(1423 - 1375) + chr(0b1101111) + chr(2286 - 2238), 8), num_devices=eK0vLxsq0cly)
RPGQtUZ2bC76 = lcM9yAEWxzEh(lFsSHWR5AXWi, xEjzlji2f7bf, VmNccqBk7Msl, training=ehT0Px3KOsy9(chr(48) + chr(1087 - 976) + chr(845 - 797), 8), num_devices=eK0vLxsq0cly)
T1P2HfUVrGuW = T1P2HfUVrGuW or CMC8pWw9JJzH[ehT0Px3KOsy9('\060' + '\x6f' + '\060', 8)]
tANyZeuTfu5y = VmNccqBk7Msl[T1P2HfUVrGuW].nauYfLglTpcb
return (K4VUJHAd1wl8, WsS9H6uHiqxt, RPGQtUZ2bC76, T1P2HfUVrGuW, YyaZ4tpXu4lf(tANyZeuTfu5y))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
get_multi_dataset
|
def get_multi_dataset(datasets, pmf=None):
"""Returns a Dataset that samples records from one or more Datasets.
Args:
datasets: A list of one or more Dataset objects to sample from.
pmf: A tensor of shape [len(datasets)], the probabilities to sample each
dataset with. This tensor is often constructed with the global_step. If
this is None, we sample from the datasets uniformly at random.
Returns:
A Dataset object containing records from multiple datasets. Note that
because this dataset iterates through other datasets it is stateful, thus
you will need to call make_initializable_iterator instead of
make_one_shot_iterator.
"""
pmf = tf.fill([len(datasets)], 1.0 / len(datasets)) if pmf is None else pmf
samplers = [d.repeat().make_one_shot_iterator().get_next for d in datasets]
sample = lambda _: categorical_case(pmf, samplers)
return tf.data.Dataset.from_tensors([]).repeat().map(sample)
|
python
|
def get_multi_dataset(datasets, pmf=None):
"""Returns a Dataset that samples records from one or more Datasets.
Args:
datasets: A list of one or more Dataset objects to sample from.
pmf: A tensor of shape [len(datasets)], the probabilities to sample each
dataset with. This tensor is often constructed with the global_step. If
this is None, we sample from the datasets uniformly at random.
Returns:
A Dataset object containing records from multiple datasets. Note that
because this dataset iterates through other datasets it is stateful, thus
you will need to call make_initializable_iterator instead of
make_one_shot_iterator.
"""
pmf = tf.fill([len(datasets)], 1.0 / len(datasets)) if pmf is None else pmf
samplers = [d.repeat().make_one_shot_iterator().get_next for d in datasets]
sample = lambda _: categorical_case(pmf, samplers)
return tf.data.Dataset.from_tensors([]).repeat().map(sample)
|
[
"def",
"get_multi_dataset",
"(",
"datasets",
",",
"pmf",
"=",
"None",
")",
":",
"pmf",
"=",
"tf",
".",
"fill",
"(",
"[",
"len",
"(",
"datasets",
")",
"]",
",",
"1.0",
"/",
"len",
"(",
"datasets",
")",
")",
"if",
"pmf",
"is",
"None",
"else",
"pmf",
"samplers",
"=",
"[",
"d",
".",
"repeat",
"(",
")",
".",
"make_one_shot_iterator",
"(",
")",
".",
"get_next",
"for",
"d",
"in",
"datasets",
"]",
"sample",
"=",
"lambda",
"_",
":",
"categorical_case",
"(",
"pmf",
",",
"samplers",
")",
"return",
"tf",
".",
"data",
".",
"Dataset",
".",
"from_tensors",
"(",
"[",
"]",
")",
".",
"repeat",
"(",
")",
".",
"map",
"(",
"sample",
")"
] |
Returns a Dataset that samples records from one or more Datasets.
Args:
datasets: A list of one or more Dataset objects to sample from.
pmf: A tensor of shape [len(datasets)], the probabilities to sample each
dataset with. This tensor is often constructed with the global_step. If
this is None, we sample from the datasets uniformly at random.
Returns:
A Dataset object containing records from multiple datasets. Note that
because this dataset iterates through other datasets it is stateful, thus
you will need to call make_initializable_iterator instead of
make_one_shot_iterator.
|
[
"Returns",
"a",
"Dataset",
"that",
"samples",
"records",
"from",
"one",
"or",
"more",
"Datasets",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L205-L223
|
train
|
Returns a Dataset that samples records from one or more Datasets.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr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bortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b100111 + 0o12) + chr(0b10111 + 0o35) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b100001 + 0o25) + chr(0b110011 + 0o3), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110111 + 0o0) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1011 + 0o46) + chr(53) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + chr(0b110011) + chr(0b110100) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + '\x31' + chr(0b10011 + 0o37) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(2292 - 2242) + chr(0b110011 + 0o1) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6569 - 6458) + chr(1383 - 1334) + chr(0b100110 + 0o17) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110111) + chr(144 - 92), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\067' + chr(49), 59885 - 59877), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101110 + 0o5) + '\x31' + chr(0b110011), 48404 - 48396), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(2034 - 1983) + chr(55) + chr(2007 - 1955), 6700 - 6692), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + '\063' + '\x33' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b11010 + 0o125) + chr(857 - 807) + '\x34' + chr(448 - 396), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b101111 + 0o10) + '\x31', 7906 - 7898), ehT0Px3KOsy9(chr(2093 - 2045) + chr(0b100001 + 0o116) + '\066' + chr(0b101110 + 0o5), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101110 + 0o5) + '\x31' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(233 - 185) + chr(0b1110 + 0o141) + '\x31' + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101110 + 0o101) + '\x31' + chr(1049 - 1001) + chr(650 - 598), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10110 + 0o33) + chr(0b11101 + 0o26) + chr(0b1110 + 0o44), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001 + 0o146) + chr(50) + '\064' + chr(2568 - 2516), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(110 - 62) + chr(0b1101111) + '\062' + chr(0b10010 + 0o42) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(0b100101 + 0o15) + chr(49) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11502 - 11391) + '\067' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b1110 + 0o51) + chr(455 - 405), 0b1000), ehT0Px3KOsy9(chr(1463 - 1415) + '\x6f' + chr(54) + '\x33', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110101) + chr(0b110 + 0o55), 9542 - 9534), ehT0Px3KOsy9(chr(1736 - 1688) + '\157' + '\061' + chr(53) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(229 - 174) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(203 - 92) + chr(0b10000 + 0o42) + chr(49) + chr(1313 - 1264), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(0b110001) + chr(2840 - 2786) + '\x37', 39832 - 39824), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + chr(0b110001) + chr(358 - 305) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(0b10010 + 0o41) + chr(0b110011) + chr(0b100000 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(8586 - 8475) + '\x31' + chr(52) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1962 - 1851) + '\065' + chr(1296 - 1244), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011111 + 0o20) + chr(0b110001) + '\x32' + chr(0b110010), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(867 - 818) + chr(0b101011 + 0o6) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3755 - 3644) + '\062' + chr(0b100011 + 0o16) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7067 - 6956) + chr(2173 - 2122) + '\x35' + chr(0b0 + 0o60), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(363 - 315) + chr(111) + chr(129 - 76) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'J'), chr(3999 - 3899) + '\145' + chr(99) + chr(111) + chr(100) + '\x65')(chr(0b110100 + 0o101) + chr(0b1011110 + 0o26) + chr(0b1001001 + 0o35) + chr(0b100 + 0o51) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def dVT0IK878SuM(yFP4suyTsK4d, jZpMg4iAlWss=None):
jZpMg4iAlWss = IDJ2eXGCBCDu.fill([c2A0yzQpDQB3(yFP4suyTsK4d)], 1.0 / c2A0yzQpDQB3(yFP4suyTsK4d)) if jZpMg4iAlWss is None else jZpMg4iAlWss
RL9swxIsgmlz = [pd3lxn9vqWxp.repeat().make_one_shot_iterator().get_next for pd3lxn9vqWxp in yFP4suyTsK4d]
def aBu4gMMQp6Jg(VNGQdHSFPrso):
return dhPgEGf9G8Yi(jZpMg4iAlWss, RL9swxIsgmlz)
return xafqLlk3kkUe(IDJ2eXGCBCDu.data.Dataset.from_tensors([]).repeat(), xafqLlk3kkUe(SXOLrMavuUCe(b'\t\x97\x88'), chr(4113 - 4013) + chr(101) + chr(0b1100011) + '\x6f' + chr(0b101 + 0o137) + chr(898 - 797))(chr(0b100001 + 0o124) + '\x74' + '\x66' + chr(779 - 734) + chr(0b111000)))(aBu4gMMQp6Jg)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
get_schedule_distribution
|
def get_schedule_distribution(schedule, global_step=None):
"""Computes the pmf of a schedule given the global_step.
Args:
schedule: A schedule tuple, see encode_schedule for details.
global_step: A scalar tensor, the step to query the schedule.
Returns:
A 1-D tensor of probs, the sampling distribution of the global_step.
"""
interpolation, steps, pmfs = schedule
if len(pmfs) == 1:
# py_func doesn't seem to work on TPU - at least get the constant case to
# run.
# TODO(noam): get the general case working.
return pmfs[0]
if global_step is None:
global_step = tf.train.get_or_create_global_step()
if interpolation == 'step':
interpolation_fn = step_interpolation
elif interpolation == 'linear':
interpolation_fn = linear_interpolation
else:
raise ValueError('Invalid interpolation strategy: %s' % interpolation)
return tf.reshape(
tf.py_func(
func=lambda x: interpolation_fn(x, np.array(steps), np.array(pmfs)),
inp=[global_step], Tout=tf.float32), [len(pmfs[0])])
|
python
|
def get_schedule_distribution(schedule, global_step=None):
"""Computes the pmf of a schedule given the global_step.
Args:
schedule: A schedule tuple, see encode_schedule for details.
global_step: A scalar tensor, the step to query the schedule.
Returns:
A 1-D tensor of probs, the sampling distribution of the global_step.
"""
interpolation, steps, pmfs = schedule
if len(pmfs) == 1:
# py_func doesn't seem to work on TPU - at least get the constant case to
# run.
# TODO(noam): get the general case working.
return pmfs[0]
if global_step is None:
global_step = tf.train.get_or_create_global_step()
if interpolation == 'step':
interpolation_fn = step_interpolation
elif interpolation == 'linear':
interpolation_fn = linear_interpolation
else:
raise ValueError('Invalid interpolation strategy: %s' % interpolation)
return tf.reshape(
tf.py_func(
func=lambda x: interpolation_fn(x, np.array(steps), np.array(pmfs)),
inp=[global_step], Tout=tf.float32), [len(pmfs[0])])
|
[
"def",
"get_schedule_distribution",
"(",
"schedule",
",",
"global_step",
"=",
"None",
")",
":",
"interpolation",
",",
"steps",
",",
"pmfs",
"=",
"schedule",
"if",
"len",
"(",
"pmfs",
")",
"==",
"1",
":",
"# py_func doesn't seem to work on TPU - at least get the constant case to",
"# run.",
"# TODO(noam): get the general case working.",
"return",
"pmfs",
"[",
"0",
"]",
"if",
"global_step",
"is",
"None",
":",
"global_step",
"=",
"tf",
".",
"train",
".",
"get_or_create_global_step",
"(",
")",
"if",
"interpolation",
"==",
"'step'",
":",
"interpolation_fn",
"=",
"step_interpolation",
"elif",
"interpolation",
"==",
"'linear'",
":",
"interpolation_fn",
"=",
"linear_interpolation",
"else",
":",
"raise",
"ValueError",
"(",
"'Invalid interpolation strategy: %s'",
"%",
"interpolation",
")",
"return",
"tf",
".",
"reshape",
"(",
"tf",
".",
"py_func",
"(",
"func",
"=",
"lambda",
"x",
":",
"interpolation_fn",
"(",
"x",
",",
"np",
".",
"array",
"(",
"steps",
")",
",",
"np",
".",
"array",
"(",
"pmfs",
")",
")",
",",
"inp",
"=",
"[",
"global_step",
"]",
",",
"Tout",
"=",
"tf",
".",
"float32",
")",
",",
"[",
"len",
"(",
"pmfs",
"[",
"0",
"]",
")",
"]",
")"
] |
Computes the pmf of a schedule given the global_step.
Args:
schedule: A schedule tuple, see encode_schedule for details.
global_step: A scalar tensor, the step to query the schedule.
Returns:
A 1-D tensor of probs, the sampling distribution of the global_step.
|
[
"Computes",
"the",
"pmf",
"of",
"a",
"schedule",
"given",
"the",
"global_step",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L226-L253
|
train
|
Computes the pmf of a schedule given the global_step.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr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bortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,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(4539 - 4428) + '\x32' + '\x32' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(2096 - 2048) + chr(0b111 + 0o150) + '\x32' + '\x30' + chr(48), 41351 - 41343), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x35' + '\061', 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(1258 - 1147) + chr(0b110001) + chr(0b110111) + chr(0b10 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(4355 - 4244) + '\x31' + '\061' + '\061', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111 + 0o0) + '\x31' + '\x37' + chr(0b10000 + 0o43), 0b1000), ehT0Px3KOsy9(chr(1253 - 1205) + '\157' + chr(2529 - 2478) + chr(273 - 222) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(568 - 514) + chr(1807 - 1754), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(1771 - 1721) + chr(157 - 109), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b110010) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(1307 - 1256) + '\x35' + '\x37', 1888 - 1880), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100001 + 0o21) + '\x31' + chr(294 - 241), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010111 + 0o30) + chr(0b0 + 0o62) + chr(221 - 167) + '\066', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + '\x31' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(848 - 797) + chr(711 - 662) + chr(0b10001 + 0o46), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(51) + chr(52), 8), ehT0Px3KOsy9(chr(0b110000) + chr(7567 - 7456) + chr(2481 - 2428) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\x32' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1911 - 1863) + '\x6f' + '\x33' + chr(0b101001 + 0o7) + chr(1081 - 1028), 0o10), ehT0Px3KOsy9(chr(1316 - 1268) + chr(0b100010 + 0o115) + '\063' + chr(0b101010 + 0o14) + chr(521 - 472), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1100101 + 0o12) + '\x35' + chr(0b1110 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(0b110010) + chr(0b110111), 19003 - 18995), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(2703 - 2651) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1463 - 1408) + chr(751 - 700), 22689 - 22681), ehT0Px3KOsy9(chr(48) + chr(0b1011110 + 0o21) + '\062' + chr(55) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2008 - 1959) + chr(88 - 36) + chr(1107 - 1058), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101101 + 0o2) + chr(711 - 661) + chr(53) + chr(1917 - 1864), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\060' + '\x30', 8), ehT0Px3KOsy9(chr(1787 - 1739) + chr(0b1000100 + 0o53) + chr(0b110010) + chr(0b110111) + chr(0b110010), 64797 - 64789), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(609 - 556) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + '\061' + chr(0b11 + 0o61) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\x36' + chr(49), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\065' + '\064', 0o10), ehT0Px3KOsy9(chr(2242 - 2194) + '\157' + '\061' + '\065' + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(50) + chr(0b101010 + 0o7), 57572 - 57564), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + '\x32' + chr(54) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + '\x32' + chr(0b110110) + chr(54), 8), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + chr(50) + '\x31' + chr(0b1111 + 0o43), 20226 - 20218)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b11100 + 0o123) + chr(53) + chr(0b110000), 6877 - 6869)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8'), chr(8498 - 8398) + chr(0b1100101) + chr(0b1 + 0o142) + chr(111) + '\x64' + chr(101))(chr(117) + '\164' + chr(102) + chr(45) + chr(1606 - 1550)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def LM9_sSd47yIO(UAGQwjlXRoHO, tnqEWmPx71Oj=None):
(TLLWAvIaY1XC, v0VhEmlMsO_l, IbM7WiX99rYM) = UAGQwjlXRoHO
if c2A0yzQpDQB3(IbM7WiX99rYM) == ehT0Px3KOsy9(chr(2124 - 2076) + chr(0b11001 + 0o126) + chr(173 - 124), 19335 - 19327):
return IbM7WiX99rYM[ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b11011 + 0o25), 8)]
if tnqEWmPx71Oj is None:
tnqEWmPx71Oj = IDJ2eXGCBCDu.train.get_or_create_global_step()
if TLLWAvIaY1XC == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe5\xf4\x0c\x08'), chr(0b1100100) + '\145' + '\x63' + chr(111) + chr(100) + chr(0b1000 + 0o135))('\165' + chr(0b1101010 + 0o12) + chr(0b1100110) + chr(907 - 862) + '\x38'):
mYL_3mgRfSIl = gJUHAMSqESQQ
elif TLLWAvIaY1XC == xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xe9\x07\x1d({'), '\144' + '\145' + '\x63' + '\157' + chr(100) + chr(3521 - 3420))(chr(0b110101 + 0o100) + chr(0b1100011 + 0o21) + '\x66' + '\x2d' + chr(0b1100 + 0o54)):
mYL_3mgRfSIl = JNs_TsX6qSwo
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf\xee\x1f\x19%`\x1f\xfc\xdc\xfe\xe7\x8a\xff\xc6\xe0\xa3\xbd_;\xaa\x9f\x0cd\x91\xc9\xdc\x15\xc8\xe7\xc3P C\x82'), '\x64' + chr(0b1010011 + 0o22) + chr(0b1100011 + 0o0) + '\157' + chr(0b11101 + 0o107) + chr(101))(chr(0b1110101) + chr(0b110101 + 0o77) + chr(0b110100 + 0o62) + chr(1033 - 988) + '\070') % TLLWAvIaY1XC)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4\xe5\x1a\x10(y\x1e'), '\144' + '\x65' + chr(99) + '\x6f' + '\x64' + chr(0b1100101))('\165' + chr(116) + '\146' + '\x2d' + chr(1691 - 1635)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6\xf96\x1e<g\x18'), chr(2474 - 2374) + chr(1724 - 1623) + chr(99) + chr(0b10010 + 0o135) + chr(100) + '\x65')(chr(0b1110101) + '\164' + '\146' + chr(1491 - 1446) + '\070'))(func=lambda OeWW0F1dBPRQ: mYL_3mgRfSIl(OeWW0F1dBPRQ, xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\xb0\x0c(\ra\x0b\xad\xcd\xde\xa6\x81'), chr(0b1100100) + chr(101) + '\143' + '\x6f' + '\x64' + chr(4904 - 4803))(chr(0b101010 + 0o113) + '\x74' + '\x66' + '\x2d' + '\x38'))(v0VhEmlMsO_l), xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\xb0\x0c(\ra\x0b\xad\xcd\xde\xa6\x81'), chr(0b1100100) + chr(0b1010 + 0o133) + chr(99) + '\x6f' + chr(0b1011011 + 0o11) + '\x65')(chr(581 - 464) + chr(0b1101100 + 0o10) + chr(7038 - 6936) + chr(343 - 298) + chr(56)))(IbM7WiX99rYM)), inp=[tnqEWmPx71Oj], Tout=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xec\x06\x19=:I'), chr(100) + chr(0b100101 + 0o100) + chr(0b1100011) + chr(0b10 + 0o155) + chr(0b1100100) + chr(3692 - 3591))(chr(0b111110 + 0o67) + chr(0b100110 + 0o116) + '\x66' + '\055' + chr(1790 - 1734)))), [c2A0yzQpDQB3(IbM7WiX99rYM[ehT0Px3KOsy9('\x30' + chr(3235 - 3124) + chr(1808 - 1760), 8)])])
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
categorical_case
|
def categorical_case(pmf, fns, rand=None):
"""Returns the outputs of fns[i] with probability pmf[i].
Args:
pmf: A 1-D tensor of probabilities, the probability mass function.
fns: A list of callables that return tensors, same length as pmf.
rand: An optional scalar between 0.0 and 1.0, the output of an RNG.
Returns:
A tensor, the output of fns[i] with probability pmf[i].
"""
rand = tf.random_uniform([]) if rand is None else rand
cmf = tf.pad(tf.cumsum(pmf), [(1, 0)])
cmf = [cmf[i] for i in range(len(fns) + 1)]
preds = [(rand >= a) & (rand < b) for a, b in zip(cmf[:-1], cmf[1:])]
return tf.case(list(zip(preds, fns)), exclusive=True)
|
python
|
def categorical_case(pmf, fns, rand=None):
"""Returns the outputs of fns[i] with probability pmf[i].
Args:
pmf: A 1-D tensor of probabilities, the probability mass function.
fns: A list of callables that return tensors, same length as pmf.
rand: An optional scalar between 0.0 and 1.0, the output of an RNG.
Returns:
A tensor, the output of fns[i] with probability pmf[i].
"""
rand = tf.random_uniform([]) if rand is None else rand
cmf = tf.pad(tf.cumsum(pmf), [(1, 0)])
cmf = [cmf[i] for i in range(len(fns) + 1)]
preds = [(rand >= a) & (rand < b) for a, b in zip(cmf[:-1], cmf[1:])]
return tf.case(list(zip(preds, fns)), exclusive=True)
|
[
"def",
"categorical_case",
"(",
"pmf",
",",
"fns",
",",
"rand",
"=",
"None",
")",
":",
"rand",
"=",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
")",
"if",
"rand",
"is",
"None",
"else",
"rand",
"cmf",
"=",
"tf",
".",
"pad",
"(",
"tf",
".",
"cumsum",
"(",
"pmf",
")",
",",
"[",
"(",
"1",
",",
"0",
")",
"]",
")",
"cmf",
"=",
"[",
"cmf",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"fns",
")",
"+",
"1",
")",
"]",
"preds",
"=",
"[",
"(",
"rand",
">=",
"a",
")",
"&",
"(",
"rand",
"<",
"b",
")",
"for",
"a",
",",
"b",
"in",
"zip",
"(",
"cmf",
"[",
":",
"-",
"1",
"]",
",",
"cmf",
"[",
"1",
":",
"]",
")",
"]",
"return",
"tf",
".",
"case",
"(",
"list",
"(",
"zip",
"(",
"preds",
",",
"fns",
")",
")",
",",
"exclusive",
"=",
"True",
")"
] |
Returns the outputs of fns[i] with probability pmf[i].
Args:
pmf: A 1-D tensor of probabilities, the probability mass function.
fns: A list of callables that return tensors, same length as pmf.
rand: An optional scalar between 0.0 and 1.0, the output of an RNG.
Returns:
A tensor, the output of fns[i] with probability pmf[i].
|
[
"Returns",
"the",
"outputs",
"of",
"fns",
"[",
"i",
"]",
"with",
"probability",
"pmf",
"[",
"i",
"]",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L256-L271
|
train
|
Returns the outputs of fns with probability pmf.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qR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,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(4536 - 4425) + '\x31' + chr(0b1 + 0o63) + chr(0b11 + 0o56), 0b1000), ehT0Px3KOsy9(chr(2236 - 2188) + chr(0b100001 + 0o116) + '\061' + chr(2077 - 2025) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(0b110011) + '\066' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101010 + 0o5) + chr(0b110010 + 0o1) + chr(50) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\x36' + chr(50), 40470 - 40462), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + '\x33' + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7581 - 7470) + chr(50) + chr(0b110101) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1658 - 1606) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010), 49046 - 49038), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(54) + chr(0b101011 + 0o5), 0b1000), ehT0Px3KOsy9(chr(98 - 50) + '\157' + '\x31' + chr(53) + chr(0b100011 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\x6f' + chr(0b110001) + chr(889 - 834) + '\066', 29210 - 29202), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + '\x37' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\067' + chr(333 - 285), 36792 - 36784), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(0b110011) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010 + 0o145) + chr(0b110001) + '\062' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b11110 + 0o121) + '\061' + '\060' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\061' + '\061', 38090 - 38082), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10 + 0o60) + chr(50) + chr(51), 23175 - 23167), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(995 - 945) + chr(1679 - 1631) + '\064', 42267 - 42259), ehT0Px3KOsy9('\060' + '\x6f' + '\066' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(714 - 664) + '\062' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101101 + 0o102) + '\x34' + chr(0b110111), 53140 - 53132), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100001 + 0o22) + '\x30' + chr(1849 - 1798), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\x37' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(174 - 126) + chr(0b1101010 + 0o5) + chr(2219 - 2168) + chr(50) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(1525 - 1477) + chr(0b10110 + 0o131) + '\x33' + chr(0b101 + 0o54) + chr(0b10011 + 0o36), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\062' + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1111 + 0o42) + chr(48) + chr(2564 - 2512), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1089 - 1038) + chr(0b110100) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b10 + 0o61) + chr(0b1101 + 0o50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\x33' + chr(0b10000 + 0o41), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10110 + 0o131) + '\061' + chr(51) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1056 - 1008) + chr(6659 - 6548) + chr(51) + '\x34' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(1757 - 1703) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + '\x31' + chr(0b100010 + 0o23) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b110010) + chr(193 - 143), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1474 - 1421) + chr(0b100111 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101100 + 0o103) + '\061' + chr(54) + '\065', 36315 - 36307)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1898 - 1850) + chr(0b1101111) + chr(600 - 547) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'O'), chr(0b1011101 + 0o7) + chr(0b1100101) + chr(0b1100011) + chr(5138 - 5027) + chr(100) + chr(101))(chr(0b1101111 + 0o6) + '\x74' + '\146' + chr(0b11110 + 0o17) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def dhPgEGf9G8Yi(jZpMg4iAlWss, bbsRvi6TFdly, ViP387u3nRBw=None):
ViP387u3nRBw = IDJ2eXGCBCDu.random_uniform([]) if ViP387u3nRBw is None else ViP387u3nRBw
q3vHawD2Q93k = IDJ2eXGCBCDu.pad(IDJ2eXGCBCDu.i0lzZW3r00ue(jZpMg4iAlWss), [(ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1011110 + 0o21) + chr(1358 - 1309), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1772 - 1724), 1440 - 1432))])
q3vHawD2Q93k = [q3vHawD2Q93k[WVxHKyX45z_L] for WVxHKyX45z_L in vQr8gNKaIaWE(c2A0yzQpDQB3(bbsRvi6TFdly) + ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1 + 0o60), 8))]
rFir39ju85_Z = [(ViP387u3nRBw >= XPh1qbAgrPgG) & (ViP387u3nRBw < wmN3dvez4qzC) for (XPh1qbAgrPgG, wmN3dvez4qzC) in pZ0NK2y6HRbn(q3vHawD2Q93k[:-ehT0Px3KOsy9(chr(48) + chr(0b11000 + 0o127) + '\061', 8)], q3vHawD2Q93k[ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001), 8):])]
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\x03\x81\xb2'), chr(100) + '\x65' + chr(99) + chr(0b11010 + 0o125) + chr(2737 - 2637) + chr(9245 - 9144))(chr(0b11011 + 0o132) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(0b10101 + 0o43)))(YyaZ4tpXu4lf(pZ0NK2y6HRbn(rFir39ju85_Z, bbsRvi6TFdly)), exclusive=ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(2212 - 2163), 8))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
linear_interpolation
|
def linear_interpolation(x, xp, fp, **kwargs):
"""Multi-dimensional linear interpolation.
Returns the multi-dimensional piecewise linear interpolant to a function with
given discrete data points (xp, fp), evaluated at x.
Note that *N and *M indicate zero or more dimensions.
Args:
x: An array of shape [*N], the x-coordinates of the interpolated values.
xp: An np.array of shape [D], the x-coordinates of the data points, must be
increasing.
fp: An np.array of shape [D, *M], the y-coordinates of the data points.
**kwargs: Keywords for np.interp.
Returns:
An array of shape [*N, *M], the interpolated values.
"""
yp = fp.reshape([fp.shape[0], -1]).transpose()
y = np.stack([np.interp(x, xp, zp, **kwargs) for zp in yp]).transpose()
return y.reshape(x.shape[:1] + fp.shape[1:]).astype(np.float32)
|
python
|
def linear_interpolation(x, xp, fp, **kwargs):
"""Multi-dimensional linear interpolation.
Returns the multi-dimensional piecewise linear interpolant to a function with
given discrete data points (xp, fp), evaluated at x.
Note that *N and *M indicate zero or more dimensions.
Args:
x: An array of shape [*N], the x-coordinates of the interpolated values.
xp: An np.array of shape [D], the x-coordinates of the data points, must be
increasing.
fp: An np.array of shape [D, *M], the y-coordinates of the data points.
**kwargs: Keywords for np.interp.
Returns:
An array of shape [*N, *M], the interpolated values.
"""
yp = fp.reshape([fp.shape[0], -1]).transpose()
y = np.stack([np.interp(x, xp, zp, **kwargs) for zp in yp]).transpose()
return y.reshape(x.shape[:1] + fp.shape[1:]).astype(np.float32)
|
[
"def",
"linear_interpolation",
"(",
"x",
",",
"xp",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"yp",
"=",
"fp",
".",
"reshape",
"(",
"[",
"fp",
".",
"shape",
"[",
"0",
"]",
",",
"-",
"1",
"]",
")",
".",
"transpose",
"(",
")",
"y",
"=",
"np",
".",
"stack",
"(",
"[",
"np",
".",
"interp",
"(",
"x",
",",
"xp",
",",
"zp",
",",
"*",
"*",
"kwargs",
")",
"for",
"zp",
"in",
"yp",
"]",
")",
".",
"transpose",
"(",
")",
"return",
"y",
".",
"reshape",
"(",
"x",
".",
"shape",
"[",
":",
"1",
"]",
"+",
"fp",
".",
"shape",
"[",
"1",
":",
"]",
")",
".",
"astype",
"(",
"np",
".",
"float32",
")"
] |
Multi-dimensional linear interpolation.
Returns the multi-dimensional piecewise linear interpolant to a function with
given discrete data points (xp, fp), evaluated at x.
Note that *N and *M indicate zero or more dimensions.
Args:
x: An array of shape [*N], the x-coordinates of the interpolated values.
xp: An np.array of shape [D], the x-coordinates of the data points, must be
increasing.
fp: An np.array of shape [D, *M], the y-coordinates of the data points.
**kwargs: Keywords for np.interp.
Returns:
An array of shape [*N, *M], the interpolated values.
|
[
"Multi",
"-",
"dimensional",
"linear",
"interpolation",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L274-L294
|
train
|
Multi - dimensional linear interpolation.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,F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enPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,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(7889 - 7778) + chr(0b110011) + chr(0b1000 + 0o55) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101100 + 0o103) + chr(51) + chr(49) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(491 - 380) + chr(0b110011) + chr(1276 - 1224) + chr(0b11110 + 0o23), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(52) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\x33' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(49) + chr(0b110100) + '\064', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1121 - 1070) + chr(0b1 + 0o65) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(55), 0b1000), ehT0Px3KOsy9(chr(751 - 703) + chr(0b1101111) + chr(0b110001) + '\x30' + chr(1273 - 1218), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(1771 - 1722) + chr(658 - 608), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x30' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110110) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\065' + chr(53), 54241 - 54233), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b1001 + 0o51) + '\065' + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100101 + 0o112) + '\062' + chr(1459 - 1411) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(1520 - 1471) + chr(53) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110111) + chr(1802 - 1752), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + '\x31' + chr(0b110111) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + '\x32' + chr(978 - 929) + chr(0b110011), 49462 - 49454), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(52) + chr(52), 50088 - 50080), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\x34' + chr(0b10001 + 0o46), 0b1000), ehT0Px3KOsy9(chr(1950 - 1902) + '\157' + chr(0b101110 + 0o11), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(55) + chr(55), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100 + 0o55) + chr(0b110100) + chr(81 - 29), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(48) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1245 - 1195) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(11173 - 11062) + chr(53) + chr(54), 55078 - 55070), ehT0Px3KOsy9('\x30' + chr(0b1101101 + 0o2) + chr(0b110001) + chr(0b110101) + chr(0b110010 + 0o4), 9201 - 9193), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1101 + 0o44) + chr(2342 - 2290) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(3888 - 3777) + chr(1059 - 1009) + '\065' + chr(0b110001 + 0o6), 16358 - 16350), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + '\x31' + '\x36' + chr(220 - 166), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b110111) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7242 - 7131) + '\x32' + chr(1887 - 1836) + chr(50), 0o10), ehT0Px3KOsy9(chr(1211 - 1163) + chr(0b1101111) + chr(0b0 + 0o62) + '\x32' + '\067', 6264 - 6256), ehT0Px3KOsy9(chr(2054 - 2006) + chr(0b1101111) + '\x31' + '\x33' + chr(1042 - 987), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(577 - 527), 63574 - 63566), ehT0Px3KOsy9(chr(48) + chr(12079 - 11968) + '\x31' + chr(48) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101100 + 0o7) + chr(0b110110) + chr(454 - 405), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110101) + chr(1021 - 973), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5'), '\x64' + '\x65' + chr(0b1100011) + chr(111) + chr(0b110001 + 0o63) + chr(101))('\x75' + chr(116) + '\x66' + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def JNs_TsX6qSwo(OeWW0F1dBPRQ, tqcEYHxdZQ5q, ey_P6rjw_s2D, **M8EIoTs2GJXE):
DxBNb3_SD8Bm = ey_P6rjw_s2D.reshape([ey_P6rjw_s2D.shape[ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(0b110000), 0b1000)], -ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101100 + 0o5), 0o10)]).transpose()
SqiSOtYOqOJH = WqUC3KWvYVup.stack([WqUC3KWvYVup.interp(OeWW0F1dBPRQ, tqcEYHxdZQ5q, DBFdhNhE32nY, **M8EIoTs2GJXE) for DBFdhNhE32nY in DxBNb3_SD8Bm]).transpose()
return xafqLlk3kkUe(SqiSOtYOqOJH.reshape(OeWW0F1dBPRQ.shape[:ehT0Px3KOsy9(chr(48) + chr(10961 - 10850) + '\061', 8)] + ey_P6rjw_s2D.shape[ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1955 - 1906), 8):]), xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a}\xbf\x98U\xb9'), '\x64' + '\x65' + chr(0b1001101 + 0o26) + '\x6f' + chr(0b1100100) + '\145')(chr(2139 - 2022) + '\x74' + chr(102) + '\x2d' + chr(1017 - 961)))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8db\xa4\x80Q\xefV'), chr(100) + chr(8274 - 8173) + chr(99) + chr(6329 - 6218) + chr(1358 - 1258) + chr(0b111101 + 0o50))(chr(117) + chr(3697 - 3581) + chr(0b1100110) + chr(301 - 256) + '\x38')))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
step_interpolation
|
def step_interpolation(x, xp, fp, **kwargs):
"""Multi-dimensional step interpolation.
Returns the multi-dimensional step interpolant to a function with
given discrete data points (xp, fp), evaluated at x.
Note that *N and *M indicate zero or more dimensions.
Args:
x: An array of shape [*N], the x-coordinates of the interpolated values.
xp: An np.array of shape [D], the x-coordinates of the data points, must be
increasing.
fp: An np.array of shape [D, *M], the y-coordinates of the data points.
**kwargs: Unused.
Returns:
An array of shape [*N, *M], the interpolated values.
"""
del kwargs # Unused.
xp = np.expand_dims(xp, -1)
lower, upper = xp[:-1], xp[1:]
conditions = (x >= lower) & (x < upper)
# Underflow and overflow conditions and values. Values default to fp[0] and
# fp[-1] respectively.
conditions = np.concatenate([[x < xp[0]], conditions, [x >= xp[-1]]])
values = np.concatenate([[fp[0]], fp])
assert np.all(np.sum(conditions, 0) == 1), 'xp must be increasing.'
indices = np.argmax(conditions, 0)
return values[indices].astype(np.float32)
|
python
|
def step_interpolation(x, xp, fp, **kwargs):
"""Multi-dimensional step interpolation.
Returns the multi-dimensional step interpolant to a function with
given discrete data points (xp, fp), evaluated at x.
Note that *N and *M indicate zero or more dimensions.
Args:
x: An array of shape [*N], the x-coordinates of the interpolated values.
xp: An np.array of shape [D], the x-coordinates of the data points, must be
increasing.
fp: An np.array of shape [D, *M], the y-coordinates of the data points.
**kwargs: Unused.
Returns:
An array of shape [*N, *M], the interpolated values.
"""
del kwargs # Unused.
xp = np.expand_dims(xp, -1)
lower, upper = xp[:-1], xp[1:]
conditions = (x >= lower) & (x < upper)
# Underflow and overflow conditions and values. Values default to fp[0] and
# fp[-1] respectively.
conditions = np.concatenate([[x < xp[0]], conditions, [x >= xp[-1]]])
values = np.concatenate([[fp[0]], fp])
assert np.all(np.sum(conditions, 0) == 1), 'xp must be increasing.'
indices = np.argmax(conditions, 0)
return values[indices].astype(np.float32)
|
[
"def",
"step_interpolation",
"(",
"x",
",",
"xp",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"del",
"kwargs",
"# Unused.",
"xp",
"=",
"np",
".",
"expand_dims",
"(",
"xp",
",",
"-",
"1",
")",
"lower",
",",
"upper",
"=",
"xp",
"[",
":",
"-",
"1",
"]",
",",
"xp",
"[",
"1",
":",
"]",
"conditions",
"=",
"(",
"x",
">=",
"lower",
")",
"&",
"(",
"x",
"<",
"upper",
")",
"# Underflow and overflow conditions and values. Values default to fp[0] and",
"# fp[-1] respectively.",
"conditions",
"=",
"np",
".",
"concatenate",
"(",
"[",
"[",
"x",
"<",
"xp",
"[",
"0",
"]",
"]",
",",
"conditions",
",",
"[",
"x",
">=",
"xp",
"[",
"-",
"1",
"]",
"]",
"]",
")",
"values",
"=",
"np",
".",
"concatenate",
"(",
"[",
"[",
"fp",
"[",
"0",
"]",
"]",
",",
"fp",
"]",
")",
"assert",
"np",
".",
"all",
"(",
"np",
".",
"sum",
"(",
"conditions",
",",
"0",
")",
"==",
"1",
")",
",",
"'xp must be increasing.'",
"indices",
"=",
"np",
".",
"argmax",
"(",
"conditions",
",",
"0",
")",
"return",
"values",
"[",
"indices",
"]",
".",
"astype",
"(",
"np",
".",
"float32",
")"
] |
Multi-dimensional step interpolation.
Returns the multi-dimensional step interpolant to a function with
given discrete data points (xp, fp), evaluated at x.
Note that *N and *M indicate zero or more dimensions.
Args:
x: An array of shape [*N], the x-coordinates of the interpolated values.
xp: An np.array of shape [D], the x-coordinates of the data points, must be
increasing.
fp: An np.array of shape [D, *M], the y-coordinates of the data points.
**kwargs: Unused.
Returns:
An array of shape [*N, *M], the interpolated values.
|
[
"Multi",
"-",
"dimensional",
"step",
"interpolation",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L297-L325
|
train
|
Multi - dimensional step interpolation.
|
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,NE1Yam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R_,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(0b101110 + 0o2) + chr(11898 - 11787) + chr(0b110010) + chr(0b110001) + chr(0b110000), 36658 - 36650), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + chr(50) + '\064' + chr(1532 - 1478), 47728 - 47720), ehT0Px3KOsy9(chr(0b110000) + chr(2057 - 1946) + chr(0b11 + 0o64) + '\x37', 41273 - 41265), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(1312 - 1261) + chr(1428 - 1380), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(54) + '\062', 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(0b110010) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b1001 + 0o56), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\063' + chr(0b100010 + 0o16), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\060' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(634 - 583) + chr(0b100011 + 0o23) + chr(0b11001 + 0o30), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100110 + 0o14) + chr(0b100100 + 0o17) + chr(0b101001 + 0o15), 60869 - 60861), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100000 + 0o23) + chr(52) + chr(52), 48034 - 48026), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(0b100011 + 0o16) + '\x31' + chr(1080 - 1029), 0o10), ehT0Px3KOsy9(chr(415 - 367) + chr(0b1100000 + 0o17) + chr(49) + chr(51), 44217 - 44209), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(1236 - 1184) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + '\063' + '\x32' + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(0b11101 + 0o26) + chr(0b110110) + chr(0b100 + 0o55), 8), ehT0Px3KOsy9('\x30' + chr(827 - 716) + chr(131 - 81) + chr(0b100111 + 0o13) + '\064', 0b1000), ehT0Px3KOsy9(chr(819 - 771) + '\157' + chr(678 - 627) + chr(0b110101) + chr(49), 32118 - 32110), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101110 + 0o5) + chr(0b110110) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2658 - 2606) + chr(773 - 722), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101001 + 0o10) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(6175 - 6064) + chr(52) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + '\x30' + chr(0b101010 + 0o13), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1441 - 1390) + '\x32' + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\x31' + chr(0b1000 + 0o53), 8), ehT0Px3KOsy9(chr(2187 - 2139) + '\x6f' + chr(878 - 829) + chr(0b110111) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10011 + 0o40) + '\x31' + chr(826 - 773), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2177 - 2128) + chr(0b1100 + 0o47) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1719 - 1670) + '\x36' + '\066', 52939 - 52931), ehT0Px3KOsy9(chr(418 - 370) + chr(0b1000 + 0o147) + chr(1822 - 1771) + chr(2613 - 2559) + chr(0b1100 + 0o50), 8), ehT0Px3KOsy9(chr(780 - 732) + chr(111) + chr(49) + '\x32' + chr(52), 19697 - 19689), ehT0Px3KOsy9(chr(48) + '\157' + chr(959 - 909) + '\065', 1545 - 1537), ehT0Px3KOsy9(chr(1023 - 975) + '\157' + '\061' + chr(55) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(1690 - 1638) + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(55) + chr(0b11101 + 0o24), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011011 + 0o24) + chr(0b101 + 0o61) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + '\063' + '\x36', 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(51) + chr(0b110110) + '\x31', 8), ehT0Px3KOsy9(chr(1825 - 1777) + chr(0b1101111) + chr(0b110011) + chr(0b101110 + 0o3), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110101 + 0o0) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6'), '\144' + chr(0b1100101) + chr(99) + '\157' + chr(0b110101 + 0o57) + '\145')('\x75' + chr(1768 - 1652) + '\x66' + chr(0b1 + 0o54) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def gJUHAMSqESQQ(OeWW0F1dBPRQ, tqcEYHxdZQ5q, ey_P6rjw_s2D, **M8EIoTs2GJXE):
del M8EIoTs2GJXE
tqcEYHxdZQ5q = WqUC3KWvYVup.expand_dims(tqcEYHxdZQ5q, -ehT0Px3KOsy9(chr(2216 - 2168) + chr(0b1010110 + 0o31) + chr(714 - 665), ord("\x08")))
(t6F5pCAWHAAS, eGnGnmaYVLPZ) = (tqcEYHxdZQ5q[:-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001), 8)], tqcEYHxdZQ5q[ehT0Px3KOsy9(chr(2065 - 2017) + '\157' + '\061', 8):])
XtWBMBpK8Slj = (OeWW0F1dBPRQ >= t6F5pCAWHAAS) & (OeWW0F1dBPRQ < eGnGnmaYVLPZ)
XtWBMBpK8Slj = WqUC3KWvYVup.concatenate([[OeWW0F1dBPRQ < tqcEYHxdZQ5q[ehT0Px3KOsy9('\x30' + chr(1522 - 1411) + '\x30', 12852 - 12844)]], XtWBMBpK8Slj, [OeWW0F1dBPRQ >= tqcEYHxdZQ5q[-ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8)]]])
SPnCNu54H1db = WqUC3KWvYVup.concatenate([[ey_P6rjw_s2D[ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(3588 - 3477) + chr(1293 - 1245), 8)]], ey_P6rjw_s2D])
assert xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc\xca\x0b\xe0\\x6*\xe1\x98\xac\xd7'), '\x64' + chr(0b100010 + 0o103) + chr(4763 - 4664) + '\x6f' + chr(6327 - 6227) + chr(101))(chr(541 - 424) + '\x74' + '\146' + '\055' + chr(56)))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xcdG\x9a_}3a\xfb\xc3\xdf\x8a'), chr(110 - 10) + '\x65' + '\x63' + chr(0b1100 + 0o143) + chr(3219 - 3119) + '\145')(chr(5919 - 5802) + chr(8246 - 8130) + chr(2450 - 2348) + chr(0b1000 + 0o45) + '\070'))(XtWBMBpK8Slj, ehT0Px3KOsy9('\x30' + '\157' + '\060', 8)) == ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + '\061', 8)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xd6\x1f\xb5Gasx\xe1\x94\xbe\x8d%h\x91\xb5\x90\xe7\x80\x9aD"'), chr(0b1 + 0o143) + '\145' + chr(99) + chr(4415 - 4304) + '\x64' + chr(0b111100 + 0o51))(chr(117) + '\x74' + chr(102) + chr(0b100001 + 0o14) + chr(56))
pIcoaXENl5Pw = WqUC3KWvYVup.argmax(XtWBMBpK8Slj, ehT0Px3KOsy9(chr(1423 - 1375) + chr(111) + chr(0b110000), 8))
return xafqLlk3kkUe(SPnCNu54H1db[pIcoaXENl5Pw], xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xd5K\xa1Bw'), '\x64' + chr(0b101 + 0o140) + '\143' + chr(1624 - 1513) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(6317 - 6201) + chr(102) + chr(0b101101) + '\070'))(xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\xcaP\xb9F!5'), '\144' + '\145' + '\x63' + chr(6649 - 6538) + chr(0b1100100) + chr(1917 - 1816))('\165' + '\164' + chr(0b1 + 0o145) + chr(612 - 567) + chr(1810 - 1754))))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
epoch_rates_to_pmf
|
def epoch_rates_to_pmf(problems, epoch_rates=None):
"""Create a probability-mass-function based on relative epoch rates.
if epoch_rates=None, then we use uniform epoch rates [1.0] * len(problems)
i.e. it takes each problem the same time to go through one epoch.
If epoch_rates is given, then these are the relative numbers of epochs
of each problem to go through in a given amount of time.
Each must have problem.num_training_examples implemented.
Args:
problems: a list of Problem instances.
epoch_rates: an optional list of float
Returns:
a list of floating point values.
"""
if epoch_rates is None:
epoch_rates = [1.0] * len(problems)
example_rates = [epoch_rate * p.num_training_examples
for p, epoch_rate in zip(problems, epoch_rates)]
return example_rates_to_pmf(example_rates)
|
python
|
def epoch_rates_to_pmf(problems, epoch_rates=None):
"""Create a probability-mass-function based on relative epoch rates.
if epoch_rates=None, then we use uniform epoch rates [1.0] * len(problems)
i.e. it takes each problem the same time to go through one epoch.
If epoch_rates is given, then these are the relative numbers of epochs
of each problem to go through in a given amount of time.
Each must have problem.num_training_examples implemented.
Args:
problems: a list of Problem instances.
epoch_rates: an optional list of float
Returns:
a list of floating point values.
"""
if epoch_rates is None:
epoch_rates = [1.0] * len(problems)
example_rates = [epoch_rate * p.num_training_examples
for p, epoch_rate in zip(problems, epoch_rates)]
return example_rates_to_pmf(example_rates)
|
[
"def",
"epoch_rates_to_pmf",
"(",
"problems",
",",
"epoch_rates",
"=",
"None",
")",
":",
"if",
"epoch_rates",
"is",
"None",
":",
"epoch_rates",
"=",
"[",
"1.0",
"]",
"*",
"len",
"(",
"problems",
")",
"example_rates",
"=",
"[",
"epoch_rate",
"*",
"p",
".",
"num_training_examples",
"for",
"p",
",",
"epoch_rate",
"in",
"zip",
"(",
"problems",
",",
"epoch_rates",
")",
"]",
"return",
"example_rates_to_pmf",
"(",
"example_rates",
")"
] |
Create a probability-mass-function based on relative epoch rates.
if epoch_rates=None, then we use uniform epoch rates [1.0] * len(problems)
i.e. it takes each problem the same time to go through one epoch.
If epoch_rates is given, then these are the relative numbers of epochs
of each problem to go through in a given amount of time.
Each must have problem.num_training_examples implemented.
Args:
problems: a list of Problem instances.
epoch_rates: an optional list of float
Returns:
a list of floating point values.
|
[
"Create",
"a",
"probability",
"-",
"mass",
"-",
"function",
"based",
"on",
"relative",
"epoch",
"rates",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L353-L375
|
train
|
Create a probability - mass - function based on relative epoch rates.
|
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(48) + chr(0b1101111) + chr(0b110001) + '\x33' + chr(381 - 327), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011000 + 0o27) + chr(50) + chr(0b100011 + 0o15) + chr(388 - 335), 21069 - 21061), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110110), 49340 - 49332), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + chr(0b100110 + 0o15) + chr(2740 - 2685) + chr(0b1 + 0o61), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(0b110101) + chr(0b1011 + 0o54), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(3451 - 3340) + '\x36' + chr(0b111 + 0o57), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + chr(51) + '\066' + chr(0b110010), 4593 - 4585), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + '\061' + chr(48) + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10146 - 10035) + chr(0b110010) + chr(1617 - 1563), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(1576 - 1526) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + chr(1728 - 1677), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(2141 - 2030) + '\x34' + '\065', 0o10), ehT0Px3KOsy9(chr(2143 - 2095) + '\157' + chr(0b110001) + chr(2473 - 2423) + chr(0b1101 + 0o46), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b11001 + 0o36) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10101 + 0o35) + '\060' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\064' + chr(2573 - 2520), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(1291 - 1237), 58129 - 58121), ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(0b110001) + '\x30' + chr(2282 - 2230), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\063' + chr(823 - 773), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x37' + chr(0b110001 + 0o5), 30302 - 30294), ehT0Px3KOsy9('\060' + chr(111) + chr(2436 - 2385) + chr(1471 - 1416) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(517 - 468) + chr(1805 - 1755) + chr(1314 - 1266), 0b1000), ehT0Px3KOsy9(chr(1713 - 1665) + chr(2060 - 1949) + chr(0b110001) + chr(0b101011 + 0o13) + chr(50), 24845 - 24837), ehT0Px3KOsy9(chr(48) + chr(0b111001 + 0o66) + chr(0b110010) + chr(0b110011), 31120 - 31112), ehT0Px3KOsy9(chr(974 - 926) + chr(111) + '\061' + chr(0b101100 + 0o11) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(910 - 861) + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(255 - 203) + chr(383 - 335), 0b1000), ehT0Px3KOsy9(chr(2040 - 1992) + chr(4024 - 3913) + chr(2450 - 2398) + chr(913 - 863), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b110101) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(640 - 592) + chr(0b1101111) + chr(81 - 30) + '\064', 2104 - 2096), ehT0Px3KOsy9('\060' + '\157' + chr(0b100011 + 0o20) + chr(54) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(6733 - 6622) + chr(0b11110 + 0o25) + chr(0b100011 + 0o21) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + chr(3028 - 2917) + chr(1508 - 1458) + '\062' + '\064', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(50) + chr(0b10101 + 0o42), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(2512 - 2461) + chr(0b101001 + 0o16) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(50) + '\x31' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b101111 + 0o4) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\065' + '\x30', 8), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(9347 - 9236) + chr(49) + '\x34' + chr(133 - 82), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110101) + chr(0b100001 + 0o17), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'p'), '\144' + '\x65' + chr(0b110101 + 0o56) + chr(0b1101111 + 0o0) + chr(0b101011 + 0o71) + chr(0b1010110 + 0o17))(chr(117) + '\164' + chr(0b1100110) + chr(156 - 111) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def nShCrORViftS(Jcdr_dQEgT_C, m8Mr78BosjuL=None):
if m8Mr78BosjuL is None:
m8Mr78BosjuL = [1.0] * c2A0yzQpDQB3(Jcdr_dQEgT_C)
l6V5_onstb5E = [UqSSMI0Ly8DF * UyakMW2IMFEj.num_training_examples for (UyakMW2IMFEj, UqSSMI0Ly8DF) in pZ0NK2y6HRbn(Jcdr_dQEgT_C, m8Mr78BosjuL)]
return QbOW17rkIW_V(l6V5_onstb5E)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
encode_schedule
|
def encode_schedule(schedule):
"""Encodes a schedule tuple into a string.
Args:
schedule: A tuple containing (interpolation, steps, pmfs), where
interpolation is a string specifying the interpolation strategy, steps
is an int array_like of shape [N] specifying the global steps, and pmfs is
an array_like of shape [N, M] where pmf[i] is the sampling distribution
at global step steps[i]. N is the number of schedule requirements to
interpolate and M is the size of the probability space.
Returns:
The string encoding of the schedule tuple.
"""
interpolation, steps, pmfs = schedule
return interpolation + ' ' + ' '.join(
'@' + str(s) + ' ' + ' '.join(map(str, p)) for s, p in zip(steps, pmfs))
|
python
|
def encode_schedule(schedule):
"""Encodes a schedule tuple into a string.
Args:
schedule: A tuple containing (interpolation, steps, pmfs), where
interpolation is a string specifying the interpolation strategy, steps
is an int array_like of shape [N] specifying the global steps, and pmfs is
an array_like of shape [N, M] where pmf[i] is the sampling distribution
at global step steps[i]. N is the number of schedule requirements to
interpolate and M is the size of the probability space.
Returns:
The string encoding of the schedule tuple.
"""
interpolation, steps, pmfs = schedule
return interpolation + ' ' + ' '.join(
'@' + str(s) + ' ' + ' '.join(map(str, p)) for s, p in zip(steps, pmfs))
|
[
"def",
"encode_schedule",
"(",
"schedule",
")",
":",
"interpolation",
",",
"steps",
",",
"pmfs",
"=",
"schedule",
"return",
"interpolation",
"+",
"' '",
"+",
"' '",
".",
"join",
"(",
"'@'",
"+",
"str",
"(",
"s",
")",
"+",
"' '",
"+",
"' '",
".",
"join",
"(",
"map",
"(",
"str",
",",
"p",
")",
")",
"for",
"s",
",",
"p",
"in",
"zip",
"(",
"steps",
",",
"pmfs",
")",
")"
] |
Encodes a schedule tuple into a string.
Args:
schedule: A tuple containing (interpolation, steps, pmfs), where
interpolation is a string specifying the interpolation strategy, steps
is an int array_like of shape [N] specifying the global steps, and pmfs is
an array_like of shape [N, M] where pmf[i] is the sampling distribution
at global step steps[i]. N is the number of schedule requirements to
interpolate and M is the size of the probability space.
Returns:
The string encoding of the schedule tuple.
|
[
"Encodes",
"a",
"schedule",
"tuple",
"into",
"a",
"string",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L378-L394
|
train
|
Encodes a schedule tuple into a string.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfk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_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110110) + '\063', 0b1000), ehT0Px3KOsy9(chr(1502 - 1454) + chr(8781 - 8670) + chr(929 - 878) + chr(1782 - 1731) + chr(0b101011 + 0o5), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2450 - 2399) + chr(1449 - 1396) + chr(54), 65237 - 65229), ehT0Px3KOsy9('\x30' + chr(0b1101001 + 0o6) + '\065' + '\067', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1939 - 1887) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(1019 - 971) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(51) + chr(0b101110 + 0o3), 0o10), ehT0Px3KOsy9(chr(48) + chr(6999 - 6888) + chr(0b110010) + chr(0b110101) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(51) + '\x32' + '\x31', 21979 - 21971), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b110001) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1708 - 1660) + chr(0b1101111) + chr(0b100101 + 0o14) + '\060' + '\x35', 40679 - 40671), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\x30' + chr(1737 - 1684), 8), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + '\067' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5029 - 4918) + chr(2914 - 2859) + chr(730 - 679), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1242 - 1191), 12827 - 12819), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + '\063' + '\x35' + '\x36', 8), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\065' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\x32' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110000) + chr(0b110000), 41462 - 41454), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + '\061' + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b10 + 0o61) + chr(1343 - 1294) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(2227 - 2179) + '\157' + chr(50) + chr(1492 - 1438) + chr(1679 - 1630), 42449 - 42441), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(1411 - 1359) + chr(52), 2018 - 2010), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101100 + 0o12) + chr(52), 6674 - 6666), ehT0Px3KOsy9(chr(0b110000) + chr(10475 - 10364) + '\x33' + '\064' + '\064', 8), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(3947 - 3836) + chr(0b110001) + chr(0b110110) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\x31' + chr(51) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101010 + 0o5) + chr(0b110011) + '\067' + chr(0b1 + 0o65), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + chr(0b11011 + 0o30) + '\x31' + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11011 + 0o27) + chr(0b100001 + 0o25) + chr(2642 - 2587), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b110111) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\x30' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110011) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(0b110010) + chr(0b10101 + 0o42), 58733 - 58725), ehT0Px3KOsy9(chr(2095 - 2047) + '\157' + chr(0b110001) + '\x35' + chr(49), 8), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(51) + '\064' + chr(457 - 408), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(51) + chr(48) + '\064', 3129 - 3121), ehT0Px3KOsy9(chr(298 - 250) + chr(0b1010111 + 0o30) + chr(51) + chr(153 - 101) + '\x37', 10160 - 10152), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + '\x33' + '\x33' + '\067', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + '\060', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xdd'), '\144' + chr(101) + '\x63' + chr(0b110001 + 0o76) + '\x64' + '\145')(chr(0b1110100 + 0o1) + chr(116) + chr(0b100010 + 0o104) + chr(1348 - 1303) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xpEux0eF7Qw1(UAGQwjlXRoHO):
(TLLWAvIaY1XC, v0VhEmlMsO_l, IbM7WiX99rYM) = UAGQwjlXRoHO
return TLLWAvIaY1XC + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3'), chr(100) + '\145' + chr(99) + chr(3079 - 2968) + '\144' + chr(101))('\165' + chr(0b1001 + 0o153) + chr(2359 - 2257) + '\x2d' + chr(0b100011 + 0o25)) + xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3'), chr(8403 - 8303) + chr(0b1100101) + '\x63' + chr(111) + '\144' + '\145')('\165' + chr(3426 - 3310) + '\x66' + chr(941 - 896) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x99\xb7\x87A'), chr(0b1010010 + 0o22) + '\x65' + '\x63' + chr(111) + chr(100) + chr(0b1000 + 0o135))(chr(0b1110101) + chr(10183 - 10067) + chr(102) + chr(0b101101) + chr(56)))((xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3'), '\144' + chr(101) + chr(105 - 6) + '\x6f' + '\x64' + chr(0b100110 + 0o77))(chr(0b1110101) + chr(237 - 121) + chr(8518 - 8416) + '\055' + '\x38') + M8_cKLkHVB2V(vGrByMSYMp9h) + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3'), chr(100) + '\145' + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1110100) + '\x66' + '\055' + chr(0b110001 + 0o7)) + xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3'), chr(0b1100100) + chr(0b11011 + 0o112) + chr(0b1100011) + chr(8526 - 8415) + chr(4784 - 4684) + chr(0b1011100 + 0o11))(chr(0b1110101) + chr(490 - 374) + chr(0b1000110 + 0o40) + '\055' + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x99\xb7\x87A'), chr(8349 - 8249) + chr(101) + '\x63' + chr(5165 - 5054) + '\144' + chr(0b11101 + 0o110))(chr(117) + chr(0b1110100) + chr(6329 - 6227) + '\055' + chr(0b111000)))(abA97kOQKaLo(M8_cKLkHVB2V, UyakMW2IMFEj)) for (vGrByMSYMp9h, UyakMW2IMFEj) in pZ0NK2y6HRbn(v0VhEmlMsO_l, IbM7WiX99rYM)))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
decode_schedule
|
def decode_schedule(string):
"""Decodes a string into a schedule tuple.
Args:
string: The string encoding of a schedule tuple.
Returns:
A schedule tuple, see encode_schedule for details.
"""
splits = string.split()
steps = [int(x[1:]) for x in splits[1:] if x[0] == '@']
pmfs = np.reshape(
[float(x) for x in splits[1:] if x[0] != '@'], [len(steps), -1])
return splits[0], tuplize(steps), tuplize(pmfs)
|
python
|
def decode_schedule(string):
"""Decodes a string into a schedule tuple.
Args:
string: The string encoding of a schedule tuple.
Returns:
A schedule tuple, see encode_schedule for details.
"""
splits = string.split()
steps = [int(x[1:]) for x in splits[1:] if x[0] == '@']
pmfs = np.reshape(
[float(x) for x in splits[1:] if x[0] != '@'], [len(steps), -1])
return splits[0], tuplize(steps), tuplize(pmfs)
|
[
"def",
"decode_schedule",
"(",
"string",
")",
":",
"splits",
"=",
"string",
".",
"split",
"(",
")",
"steps",
"=",
"[",
"int",
"(",
"x",
"[",
"1",
":",
"]",
")",
"for",
"x",
"in",
"splits",
"[",
"1",
":",
"]",
"if",
"x",
"[",
"0",
"]",
"==",
"'@'",
"]",
"pmfs",
"=",
"np",
".",
"reshape",
"(",
"[",
"float",
"(",
"x",
")",
"for",
"x",
"in",
"splits",
"[",
"1",
":",
"]",
"if",
"x",
"[",
"0",
"]",
"!=",
"'@'",
"]",
",",
"[",
"len",
"(",
"steps",
")",
",",
"-",
"1",
"]",
")",
"return",
"splits",
"[",
"0",
"]",
",",
"tuplize",
"(",
"steps",
")",
",",
"tuplize",
"(",
"pmfs",
")"
] |
Decodes a string into a schedule tuple.
Args:
string: The string encoding of a schedule tuple.
Returns:
A schedule tuple, see encode_schedule for details.
|
[
"Decodes",
"a",
"string",
"into",
"a",
"schedule",
"tuple",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L397-L410
|
train
|
Decodes a string into a schedule tuple.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,F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XYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(7043 - 6932) + chr(2110 - 2059) + chr(51) + chr(258 - 208), ord("\x08")), ehT0Px3KOsy9(chr(61 - 13) + chr(0b1101111) + chr(50) + '\060' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011011 + 0o24) + chr(0b110101) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10111 + 0o33) + '\064' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100 + 0o55) + chr(55) + chr(53), 54065 - 54057), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(0b10001 + 0o41) + chr(217 - 165), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(2289 - 2235), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10101 + 0o132) + chr(54) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7416 - 7305) + '\061' + chr(249 - 195), 10266 - 10258), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + '\x33' + '\x36', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\061' + '\066', 0b1000), ehT0Px3KOsy9(chr(394 - 346) + chr(0b1000001 + 0o56) + '\x36' + chr(838 - 789), 8), ehT0Px3KOsy9(chr(1342 - 1294) + '\x6f' + chr(2815 - 2761) + chr(862 - 808), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(623 - 572) + chr(52) + chr(2522 - 2470), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110101) + chr(0b11001 + 0o31), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(5339 - 5228) + chr(2099 - 2050) + '\064' + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(1564 - 1516) + chr(111) + '\x32' + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(54), 0b1000), ehT0Px3KOsy9(chr(395 - 347) + chr(0b1001111 + 0o40) + chr(2270 - 2219) + chr(1372 - 1324) + chr(0b110000), 42942 - 42934), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(53) + chr(1666 - 1612), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(49) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(2222 - 2173) + chr(0b101 + 0o61), 8), ehT0Px3KOsy9(chr(69 - 21) + chr(0b1101111) + '\x37' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(919 - 871) + chr(0b1001010 + 0o45) + chr(303 - 252) + chr(1262 - 1209) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4234 - 4123) + '\066' + chr(364 - 315), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(55) + chr(0b110010), 10738 - 10730), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b100110 + 0o21) + chr(52), 59196 - 59188), ehT0Px3KOsy9('\x30' + '\x6f' + '\066' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(11944 - 11833) + chr(0b110001) + chr(1281 - 1231), 9052 - 9044), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(0b110011) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(55) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + chr(54) + chr(0b100010 + 0o25), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1282 - 1232) + '\065' + chr(0b11010 + 0o32), 51654 - 51646), ehT0Px3KOsy9('\060' + '\x6f' + chr(1605 - 1556) + chr(53), 32538 - 32530), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1001 + 0o50) + chr(0b101 + 0o53) + chr(0b1101 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100111 + 0o13) + chr(320 - 270) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b100001 + 0o17) + chr(0b100011 + 0o16), 30343 - 30335), ehT0Px3KOsy9(chr(574 - 526) + '\157' + chr(51) + chr(0b110001) + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + chr(917 - 866) + chr(53) + '\x35', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2038 - 1990) + '\157' + chr(53) + chr(0b101011 + 0o5), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(1673 - 1562) + '\144' + chr(101))('\165' + chr(0b1110100) + chr(0b110101 + 0o61) + '\055' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def p6uvNOxiaehr(YfpuhF1UI1FC):
uSBCRSw0LUmo = YfpuhF1UI1FC.split()
v0VhEmlMsO_l = [ehT0Px3KOsy9(OeWW0F1dBPRQ[ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + chr(0b110001), 41642 - 41634):]) for OeWW0F1dBPRQ in uSBCRSw0LUmo[ehT0Px3KOsy9('\x30' + chr(0b1001110 + 0o41) + chr(0b110001), 8):] if OeWW0F1dBPRQ[ehT0Px3KOsy9('\x30' + chr(606 - 495) + '\x30', 60075 - 60067)] == xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a'), '\144' + '\x65' + chr(99) + '\x6f' + '\x64' + chr(0b1100101))(chr(5324 - 5207) + '\164' + chr(0b1100110) + '\055' + chr(0b111000))]
IbM7WiX99rYM = WqUC3KWvYVup.reshape([kkSX4ccExqw4(OeWW0F1dBPRQ) for OeWW0F1dBPRQ in uSBCRSw0LUmo[ehT0Px3KOsy9('\060' + '\157' + chr(0b101101 + 0o4), 8):] if OeWW0F1dBPRQ[ehT0Px3KOsy9(chr(1731 - 1683) + chr(0b1101111) + '\x30', 8)] != xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a'), chr(3860 - 3760) + chr(0b1001100 + 0o31) + chr(0b1100011) + chr(0b1101111) + chr(9981 - 9881) + chr(0b11111 + 0o106))('\x75' + chr(3423 - 3307) + chr(0b1100110) + chr(45) + '\070')], [c2A0yzQpDQB3(v0VhEmlMsO_l), -ehT0Px3KOsy9('\060' + chr(1581 - 1470) + chr(0b110001), 8)])
return (uSBCRSw0LUmo[ehT0Px3KOsy9(chr(1471 - 1423) + '\157' + chr(1100 - 1052), 8)], cdQ8dxeSS9yL(v0VhEmlMsO_l), cdQ8dxeSS9yL(IbM7WiX99rYM))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
tuplize
|
def tuplize(nested):
"""Recursively converts iterables into tuples.
Args:
nested: A nested structure of items and iterables.
Returns:
A nested structure of items and tuples.
"""
if isinstance(nested, str):
return nested
try:
return tuple(map(tuplize, nested))
except TypeError:
return nested
|
python
|
def tuplize(nested):
"""Recursively converts iterables into tuples.
Args:
nested: A nested structure of items and iterables.
Returns:
A nested structure of items and tuples.
"""
if isinstance(nested, str):
return nested
try:
return tuple(map(tuplize, nested))
except TypeError:
return nested
|
[
"def",
"tuplize",
"(",
"nested",
")",
":",
"if",
"isinstance",
"(",
"nested",
",",
"str",
")",
":",
"return",
"nested",
"try",
":",
"return",
"tuple",
"(",
"map",
"(",
"tuplize",
",",
"nested",
")",
")",
"except",
"TypeError",
":",
"return",
"nested"
] |
Recursively converts iterables into tuples.
Args:
nested: A nested structure of items and iterables.
Returns:
A nested structure of items and tuples.
|
[
"Recursively",
"converts",
"iterables",
"into",
"tuples",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L413-L427
|
train
|
Recursively converts iterables into tuples.
|
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,jIl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iBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1111 + 0o46) + '\062', 45407 - 45399), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(0b110100) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1100101 + 0o12) + chr(987 - 939), 0b1000), ehT0Px3KOsy9(chr(2110 - 2062) + chr(0b1101111) + chr(592 - 542) + '\060' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101010 + 0o105) + '\x31' + chr(1478 - 1424) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11001 + 0o32) + chr(2313 - 2262) + chr(1337 - 1286), 0o10), ehT0Px3KOsy9(chr(447 - 399) + chr(0b1101111) + '\063' + chr(48) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b101110 + 0o3) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11011 + 0o30) + '\067', 50840 - 50832), ehT0Px3KOsy9(chr(0b110000) + chr(965 - 854) + chr(51) + chr(2026 - 1976) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x35' + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\064', 0o10), ehT0Px3KOsy9(chr(1737 - 1689) + '\x6f' + chr(0b110001) + chr(54) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1111 + 0o42) + '\x36' + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + chr(0b110101) + chr(52), 30618 - 30610), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10100 + 0o36) + '\x33' + chr(54), 11651 - 11643), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b1111 + 0o50) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(8356 - 8245) + chr(1048 - 996) + '\x34', 29471 - 29463), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\064' + chr(1041 - 993), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(1579 - 1529), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010100 + 0o33) + chr(0b10010 + 0o37) + '\x31' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(429 - 381) + chr(10860 - 10749) + '\065' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(2259 - 2211) + '\157' + chr(0b110001) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\065' + chr(0b10000 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(1756 - 1706) + chr(50) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1010 + 0o50) + '\060' + chr(0b0 + 0o60), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(1982 - 1933) + chr(1686 - 1636), 0b1000), ehT0Px3KOsy9(chr(1416 - 1368) + '\157' + '\061' + '\x33' + chr(48), 0b1000), ehT0Px3KOsy9(chr(1287 - 1239) + '\157' + chr(0b110011) + chr(0b110010 + 0o3) + chr(0b110010), 65302 - 65294), ehT0Px3KOsy9(chr(48) + chr(0b110110 + 0o71) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\x33' + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(505 - 454) + chr(0b101000 + 0o17) + chr(0b101 + 0o57), 43223 - 43215), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110001) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + '\x33' + '\065' + '\064', 8), ehT0Px3KOsy9(chr(1239 - 1191) + chr(8101 - 7990) + chr(50) + '\x30' + '\x31', 60122 - 60114), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(12124 - 12013) + chr(50) + chr(0b110111) + chr(712 - 661), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b11000 + 0o32) + '\064' + '\x33', 21701 - 21693), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(49) + chr(51) + '\062', 52280 - 52272), ehT0Px3KOsy9(chr(1824 - 1776) + '\157' + chr(2233 - 2183) + chr(0b110100) + chr(48), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(53) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x04'), chr(0b1100100) + chr(0b1100101) + chr(5340 - 5241) + chr(111) + chr(0b1000100 + 0o40) + chr(1769 - 1668))(chr(12764 - 12647) + chr(5744 - 5628) + chr(0b101000 + 0o76) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cdQ8dxeSS9yL(n816tMK5ypdL):
if PlSM16l2KDPD(n816tMK5ypdL, M8_cKLkHVB2V):
return n816tMK5ypdL
try:
return KNyTy8rYcwji(abA97kOQKaLo(cdQ8dxeSS9yL, n816tMK5ypdL))
except sznFqDbNBHlx:
return n816tMK5ypdL
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
MultiProblemV2.filepattern
|
def filepattern(self, *args, **kwargs):
"""Returns a list of filepatterns, one for each problem."""
return [p.filepattern(*args, **kwargs) for p in self.problems]
|
python
|
def filepattern(self, *args, **kwargs):
"""Returns a list of filepatterns, one for each problem."""
return [p.filepattern(*args, **kwargs) for p in self.problems]
|
[
"def",
"filepattern",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"p",
".",
"filepattern",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"for",
"p",
"in",
"self",
".",
"problems",
"]"
] |
Returns a list of filepatterns, one for each problem.
|
[
"Returns",
"a",
"list",
"of",
"filepatterns",
"one",
"for",
"each",
"problem",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L82-L84
|
train
|
Returns a list of filepatterns one for each problem.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7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AZlkZOtyh,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(0b111110 + 0o61) + chr(0b110001) + '\064' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(0b100011 + 0o20) + '\x30' + chr(0b11111 + 0o27), 0b1000), ehT0Px3KOsy9(chr(1403 - 1355) + chr(0b1101111) + chr(0b110110) + chr(52), 42827 - 42819), ehT0Px3KOsy9(chr(2260 - 2212) + '\x6f' + chr(409 - 360) + '\064' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101 + 0o142) + '\x32' + chr(53) + chr(826 - 778), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\062' + '\067' + chr(0b11100 + 0o24), 59610 - 59602), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\x36' + '\x37', 0b1000), ehT0Px3KOsy9(chr(696 - 648) + chr(370 - 259) + chr(0b10001 + 0o46) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + '\062' + chr(0b0 + 0o61) + '\x35', 36075 - 36067), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b110111) + chr(0b1011 + 0o45), 57013 - 57005), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\x36' + '\x31', 60288 - 60280), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b10110 + 0o131) + '\x33' + chr(768 - 718) + chr(1778 - 1725), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(2108 - 2054) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(55) + '\060', 8), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(1427 - 1372) + chr(55), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(53) + chr(845 - 792), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b100000 + 0o21) + '\067', 41668 - 41660), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100011 + 0o20) + chr(0b110110) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5176 - 5065) + '\062' + '\x36' + chr(1180 - 1131), ord("\x08")), ehT0Px3KOsy9(chr(1682 - 1634) + '\157' + chr(54) + chr(2250 - 2196), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1492 - 1441) + chr(0b110011) + chr(52), 53792 - 53784), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x33' + chr(0b110011), 5340 - 5332), ehT0Px3KOsy9('\060' + chr(6476 - 6365) + chr(0b110011) + chr(48) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(51) + chr(0b110111) + chr(911 - 861), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10000 + 0o42) + chr(0b100000 + 0o20) + '\066', 0o10), ehT0Px3KOsy9(chr(2202 - 2154) + chr(0b1100000 + 0o17) + chr(0b110100) + chr(2685 - 2632), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10010 + 0o37) + '\x36' + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1658 - 1547) + chr(0b10001 + 0o42) + chr(1017 - 969) + chr(928 - 875), 0b1000), ehT0Px3KOsy9(chr(1582 - 1534) + chr(111) + chr(0b11000 + 0o31) + '\x34' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(313 - 265) + '\157' + chr(1128 - 1074) + chr(0b1011 + 0o46), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + '\x32' + chr(0b11010 + 0o34) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1104 - 1053) + chr(868 - 820) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(5441 - 5330) + chr(0b101101 + 0o6) + '\060' + '\x32', 8), ehT0Px3KOsy9('\060' + chr(12058 - 11947) + chr(676 - 626) + '\066' + chr(0b110010), 8), ehT0Px3KOsy9(chr(1934 - 1886) + chr(0b1101111) + '\061' + chr(0b110100) + chr(849 - 795), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b101010 + 0o10) + chr(0b110101), 58381 - 58373), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x37' + chr(0b110111), 33411 - 33403), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(49) + '\067', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1 + 0o156) + '\065' + chr(0b110000), 17696 - 17688)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'M'), chr(0b1100 + 0o130) + '\x65' + chr(99) + '\x6f' + chr(7403 - 7303) + chr(0b1100101))('\x75' + chr(0b1101011 + 0o11) + chr(0b1100110) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def mnAeTPQPQgT_(oVre8I6UXc3b, *kJDRfRhcZHjS, **M8EIoTs2GJXE):
return [xafqLlk3kkUe(UyakMW2IMFEj, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xafX\x01\xd8\xd9\xc3M\xe8\x8a\x9f'), '\144' + '\x65' + chr(99) + chr(6843 - 6732) + chr(100) + chr(101))(chr(117) + chr(116) + chr(0b1100110) + chr(0b10001 + 0o34) + '\x38'))(*kJDRfRhcZHjS, **M8EIoTs2GJXE) for UyakMW2IMFEj in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x13\xb4[\x06\xc4\xdd\xdaJ'), chr(0b101 + 0o137) + chr(0b1001100 + 0o31) + '\x63' + chr(10563 - 10452) + chr(0b1100100) + '\x65')(chr(0b1010000 + 0o45) + chr(0b100110 + 0o116) + chr(102) + chr(1132 - 1087) + chr(0b0 + 0o70)))]
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
MultiProblemV2.generate_data
|
def generate_data(self, *args, **kwargs):
"""Generates data for each problem."""
for p in self.problems:
p.generate_data(*args, **kwargs)
|
python
|
def generate_data(self, *args, **kwargs):
"""Generates data for each problem."""
for p in self.problems:
p.generate_data(*args, **kwargs)
|
[
"def",
"generate_data",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"p",
"in",
"self",
".",
"problems",
":",
"p",
".",
"generate_data",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] |
Generates data for each problem.
|
[
"Generates",
"data",
"for",
"each",
"problem",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L86-L89
|
train
|
Generates data for each problem.
|
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,Iiw8L0MH5q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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(0b110011) + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(0b110001) + chr(55) + chr(0b11011 + 0o30), 36567 - 36559), ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(0b110011) + chr(54) + chr(52), 53832 - 53824), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b1 + 0o60) + chr(0b110 + 0o55), 8729 - 8721), ehT0Px3KOsy9(chr(789 - 741) + '\157' + '\x35' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b110010) + chr(2422 - 2370), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x36' + chr(881 - 829), 21217 - 21209), ehT0Px3KOsy9(chr(48) + chr(0b1001 + 0o146) + '\x35' + chr(1272 - 1223), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\x31', 61417 - 61409), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(48) + '\x36', 0b1000), ehT0Px3KOsy9(chr(802 - 754) + chr(3124 - 3013) + chr(50) + '\063' + chr(49), 6938 - 6930), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b110011) + '\x30' + '\x36', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(479 - 430) + chr(606 - 552) + chr(2390 - 2340), 15117 - 15109), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b10 + 0o56) + chr(883 - 830), 13631 - 13623), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(54) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(2096 - 2042) + chr(2812 - 2757), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + '\063' + chr(0b11011 + 0o32) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11111 + 0o120) + '\061' + chr(1021 - 972) + chr(332 - 277), 0b1000), ehT0Px3KOsy9('\x30' + chr(500 - 389) + chr(0b110000 + 0o2) + chr(158 - 108) + chr(0b10001 + 0o46), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1992 - 1942) + chr(1716 - 1666) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2078 - 1967) + '\062' + chr(1050 - 1001) + chr(1182 - 1128), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10079 - 9968) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1151 - 1103) + chr(0b1101111) + chr(2863 - 2809) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + '\x33' + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x37' + chr(908 - 856), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(48) + '\065', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10011 + 0o36) + chr(1888 - 1838) + chr(552 - 500), 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(11163 - 11052) + '\063' + '\x33' + '\066', 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(0b100111 + 0o12) + chr(0b110110) + chr(0b101010 + 0o7), 26263 - 26255), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b11110 + 0o121) + chr(0b110111) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1100111 + 0o10) + '\x31' + '\x31' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111000 + 0o67) + '\x32' + chr(48) + '\062', 60225 - 60217), ehT0Px3KOsy9(chr(154 - 106) + chr(0b1101111) + '\063' + '\x37' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(2225 - 2177) + chr(0b1101111) + '\064' + '\x36', 56210 - 56202), ehT0Px3KOsy9(chr(0b110000) + chr(4620 - 4509) + '\061' + '\066' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1416 - 1365) + chr(0b101111 + 0o1) + chr(54), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b110110) + '\064', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(1478 - 1367) + chr(317 - 266) + chr(52) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(660 - 612) + chr(6914 - 6803) + chr(0b110010) + chr(0b110100) + chr(0b100111 + 0o13), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(1384 - 1273) + '\065' + chr(0b101101 + 0o3), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa'), '\144' + '\x65' + chr(8120 - 8021) + chr(111) + chr(0b1100100) + '\x65')(chr(1520 - 1403) + chr(2918 - 2802) + '\x66' + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def jHQgtlDNFkuG(oVre8I6UXc3b, *kJDRfRhcZHjS, **M8EIoTs2GJXE):
for UyakMW2IMFEj in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4\t\x9b)G1YZ'), '\x64' + chr(0b111000 + 0o55) + chr(0b1000 + 0o133) + chr(0b1101111) + '\144' + chr(101))(chr(117) + chr(7370 - 7254) + chr(0b1001000 + 0o36) + chr(1170 - 1125) + chr(2011 - 1955))):
xafqLlk3kkUe(UyakMW2IMFEj, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3\x1e\x9a.Y5@LN\xa2\xf8\xb2\x13'), chr(100) + '\145' + '\143' + chr(111) + chr(100) + chr(0b11010 + 0o113))('\x75' + chr(116) + '\x66' + '\x2d' + chr(790 - 734)))(*kJDRfRhcZHjS, **M8EIoTs2GJXE)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
MultiProblemV2.dataset
|
def dataset(self, mode, hparams=None, global_step=None, **kwargs):
"""Returns a dataset containing examples from multiple problems.
Args:
mode: A member of problem.DatasetSplit.
hparams: A tf.HParams object, the model hparams.
global_step: A scalar tensor used to compute the sampling distribution.
If global_step is None, we call tf.train.get_or_create_global_step by
default.
**kwargs: Keywords for problem.Problem.Dataset.
Returns:
A dataset containing examples from multiple problems.
"""
datasets = [p.dataset(mode, **kwargs) for p in self.problems]
datasets = [
d.map(lambda x, i=j: self.normalize_example( # pylint: disable=g-long-lambda
dict(x, problem_id=tf.constant([i])), hparams))
for j, d in enumerate(datasets) # Tag examples with a problem_id.
]
if mode is problem.DatasetSplit.TRAIN:
if global_step is None:
global_step = tf.train.get_or_create_global_step()
pmf = get_schedule_distribution(self.schedule, global_step)
return get_multi_dataset(datasets, pmf)
elif self.only_eval_first_problem:
return datasets[0]
else:
datasets = [d.repeat() for d in datasets]
return tf.data.Dataset.zip(tuple(datasets)).flat_map(
lambda *x: functools.reduce( # pylint: disable=g-long-lambda
tf.data.Dataset.concatenate,
map(tf.data.Dataset.from_tensors, x)))
|
python
|
def dataset(self, mode, hparams=None, global_step=None, **kwargs):
"""Returns a dataset containing examples from multiple problems.
Args:
mode: A member of problem.DatasetSplit.
hparams: A tf.HParams object, the model hparams.
global_step: A scalar tensor used to compute the sampling distribution.
If global_step is None, we call tf.train.get_or_create_global_step by
default.
**kwargs: Keywords for problem.Problem.Dataset.
Returns:
A dataset containing examples from multiple problems.
"""
datasets = [p.dataset(mode, **kwargs) for p in self.problems]
datasets = [
d.map(lambda x, i=j: self.normalize_example( # pylint: disable=g-long-lambda
dict(x, problem_id=tf.constant([i])), hparams))
for j, d in enumerate(datasets) # Tag examples with a problem_id.
]
if mode is problem.DatasetSplit.TRAIN:
if global_step is None:
global_step = tf.train.get_or_create_global_step()
pmf = get_schedule_distribution(self.schedule, global_step)
return get_multi_dataset(datasets, pmf)
elif self.only_eval_first_problem:
return datasets[0]
else:
datasets = [d.repeat() for d in datasets]
return tf.data.Dataset.zip(tuple(datasets)).flat_map(
lambda *x: functools.reduce( # pylint: disable=g-long-lambda
tf.data.Dataset.concatenate,
map(tf.data.Dataset.from_tensors, x)))
|
[
"def",
"dataset",
"(",
"self",
",",
"mode",
",",
"hparams",
"=",
"None",
",",
"global_step",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"datasets",
"=",
"[",
"p",
".",
"dataset",
"(",
"mode",
",",
"*",
"*",
"kwargs",
")",
"for",
"p",
"in",
"self",
".",
"problems",
"]",
"datasets",
"=",
"[",
"d",
".",
"map",
"(",
"lambda",
"x",
",",
"i",
"=",
"j",
":",
"self",
".",
"normalize_example",
"(",
"# pylint: disable=g-long-lambda",
"dict",
"(",
"x",
",",
"problem_id",
"=",
"tf",
".",
"constant",
"(",
"[",
"i",
"]",
")",
")",
",",
"hparams",
")",
")",
"for",
"j",
",",
"d",
"in",
"enumerate",
"(",
"datasets",
")",
"# Tag examples with a problem_id.",
"]",
"if",
"mode",
"is",
"problem",
".",
"DatasetSplit",
".",
"TRAIN",
":",
"if",
"global_step",
"is",
"None",
":",
"global_step",
"=",
"tf",
".",
"train",
".",
"get_or_create_global_step",
"(",
")",
"pmf",
"=",
"get_schedule_distribution",
"(",
"self",
".",
"schedule",
",",
"global_step",
")",
"return",
"get_multi_dataset",
"(",
"datasets",
",",
"pmf",
")",
"elif",
"self",
".",
"only_eval_first_problem",
":",
"return",
"datasets",
"[",
"0",
"]",
"else",
":",
"datasets",
"=",
"[",
"d",
".",
"repeat",
"(",
")",
"for",
"d",
"in",
"datasets",
"]",
"return",
"tf",
".",
"data",
".",
"Dataset",
".",
"zip",
"(",
"tuple",
"(",
"datasets",
")",
")",
".",
"flat_map",
"(",
"lambda",
"*",
"x",
":",
"functools",
".",
"reduce",
"(",
"# pylint: disable=g-long-lambda",
"tf",
".",
"data",
".",
"Dataset",
".",
"concatenate",
",",
"map",
"(",
"tf",
".",
"data",
".",
"Dataset",
".",
"from_tensors",
",",
"x",
")",
")",
")"
] |
Returns a dataset containing examples from multiple problems.
Args:
mode: A member of problem.DatasetSplit.
hparams: A tf.HParams object, the model hparams.
global_step: A scalar tensor used to compute the sampling distribution.
If global_step is None, we call tf.train.get_or_create_global_step by
default.
**kwargs: Keywords for problem.Problem.Dataset.
Returns:
A dataset containing examples from multiple problems.
|
[
"Returns",
"a",
"dataset",
"containing",
"examples",
"from",
"multiple",
"problems",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L101-L133
|
train
|
Returns a dataset containing examples from multiple problems.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,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,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(5369 - 5258) + '\x32' + chr(50) + chr(2263 - 2214), 19654 - 19646), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100000 + 0o21) + '\x32' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\067' + '\060', 33075 - 33067), ehT0Px3KOsy9(chr(1869 - 1821) + chr(0b1100011 + 0o14) + chr(1491 - 1441) + chr(0b101000 + 0o17) + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1139 - 1089) + chr(0b110010) + chr(343 - 289), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(307 - 256) + '\064' + chr(1303 - 1252), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11001 + 0o30), 57193 - 57185), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(8551 - 8440) + chr(0b11010 + 0o31) + chr(53) + chr(54), 20497 - 20489), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101101 + 0o2) + chr(49) + '\066' + '\x35', 41214 - 41206), ehT0Px3KOsy9(chr(48) + chr(0b1000 + 0o147) + chr(0b1101 + 0o44) + '\062' + chr(2693 - 2641), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\061' + chr(0b100000 + 0o20), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011 + 0o0) + chr(0b110 + 0o60), 14467 - 14459), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + chr(0b110010) + '\x36' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5959 - 5848) + '\x33' + chr(0b110110) + chr(2127 - 2076), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(1432 - 1382) + '\067' + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\x36' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(52) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(52) + '\067', 0o10), ehT0Px3KOsy9(chr(732 - 684) + '\x6f' + chr(0b110010) + chr(53) + chr(80 - 28), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + '\066' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(4042 - 3931) + chr(1008 - 954) + '\x30', 0o10), ehT0Px3KOsy9(chr(927 - 879) + chr(111) + chr(1772 - 1723) + chr(54) + chr(1110 - 1060), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10111 + 0o130) + chr(0b101010 + 0o7) + chr(0b100 + 0o55) + chr(48), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10000 + 0o45) + chr(0b1 + 0o60), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10891 - 10780) + '\x31' + chr(0b111 + 0o53) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4305 - 4194) + chr(0b110011) + chr(0b110001 + 0o2) + chr(0b100000 + 0o27), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1 + 0o65) + '\060', 8), ehT0Px3KOsy9('\x30' + chr(2532 - 2421) + chr(51) + '\067' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9311 - 9200) + '\063' + chr(50) + chr(0b101101 + 0o7), 3240 - 3232), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + chr(51) + '\x30' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\061' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1543 - 1495) + chr(111) + '\066' + '\x30', 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b1101 + 0o50) + chr(2609 - 2555), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\066' + chr(0b10000 + 0o41), 52065 - 52057), ehT0Px3KOsy9(chr(0b110000) + chr(11004 - 10893) + '\062' + chr(0b110001) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10110 + 0o34) + chr(0b110111) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\065' + chr(1620 - 1570), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + '\062' + '\067' + chr(1794 - 1746), 8), ehT0Px3KOsy9(chr(614 - 566) + chr(0b1101111) + chr(51) + '\063' + chr(53), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + chr(2732 - 2679) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf'), '\144' + '\x65' + '\x63' + chr(0b111110 + 0o61) + chr(9794 - 9694) + chr(8646 - 8545))(chr(0b1110101) + chr(0b1010001 + 0o43) + chr(102) + chr(45) + chr(159 - 103)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xQt6gV9VfTO3(oVre8I6UXc3b, holLFgwB7vsP, n4ljua2gi1Pr=None, tnqEWmPx71Oj=None, **M8EIoTs2GJXE):
yFP4suyTsK4d = [UyakMW2IMFEj.dataset(holLFgwB7vsP, **M8EIoTs2GJXE) for UyakMW2IMFEj in oVre8I6UXc3b.problems]
yFP4suyTsK4d = [pd3lxn9vqWxp.map(lambda OeWW0F1dBPRQ, WVxHKyX45z_L=tlORBuYsiw3X: oVre8I6UXc3b.normalize_example(wLqBDw8l0eIm(OeWW0F1dBPRQ, problem_id=IDJ2eXGCBCDu.constant([WVxHKyX45z_L])), n4ljua2gi1Pr)) for (tlORBuYsiw3X, pd3lxn9vqWxp) in YlkZvXL8qwsX(yFP4suyTsK4d)]
if holLFgwB7vsP is xafqLlk3kkUe(sO7e1A_Mor6Q.DatasetSplit, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\x079\xf7\xd8'), chr(0b111010 + 0o52) + '\145' + chr(99) + chr(4965 - 4854) + '\144' + '\x65')('\165' + '\x74' + chr(9875 - 9773) + chr(571 - 526) + chr(741 - 685))):
if tnqEWmPx71Oj is None:
tnqEWmPx71Oj = IDJ2eXGCBCDu.train.get_or_create_global_step()
jZpMg4iAlWss = LM9_sSd47yIO(oVre8I6UXc3b.schedule, tnqEWmPx71Oj)
return dVT0IK878SuM(yFP4suyTsK4d, jZpMg4iAlWss)
elif xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe;\x14\xc7\xc9\x86w\x8f\x19\x0b.w\xc3\x80\xcc\xad\x94U\xc3W\\\x17%'), '\x64' + '\x65' + '\143' + chr(0b1101111) + chr(1222 - 1122) + '\145')('\165' + '\x74' + chr(102) + '\x2d' + chr(56))):
return yFP4suyTsK4d[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1730 - 1682), 0o10)]
else:
yFP4suyTsK4d = [pd3lxn9vqWxp.repeat() for pd3lxn9vqWxp in yFP4suyTsK4d]
return xafqLlk3kkUe(IDJ2eXGCBCDu.data.Dataset.zip(KNyTy8rYcwji(yFP4suyTsK4d)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf79\x19\xca\xc9\x8e`\x9e'), chr(0b1100100) + '\x65' + chr(99) + chr(0b1101111) + chr(100) + chr(101))(chr(117) + chr(0b1110100) + '\146' + '\055' + '\070'))(lambda *OeWW0F1dBPRQ: xafqLlk3kkUe(E6ula8_Zv1yl, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe30\x1c\xcb\xf5\x86'), chr(9116 - 9016) + chr(0b100111 + 0o76) + chr(0b111001 + 0o52) + '\x6f' + '\x64' + chr(0b1000001 + 0o44))(chr(1589 - 1472) + '\x74' + '\x66' + '\x2d' + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu.data.Dataset, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2:\x16\xdd\xf7\x97d\x80\x14 -'), chr(100) + chr(101) + chr(0b1100011) + chr(0b11011 + 0o124) + '\x64' + chr(101))(chr(0b0 + 0o165) + '\164' + chr(1619 - 1517) + chr(0b101101) + chr(976 - 920))), abA97kOQKaLo(xafqLlk3kkUe(IDJ2eXGCBCDu.data.Dataset, xafqLlk3kkUe(SXOLrMavuUCe(b"\xf7'\x17\xd3\xc9\x97d\x80\x06;:m"), chr(0b1001001 + 0o33) + '\x65' + chr(0b1001010 + 0o31) + chr(0b1101111) + '\x64' + chr(0b10010 + 0o123))('\165' + chr(7272 - 7156) + chr(0b100010 + 0o104) + chr(45) + '\070')), OeWW0F1dBPRQ)))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
MultiText2TextProblem.normalize_example
|
def normalize_example(self, example, hparams):
"""Assumes that example contains both inputs and targets."""
length = self.max_length(hparams)
def _to_constant_shape(tensor):
tensor = tensor[:length]
tensor = tf.pad(tensor, [(0, length - tf.shape(tensor)[0])])
return tf.reshape(tensor, [length])
if self.has_inputs:
example['inputs'] = _to_constant_shape(example['inputs'])
example['targets'] = _to_constant_shape(example['targets'])
elif 'inputs' in example:
if self.packed_length:
raise ValueError('cannot concatenate packed examples on the fly.')
inputs = example.pop('inputs')[:-1] # Remove EOS token.
targets = tf.concat([inputs, example['targets']], 0)
example['targets'] = _to_constant_shape(targets)
else:
example['targets'] = _to_constant_shape(example['targets'])
if self.packed_length:
if self.has_inputs:
if 'inputs_segmentation' in example:
example['inputs_segmentation'] = _to_constant_shape(
example['inputs_segmentation'])
example['inputs_position'] = _to_constant_shape(
example['inputs_position'])
else:
example['inputs_segmentation'] = tf.to_int64(
tf.not_equal(example['inputs'], 0))
example['inputs_position'] = (
example['inputs_segmentation'] * tf.range(length, dtype=tf.int64))
if 'targets_segmentation' in example:
example['targets_segmentation'] = _to_constant_shape(
example['targets_segmentation'])
example['targets_position'] = _to_constant_shape(
example['targets_position'])
else:
example['targets_segmentation'] = tf.to_int64(
tf.not_equal(example['targets'], 0))
example['targets_position'] = (
example['targets_segmentation'] * tf.range(length, dtype=tf.int64))
return example
|
python
|
def normalize_example(self, example, hparams):
"""Assumes that example contains both inputs and targets."""
length = self.max_length(hparams)
def _to_constant_shape(tensor):
tensor = tensor[:length]
tensor = tf.pad(tensor, [(0, length - tf.shape(tensor)[0])])
return tf.reshape(tensor, [length])
if self.has_inputs:
example['inputs'] = _to_constant_shape(example['inputs'])
example['targets'] = _to_constant_shape(example['targets'])
elif 'inputs' in example:
if self.packed_length:
raise ValueError('cannot concatenate packed examples on the fly.')
inputs = example.pop('inputs')[:-1] # Remove EOS token.
targets = tf.concat([inputs, example['targets']], 0)
example['targets'] = _to_constant_shape(targets)
else:
example['targets'] = _to_constant_shape(example['targets'])
if self.packed_length:
if self.has_inputs:
if 'inputs_segmentation' in example:
example['inputs_segmentation'] = _to_constant_shape(
example['inputs_segmentation'])
example['inputs_position'] = _to_constant_shape(
example['inputs_position'])
else:
example['inputs_segmentation'] = tf.to_int64(
tf.not_equal(example['inputs'], 0))
example['inputs_position'] = (
example['inputs_segmentation'] * tf.range(length, dtype=tf.int64))
if 'targets_segmentation' in example:
example['targets_segmentation'] = _to_constant_shape(
example['targets_segmentation'])
example['targets_position'] = _to_constant_shape(
example['targets_position'])
else:
example['targets_segmentation'] = tf.to_int64(
tf.not_equal(example['targets'], 0))
example['targets_position'] = (
example['targets_segmentation'] * tf.range(length, dtype=tf.int64))
return example
|
[
"def",
"normalize_example",
"(",
"self",
",",
"example",
",",
"hparams",
")",
":",
"length",
"=",
"self",
".",
"max_length",
"(",
"hparams",
")",
"def",
"_to_constant_shape",
"(",
"tensor",
")",
":",
"tensor",
"=",
"tensor",
"[",
":",
"length",
"]",
"tensor",
"=",
"tf",
".",
"pad",
"(",
"tensor",
",",
"[",
"(",
"0",
",",
"length",
"-",
"tf",
".",
"shape",
"(",
"tensor",
")",
"[",
"0",
"]",
")",
"]",
")",
"return",
"tf",
".",
"reshape",
"(",
"tensor",
",",
"[",
"length",
"]",
")",
"if",
"self",
".",
"has_inputs",
":",
"example",
"[",
"'inputs'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'inputs'",
"]",
")",
"example",
"[",
"'targets'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'targets'",
"]",
")",
"elif",
"'inputs'",
"in",
"example",
":",
"if",
"self",
".",
"packed_length",
":",
"raise",
"ValueError",
"(",
"'cannot concatenate packed examples on the fly.'",
")",
"inputs",
"=",
"example",
".",
"pop",
"(",
"'inputs'",
")",
"[",
":",
"-",
"1",
"]",
"# Remove EOS token.",
"targets",
"=",
"tf",
".",
"concat",
"(",
"[",
"inputs",
",",
"example",
"[",
"'targets'",
"]",
"]",
",",
"0",
")",
"example",
"[",
"'targets'",
"]",
"=",
"_to_constant_shape",
"(",
"targets",
")",
"else",
":",
"example",
"[",
"'targets'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'targets'",
"]",
")",
"if",
"self",
".",
"packed_length",
":",
"if",
"self",
".",
"has_inputs",
":",
"if",
"'inputs_segmentation'",
"in",
"example",
":",
"example",
"[",
"'inputs_segmentation'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'inputs_segmentation'",
"]",
")",
"example",
"[",
"'inputs_position'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'inputs_position'",
"]",
")",
"else",
":",
"example",
"[",
"'inputs_segmentation'",
"]",
"=",
"tf",
".",
"to_int64",
"(",
"tf",
".",
"not_equal",
"(",
"example",
"[",
"'inputs'",
"]",
",",
"0",
")",
")",
"example",
"[",
"'inputs_position'",
"]",
"=",
"(",
"example",
"[",
"'inputs_segmentation'",
"]",
"*",
"tf",
".",
"range",
"(",
"length",
",",
"dtype",
"=",
"tf",
".",
"int64",
")",
")",
"if",
"'targets_segmentation'",
"in",
"example",
":",
"example",
"[",
"'targets_segmentation'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'targets_segmentation'",
"]",
")",
"example",
"[",
"'targets_position'",
"]",
"=",
"_to_constant_shape",
"(",
"example",
"[",
"'targets_position'",
"]",
")",
"else",
":",
"example",
"[",
"'targets_segmentation'",
"]",
"=",
"tf",
".",
"to_int64",
"(",
"tf",
".",
"not_equal",
"(",
"example",
"[",
"'targets'",
"]",
",",
"0",
")",
")",
"example",
"[",
"'targets_position'",
"]",
"=",
"(",
"example",
"[",
"'targets_segmentation'",
"]",
"*",
"tf",
".",
"range",
"(",
"length",
",",
"dtype",
"=",
"tf",
".",
"int64",
")",
")",
"return",
"example"
] |
Assumes that example contains both inputs and targets.
|
[
"Assumes",
"that",
"example",
"contains",
"both",
"inputs",
"and",
"targets",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L139-L181
|
train
|
Assumes that example contains both inputs and targets.
|
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,cW7yQ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HmVpI,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(0b11011 + 0o25) + '\x6f' + '\x31' + chr(0b100100 + 0o23) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + '\063' + chr(0b110100) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b100110 + 0o15) + chr(419 - 371) + chr(0b110 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(53) + chr(0b1001 + 0o47), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(52) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(53) + chr(0b10010 + 0o43), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(351 - 302) + chr(457 - 405) + chr(701 - 651), 1136 - 1128), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x37' + chr(0b10100 + 0o37), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\067' + '\067', 38784 - 38776), ehT0Px3KOsy9(chr(1932 - 1884) + chr(0b10110 + 0o131) + chr(50) + chr(0b110000) + chr(0b101111 + 0o7), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(10232 - 10121) + '\x31' + '\061' + '\x36', 0b1000), ehT0Px3KOsy9(chr(680 - 632) + chr(699 - 588) + chr(699 - 649) + chr(0b110100) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(49) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1109 - 1061) + chr(0b1100000 + 0o17) + chr(0b100110 + 0o14) + chr(0b110111) + chr(53), 37422 - 37414), ehT0Px3KOsy9('\060' + chr(9138 - 9027) + chr(890 - 840) + '\x33' + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + chr(0b110011) + chr(53) + chr(51), 52846 - 52838), ehT0Px3KOsy9(chr(700 - 652) + chr(0b1101111) + chr(0b101101 + 0o5) + '\x37' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(5998 - 5887) + '\062' + chr(0b100010 + 0o25) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1080 - 1029) + '\060' + chr(2210 - 2156), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b11010 + 0o27) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(3170 - 3059) + chr(50) + chr(725 - 677) + chr(2411 - 2358), 0b1000), ehT0Px3KOsy9(chr(1499 - 1451) + '\x6f' + chr(0b1101 + 0o44) + chr(0b110011 + 0o1) + chr(48), 44646 - 44638), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(2351 - 2299) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10111 + 0o34) + chr(0b110001) + '\060', 2541 - 2533), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(3602 - 3491) + '\x36' + chr(1964 - 1912), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(298 - 248) + '\062' + chr(129 - 80), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x34' + chr(1573 - 1524), 38467 - 38459), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(798 - 745) + chr(0b11110 + 0o31), 0b1000), ehT0Px3KOsy9(chr(1307 - 1259) + chr(111) + chr(0b110010) + chr(53) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(2017 - 1969) + '\157' + chr(1661 - 1611) + '\064' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1111 + 0o47) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b100110 + 0o21) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(4470 - 4359) + chr(0b1111 + 0o46) + chr(0b110001), 23382 - 23374), ehT0Px3KOsy9(chr(2014 - 1966) + chr(0b1101111) + chr(0b110010) + chr(2089 - 2034) + '\x33', 8), ehT0Px3KOsy9('\060' + '\157' + chr(51), 42229 - 42221), ehT0Px3KOsy9('\060' + '\157' + chr(0b11010 + 0o31) + '\066' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100111 + 0o110) + chr(1756 - 1702) + chr(680 - 632), 11632 - 11624), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(10171 - 10060) + '\x31' + chr(0b1001 + 0o53) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x34', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'R'), chr(0b1100100) + chr(413 - 312) + chr(0b1100011 + 0o0) + '\157' + chr(100) + chr(0b1100101))(chr(9367 - 9250) + chr(116) + chr(2233 - 2131) + chr(0b101101) + chr(0b101001 + 0o17)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RFGtk20NuzdY(oVre8I6UXc3b, kP4qaKv0ZkGv, n4ljua2gi1Pr):
CHAOgk5VCHH_ = oVre8I6UXc3b._o7pVXAdOCRy(n4ljua2gi1Pr)
def GmHd26CTXOv6(LK3cpXJU3UM0):
LK3cpXJU3UM0 = LK3cpXJU3UM0[:CHAOgk5VCHH_]
LK3cpXJU3UM0 = IDJ2eXGCBCDu.pad(LK3cpXJU3UM0, [(ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x30', 0o10), CHAOgk5VCHH_ - IDJ2eXGCBCDu.nauYfLglTpcb(LK3cpXJU3UM0)[ehT0Px3KOsy9('\x30' + chr(10909 - 10798) + chr(580 - 532), 8)])])
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\x81\xb5\x80E\xdd\x07'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(111) + '\x64' + chr(0b1001010 + 0o33))('\x75' + chr(0b111110 + 0o66) + chr(0b10 + 0o144) + chr(0b101101) + chr(56)))(LK3cpXJU3UM0, [CHAOgk5VCHH_])
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14\x85\xb5\xb7M\xc3\x12N\x8b\xf5'), '\x64' + chr(101) + chr(0b100011 + 0o100) + '\x6f' + chr(0b11111 + 0o105) + '\x65')('\x75' + '\x74' + chr(102) + chr(1487 - 1442) + chr(56))):
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde'), chr(0b1100100) + chr(0b1001011 + 0o32) + chr(99) + '\157' + '\144' + chr(0b111011 + 0o52))(chr(11642 - 11525) + chr(4658 - 4542) + chr(0b1100110) + chr(45) + chr(0b111000))] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde'), chr(0b1100100) + chr(101) + chr(0b110101 + 0o56) + chr(7803 - 7692) + '\x64' + '\145')(chr(117) + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(0b111000))])
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), chr(100) + '\x65' + '\x63' + chr(5859 - 5748) + '\x64' + chr(0b10111 + 0o116))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b0 + 0o55) + chr(946 - 890))] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), chr(0b1100100) + chr(0b1100101) + chr(8709 - 8610) + chr(111) + '\x64' + '\145')(chr(12419 - 12302) + '\164' + chr(0b1100000 + 0o6) + chr(901 - 856) + chr(0b111000))])
elif xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde'), '\x64' + chr(101) + chr(99) + chr(111) + chr(100) + chr(101))('\165' + '\x74' + chr(9411 - 9309) + chr(0b101101) + '\070') in kP4qaKv0ZkGv:
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c\x85\xa5\x83A\xc9=W\x9a\xe8)\xd4\xe5'), chr(6758 - 6658) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(2966 - 2849) + chr(0b111101 + 0o67) + chr(102) + chr(0b101101) + '\070')):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x85\xa8\x86K\xd9BX\x90\xe8-\xc1\xf9\xd8\xf7\x8a\xcb\xde\xe69\xe4\x03\x08\xadP\xb1\x84\x17\xc9\xccARhZ\x9bl\x9b\x10\x15l\x19\xc4\xa0\x84]\x83'), chr(857 - 757) + chr(0b1100101) + '\x63' + '\x6f' + '\144' + chr(101))(chr(0b1110101) + chr(10312 - 10196) + chr(1810 - 1708) + chr(0b101100 + 0o1) + chr(56)))
vXoupepMtCXU = kP4qaKv0ZkGv.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde'), chr(0b1100100) + chr(0b100100 + 0o101) + chr(1061 - 962) + '\157' + '\x64' + chr(0b110000 + 0o65))(chr(0b1110101) + chr(1227 - 1111) + chr(2445 - 2343) + chr(0b101101) + chr(0b111000)))[:-ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + chr(1384 - 1335), 0o10)]
xIEmRseySp3z = IDJ2eXGCBCDu.concat([vXoupepMtCXU, kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b101000 + 0o107) + chr(5654 - 5554) + chr(0b1011001 + 0o14))(chr(0b1110101) + chr(8781 - 8665) + chr(0b10011 + 0o123) + chr(0b11000 + 0o25) + chr(0b100101 + 0o23))]], ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1001 + 0o47), 8))
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), '\144' + chr(101) + '\143' + chr(0b1101111) + '\x64' + chr(0b100111 + 0o76))(chr(4356 - 4239) + '\164' + chr(0b1001 + 0o135) + chr(0b10011 + 0o32) + chr(1150 - 1094))] = GmHd26CTXOv6(xIEmRseySp3z)
else:
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), chr(100) + chr(0b1000010 + 0o43) + chr(0b110010 + 0o61) + '\157' + chr(0b101011 + 0o71) + '\x65')(chr(12378 - 12261) + chr(13022 - 12906) + chr(1859 - 1757) + '\x2d' + chr(0b111000))] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), '\x64' + chr(0b1100101) + '\x63' + chr(0b1011110 + 0o21) + '\x64' + chr(639 - 538))(chr(0b10010 + 0o143) + '\164' + chr(0b1100110) + '\x2d' + chr(412 - 356))])
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c\x85\xa5\x83A\xc9=W\x9a\xe8)\xd4\xe5'), '\x64' + chr(101) + '\x63' + chr(0b1101111) + chr(100) + chr(0b1011100 + 0o11))(chr(0b1011001 + 0o34) + '\x74' + '\x66' + chr(1142 - 1097) + chr(0b111000))):
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14\x85\xb5\xb7M\xc3\x12N\x8b\xf5'), chr(9888 - 9788) + chr(0b1100101) + chr(1845 - 1746) + chr(0b1101111) + '\x64' + chr(101))('\x75' + chr(10859 - 10743) + chr(102) + chr(0b101101) + chr(0b111000))):
if xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde=H\x9a\xe1#\xc5\xe3\xc9\xf8\x9f\xd6\xd4\xa8'), '\144' + '\x65' + chr(0b1100011) + '\157' + '\144' + '\x65')('\165' + '\164' + '\x66' + chr(0b100111 + 0o6) + chr(56)) in kP4qaKv0ZkGv:
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde=H\x9a\xe1#\xc5\xe3\xc9\xf8\x9f\xd6\xd4\xa8'), chr(3263 - 3163) + chr(101) + chr(0b1100011) + '\157' + chr(0b1010111 + 0o15) + '\x65')('\x75' + '\x74' + chr(102) + chr(0b101101) + chr(0b111000))] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde=H\x9a\xe1#\xc5\xe3\xc9\xf8\x9f\xd6\xd4\xa8'), chr(100) + chr(101) + '\143' + chr(0b1101111) + chr(7256 - 7156) + '\145')(chr(9488 - 9371) + chr(116) + chr(3462 - 3360) + '\x2d' + chr(0b101000 + 0o20))])
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x15\x8a\xb6\x9dP\xde=K\x90\xf5'\xd4\xe4\xd2\xf7"), chr(0b1011100 + 0o10) + chr(0b1100011 + 0o2) + chr(99) + chr(1285 - 1174) + '\144' + '\x65')(chr(0b1110101) + '\x74' + chr(6557 - 6455) + '\055' + '\070')] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x15\x8a\xb6\x9dP\xde=K\x90\xf5'\xd4\xe4\xd2\xf7"), '\144' + chr(2145 - 2044) + '\143' + '\x6f' + chr(0b1100100) + chr(101))('\x75' + chr(10690 - 10574) + '\x66' + '\x2d' + chr(2279 - 2223))])
else:
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde=H\x9a\xe1#\xc5\xe3\xc9\xf8\x9f\xd6\xd4\xa8'), chr(100) + '\145' + '\x63' + chr(0b1101001 + 0o6) + '\x64' + chr(2989 - 2888))(chr(117) + '\x74' + '\146' + chr(45) + chr(0b1100 + 0o54))] = IDJ2eXGCBCDu.to_int64(IDJ2eXGCBCDu.not_equal(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde'), chr(0b1100100) + chr(0b10111 + 0o116) + '\143' + '\x6f' + '\x64' + '\145')(chr(0b1110101) + chr(0b11010 + 0o132) + chr(0b1011111 + 0o7) + '\055' + chr(3013 - 2957))], ehT0Px3KOsy9(chr(1522 - 1474) + chr(0b1010110 + 0o31) + '\x30', 8)))
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x15\x8a\xb6\x9dP\xde=K\x90\xf5'\xd4\xe4\xd2\xf7"), '\x64' + '\145' + chr(4733 - 4634) + chr(3172 - 3061) + chr(2115 - 2015) + chr(101))('\x75' + chr(0b1110100) + '\x66' + '\055' + '\070')] = kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x15\x8a\xb6\x9dP\xde=H\x9a\xe1#\xc5\xe3\xc9\xf8\x9f\xd6\xd4\xa8'), '\144' + '\x65' + chr(0b1100011) + '\157' + chr(100) + '\x65')('\x75' + chr(10144 - 10028) + chr(0b1001110 + 0o30) + chr(0b10001 + 0o34) + chr(0b111000))] * IDJ2eXGCBCDu.range(CHAOgk5VCHH_, dtype=IDJ2eXGCBCDu.int64)
if xafqLlk3kkUe(SXOLrMavuUCe(b"\x08\x85\xb4\x8fA\xd9\x11d\x8c\xe3)\xcd\xe8\xd3\xed\x8a\xcb\xd2\xa9'"), '\144' + '\145' + chr(0b1100011) + chr(4833 - 4722) + chr(0b1001111 + 0o25) + chr(0b1100101))('\x75' + chr(0b1110100) + '\146' + chr(0b101101) + '\070') in kP4qaKv0ZkGv:
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x08\x85\xb4\x8fA\xd9\x11d\x8c\xe3)\xcd\xe8\xd3\xed\x8a\xcb\xd2\xa9'"), chr(0b100010 + 0o102) + '\x65' + '\143' + '\x6f' + '\x64' + chr(0b1011100 + 0o11))('\165' + '\164' + '\x66' + chr(0b10000 + 0o35) + chr(56))] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x08\x85\xb4\x8fA\xd9\x11d\x8c\xe3)\xcd\xe8\xd3\xed\x8a\xcb\xd2\xa9'"), chr(0b1100100) + chr(9768 - 9667) + '\x63' + chr(111) + '\x64' + chr(101))(chr(0b1011011 + 0o32) + chr(916 - 800) + chr(0b1000010 + 0o44) + '\055' + '\x38')])
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11d\x8f\xe9=\xc9\xf9\xd4\xf6\x85'), chr(0b1100100) + chr(0b11 + 0o142) + chr(6965 - 6866) + chr(0b10011 + 0o134) + chr(100) + chr(101))('\165' + chr(116) + chr(0b1100110) + chr(514 - 469) + '\x38')] = GmHd26CTXOv6(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11d\x8f\xe9=\xc9\xf9\xd4\xf6\x85'), '\144' + chr(5981 - 5880) + '\143' + chr(111) + chr(0b1100100) + chr(2436 - 2335))(chr(0b1110101) + chr(116) + '\x66' + chr(0b101101) + chr(56))])
else:
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x08\x85\xb4\x8fA\xd9\x11d\x8c\xe3)\xcd\xe8\xd3\xed\x8a\xcb\xd2\xa9'"), '\144' + chr(8091 - 7990) + chr(7186 - 7087) + '\x6f' + '\144' + chr(0b100011 + 0o102))('\165' + chr(0b1110100) + chr(722 - 620) + chr(0b10111 + 0o26) + '\x38')] = IDJ2eXGCBCDu.to_int64(IDJ2eXGCBCDu.not_equal(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11'), '\144' + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(4423 - 4323) + chr(0b1100101))(chr(0b1110101) + chr(1443 - 1327) + chr(7957 - 7855) + '\055' + chr(0b11100 + 0o34))], ehT0Px3KOsy9('\060' + chr(0b101011 + 0o104) + chr(48), 8)))
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'\x08\x85\xb4\x8fA\xd9\x11d\x8f\xe9=\xc9\xf9\xd4\xf6\x85'), chr(0b1001000 + 0o34) + chr(0b1100101) + chr(0b1001001 + 0o32) + chr(0b1011111 + 0o20) + '\x64' + chr(0b1100101))('\165' + chr(116) + '\x66' + '\055' + chr(56))] = kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b"\x08\x85\xb4\x8fA\xd9\x11d\x8c\xe3)\xcd\xe8\xd3\xed\x8a\xcb\xd2\xa9'"), chr(9593 - 9493) + chr(101) + '\143' + chr(111) + chr(7166 - 7066) + chr(2616 - 2515))(chr(117) + chr(6463 - 6347) + '\146' + '\x2d' + '\x38')] * IDJ2eXGCBCDu.range(CHAOgk5VCHH_, dtype=IDJ2eXGCBCDu.int64)
return kP4qaKv0ZkGv
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/multi_problem_v2.py
|
MultiText2TextProblem.generate_data_with_shared_vocab
|
def generate_data_with_shared_vocab(self, data_dir, tmp_dir, task_id=-1):
"""Generates TF-Records for problems using a global vocabulary file."""
global_vocab_filename = os.path.join(data_dir, self.vocab_filename)
if not tf.gfile.Exists(global_vocab_filename):
raise ValueError(
'Global vocabulary file: %s does not exist, '
'please create one using build_vocab.py' % global_vocab_filename)
# Before generating data, we copy the global vocabulary file to the children
# locations. Although this is not the most disk efficient strategy, it
# imposes the fewest changes to the text-to-text API.
for p in self.problems:
local_vocab_filename = os.path.join(data_dir, p.vocab_filename)
if not tf.gfile.Exists(local_vocab_filename):
tf.gfile.Copy(global_vocab_filename, local_vocab_filename)
p.generate_data(data_dir, tmp_dir, task_id)
|
python
|
def generate_data_with_shared_vocab(self, data_dir, tmp_dir, task_id=-1):
"""Generates TF-Records for problems using a global vocabulary file."""
global_vocab_filename = os.path.join(data_dir, self.vocab_filename)
if not tf.gfile.Exists(global_vocab_filename):
raise ValueError(
'Global vocabulary file: %s does not exist, '
'please create one using build_vocab.py' % global_vocab_filename)
# Before generating data, we copy the global vocabulary file to the children
# locations. Although this is not the most disk efficient strategy, it
# imposes the fewest changes to the text-to-text API.
for p in self.problems:
local_vocab_filename = os.path.join(data_dir, p.vocab_filename)
if not tf.gfile.Exists(local_vocab_filename):
tf.gfile.Copy(global_vocab_filename, local_vocab_filename)
p.generate_data(data_dir, tmp_dir, task_id)
|
[
"def",
"generate_data_with_shared_vocab",
"(",
"self",
",",
"data_dir",
",",
"tmp_dir",
",",
"task_id",
"=",
"-",
"1",
")",
":",
"global_vocab_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"self",
".",
"vocab_filename",
")",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"global_vocab_filename",
")",
":",
"raise",
"ValueError",
"(",
"'Global vocabulary file: %s does not exist, '",
"'please create one using build_vocab.py'",
"%",
"global_vocab_filename",
")",
"# Before generating data, we copy the global vocabulary file to the children",
"# locations. Although this is not the most disk efficient strategy, it",
"# imposes the fewest changes to the text-to-text API.",
"for",
"p",
"in",
"self",
".",
"problems",
":",
"local_vocab_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"p",
".",
"vocab_filename",
")",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"local_vocab_filename",
")",
":",
"tf",
".",
"gfile",
".",
"Copy",
"(",
"global_vocab_filename",
",",
"local_vocab_filename",
")",
"p",
".",
"generate_data",
"(",
"data_dir",
",",
"tmp_dir",
",",
"task_id",
")"
] |
Generates TF-Records for problems using a global vocabulary file.
|
[
"Generates",
"TF",
"-",
"Records",
"for",
"problems",
"using",
"a",
"global",
"vocabulary",
"file",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L183-L197
|
train
|
Generates TF - Records for problems using a global vocabulary file.
|
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(2254 - 2206) + chr(0b1101111) + chr(51) + chr(48) + chr(2216 - 2161), 9584 - 9576), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + '\067' + '\067', 28335 - 28327), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1748 - 1699) + chr(0b100010 + 0o25) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101001 + 0o10) + '\x34' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110010) + chr(323 - 271), 34889 - 34881), ehT0Px3KOsy9(chr(386 - 338) + chr(2853 - 2742) + chr(0b110001) + chr(0b110010) + chr(49), 2966 - 2958), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1329 - 1278) + chr(302 - 249) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2449 - 2399) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100001 + 0o116) + chr(943 - 894) + '\x34' + chr(1929 - 1880), 27859 - 27851), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + chr(51) + chr(50) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b100111 + 0o13) + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(3898 - 3787) + chr(0b110011) + chr(1893 - 1844) + chr(1244 - 1194), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + '\064' + chr(53), 8783 - 8775), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11111 + 0o22) + '\064' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(4078 - 3967) + '\067' + chr(0b101001 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(1504 - 1456) + chr(111) + chr(840 - 790) + chr(0b10111 + 0o34) + chr(0b10110 + 0o36), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4862 - 4751) + chr(0b101111 + 0o7) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + '\x32' + chr(50) + chr(0b10000 + 0o40), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\066' + chr(2243 - 2192), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(52), 0b1000), ehT0Px3KOsy9(chr(1663 - 1615) + '\x6f' + '\x32' + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(144 - 96) + chr(0b100001 + 0o116) + chr(632 - 582) + chr(217 - 165), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11001 + 0o30) + '\063' + chr(0b100001 + 0o21), 0b1000), ehT0Px3KOsy9('\x30' + chr(1133 - 1022) + chr(0b101100 + 0o5) + '\x35' + chr(0b110010), 10994 - 10986), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\x34' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(304 - 256) + chr(111) + chr(0b101 + 0o54) + chr(2292 - 2239) + '\x32', 8), ehT0Px3KOsy9('\060' + chr(6607 - 6496) + chr(0b10011 + 0o37) + '\x36' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(0b11010 + 0o30) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(872 - 824) + '\x6f' + chr(50) + chr(0b10 + 0o60) + '\060', 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(0b110011) + chr(0b1111 + 0o46) + chr(0b10010 + 0o37), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(54) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(1478 - 1425), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(2442 - 2391), 53491 - 53483), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(2343 - 2289) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(311 - 261) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(1281 - 1230) + chr(2244 - 2196), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1948 - 1899) + chr(0b101111 + 0o5) + chr(0b101011 + 0o10), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(362 - 314) + '\x6f' + '\065' + '\x30', 58480 - 58472)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9'), chr(1036 - 936) + chr(0b1100101) + chr(99) + chr(11265 - 11154) + '\144' + '\145')(chr(0b101000 + 0o115) + '\x74' + chr(4384 - 4282) + '\x2d' + chr(0b10111 + 0o41)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def IXfNHtZbmNkQ(oVre8I6UXc3b, kVFRD544hi_1, JsZ36NJUqtml, h_MwKIdeQ6Ce=-ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31', 0o10)):
z6adojQ9zcI6 = oqhJDdMJfuwx.path.join(kVFRD544hi_1, oVre8I6UXc3b.vocab_filename)
if not xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\x82G\x16\x16\xa0"'), '\144' + '\x65' + chr(0b11001 + 0o112) + chr(111) + chr(0b1100100) + chr(248 - 147))(chr(7723 - 7606) + '\164' + '\x66' + chr(45) + chr(784 - 728)))(z6adojQ9zcI6):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\x80S\x10\x07\xb5=\xc9f\x0e\xb1\xf7\xa8P\x08_\xeeK\xb0Un`\xc1.zO\xd4J\xd7`C\xa6\xb0\x87\x18y+\x10\xa8\xb1\x10\xb3\x13_\x15\xb84\x88c\x04\xf2\xf5\xb8@\x05J\xf9\x12\xff]b,\xd1g3\x04\xc0J\xd1zO\xb9\xf4\xb6\x01bh\x14\xb2\xf6\x13\xbe'), chr(0b111110 + 0o46) + chr(0b100001 + 0o104) + chr(0b1100011) + '\157' + chr(641 - 541) + chr(0b1011001 + 0o14))(chr(0b1010010 + 0o43) + '\x74' + chr(0b1100110) + chr(45) + '\070') % z6adojQ9zcI6)
for UyakMW2IMFEj in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7M\x10\x07\xb84\x84c'), chr(3660 - 3560) + chr(0b111000 + 0o55) + chr(0b1100011) + chr(0b1101111) + chr(4585 - 4485) + '\145')(chr(117) + '\164' + chr(102) + '\x2d' + chr(2777 - 2721))):
zqls2NNx3C7L = oqhJDdMJfuwx.path.join(kVFRD544hi_1, UyakMW2IMFEj.vocab_filename)
if not xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\x82G\x16\x16\xa0"'), chr(0b1001001 + 0o33) + '\x65' + chr(0b1011100 + 0o7) + chr(0b1100101 + 0o12) + chr(3070 - 2970) + chr(101))('\x75' + chr(0b1110100) + chr(6081 - 5979) + chr(0b101101) + chr(2543 - 2487)))(zqls2NNx3C7L):
xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\x84P\x0f\x1c'), chr(1714 - 1614) + chr(0b1100101) + chr(0b1100011) + chr(111) + '\x64' + '\x65')(chr(0b1010111 + 0o36) + chr(167 - 51) + '\x66' + '\055' + '\070'))(z6adojQ9zcI6, zqls2NNx3C7L)
xafqLlk3kkUe(UyakMW2IMFEj, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0Z\x11\x00\xa60\x9du>\xb6\xf7\xbeD'), chr(0b111100 + 0o50) + '\145' + chr(0b1100011) + chr(5648 - 5537) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(1891 - 1789) + chr(1789 - 1744) + chr(56)))(kVFRD544hi_1, JsZ36NJUqtml, h_MwKIdeQ6Ce)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
lengths_to_area_mask
|
def lengths_to_area_mask(feature_length, length, max_area_size):
"""Generates a non-padding mask for areas based on lengths.
Args:
feature_length: a tensor of [batch_size]
length: the length of the batch
max_area_size: the maximum area size considered
Returns:
mask: a tensor in shape of [batch_size, num_areas]
"""
paddings = tf.cast(tf.expand_dims(
tf.logical_not(
tf.sequence_mask(feature_length, maxlen=length)), 2), tf.float32)
_, _, area_sum, _, _ = compute_area_features(paddings,
max_area_width=max_area_size)
mask = tf.squeeze(tf.logical_not(tf.cast(area_sum, tf.bool)), [2])
return mask
|
python
|
def lengths_to_area_mask(feature_length, length, max_area_size):
"""Generates a non-padding mask for areas based on lengths.
Args:
feature_length: a tensor of [batch_size]
length: the length of the batch
max_area_size: the maximum area size considered
Returns:
mask: a tensor in shape of [batch_size, num_areas]
"""
paddings = tf.cast(tf.expand_dims(
tf.logical_not(
tf.sequence_mask(feature_length, maxlen=length)), 2), tf.float32)
_, _, area_sum, _, _ = compute_area_features(paddings,
max_area_width=max_area_size)
mask = tf.squeeze(tf.logical_not(tf.cast(area_sum, tf.bool)), [2])
return mask
|
[
"def",
"lengths_to_area_mask",
"(",
"feature_length",
",",
"length",
",",
"max_area_size",
")",
":",
"paddings",
"=",
"tf",
".",
"cast",
"(",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"sequence_mask",
"(",
"feature_length",
",",
"maxlen",
"=",
"length",
")",
")",
",",
"2",
")",
",",
"tf",
".",
"float32",
")",
"_",
",",
"_",
",",
"area_sum",
",",
"_",
",",
"_",
"=",
"compute_area_features",
"(",
"paddings",
",",
"max_area_width",
"=",
"max_area_size",
")",
"mask",
"=",
"tf",
".",
"squeeze",
"(",
"tf",
".",
"logical_not",
"(",
"tf",
".",
"cast",
"(",
"area_sum",
",",
"tf",
".",
"bool",
")",
")",
",",
"[",
"2",
"]",
")",
"return",
"mask"
] |
Generates a non-padding mask for areas based on lengths.
Args:
feature_length: a tensor of [batch_size]
length: the length of the batch
max_area_size: the maximum area size considered
Returns:
mask: a tensor in shape of [batch_size, num_areas]
|
[
"Generates",
"a",
"non",
"-",
"padding",
"mask",
"for",
"areas",
"based",
"on",
"lengths",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L27-L44
|
train
|
Generates a non - padding mask for areas based on lengths.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,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8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11 + 0o56) + chr(0b100000 + 0o25) + '\063', 0o10), ehT0Px3KOsy9(chr(306 - 258) + chr(0b1101111) + '\x31' + '\064' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(0b110010) + '\063' + chr(0b101 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\x37' + chr(0b101 + 0o54), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10100 + 0o37) + '\065' + chr(0b11010 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(1831 - 1783) + chr(111) + chr(0b110010) + chr(945 - 891), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b10111 + 0o32) + '\061' + chr(2512 - 2457), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11000 + 0o33) + chr(0b110001) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(1281 - 1228) + chr(53), 20820 - 20812), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10001 + 0o41) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b11010 + 0o32) + chr(221 - 167), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101000 + 0o13) + chr(0b110101) + chr(0b11001 + 0o30), 40161 - 40153), ehT0Px3KOsy9(chr(48) + chr(111) + chr(663 - 614) + chr(0b101101 + 0o5) + chr(51), 35130 - 35122), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1213 - 1164) + '\x33' + chr(0b11010 + 0o30), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1778 - 1727) + '\065' + chr(486 - 435), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(1533 - 1485) + '\061', 43454 - 43446), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b10100 + 0o133) + '\x35' + chr(52), 0o10), ehT0Px3KOsy9(chr(435 - 387) + '\157' + chr(0b110011) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(2063 - 2008) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1275 - 1227) + chr(0b1101111 + 0o0) + '\062' + '\x32' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(990 - 939) + chr(0b110010) + chr(2620 - 2567), 14651 - 14643), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + chr(0b11101 + 0o25) + '\x32', 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(7643 - 7532) + chr(0b1 + 0o61) + chr(48) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(0b1110 + 0o42) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x36' + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(533 - 422) + chr(49) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(4247 - 4136) + '\061' + chr(2771 - 2718) + chr(0b10111 + 0o37), 0b1000), ehT0Px3KOsy9(chr(2287 - 2239) + chr(111) + '\062' + chr(913 - 862) + chr(0b110000 + 0o2), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10797 - 10686) + chr(0b10010 + 0o40) + '\061' + chr(1903 - 1849), 0o10), ehT0Px3KOsy9(chr(841 - 793) + '\x6f' + chr(0b11011 + 0o26) + chr(1352 - 1303) + chr(0b100001 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(276 - 226) + chr(0b110101) + chr(1393 - 1340), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(991 - 941) + chr(1307 - 1258), 0o10), ehT0Px3KOsy9('\x30' + chr(3226 - 3115) + chr(0b11010 + 0o32) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + '\066' + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110100) + chr(0b1 + 0o57), 42364 - 42356), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\061' + chr(1374 - 1322), 60148 - 60140), ehT0Px3KOsy9(chr(134 - 86) + chr(0b1101111) + chr(1871 - 1822) + '\065' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10056 - 9945) + chr(2118 - 2067) + chr(499 - 444) + chr(0b101 + 0o57), 8), ehT0Px3KOsy9(chr(638 - 590) + '\157' + chr(2454 - 2402) + chr(0b10001 + 0o41), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101100 + 0o103) + '\061' + chr(1397 - 1345) + '\060', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(2138 - 2085) + '\060', 53862 - 53854)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'E'), chr(100) + '\x65' + chr(0b1011110 + 0o5) + chr(0b111101 + 0o62) + chr(0b1011101 + 0o7) + '\x65')(chr(0b1110010 + 0o3) + '\164' + chr(0b1 + 0o145) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def sltZPUfZ_YkU(oA3kFX0xuJFy, CHAOgk5VCHH_, PQ23xmz8xE6l):
rWQRL0c0130o = IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.sequence_mask(oA3kFX0xuJFy, maxlen=CHAOgk5VCHH_)), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010), 0b1000)), IDJ2eXGCBCDu.float32)
(VNGQdHSFPrso, VNGQdHSFPrso, VkDBB_Kz6QTP, VNGQdHSFPrso, VNGQdHSFPrso) = fPRF4fLu_Nsl(rWQRL0c0130o, max_area_width=PQ23xmz8xE6l)
Iz1jSgUKZDvt = IDJ2eXGCBCDu.squeeze(IDJ2eXGCBCDu.logical_not(IDJ2eXGCBCDu.cast(VkDBB_Kz6QTP, IDJ2eXGCBCDu.bool)), [ehT0Px3KOsy9(chr(1639 - 1591) + '\157' + chr(50), 8)])
return Iz1jSgUKZDvt
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
_pool_one_shape
|
def _pool_one_shape(features_2d, area_width, area_height, batch_size,
width, height, depth, fn=tf.reduce_max, name=None):
"""Pools for an area in features_2d.
Args:
features_2d: a Tensor in a shape of [batch_size, height, width, depth].
area_width: the max width allowed for an area.
area_height: the max height allowed for an area.
batch_size: the batch size.
width: the width of the memory.
height: the height of the memory.
depth: the depth of the features.
fn: the TF function for the pooling.
name: the op name.
Returns:
pool_tensor: A Tensor of shape [batch_size, num_areas, depth]
"""
with tf.name_scope(name, default_name="pool_one_shape"):
images = []
for y_shift in range(area_height):
image_height = tf.maximum(height - area_height + 1 + y_shift, 0)
for x_shift in range(area_width):
image_width = tf.maximum(width - area_width + 1 + x_shift, 0)
area = features_2d[:, y_shift:image_height, x_shift:image_width, :]
flatten_area = tf.reshape(area, [batch_size, -1, depth, 1])
images.append(flatten_area)
image_tensor = tf.concat(images, axis=3)
max_tensor = fn(image_tensor, axis=3)
return max_tensor
|
python
|
def _pool_one_shape(features_2d, area_width, area_height, batch_size,
width, height, depth, fn=tf.reduce_max, name=None):
"""Pools for an area in features_2d.
Args:
features_2d: a Tensor in a shape of [batch_size, height, width, depth].
area_width: the max width allowed for an area.
area_height: the max height allowed for an area.
batch_size: the batch size.
width: the width of the memory.
height: the height of the memory.
depth: the depth of the features.
fn: the TF function for the pooling.
name: the op name.
Returns:
pool_tensor: A Tensor of shape [batch_size, num_areas, depth]
"""
with tf.name_scope(name, default_name="pool_one_shape"):
images = []
for y_shift in range(area_height):
image_height = tf.maximum(height - area_height + 1 + y_shift, 0)
for x_shift in range(area_width):
image_width = tf.maximum(width - area_width + 1 + x_shift, 0)
area = features_2d[:, y_shift:image_height, x_shift:image_width, :]
flatten_area = tf.reshape(area, [batch_size, -1, depth, 1])
images.append(flatten_area)
image_tensor = tf.concat(images, axis=3)
max_tensor = fn(image_tensor, axis=3)
return max_tensor
|
[
"def",
"_pool_one_shape",
"(",
"features_2d",
",",
"area_width",
",",
"area_height",
",",
"batch_size",
",",
"width",
",",
"height",
",",
"depth",
",",
"fn",
"=",
"tf",
".",
"reduce_max",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"default_name",
"=",
"\"pool_one_shape\"",
")",
":",
"images",
"=",
"[",
"]",
"for",
"y_shift",
"in",
"range",
"(",
"area_height",
")",
":",
"image_height",
"=",
"tf",
".",
"maximum",
"(",
"height",
"-",
"area_height",
"+",
"1",
"+",
"y_shift",
",",
"0",
")",
"for",
"x_shift",
"in",
"range",
"(",
"area_width",
")",
":",
"image_width",
"=",
"tf",
".",
"maximum",
"(",
"width",
"-",
"area_width",
"+",
"1",
"+",
"x_shift",
",",
"0",
")",
"area",
"=",
"features_2d",
"[",
":",
",",
"y_shift",
":",
"image_height",
",",
"x_shift",
":",
"image_width",
",",
":",
"]",
"flatten_area",
"=",
"tf",
".",
"reshape",
"(",
"area",
",",
"[",
"batch_size",
",",
"-",
"1",
",",
"depth",
",",
"1",
"]",
")",
"images",
".",
"append",
"(",
"flatten_area",
")",
"image_tensor",
"=",
"tf",
".",
"concat",
"(",
"images",
",",
"axis",
"=",
"3",
")",
"max_tensor",
"=",
"fn",
"(",
"image_tensor",
",",
"axis",
"=",
"3",
")",
"return",
"max_tensor"
] |
Pools for an area in features_2d.
Args:
features_2d: a Tensor in a shape of [batch_size, height, width, depth].
area_width: the max width allowed for an area.
area_height: the max height allowed for an area.
batch_size: the batch size.
width: the width of the memory.
height: the height of the memory.
depth: the depth of the features.
fn: the TF function for the pooling.
name: the op name.
Returns:
pool_tensor: A Tensor of shape [batch_size, num_areas, depth]
|
[
"Pools",
"for",
"an",
"area",
"in",
"features_2d",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L47-L75
|
train
|
Pools for an area in features_2d.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIA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2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(5644 - 5533) + '\062' + chr(0b110111) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(2090 - 2039) + chr(914 - 863), 0o10), ehT0Px3KOsy9(chr(1559 - 1511) + '\x6f' + '\063' + chr(52) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11069 - 10958) + chr(0b110001) + chr(0b110011) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(656 - 607) + chr(0b110010) + chr(492 - 442), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + chr(0b10101 + 0o35) + '\x33' + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1496 - 1446) + chr(50) + '\x36', 0b1000), ehT0Px3KOsy9(chr(1668 - 1620) + chr(7799 - 7688) + chr(0b111 + 0o52) + chr(442 - 387) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(790 - 736) + '\060', 55822 - 55814), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1011 + 0o46) + chr(2647 - 2594) + chr(814 - 759), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(179 - 131) + chr(0b101011 + 0o104) + chr(0b110010 + 0o0) + chr(0b110100) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(0b110100) + '\061', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(0b11101 + 0o26) + '\065' + chr(55), 48217 - 48209), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(1396 - 1345) + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100111 + 0o14) + '\x35' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110100) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(4634 - 4523) + chr(1840 - 1789) + chr(0b11110 + 0o26), 18385 - 18377), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(49) + chr(0b110000 + 0o3), 8), ehT0Px3KOsy9(chr(48) + chr(7394 - 7283) + chr(0b110011) + '\066' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011 + 0o144) + chr(0b101100 + 0o6) + '\066' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + '\061' + chr(0b110101) + chr(55), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11010 + 0o27) + chr(348 - 293), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(1892 - 1841) + chr(2016 - 1961) + '\x34', 40338 - 40330), ehT0Px3KOsy9(chr(1095 - 1047) + chr(111) + chr(0b100001 + 0o21) + '\x37' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(822 - 774) + chr(111) + chr(1742 - 1692) + chr(1101 - 1049) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000111 + 0o50) + chr(0b1001 + 0o50) + chr(816 - 761) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(4523 - 4412) + chr(51) + '\060' + chr(0b11000 + 0o30), 27443 - 27435), ehT0Px3KOsy9('\060' + chr(2007 - 1896) + chr(49) + chr(0b11101 + 0o30) + chr(0b110111), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\x32' + chr(1495 - 1447), 0o10), ehT0Px3KOsy9(chr(66 - 18) + '\157' + chr(0b10001 + 0o42) + chr(0b110000) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2592 - 2541) + chr(0b110111) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110 + 0o55) + '\060', 58576 - 58568), ehT0Px3KOsy9(chr(1617 - 1569) + chr(111) + chr(2647 - 2592) + chr(53), 20439 - 20431), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b111 + 0o57) + chr(0b110 + 0o52), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b10110 + 0o34) + '\066', 64437 - 64429), ehT0Px3KOsy9(chr(48) + chr(0b100010 + 0o115) + '\062' + '\x36' + '\x36', 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\060' + chr(1249 - 1201), 8), ehT0Px3KOsy9(chr(2196 - 2148) + chr(111) + '\x33' + chr(957 - 908) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(0b11101 + 0o25) + chr(55) + chr(674 - 623), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x35' + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x94'), chr(1118 - 1018) + chr(0b1100101) + '\143' + '\157' + '\144' + chr(208 - 107))(chr(0b1110101) + chr(2996 - 2880) + chr(0b11111 + 0o107) + '\x2d' + chr(2857 - 2801)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def qQSJASb6pqiJ(sHcOKwld_2dt, lAxNfQlc2ZMT, fWE9rdgTtw8c, ix9dZyeAmUxY, mPx09rBTrGXR, ehbUULKuygfC, UEys4_lSwsID, wDsB9Ho570J9=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xbe\x81,1\xfe\xc9\x10\xd1\x17'), '\144' + chr(101) + chr(99) + chr(0b11110 + 0o121) + '\144' + '\145')(chr(9064 - 8947) + chr(0b1110100) + '\146' + chr(45) + '\070')), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\xba\x88<\r\xe8\xf5\x12\xc0\n'), chr(6401 - 6301) + chr(1578 - 1477) + '\143' + '\x6f' + chr(0b1100100) + '\x65')(chr(11895 - 11778) + chr(311 - 195) + chr(102) + '\055' + chr(56)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xca\xb4\x8a5\r\xf4\xf8\x18\xef\x1cc\xc3\x11\x8a'), chr(100) + '\145' + '\143' + '\x6f' + chr(2155 - 2055) + chr(10058 - 9957))(chr(0b1111 + 0o146) + chr(0b1110100) + '\x66' + chr(429 - 384) + chr(56))):
YJOmEcibG8C0 = []
for NTEjQcyf3n_C in vQr8gNKaIaWE(fWE9rdgTtw8c):
aVRbWzCw2Vuo = IDJ2eXGCBCDu.maximum(ehbUULKuygfC - fWE9rdgTtw8c + ehT0Px3KOsy9(chr(1888 - 1840) + '\157' + chr(0b100011 + 0o16), ord("\x08")) + NTEjQcyf3n_C, ehT0Px3KOsy9(chr(48) + chr(4592 - 4481) + '\x30', 0b1000))
for Gkz6B11h0Gxy in vQr8gNKaIaWE(lAxNfQlc2ZMT):
RmwDor39z9oL = IDJ2eXGCBCDu.maximum(mPx09rBTrGXR - lAxNfQlc2ZMT + ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001), 8) + Gkz6B11h0Gxy, ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(11064 - 10953) + chr(0b110000), 8))
WABECtcYvOwd = sHcOKwld_2dt[:, NTEjQcyf3n_C:aVRbWzCw2Vuo, Gkz6B11h0Gxy:RmwDor39z9oL, :]
P9LKPGi8tS8m = IDJ2eXGCBCDu.reshape(WABECtcYvOwd, [ix9dZyeAmUxY, -ehT0Px3KOsy9('\060' + chr(111) + chr(1774 - 1725), 8), UEys4_lSwsID, ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49), 8)])
xafqLlk3kkUe(YJOmEcibG8C0, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\xab\x95<<\xff'), chr(0b1100100) + chr(7384 - 7283) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(116) + chr(8556 - 8454) + chr(0b11111 + 0o16) + chr(56)))(P9LKPGi8tS8m)
hM3dyw6tbF6Q = IDJ2eXGCBCDu.concat(YJOmEcibG8C0, axis=ehT0Px3KOsy9(chr(1785 - 1737) + chr(111) + chr(0b100110 + 0o15), 0b1000))
CVVq9piEfSGW = wDsB9Ho570J9(hM3dyw6tbF6Q, axis=ehT0Px3KOsy9('\x30' + chr(0b101001 + 0o106) + chr(51), 8))
return CVVq9piEfSGW
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
basic_pool
|
def basic_pool(features, max_area_width, max_area_height=1, height=1,
fn=tf.reduce_max, name=None):
"""Pools for each area based on a given pooling function (fn).
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
fn: the TF function for the pooling.
name: the namescope.
Returns:
pool_results: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
"""
with tf.name_scope(name, default_name="basic_pool"):
feature_shape = common_layers.shape_list(features)
batch_size = feature_shape[0]
length = feature_shape[-2]
depth = feature_shape[-1]
width = length // height
features_2d = tf.reshape(features, [batch_size, height, width, depth])
height_list = []
width_list = []
pool_list = []
size_tensor = tf.ones_like(features_2d[:, :, :, 0], dtype=tf.int32)
for area_height in range(max_area_height):
for area_width in range(max_area_width):
pool_tensor = _pool_one_shape(features_2d,
area_width=area_width + 1,
area_height=area_height + 1,
batch_size=batch_size,
width=width,
height=height,
depth=depth,
fn=fn)
pool_list.append(
tf.reshape(pool_tensor, [batch_size, -1, depth]))
height_list.append(
tf.reshape(
size_tensor[:, area_height:, area_width:] *\
(area_height + 1), [batch_size, -1]))
width_list.append(
tf.reshape(
size_tensor[:, area_height:, area_width:] *\
(area_width + 1), [batch_size, -1]))
pool_results = tf.concat(pool_list, axis=1)
area_heights = tf.expand_dims(tf.concat(height_list, axis=1), 2)
area_widths = tf.expand_dims(tf.concat(width_list, axis=1), 2)
return pool_results, area_heights, area_widths
|
python
|
def basic_pool(features, max_area_width, max_area_height=1, height=1,
fn=tf.reduce_max, name=None):
"""Pools for each area based on a given pooling function (fn).
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
fn: the TF function for the pooling.
name: the namescope.
Returns:
pool_results: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
"""
with tf.name_scope(name, default_name="basic_pool"):
feature_shape = common_layers.shape_list(features)
batch_size = feature_shape[0]
length = feature_shape[-2]
depth = feature_shape[-1]
width = length // height
features_2d = tf.reshape(features, [batch_size, height, width, depth])
height_list = []
width_list = []
pool_list = []
size_tensor = tf.ones_like(features_2d[:, :, :, 0], dtype=tf.int32)
for area_height in range(max_area_height):
for area_width in range(max_area_width):
pool_tensor = _pool_one_shape(features_2d,
area_width=area_width + 1,
area_height=area_height + 1,
batch_size=batch_size,
width=width,
height=height,
depth=depth,
fn=fn)
pool_list.append(
tf.reshape(pool_tensor, [batch_size, -1, depth]))
height_list.append(
tf.reshape(
size_tensor[:, area_height:, area_width:] *\
(area_height + 1), [batch_size, -1]))
width_list.append(
tf.reshape(
size_tensor[:, area_height:, area_width:] *\
(area_width + 1), [batch_size, -1]))
pool_results = tf.concat(pool_list, axis=1)
area_heights = tf.expand_dims(tf.concat(height_list, axis=1), 2)
area_widths = tf.expand_dims(tf.concat(width_list, axis=1), 2)
return pool_results, area_heights, area_widths
|
[
"def",
"basic_pool",
"(",
"features",
",",
"max_area_width",
",",
"max_area_height",
"=",
"1",
",",
"height",
"=",
"1",
",",
"fn",
"=",
"tf",
".",
"reduce_max",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"default_name",
"=",
"\"basic_pool\"",
")",
":",
"feature_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"features",
")",
"batch_size",
"=",
"feature_shape",
"[",
"0",
"]",
"length",
"=",
"feature_shape",
"[",
"-",
"2",
"]",
"depth",
"=",
"feature_shape",
"[",
"-",
"1",
"]",
"width",
"=",
"length",
"//",
"height",
"features_2d",
"=",
"tf",
".",
"reshape",
"(",
"features",
",",
"[",
"batch_size",
",",
"height",
",",
"width",
",",
"depth",
"]",
")",
"height_list",
"=",
"[",
"]",
"width_list",
"=",
"[",
"]",
"pool_list",
"=",
"[",
"]",
"size_tensor",
"=",
"tf",
".",
"ones_like",
"(",
"features_2d",
"[",
":",
",",
":",
",",
":",
",",
"0",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"for",
"area_height",
"in",
"range",
"(",
"max_area_height",
")",
":",
"for",
"area_width",
"in",
"range",
"(",
"max_area_width",
")",
":",
"pool_tensor",
"=",
"_pool_one_shape",
"(",
"features_2d",
",",
"area_width",
"=",
"area_width",
"+",
"1",
",",
"area_height",
"=",
"area_height",
"+",
"1",
",",
"batch_size",
"=",
"batch_size",
",",
"width",
"=",
"width",
",",
"height",
"=",
"height",
",",
"depth",
"=",
"depth",
",",
"fn",
"=",
"fn",
")",
"pool_list",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"pool_tensor",
",",
"[",
"batch_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
")",
"height_list",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"size_tensor",
"[",
":",
",",
"area_height",
":",
",",
"area_width",
":",
"]",
"*",
"(",
"area_height",
"+",
"1",
")",
",",
"[",
"batch_size",
",",
"-",
"1",
"]",
")",
")",
"width_list",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"size_tensor",
"[",
":",
",",
"area_height",
":",
",",
"area_width",
":",
"]",
"*",
"(",
"area_width",
"+",
"1",
")",
",",
"[",
"batch_size",
",",
"-",
"1",
"]",
")",
")",
"pool_results",
"=",
"tf",
".",
"concat",
"(",
"pool_list",
",",
"axis",
"=",
"1",
")",
"area_heights",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"concat",
"(",
"height_list",
",",
"axis",
"=",
"1",
")",
",",
"2",
")",
"area_widths",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"concat",
"(",
"width_list",
",",
"axis",
"=",
"1",
")",
",",
"2",
")",
"return",
"pool_results",
",",
"area_heights",
",",
"area_widths"
] |
Pools for each area based on a given pooling function (fn).
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
fn: the TF function for the pooling.
name: the namescope.
Returns:
pool_results: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
|
[
"Pools",
"for",
"each",
"area",
"based",
"on",
"a",
"given",
"pooling",
"function",
"(",
"fn",
")",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L78-L128
|
train
|
Basic pooling 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,RQ6C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3EEEj,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' + '\x33' + chr(0b10111 + 0o31) + chr(50), 0o10), ehT0Px3KOsy9(chr(309 - 261) + chr(0b1101111) + chr(51) + chr(220 - 172) + chr(0b10110 + 0o35), 26858 - 26850), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b101 + 0o53) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(53) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110101 + 0o72) + chr(0b101001 + 0o10) + '\064' + '\x34', 9553 - 9545), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\x33' + '\067', 44420 - 44412), ehT0Px3KOsy9(chr(48) + chr(111) + '\065' + chr(53), 51356 - 51348), ehT0Px3KOsy9('\x30' + '\157' + chr(2448 - 2397) + '\060' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(3909 - 3798) + chr(459 - 409) + chr(2016 - 1968), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(48) + chr(2184 - 2133), 32487 - 32479), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(2315 - 2261) + chr(2096 - 2042), ord("\x08")), ehT0Px3KOsy9(chr(1915 - 1867) + chr(111) + '\065' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(2180 - 2132) + chr(111) + chr(0b110111) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000001 + 0o56) + chr(50) + '\x33' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1 + 0o156) + chr(968 - 917) + chr(0b110001) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(835 - 787) + '\157' + chr(1809 - 1760) + chr(0b110111) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1173 - 1125) + chr(0b1101111) + chr(49) + chr(0b10110 + 0o36) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(800 - 748) + chr(0b110000), 62378 - 62370), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(51) + chr(0b1000 + 0o52), 0b1000), ehT0Px3KOsy9(chr(1976 - 1928) + chr(10589 - 10478) + chr(0b110111) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(2179 - 2131) + '\x6f' + chr(261 - 210) + chr(0b11110 + 0o31) + '\066', 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(0b110010) + '\x35', 0b1000), ehT0Px3KOsy9(chr(1753 - 1705) + chr(0b11101 + 0o122) + chr(1524 - 1474) + chr(0b110010) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(0b110001) + '\063' + chr(51), 0o10), ehT0Px3KOsy9(chr(140 - 92) + '\x6f' + chr(0b110011) + '\x34' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(52) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x30' + '\064', 8), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + chr(0b11000 + 0o32) + chr(1878 - 1828) + chr(0b11000 + 0o32), 9986 - 9978), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101011 + 0o10) + chr(54) + chr(0b100110 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\066', 38958 - 38950), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(51) + chr(55) + chr(2737 - 2684), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10044 - 9933) + chr(0b10111 + 0o34) + chr(49) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(1497 - 1448) + chr(0b110101) + '\x36', 62892 - 62884), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1111 + 0o45) + chr(786 - 737), 59713 - 59705), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b110100) + chr(0b110010 + 0o2), 50263 - 50255), ehT0Px3KOsy9('\x30' + chr(0b1010011 + 0o34) + chr(1121 - 1070) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1380 - 1332) + chr(0b1101111 + 0o0) + '\x32' + '\064' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + chr(0b11101 + 0o26) + chr(55) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b100100 + 0o17) + chr(55), 37653 - 37645)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + '\x35' + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xec'), chr(3478 - 3378) + chr(0b110 + 0o137) + chr(0b1010010 + 0o21) + '\157' + chr(0b1111 + 0o125) + chr(0b1001 + 0o134))('\x75' + chr(0b1110100) + '\x66' + chr(1227 - 1182) + chr(1601 - 1545)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def T3X5QZhqzXXY(EEf4r9nUvta_, u6lkO_RiLl5P, b1gSL9RXhjFx=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001), ord("\x08")), ehbUULKuygfC=ehT0Px3KOsy9('\x30' + chr(4714 - 4603) + chr(0b110001), 8), wDsB9Ho570J9=xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\xa6%\xda\x07zr\xa9q;'), '\x64' + '\x65' + chr(0b1100011) + '\x6f' + chr(7282 - 7182) + '\x65')(chr(11791 - 11674) + chr(0b1110100) + chr(102) + chr(0b1011 + 0o42) + '\x38')), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xac\xa2,\xca;lN\xab`&'), chr(100) + chr(101) + chr(0b1100011) + '\x6f' + chr(6549 - 6449) + chr(6020 - 5919))('\x75' + '\164' + chr(3632 - 3530) + chr(45) + chr(0b10101 + 0o43)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0\xa22\xc6\x07@]\xab\x7f/'), '\x64' + chr(0b1010110 + 0o17) + '\143' + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b1011101 + 0o11) + chr(0b101101) + chr(1670 - 1614))):
ayT0OkK6Ta67 = jSKPaHwSAfVv.shape_list(EEf4r9nUvta_)
ix9dZyeAmUxY = ayT0OkK6Ta67[ehT0Px3KOsy9('\060' + '\157' + '\060', 25572 - 25564)]
CHAOgk5VCHH_ = ayT0OkK6Ta67[-ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(0b110010), ord("\x08"))]
UEys4_lSwsID = ayT0OkK6Ta67[-ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', 8)]
mPx09rBTrGXR = CHAOgk5VCHH_ // ehbUULKuygfC
sHcOKwld_2dt = IDJ2eXGCBCDu.reshape(EEf4r9nUvta_, [ix9dZyeAmUxY, ehbUULKuygfC, mPx09rBTrGXR, UEys4_lSwsID])
gIerUd2aUpJo = []
m4xm4u9crSB2 = []
EfPHCBBtVqoW = []
X8ExH9RMB1Yp = IDJ2eXGCBCDu.ones_like(sHcOKwld_2dt[:, :, :, ehT0Px3KOsy9(chr(0b110000) + chr(3178 - 3067) + chr(48), 8)], dtype=IDJ2eXGCBCDu.int32)
for fWE9rdgTtw8c in vQr8gNKaIaWE(b1gSL9RXhjFx):
for lAxNfQlc2ZMT in vQr8gNKaIaWE(u6lkO_RiLl5P):
x9RK63mAPAwD = qQSJASb6pqiJ(sHcOKwld_2dt, area_width=lAxNfQlc2ZMT + ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(265 - 216), 8), area_height=fWE9rdgTtw8c + ehT0Px3KOsy9('\060' + chr(1964 - 1853) + '\x31', 8), batch_size=ix9dZyeAmUxY, width=mPx09rBTrGXR, height=ehbUULKuygfC, depth=UEys4_lSwsID, fn=wDsB9Ho570J9)
xafqLlk3kkUe(EfPHCBBtVqoW, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3\xb31\xca\n{'), chr(0b1100 + 0o130) + '\145' + chr(2286 - 2187) + '\157' + chr(100) + '\x65')(chr(117) + '\164' + chr(102) + chr(1662 - 1617) + chr(2401 - 2345)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\xa62\xc7\x05oH'), '\144' + chr(0b101011 + 0o72) + '\x63' + '\157' + chr(5374 - 5274) + chr(101))(chr(120 - 3) + '\164' + '\146' + '\x2d' + chr(0b111000)))(x9RK63mAPAwD, [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(155 - 107) + chr(111) + '\061', 8), UEys4_lSwsID]))
xafqLlk3kkUe(gIerUd2aUpJo, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3\xb31\xca\n{'), chr(0b1011 + 0o131) + '\145' + '\143' + chr(0b1101111) + '\144' + '\145')(chr(0b1110101) + chr(0b1110100) + '\146' + chr(45) + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\xa62\xc7\x05oH'), chr(319 - 219) + chr(0b1100101) + '\143' + chr(5657 - 5546) + '\144' + chr(101))(chr(0b1110101) + '\164' + '\146' + chr(1766 - 1721) + chr(0b111000)))(X8ExH9RMB1Yp[:, fWE9rdgTtw8c:, lAxNfQlc2ZMT:] * (fWE9rdgTtw8c + ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001), 8)), [ix9dZyeAmUxY, -ehT0Px3KOsy9('\060' + '\157' + '\061', 8)]))
xafqLlk3kkUe(m4xm4u9crSB2, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3\xb31\xca\n{'), chr(0b1100100) + chr(0b1100101) + chr(99) + '\x6f' + chr(0b111010 + 0o52) + chr(0b1010101 + 0o20))(chr(0b1110100 + 0o1) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\xa62\xc7\x05oH'), chr(0b1010001 + 0o23) + chr(0b1001011 + 0o32) + '\x63' + '\x6f' + '\144' + chr(6340 - 6239))(chr(0b1110101) + chr(0b111110 + 0o66) + chr(0b1010010 + 0o24) + chr(0b100100 + 0o11) + chr(56)))(X8ExH9RMB1Yp[:, fWE9rdgTtw8c:, lAxNfQlc2ZMT:] * (lAxNfQlc2ZMT + ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31', 8)), [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(48) + chr(9462 - 9351) + chr(49), 8)]))
grqu_N1HA2Mc = IDJ2eXGCBCDu.concat(EfPHCBBtVqoW, axis=ehT0Px3KOsy9('\060' + chr(1366 - 1255) + chr(0b100101 + 0o14), 8))
_Nfwwg5j5WdP = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.concat(gIerUd2aUpJo, axis=ehT0Px3KOsy9(chr(48) + '\157' + chr(606 - 557), 8)), ehT0Px3KOsy9('\x30' + chr(0b1000011 + 0o54) + chr(0b110010), 8))
dzqYfxWoPueX = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.concat(m4xm4u9crSB2, axis=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1616 - 1567), 8)), ehT0Px3KOsy9(chr(1453 - 1405) + '\x6f' + '\x32', 8))
return (grqu_N1HA2Mc, _Nfwwg5j5WdP, dzqYfxWoPueX)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
_compute_sum_image
|
def _compute_sum_image(features, max_area_width, max_area_height=1, height=1,
name=None):
"""Computes area sums for features.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
name: the namescope.
Returns:
sum_image: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
"""
with tf.name_scope(name, default_name="compute_sum_image"):
feature_shape = common_layers.shape_list(features)
batch_size = feature_shape[0]
length = feature_shape[-2]
depth = feature_shape[-1]
width = length // height
features_2d = tf.reshape(features, [batch_size, height, width, depth])
width_cum = tf.cumsum(features_2d, axis=-2, name="compute_integral_h")
integral_image = tf.cumsum(width_cum, axis=-3, name="compute_integral_v")
padded_image = tf.pad(
integral_image, [[0, 0], [1, 0], [1, 0], [0, 0]], constant_values=0)
height_list = []
width_list = []
dst_images = []
src_images_diag = []
src_images_h = []
src_images_v = []
size_tensor = tf.ones_like(padded_image[:, :, :, 0],
dtype=tf.int32)
for area_height in range(max_area_height):
for area_width in range(max_area_width):
dst_images.append(
tf.reshape(
padded_image[:, area_height + 1:, area_width + 1:, :],
[batch_size, -1, depth]))
src_images_diag.append(
tf.reshape(
padded_image[:, :-area_height - 1, :-area_width - 1, :],
[batch_size, -1, depth]))
src_images_h.append(
tf.reshape(
padded_image[:, area_height + 1:, :-area_width - 1, :],
[batch_size, -1, depth]))
src_images_v.append(
tf.reshape(
padded_image[:, :-area_height - 1, area_width + 1:, :],
[batch_size, -1, depth]))
height_list.append(
tf.reshape(
size_tensor[:, area_height + 1:, area_width + 1:] *\
(area_height + 1), [batch_size, -1]))
width_list.append(
tf.reshape(
size_tensor[:, area_height + 1:, area_width + 1:] *\
(area_width + 1), [batch_size, -1]))
sum_image = tf.subtract(
tf.concat(dst_images, axis=1) + tf.concat(src_images_diag, axis=1),
tf.concat(src_images_v, axis=1) + tf.concat(src_images_h, axis=1))
area_heights = tf.expand_dims(tf.concat(height_list, axis=1), 2)
area_widths = tf.expand_dims(tf.concat(width_list, axis=1), 2)
return sum_image, area_heights, area_widths
|
python
|
def _compute_sum_image(features, max_area_width, max_area_height=1, height=1,
name=None):
"""Computes area sums for features.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
name: the namescope.
Returns:
sum_image: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
"""
with tf.name_scope(name, default_name="compute_sum_image"):
feature_shape = common_layers.shape_list(features)
batch_size = feature_shape[0]
length = feature_shape[-2]
depth = feature_shape[-1]
width = length // height
features_2d = tf.reshape(features, [batch_size, height, width, depth])
width_cum = tf.cumsum(features_2d, axis=-2, name="compute_integral_h")
integral_image = tf.cumsum(width_cum, axis=-3, name="compute_integral_v")
padded_image = tf.pad(
integral_image, [[0, 0], [1, 0], [1, 0], [0, 0]], constant_values=0)
height_list = []
width_list = []
dst_images = []
src_images_diag = []
src_images_h = []
src_images_v = []
size_tensor = tf.ones_like(padded_image[:, :, :, 0],
dtype=tf.int32)
for area_height in range(max_area_height):
for area_width in range(max_area_width):
dst_images.append(
tf.reshape(
padded_image[:, area_height + 1:, area_width + 1:, :],
[batch_size, -1, depth]))
src_images_diag.append(
tf.reshape(
padded_image[:, :-area_height - 1, :-area_width - 1, :],
[batch_size, -1, depth]))
src_images_h.append(
tf.reshape(
padded_image[:, area_height + 1:, :-area_width - 1, :],
[batch_size, -1, depth]))
src_images_v.append(
tf.reshape(
padded_image[:, :-area_height - 1, area_width + 1:, :],
[batch_size, -1, depth]))
height_list.append(
tf.reshape(
size_tensor[:, area_height + 1:, area_width + 1:] *\
(area_height + 1), [batch_size, -1]))
width_list.append(
tf.reshape(
size_tensor[:, area_height + 1:, area_width + 1:] *\
(area_width + 1), [batch_size, -1]))
sum_image = tf.subtract(
tf.concat(dst_images, axis=1) + tf.concat(src_images_diag, axis=1),
tf.concat(src_images_v, axis=1) + tf.concat(src_images_h, axis=1))
area_heights = tf.expand_dims(tf.concat(height_list, axis=1), 2)
area_widths = tf.expand_dims(tf.concat(width_list, axis=1), 2)
return sum_image, area_heights, area_widths
|
[
"def",
"_compute_sum_image",
"(",
"features",
",",
"max_area_width",
",",
"max_area_height",
"=",
"1",
",",
"height",
"=",
"1",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"default_name",
"=",
"\"compute_sum_image\"",
")",
":",
"feature_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"features",
")",
"batch_size",
"=",
"feature_shape",
"[",
"0",
"]",
"length",
"=",
"feature_shape",
"[",
"-",
"2",
"]",
"depth",
"=",
"feature_shape",
"[",
"-",
"1",
"]",
"width",
"=",
"length",
"//",
"height",
"features_2d",
"=",
"tf",
".",
"reshape",
"(",
"features",
",",
"[",
"batch_size",
",",
"height",
",",
"width",
",",
"depth",
"]",
")",
"width_cum",
"=",
"tf",
".",
"cumsum",
"(",
"features_2d",
",",
"axis",
"=",
"-",
"2",
",",
"name",
"=",
"\"compute_integral_h\"",
")",
"integral_image",
"=",
"tf",
".",
"cumsum",
"(",
"width_cum",
",",
"axis",
"=",
"-",
"3",
",",
"name",
"=",
"\"compute_integral_v\"",
")",
"padded_image",
"=",
"tf",
".",
"pad",
"(",
"integral_image",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"1",
",",
"0",
"]",
",",
"[",
"1",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
",",
"constant_values",
"=",
"0",
")",
"height_list",
"=",
"[",
"]",
"width_list",
"=",
"[",
"]",
"dst_images",
"=",
"[",
"]",
"src_images_diag",
"=",
"[",
"]",
"src_images_h",
"=",
"[",
"]",
"src_images_v",
"=",
"[",
"]",
"size_tensor",
"=",
"tf",
".",
"ones_like",
"(",
"padded_image",
"[",
":",
",",
":",
",",
":",
",",
"0",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"for",
"area_height",
"in",
"range",
"(",
"max_area_height",
")",
":",
"for",
"area_width",
"in",
"range",
"(",
"max_area_width",
")",
":",
"dst_images",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"padded_image",
"[",
":",
",",
"area_height",
"+",
"1",
":",
",",
"area_width",
"+",
"1",
":",
",",
":",
"]",
",",
"[",
"batch_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
")",
"src_images_diag",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"padded_image",
"[",
":",
",",
":",
"-",
"area_height",
"-",
"1",
",",
":",
"-",
"area_width",
"-",
"1",
",",
":",
"]",
",",
"[",
"batch_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
")",
"src_images_h",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"padded_image",
"[",
":",
",",
"area_height",
"+",
"1",
":",
",",
":",
"-",
"area_width",
"-",
"1",
",",
":",
"]",
",",
"[",
"batch_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
")",
"src_images_v",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"padded_image",
"[",
":",
",",
":",
"-",
"area_height",
"-",
"1",
",",
"area_width",
"+",
"1",
":",
",",
":",
"]",
",",
"[",
"batch_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
")",
"height_list",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"size_tensor",
"[",
":",
",",
"area_height",
"+",
"1",
":",
",",
"area_width",
"+",
"1",
":",
"]",
"*",
"(",
"area_height",
"+",
"1",
")",
",",
"[",
"batch_size",
",",
"-",
"1",
"]",
")",
")",
"width_list",
".",
"append",
"(",
"tf",
".",
"reshape",
"(",
"size_tensor",
"[",
":",
",",
"area_height",
"+",
"1",
":",
",",
"area_width",
"+",
"1",
":",
"]",
"*",
"(",
"area_width",
"+",
"1",
")",
",",
"[",
"batch_size",
",",
"-",
"1",
"]",
")",
")",
"sum_image",
"=",
"tf",
".",
"subtract",
"(",
"tf",
".",
"concat",
"(",
"dst_images",
",",
"axis",
"=",
"1",
")",
"+",
"tf",
".",
"concat",
"(",
"src_images_diag",
",",
"axis",
"=",
"1",
")",
",",
"tf",
".",
"concat",
"(",
"src_images_v",
",",
"axis",
"=",
"1",
")",
"+",
"tf",
".",
"concat",
"(",
"src_images_h",
",",
"axis",
"=",
"1",
")",
")",
"area_heights",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"concat",
"(",
"height_list",
",",
"axis",
"=",
"1",
")",
",",
"2",
")",
"area_widths",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"concat",
"(",
"width_list",
",",
"axis",
"=",
"1",
")",
",",
"2",
")",
"return",
"sum_image",
",",
"area_heights",
",",
"area_widths"
] |
Computes area sums for features.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
name: the namescope.
Returns:
sum_image: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
|
[
"Computes",
"area",
"sums",
"for",
"features",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L131-L196
|
train
|
Computes area sums for features.
|
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,BXIwDASQ0Q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,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + '\x37', 55387 - 55379), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\061', 17382 - 17374), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100110 + 0o15) + chr(0b110000) + '\067', 9806 - 9798), ehT0Px3KOsy9(chr(142 - 94) + chr(5255 - 5144) + chr(0b110011) + chr(0b110110) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(583 - 535) + chr(111) + chr(0b11001 + 0o32) + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(444 - 390), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + chr(0b111 + 0o56) + chr(50), 32288 - 32280), ehT0Px3KOsy9('\x30' + chr(11623 - 11512) + chr(0b10001 + 0o42) + chr(0b101100 + 0o6) + chr(2120 - 2072), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + '\062' + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + '\064' + chr(0b100000 + 0o23), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2104 - 2053) + chr(55) + chr(0b100111 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + chr(0b1110 + 0o44) + '\061' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + chr(51) + chr(0b101100 + 0o12), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + '\063' + chr(0b10001 + 0o45), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b101 + 0o61) + '\x33', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10011 + 0o37) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b0 + 0o67) + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101010 + 0o11) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11101 + 0o25) + '\061' + chr(0b1100 + 0o44), 0o10), ehT0Px3KOsy9(chr(871 - 823) + '\157' + chr(1231 - 1182) + '\x35' + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x35' + '\x33', 0o10), ehT0Px3KOsy9(chr(578 - 530) + '\157' + chr(49) + chr(53) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(54) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1788 - 1740) + '\157' + chr(50) + '\x36' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b111 + 0o53) + chr(0b11111 + 0o24) + chr(0b100110 + 0o13), 43888 - 43880), ehT0Px3KOsy9(chr(2108 - 2060) + '\x6f' + chr(0b110010) + chr(1942 - 1887) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\x6f' + chr(50) + '\x37' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(55) + chr(53), 0o10), ehT0Px3KOsy9(chr(1177 - 1129) + chr(111) + '\061' + chr(1559 - 1509) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(0b110001) + '\x31', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(55) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(0b11000 + 0o33) + chr(1889 - 1836) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(775 - 727) + chr(0b1101111) + chr(50) + chr(0b110011) + '\067', 21650 - 21642), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(49) + chr(0b110110), 43860 - 43852), ehT0Px3KOsy9('\x30' + chr(0b1000111 + 0o50) + '\x37' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\063', 8), ehT0Px3KOsy9(chr(1314 - 1266) + '\157' + '\x32' + chr(48), 45848 - 45840), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(55) + '\065', 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b110100) + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b100101 + 0o17) + chr(0b10011 + 0o44), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(1030 - 977) + chr(0b110000), 7164 - 7156)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'!'), chr(1962 - 1862) + chr(9483 - 9382) + chr(0b110101 + 0o56) + chr(0b1101111) + chr(0b11001 + 0o113) + '\145')('\x75' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ObcYx2uRIALR(EEf4r9nUvta_, u6lkO_RiLl5P, b1gSL9RXhjFx=ehT0Px3KOsy9(chr(1667 - 1619) + '\x6f' + chr(2052 - 2003), 0o10), ehbUULKuygfC=ehT0Px3KOsy9(chr(48) + chr(314 - 203) + chr(1636 - 1587), 8), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'ax\xaa\x94E}I\xbfe\x06'), chr(100) + chr(0b1100101) + '\143' + chr(0b1101111) + '\144' + '\145')(chr(0b101111 + 0o106) + chr(0b1110100) + chr(102) + chr(1297 - 1252) + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'lv\xaa\x81ozO\x8ff\x16\x92\xd0ws\xd2p\x1c'), '\x64' + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(100) + chr(0b1001101 + 0o30))('\x75' + '\164' + chr(102) + '\x2d' + chr(2754 - 2698))):
ayT0OkK6Ta67 = jSKPaHwSAfVv.shape_list(EEf4r9nUvta_)
ix9dZyeAmUxY = ayT0OkK6Ta67[ehT0Px3KOsy9(chr(48) + chr(9785 - 9674) + chr(843 - 795), 0o10)]
CHAOgk5VCHH_ = ayT0OkK6Ta67[-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010), 0o10)]
UEys4_lSwsID = ayT0OkK6Ta67[-ehT0Px3KOsy9(chr(1632 - 1584) + chr(111) + chr(0b100000 + 0o21), 8)]
mPx09rBTrGXR = CHAOgk5VCHH_ // ehbUULKuygfC
sHcOKwld_2dt = IDJ2eXGCBCDu.reshape(EEf4r9nUvta_, [ix9dZyeAmUxY, ehbUULKuygfC, mPx09rBTrGXR, UEys4_lSwsID])
LRbFXZEXFdlr = IDJ2eXGCBCDu.i0lzZW3r00ue(sHcOKwld_2dt, axis=-ehT0Px3KOsy9(chr(1259 - 1211) + '\157' + '\x32', 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'lv\xaa\x81ozO\x8f|\r\x8b\xeayl\xd2{&s'), chr(0b1001111 + 0o25) + chr(101) + chr(0b1011101 + 0o6) + chr(9222 - 9111) + '\144' + chr(0b111010 + 0o53))('\165' + '\164' + chr(9233 - 9131) + chr(45) + '\070'))
ntGNpyOu92HN = IDJ2eXGCBCDu.i0lzZW3r00ue(LRbFXZEXFdlr, axis=-ehT0Px3KOsy9(chr(604 - 556) + chr(8435 - 8324) + chr(0b110011), 0o10), name=xafqLlk3kkUe(SXOLrMavuUCe(b'lv\xaa\x81ozO\x8f|\r\x8b\xeayl\xd2{&m'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\157' + '\144' + chr(101))(chr(3331 - 3214) + chr(0b100111 + 0o115) + chr(0b1100110) + '\x2d' + chr(0b110111 + 0o1)))
rj8mrKVtrDR1 = IDJ2eXGCBCDu.pad(ntGNpyOu92HN, [[ehT0Px3KOsy9(chr(1625 - 1577) + '\x6f' + '\x30', 8), ehT0Px3KOsy9(chr(48) + chr(2007 - 1896) + chr(0b110000), 8)], [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1158 - 1109), 8), ehT0Px3KOsy9('\x30' + '\157' + '\060', 8)], [ehT0Px3KOsy9(chr(641 - 593) + '\x6f' + chr(0b101111 + 0o2), 8), ehT0Px3KOsy9('\060' + chr(2763 - 2652) + chr(0b10010 + 0o36), 8)], [ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(1706 - 1595) + chr(48), 8), ehT0Px3KOsy9(chr(1487 - 1439) + chr(0b1010110 + 0o31) + chr(48), 8)]], constant_values=ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b101101 + 0o3), 8))
gIerUd2aUpJo = []
m4xm4u9crSB2 = []
Afi2oRZMf9fV = []
e63nhvrVN16d = []
SJwTlpWCAUDR = []
_YWTl4RG0Y7J = []
X8ExH9RMB1Yp = IDJ2eXGCBCDu.ones_like(rj8mrKVtrDR1[:, :, :, ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000), 8)], dtype=IDJ2eXGCBCDu.int32)
for fWE9rdgTtw8c in vQr8gNKaIaWE(b1gSL9RXhjFx):
for lAxNfQlc2ZMT in vQr8gNKaIaWE(u6lkO_RiLl5P):
xafqLlk3kkUe(Afi2oRZMf9fV, xafqLlk3kkUe(SXOLrMavuUCe(b'ni\xb7\x94tj'), '\x64' + '\x65' + chr(181 - 82) + '\157' + '\x64' + chr(101))('\x75' + chr(116) + chr(0b1100011 + 0o3) + chr(0b101101) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}|\xb4\x99{~O'), '\144' + '\145' + chr(0b1100011) + '\157' + chr(0b1100100) + '\x65')(chr(0b1000100 + 0o61) + '\164' + chr(102) + chr(45) + chr(0b11100 + 0o34)))(rj8mrKVtrDR1[:, fWE9rdgTtw8c + ehT0Px3KOsy9(chr(0b110000) + chr(8802 - 8691) + chr(0b110001), 8):, lAxNfQlc2ZMT + ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + chr(49), 8):, :], [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(0b110000) + chr(4950 - 4839) + chr(0b111 + 0o52), 8), UEys4_lSwsID]))
xafqLlk3kkUe(e63nhvrVN16d, xafqLlk3kkUe(SXOLrMavuUCe(b'ni\xb7\x94tj'), chr(0b110 + 0o136) + chr(0b1001101 + 0o30) + chr(0b1100011) + chr(111) + '\x64' + chr(9010 - 8909))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b100000 + 0o15) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}|\xb4\x99{~O'), chr(0b1001000 + 0o34) + chr(0b1010010 + 0o23) + chr(99) + '\x6f' + chr(0b1110 + 0o126) + '\145')(chr(174 - 57) + chr(6309 - 6193) + chr(3655 - 3553) + chr(0b100001 + 0o14) + chr(906 - 850)))(rj8mrKVtrDR1[:, :-fWE9rdgTtw8c - ehT0Px3KOsy9(chr(0b110000) + chr(0b111011 + 0o64) + chr(2208 - 2159), 8), :-lAxNfQlc2ZMT - ehT0Px3KOsy9(chr(1774 - 1726) + chr(111) + '\061', 8), :], [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(48) + chr(1429 - 1318) + '\x31', 8), UEys4_lSwsID]))
xafqLlk3kkUe(SJwTlpWCAUDR, xafqLlk3kkUe(SXOLrMavuUCe(b'ni\xb7\x94tj'), chr(0b1100100) + '\145' + chr(99) + chr(0b1101111) + '\x64' + chr(0b1000000 + 0o45))('\x75' + chr(116) + '\x66' + chr(0b11000 + 0o25) + chr(2598 - 2542)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}|\xb4\x99{~O'), chr(0b100001 + 0o103) + chr(2467 - 2366) + '\x63' + chr(0b1101111) + chr(4201 - 4101) + chr(0b11101 + 0o110))('\165' + '\164' + chr(0b1100110) + '\055' + chr(2890 - 2834)))(rj8mrKVtrDR1[:, fWE9rdgTtw8c + ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11111 + 0o22), 8):, :-lAxNfQlc2ZMT - ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + '\061', 8), :], [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(940 - 892) + chr(11790 - 11679) + '\x31', 8), UEys4_lSwsID]))
xafqLlk3kkUe(_YWTl4RG0Y7J, xafqLlk3kkUe(SXOLrMavuUCe(b'ni\xb7\x94tj'), '\144' + chr(7856 - 7755) + chr(0b1100011) + chr(0b1000011 + 0o54) + chr(0b1100100) + chr(0b1100101))(chr(8871 - 8754) + chr(0b10101 + 0o137) + '\x66' + chr(171 - 126) + chr(0b11110 + 0o32)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}|\xb4\x99{~O'), '\144' + chr(2505 - 2404) + chr(99) + chr(0b111100 + 0o63) + chr(4030 - 3930) + chr(0b1100101))('\165' + chr(0b1000101 + 0o57) + chr(0b110110 + 0o60) + chr(0b10100 + 0o31) + chr(0b111000)))(rj8mrKVtrDR1[:, :-fWE9rdgTtw8c - ehT0Px3KOsy9(chr(1364 - 1316) + '\157' + chr(1695 - 1646), 8), lAxNfQlc2ZMT + ehT0Px3KOsy9('\060' + chr(111) + chr(1103 - 1054), 8):, :], [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(1979 - 1931) + chr(111) + chr(0b110001 + 0o0), 8), UEys4_lSwsID]))
xafqLlk3kkUe(gIerUd2aUpJo, xafqLlk3kkUe(SXOLrMavuUCe(b'ni\xb7\x94tj'), chr(100) + chr(101) + chr(791 - 692) + '\157' + '\144' + chr(101))('\165' + '\164' + chr(0b1100110) + chr(45) + chr(687 - 631)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}|\xb4\x99{~O'), chr(1262 - 1162) + chr(3418 - 3317) + '\143' + chr(2724 - 2613) + chr(6996 - 6896) + chr(0b11101 + 0o110))(chr(117) + chr(0b1011111 + 0o25) + chr(6827 - 6725) + '\x2d' + chr(56)))(X8ExH9RMB1Yp[:, fWE9rdgTtw8c + ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1111 + 0o42), 8):, lAxNfQlc2ZMT + ehT0Px3KOsy9('\060' + chr(111) + '\061', 8):] * (fWE9rdgTtw8c + ehT0Px3KOsy9('\060' + chr(0b100101 + 0o112) + '\x31', 8)), [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + '\x31', 8)]))
xafqLlk3kkUe(m4xm4u9crSB2, xafqLlk3kkUe(SXOLrMavuUCe(b'ni\xb7\x94tj'), chr(100) + '\145' + chr(0b1100011) + '\x6f' + chr(100) + '\x65')(chr(117) + chr(116) + chr(0b10101 + 0o121) + chr(45) + chr(2522 - 2466)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'}|\xb4\x99{~O'), chr(0b1100100) + chr(0b1100101) + chr(0b111000 + 0o53) + chr(1536 - 1425) + chr(4840 - 4740) + chr(0b10100 + 0o121))(chr(9462 - 9345) + chr(0b1110100) + '\x66' + chr(45) + chr(56)))(X8ExH9RMB1Yp[:, fWE9rdgTtw8c + ehT0Px3KOsy9(chr(2245 - 2197) + chr(3088 - 2977) + '\x31', 8):, lAxNfQlc2ZMT + ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8):] * (lAxNfQlc2ZMT + ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b10011 + 0o36), 8)), [ix9dZyeAmUxY, -ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(0b110001), 8)]))
EVcNW2aYbDpd = IDJ2eXGCBCDu.subtract(IDJ2eXGCBCDu.concat(Afi2oRZMf9fV, axis=ehT0Px3KOsy9('\060' + chr(1044 - 933) + chr(49), 8)) + IDJ2eXGCBCDu.concat(e63nhvrVN16d, axis=ehT0Px3KOsy9('\x30' + chr(0b10010 + 0o135) + '\061', 8)), IDJ2eXGCBCDu.concat(_YWTl4RG0Y7J, axis=ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31', 8)) + IDJ2eXGCBCDu.concat(SJwTlpWCAUDR, axis=ehT0Px3KOsy9('\x30' + chr(0b1000001 + 0o56) + '\061', 8)))
_Nfwwg5j5WdP = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.concat(gIerUd2aUpJo, axis=ehT0Px3KOsy9(chr(48) + chr(111) + '\x31', 8)), ehT0Px3KOsy9(chr(834 - 786) + chr(1965 - 1854) + '\x32', 8))
dzqYfxWoPueX = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.concat(m4xm4u9crSB2, axis=ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), 8)), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010), 8))
return (EVcNW2aYbDpd, _Nfwwg5j5WdP, dzqYfxWoPueX)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
compute_area_features
|
def compute_area_features(features, max_area_width, max_area_height=1, height=1,
epsilon=1e-6):
"""Computes features for each area.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
epsilon: the epsilon added to the variance for computing standard deviation.
Returns:
area_mean: A Tensor of shape [batch_size, num_areas, depth]
area_std: A Tensor of shape [batch_size, num_areas, depth]
area_sum: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
"""
with tf.name_scope("compute_area_features"):
tf.logging.info("area_attention compute_area_features: %d x %d",
max_area_height, max_area_width)
area_sum, area_heights, area_widths = _compute_sum_image(
features, max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
area_squared_sum, _, _ = _compute_sum_image(
tf.pow(features, 2), max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
sizes = tf.multiply(area_heights, area_widths)
float_area_sizes = tf.to_float(sizes)
area_mean = tf.div(area_sum, float_area_sizes)
s2_n = tf.div(area_squared_sum, float_area_sizes)
area_variance = tf.subtract(s2_n, tf.pow(area_mean, 2))
area_std = tf.sqrt(tf.abs(area_variance) + epsilon)
return area_mean, area_std, area_sum, area_heights, area_widths
|
python
|
def compute_area_features(features, max_area_width, max_area_height=1, height=1,
epsilon=1e-6):
"""Computes features for each area.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
epsilon: the epsilon added to the variance for computing standard deviation.
Returns:
area_mean: A Tensor of shape [batch_size, num_areas, depth]
area_std: A Tensor of shape [batch_size, num_areas, depth]
area_sum: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
"""
with tf.name_scope("compute_area_features"):
tf.logging.info("area_attention compute_area_features: %d x %d",
max_area_height, max_area_width)
area_sum, area_heights, area_widths = _compute_sum_image(
features, max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
area_squared_sum, _, _ = _compute_sum_image(
tf.pow(features, 2), max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
sizes = tf.multiply(area_heights, area_widths)
float_area_sizes = tf.to_float(sizes)
area_mean = tf.div(area_sum, float_area_sizes)
s2_n = tf.div(area_squared_sum, float_area_sizes)
area_variance = tf.subtract(s2_n, tf.pow(area_mean, 2))
area_std = tf.sqrt(tf.abs(area_variance) + epsilon)
return area_mean, area_std, area_sum, area_heights, area_widths
|
[
"def",
"compute_area_features",
"(",
"features",
",",
"max_area_width",
",",
"max_area_height",
"=",
"1",
",",
"height",
"=",
"1",
",",
"epsilon",
"=",
"1e-6",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"compute_area_features\"",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"area_attention compute_area_features: %d x %d\"",
",",
"max_area_height",
",",
"max_area_width",
")",
"area_sum",
",",
"area_heights",
",",
"area_widths",
"=",
"_compute_sum_image",
"(",
"features",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"height",
")",
"area_squared_sum",
",",
"_",
",",
"_",
"=",
"_compute_sum_image",
"(",
"tf",
".",
"pow",
"(",
"features",
",",
"2",
")",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"height",
")",
"sizes",
"=",
"tf",
".",
"multiply",
"(",
"area_heights",
",",
"area_widths",
")",
"float_area_sizes",
"=",
"tf",
".",
"to_float",
"(",
"sizes",
")",
"area_mean",
"=",
"tf",
".",
"div",
"(",
"area_sum",
",",
"float_area_sizes",
")",
"s2_n",
"=",
"tf",
".",
"div",
"(",
"area_squared_sum",
",",
"float_area_sizes",
")",
"area_variance",
"=",
"tf",
".",
"subtract",
"(",
"s2_n",
",",
"tf",
".",
"pow",
"(",
"area_mean",
",",
"2",
")",
")",
"area_std",
"=",
"tf",
".",
"sqrt",
"(",
"tf",
".",
"abs",
"(",
"area_variance",
")",
"+",
"epsilon",
")",
"return",
"area_mean",
",",
"area_std",
",",
"area_sum",
",",
"area_heights",
",",
"area_widths"
] |
Computes features for each area.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
epsilon: the epsilon added to the variance for computing standard deviation.
Returns:
area_mean: A Tensor of shape [batch_size, num_areas, depth]
area_std: A Tensor of shape [batch_size, num_areas, depth]
area_sum: A Tensor of shape [batch_size, num_areas, depth]
area_heights: A Tensor of shape [batch_size, num_areas, 1]
area_widths: A Tensor of shape [batch_size, num_areas, 1]
|
[
"Computes",
"features",
"for",
"each",
"area",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L199-L231
|
train
|
Computes features for each area.
|
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(0b110 + 0o52) + chr(0b1101111) + '\064' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b10 + 0o64) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(0b11110 + 0o121) + chr(1155 - 1105) + chr(1280 - 1225), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(489 - 436) + chr(445 - 393), 45019 - 45011), ehT0Px3KOsy9('\060' + '\157' + chr(0b1010 + 0o47) + '\x36' + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\x31' + chr(0b110111), 64047 - 64039), ehT0Px3KOsy9('\060' + chr(0b1011000 + 0o27) + chr(0b110010) + '\063' + chr(0b110000 + 0o0), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1957 - 1906) + '\x35' + '\063', 0b1000), ehT0Px3KOsy9(chr(402 - 354) + chr(111) + '\x32' + '\x37' + chr(55), 12590 - 12582), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + chr(0b1011 + 0o50) + chr(0b1101 + 0o43) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b1010 + 0o50) + '\066', 1227 - 1219), ehT0Px3KOsy9(chr(1420 - 1372) + chr(111) + '\064' + '\x31', 0b1000), ehT0Px3KOsy9(chr(1250 - 1202) + chr(111) + chr(1188 - 1139) + '\x35' + '\063', 33191 - 33183), ehT0Px3KOsy9('\x30' + chr(0b1001101 + 0o42) + chr(0b110011) + chr(693 - 645) + chr(0b101 + 0o55), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b110 + 0o151) + '\062' + '\067' + chr(0b1001 + 0o50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(51) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(2832 - 2778) + chr(764 - 712), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110 + 0o151) + chr(0b110011) + chr(0b110111) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b1010 + 0o54) + chr(0b110000), 7957 - 7949), ehT0Px3KOsy9('\x30' + chr(0b10 + 0o155) + chr(1196 - 1146) + chr(0b10101 + 0o37) + chr(55), 0b1000), ehT0Px3KOsy9(chr(1522 - 1474) + '\157' + chr(2346 - 2292) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(4854 - 4743) + chr(2106 - 2051) + '\x30', 25664 - 25656), ehT0Px3KOsy9(chr(58 - 10) + '\157' + '\061' + chr(50) + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x37' + chr(0b1011 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + chr(0b110001) + chr(0b11001 + 0o32), 500 - 492), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(53) + chr(0b10000 + 0o43), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b111 + 0o56) + chr(51), 53966 - 53958), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11 + 0o62) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(747 - 699) + chr(0b1101111) + '\x31' + chr(0b110000) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(1381 - 1270) + '\061' + '\x33' + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b11100 + 0o123) + '\063' + '\x33' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1842 - 1794) + chr(8160 - 8049) + '\x31' + chr(1431 - 1382), 0b1000), ehT0Px3KOsy9('\x30' + chr(6007 - 5896) + chr(0b1100 + 0o47) + '\x36' + chr(562 - 511), 0o10), ehT0Px3KOsy9('\x30' + chr(8231 - 8120) + '\062' + chr(647 - 595) + '\x34', 43822 - 43814), ehT0Px3KOsy9(chr(1871 - 1823) + chr(111) + '\061' + chr(50) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(130 - 81) + chr(51), 5870 - 5862), ehT0Px3KOsy9(chr(1192 - 1144) + chr(111) + chr(0b110001) + chr(0b110101) + '\066', 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + '\063' + chr(0b110100) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b101010 + 0o6), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(2418 - 2365) + chr(0b10101 + 0o33), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\t'), chr(100) + chr(101) + chr(99) + chr(111) + '\x64' + '\145')(chr(0b1110101) + chr(116) + '\x66' + chr(1460 - 1415) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def fPRF4fLu_Nsl(EEf4r9nUvta_, u6lkO_RiLl5P, b1gSL9RXhjFx=ehT0Px3KOsy9(chr(820 - 772) + chr(111) + '\x31', ord("\x08")), ehbUULKuygfC=ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(1519 - 1470), 8), Xtig2zAKpR0T=1e-06):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'I\x93z\x89*\xbc\xfb\x84\xcf\xa7'), '\144' + chr(7547 - 7446) + chr(99) + '\x6f' + '\144' + chr(7382 - 7281))(chr(2411 - 2294) + '\164' + '\146' + chr(1601 - 1556) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'D\x9dz\x9c\x00\xbb\xfd\xb4\xde\xb03@4\xa4\xdc\xfa\x00\x8a\x82\xc2D'), chr(100) + chr(8494 - 8393) + chr(99) + chr(0b10101 + 0o132) + chr(0b1100100 + 0o0) + chr(7281 - 7180))(chr(117) + '\164' + chr(0b1100110) + chr(45) + chr(0b111000))):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b't\xc5_\x94\x00\xac\xff\xdc\xd5\xae\x0cJ'), '\x64' + chr(6086 - 5985) + '\x63' + chr(0b111000 + 0o67) + '\x64' + '\x65')('\x75' + chr(0b1110100) + '\146' + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'F\x80r\x8d*\xae\xec\x9f\xda\xac"H\x04\xac\x99\xf8\x1b\x92\x80\xd2C]\x0b^y\xcewtL!;\xab|\x81\xc1!\xb1N\xc1|\x07\x8a7\xc9\x11'), '\144' + '\x65' + '\143' + '\157' + '\144' + chr(0b1100101))(chr(117) + '\x74' + '\x66' + '\x2d' + '\x38'), b1gSL9RXhjFx, u6lkO_RiLl5P)
(VkDBB_Kz6QTP, _Nfwwg5j5WdP, dzqYfxWoPueX) = ObcYx2uRIALR(EEf4r9nUvta_, max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=ehbUULKuygfC)
(zeVHQM6nIcQx, VNGQdHSFPrso, VNGQdHSFPrso) = ObcYx2uRIALR(IDJ2eXGCBCDu.pow(EEf4r9nUvta_, ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + chr(50), 60353 - 60345)), max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=ehbUULKuygfC)
Q55tUpoH0W5L = IDJ2eXGCBCDu.multiply(_Nfwwg5j5WdP, dzqYfxWoPueX)
KPxUlceC5mfv = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(Q55tUpoH0W5L)
APGjhNr_nach = IDJ2eXGCBCDu.div(VkDBB_Kz6QTP, KPxUlceC5mfv)
u2wWeYaqpAxH = IDJ2eXGCBCDu.div(zeVHQM6nIcQx, KPxUlceC5mfv)
JUMc4n0lOFuq = IDJ2eXGCBCDu.subtract(u2wWeYaqpAxH, IDJ2eXGCBCDu.pow(APGjhNr_nach, ehT0Px3KOsy9(chr(224 - 176) + chr(10733 - 10622) + '\062', 8)))
WwTEx5bz1TA5 = IDJ2eXGCBCDu.sqrt(IDJ2eXGCBCDu.abs(JUMc4n0lOFuq) + Xtig2zAKpR0T)
return (APGjhNr_nach, WwTEx5bz1TA5, VkDBB_Kz6QTP, _Nfwwg5j5WdP, dzqYfxWoPueX)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
compute_area_key
|
def compute_area_key(features, max_area_width, max_area_height=1, height=1,
mode="mean", training=True, name=None):
"""Computes the key for each area.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
mode: whether to combine different area features or only use
the vector mean of each area, which can be "mean", "concat", "sum",
"sample_concat", and "sample_sum".
training: indicating if it is in the training mode.
name: the name for setting the variable scope.
Returns:
area_key: a Tensor in the shape of [batch_size, num_areas, depth]
"""
tf.logging.info("area_attention mode=%s", mode)
area_mean, area_std, _, area_heights, area_widths =\
compute_area_features(features, max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
if mode == "mean":
return area_mean
elif mode == "max":
area_max, _, _ = basic_pool(features, max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
return area_max
elif mode == "sample":
if training:
area_mean += (area_std * tf.random_normal(tf.shape(area_std)))
return area_mean
with tf.variable_scope(
name, default_name="combine_area_features",
values=[area_mean, area_std, area_heights, area_widths]):
depth = common_layers.shape_list(area_mean)[-1]
height_embed = tf.nn.embedding_lookup(
params=tf.get_variable("area_height_emb",
[max_area_height, depth // 2]),
ids=area_heights[:, :, 0] - 1)
width_embed = tf.nn.embedding_lookup(
params=tf.get_variable("area_width_emb",
[max_area_width, depth // 2]),
ids=area_widths[:, :, 0] - 1)
size_embed = tf.concat([height_embed, width_embed], -1)
if mode == "concat":
feature_concat = tf.concat([area_mean, area_std, size_embed], -1)
elif mode == "max_concat":
area_max, _, _ = basic_pool(features, max_area_width=max_area_width,
max_area_height=max_area_height,
height=height)
feature_concat = tf.concat([area_max, size_embed], -1)
elif mode == "sum":
feature_concat = size_embed + area_mean + area_std
elif mode == "sample_concat":
if training:
area_mean += (area_std * tf.random_normal(tf.shape(area_std)))
feature_concat = tf.concat([area_mean, size_embed], -1)
elif mode == "sample_sum":
if training:
area_mean += (area_std * tf.random_normal(tf.shape(area_std)))
feature_concat = area_mean + size_embed
else:
raise ValueError("Unsupported area key mode=%s" % mode)
feature_hidden = tf.layers.dense(inputs=feature_concat,
units=depth,
activation=tf.nn.relu)
area_key = tf.layers.dense(feature_hidden, units=depth)
return area_key
|
python
|
def compute_area_key(features, max_area_width, max_area_height=1, height=1,
mode="mean", training=True, name=None):
"""Computes the key for each area.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
mode: whether to combine different area features or only use
the vector mean of each area, which can be "mean", "concat", "sum",
"sample_concat", and "sample_sum".
training: indicating if it is in the training mode.
name: the name for setting the variable scope.
Returns:
area_key: a Tensor in the shape of [batch_size, num_areas, depth]
"""
tf.logging.info("area_attention mode=%s", mode)
area_mean, area_std, _, area_heights, area_widths =\
compute_area_features(features, max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
if mode == "mean":
return area_mean
elif mode == "max":
area_max, _, _ = basic_pool(features, max_area_width=max_area_width,
max_area_height=max_area_height, height=height)
return area_max
elif mode == "sample":
if training:
area_mean += (area_std * tf.random_normal(tf.shape(area_std)))
return area_mean
with tf.variable_scope(
name, default_name="combine_area_features",
values=[area_mean, area_std, area_heights, area_widths]):
depth = common_layers.shape_list(area_mean)[-1]
height_embed = tf.nn.embedding_lookup(
params=tf.get_variable("area_height_emb",
[max_area_height, depth // 2]),
ids=area_heights[:, :, 0] - 1)
width_embed = tf.nn.embedding_lookup(
params=tf.get_variable("area_width_emb",
[max_area_width, depth // 2]),
ids=area_widths[:, :, 0] - 1)
size_embed = tf.concat([height_embed, width_embed], -1)
if mode == "concat":
feature_concat = tf.concat([area_mean, area_std, size_embed], -1)
elif mode == "max_concat":
area_max, _, _ = basic_pool(features, max_area_width=max_area_width,
max_area_height=max_area_height,
height=height)
feature_concat = tf.concat([area_max, size_embed], -1)
elif mode == "sum":
feature_concat = size_embed + area_mean + area_std
elif mode == "sample_concat":
if training:
area_mean += (area_std * tf.random_normal(tf.shape(area_std)))
feature_concat = tf.concat([area_mean, size_embed], -1)
elif mode == "sample_sum":
if training:
area_mean += (area_std * tf.random_normal(tf.shape(area_std)))
feature_concat = area_mean + size_embed
else:
raise ValueError("Unsupported area key mode=%s" % mode)
feature_hidden = tf.layers.dense(inputs=feature_concat,
units=depth,
activation=tf.nn.relu)
area_key = tf.layers.dense(feature_hidden, units=depth)
return area_key
|
[
"def",
"compute_area_key",
"(",
"features",
",",
"max_area_width",
",",
"max_area_height",
"=",
"1",
",",
"height",
"=",
"1",
",",
"mode",
"=",
"\"mean\"",
",",
"training",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"area_attention mode=%s\"",
",",
"mode",
")",
"area_mean",
",",
"area_std",
",",
"_",
",",
"area_heights",
",",
"area_widths",
"=",
"compute_area_features",
"(",
"features",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"height",
")",
"if",
"mode",
"==",
"\"mean\"",
":",
"return",
"area_mean",
"elif",
"mode",
"==",
"\"max\"",
":",
"area_max",
",",
"_",
",",
"_",
"=",
"basic_pool",
"(",
"features",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"height",
")",
"return",
"area_max",
"elif",
"mode",
"==",
"\"sample\"",
":",
"if",
"training",
":",
"area_mean",
"+=",
"(",
"area_std",
"*",
"tf",
".",
"random_normal",
"(",
"tf",
".",
"shape",
"(",
"area_std",
")",
")",
")",
"return",
"area_mean",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"combine_area_features\"",
",",
"values",
"=",
"[",
"area_mean",
",",
"area_std",
",",
"area_heights",
",",
"area_widths",
"]",
")",
":",
"depth",
"=",
"common_layers",
".",
"shape_list",
"(",
"area_mean",
")",
"[",
"-",
"1",
"]",
"height_embed",
"=",
"tf",
".",
"nn",
".",
"embedding_lookup",
"(",
"params",
"=",
"tf",
".",
"get_variable",
"(",
"\"area_height_emb\"",
",",
"[",
"max_area_height",
",",
"depth",
"//",
"2",
"]",
")",
",",
"ids",
"=",
"area_heights",
"[",
":",
",",
":",
",",
"0",
"]",
"-",
"1",
")",
"width_embed",
"=",
"tf",
".",
"nn",
".",
"embedding_lookup",
"(",
"params",
"=",
"tf",
".",
"get_variable",
"(",
"\"area_width_emb\"",
",",
"[",
"max_area_width",
",",
"depth",
"//",
"2",
"]",
")",
",",
"ids",
"=",
"area_widths",
"[",
":",
",",
":",
",",
"0",
"]",
"-",
"1",
")",
"size_embed",
"=",
"tf",
".",
"concat",
"(",
"[",
"height_embed",
",",
"width_embed",
"]",
",",
"-",
"1",
")",
"if",
"mode",
"==",
"\"concat\"",
":",
"feature_concat",
"=",
"tf",
".",
"concat",
"(",
"[",
"area_mean",
",",
"area_std",
",",
"size_embed",
"]",
",",
"-",
"1",
")",
"elif",
"mode",
"==",
"\"max_concat\"",
":",
"area_max",
",",
"_",
",",
"_",
"=",
"basic_pool",
"(",
"features",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"height",
")",
"feature_concat",
"=",
"tf",
".",
"concat",
"(",
"[",
"area_max",
",",
"size_embed",
"]",
",",
"-",
"1",
")",
"elif",
"mode",
"==",
"\"sum\"",
":",
"feature_concat",
"=",
"size_embed",
"+",
"area_mean",
"+",
"area_std",
"elif",
"mode",
"==",
"\"sample_concat\"",
":",
"if",
"training",
":",
"area_mean",
"+=",
"(",
"area_std",
"*",
"tf",
".",
"random_normal",
"(",
"tf",
".",
"shape",
"(",
"area_std",
")",
")",
")",
"feature_concat",
"=",
"tf",
".",
"concat",
"(",
"[",
"area_mean",
",",
"size_embed",
"]",
",",
"-",
"1",
")",
"elif",
"mode",
"==",
"\"sample_sum\"",
":",
"if",
"training",
":",
"area_mean",
"+=",
"(",
"area_std",
"*",
"tf",
".",
"random_normal",
"(",
"tf",
".",
"shape",
"(",
"area_std",
")",
")",
")",
"feature_concat",
"=",
"area_mean",
"+",
"size_embed",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unsupported area key mode=%s\"",
"%",
"mode",
")",
"feature_hidden",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"inputs",
"=",
"feature_concat",
",",
"units",
"=",
"depth",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
")",
"area_key",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"feature_hidden",
",",
"units",
"=",
"depth",
")",
"return",
"area_key"
] |
Computes the key for each area.
Args:
features: a Tensor in a shape of [batch_size, height * width, depth].
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
height: the height of the image.
mode: whether to combine different area features or only use
the vector mean of each area, which can be "mean", "concat", "sum",
"sample_concat", and "sample_sum".
training: indicating if it is in the training mode.
name: the name for setting the variable scope.
Returns:
area_key: a Tensor in the shape of [batch_size, num_areas, depth]
|
[
"Computes",
"the",
"key",
"for",
"each",
"area",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L234-L302
|
train
|
Computes the key for each area.
|
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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Ty8rYcwji,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' + '\061' + '\065' + chr(2522 - 2467), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(0b10100 + 0o37) + chr(1019 - 969) + chr(0b1011 + 0o45), 23228 - 23220), ehT0Px3KOsy9(chr(48) + chr(0b10010 + 0o135) + chr(0b111 + 0o52) + chr(53) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(1201 - 1153) + '\x6f' + chr(50) + chr(208 - 153) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b100010 + 0o20) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + '\x35' + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\064' + chr(412 - 362), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(53) + '\061', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b1101 + 0o46) + '\062', 20372 - 20364), ehT0Px3KOsy9('\060' + chr(1510 - 1399) + chr(0b110100) + '\067', 0o10), ehT0Px3KOsy9(chr(2186 - 2138) + chr(8092 - 7981) + chr(2043 - 1994) + chr(0b110100) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(694 - 646) + chr(111) + '\x32' + '\063' + chr(0b110001), 15698 - 15690), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + '\062' + chr(1179 - 1130) + '\x31', 9859 - 9851), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b110010) + chr(0b101111 + 0o3) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x31' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(371 - 323) + chr(0b1101000 + 0o7) + '\x31' + chr(0b100001 + 0o23) + '\x31', 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(7333 - 7222) + '\x32' + chr(50) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36' + chr(1699 - 1651), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11010 + 0o30) + chr(0b110100), 35859 - 35851), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2005 - 1956) + chr(0b110111) + chr(2583 - 2531), 0o10), ehT0Px3KOsy9(chr(1632 - 1584) + '\x6f' + chr(49) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1086 - 1038) + '\x6f' + '\x33' + '\061' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(50) + '\x32' + chr(0b11110 + 0o26), 33364 - 33356), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b110001 + 0o76) + chr(1537 - 1487) + chr(0b110000) + '\x33', 8561 - 8553), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(2084 - 2033) + chr(0b110001), 8), ehT0Px3KOsy9('\060' + chr(0b1111 + 0o140) + '\062' + chr(49) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b110011) + chr(48), 18697 - 18689), ehT0Px3KOsy9(chr(1857 - 1809) + chr(111) + '\x31' + chr(0b110000) + chr(0b1111 + 0o45), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(94 - 45) + chr(49) + '\066', 64129 - 64121), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\x37' + chr(0b11010 + 0o31), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(0b110100 + 0o3) + '\060', 20924 - 20916), ehT0Px3KOsy9('\060' + '\157' + chr(0b11100 + 0o26) + chr(0b11111 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(1488 - 1440) + chr(0b1001110 + 0o41) + chr(0b110010) + chr(1411 - 1362) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(2219 - 2170) + chr(0b110 + 0o57) + chr(55), 8), ehT0Px3KOsy9(chr(1438 - 1390) + '\157' + chr(50) + chr(0b110001) + '\x37', 8), ehT0Px3KOsy9(chr(1733 - 1685) + '\157' + '\063' + '\065' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(11308 - 11197) + chr(50) + chr(53) + chr(0b0 + 0o66), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10111 + 0o33) + chr(1062 - 1010) + '\x33', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b101100 + 0o11) + chr(1409 - 1361), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'A'), chr(6082 - 5982) + chr(101) + chr(9562 - 9463) + chr(4348 - 4237) + chr(0b110101 + 0o57) + chr(0b1100101))('\165' + chr(0b111001 + 0o73) + chr(0b101100 + 0o72) + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ANvSqnAE11FV(EEf4r9nUvta_, u6lkO_RiLl5P, b1gSL9RXhjFx=ehT0Px3KOsy9('\060' + '\157' + chr(0b11010 + 0o27), 36276 - 36268), ehbUULKuygfC=ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(49), 8), holLFgwB7vsP=xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xb5\x08\xd2'), chr(100) + '\145' + chr(0b101 + 0o136) + '\157' + chr(0b1100100) + '\145')(chr(958 - 841) + '\164' + chr(0b1100110) + chr(0b0 + 0o55) + chr(0b11101 + 0o33)), H15mhcYcioqz=ehT0Px3KOsy9(chr(0b110000) + chr(2082 - 1971) + chr(1647 - 1598), 8), AIvJRzLdDfgF=None):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'<\xe7!\xc4\xa6\xcd\x85\x9e\xf0K;\xf2'), '\x64' + chr(7423 - 7322) + '\143' + '\x6f' + '\x64' + '\x65')('\165' + chr(0b1011101 + 0o27) + chr(0b1100110) + chr(805 - 760) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\xa2\x0c\xdd\x8c\xcf\x96\xdd\xffI\x15\xf0\xe6\xf9\xeb\x0cs\xf5U>1\x0f'), chr(0b1100100) + '\x65' + chr(0b10 + 0o141) + chr(111) + '\x64' + chr(113 - 12))(chr(0b1001001 + 0o54) + '\x74' + '\x66' + chr(0b101101) + '\x38'), holLFgwB7vsP)
(APGjhNr_nach, WwTEx5bz1TA5, VNGQdHSFPrso, _Nfwwg5j5WdP, dzqYfxWoPueX) = fPRF4fLu_Nsl(EEf4r9nUvta_, max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=ehbUULKuygfC)
if holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xb5\x08\xd2'), '\144' + chr(0b10100 + 0o121) + '\x63' + '\x6f' + chr(100) + chr(101))('\165' + chr(7242 - 7126) + chr(0b1100110) + chr(0b1 + 0o54) + '\x38'):
return APGjhNr_nach
elif holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xb1\x11'), chr(0b1000 + 0o134) + '\145' + chr(0b1100011) + chr(0b11100 + 0o123) + chr(9015 - 8915) + chr(3474 - 3373))('\x75' + chr(10134 - 10018) + chr(6561 - 6459) + chr(0b101101) + chr(56)):
(YHKKYSkdSaoJ, VNGQdHSFPrso, VNGQdHSFPrso) = T3X5QZhqzXXY(EEf4r9nUvta_, max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=ehbUULKuygfC)
return YHKKYSkdSaoJ
elif holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xb1\x04\xcc\xbf\xcb'), '\x64' + '\145' + chr(99) + '\157' + chr(100) + chr(8380 - 8279))('\165' + chr(116) + '\146' + chr(45) + chr(0b100011 + 0o25)):
if H15mhcYcioqz:
APGjhNr_nach += WwTEx5bz1TA5 * IDJ2eXGCBCDu.random_normal(IDJ2eXGCBCDu.nauYfLglTpcb(WwTEx5bz1TA5))
return APGjhNr_nach
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x19\xb1\x1b\xd5\xb2\xcc\x8e\xcc\xc5T\x02\xf6\xf9\xf2'), chr(100) + chr(0b1100101) + chr(0b100101 + 0o76) + chr(0b1100011 + 0o14) + chr(100) + '\145')(chr(3423 - 3306) + '\164' + chr(6190 - 6088) + chr(0b101101) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c\xbf\x04\xde\xba\xc0\x87\xf6\xfbU\x04\xf8\xd6\xf1\xae\x00h\xe4Bfg'), '\144' + '\145' + '\143' + chr(0b100111 + 0o110) + '\144' + chr(0b1100101))(chr(0b1001000 + 0o55) + chr(0b1110100) + '\146' + chr(0b101101) + chr(56)), values=[APGjhNr_nach, WwTEx5bz1TA5, _Nfwwg5j5WdP, dzqYfxWoPueX]):
UEys4_lSwsID = jSKPaHwSAfVv.shape_list(APGjhNr_nach)[-ehT0Px3KOsy9('\060' + '\x6f' + '\x31', 8)]
wNOmJOJjz0Kj = IDJ2eXGCBCDu.nn.embedding_lookup(params=IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\xa2\x0c\xdd\x8c\xc6\x87\xc0\xfdO\x15\xc6\xec\xfa\xa9'), chr(0b1100100) + chr(0b1100101) + chr(0b11100 + 0o107) + '\x6f' + chr(7109 - 7009) + '\145')(chr(117) + '\x74' + '\146' + chr(0b101000 + 0o5) + '\070'), [b1gSL9RXhjFx, UEys4_lSwsID // ehT0Px3KOsy9(chr(48) + chr(111) + '\062', 10906 - 10898)]), ids=_Nfwwg5j5WdP[:, :, ehT0Px3KOsy9(chr(48) + chr(4621 - 4510) + chr(0b1011 + 0o45), ord("\x08"))] - ehT0Px3KOsy9(chr(2016 - 1968) + chr(0b1101111) + chr(0b1 + 0o60), 8))
aTmgDDIrxdn5 = IDJ2eXGCBCDu.nn.embedding_lookup(params=IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\xa2\x0c\xdd\x8c\xd9\x8b\xcd\xeeO>\xfc\xe4\xf5'), chr(100) + '\x65' + '\143' + chr(111) + chr(9139 - 9039) + chr(0b1100101))(chr(117) + '\x74' + chr(0b1100100 + 0o2) + '\055' + '\070'), [u6lkO_RiLl5P, UEys4_lSwsID // ehT0Px3KOsy9('\x30' + chr(111) + chr(2303 - 2253), 8)]), ids=dzqYfxWoPueX[:, :, ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + '\x30', 8)] - ehT0Px3KOsy9(chr(1280 - 1232) + chr(1915 - 1804) + chr(0b110001), 8))
WPeZYgan7LRM = IDJ2eXGCBCDu.concat([wNOmJOJjz0Kj, aTmgDDIrxdn5], -ehT0Px3KOsy9('\060' + chr(0b11 + 0o154) + '\x31', 8))
if holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c\xbf\x07\xdf\xb2\xda'), chr(100) + chr(0b1100101) + '\143' + chr(0b11011 + 0o124) + chr(2706 - 2606) + chr(101))('\165' + chr(0b1010001 + 0o43) + chr(0b11010 + 0o114) + chr(122 - 77) + '\x38'):
cA52N7B0kgFq = IDJ2eXGCBCDu.concat([APGjhNr_nach, WwTEx5bz1TA5, WPeZYgan7LRM], -ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(0b11100 + 0o25), 8))
elif holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xb1\x11\xe3\xb0\xc1\x8c\xca\xfbS'), chr(0b11100 + 0o110) + chr(4176 - 4075) + '\143' + '\x6f' + chr(0b111 + 0o135) + chr(0b1100101))(chr(0b1001001 + 0o54) + '\x74' + chr(0b10110 + 0o120) + '\055' + '\x38'):
(YHKKYSkdSaoJ, VNGQdHSFPrso, VNGQdHSFPrso) = T3X5QZhqzXXY(EEf4r9nUvta_, max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=ehbUULKuygfC)
cA52N7B0kgFq = IDJ2eXGCBCDu.concat([YHKKYSkdSaoJ, WPeZYgan7LRM], -ehT0Px3KOsy9(chr(0b110000) + chr(5932 - 5821) + '\061', 8))
elif holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xa5\x04'), chr(0b10101 + 0o117) + chr(0b10011 + 0o122) + chr(8426 - 8327) + '\x6f' + chr(9488 - 9388) + chr(9429 - 9328))(chr(0b1110101) + '\164' + chr(102) + chr(1095 - 1050) + chr(56)):
cA52N7B0kgFq = WPeZYgan7LRM + APGjhNr_nach + WwTEx5bz1TA5
elif holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xb1\x04\xcc\xbf\xcb\xbd\xca\xf5I\x02\xf8\xfd'), '\x64' + '\x65' + chr(0b1100011) + '\157' + '\144' + chr(3694 - 3593))(chr(117) + chr(116) + chr(7025 - 6923) + chr(0b10000 + 0o35) + chr(0b111000)):
if H15mhcYcioqz:
APGjhNr_nach += WwTEx5bz1TA5 * IDJ2eXGCBCDu.random_normal(IDJ2eXGCBCDu.nauYfLglTpcb(WwTEx5bz1TA5))
cA52N7B0kgFq = IDJ2eXGCBCDu.concat([APGjhNr_nach, WPeZYgan7LRM], -ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(49), 8))
elif holLFgwB7vsP == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\xb1\x04\xcc\xbf\xcb\xbd\xda\xefJ'), chr(100) + chr(0b1100101) + chr(4956 - 4857) + chr(111) + chr(0b1100100) + chr(101))('\x75' + chr(0b100010 + 0o122) + chr(0b100010 + 0o104) + chr(919 - 874) + '\070'):
if H15mhcYcioqz:
APGjhNr_nach += WwTEx5bz1TA5 * IDJ2eXGCBCDu.random_normal(IDJ2eXGCBCDu.nauYfLglTpcb(WwTEx5bz1TA5))
cA52N7B0kgFq = APGjhNr_nach + WPeZYgan7LRM
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b':\xbe\x1a\xc9\xa3\xde\x8d\xdb\xeeB\x05\xb9\xe8\xe5\xae\x00<\xfaUz4\x11`\xab\xf1\xbe\xbc\xfe'), chr(100) + chr(0b11111 + 0o106) + chr(0b1100011) + chr(0b1101111) + chr(6725 - 6625) + '\x65')(chr(117) + chr(0b100110 + 0o116) + chr(0b110 + 0o140) + chr(0b1111 + 0o36) + '\x38') % holLFgwB7vsP)
qhPD03GCsJYQ = IDJ2eXGCBCDu.layers.dense(inputs=cA52N7B0kgFq, units=UEys4_lSwsID, activation=IDJ2eXGCBCDu.nn.relu)
HE43BqRxDTij = IDJ2eXGCBCDu.layers.dense(qhPD03GCsJYQ, units=UEys4_lSwsID)
return HE43BqRxDTij
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/area_attention.py
|
dot_product_area_attention
|
def dot_product_area_attention(q,
k,
v,
bias,
dropout_rate=0.0,
image_shapes=None,
name=None,
attention_image_summary=None,
save_weights_to=None,
dropout_broadcast_dims=None,
max_area_width=1,
max_area_height=1,
memory_height=1,
area_key_mode="mean",
area_value_mode="sum",
top_k_areas=0,
area_temperature=1.0,
training=True):
"""Dot-product area attention.
Args:
q: Tensor with shape [..., length_q, depth_k].
k: Tensor with shape [..., length_kv, depth_k]. Leading dimensions must
match with q.
v: Tensor with shape [..., length_kv, depth_v] Leading dimensions must
match with q.
bias: bias Tensor (see attention_bias())
dropout_rate: a float.
image_shapes: optional tuple of integer scalars.
see comments for attention_image_summary()
name: an optional string
attention_image_summary: the callback for making image summary of attention.
save_weights_to: an optional dictionary to capture attention weights
for visualization; the weights tensor will be appended there under
a string key created from the variable scope (including name).
dropout_broadcast_dims: an optional list of integers less than rank of q.
Specifies in which dimensions to broadcast the dropout decisions.
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
memory_height: the height of the memory.
area_key_mode: the mode for computing area keys, which can be "mean",
"concat", "sum", "sample_concat", and "sample_sum".
area_value_mode: the mode for computing area values, which can be either
"mean", or "sum".
top_k_areas: Use the top key areas for attention.
area_temperature: the temperature for attention softmax.
training: indicating if it is in the training mode.
Returns:
Tensor with shape [..., length_q, depth_v].
"""
tf.logging.info("dot_product_area_attention: "
"area_h=%d, area_w=%d, mem_h=%d, "
"area_key_mode=%s, area_value_mode=%s, "
"area_temperature=%f",
max_area_height, max_area_width, memory_height,
area_key_mode, area_value_mode,
area_temperature)
with tf.variable_scope(
name, default_name="dot_product_area_attention",
values=[q, k, v]) as scope:
mem_shape = common_layers.shape_list(k)
batch_size = mem_shape[0]
head_size = mem_shape[1]
length = mem_shape[2]
depth = mem_shape[3]
k_area = compute_area_key(
tf.reshape(k, [-1, length, depth]),
max_area_width=max_area_width,
max_area_height=max_area_height,
height=memory_height,
mode=area_key_mode,
training=training)
if area_value_mode == "mean":
v_area, _, _, _, _ = compute_area_features(
tf.reshape(v, [-1, length, depth]), max_area_width=max_area_width,
max_area_height=max_area_height, height=memory_height)
elif area_value_mode == "max":
v_area, _, _ = basic_pool(tf.reshape(v, [-1, length, depth]),
max_area_width=max_area_width,
max_area_height=max_area_height,
height=memory_height,
fn=tf.reduce_max)
elif area_value_mode == "sum":
_, _, v_area, _, _ = compute_area_features(
tf.reshape(v, [-1, length, depth]), max_area_width=max_area_width,
max_area_height=max_area_height, height=memory_height)
else:
raise ValueError("Unsupported area value mode=%s" % area_value_mode)
k = tf.reshape(k_area, [batch_size, head_size, -1, depth])
v = tf.reshape(v_area, [batch_size, head_size, -1, depth])
logits = tf.matmul(q, k, transpose_b=True) # [..., length_q, length_kv]
if bias is not None:
bias = common_layers.cast_like(bias, logits)
with tf.name_scope("compute_area_att_bias", values=[bias]):
bias_shape = common_layers.shape_list(bias)
mem_length = bias_shape[-1]
bias_values = tf.reshape(
tf.to_float(tf.less(bias, -1)), [-1, mem_length, 1])
_, _, padding_sum, _, _ = compute_area_features(
bias_values, max_area_width=max_area_width,
max_area_height=max_area_height, height=memory_height)
bias = tf.where(
tf.cast(tf.to_int32(padding_sum), tf.bool),
tf.fill(tf.shape(padding_sum), -np.inf),
tf.zeros_like(padding_sum, dtype=tf.float32))
bias = tf.reshape(bias,
[bias_shape[0], bias_shape[1],
bias_shape[2], -1])
logits += bias
logits = logits / area_temperature
weights = tf.nn.softmax(logits, name="attention_weights")
if top_k_areas > 0:
tf.logging.info("area_attention top_k_areas=%d", top_k_areas)
top_k = tf.minimum(common_layers.shape_list(weights)[-1], top_k_areas)
top_weights, _ = tf.nn.top_k(weights, k=top_k)
min_values = tf.reduce_min(top_weights, -1, keepdims=True)
weights = tf.where(tf.greater_equal(weights, min_values),
weights, tf.zeros_like(weights))
weights = tf.div(weights, tf.reduce_sum(weights, -1, keepdims=True))
if save_weights_to is not None:
save_weights_to[scope.name] = weights
save_weights_to[scope.name + "/logits"] = logits
# Drop out attention links for each head.
weights = common_layers.dropout_with_broadcast_dims(
weights, 1.0 - dropout_rate, broadcast_dims=dropout_broadcast_dims)
if common_layers.should_generate_summaries() and attention_image_summary:
attention_image_summary(weights, image_shapes)
return tf.matmul(weights, v)
|
python
|
def dot_product_area_attention(q,
k,
v,
bias,
dropout_rate=0.0,
image_shapes=None,
name=None,
attention_image_summary=None,
save_weights_to=None,
dropout_broadcast_dims=None,
max_area_width=1,
max_area_height=1,
memory_height=1,
area_key_mode="mean",
area_value_mode="sum",
top_k_areas=0,
area_temperature=1.0,
training=True):
"""Dot-product area attention.
Args:
q: Tensor with shape [..., length_q, depth_k].
k: Tensor with shape [..., length_kv, depth_k]. Leading dimensions must
match with q.
v: Tensor with shape [..., length_kv, depth_v] Leading dimensions must
match with q.
bias: bias Tensor (see attention_bias())
dropout_rate: a float.
image_shapes: optional tuple of integer scalars.
see comments for attention_image_summary()
name: an optional string
attention_image_summary: the callback for making image summary of attention.
save_weights_to: an optional dictionary to capture attention weights
for visualization; the weights tensor will be appended there under
a string key created from the variable scope (including name).
dropout_broadcast_dims: an optional list of integers less than rank of q.
Specifies in which dimensions to broadcast the dropout decisions.
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
memory_height: the height of the memory.
area_key_mode: the mode for computing area keys, which can be "mean",
"concat", "sum", "sample_concat", and "sample_sum".
area_value_mode: the mode for computing area values, which can be either
"mean", or "sum".
top_k_areas: Use the top key areas for attention.
area_temperature: the temperature for attention softmax.
training: indicating if it is in the training mode.
Returns:
Tensor with shape [..., length_q, depth_v].
"""
tf.logging.info("dot_product_area_attention: "
"area_h=%d, area_w=%d, mem_h=%d, "
"area_key_mode=%s, area_value_mode=%s, "
"area_temperature=%f",
max_area_height, max_area_width, memory_height,
area_key_mode, area_value_mode,
area_temperature)
with tf.variable_scope(
name, default_name="dot_product_area_attention",
values=[q, k, v]) as scope:
mem_shape = common_layers.shape_list(k)
batch_size = mem_shape[0]
head_size = mem_shape[1]
length = mem_shape[2]
depth = mem_shape[3]
k_area = compute_area_key(
tf.reshape(k, [-1, length, depth]),
max_area_width=max_area_width,
max_area_height=max_area_height,
height=memory_height,
mode=area_key_mode,
training=training)
if area_value_mode == "mean":
v_area, _, _, _, _ = compute_area_features(
tf.reshape(v, [-1, length, depth]), max_area_width=max_area_width,
max_area_height=max_area_height, height=memory_height)
elif area_value_mode == "max":
v_area, _, _ = basic_pool(tf.reshape(v, [-1, length, depth]),
max_area_width=max_area_width,
max_area_height=max_area_height,
height=memory_height,
fn=tf.reduce_max)
elif area_value_mode == "sum":
_, _, v_area, _, _ = compute_area_features(
tf.reshape(v, [-1, length, depth]), max_area_width=max_area_width,
max_area_height=max_area_height, height=memory_height)
else:
raise ValueError("Unsupported area value mode=%s" % area_value_mode)
k = tf.reshape(k_area, [batch_size, head_size, -1, depth])
v = tf.reshape(v_area, [batch_size, head_size, -1, depth])
logits = tf.matmul(q, k, transpose_b=True) # [..., length_q, length_kv]
if bias is not None:
bias = common_layers.cast_like(bias, logits)
with tf.name_scope("compute_area_att_bias", values=[bias]):
bias_shape = common_layers.shape_list(bias)
mem_length = bias_shape[-1]
bias_values = tf.reshape(
tf.to_float(tf.less(bias, -1)), [-1, mem_length, 1])
_, _, padding_sum, _, _ = compute_area_features(
bias_values, max_area_width=max_area_width,
max_area_height=max_area_height, height=memory_height)
bias = tf.where(
tf.cast(tf.to_int32(padding_sum), tf.bool),
tf.fill(tf.shape(padding_sum), -np.inf),
tf.zeros_like(padding_sum, dtype=tf.float32))
bias = tf.reshape(bias,
[bias_shape[0], bias_shape[1],
bias_shape[2], -1])
logits += bias
logits = logits / area_temperature
weights = tf.nn.softmax(logits, name="attention_weights")
if top_k_areas > 0:
tf.logging.info("area_attention top_k_areas=%d", top_k_areas)
top_k = tf.minimum(common_layers.shape_list(weights)[-1], top_k_areas)
top_weights, _ = tf.nn.top_k(weights, k=top_k)
min_values = tf.reduce_min(top_weights, -1, keepdims=True)
weights = tf.where(tf.greater_equal(weights, min_values),
weights, tf.zeros_like(weights))
weights = tf.div(weights, tf.reduce_sum(weights, -1, keepdims=True))
if save_weights_to is not None:
save_weights_to[scope.name] = weights
save_weights_to[scope.name + "/logits"] = logits
# Drop out attention links for each head.
weights = common_layers.dropout_with_broadcast_dims(
weights, 1.0 - dropout_rate, broadcast_dims=dropout_broadcast_dims)
if common_layers.should_generate_summaries() and attention_image_summary:
attention_image_summary(weights, image_shapes)
return tf.matmul(weights, v)
|
[
"def",
"dot_product_area_attention",
"(",
"q",
",",
"k",
",",
"v",
",",
"bias",
",",
"dropout_rate",
"=",
"0.0",
",",
"image_shapes",
"=",
"None",
",",
"name",
"=",
"None",
",",
"attention_image_summary",
"=",
"None",
",",
"save_weights_to",
"=",
"None",
",",
"dropout_broadcast_dims",
"=",
"None",
",",
"max_area_width",
"=",
"1",
",",
"max_area_height",
"=",
"1",
",",
"memory_height",
"=",
"1",
",",
"area_key_mode",
"=",
"\"mean\"",
",",
"area_value_mode",
"=",
"\"sum\"",
",",
"top_k_areas",
"=",
"0",
",",
"area_temperature",
"=",
"1.0",
",",
"training",
"=",
"True",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"dot_product_area_attention: \"",
"\"area_h=%d, area_w=%d, mem_h=%d, \"",
"\"area_key_mode=%s, area_value_mode=%s, \"",
"\"area_temperature=%f\"",
",",
"max_area_height",
",",
"max_area_width",
",",
"memory_height",
",",
"area_key_mode",
",",
"area_value_mode",
",",
"area_temperature",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"dot_product_area_attention\"",
",",
"values",
"=",
"[",
"q",
",",
"k",
",",
"v",
"]",
")",
"as",
"scope",
":",
"mem_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"k",
")",
"batch_size",
"=",
"mem_shape",
"[",
"0",
"]",
"head_size",
"=",
"mem_shape",
"[",
"1",
"]",
"length",
"=",
"mem_shape",
"[",
"2",
"]",
"depth",
"=",
"mem_shape",
"[",
"3",
"]",
"k_area",
"=",
"compute_area_key",
"(",
"tf",
".",
"reshape",
"(",
"k",
",",
"[",
"-",
"1",
",",
"length",
",",
"depth",
"]",
")",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"memory_height",
",",
"mode",
"=",
"area_key_mode",
",",
"training",
"=",
"training",
")",
"if",
"area_value_mode",
"==",
"\"mean\"",
":",
"v_area",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
"=",
"compute_area_features",
"(",
"tf",
".",
"reshape",
"(",
"v",
",",
"[",
"-",
"1",
",",
"length",
",",
"depth",
"]",
")",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"memory_height",
")",
"elif",
"area_value_mode",
"==",
"\"max\"",
":",
"v_area",
",",
"_",
",",
"_",
"=",
"basic_pool",
"(",
"tf",
".",
"reshape",
"(",
"v",
",",
"[",
"-",
"1",
",",
"length",
",",
"depth",
"]",
")",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"memory_height",
",",
"fn",
"=",
"tf",
".",
"reduce_max",
")",
"elif",
"area_value_mode",
"==",
"\"sum\"",
":",
"_",
",",
"_",
",",
"v_area",
",",
"_",
",",
"_",
"=",
"compute_area_features",
"(",
"tf",
".",
"reshape",
"(",
"v",
",",
"[",
"-",
"1",
",",
"length",
",",
"depth",
"]",
")",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"memory_height",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unsupported area value mode=%s\"",
"%",
"area_value_mode",
")",
"k",
"=",
"tf",
".",
"reshape",
"(",
"k_area",
",",
"[",
"batch_size",
",",
"head_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
"v",
"=",
"tf",
".",
"reshape",
"(",
"v_area",
",",
"[",
"batch_size",
",",
"head_size",
",",
"-",
"1",
",",
"depth",
"]",
")",
"logits",
"=",
"tf",
".",
"matmul",
"(",
"q",
",",
"k",
",",
"transpose_b",
"=",
"True",
")",
"# [..., length_q, length_kv]",
"if",
"bias",
"is",
"not",
"None",
":",
"bias",
"=",
"common_layers",
".",
"cast_like",
"(",
"bias",
",",
"logits",
")",
"with",
"tf",
".",
"name_scope",
"(",
"\"compute_area_att_bias\"",
",",
"values",
"=",
"[",
"bias",
"]",
")",
":",
"bias_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"bias",
")",
"mem_length",
"=",
"bias_shape",
"[",
"-",
"1",
"]",
"bias_values",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"to_float",
"(",
"tf",
".",
"less",
"(",
"bias",
",",
"-",
"1",
")",
")",
",",
"[",
"-",
"1",
",",
"mem_length",
",",
"1",
"]",
")",
"_",
",",
"_",
",",
"padding_sum",
",",
"_",
",",
"_",
"=",
"compute_area_features",
"(",
"bias_values",
",",
"max_area_width",
"=",
"max_area_width",
",",
"max_area_height",
"=",
"max_area_height",
",",
"height",
"=",
"memory_height",
")",
"bias",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"cast",
"(",
"tf",
".",
"to_int32",
"(",
"padding_sum",
")",
",",
"tf",
".",
"bool",
")",
",",
"tf",
".",
"fill",
"(",
"tf",
".",
"shape",
"(",
"padding_sum",
")",
",",
"-",
"np",
".",
"inf",
")",
",",
"tf",
".",
"zeros_like",
"(",
"padding_sum",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
")",
"bias",
"=",
"tf",
".",
"reshape",
"(",
"bias",
",",
"[",
"bias_shape",
"[",
"0",
"]",
",",
"bias_shape",
"[",
"1",
"]",
",",
"bias_shape",
"[",
"2",
"]",
",",
"-",
"1",
"]",
")",
"logits",
"+=",
"bias",
"logits",
"=",
"logits",
"/",
"area_temperature",
"weights",
"=",
"tf",
".",
"nn",
".",
"softmax",
"(",
"logits",
",",
"name",
"=",
"\"attention_weights\"",
")",
"if",
"top_k_areas",
">",
"0",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"area_attention top_k_areas=%d\"",
",",
"top_k_areas",
")",
"top_k",
"=",
"tf",
".",
"minimum",
"(",
"common_layers",
".",
"shape_list",
"(",
"weights",
")",
"[",
"-",
"1",
"]",
",",
"top_k_areas",
")",
"top_weights",
",",
"_",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"weights",
",",
"k",
"=",
"top_k",
")",
"min_values",
"=",
"tf",
".",
"reduce_min",
"(",
"top_weights",
",",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
"weights",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"greater_equal",
"(",
"weights",
",",
"min_values",
")",
",",
"weights",
",",
"tf",
".",
"zeros_like",
"(",
"weights",
")",
")",
"weights",
"=",
"tf",
".",
"div",
"(",
"weights",
",",
"tf",
".",
"reduce_sum",
"(",
"weights",
",",
"-",
"1",
",",
"keepdims",
"=",
"True",
")",
")",
"if",
"save_weights_to",
"is",
"not",
"None",
":",
"save_weights_to",
"[",
"scope",
".",
"name",
"]",
"=",
"weights",
"save_weights_to",
"[",
"scope",
".",
"name",
"+",
"\"/logits\"",
"]",
"=",
"logits",
"# Drop out attention links for each head.",
"weights",
"=",
"common_layers",
".",
"dropout_with_broadcast_dims",
"(",
"weights",
",",
"1.0",
"-",
"dropout_rate",
",",
"broadcast_dims",
"=",
"dropout_broadcast_dims",
")",
"if",
"common_layers",
".",
"should_generate_summaries",
"(",
")",
"and",
"attention_image_summary",
":",
"attention_image_summary",
"(",
"weights",
",",
"image_shapes",
")",
"return",
"tf",
".",
"matmul",
"(",
"weights",
",",
"v",
")"
] |
Dot-product area attention.
Args:
q: Tensor with shape [..., length_q, depth_k].
k: Tensor with shape [..., length_kv, depth_k]. Leading dimensions must
match with q.
v: Tensor with shape [..., length_kv, depth_v] Leading dimensions must
match with q.
bias: bias Tensor (see attention_bias())
dropout_rate: a float.
image_shapes: optional tuple of integer scalars.
see comments for attention_image_summary()
name: an optional string
attention_image_summary: the callback for making image summary of attention.
save_weights_to: an optional dictionary to capture attention weights
for visualization; the weights tensor will be appended there under
a string key created from the variable scope (including name).
dropout_broadcast_dims: an optional list of integers less than rank of q.
Specifies in which dimensions to broadcast the dropout decisions.
max_area_width: the max width allowed for an area.
max_area_height: the max height allowed for an area.
memory_height: the height of the memory.
area_key_mode: the mode for computing area keys, which can be "mean",
"concat", "sum", "sample_concat", and "sample_sum".
area_value_mode: the mode for computing area values, which can be either
"mean", or "sum".
top_k_areas: Use the top key areas for attention.
area_temperature: the temperature for attention softmax.
training: indicating if it is in the training mode.
Returns:
Tensor with shape [..., length_q, depth_v].
|
[
"Dot",
"-",
"product",
"area",
"attention",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/area_attention.py#L305-L433
|
train
|
Dot - product area attention.
|
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,rIcPej9ZqM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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(0b10000 + 0o42) + '\x31' + chr(0b110000 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(739 - 688) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1013 - 963) + chr(797 - 745) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1699 - 1588) + chr(0b101101 + 0o4) + chr(55) + chr(0b110011 + 0o2), 25218 - 25210), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11011 + 0o33) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1044 - 933) + '\x32' + '\x36' + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(52) + '\x31', 42024 - 42016), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101111 + 0o2) + chr(0b101100 + 0o13) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(7672 - 7561) + '\063' + chr(1690 - 1635) + chr(0b110 + 0o57), 0o10), ehT0Px3KOsy9(chr(361 - 313) + '\157' + '\062' + chr(1978 - 1928) + chr(0b1 + 0o66), 0o10), ehT0Px3KOsy9('\x30' + chr(6614 - 6503) + chr(0b110011) + chr(1778 - 1725) + chr(55), 2180 - 2172), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1478 - 1429) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7861 - 7750) + chr(0b110011) + chr(1804 - 1755) + chr(0b110110), 37056 - 37048), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110110), 39620 - 39612), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b1 + 0o66) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x36' + chr(1397 - 1348), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1475 - 1424) + chr(50) + chr(2426 - 2371), 0b1000), ehT0Px3KOsy9(chr(845 - 797) + chr(111) + chr(1609 - 1558) + '\062' + chr(1497 - 1443), 14714 - 14706), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b110111) + chr(824 - 773), 0o10), ehT0Px3KOsy9(chr(1142 - 1094) + chr(0b101001 + 0o106) + chr(1281 - 1230) + '\x34' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(0b110001) + chr(0b110001) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + '\x36' + '\x34', 11023 - 11015), ehT0Px3KOsy9('\x30' + chr(111) + chr(1142 - 1090) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\x31' + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b101001 + 0o15) + chr(0b10001 + 0o37), 8), ehT0Px3KOsy9(chr(520 - 472) + chr(0b101000 + 0o107) + chr(0b110001 + 0o5), 8), ehT0Px3KOsy9('\060' + chr(0b1101001 + 0o6) + chr(49) + chr(0b10110 + 0o32) + '\063', 37445 - 37437), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(10574 - 10463) + '\062' + chr(53) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(0b10001 + 0o42) + chr(0b101 + 0o57) + chr(605 - 552), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1338 - 1288) + chr(0b110111) + chr(279 - 226), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b110001) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + chr(1906 - 1855) + '\063' + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(759 - 706) + chr(0b11111 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(430 - 381) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(4338 - 4227) + chr(50) + chr(0b110011) + chr(1751 - 1702), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(1362 - 1311) + chr(0b110001) + chr(2265 - 2212), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010010 + 0o35) + chr(0b110010) + chr(0b110100) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1000 + 0o55) + chr(0b110011), 8), ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + chr(0b110011) + chr(0b11111 + 0o25), 18568 - 18560)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + chr(0b10001 + 0o37), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0'), '\144' + '\145' + chr(0b101110 + 0o65) + chr(5975 - 5864) + chr(100) + chr(4208 - 4107))('\165' + chr(8706 - 8590) + chr(102) + chr(45) + chr(0b0 + 0o70)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def S1Fi9GzuKwo5(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, IKTrMTySqz10, iI9Z069HML_u=0.0, IHMu1EGwZgDx=None, AIvJRzLdDfgF=None, vjFJTe5Ux47H=None, zWaF_2VBEDjk=None, Tovc3lDEHg6s=None, u6lkO_RiLl5P=ehT0Px3KOsy9(chr(143 - 95) + '\157' + '\061', 0b1000), b1gSL9RXhjFx=ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + '\x31', 8), RbuxRSqxOlbf=ehT0Px3KOsy9('\x30' + chr(7886 - 7775) + chr(0b110001), 8), cJKjZFYrxrad=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3=\xc1\x13'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b1100100) + '\145')('\165' + chr(12123 - 12007) + chr(0b11101 + 0o111) + chr(194 - 149) + chr(1631 - 1575)), Z9oQ7Tm8mGJ6=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd-\xcd'), chr(0b1000010 + 0o42) + chr(0b101101 + 0o70) + chr(0b1001111 + 0o24) + chr(0b1000010 + 0o55) + chr(6498 - 6398) + chr(101))('\x75' + chr(11607 - 11491) + chr(2646 - 2544) + chr(0b101101) + chr(0b111000)), dM5gNcEDMqbc=ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(61 - 13), ord("\x08")), xWhP3V79bYKE=1.0, H15mhcYcioqz=ehT0Px3KOsy9(chr(881 - 833) + chr(0b1100000 + 0o17) + chr(49), 8)):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xddo\xe8\x05F\xd3\xc6K\x97\xfb\xb5b'), chr(0b1011011 + 0o11) + '\x65' + '\x63' + chr(111) + chr(100) + chr(2844 - 2743))('\x75' + chr(116) + chr(102) + '\x2d' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xea7\xd4"C\xc2\xce\x18\x88\xf4\x9bV\xaft\xd8P\x88\xb7\x8f\x90,ZV\xa7\xdfhy\x8aM\x97\xd8\xad\x87C2\xbc\xa9\x89\x0b}\xfc=\xc1"D\x8d\x84\x18\xd1\xb7\x82l\xa3Y\xd5\x0c\xf2\xb2\xd7\xc4(FG\xaf\xefm&\xd3s\x88\xd2\xa8\xbd\x16*\xea\xe1\x85Jn\xeb9\xff\x0bR\xdc\xd4\x19\xa2\xfa\x80m\xab;\x98B\xfb\xf6\x9a\x96,U}\xba\xd5k3\xcf^\x84\xc9\xb9\xaaN2\xbc\xab'), chr(0b1010111 + 0o15) + chr(0b1100101) + chr(3106 - 3007) + chr(111) + '\144' + chr(101))(chr(0b1110101) + chr(0b101010 + 0o112) + chr(0b1100110) + chr(0b10001 + 0o34) + '\070'), b1gSL9RXhjFx, u6lkO_RiLl5P, RbuxRSqxOlbf, cJKjZFYrxrad, Z9oQ7Tm8mGJ6, xWhP3V79bYKE)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf89\xd2\x14R\xd2\xcd\x19\xa2\xe4\x8cf\xbec'), '\x64' + chr(8850 - 8749) + chr(0b100110 + 0o75) + '\x6f' + chr(100) + '\x65')('\165' + chr(0b1110001 + 0o3) + chr(5819 - 5717) + chr(0b100011 + 0o12) + chr(0b1 + 0o67)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xea7\xd4"C\xc2\xce\x18\x88\xf4\x9bV\xaft\xd8P\x88\xb7\x8f\x90,ZV\xa7\xdfh'), chr(0b101001 + 0o73) + chr(4697 - 4596) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(2213 - 2112))(chr(7820 - 7703) + chr(0b1110100) + chr(0b1100110) + chr(989 - 944) + chr(1853 - 1797)), values=[WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo]) as CJBHNoj4zKoT:
nagsec90ctu7 = jSKPaHwSAfVv.shape_list(OolUPRJhRaJd)
ix9dZyeAmUxY = nagsec90ctu7[ehT0Px3KOsy9(chr(1352 - 1304) + chr(1059 - 948) + chr(48), 8)]
nZJOFmW9OmLl = nagsec90ctu7[ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8)]
CHAOgk5VCHH_ = nagsec90ctu7[ehT0Px3KOsy9(chr(568 - 520) + chr(111) + chr(2139 - 2089), ord("\x08"))]
UEys4_lSwsID = nagsec90ctu7[ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + '\063', ord("\x08"))]
oHJeF8H4pnBS = ANvSqnAE11FV(IDJ2eXGCBCDu.reshape(OolUPRJhRaJd, [-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49), 8), CHAOgk5VCHH_, UEys4_lSwsID]), max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=RbuxRSqxOlbf, mode=cJKjZFYrxrad, training=H15mhcYcioqz)
if Z9oQ7Tm8mGJ6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3=\xc1\x13'), '\144' + chr(0b1100101) + '\x63' + chr(111) + '\144' + chr(4462 - 4361))(chr(117) + chr(11576 - 11460) + '\146' + chr(45) + '\x38'):
(MxUkas6gapuD, VNGQdHSFPrso, VNGQdHSFPrso, VNGQdHSFPrso, VNGQdHSFPrso) = fPRF4fLu_Nsl(IDJ2eXGCBCDu.reshape(cMbll0QYhULo, [-ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + chr(0b110001), 8), CHAOgk5VCHH_, UEys4_lSwsID]), max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=RbuxRSqxOlbf)
elif Z9oQ7Tm8mGJ6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe39\xd8'), '\x64' + chr(0b1010111 + 0o16) + '\x63' + '\157' + chr(0b1100100) + chr(101))(chr(0b1011000 + 0o35) + chr(0b1011011 + 0o31) + chr(0b1001010 + 0o34) + chr(311 - 266) + '\070'):
(MxUkas6gapuD, VNGQdHSFPrso, VNGQdHSFPrso) = T3X5QZhqzXXY(IDJ2eXGCBCDu.reshape(cMbll0QYhULo, [-ehT0Px3KOsy9('\060' + chr(9996 - 9885) + chr(0b110001), 8), CHAOgk5VCHH_, UEys4_lSwsID]), max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=RbuxRSqxOlbf, fn=IDJ2eXGCBCDu.reduce_max)
elif Z9oQ7Tm8mGJ6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd-\xcd'), chr(100) + chr(0b1111 + 0o126) + chr(0b1100011) + '\x6f' + '\x64' + '\145')('\165' + chr(0b11111 + 0o125) + '\x66' + chr(45) + '\070'):
(VNGQdHSFPrso, VNGQdHSFPrso, MxUkas6gapuD, VNGQdHSFPrso, VNGQdHSFPrso) = fPRF4fLu_Nsl(IDJ2eXGCBCDu.reshape(cMbll0QYhULo, [-ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b111110 + 0o61) + chr(1314 - 1265), 8), CHAOgk5VCHH_, UEys4_lSwsID]), max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=RbuxRSqxOlbf)
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb6\xd3\x08C\xc0\xce\x0e\x89\xf2\x8b)\xaft\xd8P\xf7\xa0\x9a\x88<Q\x02\xa3\xdfb&\x97\t\x96'), '\144' + chr(101) + '\143' + '\x6f' + chr(0b1000000 + 0o44) + '\145')(chr(117) + chr(0b111010 + 0o72) + '\146' + chr(111 - 66) + chr(0b111000)) % Z9oQ7Tm8mGJ6)
OolUPRJhRaJd = IDJ2eXGCBCDu.reshape(oHJeF8H4pnBS, [ix9dZyeAmUxY, nZJOFmW9OmLl, -ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(49), 8), UEys4_lSwsID])
cMbll0QYhULo = IDJ2eXGCBCDu.reshape(MxUkas6gapuD, [ix9dZyeAmUxY, nZJOFmW9OmLl, -ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(8277 - 8166) + chr(0b110001), 8), UEys4_lSwsID])
wF9nmvjsKjYM = IDJ2eXGCBCDu.matmul(WtwjCI_b3w8O, OolUPRJhRaJd, transpose_b=ehT0Px3KOsy9('\x30' + '\157' + chr(49), 8))
if IKTrMTySqz10 is not None:
IKTrMTySqz10 = jSKPaHwSAfVv.cast_like(IKTrMTySqz10, wF9nmvjsKjYM)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe09\xcd\x18l\xc3\xc2\x13\x8d\xf2'), chr(0b110010 + 0o62) + chr(2022 - 1921) + chr(2810 - 2711) + chr(4270 - 4159) + chr(0b1100100) + '\145')('\165' + chr(13068 - 12952) + '\x66' + '\x2d' + chr(2982 - 2926)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xed7\xcd\rF\xc4\xc4#\x9c\xe5\x8ah\x91g\xc9E\x88\xb4\x92\x85:'), chr(0b1100100) + chr(0b1010 + 0o133) + chr(99) + '\x6f' + chr(0b1100100) + chr(101))(chr(3699 - 3582) + chr(0b1110100) + chr(102) + chr(0b100010 + 0o13) + chr(0b111000)), values=[IKTrMTySqz10]):
sIfaSZOV19OP = jSKPaHwSAfVv.shape_list(IKTrMTySqz10)
VzuGFhxszRYy = sIfaSZOV19OP[-ehT0Px3KOsy9(chr(0b110000) + chr(0b111010 + 0o65) + '\x31', 8)]
lJ0j3kBUbN6P = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.less(IKTrMTySqz10, -ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49), 8))), [-ehT0Px3KOsy9('\060' + '\157' + chr(49), 8), VzuGFhxszRYy, ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1194 - 1145), 8)])
(VNGQdHSFPrso, VNGQdHSFPrso, usUVow_xBUPw, VNGQdHSFPrso, VNGQdHSFPrso) = fPRF4fLu_Nsl(lJ0j3kBUbN6P, max_area_width=u6lkO_RiLl5P, max_area_height=b1gSL9RXhjFx, height=RbuxRSqxOlbf)
IKTrMTySqz10 = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.cast(IDJ2eXGCBCDu.to_int32(usUVow_xBUPw), IDJ2eXGCBCDu.bool), IDJ2eXGCBCDu.fill(IDJ2eXGCBCDu.nauYfLglTpcb(usUVow_xBUPw), -WqUC3KWvYVup.inf), IDJ2eXGCBCDu.zeros_like(usUVow_xBUPw, dtype=IDJ2eXGCBCDu.float32))
IKTrMTySqz10 = IDJ2eXGCBCDu.reshape(IKTrMTySqz10, [sIfaSZOV19OP[ehT0Px3KOsy9(chr(1655 - 1607) + '\x6f' + chr(1058 - 1010), 8)], sIfaSZOV19OP[ehT0Px3KOsy9(chr(663 - 615) + chr(0b1101111) + chr(0b110001), 8)], sIfaSZOV19OP[ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(0b1000 + 0o52), 8)], -ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8)])
wF9nmvjsKjYM += IKTrMTySqz10
wF9nmvjsKjYM = wF9nmvjsKjYM / xWhP3V79bYKE
ZurHTci57aXw = IDJ2eXGCBCDu.nn.softmax(wF9nmvjsKjYM, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xef,\xd4\x18]\xc4\xc8\x13\x93\xc8\x98l\xa7a\xd5E\xa4'), '\144' + chr(101) + chr(8447 - 8348) + chr(9218 - 9107) + '\144' + chr(0b1000100 + 0o41))('\x75' + chr(13191 - 13075) + chr(102) + '\055' + chr(0b11001 + 0o37)))
if dM5gNcEDMqbc > ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b111101 + 0o62) + chr(0b110000), 8):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xddo\xe8\x05F\xd3\xc6K\x97\xfb\xb5b'), '\144' + chr(0b1100101) + '\143' + chr(0b1101111) + chr(0b1100100) + chr(0b111010 + 0o53))(chr(117) + chr(0b101010 + 0o112) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xef*\xc5\x1cl\xd1\xd5\x08\x98\xf9\x9b`\xa1h\x9dE\xb8\xa6\xa4\x8f\x16UP\xab\xd1u~\x8fH'), chr(9833 - 9733) + chr(0b1100101) + chr(6085 - 5986) + chr(0b1010110 + 0o31) + '\144' + chr(0b1001000 + 0o35))(chr(0b110101 + 0o100) + chr(0b1110100) + chr(0b11101 + 0o111) + '\055' + chr(0b111 + 0o61)), dM5gNcEDMqbc)
LQLM6CJZRTKz = IDJ2eXGCBCDu.minimum(jSKPaHwSAfVv.shape_list(ZurHTci57aXw)[-ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + '\x31', 8)], dM5gNcEDMqbc)
(ERGMwMc44ExF, VNGQdHSFPrso) = IDJ2eXGCBCDu.nn.top_k(ZurHTci57aXw, k=LQLM6CJZRTKz)
Cnx19_76lphl = IDJ2eXGCBCDu.reduce_min(ERGMwMc44ExF, -ehT0Px3KOsy9(chr(746 - 698) + chr(0b1101111 + 0o0) + chr(0b110001), 8), keepdims=ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001 + 0o0), 8))
ZurHTci57aXw = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.greater_equal(ZurHTci57aXw, Cnx19_76lphl), ZurHTci57aXw, IDJ2eXGCBCDu.zeros_like(ZurHTci57aXw))
ZurHTci57aXw = IDJ2eXGCBCDu.div(ZurHTci57aXw, IDJ2eXGCBCDu.reduce_sum(ZurHTci57aXw, -ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), 8), keepdims=ehT0Px3KOsy9(chr(48) + chr(0b111101 + 0o62) + chr(2112 - 2063), 8)))
if zWaF_2VBEDjk is not None:
zWaF_2VBEDjk[CJBHNoj4zKoT.AIvJRzLdDfgF] = ZurHTci57aXw
zWaF_2VBEDjk[CJBHNoj4zKoT.AIvJRzLdDfgF + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa14\xcf\x1aZ\xc4\xd2'), chr(100) + '\145' + chr(99) + chr(0b1000010 + 0o55) + chr(8491 - 8391) + '\x65')(chr(13334 - 13217) + chr(116) + '\x66' + chr(45) + chr(0b111000))] = wF9nmvjsKjYM
ZurHTci57aXw = jSKPaHwSAfVv.dropout_with_broadcast_dims(ZurHTci57aXw, 1.0 - iI9Z069HML_u, broadcast_dims=Tovc3lDEHg6s)
if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd0\xcf\x08_\xd4\xfe\x1b\x98\xf9\x8a{\xafr\xd8n\xa4\xa3\x96\x89(FK\xab\xc3'), chr(0b111111 + 0o45) + chr(9495 - 9394) + chr(0b110 + 0o135) + '\157' + chr(4902 - 4802) + '\145')(chr(0b101 + 0o160) + chr(116) + chr(102) + chr(0b101101) + chr(0b111000)))() and vjFJTe5Ux47H:
vjFJTe5Ux47H(ZurHTci57aXw, IHMu1EGwZgDx)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe39\xd4\x10F\xdc'), '\x64' + '\x65' + chr(0b1000101 + 0o36) + '\x6f' + chr(9176 - 9076) + chr(101))('\x75' + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(0b111000)))(ZurHTci57aXw, cMbll0QYhULo)
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
setup_directories
|
def setup_directories(base_dir, subdirs):
"""Setup directories."""
base_dir = os.path.expanduser(base_dir)
tf.gfile.MakeDirs(base_dir)
all_dirs = {}
for subdir in subdirs:
if isinstance(subdir, six.string_types):
subdir_tuple = (subdir,)
else:
subdir_tuple = subdir
dir_name = os.path.join(base_dir, *subdir_tuple)
tf.gfile.MakeDirs(dir_name)
all_dirs[subdir] = dir_name
return all_dirs
|
python
|
def setup_directories(base_dir, subdirs):
"""Setup directories."""
base_dir = os.path.expanduser(base_dir)
tf.gfile.MakeDirs(base_dir)
all_dirs = {}
for subdir in subdirs:
if isinstance(subdir, six.string_types):
subdir_tuple = (subdir,)
else:
subdir_tuple = subdir
dir_name = os.path.join(base_dir, *subdir_tuple)
tf.gfile.MakeDirs(dir_name)
all_dirs[subdir] = dir_name
return all_dirs
|
[
"def",
"setup_directories",
"(",
"base_dir",
",",
"subdirs",
")",
":",
"base_dir",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"base_dir",
")",
"tf",
".",
"gfile",
".",
"MakeDirs",
"(",
"base_dir",
")",
"all_dirs",
"=",
"{",
"}",
"for",
"subdir",
"in",
"subdirs",
":",
"if",
"isinstance",
"(",
"subdir",
",",
"six",
".",
"string_types",
")",
":",
"subdir_tuple",
"=",
"(",
"subdir",
",",
")",
"else",
":",
"subdir_tuple",
"=",
"subdir",
"dir_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"base_dir",
",",
"*",
"subdir_tuple",
")",
"tf",
".",
"gfile",
".",
"MakeDirs",
"(",
"dir_name",
")",
"all_dirs",
"[",
"subdir",
"]",
"=",
"dir_name",
"return",
"all_dirs"
] |
Setup directories.
|
[
"Setup",
"directories",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L68-L82
|
train
|
Setup directories.
|
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,_zJ24Vce7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fhgG,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(0b1010100 + 0o33) + chr(755 - 703) + chr(0b110101), 936 - 928), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + '\x33' + '\x36' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11 + 0o60) + '\x37' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(51) + chr(0b110100) + '\065', 13511 - 13503), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110100) + '\x33', 35336 - 35328), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(0b11111 + 0o30) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(1016 - 967) + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + chr(0b10111 + 0o33) + chr(0b100001 + 0o20) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(637 - 585) + chr(0b110011 + 0o1), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010011 + 0o34) + chr(0b110001 + 0o0) + chr(349 - 295) + chr(238 - 185), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1011 + 0o46) + chr(95 - 44) + chr(0b100 + 0o56), 0b1000), ehT0Px3KOsy9(chr(1006 - 958) + '\x6f' + chr(925 - 874) + chr(0b10110 + 0o41) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110101) + chr(0b110100), 39346 - 39338), ehT0Px3KOsy9('\060' + '\157' + chr(0b1001 + 0o51) + chr(53) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(6229 - 6118) + chr(0b101100 + 0o12) + chr(2227 - 2174), 0o10), ehT0Px3KOsy9('\060' + chr(4929 - 4818) + chr(0b110 + 0o57) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(49) + chr(0b1101 + 0o51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(52) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b110001), 23345 - 23337), ehT0Px3KOsy9(chr(48) + '\157' + chr(698 - 646) + chr(0b10110 + 0o34), 39239 - 39231), ehT0Px3KOsy9('\x30' + chr(5290 - 5179) + '\x32' + chr(1802 - 1748) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b110100 + 0o73) + chr(50) + chr(0b110001) + '\064', 0b1000), ehT0Px3KOsy9(chr(2206 - 2158) + '\x6f' + chr(0b110100) + chr(55), 64856 - 64848), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\063' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(1129 - 1078) + chr(531 - 478) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(2805 - 2694) + chr(0b110001) + chr(50) + chr(1665 - 1617), 0b1000), ehT0Px3KOsy9(chr(1363 - 1315) + chr(0b1101111) + '\062' + chr(0b1010 + 0o53) + chr(48), 8), ehT0Px3KOsy9(chr(1608 - 1560) + chr(0b110001 + 0o76) + chr(496 - 447) + chr(0b110111) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(0b10 + 0o57) + chr(1580 - 1525), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2335 - 2224) + chr(0b110100) + '\064', 8), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + chr(331 - 279) + '\061', 39996 - 39988), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(0b100000 + 0o21) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + '\066' + '\x31', 27372 - 27364), ehT0Px3KOsy9(chr(1040 - 992) + '\x6f' + chr(1676 - 1625) + chr(609 - 554) + chr(0b10010 + 0o44), 8), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + '\x32' + '\063' + chr(0b100001 + 0o23), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + '\063' + chr(49) + chr(2210 - 2159), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(152 - 97) + chr(0b1000 + 0o51), 8), ehT0Px3KOsy9(chr(2207 - 2159) + '\x6f' + chr(704 - 655) + chr(2101 - 2047) + '\065', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110111) + '\067', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(4917 - 4806) + chr(0b11011 + 0o32) + chr(0b1001 + 0o47), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b'), '\x64' + '\145' + '\x63' + chr(0b11011 + 0o124) + chr(2956 - 2856) + chr(0b1100101))(chr(0b1010000 + 0o45) + chr(0b1100 + 0o150) + chr(102) + '\x2d' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def FSJmFDxnRCoy(tEZltfn1uUbu, Vvyk8EF5LzTX):
tEZltfn1uUbu = oqhJDdMJfuwx.path.expanduser(tEZltfn1uUbu)
xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'h\x95\x95\x80\xe7P\xbc\xf8'), '\x64' + '\145' + chr(99) + '\x6f' + chr(100) + chr(0b1100101))('\165' + chr(5477 - 5361) + '\x66' + '\055' + '\070'))(tEZltfn1uUbu)
f2I9HKxO9hew = {}
for LOQ33RWbsQRm in Vvyk8EF5LzTX:
if PlSM16l2KDPD(LOQ33RWbsQRm, xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'V\x80\x8c\x8c\xcd^\x91\xff\xdd\x05?\x8c'), chr(100) + '\145' + '\143' + chr(0b1101111) + chr(774 - 674) + '\145')('\165' + chr(13398 - 13282) + '\146' + chr(1537 - 1492) + '\070'))):
rqM8lw8HtQZe = (LOQ33RWbsQRm,)
else:
rqM8lw8HtQZe = LOQ33RWbsQRm
iAm9284i4LwH = oqhJDdMJfuwx.path.join(tEZltfn1uUbu, *rqM8lw8HtQZe)
xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'h\x95\x95\x80\xe7P\xbc\xf8'), chr(100) + chr(101) + chr(99) + '\x6f' + '\144' + '\145')(chr(0b1011000 + 0o35) + '\x74' + chr(102) + '\x2d' + '\x38'))(iAm9284i4LwH)
f2I9HKxO9hew[LOQ33RWbsQRm] = iAm9284i4LwH
return f2I9HKxO9hew
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
make_relative_timing_fn
|
def make_relative_timing_fn():
"""Make a function that logs the duration since it was made."""
start_time = time.time()
def format_relative_time():
time_delta = time.time() - start_time
return str(datetime.timedelta(seconds=time_delta))
def log_relative_time():
tf.logging.info("Timing: %s", format_relative_time())
return log_relative_time
|
python
|
def make_relative_timing_fn():
"""Make a function that logs the duration since it was made."""
start_time = time.time()
def format_relative_time():
time_delta = time.time() - start_time
return str(datetime.timedelta(seconds=time_delta))
def log_relative_time():
tf.logging.info("Timing: %s", format_relative_time())
return log_relative_time
|
[
"def",
"make_relative_timing_fn",
"(",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"def",
"format_relative_time",
"(",
")",
":",
"time_delta",
"=",
"time",
".",
"time",
"(",
")",
"-",
"start_time",
"return",
"str",
"(",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"time_delta",
")",
")",
"def",
"log_relative_time",
"(",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Timing: %s\"",
",",
"format_relative_time",
"(",
")",
")",
"return",
"log_relative_time"
] |
Make a function that logs the duration since it was made.
|
[
"Make",
"a",
"function",
"that",
"logs",
"the",
"duration",
"since",
"it",
"was",
"made",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L85-L96
|
train
|
Make a function that logs the duration since it was made.
|
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,yROw0HWBk0Q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hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\063' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b100011 + 0o17) + chr(0b1100 + 0o44), 41993 - 41985), ehT0Px3KOsy9(chr(2269 - 2221) + '\157' + '\x33' + chr(0b111 + 0o52) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110000 + 0o4) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(0b110010) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(1251 - 1203), 32335 - 32327), ehT0Px3KOsy9(chr(1129 - 1081) + chr(0b1000101 + 0o52) + chr(51) + chr(0b101010 + 0o13) + chr(1126 - 1076), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(51) + chr(0b10100 + 0o35), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010 + 0o0) + '\064' + chr(2156 - 2107), 42419 - 42411), ehT0Px3KOsy9('\x30' + chr(0b110001 + 0o76) + chr(0b100010 + 0o20) + chr(53) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b110101) + chr(0b10000 + 0o44), 0o10), ehT0Px3KOsy9(chr(1771 - 1723) + chr(0b1101111) + chr(0b11110 + 0o22), 8), ehT0Px3KOsy9(chr(344 - 296) + chr(0b1101111) + chr(0b100111 + 0o17) + '\x30', 770 - 762), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100100 + 0o15) + chr(0b110011) + chr(0b100100 + 0o14), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100110 + 0o111) + chr(0b100 + 0o56) + '\064' + chr(0b110000 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4263 - 4152) + chr(0b110000 + 0o2) + chr(48) + chr(562 - 511), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + '\062' + chr(48) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10001 + 0o136) + '\x31' + chr(0b100010 + 0o25) + chr(1801 - 1747), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b0 + 0o63) + chr(52) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4065 - 3954) + chr(0b11100 + 0o25) + '\061' + chr(0b10110 + 0o32), 15754 - 15746), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(11640 - 11529) + chr(51) + chr(607 - 557) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(303 - 255) + chr(111) + '\062' + chr(752 - 702) + chr(443 - 394), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b1011 + 0o53) + chr(0b1101 + 0o44), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b101111 + 0o4) + chr(284 - 229), ord("\x08")), ehT0Px3KOsy9(chr(1920 - 1872) + chr(6863 - 6752) + chr(0b10110 + 0o37) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + chr(0b110001) + '\064' + chr(0b10000 + 0o44), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + '\061' + chr(438 - 389) + chr(0b100000 + 0o20), 8), ehT0Px3KOsy9(chr(48) + chr(0b1100001 + 0o16) + chr(0b110001 + 0o0) + '\064' + chr(51), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(1831 - 1720) + '\x31' + chr(1266 - 1215), 0b1000), ehT0Px3KOsy9(chr(1360 - 1312) + '\x6f' + chr(0b110010) + chr(0b110011) + chr(0b110010), 19699 - 19691), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b11011 + 0o27) + '\x35' + chr(714 - 662), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1736 - 1681), 0o10), ehT0Px3KOsy9(chr(1163 - 1115) + chr(111) + '\062' + '\x30' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1101 - 1052) + chr(0b110110) + chr(0b11011 + 0o33), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101110 + 0o3) + chr(50) + chr(0b0 + 0o66), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\x33' + chr(2551 - 2498), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + '\x32' + chr(0b101000 + 0o13) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10001 + 0o41) + '\061' + chr(49), 0b1000), ehT0Px3KOsy9(chr(1492 - 1444) + '\157' + chr(51) + '\060' + chr(0b110110), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b111010 + 0o65) + chr(2068 - 2015) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5'), chr(9160 - 9060) + chr(101) + chr(0b110010 + 0o61) + chr(0b1101111) + chr(0b100101 + 0o77) + chr(0b101011 + 0o72))(chr(2556 - 2439) + chr(9917 - 9801) + '\x66' + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def zRZMTopDM70y():
tSzPDN5a8DrS = ltvhPP4VhXre.time()
def TOatM1VeNeSu():
pDuqEPtiA9eN = ltvhPP4VhXre.time() - tSzPDN5a8DrS
return M8_cKLkHVB2V(xafqLlk3kkUe(zKdiQFzuryNR, xafqLlk3kkUe(SXOLrMavuUCe(b'\xef9\xa0B\xf6e\x86\xed\xc0'), '\144' + chr(101) + chr(0b11001 + 0o112) + chr(0b1101111) + '\x64' + '\x65')('\165' + chr(0b1110100) + '\146' + chr(0b101101) + chr(0b10000 + 0o50)))(seconds=pDuqEPtiA9eN))
def YbYxT9NO6qap():
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8g\x85_\xe7c\x8d\xae\xcb\xc7vk'), chr(0b1100100) + chr(0b1100010 + 0o3) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b1111 + 0o126))(chr(0b1110101) + '\x74' + chr(0b1001011 + 0o33) + chr(0b101101) + chr(334 - 278)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf9\xa0N\xfcg\xd0\xb9\x84\xd8'), chr(6741 - 6641) + chr(0b1100101) + chr(3247 - 3148) + chr(0b100110 + 0o111) + '\144' + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b100001 + 0o14) + chr(0b100010 + 0o26)), TOatM1VeNeSu())
return YbYxT9NO6qap
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
train_supervised
|
def train_supervised(problem, model_name, hparams, data_dir, output_dir,
train_steps, eval_steps, local_eval_frequency=None,
schedule="continuous_train_and_eval"):
"""Train supervised."""
if local_eval_frequency is None:
local_eval_frequency = FLAGS.local_eval_frequency
exp_fn = trainer_lib.create_experiment_fn(
model_name, problem, data_dir, train_steps, eval_steps,
min_eval_frequency=local_eval_frequency
)
run_config = trainer_lib.create_run_config(model_name, model_dir=output_dir)
exp = exp_fn(run_config, hparams)
getattr(exp, schedule)()
|
python
|
def train_supervised(problem, model_name, hparams, data_dir, output_dir,
train_steps, eval_steps, local_eval_frequency=None,
schedule="continuous_train_and_eval"):
"""Train supervised."""
if local_eval_frequency is None:
local_eval_frequency = FLAGS.local_eval_frequency
exp_fn = trainer_lib.create_experiment_fn(
model_name, problem, data_dir, train_steps, eval_steps,
min_eval_frequency=local_eval_frequency
)
run_config = trainer_lib.create_run_config(model_name, model_dir=output_dir)
exp = exp_fn(run_config, hparams)
getattr(exp, schedule)()
|
[
"def",
"train_supervised",
"(",
"problem",
",",
"model_name",
",",
"hparams",
",",
"data_dir",
",",
"output_dir",
",",
"train_steps",
",",
"eval_steps",
",",
"local_eval_frequency",
"=",
"None",
",",
"schedule",
"=",
"\"continuous_train_and_eval\"",
")",
":",
"if",
"local_eval_frequency",
"is",
"None",
":",
"local_eval_frequency",
"=",
"FLAGS",
".",
"local_eval_frequency",
"exp_fn",
"=",
"trainer_lib",
".",
"create_experiment_fn",
"(",
"model_name",
",",
"problem",
",",
"data_dir",
",",
"train_steps",
",",
"eval_steps",
",",
"min_eval_frequency",
"=",
"local_eval_frequency",
")",
"run_config",
"=",
"trainer_lib",
".",
"create_run_config",
"(",
"model_name",
",",
"model_dir",
"=",
"output_dir",
")",
"exp",
"=",
"exp_fn",
"(",
"run_config",
",",
"hparams",
")",
"getattr",
"(",
"exp",
",",
"schedule",
")",
"(",
")"
] |
Train supervised.
|
[
"Train",
"supervised",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L125-L138
|
train
|
Train supervised model.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4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ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + chr(0b110110) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\x31' + chr(0b110101), 29315 - 29307), ehT0Px3KOsy9('\060' + '\x6f' + chr(678 - 627) + chr(48) + chr(0b110110), 53332 - 53324), ehT0Px3KOsy9(chr(404 - 356) + chr(0b10111 + 0o130) + '\x31' + chr(0b110100) + chr(0b110100), 58486 - 58478), ehT0Px3KOsy9(chr(48) + chr(0b1100100 + 0o13) + '\x37' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(0b101000 + 0o13) + '\061' + chr(0b10000 + 0o45), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(53) + chr(0b10011 + 0o44), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + '\x32' + chr(0b110101) + '\067', 22438 - 22430), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b10110 + 0o34) + chr(0b10010 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11111 + 0o22) + chr(90 - 41) + '\x36', 0b1000), ehT0Px3KOsy9(chr(851 - 803) + chr(0b1101110 + 0o1) + chr(0b11111 + 0o22) + chr(0b100111 + 0o15) + chr(1362 - 1310), 8), ehT0Px3KOsy9(chr(2123 - 2075) + chr(111) + '\062' + '\063' + '\x37', 0b1000), ehT0Px3KOsy9(chr(989 - 941) + chr(7261 - 7150) + chr(49) + chr(53) + chr(0b100011 + 0o21), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + chr(553 - 504) + chr(0b1010 + 0o54) + chr(53), 26623 - 26615), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(50) + chr(0b11000 + 0o32), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\x35' + chr(51), 48320 - 48312), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(52) + chr(1392 - 1340), 0o10), ehT0Px3KOsy9(chr(1273 - 1225) + chr(5154 - 5043) + chr(0b101100 + 0o5) + chr(1430 - 1377) + chr(0b1000 + 0o52), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100001 + 0o22) + '\064' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + '\x32' + chr(53), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100101 + 0o16) + chr(0b110000) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + '\067' + chr(51), 10208 - 10200), ehT0Px3KOsy9('\060' + '\157' + chr(2171 - 2121) + chr(0b101100 + 0o7) + '\x37', 8), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(49) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x34' + chr(1327 - 1272), ord("\x08")), ehT0Px3KOsy9(chr(1161 - 1113) + chr(10441 - 10330) + chr(0b11 + 0o60) + chr(52) + chr(1379 - 1327), 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(722 - 672) + chr(0b10000 + 0o45) + '\x36', 45402 - 45394), ehT0Px3KOsy9('\x30' + chr(2148 - 2037) + chr(547 - 496) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + chr(929 - 879) + chr(50) + chr(791 - 736), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\064' + chr(1869 - 1815), 39476 - 39468), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(7725 - 7614) + chr(0b100010 + 0o21) + chr(0b110100) + chr(0b10010 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(53) + chr(0b101101 + 0o12), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b10011 + 0o35) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100100 + 0o17) + chr(0b110001) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(5912 - 5801) + chr(0b110010) + chr(0b110110) + chr(0b1101 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(1160 - 1112) + chr(843 - 732) + chr(0b110011) + chr(50) + chr(2041 - 1990), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(226 - 175) + chr(53) + chr(0b110110), 14298 - 14290), ehT0Px3KOsy9(chr(986 - 938) + '\157' + '\067' + chr(478 - 425), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + '\065' + chr(0b100110 + 0o12), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f'), chr(0b1000001 + 0o43) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))('\165' + chr(6828 - 6712) + chr(0b1001101 + 0o31) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def kaQjr4LrpKBL(sO7e1A_Mor6Q, yJFe33rl9i_r, n4ljua2gi1Pr, kVFRD544hi_1, nd0OX_BS6_o4, daYMko0joBwR, K3bHLghgmarn, m5LLuNOGfJyd=None, UAGQwjlXRoHO=xafqLlk3kkUe(SXOLrMavuUCe(b'R\xe2\xa8\x10R\xa3Z\xc0\xa4=;\xeb\x1e\x14;\x05\xbb\x0b\x88qJ\xa1\x8d\xfe\xa5'), chr(5991 - 5891) + chr(0b1101 + 0o130) + '\x63' + chr(0b1101111) + chr(100) + chr(8497 - 8396))(chr(0b111011 + 0o72) + '\x74' + chr(0b1000000 + 0o46) + chr(45) + '\x38')):
if m5LLuNOGfJyd is None:
m5LLuNOGfJyd = vUTZFbqN0o8F.local_eval_frequency
Ozdedat8cP7v = KvtIAVGi33Ty.create_experiment_fn(yJFe33rl9i_r, sO7e1A_Mor6Q, kVFRD544hi_1, daYMko0joBwR, K3bHLghgmarn, min_eval_frequency=m5LLuNOGfJyd)
XwFhQmkvbPWZ = KvtIAVGi33Ty.create_run_config(yJFe33rl9i_r, model_dir=nd0OX_BS6_o4)
quvessij56om = Ozdedat8cP7v(XwFhQmkvbPWZ, n4ljua2gi1Pr)
xafqLlk3kkUe(quvessij56om, UAGQwjlXRoHO)()
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
train_agent
|
def train_agent(real_env, learner, world_model_dir, hparams, epoch):
"""Train the PPO agent in the simulated environment."""
initial_frame_chooser = rl_utils.make_initial_frame_chooser(
real_env, hparams.frame_stack_size, hparams.simulation_random_starts,
hparams.simulation_flip_first_random_for_beginning
)
env_fn = rl.make_simulated_env_fn_from_hparams(
real_env, hparams, batch_size=hparams.simulated_batch_size,
initial_frame_chooser=initial_frame_chooser, model_dir=world_model_dir,
sim_video_dir=os.path.join(
learner.agent_model_dir, "sim_videos_{}".format(epoch)
)
)
base_algo_str = hparams.base_algo
train_hparams = trainer_lib.create_hparams(hparams.base_algo_params)
if hparams.wm_policy_param_sharing:
train_hparams.optimizer_zero_grads = True
rl_utils.update_hparams_from_hparams(
train_hparams, hparams, base_algo_str + "_"
)
final_epoch = hparams.epochs - 1
is_special_epoch = (epoch + 3) == final_epoch or (epoch + 7) == final_epoch
is_final_epoch = epoch == final_epoch
env_step_multiplier = 3 if is_final_epoch else 2 if is_special_epoch else 1
learner.train(
env_fn, train_hparams, simulated=True, save_continuously=True,
epoch=epoch, env_step_multiplier=env_step_multiplier
)
|
python
|
def train_agent(real_env, learner, world_model_dir, hparams, epoch):
"""Train the PPO agent in the simulated environment."""
initial_frame_chooser = rl_utils.make_initial_frame_chooser(
real_env, hparams.frame_stack_size, hparams.simulation_random_starts,
hparams.simulation_flip_first_random_for_beginning
)
env_fn = rl.make_simulated_env_fn_from_hparams(
real_env, hparams, batch_size=hparams.simulated_batch_size,
initial_frame_chooser=initial_frame_chooser, model_dir=world_model_dir,
sim_video_dir=os.path.join(
learner.agent_model_dir, "sim_videos_{}".format(epoch)
)
)
base_algo_str = hparams.base_algo
train_hparams = trainer_lib.create_hparams(hparams.base_algo_params)
if hparams.wm_policy_param_sharing:
train_hparams.optimizer_zero_grads = True
rl_utils.update_hparams_from_hparams(
train_hparams, hparams, base_algo_str + "_"
)
final_epoch = hparams.epochs - 1
is_special_epoch = (epoch + 3) == final_epoch or (epoch + 7) == final_epoch
is_final_epoch = epoch == final_epoch
env_step_multiplier = 3 if is_final_epoch else 2 if is_special_epoch else 1
learner.train(
env_fn, train_hparams, simulated=True, save_continuously=True,
epoch=epoch, env_step_multiplier=env_step_multiplier
)
|
[
"def",
"train_agent",
"(",
"real_env",
",",
"learner",
",",
"world_model_dir",
",",
"hparams",
",",
"epoch",
")",
":",
"initial_frame_chooser",
"=",
"rl_utils",
".",
"make_initial_frame_chooser",
"(",
"real_env",
",",
"hparams",
".",
"frame_stack_size",
",",
"hparams",
".",
"simulation_random_starts",
",",
"hparams",
".",
"simulation_flip_first_random_for_beginning",
")",
"env_fn",
"=",
"rl",
".",
"make_simulated_env_fn_from_hparams",
"(",
"real_env",
",",
"hparams",
",",
"batch_size",
"=",
"hparams",
".",
"simulated_batch_size",
",",
"initial_frame_chooser",
"=",
"initial_frame_chooser",
",",
"model_dir",
"=",
"world_model_dir",
",",
"sim_video_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"learner",
".",
"agent_model_dir",
",",
"\"sim_videos_{}\"",
".",
"format",
"(",
"epoch",
")",
")",
")",
"base_algo_str",
"=",
"hparams",
".",
"base_algo",
"train_hparams",
"=",
"trainer_lib",
".",
"create_hparams",
"(",
"hparams",
".",
"base_algo_params",
")",
"if",
"hparams",
".",
"wm_policy_param_sharing",
":",
"train_hparams",
".",
"optimizer_zero_grads",
"=",
"True",
"rl_utils",
".",
"update_hparams_from_hparams",
"(",
"train_hparams",
",",
"hparams",
",",
"base_algo_str",
"+",
"\"_\"",
")",
"final_epoch",
"=",
"hparams",
".",
"epochs",
"-",
"1",
"is_special_epoch",
"=",
"(",
"epoch",
"+",
"3",
")",
"==",
"final_epoch",
"or",
"(",
"epoch",
"+",
"7",
")",
"==",
"final_epoch",
"is_final_epoch",
"=",
"epoch",
"==",
"final_epoch",
"env_step_multiplier",
"=",
"3",
"if",
"is_final_epoch",
"else",
"2",
"if",
"is_special_epoch",
"else",
"1",
"learner",
".",
"train",
"(",
"env_fn",
",",
"train_hparams",
",",
"simulated",
"=",
"True",
",",
"save_continuously",
"=",
"True",
",",
"epoch",
"=",
"epoch",
",",
"env_step_multiplier",
"=",
"env_step_multiplier",
")"
] |
Train the PPO agent in the simulated environment.
|
[
"Train",
"the",
"PPO",
"agent",
"in",
"the",
"simulated",
"environment",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L141-L170
|
train
|
Train the PPO agent in the simulated environment.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,W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TRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(2549 - 2438) + '\x32' + '\065' + chr(0b10010 + 0o42), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101100 + 0o13) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(50) + '\065', 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(0b110001) + chr(0b110100) + chr(53), 29639 - 29631), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1611 - 1560) + chr(0b110111) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101000 + 0o107) + chr(0b110001) + chr(2137 - 2082) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11011 + 0o124) + chr(49) + chr(0b110111) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + '\062' + '\065' + '\067', 64398 - 64390), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b111 + 0o150) + chr(52) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2535 - 2424) + chr(0b110111) + chr(0b1101 + 0o43), 42743 - 42735), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(195 - 143) + chr(2174 - 2124), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000000 + 0o57) + chr(50) + chr(53), 0b1000), ehT0Px3KOsy9(chr(758 - 710) + chr(1440 - 1329) + chr(0b10 + 0o60) + '\x30' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(10676 - 10565) + chr(0b100000 + 0o25) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + chr(0b0 + 0o60), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(2063 - 2009) + chr(2729 - 2674), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + chr(0b110001) + '\x36', 47980 - 47972), ehT0Px3KOsy9(chr(465 - 417) + chr(0b1001010 + 0o45) + '\062' + '\063' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(712 - 664) + chr(0b1101111) + chr(0b110011) + '\x36' + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000100 + 0o53) + chr(0b1000 + 0o52) + '\x31' + chr(0b1100 + 0o52), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\061' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + '\x32' + chr(0b110011) + chr(0b11010 + 0o26), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + chr(49) + chr(0b110101) + chr(2695 - 2643), ord("\x08")), ehT0Px3KOsy9(chr(1934 - 1886) + '\x6f' + chr(0b101000 + 0o13) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1001 + 0o146) + chr(0b0 + 0o63) + chr(0b110111) + chr(0b110111), 6577 - 6569), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(1538 - 1488) + chr(1690 - 1635) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101 + 0o56) + chr(55) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(2066 - 2016) + chr(0b110100) + chr(468 - 413), 0o10), ehT0Px3KOsy9(chr(2274 - 2226) + chr(111) + chr(0b110111) + chr(0b10010 + 0o41), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b110010) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(510 - 462) + '\x6f' + '\x32' + chr(0b111 + 0o55) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(8720 - 8609) + chr(0b100001 + 0o22) + chr(0b11010 + 0o32) + chr(0b110111), 40029 - 40021), ehT0Px3KOsy9(chr(1788 - 1740) + '\157' + chr(51) + '\066' + chr(0b100111 + 0o15), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + '\063' + chr(2705 - 2652) + chr(2645 - 2593), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + chr(0b110010) + chr(0b110000) + chr(521 - 466), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(52) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100001 + 0o20) + '\060' + chr(1681 - 1630), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1270 - 1219) + chr(50) + chr(52), 1772 - 1764), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\065', 15756 - 15748)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x35' + '\x30', 37379 - 37371)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x82'), chr(0b111111 + 0o45) + chr(5128 - 5027) + '\143' + chr(1971 - 1860) + '\144' + chr(0b1010001 + 0o24))(chr(1141 - 1024) + '\164' + '\x66' + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def cv3JHpzWIwZy(EgS9dR_BAieQ, pdR5uWN8d5YQ, liGWULAjpmPi, n4ljua2gi1Pr, LWTVW06OsTjl):
OkKotjp_CVo5 = dS9nMkNNnOq2.make_initial_frame_chooser(EgS9dR_BAieQ, n4ljua2gi1Pr.YYpMgs8WK8M7, n4ljua2gi1Pr.fJlr2HKekDZ6, n4ljua2gi1Pr.simulation_flip_first_random_for_beginning)
LwGmvHQYXm7c = iwzD7IVqUS5S.make_simulated_env_fn_from_hparams(EgS9dR_BAieQ, n4ljua2gi1Pr, batch_size=n4ljua2gi1Pr.PBpnkLjxkvnI, initial_frame_chooser=OkKotjp_CVo5, model_dir=liGWULAjpmPi, sim_video_dir=oqhJDdMJfuwx.path.join(pdR5uWN8d5YQ.agent_model_dir, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdfR\xf8:\x88\x14\x1f\xcaIK\xbdn\xfe'), chr(100) + '\x65' + chr(142 - 43) + chr(0b1001010 + 0o45) + '\x64' + chr(101))(chr(0b1010101 + 0o40) + chr(116) + '\146' + chr(1078 - 1033) + '\x38').V4roHaS3Ppej(LWTVW06OsTjl)))
uqCnikHx6wvg = n4ljua2gi1Pr.fuZMZiRkIYJT
pM2hwsxlgqWw = KvtIAVGi33Ty.create_hparams(n4ljua2gi1Pr.eNhPLh6cTW8q)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdbV\xca\x15\x91\x11\x12\xcc_g\x92t\xf1Hm\xa8\xfd\xf2\x95}\xe7#\xff'), chr(0b1100100) + '\145' + '\x63' + '\157' + chr(0b1100010 + 0o2) + '\145')(chr(117) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b101011 + 0o15))):
pM2hwsxlgqWw.KM32JV3e0qHG = ehT0Px3KOsy9('\x30' + chr(0b111001 + 0o66) + chr(0b110001), 767 - 759)
xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9K\xf1\x04\x8a\x18$\xc7VY\x90t\xeeZ_\x91\xfc\xf5\x99P\xe6=\xf9\x1ex\x92\xc8'), chr(0b1100100) + chr(0b1100101) + chr(0b1100000 + 0o3) + chr(0b1101111) + chr(0b1011010 + 0o12) + '\x65')(chr(3553 - 3436) + '\164' + chr(6814 - 6712) + '\055' + chr(56)))(pM2hwsxlgqWw, n4ljua2gi1Pr, uqCnikHx6wvg + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3'), '\x64' + '\145' + '\143' + chr(0b100101 + 0o112) + chr(0b1100100) + '\145')('\x75' + chr(116) + chr(102) + chr(0b100000 + 0o15) + chr(0b111000)))
UTuRhX0zosFr = n4ljua2gi1Pr.xvDB7qObFSrr - ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001), 8)
CRImEQ4lHouw = LWTVW06OsTjl + ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51), 0o10) == UTuRhX0zosFr or LWTVW06OsTjl + ehT0Px3KOsy9(chr(666 - 618) + chr(0b1000111 + 0o50) + chr(55), ord("\x08")) == UTuRhX0zosFr
Z9DR74IB9Ca6 = LWTVW06OsTjl == UTuRhX0zosFr
i4oxwMVbUOk7 = ehT0Px3KOsy9('\x30' + '\157' + '\x33', 8) if Z9DR74IB9Ca6 else ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010), ord("\x08")) if CRImEQ4lHouw else ehT0Px3KOsy9(chr(48) + chr(2521 - 2410) + '\x31', 8)
xafqLlk3kkUe(pdR5uWN8d5YQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9\x03\xa5\x02\xac\x14\x14\xecL\\\x83a'), '\x64' + chr(0b1100101) + '\x63' + chr(0b1101111) + '\144' + chr(1975 - 1874))(chr(0b11100 + 0o131) + '\164' + '\x66' + chr(0b101101) + chr(1957 - 1901)))(LwGmvHQYXm7c, pM2hwsxlgqWw, simulated=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061', 8), save_continuously=ehT0Px3KOsy9('\x30' + chr(0b1010110 + 0o31) + '\061', 8), epoch=LWTVW06OsTjl, env_step_multiplier=i4oxwMVbUOk7)
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
train_agent_real_env
|
def train_agent_real_env(env, learner, hparams, epoch):
"""Train the PPO agent in the real environment."""
base_algo_str = hparams.base_algo
train_hparams = trainer_lib.create_hparams(hparams.base_algo_params)
rl_utils.update_hparams_from_hparams(
train_hparams, hparams, "real_" + base_algo_str + "_"
)
if hparams.wm_policy_param_sharing:
train_hparams.optimizer_zero_grads = True
env_fn = rl.make_real_env_fn(env)
num_env_steps = real_env_step_increment(hparams)
learner.train(
env_fn,
train_hparams,
simulated=False,
save_continuously=False,
epoch=epoch,
sampling_temp=hparams.real_sampling_temp,
num_env_steps=num_env_steps,
)
# Save unfinished rollouts to history.
env.reset()
|
python
|
def train_agent_real_env(env, learner, hparams, epoch):
"""Train the PPO agent in the real environment."""
base_algo_str = hparams.base_algo
train_hparams = trainer_lib.create_hparams(hparams.base_algo_params)
rl_utils.update_hparams_from_hparams(
train_hparams, hparams, "real_" + base_algo_str + "_"
)
if hparams.wm_policy_param_sharing:
train_hparams.optimizer_zero_grads = True
env_fn = rl.make_real_env_fn(env)
num_env_steps = real_env_step_increment(hparams)
learner.train(
env_fn,
train_hparams,
simulated=False,
save_continuously=False,
epoch=epoch,
sampling_temp=hparams.real_sampling_temp,
num_env_steps=num_env_steps,
)
# Save unfinished rollouts to history.
env.reset()
|
[
"def",
"train_agent_real_env",
"(",
"env",
",",
"learner",
",",
"hparams",
",",
"epoch",
")",
":",
"base_algo_str",
"=",
"hparams",
".",
"base_algo",
"train_hparams",
"=",
"trainer_lib",
".",
"create_hparams",
"(",
"hparams",
".",
"base_algo_params",
")",
"rl_utils",
".",
"update_hparams_from_hparams",
"(",
"train_hparams",
",",
"hparams",
",",
"\"real_\"",
"+",
"base_algo_str",
"+",
"\"_\"",
")",
"if",
"hparams",
".",
"wm_policy_param_sharing",
":",
"train_hparams",
".",
"optimizer_zero_grads",
"=",
"True",
"env_fn",
"=",
"rl",
".",
"make_real_env_fn",
"(",
"env",
")",
"num_env_steps",
"=",
"real_env_step_increment",
"(",
"hparams",
")",
"learner",
".",
"train",
"(",
"env_fn",
",",
"train_hparams",
",",
"simulated",
"=",
"False",
",",
"save_continuously",
"=",
"False",
",",
"epoch",
"=",
"epoch",
",",
"sampling_temp",
"=",
"hparams",
".",
"real_sampling_temp",
",",
"num_env_steps",
"=",
"num_env_steps",
",",
")",
"# Save unfinished rollouts to history.",
"env",
".",
"reset",
"(",
")"
] |
Train the PPO agent in the real environment.
|
[
"Train",
"the",
"PPO",
"agent",
"in",
"the",
"real",
"environment",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L173-L196
|
train
|
Train the PPO agent in the real environment.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,Z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=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\x33' + chr(221 - 167), 24707 - 24699), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1011 + 0o47) + chr(50) + chr(50), 11778 - 11770), ehT0Px3KOsy9('\060' + '\157' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(443 - 392) + '\x34' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(1536 - 1487) + chr(0b110110) + chr(0b110001), 41354 - 41346), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(52) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2205 - 2156) + '\065' + chr(0b100011 + 0o22), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(0b110100) + '\x34', 28708 - 28700), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(9723 - 9612) + chr(0b100110 + 0o14) + chr(0b10010 + 0o37) + chr(907 - 859), ord("\x08")), ehT0Px3KOsy9('\060' + chr(10192 - 10081) + chr(208 - 157) + chr(1202 - 1150) + chr(1645 - 1597), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(55) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b101110 + 0o11) + chr(1460 - 1407), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + '\x31' + chr(0b110010) + '\x34', 30155 - 30147), ehT0Px3KOsy9(chr(2017 - 1969) + '\157' + chr(51) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11110 + 0o23) + chr(0b11001 + 0o27) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2469 - 2419) + chr(2373 - 2321) + chr(320 - 265), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\064' + chr(0b100 + 0o60), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1572 - 1461) + chr(0b101000 + 0o13) + chr(0b1001 + 0o53) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b11101 + 0o25) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(2440 - 2389) + chr(0b110110) + chr(0b101000 + 0o17), 61301 - 61293), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + chr(0b10010 + 0o41) + chr(0b110101) + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(669 - 558) + chr(0b110010) + chr(379 - 331) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10 + 0o155) + '\063' + '\066' + chr(1693 - 1638), 8), ehT0Px3KOsy9('\060' + '\157' + '\062' + '\x30' + chr(1980 - 1930), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001 + 0o0) + '\x30' + '\062', 21524 - 21516), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b10100 + 0o133) + chr(121 - 71) + chr(0b11000 + 0o33) + chr(0b11010 + 0o35), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + '\063' + chr(1922 - 1868) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1000 + 0o52) + chr(49) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1423 - 1373) + '\062' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1736 - 1687) + chr(48) + chr(49), 41764 - 41756), ehT0Px3KOsy9('\x30' + chr(5441 - 5330) + '\x32' + chr(2799 - 2745) + '\066', 0b1000), ehT0Px3KOsy9(chr(280 - 232) + chr(0b1001101 + 0o42) + chr(0b1110 + 0o45) + '\x35' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2839 - 2728) + chr(0b101001 + 0o10) + '\060' + chr(2279 - 2224), 1928 - 1920), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(0b100010 + 0o21) + chr(0b100 + 0o56) + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(5215 - 5104) + chr(0b100000 + 0o22) + '\x30' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(0b110000 + 0o2) + '\x32' + chr(0b110111), 17300 - 17292), ehT0Px3KOsy9(chr(1319 - 1271) + chr(0b1101111) + chr(50) + chr(0b11 + 0o60) + '\061', 0b1000), ehT0Px3KOsy9(chr(1372 - 1324) + chr(9510 - 9399) + '\064' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(181 - 133) + chr(0b1001101 + 0o42) + '\x32' + chr(54) + '\x36', 8), ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + chr(53) + chr(0b110001), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + '\065' + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'p'), '\x64' + chr(0b1100101) + chr(99) + chr(0b1001001 + 0o46) + chr(100) + chr(0b1100101))(chr(0b101111 + 0o106) + '\x74' + chr(0b111 + 0o137) + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hYldmLcs8Ha2(xzsHIGfR8Ip5, pdR5uWN8d5YQ, n4ljua2gi1Pr, LWTVW06OsTjl):
uqCnikHx6wvg = n4ljua2gi1Pr.fuZMZiRkIYJT
pM2hwsxlgqWw = KvtIAVGi33Ty.create_hparams(n4ljua2gi1Pr.eNhPLh6cTW8q)
xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'+\xe2b\x80\x05\xc52\x8c\xf8\x81K\xdc9k\x1b\xc1\x16\x8c\xfd\xa8\x84\xf3\x96\xf0#\xf2\x80'), '\144' + '\x65' + '\x63' + chr(111) + chr(100) + chr(101))('\165' + chr(0b111000 + 0o74) + chr(7637 - 7535) + chr(45) + chr(2514 - 2458)))(pM2hwsxlgqWw, n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b',\xf7g\x8d.'), chr(0b101101 + 0o67) + chr(1881 - 1780) + chr(6657 - 6558) + '\x6f' + chr(100) + '\145')('\x75' + chr(9107 - 8991) + chr(0b1100110) + chr(0b101101) + chr(0b111000)) + uqCnikHx6wvg + xafqLlk3kkUe(SXOLrMavuUCe(b'\x01'), chr(0b110011 + 0o61) + chr(101) + chr(0b1100011) + '\157' + '\x64' + '\x65')(chr(117) + chr(0b1010 + 0o152) + '\x66' + chr(45) + chr(1002 - 946)))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b')\xffY\x91\x1e\xcc\x04\x87\xf1\xbfI\xdc&y)\xf8\x17\x8b\xf1\x85\x85\xed\x90'), chr(100) + chr(3929 - 3828) + '\143' + chr(111) + chr(4265 - 4165) + chr(0b1100010 + 0o3))('\x75' + chr(10917 - 10801) + '\146' + '\055' + '\x38')):
pM2hwsxlgqWw.KM32JV3e0qHG = ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + chr(1916 - 1867), 0b1000)
LwGmvHQYXm7c = iwzD7IVqUS5S.make_real_env_fn(xzsHIGfR8Ip5)
aVw2a5YbMc6U = OloIzKRk7KQn(n4ljua2gi1Pr)
xafqLlk3kkUe(pdR5uWN8d5YQ, xafqLlk3kkUe(SXOLrMavuUCe(b';\xaa6\x86#\xc9\x02\xa7\xe2\x84X\xc9'), chr(0b1100100 + 0o0) + chr(101) + '\x63' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(13041 - 12925) + chr(102) + chr(1577 - 1532) + '\070'))(LwGmvHQYXm7c, pM2hwsxlgqWw, simulated=ehT0Px3KOsy9(chr(2012 - 1964) + chr(0b1010111 + 0o30) + '\x30', 0o10), save_continuously=ehT0Px3KOsy9(chr(1778 - 1730) + chr(111) + chr(48), 8), epoch=LWTVW06OsTjl, sampling_temp=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b',\xf7g\x8d.\xd3\x0c\x89\xf8\x8cP\xd33G0\xc2\t\x93'), chr(0b1100010 + 0o2) + '\x65' + chr(3225 - 3126) + chr(0b111001 + 0o66) + chr(1315 - 1215) + chr(0b1001101 + 0o30))('\165' + chr(0b1110100) + chr(5039 - 4937) + '\x2d' + chr(348 - 292))), num_env_steps=aVw2a5YbMc6U)
xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b',\xf7u\x84\x05'), chr(0b1100100) + chr(0b1011 + 0o132) + chr(99) + chr(10634 - 10523) + chr(4615 - 4515) + chr(5573 - 5472))(chr(0b1101110 + 0o7) + chr(116) + '\146' + chr(1899 - 1854) + '\070'))()
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
train_world_model
|
def train_world_model(
env, data_dir, output_dir, hparams, world_model_steps_num, epoch
):
"""Train the world model on problem_name."""
world_model_steps_num += world_model_step_increment(
hparams, is_initial_epoch=(epoch == 0)
)
model_hparams = trainer_lib.create_hparams(hparams.generative_model_params)
model_hparams.learning_rate = model_hparams.learning_rate_constant
if epoch > 0:
model_hparams.learning_rate *= hparams.learning_rate_bump
if hparams.wm_policy_param_sharing:
model_hparams.optimizer_zero_grads = True
restarter = Restarter("world_model", output_dir, world_model_steps_num)
if restarter.should_skip:
return world_model_steps_num
with restarter.training_loop():
train_supervised(
problem=env,
model_name=hparams.generative_model,
hparams=model_hparams,
data_dir=data_dir,
output_dir=output_dir,
train_steps=restarter.target_global_step,
eval_steps=100,
local_eval_frequency=2000
)
return world_model_steps_num
|
python
|
def train_world_model(
env, data_dir, output_dir, hparams, world_model_steps_num, epoch
):
"""Train the world model on problem_name."""
world_model_steps_num += world_model_step_increment(
hparams, is_initial_epoch=(epoch == 0)
)
model_hparams = trainer_lib.create_hparams(hparams.generative_model_params)
model_hparams.learning_rate = model_hparams.learning_rate_constant
if epoch > 0:
model_hparams.learning_rate *= hparams.learning_rate_bump
if hparams.wm_policy_param_sharing:
model_hparams.optimizer_zero_grads = True
restarter = Restarter("world_model", output_dir, world_model_steps_num)
if restarter.should_skip:
return world_model_steps_num
with restarter.training_loop():
train_supervised(
problem=env,
model_name=hparams.generative_model,
hparams=model_hparams,
data_dir=data_dir,
output_dir=output_dir,
train_steps=restarter.target_global_step,
eval_steps=100,
local_eval_frequency=2000
)
return world_model_steps_num
|
[
"def",
"train_world_model",
"(",
"env",
",",
"data_dir",
",",
"output_dir",
",",
"hparams",
",",
"world_model_steps_num",
",",
"epoch",
")",
":",
"world_model_steps_num",
"+=",
"world_model_step_increment",
"(",
"hparams",
",",
"is_initial_epoch",
"=",
"(",
"epoch",
"==",
"0",
")",
")",
"model_hparams",
"=",
"trainer_lib",
".",
"create_hparams",
"(",
"hparams",
".",
"generative_model_params",
")",
"model_hparams",
".",
"learning_rate",
"=",
"model_hparams",
".",
"learning_rate_constant",
"if",
"epoch",
">",
"0",
":",
"model_hparams",
".",
"learning_rate",
"*=",
"hparams",
".",
"learning_rate_bump",
"if",
"hparams",
".",
"wm_policy_param_sharing",
":",
"model_hparams",
".",
"optimizer_zero_grads",
"=",
"True",
"restarter",
"=",
"Restarter",
"(",
"\"world_model\"",
",",
"output_dir",
",",
"world_model_steps_num",
")",
"if",
"restarter",
".",
"should_skip",
":",
"return",
"world_model_steps_num",
"with",
"restarter",
".",
"training_loop",
"(",
")",
":",
"train_supervised",
"(",
"problem",
"=",
"env",
",",
"model_name",
"=",
"hparams",
".",
"generative_model",
",",
"hparams",
"=",
"model_hparams",
",",
"data_dir",
"=",
"data_dir",
",",
"output_dir",
"=",
"output_dir",
",",
"train_steps",
"=",
"restarter",
".",
"target_global_step",
",",
"eval_steps",
"=",
"100",
",",
"local_eval_frequency",
"=",
"2000",
")",
"return",
"world_model_steps_num"
] |
Train the world model on problem_name.
|
[
"Train",
"the",
"world",
"model",
"on",
"problem_name",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L199-L228
|
train
|
Train the world model on problem_name.
|
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('\060' + '\157' + '\x32' + '\061' + chr(0b101011 + 0o10), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + '\x32' + '\061' + chr(425 - 374), 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b111111 + 0o60) + chr(49) + chr(1468 - 1418) + chr(1271 - 1221), 5639 - 5631), ehT0Px3KOsy9('\060' + '\x6f' + chr(1496 - 1447) + chr(1117 - 1064) + chr(0b101110 + 0o11), 39333 - 39325), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1 + 0o156) + chr(0b110100) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(50) + chr(633 - 579) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(5065 - 4954) + chr(50) + '\063' + '\067', 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b111 + 0o150) + '\062' + chr(0b110110) + chr(2488 - 2434), 8), ehT0Px3KOsy9(chr(1095 - 1047) + chr(111) + chr(51) + '\x32' + chr(0b100110 + 0o14), 45729 - 45721), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100011 + 0o16) + '\x37' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2355 - 2303) + '\061', 8), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1110 + 0o141) + chr(50) + '\061' + chr(0b1100 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(168 - 120) + '\157' + '\063' + chr(52) + '\x33', 19738 - 19730), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\061' + '\063', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1011110 + 0o21) + chr(0b110011) + '\x36' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(2289 - 2241) + chr(0b1101111) + chr(0b110010) + '\x34' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(0b101001 + 0o10) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + '\065' + chr(736 - 686), 33983 - 33975), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1010110 + 0o31) + '\062' + chr(2415 - 2362) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\x31' + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110 + 0o53) + chr(50) + chr(50), 8), ehT0Px3KOsy9(chr(465 - 417) + '\157' + '\x34', 0b1000), ehT0Px3KOsy9(chr(1666 - 1618) + chr(111) + chr(1628 - 1579) + chr(0b110110), 64569 - 64561), ehT0Px3KOsy9('\060' + '\157' + chr(0b11111 + 0o23) + '\x35' + chr(0b100110 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(927 - 879) + chr(0b1101111) + chr(0b11111 + 0o24) + chr(0b10011 + 0o43) + chr(51), 32972 - 32964), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(0b1010 + 0o50) + '\x32', 50259 - 50251), ehT0Px3KOsy9('\x30' + chr(0b101101 + 0o102) + '\061' + '\063' + chr(2524 - 2472), 51941 - 51933), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2088 - 2039) + chr(48) + chr(1967 - 1916), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110100) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(747 - 699) + chr(0b1110 + 0o141) + chr(0b101111 + 0o3) + '\x32' + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(4430 - 4319) + '\062' + '\x33' + chr(0b110101), 43130 - 43122), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(10907 - 10796) + chr(0b10011 + 0o37) + chr(0b110101 + 0o0) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x34' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1910 - 1799) + '\x31' + chr(52) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11011 + 0o30) + '\x31' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b110010) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(1817 - 1769) + chr(0b1110 + 0o141) + '\x32' + chr(52) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + chr(413 - 364) + chr(0b110010) + '\062', 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\x33' + chr(0b100011 + 0o21), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(63 - 15) + chr(111) + '\x35' + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5'), chr(100) + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(810 - 710) + chr(0b1100101))(chr(0b1110101) + chr(0b100011 + 0o121) + '\x66' + chr(1752 - 1707) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def p11T8nW9C6Hi(xzsHIGfR8Ip5, kVFRD544hi_1, nd0OX_BS6_o4, n4ljua2gi1Pr, yoEqdytCcl1H, LWTVW06OsTjl):
yoEqdytCcl1H += wU68zKKhYw5l(n4ljua2gi1Pr, is_initial_epoch=LWTVW06OsTjl == ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1011 + 0o45), 0b1000))
tq24Tk6UZ6u1 = KvtIAVGi33Ty.create_hparams(n4ljua2gi1Pr.YBEkVLgqMiCU)
tq24Tk6UZ6u1.QGSIpd_yUNzU = tq24Tk6UZ6u1.Ot9HUjnkxXA_
if LWTVW06OsTjl > ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 8):
tq24Tk6UZ6u1.QGSIpd_yUNzU *= n4ljua2gi1Pr.rgYNOuacdxId
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\xe6\r\x1fN\xdaw\xfc\xcf\x8d\x0b@\xf8\x82\xa6\xa8\xd2bK\xd8b<c'), chr(100) + '\x65' + chr(0b1100011) + '\157' + '\x64' + chr(5517 - 5416))(chr(0b1110101) + chr(0b1110100) + chr(9398 - 9296) + chr(0b101001 + 0o4) + chr(56))):
tq24Tk6UZ6u1.KM32JV3e0qHG = ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(1822 - 1773), ord("\x08"))
vQBi6leoJfJ0 = tOAJtkbGZFHu(xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc\xe4 \x03E\xe9s\xf0\xd2\xb7\x17'), chr(0b1100100) + chr(0b10111 + 0o116) + '\x63' + chr(9766 - 9655) + '\144' + chr(3590 - 3489))('\x75' + chr(0b10010 + 0o142) + chr(0b100110 + 0o100) + chr(45) + chr(1516 - 1460)), nd0OX_BS6_o4, yoEqdytCcl1H)
if xafqLlk3kkUe(vQBi6leoJfJ0, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\xe3=\x1aM\xd2A\xec\xdd\xbb\x0b'), chr(100) + '\x65' + '\x63' + chr(111) + chr(0b11010 + 0o112) + chr(101))(chr(0b1000000 + 0o65) + '\x74' + chr(0b1010010 + 0o24) + '\x2d' + '\070')):
return yoEqdytCcl1H
with xafqLlk3kkUe(vQBi6leoJfJ0, xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\xf93\x06O\xdfp\xf8\xe9\xbe\x14N\xfa'), chr(9952 - 9852) + chr(101) + chr(2612 - 2513) + '\x6f' + chr(5072 - 4972) + '\x65')(chr(0b10000 + 0o145) + chr(116) + '\x66' + chr(0b10000 + 0o35) + '\070'))():
kaQjr4LrpKBL(problem=xzsHIGfR8Ip5, model_name=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xdd\x1b\x06G\xd0N\xfa\xf8\xe5\x02`'), '\x64' + '\145' + chr(2537 - 2438) + '\x6f' + chr(0b1011 + 0o131) + '\x65')(chr(0b1110101) + chr(0b110011 + 0o101) + '\146' + '\x2d' + chr(56))), hparams=tq24Tk6UZ6u1, data_dir=kVFRD544hi_1, output_dir=nd0OX_BS6_o4, train_steps=xafqLlk3kkUe(vQBi6leoJfJ0, xafqLlk3kkUe(SXOLrMavuUCe(b'\xff\xea \x08D\xc2A\xf8\xda\xbd\x19@\xe6\xbc\xb8\x83\xc4z'), '\144' + chr(0b110011 + 0o62) + '\x63' + chr(0b1000111 + 0o50) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + '\164' + '\x66' + '\x2d' + chr(56))), eval_steps=ehT0Px3KOsy9(chr(1959 - 1911) + '\x6f' + chr(1573 - 1524) + chr(52) + '\x34', ord("\x08")), local_eval_frequency=ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1001110 + 0o41) + chr(51) + chr(0b100 + 0o63) + '\x32' + chr(0b110000), ord("\x08")))
return yoEqdytCcl1H
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
load_metrics
|
def load_metrics(event_dir, epoch):
"""Loads metrics for this epoch if they have already been written.
This reads the entire event file but it's small with just per-epoch metrics.
Args:
event_dir: TODO(koz4k): Document this.
epoch: TODO(koz4k): Document this.
Returns:
metrics.
"""
metrics = {}
for filename in tf.gfile.ListDirectory(event_dir):
path = os.path.join(event_dir, filename)
for event in tf.train.summary_iterator(path):
if event.step == epoch and event.HasField("summary"):
value = event.summary.value[0]
metrics[value.tag] = value.simple_value
return metrics
|
python
|
def load_metrics(event_dir, epoch):
"""Loads metrics for this epoch if they have already been written.
This reads the entire event file but it's small with just per-epoch metrics.
Args:
event_dir: TODO(koz4k): Document this.
epoch: TODO(koz4k): Document this.
Returns:
metrics.
"""
metrics = {}
for filename in tf.gfile.ListDirectory(event_dir):
path = os.path.join(event_dir, filename)
for event in tf.train.summary_iterator(path):
if event.step == epoch and event.HasField("summary"):
value = event.summary.value[0]
metrics[value.tag] = value.simple_value
return metrics
|
[
"def",
"load_metrics",
"(",
"event_dir",
",",
"epoch",
")",
":",
"metrics",
"=",
"{",
"}",
"for",
"filename",
"in",
"tf",
".",
"gfile",
".",
"ListDirectory",
"(",
"event_dir",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"event_dir",
",",
"filename",
")",
"for",
"event",
"in",
"tf",
".",
"train",
".",
"summary_iterator",
"(",
"path",
")",
":",
"if",
"event",
".",
"step",
"==",
"epoch",
"and",
"event",
".",
"HasField",
"(",
"\"summary\"",
")",
":",
"value",
"=",
"event",
".",
"summary",
".",
"value",
"[",
"0",
"]",
"metrics",
"[",
"value",
".",
"tag",
"]",
"=",
"value",
".",
"simple_value",
"return",
"metrics"
] |
Loads metrics for this epoch if they have already been written.
This reads the entire event file but it's small with just per-epoch metrics.
Args:
event_dir: TODO(koz4k): Document this.
epoch: TODO(koz4k): Document this.
Returns:
metrics.
|
[
"Loads",
"metrics",
"for",
"this",
"epoch",
"if",
"they",
"have",
"already",
"been",
"written",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based.py#L231-L250
|
train
|
Loads metrics for this epoch if they have already been written.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,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kLpS8s,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(0b10101 + 0o33) + chr(111) + chr(0b101110 + 0o4) + '\060' + chr(0b110010), 3544 - 3536), ehT0Px3KOsy9('\060' + '\157' + chr(0b11 + 0o57) + chr(2371 - 2317) + chr(0b110001), 23236 - 23228), ehT0Px3KOsy9(chr(1975 - 1927) + chr(0b101100 + 0o103) + chr(50) + chr(0b110000) + '\x31', 13788 - 13780), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101 + 0o142) + '\061' + '\061' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(2035 - 1983) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3009 - 2898) + chr(53) + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + chr(0b101110 + 0o3) + chr(1632 - 1583) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x37' + '\x32', 0o10), ehT0Px3KOsy9(chr(2142 - 2094) + '\x6f' + chr(0b11001 + 0o31) + chr(0b100111 + 0o17) + '\065', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b10101 + 0o35) + chr(2148 - 2096) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1001100 + 0o43) + chr(0b11 + 0o56) + '\064' + chr(51), 15997 - 15989), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + '\x31' + '\x35' + chr(52), 33943 - 33935), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(1835 - 1787) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(54) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(4548 - 4437) + '\061' + '\x35' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1100001 + 0o16) + '\061' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b110011) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(0b110010) + chr(2735 - 2680) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101001 + 0o6) + chr(0b100011 + 0o23) + chr(0b10000 + 0o43), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(54) + '\x33', 8), ehT0Px3KOsy9('\060' + chr(11938 - 11827) + '\062' + chr(0b110110) + '\x30', 0b1000), ehT0Px3KOsy9(chr(1695 - 1647) + chr(0b1101111) + '\x32' + chr(1527 - 1478) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b11101 + 0o122) + chr(2502 - 2449) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + '\x30' + chr(51), 12799 - 12791), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(0b10000 + 0o45) + chr(635 - 585), 50058 - 50050), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(49) + chr(0b101100 + 0o11), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(0b110010) + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\067' + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(51) + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\062' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(570 - 519) + '\061' + chr(0b1110 + 0o51), 0b1000), ehT0Px3KOsy9('\060' + chr(762 - 651) + '\x33' + chr(52) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + '\063' + '\060' + chr(801 - 753), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\x6f' + chr(0b10111 + 0o32) + chr(0b110101) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(8922 - 8811) + chr(0b110010) + chr(1675 - 1620) + chr(53), 0o10), ehT0Px3KOsy9(chr(1439 - 1391) + chr(111) + chr(0b10100 + 0o41) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10 + 0o155) + chr(0b1101 + 0o45) + chr(2396 - 2345) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(1520 - 1472) + chr(0b1101111) + chr(0b10011 + 0o36) + chr(2538 - 2484) + '\067', 0b1000), ehT0Px3KOsy9(chr(1969 - 1921) + chr(0b101011 + 0o104) + chr(0b100010 + 0o21) + chr(51) + chr(0b11110 + 0o26), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010 + 0o145) + chr(864 - 814) + chr(0b100101 + 0o21) + chr(0b1100 + 0o50), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(180 - 127) + chr(0b10100 + 0o34), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xac'), chr(100) + chr(101) + chr(0b101100 + 0o67) + chr(0b1101111) + chr(2758 - 2658) + '\x65')(chr(0b11010 + 0o133) + chr(116) + chr(0b1100110) + chr(0b100000 + 0o15) + chr(0b110110 + 0o2)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def FYxaijDbiVw7(_qkMyi7xY23I, LWTVW06OsTjl):
yYegMqDoSfs5 = {}
for xw4DsBfIJ22E in xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\xd8\xf2?\xe1E;\x1f\xd6\xd6\x0c\x1e9'), '\x64' + '\145' + '\143' + chr(0b1010 + 0o145) + chr(0b1100100) + chr(0b1100100 + 0o1))('\165' + '\164' + '\x66' + chr(1237 - 1192) + chr(2607 - 2551)))(_qkMyi7xY23I):
EaCjyhZptSer = oqhJDdMJfuwx.path.join(_qkMyi7xY23I, xw4DsBfIJ22E)
for SGm65G84ZKM5 in xafqLlk3kkUe(IDJ2eXGCBCDu.train, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1\xc4\xec&\xc4^0%\xdc\xd6\x06\x1e!\xc0\x01\x7f'), '\x64' + chr(0b1001010 + 0o33) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(0b1100101))('\165' + '\x74' + chr(0b1100110) + chr(0b11111 + 0o16) + '\070'))(EaCjyhZptSer):
if xafqLlk3kkUe(SGm65G84ZKM5, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xf5\xf4\r\xd6m!?\xd4\xd6\x009'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b1100 + 0o130) + chr(0b1100101))('\x75' + chr(116) + '\x66' + '\055' + '\x38')) == LWTVW06OsTjl and xafqLlk3kkUe(SGm65G84ZKM5, xafqLlk3kkUe(SXOLrMavuUCe(b'\xca\xd0\xf2\r\xccI%\x1e'), '\144' + '\x65' + chr(99) + chr(0b1101111) + '\144' + chr(657 - 556))(chr(0b1110101) + chr(116) + '\146' + '\055' + chr(706 - 650)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1\xc4\xec&\xc4^0'), chr(8485 - 8385) + chr(0b1100101) + chr(2953 - 2854) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))('\165' + chr(116) + chr(102) + chr(45) + chr(0b111000))):
QmmgWUB13VCJ = SGm65G84ZKM5.summary.QmmgWUB13VCJ[ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(404 - 293) + '\x30', 0o10)]
yYegMqDoSfs5[QmmgWUB13VCJ.CPdEsc5O1sf7] = QmmgWUB13VCJ.simple_value
return yYegMqDoSfs5
|
tensorflow/tensor2tensor
|
tensor2tensor/rl/trainer_model_based.py
|
training_loop
|
def training_loop(hparams, output_dir, report_fn=None, report_metric=None):
"""Run the main training loop."""
if report_fn:
assert report_metric is not None
# Directories
subdirectories = [
"data", "tmp", "world_model", ("world_model", "debug_videos"),
"policy", "eval_metrics"
]
directories = setup_directories(output_dir, subdirectories)
epoch = -1
data_dir = directories["data"]
env = rl_utils.setup_env(
hparams, batch_size=hparams.real_batch_size,
max_num_noops=hparams.max_num_noops,
rl_env_max_episode_steps=hparams.rl_env_max_episode_steps
)
env.start_new_epoch(epoch, data_dir)
if hparams.wm_policy_param_sharing:
policy_model_dir = directories["world_model"]
else:
policy_model_dir = directories["policy"]
learner = rl_utils.LEARNERS[hparams.base_algo](
hparams.frame_stack_size, policy_model_dir,
policy_model_dir, hparams.epochs
)
# Timing log function
log_relative_time = make_relative_timing_fn()
# Per-epoch state
epoch_metrics = []
metrics = {}
# Collect data from the real environment.
policy_model_dir = directories["policy"]
tf.logging.info("Initial training of the policy in real environment.")
train_agent_real_env(env, learner, hparams, epoch)
metrics["mean_reward/train/clipped"] = rl_utils.compute_mean_reward(
env.current_epoch_rollouts(), clipped=True
)
tf.logging.info("Mean training reward (initial): {}".format(
metrics["mean_reward/train/clipped"]
))
env.generate_data(data_dir)
eval_metrics_writer = tf.summary.FileWriter(
directories["eval_metrics"]
)
world_model_steps_num = 0
for epoch in range(hparams.epochs):
log = make_log_fn(epoch, log_relative_time)
# Train world model
log("Training world model")
world_model_steps_num = train_world_model(
env, data_dir, directories["world_model"], hparams,
world_model_steps_num, epoch
)
# Train agent
log("Training policy in simulated environment.")
train_agent(env, learner, directories["world_model"], hparams, epoch)
env.start_new_epoch(epoch, data_dir)
# Train agent on real env (short)
log("Training policy in real environment.")
train_agent_real_env(env, learner, hparams, epoch)
if hparams.stop_loop_early:
return 0.0
env.generate_data(data_dir)
metrics = load_metrics(directories["eval_metrics"], epoch)
if metrics:
# Skip eval if metrics have already been written for this epoch. Otherwise
# we'd overwrite them with wrong data.
log("Metrics found for this epoch, skipping evaluation.")
else:
metrics["mean_reward/train/clipped"] = rl_utils.compute_mean_reward(
env.current_epoch_rollouts(), clipped=True
)
log("Mean training reward: {}".format(
metrics["mean_reward/train/clipped"]
))
eval_metrics = rl_utils.evaluate_all_configs(hparams, policy_model_dir)
log("Agent eval metrics:\n{}".format(pprint.pformat(eval_metrics)))
metrics.update(eval_metrics)
if hparams.eval_world_model:
debug_video_path = os.path.join(
directories["world_model", "debug_videos"],
"{}.avi".format(env.current_epoch)
)
wm_metrics = rl_utils.evaluate_world_model(
env, hparams, directories["world_model"], debug_video_path
)
log("World model eval metrics:\n{}".format(pprint.pformat(wm_metrics)))
metrics.update(wm_metrics)
rl_utils.summarize_metrics(eval_metrics_writer, metrics, epoch)
# Report metrics
if report_fn:
if report_metric == "mean_reward":
metric_name = rl_utils.get_metric_name(
sampling_temp=hparams.eval_sampling_temps[0],
max_num_noops=hparams.eval_max_num_noops,
clipped=False
)
report_fn(eval_metrics[metric_name], epoch)
else:
report_fn(eval_metrics[report_metric], epoch)
epoch_metrics.append(metrics)
# Return the evaluation metrics from the final epoch
return epoch_metrics[-1]
|
python
|
def training_loop(hparams, output_dir, report_fn=None, report_metric=None):
"""Run the main training loop."""
if report_fn:
assert report_metric is not None
# Directories
subdirectories = [
"data", "tmp", "world_model", ("world_model", "debug_videos"),
"policy", "eval_metrics"
]
directories = setup_directories(output_dir, subdirectories)
epoch = -1
data_dir = directories["data"]
env = rl_utils.setup_env(
hparams, batch_size=hparams.real_batch_size,
max_num_noops=hparams.max_num_noops,
rl_env_max_episode_steps=hparams.rl_env_max_episode_steps
)
env.start_new_epoch(epoch, data_dir)
if hparams.wm_policy_param_sharing:
policy_model_dir = directories["world_model"]
else:
policy_model_dir = directories["policy"]
learner = rl_utils.LEARNERS[hparams.base_algo](
hparams.frame_stack_size, policy_model_dir,
policy_model_dir, hparams.epochs
)
# Timing log function
log_relative_time = make_relative_timing_fn()
# Per-epoch state
epoch_metrics = []
metrics = {}
# Collect data from the real environment.
policy_model_dir = directories["policy"]
tf.logging.info("Initial training of the policy in real environment.")
train_agent_real_env(env, learner, hparams, epoch)
metrics["mean_reward/train/clipped"] = rl_utils.compute_mean_reward(
env.current_epoch_rollouts(), clipped=True
)
tf.logging.info("Mean training reward (initial): {}".format(
metrics["mean_reward/train/clipped"]
))
env.generate_data(data_dir)
eval_metrics_writer = tf.summary.FileWriter(
directories["eval_metrics"]
)
world_model_steps_num = 0
for epoch in range(hparams.epochs):
log = make_log_fn(epoch, log_relative_time)
# Train world model
log("Training world model")
world_model_steps_num = train_world_model(
env, data_dir, directories["world_model"], hparams,
world_model_steps_num, epoch
)
# Train agent
log("Training policy in simulated environment.")
train_agent(env, learner, directories["world_model"], hparams, epoch)
env.start_new_epoch(epoch, data_dir)
# Train agent on real env (short)
log("Training policy in real environment.")
train_agent_real_env(env, learner, hparams, epoch)
if hparams.stop_loop_early:
return 0.0
env.generate_data(data_dir)
metrics = load_metrics(directories["eval_metrics"], epoch)
if metrics:
# Skip eval if metrics have already been written for this epoch. Otherwise
# we'd overwrite them with wrong data.
log("Metrics found for this epoch, skipping evaluation.")
else:
metrics["mean_reward/train/clipped"] = rl_utils.compute_mean_reward(
env.current_epoch_rollouts(), clipped=True
)
log("Mean training reward: {}".format(
metrics["mean_reward/train/clipped"]
))
eval_metrics = rl_utils.evaluate_all_configs(hparams, policy_model_dir)
log("Agent eval metrics:\n{}".format(pprint.pformat(eval_metrics)))
metrics.update(eval_metrics)
if hparams.eval_world_model:
debug_video_path = os.path.join(
directories["world_model", "debug_videos"],
"{}.avi".format(env.current_epoch)
)
wm_metrics = rl_utils.evaluate_world_model(
env, hparams, directories["world_model"], debug_video_path
)
log("World model eval metrics:\n{}".format(pprint.pformat(wm_metrics)))
metrics.update(wm_metrics)
rl_utils.summarize_metrics(eval_metrics_writer, metrics, epoch)
# Report metrics
if report_fn:
if report_metric == "mean_reward":
metric_name = rl_utils.get_metric_name(
sampling_temp=hparams.eval_sampling_temps[0],
max_num_noops=hparams.eval_max_num_noops,
clipped=False
)
report_fn(eval_metrics[metric_name], epoch)
else:
report_fn(eval_metrics[report_metric], epoch)
epoch_metrics.append(metrics)
# Return the evaluation metrics from the final epoch
return epoch_metrics[-1]
|
[
"def",
"training_loop",
"(",
"hparams",
",",
"output_dir",
",",
"report_fn",
"=",
"None",
",",
"report_metric",
"=",
"None",
")",
":",
"if",
"report_fn",
":",
"assert",
"report_metric",
"is",
"not",
"None",
"# Directories",
"subdirectories",
"=",
"[",
"\"data\"",
",",
"\"tmp\"",
",",
"\"world_model\"",
",",
"(",
"\"world_model\"",
",",
"\"debug_videos\"",
")",
",",
"\"policy\"",
",",
"\"eval_metrics\"",
"]",
"directories",
"=",
"setup_directories",
"(",
"output_dir",
",",
"subdirectories",
")",
"epoch",
"=",
"-",
"1",
"data_dir",
"=",
"directories",
"[",
"\"data\"",
"]",
"env",
"=",
"rl_utils",
".",
"setup_env",
"(",
"hparams",
",",
"batch_size",
"=",
"hparams",
".",
"real_batch_size",
",",
"max_num_noops",
"=",
"hparams",
".",
"max_num_noops",
",",
"rl_env_max_episode_steps",
"=",
"hparams",
".",
"rl_env_max_episode_steps",
")",
"env",
".",
"start_new_epoch",
"(",
"epoch",
",",
"data_dir",
")",
"if",
"hparams",
".",
"wm_policy_param_sharing",
":",
"policy_model_dir",
"=",
"directories",
"[",
"\"world_model\"",
"]",
"else",
":",
"policy_model_dir",
"=",
"directories",
"[",
"\"policy\"",
"]",
"learner",
"=",
"rl_utils",
".",
"LEARNERS",
"[",
"hparams",
".",
"base_algo",
"]",
"(",
"hparams",
".",
"frame_stack_size",
",",
"policy_model_dir",
",",
"policy_model_dir",
",",
"hparams",
".",
"epochs",
")",
"# Timing log function",
"log_relative_time",
"=",
"make_relative_timing_fn",
"(",
")",
"# Per-epoch state",
"epoch_metrics",
"=",
"[",
"]",
"metrics",
"=",
"{",
"}",
"# Collect data from the real environment.",
"policy_model_dir",
"=",
"directories",
"[",
"\"policy\"",
"]",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Initial training of the policy in real environment.\"",
")",
"train_agent_real_env",
"(",
"env",
",",
"learner",
",",
"hparams",
",",
"epoch",
")",
"metrics",
"[",
"\"mean_reward/train/clipped\"",
"]",
"=",
"rl_utils",
".",
"compute_mean_reward",
"(",
"env",
".",
"current_epoch_rollouts",
"(",
")",
",",
"clipped",
"=",
"True",
")",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Mean training reward (initial): {}\"",
".",
"format",
"(",
"metrics",
"[",
"\"mean_reward/train/clipped\"",
"]",
")",
")",
"env",
".",
"generate_data",
"(",
"data_dir",
")",
"eval_metrics_writer",
"=",
"tf",
".",
"summary",
".",
"FileWriter",
"(",
"directories",
"[",
"\"eval_metrics\"",
"]",
")",
"world_model_steps_num",
"=",
"0",
"for",
"epoch",
"in",
"range",
"(",
"hparams",
".",
"epochs",
")",
":",
"log",
"=",
"make_log_fn",
"(",
"epoch",
",",
"log_relative_time",
")",
"# Train world model",
"log",
"(",
"\"Training world model\"",
")",
"world_model_steps_num",
"=",
"train_world_model",
"(",
"env",
",",
"data_dir",
",",
"directories",
"[",
"\"world_model\"",
"]",
",",
"hparams",
",",
"world_model_steps_num",
",",
"epoch",
")",
"# Train agent",
"log",
"(",
"\"Training policy in simulated environment.\"",
")",
"train_agent",
"(",
"env",
",",
"learner",
",",
"directories",
"[",
"\"world_model\"",
"]",
",",
"hparams",
",",
"epoch",
")",
"env",
".",
"start_new_epoch",
"(",
"epoch",
",",
"data_dir",
")",
"# Train agent on real env (short)",
"log",
"(",
"\"Training policy in real environment.\"",
")",
"train_agent_real_env",
"(",
"env",
",",
"learner",
",",
"hparams",
",",
"epoch",
")",
"if",
"hparams",
".",
"stop_loop_early",
":",
"return",
"0.0",
"env",
".",
"generate_data",
"(",
"data_dir",
")",
"metrics",
"=",
"load_metrics",
"(",
"directories",
"[",
"\"eval_metrics\"",
"]",
",",
"epoch",
")",
"if",
"metrics",
":",
"# Skip eval if metrics have already been written for this epoch. Otherwise",
"# we'd overwrite them with wrong data.",
"log",
"(",
"\"Metrics found for this epoch, skipping evaluation.\"",
")",
"else",
":",
"metrics",
"[",
"\"mean_reward/train/clipped\"",
"]",
"=",
"rl_utils",
".",
"compute_mean_reward",
"(",
"env",
".",
"current_epoch_rollouts",
"(",
")",
",",
"clipped",
"=",
"True",
")",
"log",
"(",
"\"Mean training reward: {}\"",
".",
"format",
"(",
"metrics",
"[",
"\"mean_reward/train/clipped\"",
"]",
")",
")",
"eval_metrics",
"=",
"rl_utils",
".",
"evaluate_all_configs",
"(",
"hparams",
",",
"policy_model_dir",
")",
"log",
"(",
"\"Agent eval metrics:\\n{}\"",
".",
"format",
"(",
"pprint",
".",
"pformat",
"(",
"eval_metrics",
")",
")",
")",
"metrics",
".",
"update",
"(",
"eval_metrics",
")",
"if",
"hparams",
".",
"eval_world_model",
":",
"debug_video_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directories",
"[",
"\"world_model\"",
",",
"\"debug_videos\"",
"]",
",",
"\"{}.avi\"",
".",
"format",
"(",
"env",
".",
"current_epoch",
")",
")",
"wm_metrics",
"=",
"rl_utils",
".",
"evaluate_world_model",
"(",
"env",
",",
"hparams",
",",
"directories",
"[",
"\"world_model\"",
"]",
",",
"debug_video_path",
")",
"log",
"(",
"\"World model eval metrics:\\n{}\"",
".",
"format",
"(",
"pprint",
".",
"pformat",
"(",
"wm_metrics",
")",
")",
")",
"metrics",
".",
"update",
"(",
"wm_metrics",
")",
"rl_utils",
".",
"summarize_metrics",
"(",
"eval_metrics_writer",
",",
"metrics",
",",
"epoch",
")",
"# Report metrics",
"if",
"report_fn",
":",
"if",
"report_metric",
"==",
"\"mean_reward\"",
":",
"metric_name",
"=",
"rl_utils",
".",
"get_metric_name",
"(",
"sampling_temp",
"=",
"hparams",
".",
"eval_sampling_temps",
"[",
"0",
"]",
",",
"max_num_noops",
"=",
"hparams",
".",
"eval_max_num_noops",
",",
"clipped",
"=",
"False",
")",
"report_fn",
"(",
"eval_metrics",
"[",
"metric_name",
"]",
",",
"epoch",
")",
"else",
":",
"report_fn",
"(",
"eval_metrics",
"[",
"report_metric",
"]",
",",
"epoch",
")",
"epoch_metrics",
".",
"append",
"(",
"metrics",
")",
"# Return the evaluation metrics from the final epoch",
"return",
"epoch_metrics",
"[",
"-",
"1",
"]"
] |
Run the main training loop.
|
[
"Run",
"the",
"main",
"training",
"loop",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca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LRS7Iy8j,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(1066 - 1018) + chr(111) + '\x36' + chr(1912 - 1857), 0o10), ehT0Px3KOsy9(chr(859 - 811) + '\x6f' + chr(0b110001) + '\x36' + chr(706 - 654), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b101101 + 0o102) + chr(51) + chr(0b1100 + 0o47) + chr(0b11011 + 0o25), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\067' + chr(0b110101), 49068 - 49060), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(0b11111 + 0o23) + '\067' + chr(442 - 394), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000010 + 0o55) + chr(0b110011) + chr(1040 - 991) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + chr(0b11011 + 0o26) + chr(0b110100) + chr(0b10101 + 0o33), 44569 - 44561), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + '\061' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\x30' + '\x35', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(52) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b110010) + '\x31', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(2614 - 2561) + chr(0b1110 + 0o43), 0b1000), ehT0Px3KOsy9(chr(796 - 748) + chr(9636 - 9525) + '\061' + chr(54) + chr(595 - 547), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + '\x35' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x33' + chr(0b11110 + 0o23), 46862 - 46854), ehT0Px3KOsy9(chr(48) + chr(111) + chr(480 - 430) + '\x34' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(49) + chr(0b101100 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110011) + '\x36', 36774 - 36766), ehT0Px3KOsy9(chr(456 - 408) + chr(111) + '\062' + chr(49) + '\x35', 49949 - 49941), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(2208 - 2155) + chr(52), 0b1000), ehT0Px3KOsy9(chr(411 - 363) + '\x6f' + chr(0b1000 + 0o52) + chr(2322 - 2267) + '\x32', 5801 - 5793), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(6337 - 6226) + '\062' + '\x31' + '\062', 8), ehT0Px3KOsy9('\x30' + chr(3130 - 3019) + chr(0b101111 + 0o2) + chr(48) + chr(0b1100 + 0o45), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1111 + 0o140) + '\x31' + '\x34' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1235 - 1124) + chr(0b110011) + chr(51) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(49) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(1532 - 1484) + chr(0b1101111) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110100 + 0o3) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1000 + 0o52) + chr(0b1 + 0o66) + chr(2851 - 2796), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\066' + chr(2339 - 2285), 22453 - 22445), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\x35', 33675 - 33667), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2495 - 2444) + chr(52) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(809 - 755) + chr(0b110011), 46265 - 46257), ehT0Px3KOsy9('\x30' + chr(0b11000 + 0o127) + chr(2418 - 2368) + chr(0b110100) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b10000 + 0o137) + chr(0b110110) + chr(2554 - 2502), 65006 - 64998), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1641 - 1592) + '\x33' + chr(0b110100), 29177 - 29169), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x36' + chr(54), 44465 - 44457), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(0b10101 + 0o35) + '\x37' + chr(48), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101) + '\060', 21401 - 21393)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x19'), '\x64' + '\x65' + chr(0b1010111 + 0o14) + chr(11198 - 11087) + chr(100) + chr(2967 - 2866))(chr(0b1110101) + chr(116) + '\146' + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def MTa14RvCBWlS(n4ljua2gi1Pr, nd0OX_BS6_o4, FRqNoLmvqdQl=None, Ct55e2RMOtPX=None):
if FRqNoLmvqdQl:
assert Ct55e2RMOtPX is not None
cnekURhkIzrn = [xafqLlk3kkUe(SXOLrMavuUCe(b'S\x15\xac\x1c'), chr(0b1100001 + 0o3) + chr(101) + chr(99) + '\x6f' + chr(0b1100100) + chr(9166 - 9065))(chr(0b1110101) + chr(0b1100 + 0o150) + chr(0b1100110) + chr(0b101101) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'C\x19\xa8'), chr(0b1100100) + chr(0b1000010 + 0o43) + chr(0b1100011) + chr(0b1101111) + chr(3604 - 3504) + '\145')(chr(0b0 + 0o165) + chr(116) + '\146' + chr(45) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), chr(1858 - 1758) + '\145' + '\143' + chr(7144 - 7033) + chr(100) + '\145')(chr(7192 - 7075) + chr(116) + chr(0b10011 + 0o123) + chr(0b101101) + chr(0b10000 + 0o50)), (xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), chr(9661 - 9561) + chr(10049 - 9948) + '\x63' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(116) + '\x66' + '\x2d' + chr(802 - 746)), xafqLlk3kkUe(SXOLrMavuUCe(b'S\x11\xba\x08\xdf\x96\x16a\xe1\x02\xbe\x1a'), chr(0b110 + 0o136) + chr(101) + chr(99) + chr(948 - 837) + chr(2631 - 2531) + chr(0b101100 + 0o71))(chr(8260 - 8143) + chr(116) + chr(102) + chr(0b101101) + '\070')), xafqLlk3kkUe(SXOLrMavuUCe(b'G\x1b\xb4\x14\xdb\xb0'), chr(0b1100 + 0o130) + chr(0b1100101) + chr(0b1100011) + chr(10941 - 10830) + chr(100) + chr(101))(chr(0b1110101) + chr(116) + '\146' + '\x2d' + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'R\x02\xb9\x11\xe7\xa4\x05|\xf7\x0e\xb2\x1a'), '\144' + chr(0b1100101) + chr(99) + chr(0b1000101 + 0o52) + '\144' + '\x65')(chr(6450 - 6333) + chr(116) + chr(102) + chr(0b101101) + '\070')]
uLwOoj3v0w_9 = FSJmFDxnRCoy(nd0OX_BS6_o4, cnekURhkIzrn)
LWTVW06OsTjl = -ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 0b1000)
kVFRD544hi_1 = uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'S\x15\xac\x1c'), '\144' + chr(0b1100101) + chr(4993 - 4894) + chr(111) + chr(0b1000 + 0o134) + chr(0b1100101))(chr(0b1101010 + 0o13) + chr(0b1110100) + chr(102) + '\x2d' + chr(0b111000))]
xzsHIGfR8Ip5 = dS9nMkNNnOq2.setup_env(n4ljua2gi1Pr, batch_size=n4ljua2gi1Pr.real_batch_size, max_num_noops=n4ljua2gi1Pr.PNkPtpEftL3Z, rl_env_max_episode_steps=n4ljua2gi1Pr.rl_env_max_episode_steps)
xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'D\x00\xb9\x0f\xcc\x96\x0em\xf28\xb4\x19\x1f\xce1'), '\144' + chr(101) + '\143' + chr(0b1101111) + '\144' + '\145')('\165' + chr(0b1101110 + 0o6) + chr(1302 - 1200) + chr(161 - 116) + '\070'))(LWTVW06OsTjl, kVFRD544hi_1)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'@\x19\x87\r\xd7\xa5\tk\xfc8\xa1\x08\x02\xcc4\xfd\xf96\xec\x1e\xd3\xe4&'), chr(0b1100100) + '\145' + chr(0b1001011 + 0o30) + '\157' + '\144' + chr(4961 - 4860))(chr(0b100001 + 0o124) + chr(0b1110100) + chr(193 - 91) + chr(0b101101) + '\x38')):
TJplMcc0Narb = uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), chr(0b1100100) + '\145' + '\143' + chr(111) + chr(0b1100100) + '\145')(chr(0b1010110 + 0o37) + '\x74' + chr(102) + chr(0b11111 + 0o16) + '\070')]
else:
TJplMcc0Narb = uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'G\x1b\xb4\x14\xdb\xb0'), chr(7950 - 7850) + chr(0b1100101) + chr(0b1100011) + chr(0b11010 + 0o125) + chr(5489 - 5389) + '\145')(chr(0b1101110 + 0o7) + chr(1829 - 1713) + '\146' + '\055' + '\x38')]
pdR5uWN8d5YQ = dS9nMkNNnOq2.LEARNERS[n4ljua2gi1Pr.fuZMZiRkIYJT](n4ljua2gi1Pr.YYpMgs8WK8M7, TJplMcc0Narb, TJplMcc0Narb, n4ljua2gi1Pr.xvDB7qObFSrr)
YbYxT9NO6qap = zRZMTopDM70y()
HqkhgE05B9db = []
yYegMqDoSfs5 = {}
TJplMcc0Narb = uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'G\x1b\xb4\x14\xdb\xb0'), chr(0b1100100) + '\x65' + chr(5891 - 5792) + chr(0b1101111) + chr(100) + '\x65')(chr(0b10 + 0o163) + chr(116) + chr(3272 - 3170) + chr(0b101101) + chr(1480 - 1424))]
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'dC\x90\x05\xcd\xaa\x07?\xef\x0b\x8b\x02'), '\x64' + '\x65' + chr(0b1100001 + 0o2) + '\157' + chr(100) + chr(0b1011000 + 0o15))('\x75' + chr(0b110010 + 0o102) + chr(0b1100110) + '\055' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'~\x1a\xb1\t\xd1\xa8\x0c(\xf1\x15\xb0\x00\x1e\xc47\xc5\xaa1\xebL\xce\xe2$<\x13\xb0"l\\\xc6\x16r{\xc2A\xc4U0\xd6\xddY\x02\xb1\x0f\xd7\xa7\rm\xeb\x13\xff'), chr(0b11010 + 0o112) + chr(3101 - 3000) + chr(99) + '\157' + chr(0b1 + 0o143) + chr(8321 - 8220))(chr(0b1110101) + chr(0b1110100) + chr(5624 - 5522) + chr(0b101101) + chr(2232 - 2176)))
hYldmLcs8Ha2(xzsHIGfR8Ip5, pdR5uWN8d5YQ, n4ljua2gi1Pr, LWTVW06OsTjl)
yYegMqDoSfs5[xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x11\xb9\x13\xe7\xbb\x05\x7f\xe4\x15\xb5F\x04\xdf8\xcb\xe4q\xee\x00\xd3\xfa1y\x07'), chr(0b10 + 0o142) + chr(1566 - 1465) + chr(0b1100011) + chr(2654 - 2543) + chr(100) + chr(101))(chr(0b1110101) + chr(0b1011100 + 0o30) + chr(102) + chr(998 - 953) + '\070')] = dS9nMkNNnOq2.compute_mean_reward(xzsHIGfR8Ip5.current_epoch_rollouts(), clipped=ehT0Px3KOsy9(chr(1133 - 1085) + chr(111) + chr(0b11 + 0o56), 8))
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'dC\x90\x05\xcd\xaa\x07?\xef\x0b\x8b\x02'), chr(0b1010010 + 0o22) + chr(0b1100101) + chr(0b1010000 + 0o23) + '\157' + chr(100) + '\145')(chr(4599 - 4482) + chr(116) + chr(4455 - 4353) + chr(1273 - 1228) + chr(0b111000)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"z\x11\xb9\x13\x98\xbd\x12i\xec\t\xb8\x07\x17\x8d+\xc7\xfd?\xff\x08\x9a\xa2(r\n\xab'dS\x96\x0c;n\x9f"), chr(0b111110 + 0o46) + chr(101) + chr(0b1100011) + chr(111) + '\144' + chr(101))(chr(0b1001 + 0o154) + '\164' + '\146' + '\x2d' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'a@\xaa\x12\xf0\xa83;\xd5\x17\xb4\x03'), '\144' + '\145' + '\143' + chr(0b1101111) + '\x64' + chr(0b1000000 + 0o45))(chr(0b111000 + 0o75) + chr(116) + chr(0b1100110) + chr(0b101101) + '\070'))(yYegMqDoSfs5[xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x11\xb9\x13\xe7\xbb\x05\x7f\xe4\x15\xb5F\x04\xdf8\xcb\xe4q\xee\x00\xd3\xfa1y\x07'), '\144' + chr(8337 - 8236) + chr(99) + chr(0b11001 + 0o126) + '\x64' + chr(0b1100101))(chr(12798 - 12681) + '\164' + '\x66' + chr(0b11011 + 0o22) + chr(2038 - 1982))]))
xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'P\x11\xb6\x18\xca\xa8\x14m\xda\x03\xb0\x1d\x11'), chr(0b11010 + 0o112) + '\145' + chr(8846 - 8747) + '\157' + chr(8475 - 8375) + chr(101))(chr(117) + '\x74' + chr(5952 - 5850) + chr(0b100011 + 0o12) + chr(0b110 + 0o62)))(kVFRD544hi_1)
mOm1AorxMOLi = IDJ2eXGCBCDu.summary.FileWriter(uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'R\x02\xb9\x11\xe7\xa4\x05|\xf7\x0e\xb2\x1a'), chr(0b1000100 + 0o40) + chr(4312 - 4211) + chr(0b1100011) + chr(0b11 + 0o154) + '\144' + chr(0b1100101))('\165' + chr(3007 - 2891) + chr(9167 - 9065) + '\055' + chr(0b111000))])
yoEqdytCcl1H = ehT0Px3KOsy9(chr(1272 - 1224) + chr(0b1100110 + 0o11) + chr(0b100110 + 0o12), ord("\x08"))
for LWTVW06OsTjl in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'O\x02\x9c?\x8f\xb8/j\xc34\xa3\x1b'), '\x64' + '\145' + chr(1223 - 1124) + chr(111) + chr(0b1000000 + 0o44) + chr(101))(chr(0b11 + 0o162) + chr(0b1110100) + chr(0b1000011 + 0o43) + chr(45) + '\070'))):
WHAFymdp8Jcy = RKRIj1DYiCAA(LWTVW06OsTjl, YbYxT9NO6qap)
WHAFymdp8Jcy(xafqLlk3kkUe(SXOLrMavuUCe(b'c\x06\xb9\x14\xd6\xa0\x0eo\xa5\x10\xbe\x1b\x1c\xc9y\xcf\xe5:\xe8\x00'), chr(100) + chr(101) + chr(4881 - 4782) + '\x6f' + '\144' + chr(0b1111 + 0o126))(chr(0b10101 + 0o140) + chr(0b1110100) + chr(0b1001 + 0o135) + chr(0b101101) + chr(0b111000)))
yoEqdytCcl1H = p11T8nW9C6Hi(xzsHIGfR8Ip5, kVFRD544hi_1, uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), '\x64' + chr(0b1000101 + 0o40) + chr(0b1100011) + chr(111) + chr(6914 - 6814) + chr(6660 - 6559))(chr(0b110100 + 0o101) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b10 + 0o66))], n4ljua2gi1Pr, yoEqdytCcl1H, LWTVW06OsTjl)
WHAFymdp8Jcy(xafqLlk3kkUe(SXOLrMavuUCe(b'c\x06\xb9\x14\xd6\xa0\x0eo\xa5\x17\xbe\x05\x19\xce \x82\xe30\xad\x1f\xd3\xe74p\x02\xab+a\x1f\xdaXm|\x90\\\xcfY9\x98\xcc\x19'), '\144' + chr(0b1100101) + chr(0b101100 + 0o67) + '\x6f' + chr(0b1001111 + 0o25) + chr(0b1100100 + 0o1))(chr(8425 - 8308) + chr(0b101001 + 0o113) + '\146' + '\x2d' + chr(56)))
cv3JHpzWIwZy(xzsHIGfR8Ip5, pdR5uWN8d5YQ, uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), chr(0b1000100 + 0o40) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(100) + chr(6243 - 6142))('\165' + chr(0b101010 + 0o112) + chr(9683 - 9581) + '\x2d' + '\x38')], n4ljua2gi1Pr, LWTVW06OsTjl)
xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'D\x00\xb9\x0f\xcc\x96\x0em\xf28\xb4\x19\x1f\xce1'), '\x64' + chr(101) + chr(0b1100011) + chr(6448 - 6337) + chr(100) + chr(0b1100101))('\165' + chr(116) + '\x66' + chr(1354 - 1309) + chr(765 - 709)))(LWTVW06OsTjl, kVFRD544hi_1)
WHAFymdp8Jcy(xafqLlk3kkUe(SXOLrMavuUCe(b'c\x06\xb9\x14\xd6\xa0\x0eo\xa5\x17\xbe\x05\x19\xce \x82\xe30\xad\x1e\xdf\xeb-<\x06\xb18lM\xd0Xvp\x8cG\x8f'), chr(4734 - 4634) + chr(0b1110 + 0o127) + chr(99) + chr(0b1011111 + 0o20) + chr(0b1100100) + chr(101))(chr(11010 - 10893) + '\x74' + chr(1506 - 1404) + chr(1036 - 991) + '\070'))
hYldmLcs8Ha2(xzsHIGfR8Ip5, pdR5uWN8d5YQ, n4ljua2gi1Pr, LWTVW06OsTjl)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'D\x00\xb7\r\xe7\xa5\x0fg\xf58\xb4\x08\x02\xc1 '), chr(0b1100100) + chr(101) + chr(0b1000101 + 0o36) + '\157' + chr(0b1100100) + '\x65')('\x75' + chr(0b1001101 + 0o47) + '\146' + chr(1221 - 1176) + '\x38')):
return 0.0
xafqLlk3kkUe(xzsHIGfR8Ip5, xafqLlk3kkUe(SXOLrMavuUCe(b'P\x11\xb6\x18\xca\xa8\x14m\xda\x03\xb0\x1d\x11'), '\x64' + chr(4638 - 4537) + chr(99) + chr(111) + chr(0b111110 + 0o46) + '\x65')(chr(117) + chr(0b1001 + 0o153) + '\146' + '\x2d' + '\x38'))(kVFRD544hi_1)
yYegMqDoSfs5 = FYxaijDbiVw7(uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'R\x02\xb9\x11\xe7\xa4\x05|\xf7\x0e\xb2\x1a'), chr(0b1001011 + 0o31) + chr(0b1100101) + chr(99) + chr(0b1 + 0o156) + chr(8435 - 8335) + chr(0b1011100 + 0o11))(chr(117) + chr(8047 - 7931) + chr(102) + '\x2d' + chr(0b10 + 0o66))], LWTVW06OsTjl)
if yYegMqDoSfs5:
WHAFymdp8Jcy(xafqLlk3kkUe(SXOLrMavuUCe(b'z\x11\xac\x0f\xd1\xaa\x13(\xe3\x08\xa4\x07\x14\x8d?\xcd\xf8~\xf9\x04\xd3\xf9ay\x13\xb0-m\x13\x9fEp|\x92C\xc8Z;\xd6\xddA\x15\xb4\x08\xd9\xbd\tg\xebI'), '\x64' + chr(0b1001111 + 0o26) + '\143' + '\157' + '\144' + chr(0b101 + 0o140))(chr(0b11011 + 0o132) + chr(116) + chr(3821 - 3719) + chr(45) + chr(0b110 + 0o62)))
else:
yYegMqDoSfs5[xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x11\xb9\x13\xe7\xbb\x05\x7f\xe4\x15\xb5F\x04\xdf8\xcb\xe4q\xee\x00\xd3\xfa1y\x07'), chr(0b1100100) + '\x65' + '\143' + chr(3479 - 3368) + chr(100) + chr(101))('\x75' + '\164' + '\146' + '\055' + chr(0b111000))] = dS9nMkNNnOq2.compute_mean_reward(xzsHIGfR8Ip5.current_epoch_rollouts(), clipped=ehT0Px3KOsy9('\060' + chr(6268 - 6157) + '\x31', 8))
WHAFymdp8Jcy(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'z\x11\xb9\x13\x98\xbd\x12i\xec\t\xb8\x07\x17\x8d+\xc7\xfd?\xff\x08\x80\xaa:a'), '\144' + chr(0b1100101) + '\x63' + chr(111) + chr(0b1100100) + chr(2223 - 2122))(chr(0b1011110 + 0o27) + chr(0b1001100 + 0o50) + chr(0b101 + 0o141) + chr(0b11101 + 0o20) + chr(2991 - 2935)), xafqLlk3kkUe(SXOLrMavuUCe(b'a@\xaa\x12\xf0\xa83;\xd5\x17\xb4\x03'), chr(0b1010000 + 0o24) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\145')('\x75' + '\164' + '\146' + chr(0b100 + 0o51) + '\070'))(yYegMqDoSfs5[xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x11\xb9\x13\xe7\xbb\x05\x7f\xe4\x15\xb5F\x04\xdf8\xcb\xe4q\xee\x00\xd3\xfa1y\x07'), chr(0b1100100) + chr(101) + chr(0b1010001 + 0o22) + chr(111) + chr(0b101100 + 0o70) + '\145')(chr(117) + chr(4412 - 4296) + chr(0b1100110) + chr(0b101101) + '\x38')]))
gEY30c7K0x8W = dS9nMkNNnOq2.evaluate_all_configs(n4ljua2gi1Pr, TJplMcc0Narb)
WHAFymdp8Jcy(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'v\x13\xbd\x13\xcc\xe9\x05~\xe4\x0b\xf1\x04\x15\xd9+\xcb\xe9-\xb7f\xc1\xf7'), '\x64' + '\x65' + chr(99) + chr(9470 - 9359) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b100111 + 0o77) + chr(45) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'a@\xaa\x12\xf0\xa83;\xd5\x17\xb4\x03'), '\x64' + chr(2444 - 2343) + chr(99) + chr(0b1101111) + chr(1663 - 1563) + chr(0b1100101))(chr(13474 - 13357) + '\164' + chr(0b1100110) + chr(0b11100 + 0o21) + chr(56)))(xafqLlk3kkUe(quvQcGrKjCXS, xafqLlk3kkUe(SXOLrMavuUCe(b'G\x12\xb7\x0f\xd5\xa8\x14'), chr(0b101000 + 0o74) + chr(101) + '\143' + chr(7624 - 7513) + chr(100) + '\145')(chr(7734 - 7617) + chr(5756 - 5640) + chr(0b1100110) + chr(0b11111 + 0o16) + chr(0b11101 + 0o33)))(gEY30c7K0x8W)))
xafqLlk3kkUe(yYegMqDoSfs5, xafqLlk3kkUe(SXOLrMavuUCe(b'm\x00\x998\xd1\x87*f\xfcS\xb4Y'), chr(100) + chr(9984 - 9883) + chr(3904 - 3805) + chr(0b1101111) + chr(100) + '\145')(chr(0b111111 + 0o66) + '\x74' + chr(5383 - 5281) + chr(0b11010 + 0o23) + chr(2633 - 2577)))(gEY30c7K0x8W)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'R\x02\xb9\x11\xe7\xbe\x0fz\xe9\x03\x8e\x04\x1f\xc9<\xce'), chr(0b10110 + 0o116) + '\x65' + '\x63' + chr(8240 - 8129) + chr(100) + chr(101))(chr(0b1110101) + chr(10414 - 10298) + chr(102) + chr(0b11 + 0o52) + chr(0b110100 + 0o4))):
hojfa0zbgkh3 = oqhJDdMJfuwx.path.join(uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), chr(0b1100100) + chr(0b1100101) + chr(0b100010 + 0o101) + chr(0b10001 + 0o136) + '\144' + chr(0b100010 + 0o103))(chr(0b1011011 + 0o32) + chr(116) + chr(3597 - 3495) + chr(1399 - 1354) + chr(1165 - 1109)), xafqLlk3kkUe(SXOLrMavuUCe(b'S\x11\xba\x08\xdf\x96\x16a\xe1\x02\xbe\x1a'), '\144' + chr(101) + '\x63' + '\157' + chr(0b11000 + 0o114) + chr(0b1100101))('\165' + chr(8919 - 8803) + chr(0b111110 + 0o50) + chr(0b101101) + chr(0b1001 + 0o57))], xafqLlk3kkUe(SXOLrMavuUCe(b'L\t\xf6\x1c\xce\xa0'), chr(7153 - 7053) + chr(0b101011 + 0o72) + chr(3285 - 3186) + chr(0b1001110 + 0o41) + chr(7848 - 7748) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(0b1100110) + '\x2d' + chr(0b111000)).V4roHaS3Ppej(xzsHIGfR8Ip5.lRE7WEKM3QCA))
joZgYyUOA_lx = dS9nMkNNnOq2.evaluate_world_model(xzsHIGfR8Ip5, n4ljua2gi1Pr, uLwOoj3v0w_9[xafqLlk3kkUe(SXOLrMavuUCe(b'@\x1b\xaa\x11\xdc\x96\rg\xe1\x02\xbd'), chr(0b10000 + 0o124) + '\145' + '\x63' + '\x6f' + chr(7100 - 7000) + '\145')('\165' + chr(0b1000011 + 0o61) + chr(4845 - 4743) + chr(0b101101) + '\070')], hojfa0zbgkh3)
WHAFymdp8Jcy(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'`\x1b\xaa\x11\xdc\xe9\rg\xe1\x02\xbdI\x15\xdb8\xce\xaa3\xe8\x18\xc8\xe3"oY\xd55x'), chr(1194 - 1094) + chr(101) + chr(99) + '\157' + chr(747 - 647) + '\x65')('\x75' + chr(0b101011 + 0o111) + chr(0b1100110) + chr(1200 - 1155) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'a@\xaa\x12\xf0\xa83;\xd5\x17\xb4\x03'), '\144' + chr(0b1100101) + '\143' + '\x6f' + '\x64' + chr(3088 - 2987))(chr(0b1110101) + chr(116) + chr(3659 - 3557) + '\x2d' + '\x38'))(xafqLlk3kkUe(quvQcGrKjCXS, xafqLlk3kkUe(SXOLrMavuUCe(b'G\x12\xb7\x0f\xd5\xa8\x14'), '\x64' + '\x65' + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b1011010 + 0o13))('\165' + chr(116) + chr(6927 - 6825) + '\x2d' + chr(0b111000)))(joZgYyUOA_lx)))
xafqLlk3kkUe(yYegMqDoSfs5, xafqLlk3kkUe(SXOLrMavuUCe(b'm\x00\x998\xd1\x87*f\xfcS\xb4Y'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\157' + chr(0b1100100) + chr(101))(chr(13217 - 13100) + '\x74' + '\146' + chr(0b101101) + chr(0b110011 + 0o5)))(joZgYyUOA_lx)
xafqLlk3kkUe(dS9nMkNNnOq2, xafqLlk3kkUe(SXOLrMavuUCe(b'D\x01\xb5\x10\xd9\xbb\tr\xe08\xbc\x0c\x04\xdf0\xc1\xf9'), chr(0b1100100) + chr(495 - 394) + '\143' + chr(10377 - 10266) + chr(9908 - 9808) + chr(631 - 530))('\x75' + chr(0b1110100) + '\x66' + chr(45) + '\070'))(mOm1AorxMOLi, yYegMqDoSfs5, LWTVW06OsTjl)
if FRqNoLmvqdQl:
if Ct55e2RMOtPX == xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x11\xb9\x13\xe7\xbb\x05\x7f\xe4\x15\xb5'), chr(100) + chr(0b1100101) + chr(0b1010110 + 0o15) + '\x6f' + chr(0b1100000 + 0o4) + '\x65')('\165' + chr(116) + '\x66' + chr(1202 - 1157) + chr(411 - 355)):
Fk10FZM6EP2K = dS9nMkNNnOq2.get_metric_name(sampling_temp=n4ljua2gi1Pr.dXdg5YsfUP4x[ehT0Px3KOsy9(chr(48) + chr(0b110000 + 0o77) + chr(0b1100 + 0o44), 8)], max_num_noops=n4ljua2gi1Pr.OwVsnpOOrOZC, clipped=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000), 8))
FRqNoLmvqdQl(gEY30c7K0x8W[Fk10FZM6EP2K], LWTVW06OsTjl)
else:
FRqNoLmvqdQl(gEY30c7K0x8W[Ct55e2RMOtPX], LWTVW06OsTjl)
xafqLlk3kkUe(HqkhgE05B9db, xafqLlk3kkUe(SXOLrMavuUCe(b'V\x04\xa8\x18\xd6\xad'), chr(5016 - 4916) + chr(1740 - 1639) + '\143' + '\x6f' + chr(6962 - 6862) + '\x65')('\165' + '\x74' + chr(0b111100 + 0o52) + '\055' + chr(0b10110 + 0o42)))(yYegMqDoSfs5)
return HqkhgE05B9db[-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061', 8)]
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/gene_expression.py
|
conv_layer
|
def conv_layer(x,
hidden_size,
kernel_size,
stride,
pooling_window,
dropout_rate,
dilation_rate,
name="conv"):
"""Single conv layer with relu, optional pooling, and dropout."""
with tf.variable_scope(name):
out = x
out = common_layers.conv1d_block(
out,
hidden_size, [(dilation_rate, kernel_size)],
strides=stride,
first_relu=False,
padding="same")
out = tf.nn.relu(out)
if pooling_window:
out = tf.layers.max_pooling1d(
out, pooling_window, pooling_window, padding="same")
out = tf.layers.dropout(out, dropout_rate)
return out
|
python
|
def conv_layer(x,
hidden_size,
kernel_size,
stride,
pooling_window,
dropout_rate,
dilation_rate,
name="conv"):
"""Single conv layer with relu, optional pooling, and dropout."""
with tf.variable_scope(name):
out = x
out = common_layers.conv1d_block(
out,
hidden_size, [(dilation_rate, kernel_size)],
strides=stride,
first_relu=False,
padding="same")
out = tf.nn.relu(out)
if pooling_window:
out = tf.layers.max_pooling1d(
out, pooling_window, pooling_window, padding="same")
out = tf.layers.dropout(out, dropout_rate)
return out
|
[
"def",
"conv_layer",
"(",
"x",
",",
"hidden_size",
",",
"kernel_size",
",",
"stride",
",",
"pooling_window",
",",
"dropout_rate",
",",
"dilation_rate",
",",
"name",
"=",
"\"conv\"",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
")",
":",
"out",
"=",
"x",
"out",
"=",
"common_layers",
".",
"conv1d_block",
"(",
"out",
",",
"hidden_size",
",",
"[",
"(",
"dilation_rate",
",",
"kernel_size",
")",
"]",
",",
"strides",
"=",
"stride",
",",
"first_relu",
"=",
"False",
",",
"padding",
"=",
"\"same\"",
")",
"out",
"=",
"tf",
".",
"nn",
".",
"relu",
"(",
"out",
")",
"if",
"pooling_window",
":",
"out",
"=",
"tf",
".",
"layers",
".",
"max_pooling1d",
"(",
"out",
",",
"pooling_window",
",",
"pooling_window",
",",
"padding",
"=",
"\"same\"",
")",
"out",
"=",
"tf",
".",
"layers",
".",
"dropout",
"(",
"out",
",",
"dropout_rate",
")",
"return",
"out"
] |
Single conv layer with relu, optional pooling, and dropout.
|
[
"Single",
"conv",
"layer",
"with",
"relu",
"optional",
"pooling",
"and",
"dropout",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/gene_expression.py#L92-L114
|
train
|
Single conv layer with relu pooling and dropout.
|
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,hI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ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(2476 - 2426) + chr(0b1110 + 0o44) + chr(1830 - 1782), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(2044 - 1993) + chr(343 - 291) + chr(532 - 480), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(54) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1361 - 1312) + '\x33' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(2197 - 2149) + chr(111) + chr(0b0 + 0o65) + '\064', 10906 - 10898), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b111001 + 0o66) + chr(0b110011) + chr(767 - 714) + chr(0b110001 + 0o4), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b11110 + 0o22) + chr(0b1010 + 0o55), 32878 - 32870), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(50) + chr(54) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + '\063' + '\067' + '\066', 59522 - 59514), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1010 + 0o50) + chr(0b101 + 0o55) + chr(135 - 80), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000111 + 0o50) + chr(0b110010) + chr(53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(0b110010) + chr(1934 - 1882) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(0b1000 + 0o147) + chr(2629 - 2576) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x31' + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + chr(1218 - 1167) + chr(52) + chr(52), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(654 - 601) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(0b100110 + 0o14) + '\060' + chr(55), 8), ehT0Px3KOsy9(chr(420 - 372) + '\157' + chr(0b0 + 0o63) + chr(0b101011 + 0o13) + chr(508 - 458), 0o10), ehT0Px3KOsy9('\x30' + chr(1922 - 1811) + chr(820 - 769) + chr(51) + chr(1556 - 1505), 2668 - 2660), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b11010 + 0o31) + chr(0b1000 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110100) + chr(49), 6988 - 6980), ehT0Px3KOsy9(chr(0b110000) + chr(475 - 364) + chr(0b110010) + chr(1469 - 1421) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11001 + 0o126) + '\063' + '\x34' + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x36' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(973 - 918) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1967 - 1919) + '\157' + chr(1946 - 1892) + chr(0b110011), 8), ehT0Px3KOsy9(chr(48) + chr(9917 - 9806) + '\062' + '\x36', 5517 - 5509), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(913 - 865) + chr(217 - 164), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11933 - 11822) + chr(54) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + '\x33' + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(51) + '\063' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(0b110001 + 0o0) + chr(52) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(871 - 820) + chr(48) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\x30' + chr(300 - 250), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1962 - 1912) + chr(0b100111 + 0o17) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + '\066' + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11 + 0o57) + chr(0b110010) + chr(995 - 945), 45848 - 45840), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1519 - 1468) + chr(0b110001), 22363 - 22355)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + chr(2256 - 2203) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe'), chr(100) + chr(0b1100101) + chr(0b101110 + 0o65) + '\x6f' + chr(4297 - 4197) + chr(8282 - 8181))(chr(117) + '\164' + '\146' + '\055' + chr(1450 - 1394)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ClJkZVmt1pJi(OeWW0F1dBPRQ, qzoyXN3kdhDL, m6gwVXy4D3Au, VKQ5wcD30goF, ZxaRcjZfbTvd, iI9Z069HML_u, Rm2KgSQziMI2, AIvJRzLdDfgF=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\x8b\x18)'), chr(0b1100100) + chr(0b1000100 + 0o41) + '\143' + chr(0b1001100 + 0o43) + chr(100) + chr(101))(chr(5121 - 5004) + chr(116) + '\x66' + chr(0b101101) + chr(0b111000))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe6\x85\x046M\x8f\xeb\xd7\xa1\xe4\xcf\xcf]*'), chr(100) + chr(1935 - 1834) + chr(1682 - 1583) + '\x6f' + '\144' + chr(0b1100101))(chr(0b1110101 + 0o0) + chr(7485 - 7369) + chr(0b1100110) + chr(45) + chr(0b111000)))(AIvJRzLdDfgF):
UkrMp_I0RDmo = OeWW0F1dBPRQ
UkrMp_I0RDmo = jSKPaHwSAfVv.conv1d_block(UkrMp_I0RDmo, qzoyXN3kdhDL, [(Rm2KgSQziMI2, m6gwVXy4D3Au)], strides=VKQ5wcD30goF, first_relu=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100011 + 0o15), 0o10), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3\x85\x1b:'), chr(0b1100100) + chr(101) + chr(0b111001 + 0o52) + chr(111) + chr(6317 - 6217) + chr(101))(chr(0b1100101 + 0o20) + '\x74' + '\x66' + '\x2d' + chr(0b111000)))
UkrMp_I0RDmo = IDJ2eXGCBCDu.nn.relu(UkrMp_I0RDmo)
if ZxaRcjZfbTvd:
UkrMp_I0RDmo = IDJ2eXGCBCDu.layers.max_pooling1d(UkrMp_I0RDmo, ZxaRcjZfbTvd, ZxaRcjZfbTvd, padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3\x85\x1b:'), chr(0b1100100) + chr(1777 - 1676) + chr(3327 - 3228) + chr(8584 - 8473) + '\144' + chr(0b1010010 + 0o23))(chr(0b111100 + 0o71) + '\164' + chr(964 - 862) + chr(390 - 345) + chr(0b111000)))
UkrMp_I0RDmo = IDJ2eXGCBCDu.layers.ag0mwEgWzjYv(UkrMp_I0RDmo, iI9Z069HML_u)
return UkrMp_I0RDmo
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/gene_expression.py
|
gene_expression_conv_base
|
def gene_expression_conv_base():
"""Hparams for GeneExpressionConv model."""
hparams = common_hparams.basic_params1()
batch_size = 10
output_length = 2048
inputs_per_output = 128
chunk_size = 4
input_length = output_length * inputs_per_output // chunk_size
hparams.batch_size = input_length * batch_size
hparams.dropout = 0.1
hparams.add_hparam("num_conv_layers", 4)
hparams.add_hparam("num_dconv_layers", 7)
# The product of these pooling windows should match
# input_length/target_length.
hparams.add_hparam("pooling_windows", [2, 2, 2, 4])
hparams.hidden_size = 256
hparams.kernel_width = 20
hparams.add_hparam("stride", 1)
return hparams
|
python
|
def gene_expression_conv_base():
"""Hparams for GeneExpressionConv model."""
hparams = common_hparams.basic_params1()
batch_size = 10
output_length = 2048
inputs_per_output = 128
chunk_size = 4
input_length = output_length * inputs_per_output // chunk_size
hparams.batch_size = input_length * batch_size
hparams.dropout = 0.1
hparams.add_hparam("num_conv_layers", 4)
hparams.add_hparam("num_dconv_layers", 7)
# The product of these pooling windows should match
# input_length/target_length.
hparams.add_hparam("pooling_windows", [2, 2, 2, 4])
hparams.hidden_size = 256
hparams.kernel_width = 20
hparams.add_hparam("stride", 1)
return hparams
|
[
"def",
"gene_expression_conv_base",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"batch_size",
"=",
"10",
"output_length",
"=",
"2048",
"inputs_per_output",
"=",
"128",
"chunk_size",
"=",
"4",
"input_length",
"=",
"output_length",
"*",
"inputs_per_output",
"//",
"chunk_size",
"hparams",
".",
"batch_size",
"=",
"input_length",
"*",
"batch_size",
"hparams",
".",
"dropout",
"=",
"0.1",
"hparams",
".",
"add_hparam",
"(",
"\"num_conv_layers\"",
",",
"4",
")",
"hparams",
".",
"add_hparam",
"(",
"\"num_dconv_layers\"",
",",
"7",
")",
"# The product of these pooling windows should match",
"# input_length/target_length.",
"hparams",
".",
"add_hparam",
"(",
"\"pooling_windows\"",
",",
"[",
"2",
",",
"2",
",",
"2",
",",
"4",
"]",
")",
"hparams",
".",
"hidden_size",
"=",
"256",
"hparams",
".",
"kernel_width",
"=",
"20",
"hparams",
".",
"add_hparam",
"(",
"\"stride\"",
",",
"1",
")",
"return",
"hparams"
] |
Hparams for GeneExpressionConv model.
|
[
"Hparams",
"for",
"GeneExpressionConv",
"model",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/gene_expression.py#L128-L149
|
train
|
Hparams for GeneExpressionConv model.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8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V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(0b100101 + 0o20) + chr(2055 - 2005), 61294 - 61286), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + '\065' + '\061', 42749 - 42741), ehT0Px3KOsy9('\060' + '\x6f' + '\x34' + '\x35', 42309 - 42301), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(1120 - 1071) + chr(0b110111) + chr(1944 - 1891), 0o10), ehT0Px3KOsy9(chr(2121 - 2073) + chr(228 - 117) + chr(645 - 596) + chr(51) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1599 - 1488) + '\x31' + chr(0b110001) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(0b110110) + chr(0b101010 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110110) + chr(2985 - 2930), 38582 - 38574), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(366 - 316) + chr(0b11011 + 0o32), 0o10), ehT0Px3KOsy9('\060' + chr(10192 - 10081) + chr(0b1011 + 0o46) + '\x37' + chr(0b1010 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(51) + chr(54) + chr(2197 - 2143), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + '\064' + chr(645 - 593), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b101010 + 0o6) + chr(0b110001 + 0o5), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101001 + 0o6) + chr(0b110001) + '\061' + chr(1609 - 1561), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b1011 + 0o47) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110111) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + chr(0b101101 + 0o3), 35284 - 35276), ehT0Px3KOsy9('\x30' + chr(9996 - 9885) + '\063' + chr(0b110101) + chr(0b101110 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11736 - 11625) + chr(0b110001 + 0o2) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b111100 + 0o63) + '\x33' + '\x36' + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(936 - 881) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1868 - 1820) + chr(111) + chr(1109 - 1058) + '\x33' + chr(0b10 + 0o65), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(1185 - 1133) + chr(0b110010), 45145 - 45137), ehT0Px3KOsy9(chr(617 - 569) + '\x6f' + '\062' + chr(51) + chr(1831 - 1779), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110000 + 0o77) + chr(0b101100 + 0o6) + '\x33' + chr(0b100110 + 0o16), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(1846 - 1795) + chr(0b11001 + 0o32), 0o10), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(369 - 317) + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(52), 51735 - 51727), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1101 + 0o46) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(2075 - 2027) + '\157' + '\062' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(1197 - 1149) + chr(0b100 + 0o153) + chr(52) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(51) + '\x34' + chr(1191 - 1143), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b11 + 0o154) + chr(0b101001 + 0o10) + chr(55) + '\067', 8), ehT0Px3KOsy9(chr(675 - 627) + chr(111) + '\063' + chr(0b110000) + chr(2117 - 2064), 0b1000), ehT0Px3KOsy9(chr(312 - 264) + chr(0b1101111) + chr(0b110001) + chr(301 - 251) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b111 + 0o52) + chr(1258 - 1210) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110110) + chr(0b11001 + 0o32), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b110100) + '\063', 22502 - 22494), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110100) + chr(452 - 404), 8), ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + chr(0b101010 + 0o10) + chr(49) + chr(0b110101), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b10 + 0o155) + chr(1676 - 1623) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x84'), chr(0b1011001 + 0o13) + '\145' + chr(99) + chr(111) + chr(4351 - 4251) + chr(0b1100101))('\165' + '\164' + chr(0b1100110) + chr(0b101101) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xOZoluXA6Lbu():
n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1()
ix9dZyeAmUxY = ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(289 - 239), 0o10)
JCqmqqXTiA0c = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110100) + '\060' + '\x30' + chr(0b11111 + 0o21), ord("\x08"))
l_u5YJjXSQAd = ehT0Px3KOsy9(chr(48) + '\157' + '\062' + chr(0b110000) + chr(1966 - 1918), ord("\x08"))
ha7Qr2IqbXbY = ehT0Px3KOsy9(chr(598 - 550) + '\x6f' + chr(1298 - 1246), ord("\x08"))
jhOh7kNKHblg = JCqmqqXTiA0c * l_u5YJjXSQAd // ha7Qr2IqbXbY
n4ljua2gi1Pr.ix9dZyeAmUxY = jhOh7kNKHblg * ix9dZyeAmUxY
n4ljua2gi1Pr.ag0mwEgWzjYv = 0.1
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcbMA"58\x13E\xb4\x16'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b1011010 + 0o25) + chr(0b1100100) + chr(101))(chr(9163 - 9046) + '\x74' + chr(0b1100110) + chr(45) + chr(1230 - 1174)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4\\H">\'\x1cA\x8a\x17\x97]\xe3: '), chr(0b100100 + 0o100) + '\145' + chr(0b1011111 + 0o4) + chr(0b100000 + 0o117) + chr(0b111110 + 0o46) + chr(7698 - 7597))(chr(0b10100 + 0o141) + '\x74' + chr(102) + chr(0b101100 + 0o1) + chr(0b111000)), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(540 - 488), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcbMA"58\x13E\xb4\x16'), chr(100) + '\x65' + chr(4232 - 4133) + chr(0b1011011 + 0o24) + '\x64' + chr(0b10010 + 0o123))(chr(0b101101 + 0o110) + '\164' + chr(8064 - 7962) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4\\H"9+\x1dY\xa3$\x9aE\xff-!\x89'), chr(0b1100100) + chr(3747 - 3646) + chr(0b1001000 + 0o33) + chr(0b0 + 0o157) + '\144' + chr(0b1100101))('\x75' + '\x74' + chr(102) + chr(0b101000 + 0o5) + chr(1033 - 977)), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b11101 + 0o122) + chr(0b1100 + 0o53), 0b1000))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcbMA"58\x13E\xb4\x16'), '\x64' + chr(101) + chr(0b1100011) + chr(0b111111 + 0o60) + '\144' + chr(0b1100011 + 0o2))(chr(117) + '\164' + '\x66' + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdaFJ\x114&\x15h\xa2\x12\x98@\xe9? '), chr(0b1100100) + chr(0b100000 + 0o105) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(1369 - 1268))(chr(13656 - 13539) + chr(3141 - 3025) + chr(0b1100110) + '\x2d' + chr(1913 - 1857)), [ehT0Px3KOsy9(chr(0b110000) + chr(10483 - 10372) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b111100 + 0o63) + chr(0b1111 + 0o43), 8), ehT0Px3KOsy9(chr(2204 - 2156) + '\157' + chr(2546 - 2494), 8)])
n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9('\x30' + '\157' + chr(0b11 + 0o61) + '\x30' + chr(0b10101 + 0o33), 0b1000)
n4ljua2gi1Pr.xCDNMTg51zI4 = ehT0Px3KOsy9(chr(1377 - 1329) + '\157' + chr(2493 - 2443) + '\x34', 8)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcbMA"58\x13E\xb4\x16'), '\x64' + '\x65' + '\143' + chr(0b1101111) + chr(0b1100100) + chr(592 - 491))(chr(5791 - 5674) + '\x74' + chr(102) + chr(373 - 328) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9]W\x149-'), chr(2813 - 2713) + '\x65' + chr(99) + chr(111) + chr(0b10100 + 0o120) + '\145')(chr(9841 - 9724) + '\x74' + chr(8389 - 8287) + chr(45) + chr(0b110111 + 0o1)), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', ord("\x08")))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
compress_self_attention_layer
|
def compress_self_attention_layer(x, hparams, name=None):
"""Attend function."""
with tf.variable_scope(name, default_name="compress_self_attention"):
x, xshape, _ = cia.maybe_reshape_4d_to_3d(x)
y = common_attention.multihead_attention(
common_layers.layer_preprocess(x, hparams),
None,
None,
hparams.attention_key_channels or hparams.hidden_size,
hparams.attention_value_channels or hparams.hidden_size,
hparams.hidden_size, hparams.num_heads,
hparams.attention_dropout)
res = common_layers.layer_postprocess(x, y, hparams)
return tf.reshape(res, xshape)
|
python
|
def compress_self_attention_layer(x, hparams, name=None):
"""Attend function."""
with tf.variable_scope(name, default_name="compress_self_attention"):
x, xshape, _ = cia.maybe_reshape_4d_to_3d(x)
y = common_attention.multihead_attention(
common_layers.layer_preprocess(x, hparams),
None,
None,
hparams.attention_key_channels or hparams.hidden_size,
hparams.attention_value_channels or hparams.hidden_size,
hparams.hidden_size, hparams.num_heads,
hparams.attention_dropout)
res = common_layers.layer_postprocess(x, y, hparams)
return tf.reshape(res, xshape)
|
[
"def",
"compress_self_attention_layer",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"compress_self_attention\"",
")",
":",
"x",
",",
"xshape",
",",
"_",
"=",
"cia",
".",
"maybe_reshape_4d_to_3d",
"(",
"x",
")",
"y",
"=",
"common_attention",
".",
"multihead_attention",
"(",
"common_layers",
".",
"layer_preprocess",
"(",
"x",
",",
"hparams",
")",
",",
"None",
",",
"None",
",",
"hparams",
".",
"attention_key_channels",
"or",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"attention_value_channels",
"or",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"hidden_size",
",",
"hparams",
".",
"num_heads",
",",
"hparams",
".",
"attention_dropout",
")",
"res",
"=",
"common_layers",
".",
"layer_postprocess",
"(",
"x",
",",
"y",
",",
"hparams",
")",
"return",
"tf",
".",
"reshape",
"(",
"res",
",",
"xshape",
")"
] |
Attend function.
|
[
"Attend",
"function",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L35-L48
|
train
|
Attend 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,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,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(1651 - 1603) + chr(111) + chr(0b101 + 0o57) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b110011 + 0o74) + chr(1333 - 1282) + chr(0b110110) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(448 - 400) + chr(0b1101111) + chr(0b110100) + chr(0b110001), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\066' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(71 - 21) + chr(0b110110 + 0o1) + chr(48), 48992 - 48984), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10001 + 0o41) + chr(0b110001) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6700 - 6589) + chr(50) + '\x33' + '\060', 62370 - 62362), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1111 + 0o45) + chr(1733 - 1679), 30056 - 30048), ehT0Px3KOsy9(chr(235 - 187) + '\x6f' + chr(0b110111) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(8766 - 8655) + chr(1059 - 1008) + chr(54) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110011) + chr(0b1110 + 0o47), 11777 - 11769), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(48) + chr(2334 - 2280), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10100 + 0o35) + chr(0b110110) + chr(51), 0b1000), ehT0Px3KOsy9(chr(1692 - 1644) + '\157' + '\062' + chr(53) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(847 - 736) + chr(0b110011) + chr(0b101111 + 0o3) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(1387 - 1335) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + '\061' + chr(483 - 428) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + '\064' + chr(0b100100 + 0o17), 24603 - 24595), ehT0Px3KOsy9(chr(1130 - 1082) + chr(111) + '\065' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b111100 + 0o63) + chr(0b110100) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11653 - 11542) + '\062' + chr(0b100011 + 0o21) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(8956 - 8845) + chr(51) + chr(55) + '\060', 46519 - 46511), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(55) + chr(0b110010), 23394 - 23386), ehT0Px3KOsy9(chr(282 - 234) + chr(0b1011010 + 0o25) + chr(0b101110 + 0o3) + chr(0b11011 + 0o33) + '\061', 0b1000), ehT0Px3KOsy9(chr(1980 - 1932) + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(2213 - 2159), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + chr(2367 - 2315) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000 + 0o2) + '\x34' + chr(1465 - 1411), 18474 - 18466), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(0b1 + 0o62) + chr(52) + chr(97 - 47), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(0b110001) + chr(0b110 + 0o61) + chr(0b11101 + 0o31), 8), ehT0Px3KOsy9(chr(180 - 132) + chr(0b1101111) + '\x32' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b10100 + 0o36) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x36' + chr(0b101100 + 0o5), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x31' + chr(1941 - 1891), 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + '\x31' + chr(54) + chr(0b10100 + 0o35), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(9587 - 9476) + chr(50) + chr(0b10011 + 0o37) + '\x34', 30576 - 30568), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1921 - 1870) + chr(52), 26283 - 26275), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001 + 0o146) + chr(55) + chr(0b101101 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(51) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(3101 - 2990) + chr(1205 - 1150) + chr(0b110101), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(53) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f'), chr(6311 - 6211) + chr(0b1100101) + chr(0b1100011) + chr(10686 - 10575) + '\x64' + chr(4587 - 4486))(chr(0b1110101) + chr(0b111001 + 0o73) + '\146' + chr(541 - 496) + chr(0b111 + 0o61)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ZDIIUJZ6Hwx4(OeWW0F1dBPRQ, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'W\x92S_\xd9\xe9\xf4Ca\x83\xbe\xe9\x03\xce'), chr(7908 - 7808) + chr(0b1011110 + 0o7) + '\143' + chr(6346 - 6235) + '\144' + '\x65')(chr(0b110011 + 0o102) + '\164' + chr(102) + chr(0b101101) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'B\x9cLF\xca\xee\xebUa\x83\xb8\xea\x15\xf4\xb3\x10\n\x86CTK\xcc\x96'), chr(6185 - 6085) + '\x65' + '\x63' + '\157' + chr(0b11110 + 0o106) + chr(0b110100 + 0o61))(chr(0b1110101) + chr(0b0 + 0o164) + chr(102) + '\055' + chr(0b101100 + 0o14))):
(OeWW0F1dBPRQ, XH_WlT4vj_oW, VNGQdHSFPrso) = oIL3U1EOcJgs.maybe_reshape_4d_to_3d(OeWW0F1dBPRQ)
SqiSOtYOqOJH = WOnrfm4dlYcf.multihead_attention(jSKPaHwSAfVv.layer_preprocess(OeWW0F1dBPRQ, n4ljua2gi1Pr), None, None, n4ljua2gi1Pr.Hj_JCZasfmqG or n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.PZHUuenu09ti or n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.qzoyXN3kdhDL, n4ljua2gi1Pr.vRVqPOZ1hUG7, n4ljua2gi1Pr.RdMRr3qkYioQ)
MsbwfslwLjRO = jSKPaHwSAfVv.layer_postprocess(OeWW0F1dBPRQ, SqiSOtYOqOJH, n4ljua2gi1Pr)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'S\x96R^\xd9\xfb\xfd'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b1001111 + 0o40) + '\144' + '\145')(chr(117) + '\x74' + chr(102) + '\x2d' + chr(768 - 712)))(MsbwfslwLjRO, XH_WlT4vj_oW)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
compute_nats_and_bits_per_dim
|
def compute_nats_and_bits_per_dim(data_dim,
latent_dim,
average_reconstruction,
average_prior):
"""Computes negative ELBO, which is an upper bound on the negative likelihood.
Args:
data_dim: int-like indicating data dimensionality.
latent_dim: int-like indicating latent dimensionality.
average_reconstruction: Scalar Tensor indicating the reconstruction cost
averaged over all data dimensions and any data batches.
average_prior: Scalar Tensor indicating the negative log-prior probability
averaged over all latent dimensions and any data batches.
Returns:
Tuple of scalar Tensors, representing the nats and bits per data dimension
(e.g., subpixels) respectively.
"""
with tf.name_scope(None, default_name="compute_nats_per_dim"):
data_dim = tf.cast(data_dim, average_reconstruction.dtype)
latent_dim = tf.cast(latent_dim, average_prior.dtype)
negative_log_likelihood = data_dim * average_reconstruction
negative_log_prior = latent_dim * average_prior
negative_elbo = negative_log_likelihood + negative_log_prior
nats_per_dim = tf.divide(negative_elbo, data_dim, name="nats_per_dim")
bits_per_dim = tf.divide(nats_per_dim, tf.log(2.), name="bits_per_dim")
return nats_per_dim, bits_per_dim
|
python
|
def compute_nats_and_bits_per_dim(data_dim,
latent_dim,
average_reconstruction,
average_prior):
"""Computes negative ELBO, which is an upper bound on the negative likelihood.
Args:
data_dim: int-like indicating data dimensionality.
latent_dim: int-like indicating latent dimensionality.
average_reconstruction: Scalar Tensor indicating the reconstruction cost
averaged over all data dimensions and any data batches.
average_prior: Scalar Tensor indicating the negative log-prior probability
averaged over all latent dimensions and any data batches.
Returns:
Tuple of scalar Tensors, representing the nats and bits per data dimension
(e.g., subpixels) respectively.
"""
with tf.name_scope(None, default_name="compute_nats_per_dim"):
data_dim = tf.cast(data_dim, average_reconstruction.dtype)
latent_dim = tf.cast(latent_dim, average_prior.dtype)
negative_log_likelihood = data_dim * average_reconstruction
negative_log_prior = latent_dim * average_prior
negative_elbo = negative_log_likelihood + negative_log_prior
nats_per_dim = tf.divide(negative_elbo, data_dim, name="nats_per_dim")
bits_per_dim = tf.divide(nats_per_dim, tf.log(2.), name="bits_per_dim")
return nats_per_dim, bits_per_dim
|
[
"def",
"compute_nats_and_bits_per_dim",
"(",
"data_dim",
",",
"latent_dim",
",",
"average_reconstruction",
",",
"average_prior",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"None",
",",
"default_name",
"=",
"\"compute_nats_per_dim\"",
")",
":",
"data_dim",
"=",
"tf",
".",
"cast",
"(",
"data_dim",
",",
"average_reconstruction",
".",
"dtype",
")",
"latent_dim",
"=",
"tf",
".",
"cast",
"(",
"latent_dim",
",",
"average_prior",
".",
"dtype",
")",
"negative_log_likelihood",
"=",
"data_dim",
"*",
"average_reconstruction",
"negative_log_prior",
"=",
"latent_dim",
"*",
"average_prior",
"negative_elbo",
"=",
"negative_log_likelihood",
"+",
"negative_log_prior",
"nats_per_dim",
"=",
"tf",
".",
"divide",
"(",
"negative_elbo",
",",
"data_dim",
",",
"name",
"=",
"\"nats_per_dim\"",
")",
"bits_per_dim",
"=",
"tf",
".",
"divide",
"(",
"nats_per_dim",
",",
"tf",
".",
"log",
"(",
"2.",
")",
",",
"name",
"=",
"\"bits_per_dim\"",
")",
"return",
"nats_per_dim",
",",
"bits_per_dim"
] |
Computes negative ELBO, which is an upper bound on the negative likelihood.
Args:
data_dim: int-like indicating data dimensionality.
latent_dim: int-like indicating latent dimensionality.
average_reconstruction: Scalar Tensor indicating the reconstruction cost
averaged over all data dimensions and any data batches.
average_prior: Scalar Tensor indicating the negative log-prior probability
averaged over all latent dimensions and any data batches.
Returns:
Tuple of scalar Tensors, representing the nats and bits per data dimension
(e.g., subpixels) respectively.
|
[
"Computes",
"negative",
"ELBO",
"which",
"is",
"an",
"upper",
"bound",
"on",
"the",
"negative",
"likelihood",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L51-L77
|
train
|
Computes the negative ELBO which is an upper bound on the negative likelihood.
|
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,GNd6AVvh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,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' + '\063' + '\x30' + chr(0b100101 + 0o15), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\x35' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(407 - 359) + '\157' + '\x33' + chr(0b110000) + chr(0b101110 + 0o2), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001100 + 0o43) + chr(0b110010) + chr(2331 - 2279) + '\065', 32850 - 32842), ehT0Px3KOsy9(chr(2018 - 1970) + '\157' + chr(1639 - 1589) + chr(1601 - 1552) + chr(0b110111), 60855 - 60847), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b110001) + '\x30' + chr(1629 - 1575), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(49) + '\x33' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(2020 - 1909) + '\061' + '\x35' + chr(0b1100 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b11 + 0o60), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + chr(1480 - 1429) + chr(223 - 168) + chr(1947 - 1899), 3519 - 3511), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + chr(0b110010), 43358 - 43350), ehT0Px3KOsy9(chr(1938 - 1890) + chr(0b1011011 + 0o24) + chr(0b110010) + chr(947 - 898) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(2101 - 2053) + chr(0b111111 + 0o60) + chr(0b11100 + 0o25) + '\060' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10100 + 0o35) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\067' + chr(49), 31522 - 31514), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(50) + chr(0b110000), 38616 - 38608), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2280 - 2230) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b10001 + 0o42) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b11111 + 0o23) + chr(193 - 140), ord("\x08")), ehT0Px3KOsy9(chr(969 - 921) + chr(0b1101111) + chr(50) + chr(0b100101 + 0o13) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(54) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(53) + chr(223 - 174), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11101 + 0o26) + chr(52) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1552 - 1504) + '\157' + chr(2406 - 2355) + chr(2229 - 2180) + chr(0b1 + 0o63), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111110 + 0o61) + chr(50) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(2160 - 2049) + chr(51) + '\x31' + chr(0b10101 + 0o37), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(1605 - 1557), 8), ehT0Px3KOsy9(chr(1503 - 1455) + chr(3466 - 3355) + chr(0b110011) + chr(0b110000) + chr(53), 53390 - 53382), ehT0Px3KOsy9('\060' + chr(1058 - 947) + chr(991 - 940) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(1791 - 1743) + chr(0b111 + 0o150) + chr(0b110010 + 0o1) + chr(151 - 102) + chr(0b10011 + 0o36), 35624 - 35616), ehT0Px3KOsy9('\060' + chr(5027 - 4916) + '\x33' + '\063' + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(0b10110 + 0o33) + '\x31', 10461 - 10453), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + '\x32' + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110100) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b11110 + 0o121) + chr(0b101 + 0o62) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(2284 - 2232) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101110 + 0o1) + '\x31' + chr(0b110101) + chr(49), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(178 - 127) + chr(50) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\063' + chr(54) + chr(53), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(2296 - 2243) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xec'), chr(0b1001001 + 0o33) + chr(3242 - 3141) + chr(0b110000 + 0o63) + chr(0b1101111) + chr(100) + '\145')(chr(0b100 + 0o161) + '\164' + '\x66' + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Jo_VeJIK6iwb(cEGqp1SO4iJa, GELGNuVd7ZTT, PS6_BJQKd9oD, rZPRuSccVy8t):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xac\xc8\xad\xc0\xd05;\x04{\x9d'), chr(100) + '\145' + '\x63' + chr(7353 - 7242) + '\x64' + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b101101 + 0o71) + '\055' + '\070'))(None, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1\xc6\xad\xd5\xfa2=4e\x99^\xf9\x1c}\x1cbWt\xf28'), chr(100) + chr(0b110111 + 0o56) + chr(99) + chr(0b11100 + 0o123) + chr(0b10010 + 0o122) + chr(0b1100101))(chr(13458 - 13341) + chr(0b1010111 + 0o35) + chr(102) + chr(45) + chr(2044 - 1988))):
cEGqp1SO4iJa = IDJ2eXGCBCDu.cast(cEGqp1SO4iJa, PS6_BJQKd9oD.jSV9IKnemH7K)
GELGNuVd7ZTT = IDJ2eXGCBCDu.cast(GELGNuVd7ZTT, rZPRuSccVy8t.jSV9IKnemH7K)
jayxWZXTL1Mz = cEGqp1SO4iJa * PS6_BJQKd9oD
WhQ5eZsHxn3U = GELGNuVd7ZTT * rZPRuSccVy8t
pw7ul9A4m0Us = jayxWZXTL1Mz + WhQ5eZsHxn3U
mrYBMGxaio_B = IDJ2eXGCBCDu.divide(pw7ul9A4m0Us, cEGqp1SO4iJa, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xac\xc8\xb4\xd6\xd06=\x19T\x9cC\xe7'), chr(100) + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(3526 - 3425))(chr(383 - 266) + '\164' + chr(0b1100110) + '\055' + chr(0b111000)))
T9ZSq_5beVku = IDJ2eXGCBCDu.divide(mrYBMGxaio_B, IDJ2eXGCBCDu.log(2.0), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0\xc0\xb4\xd6\xd06=\x19T\x9cC\xe7'), '\144' + chr(0b1100101) + chr(99) + '\157' + chr(0b1001 + 0o133) + chr(9194 - 9093))(chr(117) + chr(0b11000 + 0o134) + chr(10101 - 9999) + '\055' + chr(0b100101 + 0o23)))
return (mrYBMGxaio_B, T9ZSq_5beVku)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
multinomial_sample
|
def multinomial_sample(x, vocab_size=None, sampling_method="random",
temperature=1.0):
"""Multinomial sampling from a n-dimensional tensor.
Args:
x: Tensor of shape [..., vocab_size]. Parameterizes logits of multinomial.
vocab_size: Number of classes in multinomial distribution.
sampling_method: String, "random" or otherwise deterministic.
temperature: Positive float.
Returns:
Tensor of shape [...].
"""
vocab_size = vocab_size or common_layers.shape_list(x)[-1]
if sampling_method == "random" and temperature > 0.0:
samples = tf.multinomial(tf.reshape(x, [-1, vocab_size]) / temperature, 1)
else:
samples = tf.argmax(x, axis=-1)
reshaped_samples = tf.reshape(samples, common_layers.shape_list(x)[:-1])
return reshaped_samples
|
python
|
def multinomial_sample(x, vocab_size=None, sampling_method="random",
temperature=1.0):
"""Multinomial sampling from a n-dimensional tensor.
Args:
x: Tensor of shape [..., vocab_size]. Parameterizes logits of multinomial.
vocab_size: Number of classes in multinomial distribution.
sampling_method: String, "random" or otherwise deterministic.
temperature: Positive float.
Returns:
Tensor of shape [...].
"""
vocab_size = vocab_size or common_layers.shape_list(x)[-1]
if sampling_method == "random" and temperature > 0.0:
samples = tf.multinomial(tf.reshape(x, [-1, vocab_size]) / temperature, 1)
else:
samples = tf.argmax(x, axis=-1)
reshaped_samples = tf.reshape(samples, common_layers.shape_list(x)[:-1])
return reshaped_samples
|
[
"def",
"multinomial_sample",
"(",
"x",
",",
"vocab_size",
"=",
"None",
",",
"sampling_method",
"=",
"\"random\"",
",",
"temperature",
"=",
"1.0",
")",
":",
"vocab_size",
"=",
"vocab_size",
"or",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"[",
"-",
"1",
"]",
"if",
"sampling_method",
"==",
"\"random\"",
"and",
"temperature",
">",
"0.0",
":",
"samples",
"=",
"tf",
".",
"multinomial",
"(",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"-",
"1",
",",
"vocab_size",
"]",
")",
"/",
"temperature",
",",
"1",
")",
"else",
":",
"samples",
"=",
"tf",
".",
"argmax",
"(",
"x",
",",
"axis",
"=",
"-",
"1",
")",
"reshaped_samples",
"=",
"tf",
".",
"reshape",
"(",
"samples",
",",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"[",
":",
"-",
"1",
"]",
")",
"return",
"reshaped_samples"
] |
Multinomial sampling from a n-dimensional tensor.
Args:
x: Tensor of shape [..., vocab_size]. Parameterizes logits of multinomial.
vocab_size: Number of classes in multinomial distribution.
sampling_method: String, "random" or otherwise deterministic.
temperature: Positive float.
Returns:
Tensor of shape [...].
|
[
"Multinomial",
"sampling",
"from",
"a",
"n",
"-",
"dimensional",
"tensor",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L80-L99
|
train
|
Multinomial sampling from a n - dimensional tensor.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,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0qciNl3EEEj,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' + '\x33' + '\x30' + chr(52), 11543 - 11535), ehT0Px3KOsy9(chr(1393 - 1345) + chr(0b1010110 + 0o31) + chr(228 - 177) + chr(1514 - 1465) + chr(0b110001), 26229 - 26221), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101 + 0o54) + chr(55) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(0b110011) + chr(0b110000) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(6349 - 6238) + chr(0b110111) + chr(535 - 487), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + '\063' + chr(0b1001 + 0o51), 6681 - 6673), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + '\063' + chr(0b100011 + 0o23) + chr(0b101110 + 0o7), 12681 - 12673), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(9289 - 9178) + chr(0b110011) + '\x35' + chr(0b11111 + 0o24), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000100 + 0o53) + '\x31' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001011 + 0o44) + '\067' + chr(235 - 180), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101 + 0o142) + chr(0b110010) + '\x35' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x35' + '\064', 0o10), ehT0Px3KOsy9(chr(1030 - 982) + chr(111) + chr(1261 - 1212) + chr(2084 - 2029) + chr(0b10110 + 0o41), 8), ehT0Px3KOsy9(chr(870 - 822) + '\157' + chr(2033 - 1983) + chr(912 - 863) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(0b10000 + 0o43) + chr(1771 - 1720) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(49) + chr(51), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(53) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1000110 + 0o51) + chr(1419 - 1368) + chr(0b101111 + 0o1) + chr(1335 - 1287), 24453 - 24445), ehT0Px3KOsy9(chr(1045 - 997) + '\x6f' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + '\x33' + '\x34' + '\063', 0b1000), ehT0Px3KOsy9(chr(1433 - 1385) + chr(11427 - 11316) + '\x32' + chr(719 - 667) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7383 - 7272) + chr(0b1 + 0o60) + chr(2067 - 2013) + chr(0b11 + 0o60), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b111 + 0o52) + chr(0b10001 + 0o43) + chr(0b110011), 2719 - 2711), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100111 + 0o13) + chr(1384 - 1332) + chr(0b101010 + 0o12), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110001 + 0o76) + '\x32' + chr(0b10 + 0o64) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11111 + 0o22) + '\x34', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10893 - 10782) + chr(54) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(0b101010 + 0o13) + chr(0b101011 + 0o6), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100001 + 0o16) + '\063' + chr(0b110000) + chr(0b10101 + 0o33), 8), ehT0Px3KOsy9(chr(1437 - 1389) + chr(2232 - 2121) + '\062' + chr(0b110001) + '\061', 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1111 + 0o140) + chr(49) + '\x33' + chr(2684 - 2632), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(2167 - 2116) + '\x36' + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2635 - 2581) + '\063', 26985 - 26977), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(945 - 897) + chr(111) + '\061' + chr(69 - 19) + '\x34', 28560 - 28552), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1276 - 1228) + chr(49), 45093 - 45085), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110011) + '\066', 1639 - 1631), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(2537 - 2484) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + '\x33' + chr(0b110010), 8), ehT0Px3KOsy9(chr(1892 - 1844) + '\157' + chr(0b10110 + 0o33) + chr(0b1111 + 0o44) + chr(1277 - 1223), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(5120 - 5009) + chr(0b110101) + chr(0b101110 + 0o2), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xea'), chr(0b1011111 + 0o5) + chr(0b1100101) + chr(0b1100011) + chr(8682 - 8571) + chr(100) + '\145')('\165' + chr(0b1110100) + '\146' + '\055' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def jGHq2mSq6KXM(OeWW0F1dBPRQ, CeyMIoSyrpkQ=None, Ud1InQ7hapop=xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6\xa8\x11\xa2Ww'), '\x64' + chr(101) + '\143' + '\157' + '\144' + chr(0b1100101))(chr(0b1000000 + 0o65) + '\164' + chr(8081 - 7979) + chr(45) + chr(1392 - 1336)), uICaXvjWrxGa=1.0):
CeyMIoSyrpkQ = CeyMIoSyrpkQ or jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)[-ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31', 43951 - 43943)]
if Ud1InQ7hapop == xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6\xa8\x11\xa2Ww'), '\144' + chr(0b10001 + 0o124) + chr(0b1100011) + chr(6905 - 6794) + chr(0b1100100) + chr(101))(chr(117) + chr(0b11011 + 0o131) + chr(0b1001101 + 0o31) + '\055' + chr(1259 - 1203)) and uICaXvjWrxGa > 0.0:
db1_IZvznkcy = IDJ2eXGCBCDu.multinomial(IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [-ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001 + 0o0), 8), CeyMIoSyrpkQ]) / uICaXvjWrxGa, ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), 8))
else:
db1_IZvznkcy = IDJ2eXGCBCDu.argmax(OeWW0F1dBPRQ, axis=-ehT0Px3KOsy9('\x30' + chr(9253 - 9142) + chr(1003 - 954), 8))
EU_KDAywSzFO = IDJ2eXGCBCDu.reshape(db1_IZvznkcy, jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)[:-ehT0Px3KOsy9(chr(48) + chr(1143 - 1032) + '\061', 8)])
return EU_KDAywSzFO
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
ae_latent_softmax
|
def ae_latent_softmax(latents_pred, latents_discrete_hot, vocab_size, hparams):
"""Latent prediction and loss.
Args:
latents_pred: Tensor of shape [..., depth].
latents_discrete_hot: Tensor of shape [..., vocab_size].
vocab_size: an int representing the vocab size.
hparams: HParams.
Returns:
sample: Tensor of shape [...], a sample from a multinomial distribution.
loss: Tensor of shape [...], the softmax cross-entropy.
"""
with tf.variable_scope("latent_logits"):
latents_logits = tf.layers.dense(latents_pred, vocab_size,
name="logits_dense")
if hparams.logit_normalization:
latents_logits *= tf.rsqrt(1e-8 +
tf.reduce_mean(tf.square(latents_logits)))
loss = tf.nn.softmax_cross_entropy_with_logits_v2(
labels=latents_discrete_hot, logits=latents_logits)
# TODO(trandustin): tease this out from ae_latent_softmax.
# we use just the loss portion to anchor prior / encoder on text.
sample = multinomial_sample(latents_logits,
vocab_size,
hparams.sampling_method,
hparams.sampling_temp)
return sample, loss
|
python
|
def ae_latent_softmax(latents_pred, latents_discrete_hot, vocab_size, hparams):
"""Latent prediction and loss.
Args:
latents_pred: Tensor of shape [..., depth].
latents_discrete_hot: Tensor of shape [..., vocab_size].
vocab_size: an int representing the vocab size.
hparams: HParams.
Returns:
sample: Tensor of shape [...], a sample from a multinomial distribution.
loss: Tensor of shape [...], the softmax cross-entropy.
"""
with tf.variable_scope("latent_logits"):
latents_logits = tf.layers.dense(latents_pred, vocab_size,
name="logits_dense")
if hparams.logit_normalization:
latents_logits *= tf.rsqrt(1e-8 +
tf.reduce_mean(tf.square(latents_logits)))
loss = tf.nn.softmax_cross_entropy_with_logits_v2(
labels=latents_discrete_hot, logits=latents_logits)
# TODO(trandustin): tease this out from ae_latent_softmax.
# we use just the loss portion to anchor prior / encoder on text.
sample = multinomial_sample(latents_logits,
vocab_size,
hparams.sampling_method,
hparams.sampling_temp)
return sample, loss
|
[
"def",
"ae_latent_softmax",
"(",
"latents_pred",
",",
"latents_discrete_hot",
",",
"vocab_size",
",",
"hparams",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"latent_logits\"",
")",
":",
"latents_logits",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"latents_pred",
",",
"vocab_size",
",",
"name",
"=",
"\"logits_dense\"",
")",
"if",
"hparams",
".",
"logit_normalization",
":",
"latents_logits",
"*=",
"tf",
".",
"rsqrt",
"(",
"1e-8",
"+",
"tf",
".",
"reduce_mean",
"(",
"tf",
".",
"square",
"(",
"latents_logits",
")",
")",
")",
"loss",
"=",
"tf",
".",
"nn",
".",
"softmax_cross_entropy_with_logits_v2",
"(",
"labels",
"=",
"latents_discrete_hot",
",",
"logits",
"=",
"latents_logits",
")",
"# TODO(trandustin): tease this out from ae_latent_softmax.",
"# we use just the loss portion to anchor prior / encoder on text.",
"sample",
"=",
"multinomial_sample",
"(",
"latents_logits",
",",
"vocab_size",
",",
"hparams",
".",
"sampling_method",
",",
"hparams",
".",
"sampling_temp",
")",
"return",
"sample",
",",
"loss"
] |
Latent prediction and loss.
Args:
latents_pred: Tensor of shape [..., depth].
latents_discrete_hot: Tensor of shape [..., vocab_size].
vocab_size: an int representing the vocab size.
hparams: HParams.
Returns:
sample: Tensor of shape [...], a sample from a multinomial distribution.
loss: Tensor of shape [...], the softmax cross-entropy.
|
[
"Latent",
"prediction",
"and",
"loss",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L102-L130
|
train
|
A function that computes the softmax cross - entropy of the given set of latents.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSI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Z2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(526 - 478) + chr(0b1101111) + chr(0b11001 + 0o31) + chr(0b10110 + 0o34) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(48) + chr(0b110011), 58761 - 58753), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + '\x34' + '\062', 1866 - 1858), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000 + 0o147) + chr(910 - 860) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b110100) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(463 - 414) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(0b101111 + 0o3) + chr(0b11100 + 0o33), 8100 - 8092), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b111101 + 0o62) + '\x32' + chr(0b110111) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b110110) + chr(0b100010 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b10 + 0o155) + chr(1116 - 1065) + chr(0b110011 + 0o2) + chr(0b101 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1010 + 0o50) + chr(0b110101) + chr(1079 - 1026), 0o10), ehT0Px3KOsy9(chr(1122 - 1074) + '\157' + chr(0b110001) + chr(0b110000) + '\x33', 8), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(49) + chr(0b10100 + 0o41) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(55) + chr(1128 - 1073), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100111 + 0o13) + '\065' + chr(53), 8), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + chr(1780 - 1730) + '\067' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(10796 - 10685) + '\063' + chr(2050 - 2002) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100001 + 0o16) + chr(2460 - 2409) + chr(0b110101) + '\064', 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + chr(0b110100) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10 + 0o62) + chr(0b110111 + 0o0), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1336 - 1225) + '\x32' + chr(0b110011) + '\062', 59845 - 59837), ehT0Px3KOsy9('\x30' + chr(111) + chr(2703 - 2648) + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110 + 0o54) + '\x37' + chr(0b110000), 8586 - 8578), ehT0Px3KOsy9(chr(1415 - 1367) + chr(2727 - 2616) + chr(0b110110) + chr(0b110000), 46232 - 46224), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(51) + chr(0b101111 + 0o2) + chr(651 - 602), 62343 - 62335), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\x30' + chr(329 - 279), 0o10), ehT0Px3KOsy9('\x30' + chr(8143 - 8032) + chr(51) + chr(844 - 795) + chr(0b11 + 0o55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50), 32982 - 32974), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(49) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b110011) + chr(0b110110) + chr(1223 - 1171), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(0b110001) + chr(1487 - 1435) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(49) + chr(59 - 10), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(759 - 708) + '\x37' + chr(2199 - 2148), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1001011 + 0o44) + chr(2127 - 2077) + chr(51) + chr(356 - 304), 33181 - 33173), ehT0Px3KOsy9('\x30' + chr(0b1111 + 0o140) + chr(50) + chr(50), 8), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(3230 - 3119) + '\062' + chr(0b110011) + '\060', 24448 - 24440), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b11101 + 0o27) + '\064', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b100010 + 0o17) + chr(0b100010 + 0o21), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2917 - 2806) + '\062' + chr(2493 - 2443), 8), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + chr(0b10000 + 0o43) + '\062' + chr(52), 10594 - 10586)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1011 + 0o144) + chr(2233 - 2180) + chr(401 - 353), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc'), chr(4507 - 4407) + chr(101) + chr(7262 - 7163) + chr(0b1001101 + 0o42) + '\144' + '\145')('\165' + chr(0b1101011 + 0o11) + chr(0b1100110) + chr(348 - 303) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def aIL5S5J7gN81(CGc8shFbWMSf, YsQ4jOHTeRvG, CeyMIoSyrpkQ, n4ljua2gi1Pr):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4"\x90{\xc5k\xbb\xdc-\x98\xce,\x1a\xda'), chr(0b110100 + 0o60) + chr(101) + '\x63' + chr(0b101001 + 0o106) + chr(5882 - 5782) + chr(101))(chr(5952 - 5835) + '\x74' + chr(2549 - 2447) + chr(0b10111 + 0o26) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe"\x96w\xca}\x88\xd5\x1d\x8c\xc47\x19'), chr(0b11001 + 0o113) + chr(0b10 + 0o143) + chr(99) + '\157' + '\x64' + '\x65')(chr(0b100101 + 0o120) + '\x74' + chr(102) + '\x2d' + '\070')):
HljACvRa5la1 = IDJ2eXGCBCDu.layers.dense(CGc8shFbWMSf, CeyMIoSyrpkQ, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe,\x85{\xd0z\x88\xdd\x17\x85\xde&'), '\144' + chr(0b110 + 0o137) + '\x63' + chr(111) + chr(0b1000111 + 0o35) + '\x65')(chr(117) + chr(0b1100 + 0o150) + chr(0b11000 + 0o116) + '\055' + '\x38'))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe,\x85{\xd0V\xb9\xd6\x00\x86\xcc/\x03\xc5\xcc\xcf\xac\x83L'), '\x64' + chr(101) + chr(99) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + chr(0b1110100 + 0o0) + chr(102) + '\055' + chr(56))):
HljACvRa5la1 *= IDJ2eXGCBCDu.rsqrt(1e-08 + IDJ2eXGCBCDu.reduce_mean(IDJ2eXGCBCDu.square(HljACvRa5la1)))
YpO0BcZ6fMsf = IDJ2eXGCBCDu.nn.softmax_cross_entropy_with_logits_v2(labels=YsQ4jOHTeRvG, logits=HljACvRa5la1)
aBu4gMMQp6Jg = jGHq2mSq6KXM(HljACvRa5la1, CeyMIoSyrpkQ, n4ljua2gi1Pr.Ud1InQ7hapop, n4ljua2gi1Pr.Ep30xVZP6Jij)
return (aBu4gMMQp6Jg, YpO0BcZ6fMsf)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
ae_latent_sample_beam
|
def ae_latent_sample_beam(latents_dense_in, inputs, ed, embed, hparams):
"""Samples from the latent space in the autoencoder.
Args:
latents_dense_in: Tensor of shape [batch, length_q, ...]. Only the shape of
its first two dimensions are used. length_q is the latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
inputs: Tensor of shape [batch, length_kv, hparams.hidden_size]. Encodings
to attend to in decoder.
ed: Tensor which broadcasts with shape [batch, hparams.num_heads, length_q,
length_kv]. Encoder-decoder attention bias.
embed: Callable which embeds discrete latent hot-vectors and a hidden size
and returns dense vectors.
hparams: HParams.
Returns:
Tensor of shape [batch, length].
"""
def symbols_to_logits_fn(ids):
"""Go from ids to logits."""
ids = tf.expand_dims(ids, axis=2) # Ids start with added all-zeros.
latents_discrete = tf.pad(ids[:, 1:], [[0, 0], [0, 1], [0, 0]])
with tf.variable_scope(tf.get_variable_scope(), reuse=False):
latents_dense = embed(
tf.one_hot(latents_discrete, depth=2**hparams.bottleneck_bits),
hparams.hidden_size)
latents_pred = transformer_latent_decoder(
latents_dense, inputs, ed, hparams, name="latent_prediction")
logits = tf.layers.dense(
latents_pred, 2**hparams.bottleneck_bits, name="logits_dense")
current_output_position = common_layers.shape_list(ids)[1] - 1
logits = logits[:, current_output_position, :]
return logits
initial_ids = tf.zeros([tf.shape(latents_dense_in)[0]], dtype=tf.int32)
length = tf.shape(latents_dense_in)[1]
ids, _, _ = beam_search.beam_search(
symbols_to_logits_fn,
initial_ids,
1,
length,
2**hparams.bottleneck_bits,
alpha=0.0,
eos_id=-1,
stop_early=False)
res = tf.expand_dims(ids[:, 0, :], axis=2) # Pick first beam.
return res[:, 1:]
|
python
|
def ae_latent_sample_beam(latents_dense_in, inputs, ed, embed, hparams):
"""Samples from the latent space in the autoencoder.
Args:
latents_dense_in: Tensor of shape [batch, length_q, ...]. Only the shape of
its first two dimensions are used. length_q is the latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
inputs: Tensor of shape [batch, length_kv, hparams.hidden_size]. Encodings
to attend to in decoder.
ed: Tensor which broadcasts with shape [batch, hparams.num_heads, length_q,
length_kv]. Encoder-decoder attention bias.
embed: Callable which embeds discrete latent hot-vectors and a hidden size
and returns dense vectors.
hparams: HParams.
Returns:
Tensor of shape [batch, length].
"""
def symbols_to_logits_fn(ids):
"""Go from ids to logits."""
ids = tf.expand_dims(ids, axis=2) # Ids start with added all-zeros.
latents_discrete = tf.pad(ids[:, 1:], [[0, 0], [0, 1], [0, 0]])
with tf.variable_scope(tf.get_variable_scope(), reuse=False):
latents_dense = embed(
tf.one_hot(latents_discrete, depth=2**hparams.bottleneck_bits),
hparams.hidden_size)
latents_pred = transformer_latent_decoder(
latents_dense, inputs, ed, hparams, name="latent_prediction")
logits = tf.layers.dense(
latents_pred, 2**hparams.bottleneck_bits, name="logits_dense")
current_output_position = common_layers.shape_list(ids)[1] - 1
logits = logits[:, current_output_position, :]
return logits
initial_ids = tf.zeros([tf.shape(latents_dense_in)[0]], dtype=tf.int32)
length = tf.shape(latents_dense_in)[1]
ids, _, _ = beam_search.beam_search(
symbols_to_logits_fn,
initial_ids,
1,
length,
2**hparams.bottleneck_bits,
alpha=0.0,
eos_id=-1,
stop_early=False)
res = tf.expand_dims(ids[:, 0, :], axis=2) # Pick first beam.
return res[:, 1:]
|
[
"def",
"ae_latent_sample_beam",
"(",
"latents_dense_in",
",",
"inputs",
",",
"ed",
",",
"embed",
",",
"hparams",
")",
":",
"def",
"symbols_to_logits_fn",
"(",
"ids",
")",
":",
"\"\"\"Go from ids to logits.\"\"\"",
"ids",
"=",
"tf",
".",
"expand_dims",
"(",
"ids",
",",
"axis",
"=",
"2",
")",
"# Ids start with added all-zeros.",
"latents_discrete",
"=",
"tf",
".",
"pad",
"(",
"ids",
"[",
":",
",",
"1",
":",
"]",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"1",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"tf",
".",
"get_variable_scope",
"(",
")",
",",
"reuse",
"=",
"False",
")",
":",
"latents_dense",
"=",
"embed",
"(",
"tf",
".",
"one_hot",
"(",
"latents_discrete",
",",
"depth",
"=",
"2",
"**",
"hparams",
".",
"bottleneck_bits",
")",
",",
"hparams",
".",
"hidden_size",
")",
"latents_pred",
"=",
"transformer_latent_decoder",
"(",
"latents_dense",
",",
"inputs",
",",
"ed",
",",
"hparams",
",",
"name",
"=",
"\"latent_prediction\"",
")",
"logits",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"latents_pred",
",",
"2",
"**",
"hparams",
".",
"bottleneck_bits",
",",
"name",
"=",
"\"logits_dense\"",
")",
"current_output_position",
"=",
"common_layers",
".",
"shape_list",
"(",
"ids",
")",
"[",
"1",
"]",
"-",
"1",
"logits",
"=",
"logits",
"[",
":",
",",
"current_output_position",
",",
":",
"]",
"return",
"logits",
"initial_ids",
"=",
"tf",
".",
"zeros",
"(",
"[",
"tf",
".",
"shape",
"(",
"latents_dense_in",
")",
"[",
"0",
"]",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"length",
"=",
"tf",
".",
"shape",
"(",
"latents_dense_in",
")",
"[",
"1",
"]",
"ids",
",",
"_",
",",
"_",
"=",
"beam_search",
".",
"beam_search",
"(",
"symbols_to_logits_fn",
",",
"initial_ids",
",",
"1",
",",
"length",
",",
"2",
"**",
"hparams",
".",
"bottleneck_bits",
",",
"alpha",
"=",
"0.0",
",",
"eos_id",
"=",
"-",
"1",
",",
"stop_early",
"=",
"False",
")",
"res",
"=",
"tf",
".",
"expand_dims",
"(",
"ids",
"[",
":",
",",
"0",
",",
":",
"]",
",",
"axis",
"=",
"2",
")",
"# Pick first beam.",
"return",
"res",
"[",
":",
",",
"1",
":",
"]"
] |
Samples from the latent space in the autoencoder.
Args:
latents_dense_in: Tensor of shape [batch, length_q, ...]. Only the shape of
its first two dimensions are used. length_q is the latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
inputs: Tensor of shape [batch, length_kv, hparams.hidden_size]. Encodings
to attend to in decoder.
ed: Tensor which broadcasts with shape [batch, hparams.num_heads, length_q,
length_kv]. Encoder-decoder attention bias.
embed: Callable which embeds discrete latent hot-vectors and a hidden size
and returns dense vectors.
hparams: HParams.
Returns:
Tensor of shape [batch, length].
|
[
"Samples",
"from",
"the",
"latent",
"space",
"in",
"the",
"autoencoder",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L133-L182
|
train
|
Samples from the latent space in the autoencoder.
|
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,rIcPej9Z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0,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) + '\062' + chr(108 - 53) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1290 - 1240) + chr(563 - 512) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100101 + 0o14) + chr(50) + chr(0b1001 + 0o50), 20281 - 20273), ehT0Px3KOsy9(chr(1019 - 971) + chr(0b11101 + 0o122) + chr(50) + '\066' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(9114 - 9003) + chr(49) + chr(0b10010 + 0o37) + chr(0b110111), 56580 - 56572), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + chr(0b1001 + 0o53), 61129 - 61121), ehT0Px3KOsy9(chr(48) + chr(0b10001 + 0o136) + '\066' + chr(0b1010 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(826 - 778) + '\157' + chr(49) + '\x30' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + '\x35' + chr(779 - 726), 16453 - 16445), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(49) + chr(0b101110 + 0o4) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(768 - 657) + chr(2042 - 1992) + chr(1591 - 1539) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(3179 - 3068) + chr(1267 - 1218) + chr(0b110010) + chr(0b101111 + 0o10), 8), ehT0Px3KOsy9(chr(1474 - 1426) + chr(0b1101111) + '\063' + chr(54) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(1688 - 1638) + chr(0b10 + 0o57), 58221 - 58213), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + chr(0b110011) + chr(53) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b111100 + 0o63) + '\062' + chr(53) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + '\x35' + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110000 + 0o1) + chr(0b1000 + 0o52) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(0b1000110 + 0o51) + chr(0b101010 + 0o11) + chr(53) + chr(0b111 + 0o53), 1242 - 1234), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110101) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8760 - 8649) + chr(0b110010) + chr(0b110011), 42176 - 42168), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b111100 + 0o63) + '\061' + '\065' + '\061', 8), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(11873 - 11762) + '\x31' + chr(0b10001 + 0o42) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(962 - 914) + chr(8789 - 8678) + '\x33' + '\067' + chr(48), 60691 - 60683), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110010) + chr(49) + chr(2205 - 2156), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + chr(0b110111) + chr(644 - 592), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\063' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\065' + '\x31', 50187 - 50179), ehT0Px3KOsy9('\060' + chr(111) + chr(1282 - 1233) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x31' + chr(53), 53007 - 52999), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2051 - 2000) + chr(0b11 + 0o60) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101 + 0o55) + chr(51), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b1001 + 0o52) + chr(50) + chr(0b10100 + 0o40), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b100110 + 0o21) + chr(49), 0o10), ehT0Px3KOsy9(chr(744 - 696) + chr(111) + chr(0b110000 + 0o1) + chr(2287 - 2234) + chr(1632 - 1577), 0o10), ehT0Px3KOsy9(chr(1131 - 1083) + chr(3175 - 3064) + chr(2234 - 2185) + '\067' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(54) + chr(0b10110 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(10136 - 10025) + chr(0b110010) + chr(0b110110) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b0 + 0o61) + '\065' + chr(50), 24073 - 24065), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(50) + chr(48), 30282 - 30274)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + '\x35' + chr(1928 - 1880), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x90'), chr(100) + '\x65' + chr(0b1100011) + chr(4490 - 4379) + '\x64' + chr(0b110110 + 0o57))('\x75' + chr(0b100001 + 0o123) + '\146' + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Qh4xGcOn2HHI(rZig1969CRdA, vXoupepMtCXU, dTXqLuPC2FBQ, DSKhI6I667G0, n4ljua2gi1Pr):
def P8dwKNPITUWX(zdjj2pRemk_P):
zdjj2pRemk_P = IDJ2eXGCBCDu.expand_dims(zdjj2pRemk_P, axis=ehT0Px3KOsy9(chr(54 - 6) + chr(0b100111 + 0o110) + chr(0b110010), ord("\x08")))
z2Exq_eUlctN = IDJ2eXGCBCDu.pad(zdjj2pRemk_P[:, ehT0Px3KOsy9(chr(415 - 367) + chr(111) + chr(1211 - 1162), 0b1000):], [[ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11110 + 0o22), 8)], [ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(1198 - 1150), 8), ehT0Px3KOsy9(chr(83 - 35) + chr(0b1101111) + '\x31', 8)], [ehT0Px3KOsy9('\060' + chr(111) + '\060', 8), ehT0Px3KOsy9(chr(1589 - 1541) + chr(0b1101111) + '\060', 8)]])
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"\xc8\xfb#\xdb.N['r$\xc38\x81\xb4"), '\144' + chr(770 - 669) + chr(6083 - 5984) + '\157' + '\144' + '\145')(chr(0b1010100 + 0o41) + chr(7921 - 7805) + chr(0b1100011 + 0o3) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9\xff%\xed9ME+L5\xcc2\xae\xa2\x8a\xc1\xda6'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(5300 - 5189) + chr(100) + '\145')(chr(117) + chr(1070 - 954) + '\146' + '\055' + chr(2800 - 2744)))(), reuse=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(48), 8)):
dyezpTDvdVyF = DSKhI6I667G0(IDJ2eXGCBCDu.Hq3fv4Yp0EhD(z2Exq_eUlctN, depth=ehT0Px3KOsy9(chr(2116 - 2068) + chr(111) + '\x32', 8) ** n4ljua2gi1Pr.L0tf_yAed5SW), n4ljua2gi1Pr.qzoyXN3kdhDL)
CGc8shFbWMSf = E5l0_7XM8AYV(dyezpTDvdVyF, vXoupepMtCXU, dTXqLuPC2FBQ, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\xfb%\xd7!Xh2_2\xc4>\x92\xa5\x80\xc1\xc4'), chr(100) + chr(101) + '\x63' + '\x6f' + '\x64' + chr(6215 - 6114))(chr(0b1110101) + chr(116) + chr(0b11101 + 0o111) + '\x2d' + chr(56)))
wF9nmvjsKjYM = IDJ2eXGCBCDu.layers.dense(CGc8shFbWMSf, ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + '\062', 8) ** n4ljua2gi1Pr.L0tf_yAed5SW, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2\xf56\xdb;_h&H9\xd32'), chr(100) + chr(754 - 653) + '\x63' + '\x6f' + chr(8089 - 7989) + chr(0b11 + 0o142))(chr(0b1011111 + 0o26) + chr(6848 - 6732) + chr(9663 - 9561) + '\055' + chr(0b111000)))
Ne_DQ1Ggwi__ = jSKPaHwSAfVv.shape_list(zdjj2pRemk_P)[ehT0Px3KOsy9(chr(48) + chr(3010 - 2899) + chr(431 - 382), 8)] - ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(8861 - 8750) + chr(0b101111 + 0o2), 8)
wF9nmvjsKjYM = wF9nmvjsKjYM[:, Ne_DQ1Ggwi__, :]
return wF9nmvjsKjYM
WPnuojygthCW = IDJ2eXGCBCDu.zeros([IDJ2eXGCBCDu.nauYfLglTpcb(rZig1969CRdA)[ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1001 + 0o47), 8)]], dtype=IDJ2eXGCBCDu.int32)
CHAOgk5VCHH_ = IDJ2eXGCBCDu.nauYfLglTpcb(rZig1969CRdA)[ehT0Px3KOsy9('\x30' + '\x6f' + chr(49), 8)]
(zdjj2pRemk_P, VNGQdHSFPrso, VNGQdHSFPrso) = M4QqcqvVKFSA.beam_search(P8dwKNPITUWX, WPnuojygthCW, ehT0Px3KOsy9('\x30' + '\x6f' + chr(1214 - 1165), 8), CHAOgk5VCHH_, ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b111010 + 0o65) + chr(0b10100 + 0o36), 8) ** n4ljua2gi1Pr.L0tf_yAed5SW, alpha=0.0, eos_id=-ehT0Px3KOsy9(chr(524 - 476) + chr(111) + chr(1085 - 1036), 8), stop_early=ehT0Px3KOsy9('\x30' + '\x6f' + chr(48), 8))
MsbwfslwLjRO = IDJ2eXGCBCDu.expand_dims(zdjj2pRemk_P[:, ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b101001 + 0o106) + '\x30', 8), :], axis=ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b11111 + 0o23), 8))
return MsbwfslwLjRO[:, ehT0Px3KOsy9(chr(1876 - 1828) + chr(111) + '\061', 8):]
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
residual_block_layer
|
def residual_block_layer(inputs, hparams):
"""Residual block over inputs.
Runs a residual block consisting of
conv: kernel_size x kernel_size
conv: 1x1
dropout, add and normalize according to hparams.layer_postprocess_sequence.
Args:
inputs: Tensor of shape [batch, height, width, hparams.hidden_size].
hparams: HParams.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
"""
kernel = (hparams.res_kernel_size, hparams.res_kernel_size)
x = inputs
for i in range(hparams.num_res_layers):
with tf.variable_scope("res_conv_%d" % i):
# kernel_size x kernel_size conv block
y = common_layers.conv_block(
common_layers.layer_norm(x, hparams.hidden_size, name="lnorm"),
hparams.hidden_size, [((1, 1), kernel)],
strides=(1, 1),
padding="SAME",
name="residual_conv")
# 1x1 conv block
y = common_layers.conv_block(
y,
hparams.hidden_size, [((1, 1), (1, 1))],
strides=(1, 1),
padding="SAME",
name="residual_dense")
x = common_layers.layer_postprocess(x, y, hparams)
return x
|
python
|
def residual_block_layer(inputs, hparams):
"""Residual block over inputs.
Runs a residual block consisting of
conv: kernel_size x kernel_size
conv: 1x1
dropout, add and normalize according to hparams.layer_postprocess_sequence.
Args:
inputs: Tensor of shape [batch, height, width, hparams.hidden_size].
hparams: HParams.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
"""
kernel = (hparams.res_kernel_size, hparams.res_kernel_size)
x = inputs
for i in range(hparams.num_res_layers):
with tf.variable_scope("res_conv_%d" % i):
# kernel_size x kernel_size conv block
y = common_layers.conv_block(
common_layers.layer_norm(x, hparams.hidden_size, name="lnorm"),
hparams.hidden_size, [((1, 1), kernel)],
strides=(1, 1),
padding="SAME",
name="residual_conv")
# 1x1 conv block
y = common_layers.conv_block(
y,
hparams.hidden_size, [((1, 1), (1, 1))],
strides=(1, 1),
padding="SAME",
name="residual_dense")
x = common_layers.layer_postprocess(x, y, hparams)
return x
|
[
"def",
"residual_block_layer",
"(",
"inputs",
",",
"hparams",
")",
":",
"kernel",
"=",
"(",
"hparams",
".",
"res_kernel_size",
",",
"hparams",
".",
"res_kernel_size",
")",
"x",
"=",
"inputs",
"for",
"i",
"in",
"range",
"(",
"hparams",
".",
"num_res_layers",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"res_conv_%d\"",
"%",
"i",
")",
":",
"# kernel_size x kernel_size conv block",
"y",
"=",
"common_layers",
".",
"conv_block",
"(",
"common_layers",
".",
"layer_norm",
"(",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"name",
"=",
"\"lnorm\"",
")",
",",
"hparams",
".",
"hidden_size",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel",
")",
"]",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"residual_conv\"",
")",
"# 1x1 conv block",
"y",
"=",
"common_layers",
".",
"conv_block",
"(",
"y",
",",
"hparams",
".",
"hidden_size",
",",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"(",
"1",
",",
"1",
")",
")",
"]",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"residual_dense\"",
")",
"x",
"=",
"common_layers",
".",
"layer_postprocess",
"(",
"x",
",",
"y",
",",
"hparams",
")",
"return",
"x"
] |
Residual block over inputs.
Runs a residual block consisting of
conv: kernel_size x kernel_size
conv: 1x1
dropout, add and normalize according to hparams.layer_postprocess_sequence.
Args:
inputs: Tensor of shape [batch, height, width, hparams.hidden_size].
hparams: HParams.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
|
[
"Residual",
"block",
"over",
"inputs",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L185-L219
|
train
|
Residual block over inputs.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcj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r8gNKaIaWE,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(1625 - 1577) + chr(0b11101 + 0o122) + '\x32' + chr(0b110111) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + '\062' + chr(748 - 694) + chr(156 - 107), 0b1000), ehT0Px3KOsy9(chr(414 - 366) + chr(0b1101111) + chr(0b100001 + 0o22) + chr(0b110111) + '\064', 63534 - 63526), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b10001 + 0o46) + chr(49), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(0b1 + 0o57) + chr(607 - 552), 20922 - 20914), ehT0Px3KOsy9('\x30' + chr(5786 - 5675) + chr(0b110001 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b10011 + 0o134) + chr(49) + chr(1004 - 950) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(479 - 430) + chr(1235 - 1184) + chr(0b110011), 27972 - 27964), ehT0Px3KOsy9(chr(321 - 273) + '\x6f' + '\061' + '\061' + chr(0b10101 + 0o33), 0b1000), ehT0Px3KOsy9(chr(1026 - 978) + chr(3477 - 3366) + '\063' + chr(2367 - 2318) + '\062', 12257 - 12249), ehT0Px3KOsy9(chr(1556 - 1508) + '\157' + '\063' + chr(0b1100 + 0o46) + chr(0b11101 + 0o30), 0b1000), ehT0Px3KOsy9('\x30' + chr(4605 - 4494) + chr(1597 - 1546) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b110001) + chr(2583 - 2531) + chr(691 - 641), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10000 + 0o137) + '\x33' + '\062' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(10807 - 10696) + '\063' + chr(0b100010 + 0o22) + '\067', 42746 - 42738), ehT0Px3KOsy9(chr(1882 - 1834) + chr(0b1100010 + 0o15) + chr(51) + chr(51) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1672 - 1621) + chr(329 - 277) + chr(125 - 70), 8), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + '\x33' + '\x36' + chr(874 - 825), 0o10), ehT0Px3KOsy9(chr(1120 - 1072) + chr(4814 - 4703) + chr(0b11 + 0o60) + chr(52) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(1100 - 1045), ord("\x08")), ehT0Px3KOsy9(chr(405 - 357) + chr(999 - 888) + chr(0b0 + 0o63) + '\063' + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b10001 + 0o136) + chr(0b110011) + '\064' + '\x31', 8), ehT0Px3KOsy9(chr(383 - 335) + chr(0b1101111) + chr(0b110011) + chr(49) + chr(0b10100 + 0o40), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x31' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b101001 + 0o106) + chr(0b100011 + 0o20) + chr(0b110100), 42630 - 42622), ehT0Px3KOsy9(chr(1650 - 1602) + chr(0b1101111) + chr(0b10 + 0o61) + '\066' + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(4831 - 4720) + '\061' + chr(0b100110 + 0o15) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + '\062' + chr(0b10 + 0o60) + chr(0b100 + 0o57), 18276 - 18268), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(768 - 719) + '\064', 27660 - 27652), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + '\x33' + chr(666 - 618) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7635 - 7524) + '\065' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(677 - 629) + '\x6f' + chr(1029 - 980) + '\061' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110001) + chr(0b110011), 33092 - 33084), ehT0Px3KOsy9(chr(2189 - 2141) + '\157' + chr(0b1100 + 0o50) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(0b110010) + '\065' + '\x34', 39035 - 39027), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b110110) + chr(53), 8), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(0b110001) + chr(0b110001) + '\061', 9923 - 9915), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(7578 - 7467) + '\063' + '\x33', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100111 + 0o13), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x97'), '\x64' + '\145' + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(117) + '\164' + chr(5821 - 5719) + chr(0b1011 + 0o42) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def CyB1qZHKH3CI(vXoupepMtCXU, n4ljua2gi1Pr):
iaILEoszmqXb = (n4ljua2gi1Pr.res_kernel_size, n4ljua2gi1Pr.res_kernel_size)
OeWW0F1dBPRQ = vXoupepMtCXU
for WVxHKyX45z_L in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7\xc4\x91\xe6\xb5d\x02\x04$\xab\xac{i\x11'), chr(0b11111 + 0o105) + chr(427 - 326) + '\x63' + chr(8959 - 8848) + chr(4752 - 4652) + chr(0b110111 + 0o56))(chr(117) + chr(1130 - 1014) + chr(0b1100100 + 0o2) + '\055' + chr(0b111000)))):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf\xd0\x8e\xd0\xa6c\x1d>\x17\xb9\xb6qk\x07'), chr(0b1011101 + 0o7) + chr(0b101010 + 0o73) + chr(99) + '\157' + '\144' + chr(0b100010 + 0o103))(chr(7331 - 7214) + '\x74' + '\x66' + chr(0b101101) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xd4\x8f\xe6\xa4n\x1f-\x17\xef\xb1'), '\144' + chr(101) + chr(3653 - 3554) + '\x6f' + '\144' + chr(3425 - 3324))(chr(0b0 + 0o165) + '\x74' + '\146' + '\055' + '\070') % WVxHKyX45z_L):
SqiSOtYOqOJH = jSKPaHwSAfVv.conv_block(jSKPaHwSAfVv.layer_norm(OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xdf\x93\xcb\xaa'), '\144' + '\x65' + '\143' + chr(0b1101100 + 0o3) + '\144' + '\x65')('\165' + chr(0b1000010 + 0o62) + '\x66' + chr(936 - 891) + chr(0b111000))), n4ljua2gi1Pr.qzoyXN3kdhDL, [((ehT0Px3KOsy9('\x30' + '\157' + '\x31', 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + chr(49), 8)), iaILEoszmqXb)], strides=(ehT0Px3KOsy9(chr(1123 - 1075) + chr(111) + chr(2209 - 2160), 8), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(49), 8)), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xea\xf0\xb1\xfc'), chr(0b1100100) + '\145' + chr(99) + chr(1131 - 1020) + chr(100) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(0b1100110) + '\055' + '\070'), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xd4\x8f\xd0\xa3t\x107\x17\xa9\xbapm'), '\144' + '\145' + chr(99) + chr(0b101110 + 0o101) + chr(0b1 + 0o143) + '\x65')(chr(12808 - 12691) + '\x74' + chr(0b10001 + 0o125) + '\055' + '\070'))
SqiSOtYOqOJH = jSKPaHwSAfVv.conv_block(SqiSOtYOqOJH, n4ljua2gi1Pr.qzoyXN3kdhDL, [((ehT0Px3KOsy9(chr(504 - 456) + '\157' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + chr(0b100010 + 0o17), 8)), (ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + chr(10825 - 10714) + '\x31', 8)))], strides=(ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + chr(1526 - 1415) + '\061', 8)), padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\xea\xf0\xb1\xfc'), chr(0b1100100) + chr(0b1011001 + 0o14) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(6647 - 6531) + chr(102) + chr(45) + chr(0b10010 + 0o46)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xd4\x8f\xd0\xa3t\x107\x17\xae\xb0ph\x07'), '\144' + chr(0b1100101) + chr(0b1001 + 0o132) + chr(11848 - 11737) + '\144' + chr(1393 - 1292))('\x75' + '\164' + '\x66' + chr(1122 - 1077) + chr(56)))
OeWW0F1dBPRQ = jSKPaHwSAfVv.layer_postprocess(OeWW0F1dBPRQ, SqiSOtYOqOJH, n4ljua2gi1Pr)
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
compress_encoder
|
def compress_encoder(inputs,
hparams,
strides=(2, 2),
kernel_size=(3, 3),
name=None):
"""Encoder that compresses 2-D inputs by 2**num_compress_steps.
Args:
inputs: Tensor of shape [batch, height, width, channels].
hparams: HParams.
strides: Tuple, strides for conv block.
kernel_size: Tuple, kernel window size for conv block.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * (height*width) / 2**(hparams.num_compress_steps).
"""
with tf.variable_scope(name, default_name="compress"):
x = inputs
for i in range(hparams.num_compress_steps // 2):
with tf.variable_scope("compress_conv_%d" % i):
y = common_layers.conv_block(
common_layers.layer_norm(
x, hparams.hidden_size, name="lnorm"),
hparams.hidden_size,
dilation_rates_and_kernel_sizes=[((1, 1), kernel_size)],
strides=strides,
padding="SAME",
name="compress_conv_%d" % i)
y = tf.nn.dropout(y, 1.0 - hparams.dropout)
if hparams.do_compress_attend:
y = compress_self_attention_layer(
x, hparams, name="compress_selfatt_%d" % i)
y += x
x = y
x = residual_block_layer(x, hparams)
# If using multiple copies of latents, blow up the hidden size and then
# reshape to increase by num_latents.
shape_x = common_layers.shape_list(x)
x = tf.layers.dense(x,
hparams.num_latents * hparams.hidden_size,
name=name + "_dense")
return tf.reshape(x, [shape_x[0],
shape_x[1] * shape_x[2] * hparams.num_latents,
hparams.hidden_size])
|
python
|
def compress_encoder(inputs,
hparams,
strides=(2, 2),
kernel_size=(3, 3),
name=None):
"""Encoder that compresses 2-D inputs by 2**num_compress_steps.
Args:
inputs: Tensor of shape [batch, height, width, channels].
hparams: HParams.
strides: Tuple, strides for conv block.
kernel_size: Tuple, kernel window size for conv block.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * (height*width) / 2**(hparams.num_compress_steps).
"""
with tf.variable_scope(name, default_name="compress"):
x = inputs
for i in range(hparams.num_compress_steps // 2):
with tf.variable_scope("compress_conv_%d" % i):
y = common_layers.conv_block(
common_layers.layer_norm(
x, hparams.hidden_size, name="lnorm"),
hparams.hidden_size,
dilation_rates_and_kernel_sizes=[((1, 1), kernel_size)],
strides=strides,
padding="SAME",
name="compress_conv_%d" % i)
y = tf.nn.dropout(y, 1.0 - hparams.dropout)
if hparams.do_compress_attend:
y = compress_self_attention_layer(
x, hparams, name="compress_selfatt_%d" % i)
y += x
x = y
x = residual_block_layer(x, hparams)
# If using multiple copies of latents, blow up the hidden size and then
# reshape to increase by num_latents.
shape_x = common_layers.shape_list(x)
x = tf.layers.dense(x,
hparams.num_latents * hparams.hidden_size,
name=name + "_dense")
return tf.reshape(x, [shape_x[0],
shape_x[1] * shape_x[2] * hparams.num_latents,
hparams.hidden_size])
|
[
"def",
"compress_encoder",
"(",
"inputs",
",",
"hparams",
",",
"strides",
"=",
"(",
"2",
",",
"2",
")",
",",
"kernel_size",
"=",
"(",
"3",
",",
"3",
")",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"compress\"",
")",
":",
"x",
"=",
"inputs",
"for",
"i",
"in",
"range",
"(",
"hparams",
".",
"num_compress_steps",
"//",
"2",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"compress_conv_%d\"",
"%",
"i",
")",
":",
"y",
"=",
"common_layers",
".",
"conv_block",
"(",
"common_layers",
".",
"layer_norm",
"(",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"name",
"=",
"\"lnorm\"",
")",
",",
"hparams",
".",
"hidden_size",
",",
"dilation_rates_and_kernel_sizes",
"=",
"[",
"(",
"(",
"1",
",",
"1",
")",
",",
"kernel_size",
")",
"]",
",",
"strides",
"=",
"strides",
",",
"padding",
"=",
"\"SAME\"",
",",
"name",
"=",
"\"compress_conv_%d\"",
"%",
"i",
")",
"y",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"y",
",",
"1.0",
"-",
"hparams",
".",
"dropout",
")",
"if",
"hparams",
".",
"do_compress_attend",
":",
"y",
"=",
"compress_self_attention_layer",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"\"compress_selfatt_%d\"",
"%",
"i",
")",
"y",
"+=",
"x",
"x",
"=",
"y",
"x",
"=",
"residual_block_layer",
"(",
"x",
",",
"hparams",
")",
"# If using multiple copies of latents, blow up the hidden size and then",
"# reshape to increase by num_latents.",
"shape_x",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"x",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"hparams",
".",
"num_latents",
"*",
"hparams",
".",
"hidden_size",
",",
"name",
"=",
"name",
"+",
"\"_dense\"",
")",
"return",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"shape_x",
"[",
"0",
"]",
",",
"shape_x",
"[",
"1",
"]",
"*",
"shape_x",
"[",
"2",
"]",
"*",
"hparams",
".",
"num_latents",
",",
"hparams",
".",
"hidden_size",
"]",
")"
] |
Encoder that compresses 2-D inputs by 2**num_compress_steps.
Args:
inputs: Tensor of shape [batch, height, width, channels].
hparams: HParams.
strides: Tuple, strides for conv block.
kernel_size: Tuple, kernel window size for conv block.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * (height*width) / 2**(hparams.num_compress_steps).
|
[
"Encoder",
"that",
"compresses",
"2",
"-",
"D",
"inputs",
"by",
"2",
"**",
"num_compress_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L222-L270
|
train
|
Encoder that compresses 2 - D inputs by 2 ** num_compress_steps.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yIS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esWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,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(0b10110 + 0o35) + chr(767 - 718) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(913 - 865) + '\x6f' + chr(50) + chr(49) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110111) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + chr(3868 - 3757) + chr(0b110011) + '\064' + chr(53), 46254 - 46246), ehT0Px3KOsy9(chr(1137 - 1089) + chr(2560 - 2449) + chr(225 - 176) + chr(52), 0o10), ehT0Px3KOsy9(chr(864 - 816) + chr(0b1101111) + chr(2067 - 2016) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(802 - 750) + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + chr(8530 - 8419) + chr(0b101111 + 0o3) + chr(0b1011 + 0o47) + chr(1170 - 1116), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(0b110011) + '\x37' + '\x32', 33195 - 33187), ehT0Px3KOsy9(chr(0b110000) + chr(1799 - 1688) + chr(2369 - 2318) + chr(0b100011 + 0o20) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(2269 - 2221) + chr(5685 - 5574) + chr(49) + chr(0b110000) + chr(2317 - 2268), 0o10), ehT0Px3KOsy9(chr(1072 - 1024) + chr(111) + '\x33' + chr(52 - 1) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + '\x33' + chr(1215 - 1167), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10111 + 0o130) + chr(1635 - 1586) + chr(0b11110 + 0o23) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2327 - 2278) + '\x31' + chr(3007 - 2952), 0b1000), ehT0Px3KOsy9('\x30' + chr(840 - 729) + '\065' + chr(0b100101 + 0o15), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1868 - 1817), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(51) + chr(0b11000 + 0o33) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(5031 - 4920) + chr(0b10110 + 0o34) + '\x35' + chr(0b100011 + 0o15), 0b1000), ehT0Px3KOsy9(chr(216 - 168) + chr(0b1000111 + 0o50) + '\061' + chr(2700 - 2648) + chr(0b100000 + 0o26), 57013 - 57005), ehT0Px3KOsy9(chr(147 - 99) + chr(4544 - 4433) + '\x37' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(3563 - 3452) + '\x31' + chr(49) + '\x31', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(1642 - 1589) + chr(1817 - 1762), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010001 + 0o36) + '\x32' + chr(53) + chr(0b10010 + 0o45), 0o10), ehT0Px3KOsy9('\060' + chr(8650 - 8539) + chr(1252 - 1201) + chr(49), 0b1000), ehT0Px3KOsy9(chr(671 - 623) + '\157' + chr(0b110010) + '\062' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(1824 - 1776) + chr(0b1101111) + chr(0b11110 + 0o24) + chr(0b110101) + '\067', 8), ehT0Px3KOsy9(chr(2071 - 2023) + '\157' + chr(0b110001) + chr(0b11100 + 0o24) + chr(0b101001 + 0o10), 8), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(625 - 571) + chr(0b101101 + 0o12), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1010 + 0o50) + '\x35' + '\x31', 19137 - 19129), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(51) + chr(625 - 573) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110100) + chr(2069 - 2014), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(2391 - 2280) + chr(0b10000 + 0o41) + '\067' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(1720 - 1670) + chr(0b100000 + 0o23) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010010 + 0o35) + chr(0b0 + 0o66) + chr(0b10101 + 0o42), 33005 - 32997), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(49) + chr(0b101101 + 0o7) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1326 - 1275) + chr(1629 - 1579) + '\067', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(372 - 324) + chr(111) + chr(0b110101) + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\157' + '\144' + '\145')(chr(117) + '\164' + chr(102) + chr(45) + chr(0b10001 + 0o47)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Ah4B9JD6usP0(vXoupepMtCXU, n4ljua2gi1Pr, r8knJmMTTKwv=(ehT0Px3KOsy9(chr(2036 - 1988) + chr(9871 - 9760) + '\x32', 31203 - 31195), ehT0Px3KOsy9(chr(1714 - 1666) + chr(0b1101111) + chr(2214 - 2164), 8)), m6gwVXy4D3Au=(ehT0Px3KOsy9(chr(1138 - 1090) + chr(0b1000110 + 0o51) + chr(51), 8), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(6142 - 6031) + chr(51), 8)), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8\xe8J\x8cm|\x89\xf3\xa5\xa9"\xb4w\xbd'), '\x64' + '\145' + chr(0b1011101 + 0o6) + '\157' + '\144' + '\x65')(chr(0b1110101) + chr(0b1110100) + '\146' + '\055' + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xe6U\x95~{\x96\xe5'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(111) + chr(0b1100100) + '\145')('\165' + chr(1210 - 1094) + chr(8357 - 8255) + chr(45) + chr(610 - 554))):
OeWW0F1dBPRQ = vXoupepMtCXU
for WVxHKyX45z_L in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x91\xf0\t\xb5u)\xb0\xd3\xc9\x95\n\x88'), chr(0b110001 + 0o63) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b1000001 + 0o64) + chr(10209 - 10093) + chr(1316 - 1214) + '\055' + chr(56))) // ehT0Px3KOsy9('\x30' + chr(0b10010 + 0o135) + chr(0b10010 + 0o40), 8)):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8\xe8J\x8cm|\x89\xf3\xa5\xa9"\xb4w\xbd'), chr(3883 - 3783) + chr(7611 - 7510) + chr(0b110101 + 0o56) + '\157' + '\x64' + chr(0b1100101))(chr(2245 - 2128) + chr(116) + chr(0b1001101 + 0o31) + chr(0b10111 + 0o26) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xe6U\x95~{\x96\xe5\xa5\xb9.\xb5q\x87l+'), chr(100) + chr(0b11001 + 0o114) + '\143' + '\157' + '\144' + '\x65')(chr(0b111 + 0o156) + chr(0b111000 + 0o74) + chr(0b1100110) + chr(0b101101) + '\x38') % WVxHKyX45z_L):
SqiSOtYOqOJH = jSKPaHwSAfVv.conv_block(jSKPaHwSAfVv.layer_norm(OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xa2\xe7W\x97a'), chr(8242 - 8142) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b111000))), n4ljua2gi1Pr.qzoyXN3kdhDL, dilation_rates_and_kernel_sizes=[((ehT0Px3KOsy9('\x30' + chr(5171 - 5060) + chr(674 - 625), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1775 - 1726), 8)), m6gwVXy4D3Au)], strides=r8knJmMTTKwv, padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\x9d\xc8u\xa0'), chr(100) + '\x65' + chr(0b100011 + 0o100) + chr(9671 - 9560) + '\x64' + chr(3438 - 3337))(chr(117) + chr(0b10010 + 0o142) + chr(8472 - 8370) + '\x2d' + chr(0b111000)), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xe6U\x95~{\x96\xe5\xa5\xb9.\xb5q\x87l+'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(0b1101001 + 0o6) + chr(0b110010 + 0o62) + chr(101))('\165' + '\164' + chr(6031 - 5929) + '\055' + chr(0b101001 + 0o17)) % WVxHKyX45z_L)
SqiSOtYOqOJH = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(SqiSOtYOqOJH, 1.0 - n4ljua2gi1Pr.ag0mwEgWzjYv)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xaa\xe6g\x86cs\x95\xe4\x9f\xa92\x84f\xac=*Do'), '\144' + chr(7801 - 7700) + '\143' + chr(0b111001 + 0o66) + '\144' + '\145')('\x75' + chr(0b1110100) + chr(8235 - 8133) + chr(0b100011 + 0o12) + chr(2717 - 2661))):
SqiSOtYOqOJH = ZDIIUJZ6Hwx4(OeWW0F1dBPRQ, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xe6U\x95~{\x96\xe5\xa5\xa9$\xb7a\xb9=;u.g'), chr(100) + '\x65' + '\143' + chr(0b1100111 + 0o10) + chr(0b110101 + 0o57) + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(2137 - 2035) + '\055' + chr(605 - 549)) % WVxHKyX45z_L)
SqiSOtYOqOJH += OeWW0F1dBPRQ
OeWW0F1dBPRQ = SqiSOtYOqOJH
OeWW0F1dBPRQ = CyB1qZHKH3CI(OeWW0F1dBPRQ, n4ljua2gi1Pr)
aGtbOvWfCD5N = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)
OeWW0F1dBPRQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, n4ljua2gi1Pr.num_latents * n4ljua2gi1Pr.qzoyXN3kdhDL, name=AIvJRzLdDfgF + xafqLlk3kkUe(SXOLrMavuUCe(b'\x91\xed]\x8b\x7f{'), chr(2988 - 2888) + '\x65' + '\143' + '\x6f' + chr(0b111011 + 0o51) + chr(2588 - 2487))(chr(117) + chr(116) + chr(0b1100110) + '\055' + chr(0b111000)))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc\xecK\x8dmn\x80'), '\x64' + chr(7422 - 7321) + chr(4513 - 4414) + chr(11698 - 11587) + chr(100) + chr(0b1100101))(chr(117) + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000)))(OeWW0F1dBPRQ, [aGtbOvWfCD5N[ehT0Px3KOsy9(chr(48) + chr(0b100110 + 0o111) + chr(1434 - 1386), 0b1000)], aGtbOvWfCD5N[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2399 - 2350), 8)] * aGtbOvWfCD5N[ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(50), 8)] * xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0\xfcU\xba`\x7f\x91\xf3\x94\xae2'), chr(9399 - 9299) + '\145' + chr(5873 - 5774) + '\157' + chr(100) + chr(0b1100101))(chr(6770 - 6653) + chr(10056 - 9940) + '\x66' + '\055' + chr(1725 - 1669))), xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf\xf3W\x9cTP\xd6\xfd\x9e\xb2\x05\x97'), chr(100) + '\x65' + chr(0b1100011) + chr(111) + chr(100) + chr(0b101011 + 0o72))('\165' + '\164' + chr(5077 - 4975) + '\x2d' + chr(56)))])
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
compress_encoder_2d
|
def compress_encoder_2d(x, hparams, name=None):
"""Encoder that compresses 2-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, height, width, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * (height*width) / 2**(hparams.num_compress_steps).
"""
return compress_encoder(
x,
hparams,
strides=(2, 2),
kernel_size=(hparams.kernel_size, hparams.kernel_size),
name=name)
|
python
|
def compress_encoder_2d(x, hparams, name=None):
"""Encoder that compresses 2-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, height, width, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * (height*width) / 2**(hparams.num_compress_steps).
"""
return compress_encoder(
x,
hparams,
strides=(2, 2),
kernel_size=(hparams.kernel_size, hparams.kernel_size),
name=name)
|
[
"def",
"compress_encoder_2d",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"return",
"compress_encoder",
"(",
"x",
",",
"hparams",
",",
"strides",
"=",
"(",
"2",
",",
"2",
")",
",",
"kernel_size",
"=",
"(",
"hparams",
".",
"kernel_size",
",",
"hparams",
".",
"kernel_size",
")",
",",
"name",
"=",
"name",
")"
] |
Encoder that compresses 2-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, height, width, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * (height*width) / 2**(hparams.num_compress_steps).
|
[
"Encoder",
"that",
"compresses",
"2",
"-",
"D",
"inputs",
"by",
"2",
"**",
"num_compress_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L273-L291
|
train
|
Encoder that compresses 2 - D inputs by 2 ** num_compress_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,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRM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lqIvNSaRMa,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(0b1000111 + 0o50) + chr(0b110010) + chr(0b110010 + 0o0) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11110 + 0o25) + chr(0b11110 + 0o30), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b100100 + 0o113) + chr(1648 - 1597) + chr(49) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(2104 - 2054) + chr(1749 - 1697) + chr(0b101011 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(52) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(428 - 317) + chr(0b110011) + chr(0b110111) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(10125 - 10014) + chr(2199 - 2149) + chr(1909 - 1860) + chr(54), 0o10), ehT0Px3KOsy9(chr(2263 - 2215) + '\157' + chr(50) + '\x33' + '\066', 41442 - 41434), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(55) + '\x30', 19220 - 19212), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\066', 0b1000), ehT0Px3KOsy9(chr(1590 - 1542) + chr(8359 - 8248) + chr(0b10100 + 0o35) + '\065' + chr(1869 - 1818), 0o10), ehT0Px3KOsy9(chr(1728 - 1680) + chr(0b1101111) + chr(2341 - 2290) + chr(0b11001 + 0o31) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101 + 0o56) + '\x36' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + '\x37' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + '\x33' + '\x33' + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10 + 0o61) + chr(0b110000), 19781 - 19773), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(0b110001) + '\066' + chr(1506 - 1456), 19450 - 19442), ehT0Px3KOsy9(chr(48) + chr(4605 - 4494) + chr(49) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(294 - 245), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b11101 + 0o122) + chr(52) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1451 - 1403) + chr(0b11111 + 0o120) + '\061' + '\x37' + chr(1427 - 1372), 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(11370 - 11259) + chr(0b10001 + 0o43), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1042 - 992) + '\x32' + chr(0b10000 + 0o41), 20903 - 20895), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(0b110110) + chr(1390 - 1337), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7704 - 7593) + '\x35' + chr(1257 - 1203), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\062' + chr(49), 6633 - 6625), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b10100 + 0o133) + chr(0b11100 + 0o25) + chr(576 - 528) + chr(0b10011 + 0o35), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5316 - 5205) + chr(0b111 + 0o55) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110000 + 0o3) + chr(0b10101 + 0o41) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b11010 + 0o30) + chr(0b101000 + 0o14), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x34' + '\067', 8), ehT0Px3KOsy9(chr(48) + chr(0b1000110 + 0o51) + '\x33' + '\063', 11795 - 11787), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(3037 - 2926) + chr(1246 - 1196) + chr(53) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + '\064' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9747 - 9636) + '\062' + '\x33' + '\063', 61779 - 61771), ehT0Px3KOsy9(chr(1129 - 1081) + '\x6f' + '\062' + '\066' + '\063', 6140 - 6132), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(10089 - 9978) + chr(0b110010) + chr(0b11010 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(1202 - 1150) + chr(1290 - 1240), 33280 - 33272), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(0b1 + 0o60) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b1010 + 0o55) + chr(443 - 394), 38517 - 38509)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\065' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xba'), chr(0b1001001 + 0o33) + chr(0b1001 + 0o134) + chr(0b1100011) + chr(0b110 + 0o151) + chr(0b1001111 + 0o25) + '\145')(chr(0b111100 + 0o71) + chr(116) + chr(7230 - 7128) + chr(0b100101 + 0o10) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ZnOJveFOXTB3(OeWW0F1dBPRQ, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
return Ah4B9JD6usP0(OeWW0F1dBPRQ, n4ljua2gi1Pr, strides=(ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000 + 0o2), 15508 - 15500), ehT0Px3KOsy9(chr(0b110000) + chr(434 - 323) + chr(0b10111 + 0o33), 8)), kernel_size=(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xff{\xb8\xcbD\x90\xd1\xed\x11|\x0e'), chr(0b1011101 + 0o7) + chr(0b1110 + 0o127) + '\x63' + '\x6f' + '\x64' + '\x65')(chr(117) + chr(116) + chr(3941 - 3839) + '\055' + '\070')), xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xff{\xb8\xcbD\x90\xd1\xed\x11|\x0e'), '\144' + '\x65' + '\143' + '\x6f' + chr(100) + chr(101))(chr(0b100000 + 0o125) + chr(1469 - 1353) + '\x66' + '\x2d' + chr(0b100110 + 0o22)))), name=AIvJRzLdDfgF)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
compress_encoder_1d
|
def compress_encoder_1d(x, hparams, name=None):
"""Encoder that compresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * length / 2**hparams.num_compress_steps.
"""
x = tf.expand_dims(x, axis=2)
return compress_encoder(x,
hparams,
strides=(2, 1),
kernel_size=(hparams.kernel_size, 1),
name=name)
|
python
|
def compress_encoder_1d(x, hparams, name=None):
"""Encoder that compresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * length / 2**hparams.num_compress_steps.
"""
x = tf.expand_dims(x, axis=2)
return compress_encoder(x,
hparams,
strides=(2, 1),
kernel_size=(hparams.kernel_size, 1),
name=name)
|
[
"def",
"compress_encoder_1d",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"x",
"=",
"tf",
".",
"expand_dims",
"(",
"x",
",",
"axis",
"=",
"2",
")",
"return",
"compress_encoder",
"(",
"x",
",",
"hparams",
",",
"strides",
"=",
"(",
"2",
",",
"1",
")",
",",
"kernel_size",
"=",
"(",
"hparams",
".",
"kernel_size",
",",
"1",
")",
",",
"name",
"=",
"name",
")"
] |
Encoder that compresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, latent_length, hparams.hidden_size], where
latent_length is
hparams.num_latents * length / 2**hparams.num_compress_steps.
|
[
"Encoder",
"that",
"compresses",
"1",
"-",
"D",
"inputs",
"by",
"2",
"**",
"num_compress_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L294-L312
|
train
|
Encoder that compresses 1 - D inputs by 2 ** num_compress_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,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ZO3Ma9cXBb,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(0b101010 + 0o105) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1000010 + 0o55) + chr(0b110010) + chr(52) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11 + 0o56) + chr(0b101010 + 0o7), 45460 - 45452), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010 + 0o0) + '\060' + chr(55), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9848 - 9737) + chr(1090 - 1041) + chr(0b110111) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11001 + 0o31) + chr(0b10100 + 0o41) + chr(2400 - 2351), 38026 - 38018), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b0 + 0o61) + chr(670 - 616), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + '\061' + chr(0b110011 + 0o1) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b11010 + 0o35) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010 + 0o145) + chr(0b1011 + 0o46) + chr(0b110000), 51599 - 51591), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + chr(51) + chr(49), 20330 - 20322), ehT0Px3KOsy9(chr(818 - 770) + chr(111) + '\x31' + chr(0b100 + 0o56) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2220 - 2109) + '\x32' + chr(50), 25621 - 25613), ehT0Px3KOsy9('\060' + chr(9189 - 9078) + chr(1372 - 1321) + '\x34' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(1941 - 1890) + chr(53) + '\x37', 64330 - 64322), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b110010) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(355 - 306) + '\x36' + chr(0b11010 + 0o30), 29475 - 29467), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + '\067' + chr(50), 14186 - 14178), ehT0Px3KOsy9(chr(1071 - 1023) + chr(4609 - 4498) + '\x32' + '\066' + chr(0b101100 + 0o13), 0o10), ehT0Px3KOsy9(chr(462 - 414) + chr(111) + chr(0b110101) + '\x36', 0b1000), ehT0Px3KOsy9(chr(2217 - 2169) + '\x6f' + '\x31' + '\061' + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101101 + 0o102) + chr(0b110110) + '\061', 21640 - 21632), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(9804 - 9693) + chr(527 - 476) + chr(0b110011) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + '\x31' + chr(0b110101 + 0o1) + '\062', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b110101 + 0o72) + chr(0b110001) + chr(0b110001), 8), ehT0Px3KOsy9('\060' + chr(0b1010101 + 0o32) + '\x36' + '\x31', 8), ehT0Px3KOsy9('\x30' + chr(194 - 83) + chr(1438 - 1387) + chr(1970 - 1917), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1011 + 0o46) + chr(55) + chr(1107 - 1052), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(352 - 303) + '\067' + '\061', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100111 + 0o10) + '\x33' + chr(0b110001) + chr(0b110110), 25476 - 25468), ehT0Px3KOsy9(chr(1272 - 1224) + chr(111) + chr(0b1011 + 0o47) + chr(0b110101) + chr(0b110011 + 0o0), 36665 - 36657), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + chr(49) + chr(0b110100) + chr(49), 8), ehT0Px3KOsy9(chr(189 - 141) + '\x6f' + chr(0b100000 + 0o24) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(0b110010) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011011 + 0o24) + chr(0b101000 + 0o15) + '\066', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(419 - 366) + '\063', 0o10), ehT0Px3KOsy9(chr(1316 - 1268) + '\157' + chr(2684 - 2629) + chr(0b110100), 36371 - 36363), ehT0Px3KOsy9('\060' + chr(0b100101 + 0o112) + chr(0b11001 + 0o31) + chr(0b11110 + 0o22) + chr(52), 0o10), ehT0Px3KOsy9(chr(355 - 307) + '\x6f' + chr(0b101011 + 0o10) + chr(0b110111) + chr(2472 - 2420), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11111 + 0o26) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'('), chr(5555 - 5455) + chr(7186 - 7085) + chr(0b1100011) + '\x6f' + '\144' + '\x65')(chr(1953 - 1836) + chr(0b1101111 + 0o5) + '\x66' + chr(437 - 392) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def N_VqrHdKcT4Y(OeWW0F1dBPRQ, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.expand_dims(OeWW0F1dBPRQ, axis=ehT0Px3KOsy9(chr(48) + chr(111) + chr(2347 - 2297), 8))
return Ah4B9JD6usP0(OeWW0F1dBPRQ, n4ljua2gi1Pr, strides=(ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50), 8), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + chr(0b11 + 0o56), 0o10)), kernel_size=(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'm\xc4{\xe9\x1c\xc5\xd1\x12\xd5r|'), '\144' + '\x65' + chr(0b1100011) + chr(6538 - 6427) + chr(409 - 309) + '\x65')(chr(0b1011 + 0o152) + chr(116) + chr(102) + '\x2d' + '\070')), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(12010 - 11899) + chr(0b110001), 8)), name=AIvJRzLdDfgF)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
decompress_decoder
|
def decompress_decoder(inputs,
hparams,
strides=(2, 2),
kernel=(3, 3),
name=None):
"""Decoder that decompresses 2-D inputs by 2**num_compress_steps.
Args:
inputs: Tensor of shape [batch, compress_height, compress_width, channels].
hparams: HParams.
strides: Tuple, strides for conv block.
kernel: Tuple, kernel window size for conv block.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
"""
with tf.variable_scope(name, default_name="decompress"):
x = inputs
x = tf.layers.dense(x, hparams.hidden_size, name=name + "_dense")
x = residual_block_layer(x, hparams)
for i in range(hparams.num_compress_steps // 2):
j = hparams.num_compress_steps // 2 - i - 1
with tf.variable_scope(name + "_%d" % j):
if hparams.do_decompress_attend:
y = compress_self_attention_layer(
x, hparams, name="decompress_selfatt")
x += y
y = tf.layers.conv2d_transpose(
x,
hparams.hidden_size,
kernel,
strides=strides,
padding="SAME",
activation=tf.nn.relu if i > 0 else None,
name="decompress_conv")
x = y
return x
|
python
|
def decompress_decoder(inputs,
hparams,
strides=(2, 2),
kernel=(3, 3),
name=None):
"""Decoder that decompresses 2-D inputs by 2**num_compress_steps.
Args:
inputs: Tensor of shape [batch, compress_height, compress_width, channels].
hparams: HParams.
strides: Tuple, strides for conv block.
kernel: Tuple, kernel window size for conv block.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
"""
with tf.variable_scope(name, default_name="decompress"):
x = inputs
x = tf.layers.dense(x, hparams.hidden_size, name=name + "_dense")
x = residual_block_layer(x, hparams)
for i in range(hparams.num_compress_steps // 2):
j = hparams.num_compress_steps // 2 - i - 1
with tf.variable_scope(name + "_%d" % j):
if hparams.do_decompress_attend:
y = compress_self_attention_layer(
x, hparams, name="decompress_selfatt")
x += y
y = tf.layers.conv2d_transpose(
x,
hparams.hidden_size,
kernel,
strides=strides,
padding="SAME",
activation=tf.nn.relu if i > 0 else None,
name="decompress_conv")
x = y
return x
|
[
"def",
"decompress_decoder",
"(",
"inputs",
",",
"hparams",
",",
"strides",
"=",
"(",
"2",
",",
"2",
")",
",",
"kernel",
"=",
"(",
"3",
",",
"3",
")",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"decompress\"",
")",
":",
"x",
"=",
"inputs",
"x",
"=",
"tf",
".",
"layers",
".",
"dense",
"(",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"name",
"=",
"name",
"+",
"\"_dense\"",
")",
"x",
"=",
"residual_block_layer",
"(",
"x",
",",
"hparams",
")",
"for",
"i",
"in",
"range",
"(",
"hparams",
".",
"num_compress_steps",
"//",
"2",
")",
":",
"j",
"=",
"hparams",
".",
"num_compress_steps",
"//",
"2",
"-",
"i",
"-",
"1",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
"+",
"\"_%d\"",
"%",
"j",
")",
":",
"if",
"hparams",
".",
"do_decompress_attend",
":",
"y",
"=",
"compress_self_attention_layer",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"\"decompress_selfatt\"",
")",
"x",
"+=",
"y",
"y",
"=",
"tf",
".",
"layers",
".",
"conv2d_transpose",
"(",
"x",
",",
"hparams",
".",
"hidden_size",
",",
"kernel",
",",
"strides",
"=",
"strides",
",",
"padding",
"=",
"\"SAME\"",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
"if",
"i",
">",
"0",
"else",
"None",
",",
"name",
"=",
"\"decompress_conv\"",
")",
"x",
"=",
"y",
"return",
"x"
] |
Decoder that decompresses 2-D inputs by 2**num_compress_steps.
Args:
inputs: Tensor of shape [batch, compress_height, compress_width, channels].
hparams: HParams.
strides: Tuple, strides for conv block.
kernel: Tuple, kernel window size for conv block.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
|
[
"Decoder",
"that",
"decompresses",
"2",
"-",
"D",
"inputs",
"by",
"2",
"**",
"num_compress_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L315-L352
|
train
|
Decoder that decompresses 2 - D inputs by 2 ** num_compress_steps.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQe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zvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(10815 - 10704) + chr(51) + chr(51) + chr(0b101100 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + chr(7683 - 7572) + chr(1686 - 1637) + '\x30' + chr(2311 - 2261), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + chr(0b110001) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(836 - 788) + chr(4935 - 4824) + chr(49) + chr(0b10000 + 0o42) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10010 + 0o41) + chr(0b110100) + '\066', 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\x6f' + chr(2421 - 2370) + '\x30' + '\061', 12948 - 12940), ehT0Px3KOsy9(chr(48) + chr(11981 - 11870) + chr(0b10000 + 0o43), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1313 - 1264) + '\067' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1100010 + 0o15) + chr(0b110000 + 0o1) + chr(0b11110 + 0o24) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b110011) + chr(0b111 + 0o56), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(483 - 433) + chr(0b11001 + 0o33) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + '\061' + chr(0b110010) + '\x35', 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + '\062' + '\x34' + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(54) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(351 - 300) + '\x36' + chr(1597 - 1543), ord("\x08")), ehT0Px3KOsy9(chr(587 - 539) + chr(0b1101111) + chr(105 - 56) + chr(425 - 372) + chr(53), 23495 - 23487), ehT0Px3KOsy9(chr(48) + chr(0b101110 + 0o101) + '\062' + chr(0b110011) + chr(1079 - 1026), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(183 - 130) + chr(0b110111), 20666 - 20658), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\x32' + '\x33', 64643 - 64635), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(0b110010) + chr(53) + chr(2642 - 2587), 11409 - 11401), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(463 - 414) + chr(0b11011 + 0o27) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\061' + chr(1819 - 1768), 0b1000), ehT0Px3KOsy9('\060' + chr(9418 - 9307) + chr(0b101010 + 0o10) + '\060' + chr(0b101 + 0o54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7481 - 7370) + chr(0b1111 + 0o44) + '\x34' + chr(747 - 697), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2680 - 2628), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\x6f' + chr(0b10010 + 0o41) + chr(0b11 + 0o63) + chr(2463 - 2411), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1010 + 0o51) + chr(2313 - 2258) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b101001 + 0o106) + chr(0b11110 + 0o23) + chr(0b100 + 0o57) + chr(125 - 70), 0o10), ehT0Px3KOsy9(chr(2200 - 2152) + chr(0b1101111) + '\x33' + '\x37' + chr(0b110001), 63935 - 63927), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(7200 - 7089) + chr(0b10101 + 0o36) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b101011 + 0o7) + chr(54) + '\061', 65508 - 65500), ehT0Px3KOsy9(chr(0b110000) + chr(6550 - 6439) + '\062' + chr(55) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1768 - 1718) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(49) + '\065' + chr(0b110011), 25015 - 25007), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(5344 - 5233) + chr(0b110011) + chr(2710 - 2657) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\066' + chr(1796 - 1745), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + '\061' + '\x32' + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11111 + 0o30) + chr(1847 - 1798), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf4'), chr(7400 - 7300) + chr(4318 - 4217) + '\143' + '\157' + '\x64' + chr(0b10111 + 0o116))(chr(0b1000011 + 0o62) + '\164' + chr(0b1100110) + chr(0b11111 + 0o16) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def KJtx70IyQTCL(vXoupepMtCXU, n4ljua2gi1Pr, r8knJmMTTKwv=(ehT0Px3KOsy9(chr(1188 - 1140) + chr(2030 - 1919) + chr(672 - 622), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062', 8)), iaILEoszmqXb=(ehT0Px3KOsy9(chr(1607 - 1559) + chr(0b11010 + 0o125) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063', 8)), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xac#x8\x87\xa3o\x18\n\xee\xc6:\xd1\x90'), chr(0b1100100) + '\145' + '\x63' + chr(0b1101111) + '\144' + chr(605 - 504))(chr(0b100010 + 0o123) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xbe'i>\x8b\xb1q\x18&\xee"), chr(0b1001111 + 0o25) + chr(101) + chr(0b1100011) + chr(0b11101 + 0o122) + chr(100) + chr(101))(chr(4561 - 4444) + '\164' + chr(0b1100110) + chr(0b101101) + '\x38')):
OeWW0F1dBPRQ = vXoupepMtCXU
OeWW0F1dBPRQ = IDJ2eXGCBCDu.layers.dense(OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, name=AIvJRzLdDfgF + xafqLlk3kkUe(SXOLrMavuUCe(b'\x85&o?\x95\xa4'), chr(100) + chr(0b110000 + 0o65) + chr(99) + chr(2155 - 2044) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(10877 - 10761) + '\x66' + '\x2d' + chr(2515 - 2459)))
OeWW0F1dBPRQ = CyB1qZHKH3CI(OeWW0F1dBPRQ, n4ljua2gi1Pr)
for WVxHKyX45z_L in vQr8gNKaIaWE(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x85;;\x01\x9f\xf6V8f\xd2\xee\x06'), chr(0b1100100) + '\x65' + '\x63' + chr(111) + '\x64' + '\x65')(chr(0b1110101) + chr(0b110 + 0o156) + '\146' + '\055' + chr(56))) // ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + chr(0b110010), 8)):
tlORBuYsiw3X = n4ljua2gi1Pr._y1Py7UE3OKS // ehT0Px3KOsy9('\x30' + '\157' + chr(1245 - 1195), 8) - WVxHKyX45z_L - ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), ord("\x08"))
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xac#x8\x87\xa3o\x18\n\xee\xc6:\xd1\x90'), chr(0b1100100) + '\x65' + chr(99) + '\x6f' + chr(0b101010 + 0o72) + chr(0b111 + 0o136))(chr(5338 - 5221) + '\x74' + '\146' + chr(1713 - 1668) + chr(0b111000 + 0o0)))(AIvJRzLdDfgF + xafqLlk3kkUe(SXOLrMavuUCe(b'\x85gn'), '\x64' + chr(8296 - 8195) + chr(0b1001101 + 0o26) + chr(0b1010 + 0o145) + chr(100) + chr(8065 - 7964))(chr(0b1100101 + 0o20) + '\x74' + chr(0b101100 + 0o72) + chr(45) + chr(767 - 711)) % tlORBuYsiw3X):
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe-U5\x83\xa2l\x10%\xef\xc0&\xd2\xaa\x97\x19\xe9J\xbdc'), chr(0b1010011 + 0o21) + chr(0b101011 + 0o72) + chr(0b1001101 + 0o26) + '\157' + chr(9766 - 9666) + '\x65')(chr(9551 - 9434) + '\164' + chr(0b1011000 + 0o16) + '\055' + chr(2333 - 2277))):
SqiSOtYOqOJH = ZDIIUJZ6Hwx4(OeWW0F1dBPRQ, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xbe'i>\x8b\xb1q\x18&\xee\xfa&\xc4\x99\x90\x0c\xe9["), chr(449 - 349) + chr(8102 - 8001) + chr(0b1100011) + chr(6493 - 6382) + chr(6450 - 6350) + chr(101))(chr(0b1110101) + chr(116) + '\146' + '\055' + '\x38'))
OeWW0F1dBPRQ += SqiSOtYOqOJH
SqiSOtYOqOJH = IDJ2eXGCBCDu.layers.conv2d_transpose(OeWW0F1dBPRQ, n4ljua2gi1Pr.qzoyXN3kdhDL, iaILEoszmqXb, strides=r8knJmMTTKwv, padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\x89\x03G\x14'), '\144' + chr(101) + '\143' + chr(4391 - 4280) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(0b110000 + 0o104) + chr(0b101101 + 0o71) + chr(0b101101) + '\x38'), activation=IDJ2eXGCBCDu.nn.relu if WVxHKyX45z_L > ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b0 + 0o60), 61642 - 61634) else None, name=xafqLlk3kkUe(SXOLrMavuUCe(b"\xbe'i>\x8b\xb1q\x18&\xee\xfa6\xce\x9b\x80"), '\144' + chr(101) + '\143' + chr(0b1000 + 0o147) + '\144' + chr(0b1011000 + 0o15))(chr(0b1110101) + chr(0b1110100) + chr(0b1100011 + 0o3) + '\055' + chr(56)))
OeWW0F1dBPRQ = SqiSOtYOqOJH
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
decompress_decoder_2d
|
def decompress_decoder_2d(x, hparams, name=None):
"""Decoder that decompresses 2-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_height, compress_width, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
"""
return decompress_decoder(x, hparams,
strides=(2, 2),
kernel=(hparams.kernel_size, hparams.kernel_size),
name=name)
|
python
|
def decompress_decoder_2d(x, hparams, name=None):
"""Decoder that decompresses 2-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_height, compress_width, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
"""
return decompress_decoder(x, hparams,
strides=(2, 2),
kernel=(hparams.kernel_size, hparams.kernel_size),
name=name)
|
[
"def",
"decompress_decoder_2d",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"return",
"decompress_decoder",
"(",
"x",
",",
"hparams",
",",
"strides",
"=",
"(",
"2",
",",
"2",
")",
",",
"kernel",
"=",
"(",
"hparams",
".",
"kernel_size",
",",
"hparams",
".",
"kernel_size",
")",
",",
"name",
"=",
"name",
")"
] |
Decoder that decompresses 2-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_height, compress_width, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width, hparams.hidden_size].
|
[
"Decoder",
"that",
"decompresses",
"2",
"-",
"D",
"inputs",
"by",
"2",
"**",
"num_compress_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L355-L369
|
train
|
Decoder that decompresses 2 - D inputs by 2 ** num_compress_steps.
|
Pu7Z6IJCg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qKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,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(2385 - 2274) + chr(0b110001) + chr(0b100101 + 0o17) + chr(0b10011 + 0o37), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b10011 + 0o134) + chr(0b110001) + chr(54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1001100 + 0o43) + '\067' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(572 - 524) + chr(0b1000010 + 0o55) + chr(319 - 270) + chr(0b110 + 0o55), 23573 - 23565), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2433 - 2383) + '\x35' + chr(633 - 582), 5181 - 5173), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\062' + chr(0b111 + 0o53), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b10011 + 0o44) + '\x35', 9319 - 9311), ehT0Px3KOsy9(chr(718 - 670) + chr(0b1101111) + '\063' + '\x37' + chr(0b11010 + 0o26), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b110011) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10011 + 0o36) + chr(0b110111) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(0b110110) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000110 + 0o51) + chr(0b110001) + chr(0b10100 + 0o41) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b10100 + 0o37) + chr(0b110100), 7459 - 7451), ehT0Px3KOsy9(chr(48) + chr(1463 - 1352) + '\063' + chr(0b101101 + 0o5) + '\x35', 33600 - 33592), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(642 - 591) + '\062', 49023 - 49015), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + chr(0b110101) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7721 - 7610) + '\063' + chr(0b10010 + 0o42) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011100 + 0o23) + chr(0b10101 + 0o35) + chr(49) + chr(0b11111 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111110 + 0o61) + '\x33' + '\065' + chr(532 - 484), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(611 - 562) + chr(0b110010) + chr(0b1110 + 0o44), 8), ehT0Px3KOsy9(chr(1536 - 1488) + '\x6f' + '\x31' + chr(0b100101 + 0o16) + '\x31', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(419 - 368) + chr(0b1001 + 0o50) + chr(0b110110), 15427 - 15419), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b1110 + 0o47) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1953 - 1902) + chr(0b100110 + 0o14) + chr(0b110101), 8), ehT0Px3KOsy9(chr(1496 - 1448) + chr(0b1001010 + 0o45) + '\061' + chr(1640 - 1590) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(0b11100 + 0o32) + chr(0b10 + 0o64), 5871 - 5863), ehT0Px3KOsy9(chr(699 - 651) + chr(111) + chr(901 - 852) + '\061' + chr(50), 0o10), ehT0Px3KOsy9(chr(974 - 926) + chr(12189 - 12078) + '\061' + chr(0b10111 + 0o40) + '\x32', 12363 - 12355), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + '\063' + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(7885 - 7774) + chr(0b110001) + chr(0b110100) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101 + 0o142) + chr(0b101101 + 0o6) + '\x37' + chr(1673 - 1619), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b110010 + 0o0) + chr(0b1100 + 0o51), 0o10), ehT0Px3KOsy9(chr(91 - 43) + '\157' + '\x31' + '\063' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(161 - 113) + chr(111) + '\061' + chr(0b100001 + 0o23) + '\x30', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100011 + 0o22) + chr(0b1000 + 0o55), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11010 + 0o35) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(0b110010) + '\066' + '\060', 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(51) + chr(52) + chr(0b1111 + 0o50), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110011) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(53) + '\060', 41110 - 41102)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + chr(230 - 182), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'L'), chr(0b1100100) + chr(6142 - 6041) + '\x63' + chr(0b1101111) + chr(2995 - 2895) + chr(101))('\165' + chr(0b1001001 + 0o53) + chr(887 - 785) + chr(635 - 590) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def x52_BhUndKfR(OeWW0F1dBPRQ, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
return KJtx70IyQTCL(OeWW0F1dBPRQ, n4ljua2gi1Pr, strides=(ehT0Px3KOsy9(chr(305 - 257) + chr(0b101 + 0o152) + chr(0b110010), 23801 - 23793), ehT0Px3KOsy9('\x30' + '\157' + chr(50), 8)), kernel=(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\x11Me\xce>\xa2\x8b\xf3\x02\xd4'), chr(100) + chr(0b1100101) + '\x63' + '\157' + '\144' + chr(0b10000 + 0o125))(chr(9349 - 9232) + '\164' + chr(0b1011011 + 0o13) + '\x2d' + '\070')), xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\x11Me\xce>\xa2\x8b\xf3\x02\xd4'), chr(7844 - 7744) + chr(0b1100101) + '\x63' + chr(111) + chr(1856 - 1756) + '\x65')(chr(0b111110 + 0o67) + chr(116) + '\146' + chr(738 - 693) + chr(648 - 592)))), name=AIvJRzLdDfgF)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
decompress_decoder_1d
|
def decompress_decoder_1d(x, hparams, name=None):
"""Decoder that decompresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length, hparams.hidden_size].
"""
x = tf.expand_dims(x, axis=2)
output = decompress_decoder(x, hparams,
strides=(2, 1),
kernel=(hparams.kernel_size, 1),
name=name)
return tf.squeeze(output, axis=2)
|
python
|
def decompress_decoder_1d(x, hparams, name=None):
"""Decoder that decompresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length, hparams.hidden_size].
"""
x = tf.expand_dims(x, axis=2)
output = decompress_decoder(x, hparams,
strides=(2, 1),
kernel=(hparams.kernel_size, 1),
name=name)
return tf.squeeze(output, axis=2)
|
[
"def",
"decompress_decoder_1d",
"(",
"x",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"x",
"=",
"tf",
".",
"expand_dims",
"(",
"x",
",",
"axis",
"=",
"2",
")",
"output",
"=",
"decompress_decoder",
"(",
"x",
",",
"hparams",
",",
"strides",
"=",
"(",
"2",
",",
"1",
")",
",",
"kernel",
"=",
"(",
"hparams",
".",
"kernel_size",
",",
"1",
")",
",",
"name",
"=",
"name",
")",
"return",
"tf",
".",
"squeeze",
"(",
"output",
",",
"axis",
"=",
"2",
")"
] |
Decoder that decompresses 1-D inputs by 2**num_compress_steps.
Args:
x: Tensor of shape [batch, compress_length, channels].
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length, hparams.hidden_size].
|
[
"Decoder",
"that",
"decompresses",
"1",
"-",
"D",
"inputs",
"by",
"2",
"**",
"num_compress_steps",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L372-L388
|
train
|
Decoder that decompresses 1 - D inputs by 2 ** num_compress_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,koCeDP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jyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + chr(2452 - 2402) + chr(1100 - 1048), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(2393 - 2342) + chr(0b0 + 0o60) + chr(53), 39961 - 39953), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b100 + 0o63) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(2537 - 2426) + chr(0b110011) + chr(0b10110 + 0o36) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + '\063' + chr(671 - 619), 54547 - 54539), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(0b101000 + 0o15) + chr(0b11110 + 0o25), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110111) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34' + chr(0b100001 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(51) + '\x35' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10511 - 10400) + chr(0b110001) + chr(51) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1100111 + 0o10) + '\063' + '\060' + chr(723 - 672), 25828 - 25820), ehT0Px3KOsy9(chr(156 - 108) + chr(0b1101110 + 0o1) + '\062' + chr(0b110100) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(11778 - 11667) + chr(1695 - 1645) + '\064' + chr(0b11111 + 0o21), 43950 - 43942), ehT0Px3KOsy9(chr(343 - 295) + chr(1482 - 1371) + chr(49) + '\067' + chr(0b101011 + 0o7), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10100 + 0o37) + chr(51) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(172 - 122) + '\x35' + chr(52), 0b1000), ehT0Px3KOsy9(chr(1257 - 1209) + chr(178 - 67) + chr(2207 - 2157) + chr(0b110111) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1404 - 1356) + chr(111) + chr(0b101111 + 0o3) + chr(0b110001) + chr(0b10100 + 0o40), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(797 - 686) + '\063' + chr(2091 - 2041) + chr(814 - 763), 35502 - 35494), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(2300 - 2252) + chr(111) + chr(0b101111 + 0o3) + chr(0b110100), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(885 - 836) + chr(1195 - 1143) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(2199 - 2151) + '\x6f' + chr(0b110010) + chr(0b1001 + 0o56) + chr(0b11110 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(2134 - 2086) + '\x6f' + chr(1343 - 1289) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(583 - 528) + chr(0b0 + 0o63), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\067' + chr(50), 47707 - 47699), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101100 + 0o6) + '\x33' + chr(1826 - 1774), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b111110 + 0o61) + chr(0b110101) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(2799 - 2746), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(5501 - 5390) + '\061' + chr(53) + chr(2033 - 1981), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + chr(0b101010 + 0o11) + chr(1467 - 1414) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110011) + chr(52), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11100 + 0o123) + '\x33' + chr(53) + chr(0b101000 + 0o12), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\061' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(319 - 271) + '\157' + chr(0b101000 + 0o13) + chr(55) + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11110 + 0o25) + chr(0b101011 + 0o11) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1370 - 1320) + chr(2444 - 2393), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001011 + 0o44) + chr(0b11001 + 0o31) + '\x32' + chr(1509 - 1458), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(463 - 415) + chr(0b10010 + 0o135) + '\x35' + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b':'), '\144' + chr(101) + '\143' + '\157' + chr(0b101110 + 0o66) + '\145')(chr(117) + chr(7651 - 7535) + chr(102) + chr(1724 - 1679) + chr(0b101001 + 0o17)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RS9MCK0YN2HI(OeWW0F1dBPRQ, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
OeWW0F1dBPRQ = IDJ2eXGCBCDu.expand_dims(OeWW0F1dBPRQ, axis=ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101001 + 0o11), 0b1000))
e1jVqMSBZ01Y = KJtx70IyQTCL(OeWW0F1dBPRQ, n4ljua2gi1Pr, strides=(ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010), 8), ehT0Px3KOsy9(chr(1536 - 1488) + chr(0b1101111) + chr(49), 28414 - 28406)), kernel=(n4ljua2gi1Pr.kernel_size, ehT0Px3KOsy9(chr(1085 - 1037) + chr(0b1101111) + chr(49), 8)), name=AIvJRzLdDfgF)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'g\xb4\x8e\x82yQ\x1a'), chr(0b1100100) + chr(0b1000 + 0o135) + chr(0b1001010 + 0o31) + chr(0b111110 + 0o61) + chr(100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(299 - 254) + chr(2837 - 2781)))(e1jVqMSBZ01Y, axis=ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + '\062', 8))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
transformer_text_encoder
|
def transformer_text_encoder(inputs,
target_space,
hparams,
name=None):
"""Transformer text encoder over inputs with unmasked full attention.
Args:
inputs: Tensor of shape [batch, length, 1, hparams.hidden_size].
target_space: int. Used for encoding inputs under a target space id.
hparams: HParams.
name: string, variable scope.
Returns:
encoder_output: Tensor of shape [batch, length, hparams.hidden_size].
ed: Tensor of shape [batch, 1, 1, length]. Encoder-decoder attention bias
for any padded tokens.
"""
with tf.variable_scope(name, default_name="transformer_text_encoder"):
inputs = common_layers.flatten4d3d(inputs)
[
encoder_input,
encoder_self_attention_bias,
ed,
] = transformer_layers.transformer_prepare_encoder(
inputs, target_space=target_space, hparams=hparams)
encoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.dropout)
encoder_output = transformer_layers.transformer_encoder(
encoder_input, encoder_self_attention_bias, hparams)
return encoder_output, ed
|
python
|
def transformer_text_encoder(inputs,
target_space,
hparams,
name=None):
"""Transformer text encoder over inputs with unmasked full attention.
Args:
inputs: Tensor of shape [batch, length, 1, hparams.hidden_size].
target_space: int. Used for encoding inputs under a target space id.
hparams: HParams.
name: string, variable scope.
Returns:
encoder_output: Tensor of shape [batch, length, hparams.hidden_size].
ed: Tensor of shape [batch, 1, 1, length]. Encoder-decoder attention bias
for any padded tokens.
"""
with tf.variable_scope(name, default_name="transformer_text_encoder"):
inputs = common_layers.flatten4d3d(inputs)
[
encoder_input,
encoder_self_attention_bias,
ed,
] = transformer_layers.transformer_prepare_encoder(
inputs, target_space=target_space, hparams=hparams)
encoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.dropout)
encoder_output = transformer_layers.transformer_encoder(
encoder_input, encoder_self_attention_bias, hparams)
return encoder_output, ed
|
[
"def",
"transformer_text_encoder",
"(",
"inputs",
",",
"target_space",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"transformer_text_encoder\"",
")",
":",
"inputs",
"=",
"common_layers",
".",
"flatten4d3d",
"(",
"inputs",
")",
"[",
"encoder_input",
",",
"encoder_self_attention_bias",
",",
"ed",
",",
"]",
"=",
"transformer_layers",
".",
"transformer_prepare_encoder",
"(",
"inputs",
",",
"target_space",
"=",
"target_space",
",",
"hparams",
"=",
"hparams",
")",
"encoder_input",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"encoder_input",
",",
"1.0",
"-",
"hparams",
".",
"dropout",
")",
"encoder_output",
"=",
"transformer_layers",
".",
"transformer_encoder",
"(",
"encoder_input",
",",
"encoder_self_attention_bias",
",",
"hparams",
")",
"return",
"encoder_output",
",",
"ed"
] |
Transformer text encoder over inputs with unmasked full attention.
Args:
inputs: Tensor of shape [batch, length, 1, hparams.hidden_size].
target_space: int. Used for encoding inputs under a target space id.
hparams: HParams.
name: string, variable scope.
Returns:
encoder_output: Tensor of shape [batch, length, hparams.hidden_size].
ed: Tensor of shape [batch, 1, 1, length]. Encoder-decoder attention bias
for any padded tokens.
|
[
"Transformer",
"text",
"encoder",
"over",
"inputs",
"with",
"unmasked",
"full",
"attention",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L391-L419
|
train
|
Transformer text encoder over inputs with unmasked full attention.
|
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,koCe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6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(54) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(0b10101 + 0o35) + chr(2025 - 1976) + chr(1371 - 1322), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1001 + 0o52) + chr(0b110010) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1121 - 1072) + chr(0b1110 + 0o45) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(0b10010 + 0o40) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(289 - 237) + '\x34', 55655 - 55647), ehT0Px3KOsy9(chr(48) + chr(0b101101 + 0o102) + chr(0b110001) + chr(0b110100) + '\063', 23156 - 23148), ehT0Px3KOsy9('\060' + chr(1774 - 1663) + chr(51) + chr(0b110000) + chr(0b110111), 31730 - 31722), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + '\062' + '\x34' + chr(1954 - 1902), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\064' + chr(301 - 246), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + chr(477 - 428), 0o10), ehT0Px3KOsy9(chr(634 - 586) + '\x6f' + '\x31' + chr(50) + chr(0b110100 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + chr(0b110001) + '\x31' + chr(0b100001 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(49) + '\x36' + chr(1258 - 1205), 12255 - 12247), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100001 + 0o20) + chr(0b110000) + chr(2195 - 2143), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(0b110100) + chr(625 - 576), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(669 - 615) + chr(2613 - 2560), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + chr(50), 0o10), ehT0Px3KOsy9(chr(1535 - 1487) + chr(0b1101111) + '\064' + chr(1839 - 1791), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\x36' + '\x32', 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + '\061' + chr(0b110110 + 0o1) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000100 + 0o53) + chr(0b101 + 0o56) + chr(634 - 584) + chr(2202 - 2152), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(0b100001 + 0o21) + chr(2282 - 2231) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100101 + 0o22) + chr(0b110000 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\067' + chr(0b100100 + 0o15), 15036 - 15028), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(0b110110), 52902 - 52894), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(603 - 553) + chr(49) + '\x30', 0o10), ehT0Px3KOsy9(chr(1759 - 1711) + chr(3676 - 3565) + chr(0b111 + 0o53) + chr(646 - 598) + chr(0b110111), 63988 - 63980), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\157' + '\062' + chr(0b110010) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\x30' + chr(52), 0o10), ehT0Px3KOsy9(chr(1513 - 1465) + chr(12250 - 12139) + chr(1421 - 1372) + '\x36' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1339 - 1291) + chr(0b1101111) + chr(0b110011) + chr(0b100101 + 0o14) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101111 + 0o100) + chr(0b110001) + '\x30' + chr(52), 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(0b110001) + chr(0b101001 + 0o15) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2207 - 2157) + chr(0b10 + 0o63) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1 + 0o156) + chr(50) + chr(54) + chr(0b110010 + 0o3), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10110 + 0o33) + chr(0b11011 + 0o33) + chr(331 - 280), 8), ehT0Px3KOsy9('\060' + chr(0b1000111 + 0o50) + chr(50) + '\x36' + '\x32', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(178 - 130) + '\157' + chr(0b110101) + chr(0b1000 + 0o50), 26194 - 26186)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1a'), chr(6829 - 6729) + chr(101) + chr(99) + '\x6f' + chr(0b1100100) + chr(6891 - 6790))(chr(117) + chr(11621 - 11505) + '\146' + chr(0b101101) + chr(2756 - 2700)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def JTU6YB5oAboN(vXoupepMtCXU, uFIGUtii6RGG, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'B\xe8\xa407F\x0f\xa2\\\xd7\xc4F%*'), '\144' + chr(9765 - 9664) + chr(99) + chr(11126 - 11015) + chr(0b11001 + 0o113) + chr(9769 - 9668))(chr(117) + '\x74' + '\146' + chr(45) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'@\xfb\xb77%B\x0c\xb5n\xc1\xd5v!*\r0\xbe\x90DC\xdd\x1e\xb7\xed'), chr(5568 - 5468) + chr(0b100101 + 0o100) + chr(0b1100011 + 0o0) + chr(0b111001 + 0o66) + chr(0b1100100) + chr(101))('\x75' + '\x74' + chr(102) + chr(45) + chr(0b111000))):
vXoupepMtCXU = jSKPaHwSAfVv.flatten4d3d(vXoupepMtCXU)
[LDEM1Zag9l0P, cMrr2bkEBgTQ, dTXqLuPC2FBQ] = Nyy0_cXxpJav.transformer_prepare_encoder(vXoupepMtCXU, target_space=uFIGUtii6RGG, hparams=n4ljua2gi1Pr)
LDEM1Zag9l0P = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(LDEM1Zag9l0P, 1.0 - n4ljua2gi1Pr.ag0mwEgWzjYv)
NE_S2zAzN4PI = Nyy0_cXxpJav.transformer_encoder(LDEM1Zag9l0P, cMrr2bkEBgTQ, n4ljua2gi1Pr)
return (NE_S2zAzN4PI, dTXqLuPC2FBQ)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
transformer_image_decoder
|
def transformer_image_decoder(targets,
encoder_output,
ed_attention_bias,
hparams,
name=None):
"""Transformer image decoder over targets with local attention.
Args:
targets: Tensor of shape [batch, ...], and whose size is batch * height *
width * hparams.num_channels * hparams.hidden_size.
encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width * hparams.num_channels,
hparams.hidden_size].
"""
with tf.variable_scope(name, default_name="transformer_dec"):
batch_size = common_layers.shape_list(targets)[0]
targets = tf.reshape(targets, [batch_size,
hparams.img_len,
hparams.img_len,
hparams.num_channels * hparams.hidden_size])
decoder_input, _, _ = cia.prepare_decoder(targets, hparams)
decoder_output = cia.transformer_decoder_layers(
decoder_input,
encoder_output,
hparams.num_decoder_layers or hparams.num_hidden_layers,
hparams,
attention_type=hparams.dec_attention_type,
encoder_decoder_attention_bias=ed_attention_bias,
name="decoder")
decoder_output = tf.reshape(decoder_output,
[batch_size,
hparams.img_len,
hparams.img_len * hparams.num_channels,
hparams.hidden_size])
return decoder_output
|
python
|
def transformer_image_decoder(targets,
encoder_output,
ed_attention_bias,
hparams,
name=None):
"""Transformer image decoder over targets with local attention.
Args:
targets: Tensor of shape [batch, ...], and whose size is batch * height *
width * hparams.num_channels * hparams.hidden_size.
encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width * hparams.num_channels,
hparams.hidden_size].
"""
with tf.variable_scope(name, default_name="transformer_dec"):
batch_size = common_layers.shape_list(targets)[0]
targets = tf.reshape(targets, [batch_size,
hparams.img_len,
hparams.img_len,
hparams.num_channels * hparams.hidden_size])
decoder_input, _, _ = cia.prepare_decoder(targets, hparams)
decoder_output = cia.transformer_decoder_layers(
decoder_input,
encoder_output,
hparams.num_decoder_layers or hparams.num_hidden_layers,
hparams,
attention_type=hparams.dec_attention_type,
encoder_decoder_attention_bias=ed_attention_bias,
name="decoder")
decoder_output = tf.reshape(decoder_output,
[batch_size,
hparams.img_len,
hparams.img_len * hparams.num_channels,
hparams.hidden_size])
return decoder_output
|
[
"def",
"transformer_image_decoder",
"(",
"targets",
",",
"encoder_output",
",",
"ed_attention_bias",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"transformer_dec\"",
")",
":",
"batch_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"targets",
")",
"[",
"0",
"]",
"targets",
"=",
"tf",
".",
"reshape",
"(",
"targets",
",",
"[",
"batch_size",
",",
"hparams",
".",
"img_len",
",",
"hparams",
".",
"img_len",
",",
"hparams",
".",
"num_channels",
"*",
"hparams",
".",
"hidden_size",
"]",
")",
"decoder_input",
",",
"_",
",",
"_",
"=",
"cia",
".",
"prepare_decoder",
"(",
"targets",
",",
"hparams",
")",
"decoder_output",
"=",
"cia",
".",
"transformer_decoder_layers",
"(",
"decoder_input",
",",
"encoder_output",
",",
"hparams",
".",
"num_decoder_layers",
"or",
"hparams",
".",
"num_hidden_layers",
",",
"hparams",
",",
"attention_type",
"=",
"hparams",
".",
"dec_attention_type",
",",
"encoder_decoder_attention_bias",
"=",
"ed_attention_bias",
",",
"name",
"=",
"\"decoder\"",
")",
"decoder_output",
"=",
"tf",
".",
"reshape",
"(",
"decoder_output",
",",
"[",
"batch_size",
",",
"hparams",
".",
"img_len",
",",
"hparams",
".",
"img_len",
"*",
"hparams",
".",
"num_channels",
",",
"hparams",
".",
"hidden_size",
"]",
")",
"return",
"decoder_output"
] |
Transformer image decoder over targets with local attention.
Args:
targets: Tensor of shape [batch, ...], and whose size is batch * height *
width * hparams.num_channels * hparams.hidden_size.
encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, height, width * hparams.num_channels,
hparams.hidden_size].
|
[
"Transformer",
"image",
"decoder",
"over",
"targets",
"with",
"local",
"attention",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L422-L462
|
train
|
Transformer image decoder over targets with local attention.
|
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,Kk1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E_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(1855 - 1807) + '\x6f' + chr(49) + chr(0b110100) + chr(1726 - 1675), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\x32' + '\066', 0o10), ehT0Px3KOsy9(chr(777 - 729) + chr(0b1100011 + 0o14) + chr(1067 - 1016) + chr(1485 - 1437) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1011110 + 0o21) + '\063' + '\067' + chr(54), 4255 - 4247), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1979 - 1930) + chr(0b110101) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + '\x31' + chr(0b110111), 16877 - 16869), ehT0Px3KOsy9(chr(1815 - 1767) + '\157' + '\x31' + '\x31' + chr(0b110 + 0o52), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x31' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1110 + 0o141) + '\x32' + chr(0b110101) + '\x30', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110100 + 0o73) + '\061' + chr(55) + chr(0b101100 + 0o10), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(0b110111) + chr(48), 37726 - 37718), ehT0Px3KOsy9(chr(0b110000) + chr(1583 - 1472) + chr(313 - 263) + '\x32' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2306 - 2195) + chr(0b110000 + 0o2) + '\x32' + '\060', 39268 - 39260), ehT0Px3KOsy9('\060' + chr(3428 - 3317) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x31' + chr(0b111 + 0o60), 8), ehT0Px3KOsy9('\060' + chr(0b111101 + 0o62) + chr(55), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(50) + '\063' + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101 + 0o56) + chr(0b10000 + 0o43) + chr(0b110001), 14280 - 14272), ehT0Px3KOsy9('\060' + chr(4192 - 4081) + '\061' + chr(51) + '\064', 4055 - 4047), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + chr(0b101101 + 0o5) + '\060' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + chr(0b11110 + 0o23) + chr(0b10001 + 0o42) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7132 - 7021) + '\x31' + chr(0b1010 + 0o54) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(1530 - 1479) + chr(49) + '\x34', 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b111101 + 0o62) + chr(0b110010) + chr(0b10001 + 0o37) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100011 + 0o14) + chr(0b110001) + '\065' + chr(0b100110 + 0o14), 0o10), ehT0Px3KOsy9(chr(170 - 122) + '\x6f' + '\065' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b101111 + 0o1) + chr(49), 3131 - 3123), ehT0Px3KOsy9(chr(1045 - 997) + chr(4760 - 4649) + chr(0b1111 + 0o44) + '\061' + '\063', 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + '\x33' + chr(0b110110) + chr(2224 - 2171), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10110 + 0o34) + chr(55) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100011 + 0o14) + chr(0b101100 + 0o6) + chr(0b110001) + chr(238 - 184), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11100 + 0o26) + chr(53) + chr(0b101110 + 0o5), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(2632 - 2577) + '\065', 26631 - 26623), ehT0Px3KOsy9('\x30' + chr(9734 - 9623) + '\063' + chr(0b100110 + 0o16) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(1005 - 951), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + chr(0b11 + 0o57) + chr(0b110011) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(52) + chr(1325 - 1275), 56587 - 56579), ehT0Px3KOsy9(chr(48) + '\157' + chr(2210 - 2161) + chr(49) + chr(0b1101 + 0o43), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b110001) + chr(0b100010 + 0o23), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(7188 - 7077) + chr(2570 - 2517) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'M'), '\144' + '\145' + chr(99) + '\x6f' + chr(0b10010 + 0o122) + '\145')(chr(8595 - 8478) + chr(3263 - 3147) + chr(0b110 + 0o140) + chr(0b101101) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def tbZsp0aqZVkj(xIEmRseySp3z, NE_S2zAzN4PI, f_bqL81BAxo1, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x157\xb6\x97\x0e\xed$\xa9J\xdb\x1f\x17\xe1\xf5'), '\x64' + chr(8931 - 8830) + chr(99) + chr(0b101 + 0o152) + '\144' + chr(101))('\165' + '\164' + chr(1682 - 1580) + chr(0b11001 + 0o24) + chr(0b111000)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b"\x17$\xa5\x90\x1c\xe9'\xbex\xcd\x0e'\xf5\xf5d"), chr(0b1010010 + 0o22) + chr(0b101100 + 0o71) + chr(99) + chr(0b1100100 + 0o13) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(6185 - 6069) + chr(0b1100110) + chr(0b101000 + 0o5) + chr(56))):
ix9dZyeAmUxY = jSKPaHwSAfVv.shape_list(xIEmRseySp3z)[ehT0Px3KOsy9('\060' + '\x6f' + chr(48), ord("\x08"))]
xIEmRseySp3z = IDJ2eXGCBCDu.reshape(xIEmRseySp3z, [ix9dZyeAmUxY, n4ljua2gi1Pr.laxD7jy5y7k1, n4ljua2gi1Pr.laxD7jy5y7k1, n4ljua2gi1Pr.X1ZpHSxyKbHn * n4ljua2gi1Pr.qzoyXN3kdhDL])
(t5Jz9byuSQ65, VNGQdHSFPrso, VNGQdHSFPrso) = oIL3U1EOcJgs.prepare_decoder(xIEmRseySp3z, n4ljua2gi1Pr)
JU9Bzy7FPp94 = oIL3U1EOcJgs.transformer_decoder_layers(t5Jz9byuSQ65, NE_S2zAzN4PI, n4ljua2gi1Pr.pRi6YFAYEnH4 or n4ljua2gi1Pr.jZh5_pLUoOoZ, n4ljua2gi1Pr, attention_type=n4ljua2gi1Pr.h3BUtwwQ_ZW5, encoder_decoder_attention_bias=f_bqL81BAxo1, name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x073\xa7\x91\x0b\xea:'), chr(0b111 + 0o135) + chr(0b1010001 + 0o24) + '\143' + chr(111) + chr(0b11010 + 0o112) + '\145')(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(0b11 + 0o52) + chr(56)))
JU9Bzy7FPp94 = IDJ2eXGCBCDu.reshape(JU9Bzy7FPp94, [ix9dZyeAmUxY, n4ljua2gi1Pr.laxD7jy5y7k1, n4ljua2gi1Pr.laxD7jy5y7k1 * n4ljua2gi1Pr.X1ZpHSxyKbHn, n4ljua2gi1Pr.qzoyXN3kdhDL])
return JU9Bzy7FPp94
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
transformer_latent_decoder
|
def transformer_latent_decoder(x,
encoder_output,
ed_attention_bias,
hparams,
name=None):
"""Transformer decoder over latents using latent_attention_type.
Args:
x: Tensor of shape [batch, length_q, hparams.hidden_size]. length_q is the
latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length_q, hparams.hidden_size].
"""
with tf.variable_scope(name, default_name="transformer_latent_dec"):
batch_size = common_layers.shape_list(x)[0]
compressed_img_len = (hparams.img_len //
2**(hparams.num_compress_steps // 2))
x = tf.reshape(x, [batch_size,
compressed_img_len,
compressed_img_len * hparams.num_latents,
hparams.hidden_size])
decoder_input, _, _ = cia.prepare_decoder(x, hparams)
decoder_output = cia.transformer_decoder_layers(
decoder_input,
encoder_output,
hparams.num_latent_layers or hparams.num_hidden_layers,
hparams,
attention_type=hparams.latent_attention_type,
encoder_decoder_attention_bias=ed_attention_bias,
name="decoder")
decoder_output = tf.reshape(decoder_output,
[batch_size,
compressed_img_len**2 * hparams.num_latents,
hparams.hidden_size])
return decoder_output
|
python
|
def transformer_latent_decoder(x,
encoder_output,
ed_attention_bias,
hparams,
name=None):
"""Transformer decoder over latents using latent_attention_type.
Args:
x: Tensor of shape [batch, length_q, hparams.hidden_size]. length_q is the
latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length_q, hparams.hidden_size].
"""
with tf.variable_scope(name, default_name="transformer_latent_dec"):
batch_size = common_layers.shape_list(x)[0]
compressed_img_len = (hparams.img_len //
2**(hparams.num_compress_steps // 2))
x = tf.reshape(x, [batch_size,
compressed_img_len,
compressed_img_len * hparams.num_latents,
hparams.hidden_size])
decoder_input, _, _ = cia.prepare_decoder(x, hparams)
decoder_output = cia.transformer_decoder_layers(
decoder_input,
encoder_output,
hparams.num_latent_layers or hparams.num_hidden_layers,
hparams,
attention_type=hparams.latent_attention_type,
encoder_decoder_attention_bias=ed_attention_bias,
name="decoder")
decoder_output = tf.reshape(decoder_output,
[batch_size,
compressed_img_len**2 * hparams.num_latents,
hparams.hidden_size])
return decoder_output
|
[
"def",
"transformer_latent_decoder",
"(",
"x",
",",
"encoder_output",
",",
"ed_attention_bias",
",",
"hparams",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"transformer_latent_dec\"",
")",
":",
"batch_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"[",
"0",
"]",
"compressed_img_len",
"=",
"(",
"hparams",
".",
"img_len",
"//",
"2",
"**",
"(",
"hparams",
".",
"num_compress_steps",
"//",
"2",
")",
")",
"x",
"=",
"tf",
".",
"reshape",
"(",
"x",
",",
"[",
"batch_size",
",",
"compressed_img_len",
",",
"compressed_img_len",
"*",
"hparams",
".",
"num_latents",
",",
"hparams",
".",
"hidden_size",
"]",
")",
"decoder_input",
",",
"_",
",",
"_",
"=",
"cia",
".",
"prepare_decoder",
"(",
"x",
",",
"hparams",
")",
"decoder_output",
"=",
"cia",
".",
"transformer_decoder_layers",
"(",
"decoder_input",
",",
"encoder_output",
",",
"hparams",
".",
"num_latent_layers",
"or",
"hparams",
".",
"num_hidden_layers",
",",
"hparams",
",",
"attention_type",
"=",
"hparams",
".",
"latent_attention_type",
",",
"encoder_decoder_attention_bias",
"=",
"ed_attention_bias",
",",
"name",
"=",
"\"decoder\"",
")",
"decoder_output",
"=",
"tf",
".",
"reshape",
"(",
"decoder_output",
",",
"[",
"batch_size",
",",
"compressed_img_len",
"**",
"2",
"*",
"hparams",
".",
"num_latents",
",",
"hparams",
".",
"hidden_size",
"]",
")",
"return",
"decoder_output"
] |
Transformer decoder over latents using latent_attention_type.
Args:
x: Tensor of shape [batch, length_q, hparams.hidden_size]. length_q is the
latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
hparams: HParams.
name: string, variable scope.
Returns:
Tensor of shape [batch, length_q, hparams.hidden_size].
|
[
"Transformer",
"decoder",
"over",
"latents",
"using",
"latent_attention_type",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L465-L506
|
train
|
Transformer decoder over latents using latent_attention_type.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24V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yThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1814 - 1766) + chr(111) + chr(0b110001) + '\062' + chr(1690 - 1639), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(502 - 391) + chr(0b110100) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011101 + 0o22) + chr(0b1 + 0o62) + chr(2070 - 2019) + chr(0b110101), 50122 - 50114), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1110 + 0o43) + chr(52) + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b110101) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11224 - 11113) + chr(2272 - 2221) + '\x35' + chr(122 - 69), 0b1000), ehT0Px3KOsy9(chr(2018 - 1970) + chr(111) + '\x33' + '\x34' + chr(1786 - 1734), 63714 - 63706), ehT0Px3KOsy9(chr(48) + chr(0b100 + 0o153) + chr(50) + chr(0b100010 + 0o24) + chr(2489 - 2437), 31028 - 31020), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b101000 + 0o10) + chr(55), 20644 - 20636), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + chr(0b110011) + chr(1640 - 1591) + chr(0b10100 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1862 - 1811) + chr(0b11011 + 0o26) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + '\062' + chr(48) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10110 + 0o34) + chr(1989 - 1941) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(53) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\063' + chr(726 - 678) + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111110 + 0o61) + chr(0b110101) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(540 - 489) + chr(0b110110) + chr(0b110111), 22433 - 22425), ehT0Px3KOsy9(chr(522 - 474) + chr(0b1101111) + chr(0b110110) + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x36' + chr(51), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(659 - 607), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100011 + 0o20) + chr(55) + chr(0b11101 + 0o27), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110001) + chr(0b10100 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\060' + chr(892 - 838), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1000011 + 0o54) + chr(449 - 398) + chr(2022 - 1968) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(0b1 + 0o61) + chr(0b110000) + '\063', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + '\061' + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b110101) + chr(0b101011 + 0o13), 0b1000), ehT0Px3KOsy9(chr(1731 - 1683) + '\157' + chr(0b110010) + chr(2438 - 2384) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(2301 - 2190) + '\x32' + chr(0b0 + 0o62) + chr(55), 40778 - 40770), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(48) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(1392 - 1337) + chr(0b10011 + 0o43), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b100010 + 0o17) + chr(255 - 203), 2200 - 2192), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + '\x34' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(274 - 219) + chr(0b11110 + 0o30), 22345 - 22337), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\065' + chr(1603 - 1553), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11858 - 11747) + '\061' + chr(0b10101 + 0o35) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110101) + '\065', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(2155 - 2105) + '\060' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + chr(0b110001), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(2954 - 2843) + chr(0b110001 + 0o4) + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'}'), chr(0b1100100) + '\x65' + chr(0b10001 + 0o122) + chr(0b1101111) + chr(0b100000 + 0o104) + chr(8052 - 7951))(chr(0b1110101) + '\164' + chr(0b0 + 0o146) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def E5l0_7XM8AYV(OeWW0F1dBPRQ, NE_S2zAzN4PI, f_bqL81BAxo1, n4ljua2gi1Pr, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'%E\xaf\x0ff\x0b\x81\x81\xeb4\xaa\xa5\xf3\xe5'), '\144' + chr(7592 - 7491) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(3982 - 3881))('\165' + chr(4818 - 4702) + chr(0b1100110) + '\055' + '\x38'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\'V\xbc\x08t\x0f\x82\x96\xd9"\xbb\x95\xef\xe1\\\xa3C\x83o\x97a\x9f'), '\x64' + chr(0b1100100 + 0o1) + chr(4621 - 4522) + '\x6f' + '\x64' + chr(1954 - 1853))(chr(0b1100001 + 0o24) + chr(7881 - 7765) + chr(0b1100110) + chr(0b1101 + 0o40) + chr(2907 - 2851))):
ix9dZyeAmUxY = jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)[ehT0Px3KOsy9(chr(1316 - 1268) + chr(111) + '\060', 0o10)]
SeiIYyKhgZMY = n4ljua2gi1Pr.laxD7jy5y7k1 // ehT0Px3KOsy9(chr(48) + chr(4055 - 3944) + chr(50), 0o10) ** (n4ljua2gi1Pr._y1Py7UE3OKS // ehT0Px3KOsy9(chr(1182 - 1134) + chr(0b1101111) + chr(567 - 517), 8))
OeWW0F1dBPRQ = IDJ2eXGCBCDu.reshape(OeWW0F1dBPRQ, [ix9dZyeAmUxY, SeiIYyKhgZMY, SeiIYyKhgZMY * n4ljua2gi1Pr.num_latents, n4ljua2gi1Pr.qzoyXN3kdhDL])
(t5Jz9byuSQ65, VNGQdHSFPrso, VNGQdHSFPrso) = oIL3U1EOcJgs.prepare_decoder(OeWW0F1dBPRQ, n4ljua2gi1Pr)
JU9Bzy7FPp94 = oIL3U1EOcJgs.transformer_decoder_layers(t5Jz9byuSQ65, NE_S2zAzN4PI, n4ljua2gi1Pr.num_latent_layers or n4ljua2gi1Pr.jZh5_pLUoOoZ, n4ljua2gi1Pr, attention_type=n4ljua2gi1Pr.latent_attention_type, encoder_decoder_attention_bias=f_bqL81BAxo1, name=xafqLlk3kkUe(SXOLrMavuUCe(b'7A\xbe\tc\x0c\x9f'), '\144' + chr(0b110000 + 0o65) + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))(chr(8999 - 8882) + '\164' + '\x66' + '\x2d' + chr(0b111000)))
JU9Bzy7FPp94 = IDJ2eXGCBCDu.reshape(JU9Bzy7FPp94, [ix9dZyeAmUxY, SeiIYyKhgZMY ** ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10001 + 0o41), 8) * n4ljua2gi1Pr.num_latents, n4ljua2gi1Pr.qzoyXN3kdhDL])
return JU9Bzy7FPp94
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
bottleneck_layer
|
def bottleneck_layer(inputs,
hparams,
name="discrete_bottleneck"):
"""Computes latents given inputs (typically, compressed targets)."""
[
latents_dense,
latents_discrete,
extra_loss,
embed_fn,
_,
] = hparams.bottleneck(inputs=inputs,
filter_size=hparams.compress_filter_size,
name=name,
mode=hparams.mode)
if DO_SUMMARIES:
tf.summary.histogram("discrete_latents",
tf.reshape(latents_discrete, [-1]))
return latents_dense, latents_discrete, extra_loss, embed_fn
|
python
|
def bottleneck_layer(inputs,
hparams,
name="discrete_bottleneck"):
"""Computes latents given inputs (typically, compressed targets)."""
[
latents_dense,
latents_discrete,
extra_loss,
embed_fn,
_,
] = hparams.bottleneck(inputs=inputs,
filter_size=hparams.compress_filter_size,
name=name,
mode=hparams.mode)
if DO_SUMMARIES:
tf.summary.histogram("discrete_latents",
tf.reshape(latents_discrete, [-1]))
return latents_dense, latents_discrete, extra_loss, embed_fn
|
[
"def",
"bottleneck_layer",
"(",
"inputs",
",",
"hparams",
",",
"name",
"=",
"\"discrete_bottleneck\"",
")",
":",
"[",
"latents_dense",
",",
"latents_discrete",
",",
"extra_loss",
",",
"embed_fn",
",",
"_",
",",
"]",
"=",
"hparams",
".",
"bottleneck",
"(",
"inputs",
"=",
"inputs",
",",
"filter_size",
"=",
"hparams",
".",
"compress_filter_size",
",",
"name",
"=",
"name",
",",
"mode",
"=",
"hparams",
".",
"mode",
")",
"if",
"DO_SUMMARIES",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"discrete_latents\"",
",",
"tf",
".",
"reshape",
"(",
"latents_discrete",
",",
"[",
"-",
"1",
"]",
")",
")",
"return",
"latents_dense",
",",
"latents_discrete",
",",
"extra_loss",
",",
"embed_fn"
] |
Computes latents given inputs (typically, compressed targets).
|
[
"Computes",
"latents",
"given",
"inputs",
"(",
"typically",
"compressed",
"targets",
")",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L509-L526
|
train
|
Bottleneck 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,RouZF7b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Yhj,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(111) + chr(1920 - 1870) + chr(1952 - 1897) + chr(1998 - 1947), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(9231 - 9120) + '\062' + chr(0b101111 + 0o5), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b1110 + 0o47) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110 + 0o55) + '\061' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(11617 - 11506) + chr(0b110010) + chr(0b110111) + '\063', 8), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b11 + 0o154) + '\x32' + chr(0b110011) + chr(0b101010 + 0o7), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(355 - 301) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1000001 + 0o56) + chr(815 - 766) + '\062' + chr(54), 33388 - 33380), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(1390 - 1335) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b101100 + 0o5) + chr(0b110011), 20122 - 20114), ehT0Px3KOsy9(chr(1203 - 1155) + chr(111) + chr(0b110001) + chr(318 - 263) + '\064', 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(4263 - 4152) + chr(1346 - 1297) + chr(0b101100 + 0o5), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b110000) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(387 - 337) + chr(0b10000 + 0o47), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b10111 + 0o40) + chr(550 - 496), ord("\x08")), ehT0Px3KOsy9(chr(1375 - 1327) + chr(0b1101111) + chr(50) + chr(51) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + '\063' + chr(0b10100 + 0o43) + '\x33', 0o10), ehT0Px3KOsy9(chr(2242 - 2194) + chr(0b111100 + 0o63) + '\062' + '\x37' + chr(123 - 71), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b10111 + 0o34) + chr(50), 10591 - 10583), ehT0Px3KOsy9('\060' + chr(9336 - 9225) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(1792 - 1744) + chr(111) + '\x36' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + '\064' + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(54) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + chr(989 - 939) + chr(0b101000 + 0o16) + '\066', 13283 - 13275), ehT0Px3KOsy9(chr(48) + chr(8120 - 8009) + chr(50) + chr(0b110000) + chr(52), 25218 - 25210), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + '\x33' + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(0b110010) + chr(2336 - 2285) + chr(53), 0o10), ehT0Px3KOsy9('\060' + chr(3742 - 3631) + chr(53) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(7555 - 7444) + chr(0b1100 + 0o45) + chr(548 - 498), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6321 - 6210) + chr(0b10010 + 0o41) + chr(0b1000 + 0o50) + chr(185 - 134), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111110 + 0o61) + chr(1610 - 1558) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b1010 + 0o47) + chr(0b110011), 49870 - 49862), ehT0Px3KOsy9(chr(992 - 944) + '\157' + '\066' + chr(0b101110 + 0o2), 29250 - 29242), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10101 + 0o35) + '\x32' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110100 + 0o0) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(51) + '\060', 42016 - 42008), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\x32' + chr(51), 62192 - 62184), ehT0Px3KOsy9('\x30' + chr(10259 - 10148) + chr(49) + '\x36' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(713 - 662) + '\060', 52198 - 52190), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b11100 + 0o123) + chr(50) + chr(2356 - 2302) + chr(1718 - 1665), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(53) + '\x30', 13188 - 13180)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x95'), chr(100) + chr(101) + '\x63' + '\x6f' + '\144' + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b100111 + 0o77) + '\055' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def HM9VcPJF72zG(vXoupepMtCXU, n4ljua2gi1Pr, AIvJRzLdDfgF=xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf}\x1e\xac\xc9\xfcE3\xe7\xa9\x13}\xb4;\x9b\xf6\x9e\xdf1'), chr(9700 - 9600) + chr(0b111001 + 0o54) + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(549 - 447) + chr(845 - 800) + chr(0b11010 + 0o36))):
[dyezpTDvdVyF, z2Exq_eUlctN, OyYXdGmcLv7F, qk7ql9buv3eD, VNGQdHSFPrso] = n4ljua2gi1Pr.Hax21lk7t3Y8(inputs=vXoupepMtCXU, filter_size=n4ljua2gi1Pr.compress_filter_size, name=AIvJRzLdDfgF, mode=n4ljua2gi1Pr.mode)
if Wx4lNRtSi9f8:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4PY\x95\xcc\xa0S"\xed\x9f\tX'), chr(5337 - 5237) + chr(0b111000 + 0o55) + '\143' + '\x6f' + chr(0b1100100) + chr(3072 - 2971))(chr(2416 - 2299) + '\x74' + chr(5329 - 5227) + '\055' + chr(815 - 759)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf}\x1e\xac\xc9\xfcE3\xe7\xa7\x1d}\xa59\x8a\xeb'), '\x64' + chr(7437 - 7336) + chr(2421 - 2322) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1110000 + 0o4) + chr(0b1011110 + 0o10) + '\055' + chr(0b111000)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9q\x1e\xa7\xda\xe9T'), chr(100) + '\x65' + '\143' + '\157' + '\x64' + chr(8462 - 8361))(chr(0b1000110 + 0o57) + chr(0b1001011 + 0o51) + chr(7844 - 7742) + chr(0b100001 + 0o14) + chr(0b111000)))(z2Exq_eUlctN, [-ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101011 + 0o6), ord("\x08"))]))
return (dyezpTDvdVyF, z2Exq_eUlctN, OyYXdGmcLv7F, qk7ql9buv3eD)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
latent_prediction_model
|
def latent_prediction_model(inputs,
ed_attention_bias,
latents_discrete,
latents_dense,
hparams,
vocab_size=None,
name=None):
"""Transformer-based latent prediction model.
It is an autoregressive decoder over latents_discrete given inputs.
Args:
inputs: Tensor of shape [batch, length_kv, hparams.hidden_size]. Inputs to
attend to for the decoder on latents.
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
latents_discrete: Tensor of shape [batch, length_q, vocab_size].
One-hot latents to compute log-probability of given inputs.
latents_dense: Tensor of shape [batch, length_q, hparams.hidden_size].
length_q is the latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
hparams: HParams.
vocab_size: int or None. If None, it is 2**hparams.bottleneck_bits.
name: string, variable scope.
Returns:
latents_pred: Tensor of shape [batch, length_q, hparams.hidden_size].
latents_pred_loss: Tensor of shape [batch, length_q].
"""
with tf.variable_scope(name, default_name="latent_prediction"):
if hparams.mode != tf.estimator.ModeKeys.PREDICT:
latents_pred = transformer_latent_decoder(tf.stop_gradient(latents_dense),
inputs,
ed_attention_bias,
hparams,
name)
if vocab_size is None:
vocab_size = 2**hparams.bottleneck_bits
if not hparams.soft_em:
# TODO(trandustin): latents_discrete is not one-hot from
# discrete_bottleneck unless hparams.soft_em is True. Refactor.
latents_discrete = tf.one_hot(latents_discrete, depth=vocab_size)
_, latent_pred_loss = ae_latent_softmax(
latents_pred, tf.stop_gradient(latents_discrete), vocab_size, hparams)
return latents_pred, latent_pred_loss
|
python
|
def latent_prediction_model(inputs,
ed_attention_bias,
latents_discrete,
latents_dense,
hparams,
vocab_size=None,
name=None):
"""Transformer-based latent prediction model.
It is an autoregressive decoder over latents_discrete given inputs.
Args:
inputs: Tensor of shape [batch, length_kv, hparams.hidden_size]. Inputs to
attend to for the decoder on latents.
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
latents_discrete: Tensor of shape [batch, length_q, vocab_size].
One-hot latents to compute log-probability of given inputs.
latents_dense: Tensor of shape [batch, length_q, hparams.hidden_size].
length_q is the latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
hparams: HParams.
vocab_size: int or None. If None, it is 2**hparams.bottleneck_bits.
name: string, variable scope.
Returns:
latents_pred: Tensor of shape [batch, length_q, hparams.hidden_size].
latents_pred_loss: Tensor of shape [batch, length_q].
"""
with tf.variable_scope(name, default_name="latent_prediction"):
if hparams.mode != tf.estimator.ModeKeys.PREDICT:
latents_pred = transformer_latent_decoder(tf.stop_gradient(latents_dense),
inputs,
ed_attention_bias,
hparams,
name)
if vocab_size is None:
vocab_size = 2**hparams.bottleneck_bits
if not hparams.soft_em:
# TODO(trandustin): latents_discrete is not one-hot from
# discrete_bottleneck unless hparams.soft_em is True. Refactor.
latents_discrete = tf.one_hot(latents_discrete, depth=vocab_size)
_, latent_pred_loss = ae_latent_softmax(
latents_pred, tf.stop_gradient(latents_discrete), vocab_size, hparams)
return latents_pred, latent_pred_loss
|
[
"def",
"latent_prediction_model",
"(",
"inputs",
",",
"ed_attention_bias",
",",
"latents_discrete",
",",
"latents_dense",
",",
"hparams",
",",
"vocab_size",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"latent_prediction\"",
")",
":",
"if",
"hparams",
".",
"mode",
"!=",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"PREDICT",
":",
"latents_pred",
"=",
"transformer_latent_decoder",
"(",
"tf",
".",
"stop_gradient",
"(",
"latents_dense",
")",
",",
"inputs",
",",
"ed_attention_bias",
",",
"hparams",
",",
"name",
")",
"if",
"vocab_size",
"is",
"None",
":",
"vocab_size",
"=",
"2",
"**",
"hparams",
".",
"bottleneck_bits",
"if",
"not",
"hparams",
".",
"soft_em",
":",
"# TODO(trandustin): latents_discrete is not one-hot from",
"# discrete_bottleneck unless hparams.soft_em is True. Refactor.",
"latents_discrete",
"=",
"tf",
".",
"one_hot",
"(",
"latents_discrete",
",",
"depth",
"=",
"vocab_size",
")",
"_",
",",
"latent_pred_loss",
"=",
"ae_latent_softmax",
"(",
"latents_pred",
",",
"tf",
".",
"stop_gradient",
"(",
"latents_discrete",
")",
",",
"vocab_size",
",",
"hparams",
")",
"return",
"latents_pred",
",",
"latent_pred_loss"
] |
Transformer-based latent prediction model.
It is an autoregressive decoder over latents_discrete given inputs.
Args:
inputs: Tensor of shape [batch, length_kv, hparams.hidden_size]. Inputs to
attend to for the decoder on latents.
ed_attention_bias: Tensor which broadcasts with shape [batch,
hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
latents_discrete: Tensor of shape [batch, length_q, vocab_size].
One-hot latents to compute log-probability of given inputs.
latents_dense: Tensor of shape [batch, length_q, hparams.hidden_size].
length_q is the latent length, which is
height * width * hparams.num_latents / (2**hparams.num_compress_steps).
hparams: HParams.
vocab_size: int or None. If None, it is 2**hparams.bottleneck_bits.
name: string, variable scope.
Returns:
latents_pred: Tensor of shape [batch, length_q, hparams.hidden_size].
latents_pred_loss: Tensor of shape [batch, length_q].
|
[
"Transformer",
"-",
"based",
"latent",
"prediction",
"model",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L529-L573
|
train
|
Transformer - based latent prediction model.
|
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('\060' + chr(111) + '\061' + chr(2274 - 2225) + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x37' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(255 - 207) + '\x6f' + chr(863 - 814) + '\063' + chr(1333 - 1279), 0o10), ehT0Px3KOsy9(chr(48) + chr(4789 - 4678) + '\063' + '\060' + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b110000) + chr(876 - 826), 0o10), ehT0Px3KOsy9(chr(1819 - 1771) + chr(111) + '\062' + '\x34' + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(53) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b101101 + 0o5) + chr(1869 - 1817), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b10 + 0o63) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(742 - 689) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(1793 - 1743) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(1984 - 1931) + chr(1743 - 1695), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1001011 + 0o44) + '\x33' + chr(912 - 858), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(1354 - 1306) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(879 - 768) + '\062' + chr(0b11111 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(0b110011) + chr(1059 - 1005) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(972 - 918) + chr(0b10 + 0o65), 57987 - 57979), ehT0Px3KOsy9(chr(330 - 282) + '\x6f' + chr(50) + chr(0b110100) + chr(53), 33573 - 33565), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101011 + 0o6) + chr(0b101111 + 0o5) + chr(1370 - 1321), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2174 - 2063) + chr(0b1011 + 0o46) + '\x33' + chr(0b110011 + 0o4), ord("\x08")), ehT0Px3KOsy9(chr(323 - 275) + '\157' + chr(2505 - 2450) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1001010 + 0o45) + chr(0b110010) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2951 - 2840) + chr(2138 - 2089) + '\067' + chr(192 - 137), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\062' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + '\x30' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1110 + 0o51) + chr(290 - 237), 37400 - 37392), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(0b110001) + chr(1088 - 1035), 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + chr(0b110001) + chr(0b101010 + 0o15) + chr(0b10101 + 0o36), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(0b110011) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(9822 - 9711) + chr(1607 - 1557) + chr(50) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100 + 0o143) + '\x32' + '\061', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b110010 + 0o5) + '\x34', 0b1000), ehT0Px3KOsy9(chr(192 - 144) + '\x6f' + chr(0b10101 + 0o35) + '\x31' + '\x30', 0o10), ehT0Px3KOsy9(chr(210 - 162) + chr(0b1101111) + chr(49) + '\066' + chr(0b11010 + 0o34), 0o10), ehT0Px3KOsy9(chr(1524 - 1476) + chr(0b1101111) + '\061' + chr(0b1001 + 0o51) + chr(0b100111 + 0o17), 27650 - 27642), ehT0Px3KOsy9('\x30' + chr(11949 - 11838) + chr(1031 - 976) + '\x34', 8), ehT0Px3KOsy9(chr(1422 - 1374) + chr(111) + '\x33' + chr(0b110100) + chr(50), 25304 - 25296), ehT0Px3KOsy9(chr(0b110000) + chr(6213 - 6102) + '\061' + chr(0b101001 + 0o12) + chr(0b10110 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + '\067' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(48) + '\x32', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1101111) + chr(1882 - 1829) + '\060', 44128 - 44120)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'`'), '\x64' + chr(0b100100 + 0o101) + chr(2724 - 2625) + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(117) + '\164' + '\146' + chr(1920 - 1875) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ERLtpvosf4PM(vXoupepMtCXU, f_bqL81BAxo1, z2Exq_eUlctN, dyezpTDvdVyF, n4ljua2gi1Pr, CeyMIoSyrpkQ=None, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'8],\xa8\xe3\xc1\xc31\xb5\xdbu\x87n\xe4'), '\144' + '\x65' + chr(0b110010 + 0o61) + chr(111) + chr(100) + chr(0b1100101))(chr(0b101011 + 0o112) + '\164' + chr(9570 - 9468) + chr(1732 - 1687) + '\070'))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'"]*\xa4\xec\xd7\xf0$\x98\xcdr\x81}\xf5x\x9f\xd9'), chr(0b1100100) + chr(0b111101 + 0o50) + '\143' + chr(111) + chr(0b11010 + 0o112) + chr(6363 - 6262))(chr(117) + chr(7949 - 7833) + chr(0b1011 + 0o133) + chr(1172 - 1127) + '\x38')):
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'#S:\xa4'), '\144' + '\145' + chr(4254 - 4155) + '\157' + '\x64' + chr(101))(chr(4148 - 4031) + chr(11770 - 11654) + '\x66' + chr(364 - 319) + '\070')) != xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1en\x1b\x85\xcb\xe0\xfb'), '\x64' + '\x65' + '\143' + chr(0b1101111) + chr(0b1100100) + '\145')('\x75' + '\164' + '\x66' + '\055' + '\x38')):
CGc8shFbWMSf = E5l0_7XM8AYV(IDJ2eXGCBCDu.stop_gradient(dyezpTDvdVyF), vXoupepMtCXU, f_bqL81BAxo1, n4ljua2gi1Pr, AIvJRzLdDfgF)
if CeyMIoSyrpkQ is None:
CeyMIoSyrpkQ = ehT0Px3KOsy9(chr(2174 - 2126) + chr(0b1111 + 0o140) + chr(50), ord("\x08")) ** n4ljua2gi1Pr.L0tf_yAed5SW
if not xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'=S8\xb5\xdd\xc6\xc2'), chr(0b10101 + 0o117) + '\x65' + chr(0b11011 + 0o110) + chr(0b1101111) + chr(9984 - 9884) + '\145')(chr(117) + chr(0b1110100) + chr(0b11 + 0o143) + chr(45) + chr(0b111000))):
z2Exq_eUlctN = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(z2Exq_eUlctN, depth=CeyMIoSyrpkQ)
(VNGQdHSFPrso, tywY_VUe399r) = aIL5S5J7gN81(CGc8shFbWMSf, IDJ2eXGCBCDu.stop_gradient(z2Exq_eUlctN), CeyMIoSyrpkQ, n4ljua2gi1Pr)
return (CGc8shFbWMSf, tywY_VUe399r)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
transformer_autoencoder
|
def transformer_autoencoder(inputs,
targets,
target_space,
hparams,
cache=None,
predict_mask=1.0):
"""Auto-encoder using a Transformer decoder and a prior over latent sequences.
Args:
inputs: Tensor of shape [batch, length, 1, hparams.hidden_size] or None.
targets: Tensor of shape [batch, ..., channels]. Ellipses may be 1 or 2
dimensions denoting sequence length.
target_space: int. Used for encoding inputs under a target space id.
hparams: HParams.
cache: Tensor of shape [batch, length] or None.
predict_mask: Tensor masking whether to use gold targets or predictions.
Returns:
decoder_output: Tensor of shape [batch, ..., hparams.hidden_size] presenting
pre-logit activations. After a transformation (`top` in `T2TModel`), it is
used with targets to compute the "training" (reconstruction) loss.
losses: dict of str to Tensors. There are three loss terms: "extra",
"extra_loss", and "latent_pred". The first is hard-coded to 0. The latter
two are Tensors of shape [batch].
cache: Tensor of shape [batch, length], either the same as cache, or newly
computed if the cache input is None.
"""
original_targets_shape = common_layers.shape_list(targets)
batch_size = original_targets_shape[0]
if len(original_targets_shape) == 4:
compress_fn = compress_encoder_2d
decompress_fn = decompress_decoder_2d
else:
compress_fn = compress_encoder_1d
decompress_fn = decompress_decoder_1d
ed_attention_bias = None
if inputs is not None:
inputs, ed_attention_bias = transformer_text_encoder(
inputs, target_space, hparams, name="input_encoder")
losses = {"extra": 0.,
"extra_loss": 0.,
"latent_pred": 0.}
if hparams.mode != tf.estimator.ModeKeys.PREDICT:
targets_compressed = compress_fn(targets, hparams, name="compress")
if hparams.mode == tf.estimator.ModeKeys.TRAIN:
scale = common_layers.inverse_exp_decay(hparams.startup_steps)
else:
scale = 1.0
scale = tf.to_float(tf.less(tf.random_uniform([batch_size]), scale))
latents_dense, latents_discrete, extra_loss, _ = bottleneck_layer(
targets_compressed, hparams)
extra_loss = scale * tf.reduce_mean(extra_loss)
_, latents_pred_loss = latent_prediction_model(
inputs, ed_attention_bias, latents_discrete, latents_dense, hparams,
name="latent_pred")
latent_time = tf.less(hparams.mask_startup_steps,
tf.to_int32(tf.train.get_global_step()))
latents_pred_loss = scale * tf.reduce_mean(latents_pred_loss)
latents_pred_loss *= tf.to_float(latent_time)
# Apply dropout noise for each data point and time step.
latents_dense_shape = common_layers.shape_list(latents_dense)
latents_dense = tf.nn.dropout(
latents_dense,
keep_prob=1 - hparams.latent_dropout,
noise_shape=[latents_dense_shape[0], latents_dense_shape[1], 1])
# TODO(trandustin): Can we combine extra and extra_loss?
losses = {"extra": 0.,
"extra_loss": extra_loss,
"latent_pred": latents_pred_loss}
else:
# Set the latent length, which is num_latents times the number of latent
# pixels. The number of latent pixels is determined by a compression factor
# on the number of image pixels.
latent_len = ((hparams.img_len * hparams.img_len * hparams.num_latents) /
(2**hparams.num_compress_steps))
_, _, _, embed_fn = bottleneck_layer(targets_compressed, hparams)
latents_dense = tf.zeros([batch_size, latent_len, 1, hparams.hidden_size])
if cache is None:
cache = ae_latent_sample_beam(latents_dense,
inputs,
ed_attention_bias,
embed_fn,
hparams)
cache_one_hot = tf.one_hot(cache, depth=2**hparams.bottleneck_bits)
latents_dense = embed_fn(cache_one_hot, hparams.hidden_size)
if len(original_targets_shape) == 4:
compressed_img_len = (hparams.img_len //
2**(hparams.num_compress_steps // 2))
latents_dense = tf.reshape(latents_dense,
[batch_size,
compressed_img_len,
compressed_img_len,
hparams.num_latents * hparams.hidden_size])
latents_dense = decompress_fn(latents_dense, hparams, name="decompress")
latents_dense = tf.reshape(
latents_dense,
[-1, hparams.img_len, hparams.img_len, hparams.hidden_size])
if hparams.use_gold_targets:
if hparams.mode == tf.estimator.ModeKeys.PREDICT:
masking = predict_mask
else:
masking = common_layers.inverse_exp_decay(hparams.mask_startup_steps)
targets, _, _ = cia.maybe_reshape_4d_to_3d(targets)
mask = tf.less(masking,
tf.random_uniform(common_layers.shape_list(targets)[:-1]))
mask = tf.expand_dims(tf.to_float(mask), 2)
latents_dense = mask * targets + (1.0 - mask) * latents_dense
latents_dense = tf.reshape(latents_dense, original_targets_shape)
if hparams.decode_autoregressive:
decoder_output = transformer_image_decoder(
latents_dense, inputs, ed_attention_bias, hparams, name="decoder")
else:
decoder_output = latents_dense
return decoder_output, losses, cache
|
python
|
def transformer_autoencoder(inputs,
targets,
target_space,
hparams,
cache=None,
predict_mask=1.0):
"""Auto-encoder using a Transformer decoder and a prior over latent sequences.
Args:
inputs: Tensor of shape [batch, length, 1, hparams.hidden_size] or None.
targets: Tensor of shape [batch, ..., channels]. Ellipses may be 1 or 2
dimensions denoting sequence length.
target_space: int. Used for encoding inputs under a target space id.
hparams: HParams.
cache: Tensor of shape [batch, length] or None.
predict_mask: Tensor masking whether to use gold targets or predictions.
Returns:
decoder_output: Tensor of shape [batch, ..., hparams.hidden_size] presenting
pre-logit activations. After a transformation (`top` in `T2TModel`), it is
used with targets to compute the "training" (reconstruction) loss.
losses: dict of str to Tensors. There are three loss terms: "extra",
"extra_loss", and "latent_pred". The first is hard-coded to 0. The latter
two are Tensors of shape [batch].
cache: Tensor of shape [batch, length], either the same as cache, or newly
computed if the cache input is None.
"""
original_targets_shape = common_layers.shape_list(targets)
batch_size = original_targets_shape[0]
if len(original_targets_shape) == 4:
compress_fn = compress_encoder_2d
decompress_fn = decompress_decoder_2d
else:
compress_fn = compress_encoder_1d
decompress_fn = decompress_decoder_1d
ed_attention_bias = None
if inputs is not None:
inputs, ed_attention_bias = transformer_text_encoder(
inputs, target_space, hparams, name="input_encoder")
losses = {"extra": 0.,
"extra_loss": 0.,
"latent_pred": 0.}
if hparams.mode != tf.estimator.ModeKeys.PREDICT:
targets_compressed = compress_fn(targets, hparams, name="compress")
if hparams.mode == tf.estimator.ModeKeys.TRAIN:
scale = common_layers.inverse_exp_decay(hparams.startup_steps)
else:
scale = 1.0
scale = tf.to_float(tf.less(tf.random_uniform([batch_size]), scale))
latents_dense, latents_discrete, extra_loss, _ = bottleneck_layer(
targets_compressed, hparams)
extra_loss = scale * tf.reduce_mean(extra_loss)
_, latents_pred_loss = latent_prediction_model(
inputs, ed_attention_bias, latents_discrete, latents_dense, hparams,
name="latent_pred")
latent_time = tf.less(hparams.mask_startup_steps,
tf.to_int32(tf.train.get_global_step()))
latents_pred_loss = scale * tf.reduce_mean(latents_pred_loss)
latents_pred_loss *= tf.to_float(latent_time)
# Apply dropout noise for each data point and time step.
latents_dense_shape = common_layers.shape_list(latents_dense)
latents_dense = tf.nn.dropout(
latents_dense,
keep_prob=1 - hparams.latent_dropout,
noise_shape=[latents_dense_shape[0], latents_dense_shape[1], 1])
# TODO(trandustin): Can we combine extra and extra_loss?
losses = {"extra": 0.,
"extra_loss": extra_loss,
"latent_pred": latents_pred_loss}
else:
# Set the latent length, which is num_latents times the number of latent
# pixels. The number of latent pixels is determined by a compression factor
# on the number of image pixels.
latent_len = ((hparams.img_len * hparams.img_len * hparams.num_latents) /
(2**hparams.num_compress_steps))
_, _, _, embed_fn = bottleneck_layer(targets_compressed, hparams)
latents_dense = tf.zeros([batch_size, latent_len, 1, hparams.hidden_size])
if cache is None:
cache = ae_latent_sample_beam(latents_dense,
inputs,
ed_attention_bias,
embed_fn,
hparams)
cache_one_hot = tf.one_hot(cache, depth=2**hparams.bottleneck_bits)
latents_dense = embed_fn(cache_one_hot, hparams.hidden_size)
if len(original_targets_shape) == 4:
compressed_img_len = (hparams.img_len //
2**(hparams.num_compress_steps // 2))
latents_dense = tf.reshape(latents_dense,
[batch_size,
compressed_img_len,
compressed_img_len,
hparams.num_latents * hparams.hidden_size])
latents_dense = decompress_fn(latents_dense, hparams, name="decompress")
latents_dense = tf.reshape(
latents_dense,
[-1, hparams.img_len, hparams.img_len, hparams.hidden_size])
if hparams.use_gold_targets:
if hparams.mode == tf.estimator.ModeKeys.PREDICT:
masking = predict_mask
else:
masking = common_layers.inverse_exp_decay(hparams.mask_startup_steps)
targets, _, _ = cia.maybe_reshape_4d_to_3d(targets)
mask = tf.less(masking,
tf.random_uniform(common_layers.shape_list(targets)[:-1]))
mask = tf.expand_dims(tf.to_float(mask), 2)
latents_dense = mask * targets + (1.0 - mask) * latents_dense
latents_dense = tf.reshape(latents_dense, original_targets_shape)
if hparams.decode_autoregressive:
decoder_output = transformer_image_decoder(
latents_dense, inputs, ed_attention_bias, hparams, name="decoder")
else:
decoder_output = latents_dense
return decoder_output, losses, cache
|
[
"def",
"transformer_autoencoder",
"(",
"inputs",
",",
"targets",
",",
"target_space",
",",
"hparams",
",",
"cache",
"=",
"None",
",",
"predict_mask",
"=",
"1.0",
")",
":",
"original_targets_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"targets",
")",
"batch_size",
"=",
"original_targets_shape",
"[",
"0",
"]",
"if",
"len",
"(",
"original_targets_shape",
")",
"==",
"4",
":",
"compress_fn",
"=",
"compress_encoder_2d",
"decompress_fn",
"=",
"decompress_decoder_2d",
"else",
":",
"compress_fn",
"=",
"compress_encoder_1d",
"decompress_fn",
"=",
"decompress_decoder_1d",
"ed_attention_bias",
"=",
"None",
"if",
"inputs",
"is",
"not",
"None",
":",
"inputs",
",",
"ed_attention_bias",
"=",
"transformer_text_encoder",
"(",
"inputs",
",",
"target_space",
",",
"hparams",
",",
"name",
"=",
"\"input_encoder\"",
")",
"losses",
"=",
"{",
"\"extra\"",
":",
"0.",
",",
"\"extra_loss\"",
":",
"0.",
",",
"\"latent_pred\"",
":",
"0.",
"}",
"if",
"hparams",
".",
"mode",
"!=",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"PREDICT",
":",
"targets_compressed",
"=",
"compress_fn",
"(",
"targets",
",",
"hparams",
",",
"name",
"=",
"\"compress\"",
")",
"if",
"hparams",
".",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"TRAIN",
":",
"scale",
"=",
"common_layers",
".",
"inverse_exp_decay",
"(",
"hparams",
".",
"startup_steps",
")",
"else",
":",
"scale",
"=",
"1.0",
"scale",
"=",
"tf",
".",
"to_float",
"(",
"tf",
".",
"less",
"(",
"tf",
".",
"random_uniform",
"(",
"[",
"batch_size",
"]",
")",
",",
"scale",
")",
")",
"latents_dense",
",",
"latents_discrete",
",",
"extra_loss",
",",
"_",
"=",
"bottleneck_layer",
"(",
"targets_compressed",
",",
"hparams",
")",
"extra_loss",
"=",
"scale",
"*",
"tf",
".",
"reduce_mean",
"(",
"extra_loss",
")",
"_",
",",
"latents_pred_loss",
"=",
"latent_prediction_model",
"(",
"inputs",
",",
"ed_attention_bias",
",",
"latents_discrete",
",",
"latents_dense",
",",
"hparams",
",",
"name",
"=",
"\"latent_pred\"",
")",
"latent_time",
"=",
"tf",
".",
"less",
"(",
"hparams",
".",
"mask_startup_steps",
",",
"tf",
".",
"to_int32",
"(",
"tf",
".",
"train",
".",
"get_global_step",
"(",
")",
")",
")",
"latents_pred_loss",
"=",
"scale",
"*",
"tf",
".",
"reduce_mean",
"(",
"latents_pred_loss",
")",
"latents_pred_loss",
"*=",
"tf",
".",
"to_float",
"(",
"latent_time",
")",
"# Apply dropout noise for each data point and time step.",
"latents_dense_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"latents_dense",
")",
"latents_dense",
"=",
"tf",
".",
"nn",
".",
"dropout",
"(",
"latents_dense",
",",
"keep_prob",
"=",
"1",
"-",
"hparams",
".",
"latent_dropout",
",",
"noise_shape",
"=",
"[",
"latents_dense_shape",
"[",
"0",
"]",
",",
"latents_dense_shape",
"[",
"1",
"]",
",",
"1",
"]",
")",
"# TODO(trandustin): Can we combine extra and extra_loss?",
"losses",
"=",
"{",
"\"extra\"",
":",
"0.",
",",
"\"extra_loss\"",
":",
"extra_loss",
",",
"\"latent_pred\"",
":",
"latents_pred_loss",
"}",
"else",
":",
"# Set the latent length, which is num_latents times the number of latent",
"# pixels. The number of latent pixels is determined by a compression factor",
"# on the number of image pixels.",
"latent_len",
"=",
"(",
"(",
"hparams",
".",
"img_len",
"*",
"hparams",
".",
"img_len",
"*",
"hparams",
".",
"num_latents",
")",
"/",
"(",
"2",
"**",
"hparams",
".",
"num_compress_steps",
")",
")",
"_",
",",
"_",
",",
"_",
",",
"embed_fn",
"=",
"bottleneck_layer",
"(",
"targets_compressed",
",",
"hparams",
")",
"latents_dense",
"=",
"tf",
".",
"zeros",
"(",
"[",
"batch_size",
",",
"latent_len",
",",
"1",
",",
"hparams",
".",
"hidden_size",
"]",
")",
"if",
"cache",
"is",
"None",
":",
"cache",
"=",
"ae_latent_sample_beam",
"(",
"latents_dense",
",",
"inputs",
",",
"ed_attention_bias",
",",
"embed_fn",
",",
"hparams",
")",
"cache_one_hot",
"=",
"tf",
".",
"one_hot",
"(",
"cache",
",",
"depth",
"=",
"2",
"**",
"hparams",
".",
"bottleneck_bits",
")",
"latents_dense",
"=",
"embed_fn",
"(",
"cache_one_hot",
",",
"hparams",
".",
"hidden_size",
")",
"if",
"len",
"(",
"original_targets_shape",
")",
"==",
"4",
":",
"compressed_img_len",
"=",
"(",
"hparams",
".",
"img_len",
"//",
"2",
"**",
"(",
"hparams",
".",
"num_compress_steps",
"//",
"2",
")",
")",
"latents_dense",
"=",
"tf",
".",
"reshape",
"(",
"latents_dense",
",",
"[",
"batch_size",
",",
"compressed_img_len",
",",
"compressed_img_len",
",",
"hparams",
".",
"num_latents",
"*",
"hparams",
".",
"hidden_size",
"]",
")",
"latents_dense",
"=",
"decompress_fn",
"(",
"latents_dense",
",",
"hparams",
",",
"name",
"=",
"\"decompress\"",
")",
"latents_dense",
"=",
"tf",
".",
"reshape",
"(",
"latents_dense",
",",
"[",
"-",
"1",
",",
"hparams",
".",
"img_len",
",",
"hparams",
".",
"img_len",
",",
"hparams",
".",
"hidden_size",
"]",
")",
"if",
"hparams",
".",
"use_gold_targets",
":",
"if",
"hparams",
".",
"mode",
"==",
"tf",
".",
"estimator",
".",
"ModeKeys",
".",
"PREDICT",
":",
"masking",
"=",
"predict_mask",
"else",
":",
"masking",
"=",
"common_layers",
".",
"inverse_exp_decay",
"(",
"hparams",
".",
"mask_startup_steps",
")",
"targets",
",",
"_",
",",
"_",
"=",
"cia",
".",
"maybe_reshape_4d_to_3d",
"(",
"targets",
")",
"mask",
"=",
"tf",
".",
"less",
"(",
"masking",
",",
"tf",
".",
"random_uniform",
"(",
"common_layers",
".",
"shape_list",
"(",
"targets",
")",
"[",
":",
"-",
"1",
"]",
")",
")",
"mask",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"to_float",
"(",
"mask",
")",
",",
"2",
")",
"latents_dense",
"=",
"mask",
"*",
"targets",
"+",
"(",
"1.0",
"-",
"mask",
")",
"*",
"latents_dense",
"latents_dense",
"=",
"tf",
".",
"reshape",
"(",
"latents_dense",
",",
"original_targets_shape",
")",
"if",
"hparams",
".",
"decode_autoregressive",
":",
"decoder_output",
"=",
"transformer_image_decoder",
"(",
"latents_dense",
",",
"inputs",
",",
"ed_attention_bias",
",",
"hparams",
",",
"name",
"=",
"\"decoder\"",
")",
"else",
":",
"decoder_output",
"=",
"latents_dense",
"return",
"decoder_output",
",",
"losses",
",",
"cache"
] |
Auto-encoder using a Transformer decoder and a prior over latent sequences.
Args:
inputs: Tensor of shape [batch, length, 1, hparams.hidden_size] or None.
targets: Tensor of shape [batch, ..., channels]. Ellipses may be 1 or 2
dimensions denoting sequence length.
target_space: int. Used for encoding inputs under a target space id.
hparams: HParams.
cache: Tensor of shape [batch, length] or None.
predict_mask: Tensor masking whether to use gold targets or predictions.
Returns:
decoder_output: Tensor of shape [batch, ..., hparams.hidden_size] presenting
pre-logit activations. After a transformation (`top` in `T2TModel`), it is
used with targets to compute the "training" (reconstruction) loss.
losses: dict of str to Tensors. There are three loss terms: "extra",
"extra_loss", and "latent_pred". The first is hard-coded to 0. The latter
two are Tensors of shape [batch].
cache: Tensor of shape [batch, length], either the same as cache, or newly
computed if the cache input is None.
|
[
"Auto",
"-",
"encoder",
"using",
"a",
"Transformer",
"decoder",
"and",
"a",
"prior",
"over",
"latent",
"sequences",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L576-L700
|
train
|
Auto - encoder using a Transformer decoder and a prior over latent sequences.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVV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,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + '\063' + chr(0b110010), 5857 - 5849), ehT0Px3KOsy9(chr(660 - 612) + chr(0b111001 + 0o66) + chr(0b11100 + 0o25) + chr(1105 - 1051) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + '\060' + chr(1765 - 1711), 27115 - 27107), ehT0Px3KOsy9(chr(2107 - 2059) + chr(0b1000010 + 0o55) + chr(0b1001 + 0o52) + chr(685 - 631) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(475 - 427) + '\x6f' + chr(1344 - 1293) + chr(0b110011 + 0o1) + chr(50), 57290 - 57282), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110110) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\x30' + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\061', 0b1000), ehT0Px3KOsy9(chr(1045 - 997) + '\157' + chr(0b10101 + 0o35) + chr(0b110110) + '\060', 0o10), ehT0Px3KOsy9(chr(1568 - 1520) + '\157' + '\x33' + '\x37' + '\x32', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + chr(49) + '\x32' + chr(0b11 + 0o61), 59262 - 59254), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + '\061' + chr(0b110111) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111 + 0o0) + chr(536 - 487) + '\061' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\x32' + chr(0b101010 + 0o6) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(659 - 609) + chr(52) + chr(810 - 761), 12313 - 12305), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(1032 - 979) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(48) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + '\x31' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(52) + chr(2608 - 2553), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(0b110011) + chr(0b100100 + 0o17) + chr(348 - 295), 29140 - 29132), ehT0Px3KOsy9(chr(952 - 904) + chr(111) + '\066' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b110111) + chr(0b110100 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7449 - 7338) + chr(51) + '\x33' + '\065', 8), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + chr(49) + '\x33' + chr(99 - 51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101101 + 0o5) + chr(51) + chr(2028 - 1973), 0o10), ehT0Px3KOsy9(chr(960 - 912) + '\x6f' + chr(54) + '\x33', 8), ehT0Px3KOsy9(chr(1974 - 1926) + chr(0b101110 + 0o101) + chr(2383 - 2334) + chr(50) + chr(0b1100 + 0o53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11111 + 0o22) + chr(0b101110 + 0o7) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b110100) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b100010 + 0o115) + chr(0b110010) + '\061' + chr(0b100011 + 0o20), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + '\x37' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101001 + 0o6) + '\x31' + chr(0b100100 + 0o16) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(12138 - 12027) + chr(0b110011) + '\060' + chr(0b10 + 0o60), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001 + 0o1) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + '\x31' + chr(49) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\065' + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b100101 + 0o20) + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b100010 + 0o20) + chr(0b1111 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(1678 - 1630) + chr(0b1101111) + '\x31' + chr(0b110111), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(0b101011 + 0o12) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b't'), '\x64' + '\145' + chr(0b1100011) + '\x6f' + chr(0b1000001 + 0o43) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(0b1100110) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RbESaO3JeqGU(vXoupepMtCXU, xIEmRseySp3z, uFIGUtii6RGG, n4ljua2gi1Pr, j1lPDdxcDbRB=None, zX7jLRevnG0Y=1.0):
lE6B91bdMt0Z = jSKPaHwSAfVv.shape_list(xIEmRseySp3z)
ix9dZyeAmUxY = lE6B91bdMt0Z[ehT0Px3KOsy9(chr(1927 - 1879) + chr(8500 - 8389) + chr(0b110000), 0b1000)]
if c2A0yzQpDQB3(lE6B91bdMt0Z) == ehT0Px3KOsy9(chr(2112 - 2064) + '\157' + '\x34', 8):
pynwqn0oVKZD = ZnOJveFOXTB3
joJyLhzj2NXs = x52_BhUndKfR
else:
pynwqn0oVKZD = N_VqrHdKcT4Y
joJyLhzj2NXs = RS9MCK0YN2HI
f_bqL81BAxo1 = None
if vXoupepMtCXU is not None:
(vXoupepMtCXU, f_bqL81BAxo1) = JTU6YB5oAboN(vXoupepMtCXU, uFIGUtii6RGG, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'3\x19\xb6\x83\x96l&g\xd3\x950\x18<'), chr(100) + chr(7230 - 7129) + '\x63' + chr(0b10001 + 0o136) + chr(0b11100 + 0o110) + chr(3234 - 3133))('\165' + chr(9178 - 9062) + '\146' + chr(717 - 672) + chr(56)))
eJKWkHA7qzlZ = {xafqLlk3kkUe(SXOLrMavuUCe(b'?\x0f\xb2\x84\x83'), chr(0b1100100) + '\145' + chr(3661 - 3562) + chr(8944 - 8833) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(4203 - 4087) + '\x66' + chr(0b101101) + chr(2165 - 2109)): 0.0, xafqLlk3kkUe(SXOLrMavuUCe(b'?\x0f\xb2\x84\x83l/f\xc3\x89'), chr(100) + '\x65' + '\143' + '\157' + chr(0b1100100) + chr(0b1100101))('\x75' + chr(116) + chr(102) + chr(147 - 102) + '\070'): 0.0, xafqLlk3kkUe(SXOLrMavuUCe(b'6\x16\xb2\x93\x8cG\x1cy\xc2\x9f0'), '\x64' + chr(101) + chr(4878 - 4779) + '\x6f' + chr(100) + chr(101))(chr(3787 - 3670) + chr(0b1110100) + '\x66' + chr(164 - 119) + '\070'): 0.0}
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'7\x18\xa2\x93'), '\144' + chr(0b1001 + 0o134) + chr(0b1100011) + '\x6f' + chr(0b110000 + 0o64) + chr(101))('\x75' + '\x74' + '\x66' + chr(0b101101) + chr(0b111 + 0o61))) != xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'\n%\x83\xb2\xabp\x17'), chr(5479 - 5379) + chr(9862 - 9761) + chr(647 - 548) + '\157' + '\144' + chr(101))(chr(117) + chr(1713 - 1597) + chr(0b1011111 + 0o7) + chr(0b1011 + 0o42) + chr(0b111000))):
WUf4wU0bxnWI = pynwqn0oVKZD(xIEmRseySp3z, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'9\x18\xab\x86\x90V0z'), chr(0b1100100) + chr(101) + '\x63' + '\x6f' + chr(100) + chr(101))(chr(0b111 + 0o156) + chr(0b1110100) + chr(0b110 + 0o140) + chr(0b101101) + '\x38'))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'7\x18\xa2\x93'), chr(0b10101 + 0o117) + '\145' + chr(6450 - 6351) + chr(0b1000110 + 0o51) + '\144' + '\x65')('\165' + chr(116) + '\146' + chr(769 - 724) + '\x38')) == xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e%\x87\xbf\xac'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + '\x64' + chr(0b1100101))('\165' + chr(0b1110100) + chr(9347 - 9245) + chr(0b101101) + '\x38')):
xjPLimsZRgb9 = jSKPaHwSAfVv.inverse_exp_decay(n4ljua2gi1Pr.bC3NvZ9zq7eV)
else:
xjPLimsZRgb9 = 1.0
xjPLimsZRgb9 = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.less(IDJ2eXGCBCDu.random_uniform([ix9dZyeAmUxY]), xjPLimsZRgb9))
(dyezpTDvdVyF, z2Exq_eUlctN, OyYXdGmcLv7F, VNGQdHSFPrso) = HM9VcPJF72zG(WUf4wU0bxnWI, n4ljua2gi1Pr)
OyYXdGmcLv7F = xjPLimsZRgb9 * IDJ2eXGCBCDu.reduce_mean(OyYXdGmcLv7F)
(VNGQdHSFPrso, lUIYJ5wz1RjX) = ERLtpvosf4PM(vXoupepMtCXU, f_bqL81BAxo1, z2Exq_eUlctN, dyezpTDvdVyF, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'6\x16\xb2\x93\x8cG\x1cy\xc2\x9f0'), chr(5627 - 5527) + chr(0b11100 + 0o111) + '\143' + chr(0b11001 + 0o126) + chr(7191 - 7091) + chr(0b100100 + 0o101))(chr(0b1110101) + chr(116) + '\146' + chr(1628 - 1583) + chr(0b111000)))
flxufY_4QFGJ = IDJ2eXGCBCDu.less(n4ljua2gi1Pr.mask_startup_steps, IDJ2eXGCBCDu.to_int32(IDJ2eXGCBCDu.train.get_global_step()))
lUIYJ5wz1RjX = xjPLimsZRgb9 * IDJ2eXGCBCDu.reduce_mean(lUIYJ5wz1RjX)
lUIYJ5wz1RjX *= IDJ2eXGCBCDu.ZUL3kHBGU8Uu(flxufY_4QFGJ)
UID6DLOBL18v = jSKPaHwSAfVv.shape_list(dyezpTDvdVyF)
dyezpTDvdVyF = IDJ2eXGCBCDu.nn.ag0mwEgWzjYv(dyezpTDvdVyF, keep_prob=ehT0Px3KOsy9(chr(0b110000) + chr(5730 - 5619) + chr(49), 29391 - 29383) - n4ljua2gi1Pr.latent_dropout, noise_shape=[UID6DLOBL18v[ehT0Px3KOsy9('\060' + chr(3735 - 3624) + chr(0b110000), 8)], UID6DLOBL18v[ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + chr(0b110001), 8)], ehT0Px3KOsy9(chr(629 - 581) + '\x6f' + '\061', 8)])
eJKWkHA7qzlZ = {xafqLlk3kkUe(SXOLrMavuUCe(b'?\x0f\xb2\x84\x83'), '\x64' + chr(101) + chr(0b1100011) + '\157' + chr(0b1100000 + 0o4) + chr(0b110010 + 0o63))(chr(0b1000110 + 0o57) + chr(116) + chr(490 - 388) + chr(45) + chr(56)): 0.0, xafqLlk3kkUe(SXOLrMavuUCe(b'?\x0f\xb2\x84\x83l/f\xc3\x89'), '\x64' + chr(101) + chr(0b1011010 + 0o11) + '\157' + chr(6945 - 6845) + '\x65')(chr(0b1110101) + chr(0b1100011 + 0o21) + chr(102) + chr(0b101101) + chr(56)): OyYXdGmcLv7F, xafqLlk3kkUe(SXOLrMavuUCe(b'6\x16\xb2\x93\x8cG\x1cy\xc2\x9f0'), chr(0b10010 + 0o122) + '\x65' + chr(0b111 + 0o134) + chr(0b1101111) + '\144' + chr(101))(chr(117) + '\164' + chr(0b1100110) + '\x2d' + chr(1106 - 1050)): lUIYJ5wz1RjX}
else:
WH1RhWxChep0 = n4ljua2gi1Pr.laxD7jy5y7k1 * n4ljua2gi1Pr.laxD7jy5y7k1 * n4ljua2gi1Pr.num_latents / ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + chr(1097 - 1047), ord("\x08")) ** n4ljua2gi1Pr._y1Py7UE3OKS
(VNGQdHSFPrso, VNGQdHSFPrso, VNGQdHSFPrso, qk7ql9buv3eD) = HM9VcPJF72zG(WUf4wU0bxnWI, n4ljua2gi1Pr)
dyezpTDvdVyF = IDJ2eXGCBCDu.zeros([ix9dZyeAmUxY, WH1RhWxChep0, ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31', 8), n4ljua2gi1Pr.qzoyXN3kdhDL])
if j1lPDdxcDbRB is None:
j1lPDdxcDbRB = Qh4xGcOn2HHI(dyezpTDvdVyF, vXoupepMtCXU, f_bqL81BAxo1, qk7ql9buv3eD, n4ljua2gi1Pr)
rEMD2qimVRg2 = IDJ2eXGCBCDu.Hq3fv4Yp0EhD(j1lPDdxcDbRB, depth=ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(50), 8) ** n4ljua2gi1Pr.L0tf_yAed5SW)
dyezpTDvdVyF = qk7ql9buv3eD(rEMD2qimVRg2, n4ljua2gi1Pr.qzoyXN3kdhDL)
if c2A0yzQpDQB3(lE6B91bdMt0Z) == ehT0Px3KOsy9('\060' + '\157' + chr(52), 8):
SeiIYyKhgZMY = n4ljua2gi1Pr.laxD7jy5y7k1 // ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + chr(734 - 684), 8) ** (n4ljua2gi1Pr._y1Py7UE3OKS // ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101110 + 0o4), 8))
dyezpTDvdVyF = IDJ2eXGCBCDu.reshape(dyezpTDvdVyF, [ix9dZyeAmUxY, SeiIYyKhgZMY, SeiIYyKhgZMY, n4ljua2gi1Pr.num_latents * n4ljua2gi1Pr.qzoyXN3kdhDL])
dyezpTDvdVyF = joJyLhzj2NXs(dyezpTDvdVyF, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'>\x12\xa5\x99\x8fC1l\xc3\x89'), chr(100) + '\145' + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(388 - 271) + chr(116) + chr(102) + chr(0b101101) + chr(56)))
dyezpTDvdVyF = IDJ2eXGCBCDu.reshape(dyezpTDvdVyF, [-ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1010 + 0o47), 8), n4ljua2gi1Pr.laxD7jy5y7k1, n4ljua2gi1Pr.laxD7jy5y7k1, n4ljua2gi1Pr.qzoyXN3kdhDL])
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'/\x04\xa3\xa9\x85\\/m\xef\x8e5\x0f)\xe1\xd5\x1c'), chr(0b110011 + 0o61) + '\145' + chr(8531 - 8432) + chr(0b1101111) + chr(5451 - 5351) + chr(0b1100101))(chr(0b1001100 + 0o51) + chr(116) + chr(102) + chr(45) + chr(0b111000))):
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'7\x18\xa2\x93'), chr(6978 - 6878) + chr(8438 - 8337) + chr(0b1001011 + 0o30) + '\x6f' + chr(0b1100100) + chr(7408 - 7307))(chr(0b1110101) + chr(116) + chr(102) + '\x2d' + chr(493 - 437))) == xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.ModeKeys, xafqLlk3kkUe(SXOLrMavuUCe(b'\n%\x83\xb2\xabp\x17'), '\x64' + chr(101) + chr(3624 - 3525) + '\x6f' + chr(100) + chr(5947 - 5846))(chr(0b1110101) + chr(0b1110100) + chr(102) + '\055' + chr(0b1001 + 0o57))):
Xc6mmmn54jv8 = zX7jLRevnG0Y
else:
Xc6mmmn54jv8 = jSKPaHwSAfVv.inverse_exp_decay(n4ljua2gi1Pr.mask_startup_steps)
(xIEmRseySp3z, VNGQdHSFPrso, VNGQdHSFPrso) = oIL3U1EOcJgs.maybe_reshape_4d_to_3d(xIEmRseySp3z)
Iz1jSgUKZDvt = IDJ2eXGCBCDu.less(Xc6mmmn54jv8, IDJ2eXGCBCDu.random_uniform(jSKPaHwSAfVv.shape_list(xIEmRseySp3z)[:-ehT0Px3KOsy9(chr(0b110000) + chr(0b101110 + 0o101) + chr(154 - 105), 8)]))
Iz1jSgUKZDvt = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.ZUL3kHBGU8Uu(Iz1jSgUKZDvt), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010), 8))
dyezpTDvdVyF = Iz1jSgUKZDvt * xIEmRseySp3z + (1.0 - Iz1jSgUKZDvt) * dyezpTDvdVyF
dyezpTDvdVyF = IDJ2eXGCBCDu.reshape(dyezpTDvdVyF, lE6B91bdMt0Z)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'>\x12\xa5\x99\x86V\x1ch\xc5\x8e;\x0f+\xe3\xd3\n\xb7\xf9\xce\xabS'), chr(5742 - 5642) + '\145' + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1111 + 0o126))('\x75' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b110001 + 0o7))):
JU9Bzy7FPp94 = tbZsp0aqZVkj(dyezpTDvdVyF, vXoupepMtCXU, f_bqL81BAxo1, n4ljua2gi1Pr, name=xafqLlk3kkUe(SXOLrMavuUCe(b'>\x12\xa5\x99\x86V1'), '\144' + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b11100 + 0o111))(chr(117) + '\164' + chr(0b1100110) + '\055' + chr(0b11 + 0o65)))
else:
JU9Bzy7FPp94 = dyezpTDvdVyF
return (JU9Bzy7FPp94, eJKWkHA7qzlZ, j1lPDdxcDbRB)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/latent_layers.py
|
iaf_flow
|
def iaf_flow(one_hot_assignments,
scale_weights,
scale_bias,
num_codes,
summary=True,
name=None):
"""Performs a single IAF flow using scale and normalization transformations.
Args:
one_hot_assignments: Assignments Tensor with shape [num_samples, batch_size,
latent_size, num_codes].
scale_weights: Tensor corresponding to lower triangular matrix used to
autoregressively generate scale matrix from assignments. To ensure the
lower-triangular matrix has length of latent_size, scale_weights should
be a rank-one tensor with size latent_size * (latent_size + 1) / 2.
scale_bias: Bias tensor to be added to scale tensor, with shape
[latent_size, num_codes]. If scale weights are zero, initialize scale_bias
to be log(exp(1.) / 2. - 1) so initial transformation is identity.
num_codes: Number of codes in codebook.
summary: Whether to save summaries.
name: String used for name scope.
Returns:
flow_output: Transformed one-hot assignments.
inverse_log_det_jacobian: Inverse log deteriminant of Jacobian corresponding
to transformation.
"""
with tf.name_scope(name, default_name="iaf"):
# Pad the one_hot_assignments by zeroing out the first latent dimension and
# shifting the rest down by one (and removing the last dimension).
padded_assignments = tf.pad(
one_hot_assignments, [[0, 0], [0, 0], [1, 0], [0, 0]])[:, :, :-1, :]
scale_bijector = tfp.distributions.bijectors.Affine(
scale_tril=tfp.distributions.fill_triangular(scale_weights))
scale = scale_bijector.forward(
tf.transpose(padded_assignments, [0, 1, 3, 2]))
# Transpose the bijector output since it performs a batch matmul.
scale = tf.transpose(scale, [0, 1, 3, 2])
scale = tf.nn.softplus(scale)
scale = scale + tf.nn.softplus(scale_bias[tf.newaxis, tf.newaxis, ...])
# Don't need last dimension since the transformation keeps it constant.
scale = scale[..., :-1]
z = one_hot_assignments[..., :-1]
unnormalized_probs = tf.concat([z * scale,
one_hot_assignments[..., -1, tf.newaxis]],
axis=-1)
normalizer = tf.reduce_sum(unnormalized_probs, axis=-1)
flow_output = unnormalized_probs / (normalizer[..., tf.newaxis])
inverse_log_det_jacobian = (-tf.reduce_sum(tf.log(scale), axis=-1)
+ num_codes * tf.log(normalizer))
if summary:
tf.summary.histogram("iaf/scale", tf.reshape(scale, [-1]))
tf.summary.histogram("iaf/inverse_log_det_jacobian",
tf.reshape(inverse_log_det_jacobian, [-1]))
return flow_output, inverse_log_det_jacobian
|
python
|
def iaf_flow(one_hot_assignments,
scale_weights,
scale_bias,
num_codes,
summary=True,
name=None):
"""Performs a single IAF flow using scale and normalization transformations.
Args:
one_hot_assignments: Assignments Tensor with shape [num_samples, batch_size,
latent_size, num_codes].
scale_weights: Tensor corresponding to lower triangular matrix used to
autoregressively generate scale matrix from assignments. To ensure the
lower-triangular matrix has length of latent_size, scale_weights should
be a rank-one tensor with size latent_size * (latent_size + 1) / 2.
scale_bias: Bias tensor to be added to scale tensor, with shape
[latent_size, num_codes]. If scale weights are zero, initialize scale_bias
to be log(exp(1.) / 2. - 1) so initial transformation is identity.
num_codes: Number of codes in codebook.
summary: Whether to save summaries.
name: String used for name scope.
Returns:
flow_output: Transformed one-hot assignments.
inverse_log_det_jacobian: Inverse log deteriminant of Jacobian corresponding
to transformation.
"""
with tf.name_scope(name, default_name="iaf"):
# Pad the one_hot_assignments by zeroing out the first latent dimension and
# shifting the rest down by one (and removing the last dimension).
padded_assignments = tf.pad(
one_hot_assignments, [[0, 0], [0, 0], [1, 0], [0, 0]])[:, :, :-1, :]
scale_bijector = tfp.distributions.bijectors.Affine(
scale_tril=tfp.distributions.fill_triangular(scale_weights))
scale = scale_bijector.forward(
tf.transpose(padded_assignments, [0, 1, 3, 2]))
# Transpose the bijector output since it performs a batch matmul.
scale = tf.transpose(scale, [0, 1, 3, 2])
scale = tf.nn.softplus(scale)
scale = scale + tf.nn.softplus(scale_bias[tf.newaxis, tf.newaxis, ...])
# Don't need last dimension since the transformation keeps it constant.
scale = scale[..., :-1]
z = one_hot_assignments[..., :-1]
unnormalized_probs = tf.concat([z * scale,
one_hot_assignments[..., -1, tf.newaxis]],
axis=-1)
normalizer = tf.reduce_sum(unnormalized_probs, axis=-1)
flow_output = unnormalized_probs / (normalizer[..., tf.newaxis])
inverse_log_det_jacobian = (-tf.reduce_sum(tf.log(scale), axis=-1)
+ num_codes * tf.log(normalizer))
if summary:
tf.summary.histogram("iaf/scale", tf.reshape(scale, [-1]))
tf.summary.histogram("iaf/inverse_log_det_jacobian",
tf.reshape(inverse_log_det_jacobian, [-1]))
return flow_output, inverse_log_det_jacobian
|
[
"def",
"iaf_flow",
"(",
"one_hot_assignments",
",",
"scale_weights",
",",
"scale_bias",
",",
"num_codes",
",",
"summary",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"default_name",
"=",
"\"iaf\"",
")",
":",
"# Pad the one_hot_assignments by zeroing out the first latent dimension and",
"# shifting the rest down by one (and removing the last dimension).",
"padded_assignments",
"=",
"tf",
".",
"pad",
"(",
"one_hot_assignments",
",",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
",",
"[",
"1",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
")",
"[",
":",
",",
":",
",",
":",
"-",
"1",
",",
":",
"]",
"scale_bijector",
"=",
"tfp",
".",
"distributions",
".",
"bijectors",
".",
"Affine",
"(",
"scale_tril",
"=",
"tfp",
".",
"distributions",
".",
"fill_triangular",
"(",
"scale_weights",
")",
")",
"scale",
"=",
"scale_bijector",
".",
"forward",
"(",
"tf",
".",
"transpose",
"(",
"padded_assignments",
",",
"[",
"0",
",",
"1",
",",
"3",
",",
"2",
"]",
")",
")",
"# Transpose the bijector output since it performs a batch matmul.",
"scale",
"=",
"tf",
".",
"transpose",
"(",
"scale",
",",
"[",
"0",
",",
"1",
",",
"3",
",",
"2",
"]",
")",
"scale",
"=",
"tf",
".",
"nn",
".",
"softplus",
"(",
"scale",
")",
"scale",
"=",
"scale",
"+",
"tf",
".",
"nn",
".",
"softplus",
"(",
"scale_bias",
"[",
"tf",
".",
"newaxis",
",",
"tf",
".",
"newaxis",
",",
"...",
"]",
")",
"# Don't need last dimension since the transformation keeps it constant.",
"scale",
"=",
"scale",
"[",
"...",
",",
":",
"-",
"1",
"]",
"z",
"=",
"one_hot_assignments",
"[",
"...",
",",
":",
"-",
"1",
"]",
"unnormalized_probs",
"=",
"tf",
".",
"concat",
"(",
"[",
"z",
"*",
"scale",
",",
"one_hot_assignments",
"[",
"...",
",",
"-",
"1",
",",
"tf",
".",
"newaxis",
"]",
"]",
",",
"axis",
"=",
"-",
"1",
")",
"normalizer",
"=",
"tf",
".",
"reduce_sum",
"(",
"unnormalized_probs",
",",
"axis",
"=",
"-",
"1",
")",
"flow_output",
"=",
"unnormalized_probs",
"/",
"(",
"normalizer",
"[",
"...",
",",
"tf",
".",
"newaxis",
"]",
")",
"inverse_log_det_jacobian",
"=",
"(",
"-",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"log",
"(",
"scale",
")",
",",
"axis",
"=",
"-",
"1",
")",
"+",
"num_codes",
"*",
"tf",
".",
"log",
"(",
"normalizer",
")",
")",
"if",
"summary",
":",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"iaf/scale\"",
",",
"tf",
".",
"reshape",
"(",
"scale",
",",
"[",
"-",
"1",
"]",
")",
")",
"tf",
".",
"summary",
".",
"histogram",
"(",
"\"iaf/inverse_log_det_jacobian\"",
",",
"tf",
".",
"reshape",
"(",
"inverse_log_det_jacobian",
",",
"[",
"-",
"1",
"]",
")",
")",
"return",
"flow_output",
",",
"inverse_log_det_jacobian"
] |
Performs a single IAF flow using scale and normalization transformations.
Args:
one_hot_assignments: Assignments Tensor with shape [num_samples, batch_size,
latent_size, num_codes].
scale_weights: Tensor corresponding to lower triangular matrix used to
autoregressively generate scale matrix from assignments. To ensure the
lower-triangular matrix has length of latent_size, scale_weights should
be a rank-one tensor with size latent_size * (latent_size + 1) / 2.
scale_bias: Bias tensor to be added to scale tensor, with shape
[latent_size, num_codes]. If scale weights are zero, initialize scale_bias
to be log(exp(1.) / 2. - 1) so initial transformation is identity.
num_codes: Number of codes in codebook.
summary: Whether to save summaries.
name: String used for name scope.
Returns:
flow_output: Transformed one-hot assignments.
inverse_log_det_jacobian: Inverse log deteriminant of Jacobian corresponding
to transformation.
|
[
"Performs",
"a",
"single",
"IAF",
"flow",
"using",
"scale",
"and",
"normalization",
"transformations",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L703-L758
|
train
|
A single IAF 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,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ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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(827 - 779) + '\x6f' + chr(234 - 185) + '\066' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(50), 20210 - 20202), ehT0Px3KOsy9('\x30' + chr(111) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(534 - 483) + '\062', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + chr(1961 - 1907), 0b1000), ehT0Px3KOsy9('\x30' + chr(2190 - 2079) + chr(0b101000 + 0o13) + chr(2110 - 2058), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\063' + chr(0b101110 + 0o7), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + chr(0b110010) + '\067' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(7402 - 7291) + chr(50) + chr(0b100 + 0o60) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(278 - 230) + chr(3492 - 3381) + chr(0b11111 + 0o23) + chr(0b101011 + 0o6) + chr(0b100001 + 0o22), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11531 - 11420) + '\063' + chr(0b100110 + 0o21) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101010 + 0o105) + chr(0b1101 + 0o46) + '\x34' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(5662 - 5551) + '\061' + chr(49) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(1900 - 1789) + chr(53) + chr(0b110010 + 0o3), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b100101 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10001 + 0o41) + '\x34' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(3917 - 3806) + chr(390 - 340) + '\x37' + '\061', 3570 - 3562), ehT0Px3KOsy9('\060' + chr(8645 - 8534) + chr(0b11100 + 0o26) + chr(1089 - 1034) + chr(0b110110), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(55) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1001101 + 0o42) + '\x35' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(4288 - 4177) + chr(0b1011 + 0o46) + chr(0b100111 + 0o15) + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1 + 0o62) + '\x35' + chr(2083 - 2035), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(0b110010) + '\066' + '\062', 0b1000), ehT0Px3KOsy9(chr(659 - 611) + chr(0b110101 + 0o72) + '\x33' + '\064' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010100 + 0o33) + chr(0b100011 + 0o20) + chr(0b101100 + 0o12) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x34' + chr(0b1 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + '\062' + chr(51) + chr(0b100010 + 0o23), 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(7916 - 7805) + '\x33' + chr(527 - 477), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b110101) + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(0b110011) + chr(740 - 690) + '\061', 63057 - 63049), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b110100) + chr(54), 16884 - 16876), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b110001) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(1463 - 1352) + '\x32' + '\x34' + '\061', 10223 - 10215), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + '\065', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1799 - 1749) + chr(54) + '\x33', 34778 - 34770), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\157' + '\063' + '\061' + chr(48), 0o10), ehT0Px3KOsy9(chr(419 - 371) + chr(0b1 + 0o156) + chr(0b11 + 0o60) + '\061' + chr(0b110001), 52877 - 52869), ehT0Px3KOsy9(chr(1441 - 1393) + chr(10322 - 10211) + '\x32' + chr(0b110111) + chr(53), 8), ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + chr(0b110010 + 0o1) + chr(54) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(0b101010 + 0o10) + chr(0b110001) + '\x31', 49958 - 49950)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'['), chr(0b1001100 + 0o30) + chr(7305 - 7204) + chr(99) + chr(0b1 + 0o156) + chr(5296 - 5196) + chr(6874 - 6773))(chr(0b110111 + 0o76) + '\x74' + chr(0b101000 + 0o76) + chr(0b101101) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def bzi9y6UB33RG(waomfPi0Zg4f, qYOA0z615sWN, XoOoLzTcIx7y, qOjO3wHWPNU5, oLgyQ45ORWXM=ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(3433 - 3322) + chr(0b111 + 0o52), ord("\x08")), AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b{h\x7fio\xfe\xd1\xd7\xee'), chr(8644 - 8544) + chr(0b1100101) + '\x63' + '\157' + chr(7346 - 7246) + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(0b11000 + 0o116) + chr(45) + chr(1156 - 1100)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c{c'), chr(0b11010 + 0o112) + chr(0b110001 + 0o64) + chr(4886 - 4787) + chr(11009 - 10898) + chr(0b10100 + 0o120) + chr(101))('\x75' + '\x74' + chr(102) + '\x2d' + chr(166 - 110))):
j9ye6XjdXhIp = IDJ2eXGCBCDu.pad(waomfPi0Zg4f, [[ehT0Px3KOsy9('\x30' + chr(111) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000), 8)], [ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + '\060', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + chr(667 - 619), 8)], [ehT0Px3KOsy9(chr(2213 - 2165) + '\x6f' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\157' + '\060', 8)], [ehT0Px3KOsy9(chr(87 - 39) + chr(0b1101111) + chr(48), 8), ehT0Px3KOsy9(chr(1706 - 1658) + '\x6f' + '\x30', 8)]])[:, :, :-ehT0Px3KOsy9('\x30' + chr(111) + '\x31', 8), :]
Wk0LX0O3U_fG = Ys555qziAbad.distributions.bijectors.Affine(scale_tril=Ys555qziAbad.distributions.fill_triangular(qYOA0z615sWN))
xjPLimsZRgb9 = Wk0LX0O3U_fG.GbbcCHUNFMj5(IDJ2eXGCBCDu.transpose(j9ye6XjdXhIp, [ehT0Px3KOsy9('\x30' + chr(111) + chr(0b111 + 0o51), 8), ehT0Px3KOsy9('\x30' + chr(10602 - 10491) + '\061', 8), ehT0Px3KOsy9(chr(1358 - 1310) + '\x6f' + '\063', 4478 - 4470), ehT0Px3KOsy9('\060' + chr(0b1101010 + 0o5) + chr(50), 57320 - 57312)]))
xjPLimsZRgb9 = IDJ2eXGCBCDu.transpose(xjPLimsZRgb9, [ehT0Px3KOsy9('\060' + chr(0b1101111) + '\060', 8), ehT0Px3KOsy9(chr(1360 - 1312) + chr(111) + chr(0b101011 + 0o6), 8), ehT0Px3KOsy9(chr(0b110000) + chr(8448 - 8337) + '\x33', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50), 8)])
xjPLimsZRgb9 = IDJ2eXGCBCDu.nn.softplus(xjPLimsZRgb9)
xjPLimsZRgb9 = xjPLimsZRgb9 + IDJ2eXGCBCDu.nn.softplus(XoOoLzTcIx7y[IDJ2eXGCBCDu.newaxis, IDJ2eXGCBCDu.newaxis, ...])
xjPLimsZRgb9 = xjPLimsZRgb9[..., :-ehT0Px3KOsy9(chr(0b110000) + chr(4840 - 4729) + '\x31', 8)]
AFGBo4BePxZi = waomfPi0Zg4f[..., :-ehT0Px3KOsy9(chr(48) + chr(6405 - 6294) + chr(0b110001), 8)]
ks1pVgh5LjOX = IDJ2eXGCBCDu.concat([AFGBo4BePxZi * xjPLimsZRgb9, waomfPi0Zg4f[..., -ehT0Px3KOsy9(chr(1995 - 1947) + chr(111) + '\061', 8), IDJ2eXGCBCDu.newaxis]], axis=-ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(350 - 301), 8))
USOEjr06Ae3s = IDJ2eXGCBCDu.reduce_sum(ks1pVgh5LjOX, axis=-ehT0Px3KOsy9(chr(48) + '\157' + chr(1229 - 1180), 8))
B488EISA1UZR = ks1pVgh5LjOX / USOEjr06Ae3s[..., IDJ2eXGCBCDu.newaxis]
ntLoHCO9agEd = -IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.log(xjPLimsZRgb9), axis=-ehT0Px3KOsy9('\x30' + chr(2615 - 2504) + '\061', 8)) + qOjO3wHWPNU5 * IDJ2eXGCBCDu.log(USOEjr06Ae3s)
if oLgyQ45ORWXM:
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'*^1@A%\xff\xca\xf2\xdf\x8f\xb2'), '\x64' + chr(101) + chr(2802 - 2703) + '\157' + chr(0b1100100) + chr(0b10 + 0o143))('\x75' + chr(0b1110100) + '\146' + chr(70 - 25) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c{c5E\x7f\xfc\xd2\xc2'), '\144' + '\x65' + chr(0b1100011) + chr(11615 - 11504) + chr(100) + '\x65')(chr(5210 - 5093) + chr(0b1110100) + chr(8574 - 8472) + '\x2d' + chr(0b1101 + 0o53)), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x7fvrWl\xf8'), chr(0b1100100) + '\x65' + chr(0b100011 + 0o100) + chr(0b1001111 + 0o40) + chr(0b110111 + 0o55) + chr(0b1100101))(chr(117) + chr(116) + '\x66' + chr(0b101101) + chr(0b111000)))(xjPLimsZRgb9, [-ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(6580 - 6469) + chr(0b100010 + 0o17), 8)]))
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'*^1@A%\xff\xca\xf2\xdf\x8f\xb2'), chr(0b1100100) + chr(101) + chr(0b1100011) + '\x6f' + chr(1707 - 1607) + '\x65')(chr(5744 - 5627) + chr(7453 - 7337) + '\146' + '\x2d' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b"\x1c{c5_r\xeb\xdb\xd5\xf8\x9f\xbc'Bh\xf9\xdd\xdb\xc9q\t\x89\xd1\x8d\x92I\xfct"), chr(100) + chr(0b1100101) + chr(0b1100011) + '\157' + '\144' + chr(5330 - 5229))(chr(9647 - 9530) + chr(0b1011111 + 0o25) + chr(8057 - 7955) + chr(45) + '\x38'), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x7fvrWl\xf8'), chr(8284 - 8184) + chr(6716 - 6615) + chr(0b1100011) + '\x6f' + chr(0b1010111 + 0o15) + chr(101))(chr(8751 - 8634) + chr(0b1110100) + '\146' + chr(403 - 358) + chr(3070 - 3014)))(ntLoHCO9agEd, [-ehT0Px3KOsy9(chr(48) + chr(0b11101 + 0o122) + chr(0b110001), 8)]))
return (B488EISA1UZR, ntLoHCO9agEd)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/image_lsun.py
|
_get_lsun
|
def _get_lsun(directory, category, split_name):
"""Downloads all lsun files to directory unless they are there."""
generator_utils.maybe_download(directory,
_LSUN_DATA_FILENAME % (category, split_name),
_LSUN_URL % (category, split_name))
|
python
|
def _get_lsun(directory, category, split_name):
"""Downloads all lsun files to directory unless they are there."""
generator_utils.maybe_download(directory,
_LSUN_DATA_FILENAME % (category, split_name),
_LSUN_URL % (category, split_name))
|
[
"def",
"_get_lsun",
"(",
"directory",
",",
"category",
",",
"split_name",
")",
":",
"generator_utils",
".",
"maybe_download",
"(",
"directory",
",",
"_LSUN_DATA_FILENAME",
"%",
"(",
"category",
",",
"split_name",
")",
",",
"_LSUN_URL",
"%",
"(",
"category",
",",
"split_name",
")",
")"
] |
Downloads all lsun files to directory unless they are there.
|
[
"Downloads",
"all",
"lsun",
"files",
"to",
"directory",
"unless",
"they",
"are",
"there",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/image_lsun.py#L40-L44
|
train
|
Downloads all lsun files to directory unless they are there.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFG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,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' + chr(0b10011 + 0o44) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(49) + chr(49) + chr(632 - 582), 0b1000), ehT0Px3KOsy9(chr(1143 - 1095) + chr(0b1000 + 0o147) + chr(0b110011) + '\x33' + chr(0b1101 + 0o46), 0b1000), ehT0Px3KOsy9(chr(614 - 566) + '\x6f' + '\x31' + chr(0b10 + 0o57) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110110) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b110001) + '\064' + chr(0b1000 + 0o55), 0o10), ehT0Px3KOsy9(chr(2232 - 2184) + '\157' + chr(0b110110) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x33' + chr(0b110000 + 0o7), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101 + 0o142) + chr(207 - 157) + chr(51) + '\x36', 36354 - 36346), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1376 - 1327) + chr(0b101101 + 0o6) + '\061', 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + '\x32' + chr(613 - 560) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1446 - 1396) + '\x31' + '\x37', 0b1000), ehT0Px3KOsy9(chr(1880 - 1832) + '\x6f' + '\x31' + chr(0b110010) + chr(0b101100 + 0o12), 47266 - 47258), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(9678 - 9567) + chr(0b101001 + 0o12) + chr(0b11 + 0o63) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + '\x32' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1203 - 1155) + '\x6f' + '\062' + chr(49) + chr(1392 - 1341), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1111 + 0o43) + chr(0b110111) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + '\063' + chr(52) + '\060', 46337 - 46329), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(10304 - 10193) + chr(0b110010) + chr(0b101 + 0o54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(48) + chr(0b110000), 61764 - 61756), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101110 + 0o7) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(1318 - 1270) + chr(378 - 267) + chr(0b110011) + chr(2895 - 2840) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110 + 0o151) + chr(50) + chr(0b1011 + 0o53) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b10110 + 0o34) + chr(0b110110) + '\x34', 34451 - 34443), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(0b110001) + '\x35' + chr(2245 - 2197), 45277 - 45269), ehT0Px3KOsy9(chr(2248 - 2200) + chr(0b1101111) + chr(0b110001) + '\x32' + '\060', 0o10), ehT0Px3KOsy9(chr(108 - 60) + chr(0b1101111) + chr(1691 - 1640) + chr(0b110000) + chr(0b11011 + 0o31), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(1009 - 959) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4382 - 4271) + chr(0b1001 + 0o51) + chr(54) + chr(457 - 402), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\067', 48483 - 48475), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(53) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\064' + chr(53), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1100 + 0o47) + '\063' + '\x35', 8472 - 8464), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b111000 + 0o67) + chr(49) + chr(50) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9940 - 9829) + chr(49) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + '\x35' + chr(0b10 + 0o60), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101110 + 0o5) + '\063' + chr(0b10010 + 0o37), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001111 + 0o40) + '\x33' + chr(0b10001 + 0o44) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3821 - 3710) + chr(1090 - 1040) + '\x33' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(620 - 572) + chr(111) + chr(49) + chr(0b110111), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + chr(432 - 379) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x14'), chr(100) + '\145' + '\x63' + chr(0b100010 + 0o115) + chr(0b1100100) + '\145')(chr(0b1111 + 0o146) + '\164' + chr(102) + '\x2d' + chr(0b11111 + 0o31)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def jo9y_fNXaEPi(EVVr9bEHclel, Bo2bdn6L4dm4, snGgXs7meaot):
xafqLlk3kkUe(g1Z_RG9zP4cD, xafqLlk3kkUe(SXOLrMavuUCe(b'W+\xa2+\x14:U\xb0\xe97\xc3\xe07\x92'), '\x64' + chr(0b1100101) + chr(0b101110 + 0o65) + chr(0b100110 + 0o111) + chr(8341 - 8241) + '\x65')(chr(0b1110101) + chr(116) + '\x66' + chr(0b100 + 0o51) + chr(629 - 573)))(EVVr9bEHclel, EnkgYb3nd7mh % (Bo2bdn6L4dm4, snGgXs7meaot), vfysgEMjyOVL % (Bo2bdn6L4dm4, snGgXs7meaot))
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
_mixed_precision_is_enabled
|
def _mixed_precision_is_enabled(hparams):
"""Should be the same as in common_attention, avoiding import."""
activation_dtype = hparams.activation_dtype
weight_dtype = hparams.weight_dtype
return activation_dtype == tf.float16 and weight_dtype == tf.float32
|
python
|
def _mixed_precision_is_enabled(hparams):
"""Should be the same as in common_attention, avoiding import."""
activation_dtype = hparams.activation_dtype
weight_dtype = hparams.weight_dtype
return activation_dtype == tf.float16 and weight_dtype == tf.float32
|
[
"def",
"_mixed_precision_is_enabled",
"(",
"hparams",
")",
":",
"activation_dtype",
"=",
"hparams",
".",
"activation_dtype",
"weight_dtype",
"=",
"hparams",
".",
"weight_dtype",
"return",
"activation_dtype",
"==",
"tf",
".",
"float16",
"and",
"weight_dtype",
"==",
"tf",
".",
"float32"
] |
Should be the same as in common_attention, avoiding import.
|
[
"Should",
"be",
"the",
"same",
"as",
"in",
"common_attention",
"avoiding",
"import",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L36-L40
|
train
|
Returns True if mixed precision is enabled.
|
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,a9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OQKaLo,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(0b10100 + 0o34) + '\157' + chr(1128 - 1074) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(1836 - 1782), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + chr(0b110001) + chr(0b10100 + 0o37) + chr(229 - 177), ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + '\x34' + chr(733 - 685), 0b1000), ehT0Px3KOsy9(chr(1652 - 1604) + '\x6f' + chr(0b110101) + chr(0b110010 + 0o4), 54188 - 54180), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(1857 - 1746) + chr(49) + chr(0b110 + 0o53) + chr(55), 0b1000), ehT0Px3KOsy9(chr(186 - 138) + chr(0b1101111) + chr(0b110111) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(4873 - 4762) + chr(2473 - 2423) + chr(2015 - 1963) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(8210 - 8099) + chr(50) + chr(0b100000 + 0o23) + chr(0b1000 + 0o52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2666 - 2555) + chr(0b110011) + chr(0b110100) + chr(0b100100 + 0o16), 8786 - 8778), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(1891 - 1836), 28264 - 28256), ehT0Px3KOsy9('\x30' + chr(0b11010 + 0o125) + '\063' + '\x32' + chr(49), 34350 - 34342), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b110011) + '\062', 663 - 655), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b11 + 0o64) + chr(2239 - 2189), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\066', 42162 - 42154), ehT0Px3KOsy9(chr(1376 - 1328) + chr(4646 - 4535) + '\061' + chr(806 - 751) + chr(0b110111), 7482 - 7474), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\061' + chr(0b101010 + 0o11), 0o10), ehT0Px3KOsy9(chr(1538 - 1490) + chr(0b1101111) + chr(0b100110 + 0o13) + chr(1478 - 1424) + chr(840 - 786), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(0b1110 + 0o45) + chr(0b1011 + 0o46) + chr(1214 - 1159), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7645 - 7534) + '\x32' + chr(55) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\065' + chr(0b10101 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(1529 - 1474) + chr(1575 - 1524), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + '\061' + '\x34' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(1792 - 1741) + chr(0b110010) + chr(0b100001 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(1346 - 1298) + chr(2696 - 2585) + chr(49) + chr(0b110010) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(386 - 338) + chr(111) + chr(0b110010) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(5543 - 5432) + '\062' + '\065', 0o10), ehT0Px3KOsy9(chr(2011 - 1963) + chr(0b1101100 + 0o3) + chr(633 - 584) + chr(202 - 154) + chr(0b100000 + 0o20), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(462 - 411) + chr(55) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(9167 - 9056) + chr(1269 - 1218) + chr(0b110010) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4404 - 4293) + chr(0b110010) + chr(0b101111 + 0o1), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(51) + chr(0b100100 + 0o22) + chr(0b110000), 30830 - 30822), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b1101 + 0o47) + chr(0b110101), 50109 - 50101), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(49) + '\x36', 59388 - 59380), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + '\061' + chr(51), 0b1000), ehT0Px3KOsy9(chr(1482 - 1434) + chr(0b1101111) + chr(0b10001 + 0o41) + chr(0b100101 + 0o20), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(2019 - 1969) + '\066' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + '\x35' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010111 + 0o30) + chr(0b11101 + 0o26) + chr(49), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100100 + 0o21) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x19'), chr(0b1100100) + '\x65' + chr(0b101 + 0o136) + chr(0b1101111) + '\144' + chr(2445 - 2344))('\165' + '\164' + chr(102) + chr(0b10010 + 0o33) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def fYFE8kONqxuW(n4ljua2gi1Pr):
n6ZCgJ7AKd3U = n4ljua2gi1Pr.n6ZCgJ7AKd3U
VAEclRm_w3lD = n4ljua2gi1Pr.VAEclRm_w3lD
return n6ZCgJ7AKd3U == xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'Qj3AZ~\t'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(0b111000 + 0o54) + chr(9681 - 9580))('\165' + chr(515 - 399) + chr(0b1100110) + chr(1712 - 1667) + chr(0b111000))) and VAEclRm_w3lD == xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'Qj3AZ|\r'), chr(4803 - 4703) + chr(101) + chr(99) + chr(0b100010 + 0o115) + chr(100) + chr(101))('\x75' + chr(9745 - 9629) + '\x66' + '\055' + chr(787 - 731)))
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
optimize
|
def optimize(loss, learning_rate, hparams, use_tpu=False, variables=None):
"""Minimize loss."""
loss = weight_decay_and_noise(loss, hparams, learning_rate)
loss = tf.identity(loss, name="total_loss")
if variables is None:
variables = tf.trainable_variables()
# Print trainable variables.
log_variable_sizes(variables, verbose=hparams.summarize_vars)
# Print non-trainable variables.
non_trainable_variables = list(
set(tf.global_variables()) - set(variables))
log_variable_sizes(non_trainable_variables, tag="Non-trainable variables",
verbose=hparams.summarize_vars)
if hparams.summarize_vars:
summarize_variables(variables)
# Summarize non-trainable variables as well
summarize_variables(non_trainable_variables, tag="Non-trainable variables")
diet_vars = [
v for v in tf.global_variables() if v.dtype == dtypes.float16_ref
]
log_variable_sizes(
diet_vars, "Diet Variables", verbose=hparams.summarize_vars)
opt = ConditionalOptimizer(hparams.optimizer, learning_rate, hparams, use_tpu)
if use_tpu:
opt = tf.contrib.tpu.CrossShardOptimizer(opt)
opt_summaries = []
if common_layers.should_generate_summaries():
tf.summary.scalar("learning_rate", learning_rate)
opt_summaries.append("loss")
if hparams.summarize_grads:
tf.logging.info("Summarizing gradients")
opt_summaries.extend(
["gradients", "gradient_norm", "global_gradient_norm"])
if hparams.clip_grad_norm:
tf.logging.info("Clipping gradients, norm: %0.5f", hparams.clip_grad_norm)
if hparams.grad_noise_scale:
tf.logging.info("Adding noise to gradients, noise scale: %0.5f",
hparams.grad_noise_scale)
train_op = tf.contrib.layers.optimize_loss(
name="training",
loss=loss,
global_step=tf.train.get_or_create_global_step(),
learning_rate=learning_rate,
clip_gradients=hparams.clip_grad_norm or None,
gradient_noise_scale=hparams.grad_noise_scale or None,
optimizer=opt,
summaries=opt_summaries,
colocate_gradients_with_ops=True,
variables=variables)
return train_op
|
python
|
def optimize(loss, learning_rate, hparams, use_tpu=False, variables=None):
"""Minimize loss."""
loss = weight_decay_and_noise(loss, hparams, learning_rate)
loss = tf.identity(loss, name="total_loss")
if variables is None:
variables = tf.trainable_variables()
# Print trainable variables.
log_variable_sizes(variables, verbose=hparams.summarize_vars)
# Print non-trainable variables.
non_trainable_variables = list(
set(tf.global_variables()) - set(variables))
log_variable_sizes(non_trainable_variables, tag="Non-trainable variables",
verbose=hparams.summarize_vars)
if hparams.summarize_vars:
summarize_variables(variables)
# Summarize non-trainable variables as well
summarize_variables(non_trainable_variables, tag="Non-trainable variables")
diet_vars = [
v for v in tf.global_variables() if v.dtype == dtypes.float16_ref
]
log_variable_sizes(
diet_vars, "Diet Variables", verbose=hparams.summarize_vars)
opt = ConditionalOptimizer(hparams.optimizer, learning_rate, hparams, use_tpu)
if use_tpu:
opt = tf.contrib.tpu.CrossShardOptimizer(opt)
opt_summaries = []
if common_layers.should_generate_summaries():
tf.summary.scalar("learning_rate", learning_rate)
opt_summaries.append("loss")
if hparams.summarize_grads:
tf.logging.info("Summarizing gradients")
opt_summaries.extend(
["gradients", "gradient_norm", "global_gradient_norm"])
if hparams.clip_grad_norm:
tf.logging.info("Clipping gradients, norm: %0.5f", hparams.clip_grad_norm)
if hparams.grad_noise_scale:
tf.logging.info("Adding noise to gradients, noise scale: %0.5f",
hparams.grad_noise_scale)
train_op = tf.contrib.layers.optimize_loss(
name="training",
loss=loss,
global_step=tf.train.get_or_create_global_step(),
learning_rate=learning_rate,
clip_gradients=hparams.clip_grad_norm or None,
gradient_noise_scale=hparams.grad_noise_scale or None,
optimizer=opt,
summaries=opt_summaries,
colocate_gradients_with_ops=True,
variables=variables)
return train_op
|
[
"def",
"optimize",
"(",
"loss",
",",
"learning_rate",
",",
"hparams",
",",
"use_tpu",
"=",
"False",
",",
"variables",
"=",
"None",
")",
":",
"loss",
"=",
"weight_decay_and_noise",
"(",
"loss",
",",
"hparams",
",",
"learning_rate",
")",
"loss",
"=",
"tf",
".",
"identity",
"(",
"loss",
",",
"name",
"=",
"\"total_loss\"",
")",
"if",
"variables",
"is",
"None",
":",
"variables",
"=",
"tf",
".",
"trainable_variables",
"(",
")",
"# Print trainable variables.",
"log_variable_sizes",
"(",
"variables",
",",
"verbose",
"=",
"hparams",
".",
"summarize_vars",
")",
"# Print non-trainable variables.",
"non_trainable_variables",
"=",
"list",
"(",
"set",
"(",
"tf",
".",
"global_variables",
"(",
")",
")",
"-",
"set",
"(",
"variables",
")",
")",
"log_variable_sizes",
"(",
"non_trainable_variables",
",",
"tag",
"=",
"\"Non-trainable variables\"",
",",
"verbose",
"=",
"hparams",
".",
"summarize_vars",
")",
"if",
"hparams",
".",
"summarize_vars",
":",
"summarize_variables",
"(",
"variables",
")",
"# Summarize non-trainable variables as well",
"summarize_variables",
"(",
"non_trainable_variables",
",",
"tag",
"=",
"\"Non-trainable variables\"",
")",
"diet_vars",
"=",
"[",
"v",
"for",
"v",
"in",
"tf",
".",
"global_variables",
"(",
")",
"if",
"v",
".",
"dtype",
"==",
"dtypes",
".",
"float16_ref",
"]",
"log_variable_sizes",
"(",
"diet_vars",
",",
"\"Diet Variables\"",
",",
"verbose",
"=",
"hparams",
".",
"summarize_vars",
")",
"opt",
"=",
"ConditionalOptimizer",
"(",
"hparams",
".",
"optimizer",
",",
"learning_rate",
",",
"hparams",
",",
"use_tpu",
")",
"if",
"use_tpu",
":",
"opt",
"=",
"tf",
".",
"contrib",
".",
"tpu",
".",
"CrossShardOptimizer",
"(",
"opt",
")",
"opt_summaries",
"=",
"[",
"]",
"if",
"common_layers",
".",
"should_generate_summaries",
"(",
")",
":",
"tf",
".",
"summary",
".",
"scalar",
"(",
"\"learning_rate\"",
",",
"learning_rate",
")",
"opt_summaries",
".",
"append",
"(",
"\"loss\"",
")",
"if",
"hparams",
".",
"summarize_grads",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Summarizing gradients\"",
")",
"opt_summaries",
".",
"extend",
"(",
"[",
"\"gradients\"",
",",
"\"gradient_norm\"",
",",
"\"global_gradient_norm\"",
"]",
")",
"if",
"hparams",
".",
"clip_grad_norm",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Clipping gradients, norm: %0.5f\"",
",",
"hparams",
".",
"clip_grad_norm",
")",
"if",
"hparams",
".",
"grad_noise_scale",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Adding noise to gradients, noise scale: %0.5f\"",
",",
"hparams",
".",
"grad_noise_scale",
")",
"train_op",
"=",
"tf",
".",
"contrib",
".",
"layers",
".",
"optimize_loss",
"(",
"name",
"=",
"\"training\"",
",",
"loss",
"=",
"loss",
",",
"global_step",
"=",
"tf",
".",
"train",
".",
"get_or_create_global_step",
"(",
")",
",",
"learning_rate",
"=",
"learning_rate",
",",
"clip_gradients",
"=",
"hparams",
".",
"clip_grad_norm",
"or",
"None",
",",
"gradient_noise_scale",
"=",
"hparams",
".",
"grad_noise_scale",
"or",
"None",
",",
"optimizer",
"=",
"opt",
",",
"summaries",
"=",
"opt_summaries",
",",
"colocate_gradients_with_ops",
"=",
"True",
",",
"variables",
"=",
"variables",
")",
"return",
"train_op"
] |
Minimize loss.
|
[
"Minimize",
"loss",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L43-L94
|
train
|
Minimize 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,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkX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DCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + '\x36' + chr(49), 55136 - 55128), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(52) + chr(0b101 + 0o61), 0o10), ehT0Px3KOsy9('\060' + chr(10247 - 10136) + chr(0b100100 + 0o22) + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(1470 - 1416) + chr(98 - 50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11549 - 11438) + chr(386 - 336) + '\x33' + '\x33', 0b1000), ehT0Px3KOsy9(chr(1558 - 1510) + chr(4573 - 4462) + chr(1376 - 1326) + chr(0b10100 + 0o43) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\067' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110011) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(685 - 634) + chr(0b110011) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(1634 - 1585) + chr(53) + '\066', 0b1000), ehT0Px3KOsy9(chr(2022 - 1974) + '\157' + '\x31' + chr(576 - 523) + '\063', 0o10), ehT0Px3KOsy9(chr(211 - 163) + '\x6f' + '\063' + '\061' + '\x34', 0b1000), ehT0Px3KOsy9(chr(526 - 478) + chr(0b101000 + 0o107) + chr(51) + '\x35' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(737 - 686) + chr(1788 - 1734) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\063' + chr(0b11010 + 0o32) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(1002 - 954) + '\x6f' + chr(1214 - 1164) + chr(0b10011 + 0o37) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1011111 + 0o20) + chr(0b110001) + chr(0b11000 + 0o37) + chr(53), 57141 - 57133), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x33' + chr(1385 - 1335), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1025 - 974) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10011 + 0o40) + chr(0b101111 + 0o4) + '\x32', 3783 - 3775), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(53), 0b1000), ehT0Px3KOsy9(chr(1974 - 1926) + '\x6f' + chr(1129 - 1078) + chr(49) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(736 - 688) + chr(0b1101111) + chr(0b100 + 0o55) + chr(54) + chr(0b110000), 8), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + chr(0b10 + 0o61) + chr(50) + chr(1891 - 1839), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\x36' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(945 - 895) + '\060' + chr(0b1100 + 0o51), 0o10), ehT0Px3KOsy9(chr(1447 - 1399) + chr(1948 - 1837) + chr(0b110011) + chr(53) + chr(0b10101 + 0o42), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(1086 - 1037), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2295 - 2245) + chr(2658 - 2604) + chr(0b11000 + 0o31), ord("\x08")), ehT0Px3KOsy9('\060' + chr(9601 - 9490) + chr(49) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b11110 + 0o121) + chr(1039 - 990) + chr(0b11100 + 0o32) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x32' + chr(0b110110), 18999 - 18991), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(0b100 + 0o55) + '\066' + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101001 + 0o6) + chr(1647 - 1596) + chr(1601 - 1551), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(0b110011) + chr(0b110000) + '\065', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x34' + '\x36', 59382 - 59374), ehT0Px3KOsy9(chr(48) + chr(0b1100001 + 0o16) + '\x32' + chr(55) + chr(0b1111 + 0o42), 8), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + '\062' + '\x33' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\x37' + chr(1864 - 1809), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(672 - 561) + chr(1632 - 1583) + chr(48) + chr(1270 - 1218), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(5701 - 5590) + chr(0b110101) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f'), '\144' + '\x65' + chr(5129 - 5030) + chr(0b1101111) + chr(0b1011 + 0o131) + chr(0b1100101))(chr(5637 - 5520) + chr(0b1110100) + chr(102) + chr(45) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def M4lwI8bLCQGq(YpO0BcZ6fMsf, QGSIpd_yUNzU, n4ljua2gi1Pr, L4eE7kczIJwa=ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 29633 - 29625), DaDu8eJMPmzT=None):
YpO0BcZ6fMsf = PRZZSlumpupG(YpO0BcZ6fMsf, n4ljua2gi1Pr, QGSIpd_yUNzU)
YpO0BcZ6fMsf = IDJ2eXGCBCDu.vFUG5mKXcvYG(YpO0BcZ6fMsf, name=xafqLlk3kkUe(SXOLrMavuUCe(b'E\xc9C\x11\xf7\xe6\x93\xb6\xae\x1d'), '\x64' + '\145' + chr(0b1100011) + chr(111) + '\x64' + chr(6063 - 5962))(chr(0b100100 + 0o121) + chr(116) + chr(0b1100110) + chr(0b100001 + 0o14) + '\x38'))
if DaDu8eJMPmzT is None:
DaDu8eJMPmzT = IDJ2eXGCBCDu.trainable_variables()
RHP3rUMNQZGt(DaDu8eJMPmzT, verbose=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'C\xeb\x7f&\xd4\xd5\x93\xab\x95\x0f\x04\xa3'), chr(0b1100100) + chr(0b101101 + 0o70) + chr(0b1100011) + chr(0b110000 + 0o77) + chr(0b1100100) + '\x65')('\165' + chr(0b1011001 + 0o33) + chr(102) + '\x2d' + chr(1545 - 1489))))
PJXMpvklYX3G = YyaZ4tpXu4lf(MVEN8G6CxlvR(IDJ2eXGCBCDu.global_variables()) - MVEN8G6CxlvR(DaDu8eJMPmzT))
RHP3rUMNQZGt(PJXMpvklYX3G, tag=xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\xc9Y]\xef\xcb\x9e\xb0\xb3\x0f\t\xa0\x8f\xd7\x90\xf6\x0f3~\xb8q\xad\x03'), '\x64' + chr(8495 - 8394) + chr(99) + chr(0b100000 + 0o117) + chr(100) + chr(9075 - 8974))(chr(117) + chr(2057 - 1941) + '\x66' + chr(0b100 + 0o51) + chr(56)), verbose=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'C\xeb\x7f&\xd4\xd5\x93\xab\x95\x0f\x04\xa3'), chr(0b1100100) + chr(101) + '\143' + chr(2989 - 2878) + '\x64' + '\145')('\x75' + chr(7145 - 7029) + chr(0b11010 + 0o114) + '\055' + '\x38')))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'C\xeb\x7f&\xd4\xd5\x93\xab\x95\x0f\x04\xa3'), chr(100) + '\145' + chr(0b1100011) + chr(10719 - 10608) + '\x64' + chr(6758 - 6657))('\x75' + chr(0b1110100) + '\146' + chr(45) + chr(0b1010 + 0o56))):
YZ1slExkkc8U(DaDu8eJMPmzT)
YZ1slExkkc8U(PJXMpvklYX3G, tag=xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\xc9Y]\xef\xcb\x9e\xb0\xb3\x0f\t\xa0\x8f\xd7\x90\xf6\x0f3~\xb8q\xad\x03'), chr(100) + '\145' + '\x63' + chr(0b1101 + 0o142) + '\x64' + chr(0b1100101))(chr(2301 - 2184) + '\164' + chr(102) + chr(45) + chr(0b111000)))
C1FKajHFftyp = [cMbll0QYhULo for cMbll0QYhULo in IDJ2eXGCBCDu.global_variables() if cMbll0QYhULo.jSV9IKnemH7K == povqwBfbr44M.float16_ref]
RHP3rUMNQZGt(C1FKajHFftyp, xafqLlk3kkUe(SXOLrMavuUCe(b'u\xcfR\x04\xbb\xef\x9e\xab\xb4\x0f\t\xa0\x8f\x84'), chr(0b1100100) + chr(0b1100101) + chr(0b1000001 + 0o42) + '\x6f' + '\144' + chr(0b1001111 + 0o26))(chr(6419 - 6302) + chr(6596 - 6480) + chr(0b110 + 0o140) + chr(45) + chr(0b111000)), verbose=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'C\xeb\x7f&\xd4\xd5\x93\xab\x95\x0f\x04\xa3'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b1010111 + 0o30) + chr(100) + '\x65')(chr(0b111010 + 0o73) + '\x74' + '\x66' + chr(650 - 605) + '\070')))
PFDxXM_vbSsA = mHsColAXdoTf(n4ljua2gi1Pr.XdKNcYRObPK3, QGSIpd_yUNzU, n4ljua2gi1Pr, L4eE7kczIJwa)
if L4eE7kczIJwa:
PFDxXM_vbSsA = IDJ2eXGCBCDu.contrib.tpu.CrossShardOptimizer(PFDxXM_vbSsA)
qP0DEWL1dvRK = []
if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'B\xceX\x05\xf7\xdd\xa0\xbe\xb8\x00\x0e\xbe\x8b\x83\x83\xc8\x0e/r\xb7|\xba\x19\xb1\x83'), '\144' + chr(101) + chr(0b1100011) + chr(111) + '\x64' + '\x65')(chr(0b1110101) + '\164' + chr(5663 - 5561) + '\055' + '\070'))():
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'B\xc5V\x1c\xfa\xcb'), '\x64' + chr(906 - 805) + chr(1738 - 1639) + chr(9070 - 8959) + chr(2625 - 2525) + '\x65')(chr(117) + chr(116) + '\x66' + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b']\xc3V\x02\xf5\xd0\x91\xbe\x82\x1c\n\xb8\x8f'), chr(0b1100100) + chr(2513 - 2412) + '\143' + chr(0b1101111) + '\x64' + chr(0b110000 + 0o65))(chr(0b1110101) + '\164' + chr(5766 - 5664) + chr(0b101101) + '\070'), QGSIpd_yUNzU)
xafqLlk3kkUe(qP0DEWL1dvRK, xafqLlk3kkUe(SXOLrMavuUCe(b'P\xd6G\x15\xf5\xdd'), chr(100) + chr(1627 - 1526) + chr(0b1100011) + chr(0b11001 + 0o126) + chr(0b1100100) + '\x65')(chr(12562 - 12445) + '\164' + chr(0b110110 + 0o60) + '\x2d' + chr(368 - 312)))(xafqLlk3kkUe(SXOLrMavuUCe(b']\xc9D\x03'), chr(0b1001010 + 0o32) + chr(1616 - 1515) + chr(99) + '\x6f' + chr(100) + '\145')(chr(0b1110101) + chr(8312 - 8196) + chr(0b11 + 0o143) + chr(0b10100 + 0o31) + '\070'))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'V\x97t;\xd1\xeb\xcf\x81\xe97#\xa1'), chr(0b1010101 + 0o17) + chr(0b1100101) + chr(308 - 209) + chr(0b1 + 0o156) + chr(5294 - 5194) + chr(5753 - 5652))(chr(0b1110101) + '\164' + chr(5552 - 5450) + chr(45) + chr(0b11111 + 0o31))):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'b\x91\x7f\x08\xee\xda\x98\xee\xb7\x021\xa7'), chr(0b1100100) + chr(0b100110 + 0o77) + '\x63' + chr(0b10101 + 0o132) + chr(2516 - 2416) + chr(4264 - 4163))(chr(117) + chr(4467 - 4351) + '\146' + chr(0b100000 + 0o15) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'b\xd3Z\x1d\xfa\xcb\x96\xa3\xb4\x00\x0c\xec\x8d\x85\x87\xf3\x14?q\xaen'), '\x64' + chr(0b110101 + 0o60) + '\143' + '\x6f' + chr(0b1100100) + '\145')(chr(0b1101010 + 0o13) + '\164' + chr(0b111110 + 0o50) + chr(0b101101) + '\070'))
xafqLlk3kkUe(qP0DEWL1dvRK, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xdeC\x15\xf5\xdd'), chr(100) + chr(0b110111 + 0o56) + '\143' + chr(0b1101111) + '\x64' + '\x65')('\165' + chr(9862 - 9746) + chr(0b1110 + 0o130) + chr(0b1 + 0o54) + chr(2140 - 2084)))([xafqLlk3kkUe(SXOLrMavuUCe(b'V\xd4V\x14\xf2\xdc\x91\xad\xae'), '\144' + chr(7774 - 7673) + '\x63' + '\x6f' + chr(6863 - 6763) + chr(0b1 + 0o144))('\x75' + chr(0b1011101 + 0o27) + chr(0b1100110) + '\055' + chr(0b101101 + 0o13)), xafqLlk3kkUe(SXOLrMavuUCe(b'V\xd4V\x14\xf2\xdc\x91\xad\x82\x00\x04\xbe\x87'), '\x64' + '\x65' + '\143' + chr(6422 - 6311) + chr(100) + chr(0b1011110 + 0o7))(chr(117) + chr(0b1110100) + chr(9608 - 9506) + chr(0b1111 + 0o36) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'V\xcaX\x12\xfa\xd5\xa0\xbe\xaf\x0f\x0f\xa5\x8f\x99\x92\xc8\x135m\xb7'), '\144' + chr(1993 - 1892) + chr(0b110110 + 0o55) + chr(7876 - 7765) + chr(0b100110 + 0o76) + chr(101))(chr(117) + chr(0b1100101 + 0o17) + chr(0b1011100 + 0o12) + chr(45) + chr(1275 - 1219))])
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b"b\xc2y#\xc1\xf7\xa9\xb2\x8b\x04'\xa4"), chr(100) + chr(0b1100101) + chr(396 - 297) + chr(0b1101111) + '\144' + chr(9131 - 9030))(chr(0b1110101) + '\x74' + chr(102) + chr(802 - 757) + '\070')):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'b\x91\x7f\x08\xee\xda\x98\xee\xb7\x021\xa7'), chr(0b1100000 + 0o4) + chr(0b1011110 + 0o7) + '\x63' + chr(0b1010101 + 0o32) + chr(0b1100100) + '\145')(chr(13634 - 13517) + chr(0b1110100) + chr(1129 - 1027) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'r\xca^\x00\xeb\xd0\x91\xbe\xfd\t\x19\xad\x8e\x9e\x83\xf9\t)3\xfas\xa7\x02\xb9\xca\xa5\xca!\x9f?\x11'), chr(5995 - 5895) + chr(101) + chr(99) + chr(0b1101111) + '\144' + '\x65')(chr(7525 - 7408) + '\x74' + chr(102) + chr(1080 - 1035) + '\070'), xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b"b\xc2y#\xc1\xf7\xa9\xb2\x8b\x04'\xa4"), '\144' + chr(0b100101 + 0o100) + chr(1801 - 1702) + '\157' + '\x64' + chr(8308 - 8207))('\x75' + chr(0b10101 + 0o137) + chr(0b1001010 + 0o34) + chr(0b101011 + 0o2) + chr(56))))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xd4V\x14\xc4\xd7\x90\xb0\xae\x0b4\xbf\x89\x96\x8a\xf2'), chr(5136 - 5036) + chr(101) + chr(99) + chr(0b1101111) + chr(0b100011 + 0o101) + chr(443 - 342))(chr(0b1110101) + chr(0b1110100) + chr(0b1001001 + 0o35) + chr(512 - 467) + chr(3114 - 3058))):
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'b\x91\x7f\x08\xee\xda\x98\xee\xb7\x021\xa7'), '\x64' + chr(5268 - 5167) + chr(5773 - 5674) + chr(0b1000100 + 0o53) + '\144' + chr(7997 - 7896))(chr(0b1001011 + 0o52) + chr(1090 - 974) + chr(0b1100110) + chr(0b101101) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'p\xc2S\x19\xf5\xde\xdf\xb7\xb2\x07\x18\xa9\xca\x83\x89\xb7\x1a(~\xbet\xad\x1e\xa0\x83\xa9\xcf\x7f\xdec\x04\xb3Ti\xa6G\xd5\xfd\x85d\x14\x96\x19E\xfd'), chr(0b1100000 + 0o4) + chr(101) + '\x63' + '\157' + '\144' + chr(0b1001000 + 0o35))(chr(0b1110101) + chr(0b1111 + 0o145) + chr(0b1000100 + 0o42) + chr(45) + chr(0b111000)), xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'V\xd4V\x14\xc4\xd7\x90\xb0\xae\x0b4\xbf\x89\x96\x8a\xf2'), chr(2839 - 2739) + '\x65' + chr(9456 - 9357) + chr(0b1011011 + 0o24) + chr(0b1110 + 0o126) + chr(101))('\x75' + chr(0b1101011 + 0o11) + chr(0b1100110) + chr(0b101101) + chr(56))))
_sRzZqw7qhHl = IDJ2eXGCBCDu.contrib.layers.optimize_loss(name=xafqLlk3kkUe(SXOLrMavuUCe(b'E\xd4V\x19\xf5\xd0\x91\xbe'), chr(0b1100100) + '\145' + chr(0b1100011 + 0o0) + chr(111) + chr(100) + chr(1664 - 1563))(chr(0b1010011 + 0o42) + '\x74' + chr(102) + '\055' + '\x38'), loss=YpO0BcZ6fMsf, global_step=IDJ2eXGCBCDu.train.get_or_create_global_step(), learning_rate=QGSIpd_yUNzU, clip_gradients=n4ljua2gi1Pr.SdNSZNVkVjLh or None, gradient_noise_scale=n4ljua2gi1Pr.grad_noise_scale or None, optimizer=PFDxXM_vbSsA, summaries=qP0DEWL1dvRK, colocate_gradients_with_ops=ehT0Px3KOsy9(chr(532 - 484) + chr(0b1101111) + chr(0b11000 + 0o31), 60398 - 60390), variables=DaDu8eJMPmzT)
return _sRzZqw7qhHl
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
weight_decay_and_noise
|
def weight_decay_and_noise(loss, hparams, learning_rate, var_list=None):
"""Apply weight decay and weight noise."""
if var_list is None:
var_list = tf.trainable_variables()
decay_vars = [v for v in var_list]
noise_vars = [v for v in var_list if "/body/" in v.name]
weight_decay_loss = weight_decay(hparams.weight_decay, decay_vars)
if hparams.weight_decay and common_layers.should_generate_summaries():
tf.summary.scalar("losses/weight_decay", weight_decay_loss)
weight_noise_ops = weight_noise(hparams.weight_noise, learning_rate,
noise_vars)
with tf.control_dependencies(weight_noise_ops):
loss = tf.identity(loss)
loss += weight_decay_loss
return loss
|
python
|
def weight_decay_and_noise(loss, hparams, learning_rate, var_list=None):
"""Apply weight decay and weight noise."""
if var_list is None:
var_list = tf.trainable_variables()
decay_vars = [v for v in var_list]
noise_vars = [v for v in var_list if "/body/" in v.name]
weight_decay_loss = weight_decay(hparams.weight_decay, decay_vars)
if hparams.weight_decay and common_layers.should_generate_summaries():
tf.summary.scalar("losses/weight_decay", weight_decay_loss)
weight_noise_ops = weight_noise(hparams.weight_noise, learning_rate,
noise_vars)
with tf.control_dependencies(weight_noise_ops):
loss = tf.identity(loss)
loss += weight_decay_loss
return loss
|
[
"def",
"weight_decay_and_noise",
"(",
"loss",
",",
"hparams",
",",
"learning_rate",
",",
"var_list",
"=",
"None",
")",
":",
"if",
"var_list",
"is",
"None",
":",
"var_list",
"=",
"tf",
".",
"trainable_variables",
"(",
")",
"decay_vars",
"=",
"[",
"v",
"for",
"v",
"in",
"var_list",
"]",
"noise_vars",
"=",
"[",
"v",
"for",
"v",
"in",
"var_list",
"if",
"\"/body/\"",
"in",
"v",
".",
"name",
"]",
"weight_decay_loss",
"=",
"weight_decay",
"(",
"hparams",
".",
"weight_decay",
",",
"decay_vars",
")",
"if",
"hparams",
".",
"weight_decay",
"and",
"common_layers",
".",
"should_generate_summaries",
"(",
")",
":",
"tf",
".",
"summary",
".",
"scalar",
"(",
"\"losses/weight_decay\"",
",",
"weight_decay_loss",
")",
"weight_noise_ops",
"=",
"weight_noise",
"(",
"hparams",
".",
"weight_noise",
",",
"learning_rate",
",",
"noise_vars",
")",
"with",
"tf",
".",
"control_dependencies",
"(",
"weight_noise_ops",
")",
":",
"loss",
"=",
"tf",
".",
"identity",
"(",
"loss",
")",
"loss",
"+=",
"weight_decay_loss",
"return",
"loss"
] |
Apply weight decay and weight noise.
|
[
"Apply",
"weight",
"decay",
"and",
"weight",
"noise",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L238-L256
|
train
|
Apply weight decay and weight noise.
|
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,hIlP7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qw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(4990 - 4879) + '\066' + chr(1787 - 1739), 42480 - 42472), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(2116 - 2063) + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + chr(1667 - 1618) + chr(0b110111) + chr(0b101001 + 0o11), 55960 - 55952), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\064' + '\064', 29165 - 29157), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + chr(0b110010) + chr(0b10 + 0o57) + '\x35', 22349 - 22341), ehT0Px3KOsy9(chr(2048 - 2000) + '\x6f' + chr(0b110010) + '\x31' + '\x33', 56010 - 56002), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b110000) + chr(1059 - 1005), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + '\x31' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(2020 - 1965) + '\x36', 45766 - 45758), ehT0Px3KOsy9(chr(48) + chr(0b1100111 + 0o10) + chr(49) + chr(52) + chr(589 - 541), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11101 + 0o25) + chr(0b1010 + 0o46) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\063' + chr(0b101001 + 0o11), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\x34' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b110001) + '\065' + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11111 + 0o27) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(51) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + '\x32' + chr(54) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11000 + 0o127) + chr(51) + '\x36' + chr(0b110011), 21502 - 21494), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10001 + 0o40) + '\061' + chr(0b101 + 0o55), 35196 - 35188), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\067' + chr(54), 53073 - 53065), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(111) + chr(0b110010) + '\x36', 17333 - 17325), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(49) + chr(2522 - 2467) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1818 - 1768) + chr(0b10111 + 0o31) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(55) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1866 - 1818) + chr(0b10100 + 0o133) + '\062' + chr(0b110100) + '\x37', 0o10), ehT0Px3KOsy9(chr(816 - 768) + '\x6f' + chr(0b110100) + chr(0b110110), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11111 + 0o24), 0o10), ehT0Px3KOsy9(chr(1200 - 1152) + '\157' + '\061' + chr(53) + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(0b1110 + 0o141) + '\063' + chr(52) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(54) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1388 - 1277) + chr(0b110101) + '\064', 28354 - 28346), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101001 + 0o6) + '\x31' + chr(54) + '\x37', 0o10), ehT0Px3KOsy9(chr(665 - 617) + '\x6f' + chr(49) + chr(51) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(0b110101 + 0o0) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + chr(0b110001) + '\060' + chr(49), 29004 - 28996), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(6231 - 6120) + '\063' + chr(405 - 357) + chr(0b110101), 19951 - 19943), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b110101 + 0o2) + '\066', 8), ehT0Px3KOsy9('\x30' + chr(2112 - 2001) + chr(49) + chr(55) + '\060', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b100011 + 0o16) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1010111 + 0o30) + chr(454 - 403) + '\067' + chr(0b101010 + 0o12), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001 + 0o4) + chr(0b10000 + 0o40), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e'), '\x64' + chr(0b10010 + 0o123) + '\143' + chr(0b1010010 + 0o35) + chr(100) + chr(101))(chr(857 - 740) + chr(12467 - 12351) + chr(0b110101 + 0o61) + chr(0b101101) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def PRZZSlumpupG(YpO0BcZ6fMsf, n4ljua2gi1Pr, QGSIpd_yUNzU, WjzhQmqLR1lh=None):
if WjzhQmqLR1lh is None:
WjzhQmqLR1lh = IDJ2eXGCBCDu.trainable_variables()
DL1qghfJGGpz = [cMbll0QYhULo for cMbll0QYhULo in WjzhQmqLR1lh]
FWCC7Q_4sL6v = [cMbll0QYhULo for cMbll0QYhULo in WjzhQmqLR1lh if xafqLlk3kkUe(SXOLrMavuUCe(b'\x1fK\x15\x80\xf4\xa4'), '\144' + chr(0b1100010 + 0o3) + chr(99) + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + chr(0b111111 + 0o65) + chr(102) + '\x2d' + '\070') in cMbll0QYhULo.AIvJRzLdDfgF]
w0GIefbbSnQb = eB4rJl6fUxw9(n4ljua2gi1Pr.eB4rJl6fUxw9, DL1qghfJGGpz)
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'UkN\x96\xc7\xe7\xf0m\xeb\x18\xf5\xe3'), chr(0b10111 + 0o115) + chr(3702 - 3601) + chr(0b1010000 + 0o23) + chr(11359 - 11248) + '\x64' + '\145')('\x75' + chr(0b1010000 + 0o44) + chr(0b1010110 + 0o20) + chr(0b1110 + 0o37) + '\070')) and xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b"CA\x15\x91\xe1\xef\x99l\xdb\x0e\xe7\xa8G\x18W\xc7\xc4\x86'\x13w\n\xef\x9f\xd4"), chr(0b1100100) + chr(0b110 + 0o137) + '\x63' + chr(0b1011011 + 0o24) + '\x64' + '\145')(chr(117) + '\164' + '\146' + chr(0b101101) + '\x38'))():
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'CJ\x1b\x88\xec\xf9'), chr(0b1100100) + '\x65' + '\143' + chr(111) + '\144' + chr(0b1100101))(chr(117) + chr(1348 - 1232) + chr(0b110100 + 0o62) + chr(0b101101) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\\F\t\x97\xe8\xf8\xe9|\xdb\t\xe5\xb2R3V\xfd\xd4\x923'), '\144' + '\145' + '\143' + chr(743 - 632) + chr(0b1100100) + chr(884 - 783))('\x75' + chr(116) + chr(102) + chr(45) + chr(56)), w0GIefbbSnQb)
I4n3EG0qHdVx = Tu70xZ3oeL7h(n4ljua2gi1Pr.weight_noise, QGSIpd_yUNzU, FWCC7Q_4sL6v)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'SF\x14\x90\xff\xe4\xaaT\xda\x05\xf2\xbfH\x08W\xf6\xd4\x9a/\r'), chr(100) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + chr(0b11100 + 0o111))(chr(5988 - 5871) + chr(116) + chr(0b1100110) + chr(0b101 + 0o50) + chr(56)))(I4n3EG0qHdVx):
YpO0BcZ6fMsf = IDJ2eXGCBCDu.vFUG5mKXcvYG(YpO0BcZ6fMsf)
YpO0BcZ6fMsf += w0GIefbbSnQb
return YpO0BcZ6fMsf
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
weight_noise
|
def weight_noise(noise_rate, learning_rate, var_list):
"""Apply weight noise to vars in var_list."""
if not noise_rate:
return [tf.no_op()]
tf.logging.info("Applying weight noise scaled by learning rate, "
"noise_rate: %0.5f", noise_rate)
noise_ops = []
for v in var_list:
with tf.device(v.device): # pylint: disable=protected-access
scale = noise_rate * learning_rate * 0.001
if common_layers.should_generate_summaries():
tf.summary.scalar("weight_noise_scale", scale)
noise = tf.truncated_normal(v.shape) * scale
noise_op = v.assign_add(noise)
noise_ops.append(noise_op)
return noise_ops
|
python
|
def weight_noise(noise_rate, learning_rate, var_list):
"""Apply weight noise to vars in var_list."""
if not noise_rate:
return [tf.no_op()]
tf.logging.info("Applying weight noise scaled by learning rate, "
"noise_rate: %0.5f", noise_rate)
noise_ops = []
for v in var_list:
with tf.device(v.device): # pylint: disable=protected-access
scale = noise_rate * learning_rate * 0.001
if common_layers.should_generate_summaries():
tf.summary.scalar("weight_noise_scale", scale)
noise = tf.truncated_normal(v.shape) * scale
noise_op = v.assign_add(noise)
noise_ops.append(noise_op)
return noise_ops
|
[
"def",
"weight_noise",
"(",
"noise_rate",
",",
"learning_rate",
",",
"var_list",
")",
":",
"if",
"not",
"noise_rate",
":",
"return",
"[",
"tf",
".",
"no_op",
"(",
")",
"]",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Applying weight noise scaled by learning rate, \"",
"\"noise_rate: %0.5f\"",
",",
"noise_rate",
")",
"noise_ops",
"=",
"[",
"]",
"for",
"v",
"in",
"var_list",
":",
"with",
"tf",
".",
"device",
"(",
"v",
".",
"device",
")",
":",
"# pylint: disable=protected-access",
"scale",
"=",
"noise_rate",
"*",
"learning_rate",
"*",
"0.001",
"if",
"common_layers",
".",
"should_generate_summaries",
"(",
")",
":",
"tf",
".",
"summary",
".",
"scalar",
"(",
"\"weight_noise_scale\"",
",",
"scale",
")",
"noise",
"=",
"tf",
".",
"truncated_normal",
"(",
"v",
".",
"shape",
")",
"*",
"scale",
"noise_op",
"=",
"v",
".",
"assign_add",
"(",
"noise",
")",
"noise_ops",
".",
"append",
"(",
"noise_op",
")",
"return",
"noise_ops"
] |
Apply weight noise to vars in var_list.
|
[
"Apply",
"weight",
"noise",
"to",
"vars",
"in",
"var_list",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272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NK2y6HRbn,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(1771 - 1722) + chr(52) + chr(1294 - 1241), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(9111 - 9000) + chr(50) + chr(51) + chr(0b100 + 0o56), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(51) + chr(0b101111 + 0o3), 8), ehT0Px3KOsy9(chr(621 - 573) + chr(0b1101111) + chr(51) + chr(53) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(51) + chr(1337 - 1284) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(396 - 348) + '\x6f' + '\x31' + chr(222 - 169) + chr(0b100111 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1011011 + 0o24) + chr(49) + chr(489 - 434) + chr(1274 - 1219), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10111 + 0o130) + chr(0b110110) + chr(0b10011 + 0o44), 42249 - 42241), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(2138 - 2087) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(54) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x35' + '\x31', 8), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(728 - 676), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(54) + chr(1116 - 1065), 34739 - 34731), ehT0Px3KOsy9(chr(0b110000) + chr(3555 - 3444) + chr(51) + '\065' + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(5446 - 5335) + chr(0b110001) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + '\x32' + '\x36' + chr(0b1110 + 0o46), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\x30' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(953 - 905) + chr(0b1101111) + chr(2088 - 2037) + chr(52) + chr(53), 48649 - 48641), ehT0Px3KOsy9('\060' + '\157' + '\x36' + '\060', 0o10), ehT0Px3KOsy9(chr(872 - 824) + chr(0b1101111) + '\063' + chr(0b101000 + 0o14) + '\067', 9036 - 9028), ehT0Px3KOsy9('\x30' + '\x6f' + '\067' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(1589 - 1541) + chr(0b101011 + 0o104) + chr(0b110001) + '\x37' + chr(663 - 609), 0o10), ehT0Px3KOsy9(chr(1931 - 1883) + '\157' + chr(0b10110 + 0o35) + chr(0b110011) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10111 + 0o33) + chr(52) + chr(1467 - 1418), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(791 - 740) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7303 - 7192) + chr(49) + chr(0b110000) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(2416 - 2366) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(136 - 88) + '\x6f' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1452 - 1404) + chr(6164 - 6053) + chr(0b100001 + 0o22) + '\x30' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b10001 + 0o40) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + '\x35' + '\x30', 15297 - 15289), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(1117 - 1066) + chr(718 - 664), 0b1000), ehT0Px3KOsy9('\060' + chr(5442 - 5331) + chr(51) + chr(52) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10000 + 0o43) + '\x31' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\065' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(656 - 608) + chr(5680 - 5569) + chr(1405 - 1356) + chr(0b101001 + 0o12) + '\x31', 45033 - 45025), ehT0Px3KOsy9('\x30' + chr(1200 - 1089) + chr(318 - 265) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(798 - 750) + '\157' + chr(0b10101 + 0o36) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7388 - 7277) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(754 - 706) + chr(2550 - 2439) + '\x31' + chr(0b110111) + chr(51), 54660 - 54652)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(641 - 593) + chr(8443 - 8332) + chr(0b110101) + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'K'), chr(2161 - 2061) + chr(0b1100101) + chr(916 - 817) + chr(0b1101111) + chr(100) + chr(0b10110 + 0o117))('\x75' + chr(10219 - 10103) + chr(0b1100110) + chr(0b1010 + 0o43) + chr(1260 - 1204)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Tu70xZ3oeL7h(uqkQ4w4yW3fv, QGSIpd_yUNzU, WjzhQmqLR1lh):
if not uqkQ4w4yW3fv:
return [xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xf5\xc5\x86\x9f'), chr(100) + chr(0b11 + 0o142) + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1100001 + 0o24) + chr(0b1001011 + 0o51) + chr(0b1100010 + 0o4) + chr(0b100100 + 0o11) + chr(700 - 644)))()]
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'6\xad\xd2\x91\x9a\x0e\x18\x00t\x98\xb3o'), chr(100) + chr(0b1100101) + chr(0b111110 + 0o45) + chr(0b1101111) + '\144' + '\145')(chr(0b1000 + 0o155) + '\x74' + chr(0b100111 + 0o77) + chr(1561 - 1516) + chr(0b100000 + 0o30)))(xafqLlk3kkUe(SXOLrMavuUCe(b'$\xea\xea\x85\x96\x04\x11P>\x83\x8cm\x14\x85\x7f\x94\xe9\x8aY\x94\\^\xad\xc2|-5c\xe2\xefQ\xbe\x8f\xa8N+Gvn\x1cE\xe8\xfb\x9d\x8aA_Yq\x9d\x9aa,\x9fj\xc0\xe2\xdf\x10\xc2\tP\xeb\xc7'), '\144' + chr(3081 - 2980) + '\x63' + chr(0b1000010 + 0o55) + chr(0b101110 + 0o66) + '\145')(chr(0b11110 + 0o127) + '\x74' + '\146' + chr(0b11110 + 0o17) + '\070'), uqkQ4w4yW3fv)
DWS_xJNg4ZJ0 = []
for cMbll0QYhULo in WjzhQmqLR1lh:
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\xff\xec\x80\x8c\x08'), chr(100) + chr(585 - 484) + '\x63' + chr(2765 - 2654) + '\144' + chr(5820 - 5719))('\x75' + chr(116) + chr(102) + chr(0b10100 + 0o31) + chr(1978 - 1922)))(xafqLlk3kkUe(cMbll0QYhULo, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\xff\xec\x80\x8c\x08'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(0b101001 + 0o74))(chr(0b1110101) + '\x74' + chr(102) + chr(45) + chr(2284 - 2228)))):
xjPLimsZRgb9 = uqkQ4w4yW3fv * QGSIpd_yUNzU * 0.001
if xafqLlk3kkUe(jSKPaHwSAfVv, xafqLlk3kkUe(SXOLrMavuUCe(b'\x16\xf2\xf5\x9c\x83\t P{\x9a\x8cv\x12\x99n\xeb\xf4\x90]\x8aX\x0c\xb7\xc4n'), '\144' + chr(4638 - 4537) + chr(99) + chr(111) + '\x64' + '\145')(chr(117) + chr(8805 - 8689) + chr(0b1100110) + chr(45) + '\070'))():
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\x16\xf9\xfb\x85\x8e\x1f'), chr(0b1100100) + chr(101) + chr(99) + chr(0b10011 + 0o134) + chr(0b1100100) + '\x65')(chr(0b11111 + 0o126) + '\x74' + chr(0b1100110) + chr(1292 - 1247) + chr(319 - 263)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\xff\xf3\x8e\x87\x19 Yq\x9d\x9aa,\x9eh\xd5\xeb\x80'), '\144' + '\x65' + '\143' + '\157' + '\x64' + chr(0b1100101))(chr(117) + chr(116) + chr(1396 - 1294) + chr(0b1000 + 0o45) + chr(56)), xjPLimsZRgb9)
MudPQU2D1pmv = IDJ2eXGCBCDu.truncated_normal(cMbll0QYhULo.nauYfLglTpcb) * xjPLimsZRgb9
B1HjdZtjHLgD = cMbll0QYhULo.assign_add(MudPQU2D1pmv)
xafqLlk3kkUe(DWS_xJNg4ZJ0, xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\xea\xea\x8c\x81\t'), chr(0b1100100) + '\145' + chr(0b101111 + 0o64) + chr(0b1000101 + 0o52) + '\144' + chr(0b100110 + 0o77))(chr(0b110 + 0o157) + '\x74' + chr(102) + chr(0b101101) + chr(0b1011 + 0o55)))(B1HjdZtjHLgD)
return DWS_xJNg4ZJ0
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
weight_decay
|
def weight_decay(decay_rate, var_list, skip_biases=True):
"""Apply weight decay to vars in var_list."""
if not decay_rate:
return 0.
tf.logging.info("Applying weight decay, decay_rate: %0.5f", decay_rate)
weight_decays = []
for v in var_list:
# Weight decay.
# This is a heuristic way to detect biases that works for main tf.layers.
is_bias = len(v.shape.as_list()) == 1 and v.name.endswith("bias:0")
if not (skip_biases and is_bias):
with tf.device(v.device):
v_loss = tf.nn.l2_loss(v)
weight_decays.append(v_loss)
return tf.add_n(weight_decays) * decay_rate
|
python
|
def weight_decay(decay_rate, var_list, skip_biases=True):
"""Apply weight decay to vars in var_list."""
if not decay_rate:
return 0.
tf.logging.info("Applying weight decay, decay_rate: %0.5f", decay_rate)
weight_decays = []
for v in var_list:
# Weight decay.
# This is a heuristic way to detect biases that works for main tf.layers.
is_bias = len(v.shape.as_list()) == 1 and v.name.endswith("bias:0")
if not (skip_biases and is_bias):
with tf.device(v.device):
v_loss = tf.nn.l2_loss(v)
weight_decays.append(v_loss)
return tf.add_n(weight_decays) * decay_rate
|
[
"def",
"weight_decay",
"(",
"decay_rate",
",",
"var_list",
",",
"skip_biases",
"=",
"True",
")",
":",
"if",
"not",
"decay_rate",
":",
"return",
"0.",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Applying weight decay, decay_rate: %0.5f\"",
",",
"decay_rate",
")",
"weight_decays",
"=",
"[",
"]",
"for",
"v",
"in",
"var_list",
":",
"# Weight decay.",
"# This is a heuristic way to detect biases that works for main tf.layers.",
"is_bias",
"=",
"len",
"(",
"v",
".",
"shape",
".",
"as_list",
"(",
")",
")",
"==",
"1",
"and",
"v",
".",
"name",
".",
"endswith",
"(",
"\"bias:0\"",
")",
"if",
"not",
"(",
"skip_biases",
"and",
"is_bias",
")",
":",
"with",
"tf",
".",
"device",
"(",
"v",
".",
"device",
")",
":",
"v_loss",
"=",
"tf",
".",
"nn",
".",
"l2_loss",
"(",
"v",
")",
"weight_decays",
".",
"append",
"(",
"v_loss",
")",
"return",
"tf",
".",
"add_n",
"(",
"weight_decays",
")",
"*",
"decay_rate"
] |
Apply weight decay to vars in var_list.
|
[
"Apply",
"weight",
"decay",
"to",
"vars",
"in",
"var_list",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L281-L298
|
train
|
Apply weight decay to vars in var_list.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5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ttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,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(0b10110 + 0o32) + chr(111) + chr(51) + '\x35' + chr(1603 - 1553), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\061' + chr(0b100010 + 0o24), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\062' + '\060' + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + '\066' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100110 + 0o111) + chr(0b110001 + 0o1) + chr(675 - 627) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(4859 - 4748) + '\x32' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + '\061' + '\066' + '\064', 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + chr(0b11110 + 0o23) + '\062' + '\061', 57765 - 57757), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1121 - 1071) + '\x37' + chr(1952 - 1904), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(50) + '\060' + chr(2454 - 2403), 0b1000), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + chr(0b1110 + 0o44) + chr(53) + '\x34', 13265 - 13257), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b101110 + 0o101) + chr(0b10 + 0o57) + chr(0b10011 + 0o44) + chr(123 - 70), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(10797 - 10686) + '\x33' + chr(1448 - 1400) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b1111 + 0o43) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101110 + 0o101) + '\x32' + chr(51) + chr(2018 - 1968), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(190 - 139) + chr(0b11111 + 0o21) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000001 + 0o56) + '\063' + chr(796 - 747) + chr(49), 1076 - 1068), ehT0Px3KOsy9('\060' + chr(111) + chr(2039 - 1990) + chr(706 - 653) + chr(1310 - 1260), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1478 - 1367) + chr(51) + chr(1011 - 963) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + chr(51) + chr(2593 - 2539), 30483 - 30475), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(0b110011) + chr(0b110000), 21192 - 21184), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1490 - 1437) + chr(0b1 + 0o60), 0o10), ehT0Px3KOsy9('\x30' + chr(9055 - 8944) + chr(0b110011) + chr(0b110101) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x35' + chr(0b110101), 39947 - 39939), ehT0Px3KOsy9(chr(0b110000) + chr(11423 - 11312) + chr(49) + chr(0b110001) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10100 + 0o133) + chr(51) + '\x30' + '\x33', 24360 - 24352), ehT0Px3KOsy9(chr(1159 - 1111) + '\x6f' + '\x32' + chr(0b110001) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\x34' + chr(0b110010 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(2054 - 2006) + chr(0b1010011 + 0o34) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(439 - 328) + chr(0b10110 + 0o34) + '\x37' + chr(49), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x32' + '\x33', 54404 - 54396), ehT0Px3KOsy9(chr(1212 - 1164) + chr(0b1101111) + chr(1698 - 1647) + chr(2135 - 2083) + chr(0b101101 + 0o3), 13530 - 13522), ehT0Px3KOsy9('\060' + chr(0b1100100 + 0o13) + chr(0b110001) + chr(0b110100) + chr(1729 - 1675), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b110111) + chr(457 - 409), 8), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b111110 + 0o61) + chr(0b110001) + chr(53) + chr(0b100001 + 0o22), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(0b101 + 0o55) + '\x35' + '\066', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + '\065' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5577 - 5466) + '\x33' + '\x33' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b1111 + 0o43) + chr(1979 - 1930) + chr(490 - 439), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110100) + '\064', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(141 - 93) + '\157' + chr(1586 - 1533) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4'), chr(8347 - 8247) + '\145' + chr(480 - 381) + '\x6f' + '\144' + chr(0b1100101))(chr(8063 - 7946) + '\164' + chr(102) + chr(0b101000 + 0o5) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def eB4rJl6fUxw9(ysg2zuLaUZLS, WjzhQmqLR1lh, R2_rT8tSEO50=ehT0Px3KOsy9(chr(48) + chr(0b1101101 + 0o2) + chr(0b100110 + 0o13), 8)):
if not ysg2zuLaUZLS:
return 0.0
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xf9\xce\x0c\xf5r\x13f\xd2\xef\xf6\x16'), chr(0b1001010 + 0o32) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(1139 - 1039) + chr(0b111 + 0o136))(chr(13149 - 13032) + chr(0b101111 + 0o105) + chr(102) + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xab\xbe\xf6\x18\xf9x\x1a6\x98\xf4\xc9\x14\xa18\xee\xe0\xad\x0f\xa6\x7fa\x05\xcdI,\xa0\xea\x1e^\xcbr\x94\x03\x82K\x8b\xdf\xf4\xbeB'), '\144' + chr(0b1100101) + '\x63' + '\157' + '\144' + chr(101))(chr(9665 - 9548) + '\x74' + '\x66' + chr(45) + chr(1878 - 1822)), ysg2zuLaUZLS)
Q_yyewEyECai = []
for cMbll0QYhULo in WjzhQmqLR1lh:
qOafAaMHKZ73 = c2A0yzQpDQB3(cMbll0QYhULo.shape.as_list()) == ehT0Px3KOsy9('\x30' + chr(12152 - 12041) + '\061', 8) and cMbll0QYhULo.name.endswith(xafqLlk3kkUe(SXOLrMavuUCe(b'\x88\xa7\xe7\x07\xba!'), '\x64' + chr(101) + '\143' + chr(111) + '\x64' + '\145')(chr(0b11110 + 0o127) + chr(5240 - 5124) + '\x66' + chr(1846 - 1801) + '\070'))
if not (R2_rT8tSEO50 and qOafAaMHKZ73):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e\xab\xf0\x1d\xe3t'), chr(0b1100100) + chr(101) + chr(2396 - 2297) + chr(4290 - 4179) + chr(2270 - 2170) + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + '\x2d' + '\x38'))(xafqLlk3kkUe(cMbll0QYhULo, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8e\xab\xf0\x1d\xe3t'), '\144' + chr(0b1100010 + 0o3) + chr(1641 - 1542) + '\x6f' + chr(100) + chr(101))(chr(0b1110101) + '\x74' + '\x66' + chr(1187 - 1142) + chr(2011 - 1955)))):
LwNviKYMwoEM = IDJ2eXGCBCDu.nn.l2_loss(cMbll0QYhULo)
xafqLlk3kkUe(Q_yyewEyECai, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b\xbe\xf6\x11\xeeu'), chr(100) + chr(0b100010 + 0o103) + '\x63' + chr(111) + '\144' + chr(8330 - 8229))(chr(0b110110 + 0o77) + chr(1228 - 1112) + '\146' + chr(0b111 + 0o46) + '\070'))(LwNviKYMwoEM)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b\xaa\xe2+\xee'), chr(100) + '\x65' + chr(99) + '\157' + chr(8390 - 8290) + '\145')(chr(2139 - 2022) + '\x74' + '\146' + chr(45) + chr(923 - 867)))(Q_yyewEyECai) * ysg2zuLaUZLS
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
log_variable_sizes
|
def log_variable_sizes(var_list=None, tag=None, verbose=False):
"""Log the sizes and shapes of variables, and the total size.
Args:
var_list: a list of variables; defaults to trainable_variables
tag: a string; defaults to "Trainable Variables"
verbose: bool, if True, log every weight; otherwise, log total size only.
"""
if var_list is None:
var_list = tf.trainable_variables()
if tag is None:
tag = "Trainable Variables"
if not var_list:
return
name_to_var = {v.name: v for v in var_list}
total_size = 0
for v_name in sorted(list(name_to_var)):
v = name_to_var[v_name]
v_size = int(np.prod(np.array(v.shape.as_list())))
if verbose:
tf.logging.info("Weight %s\tshape %s\tsize %d",
v.name[:-2].ljust(80),
str(v.shape).ljust(20), v_size)
total_size += v_size
tf.logging.info("%s Total size: %d", tag, total_size)
|
python
|
def log_variable_sizes(var_list=None, tag=None, verbose=False):
"""Log the sizes and shapes of variables, and the total size.
Args:
var_list: a list of variables; defaults to trainable_variables
tag: a string; defaults to "Trainable Variables"
verbose: bool, if True, log every weight; otherwise, log total size only.
"""
if var_list is None:
var_list = tf.trainable_variables()
if tag is None:
tag = "Trainable Variables"
if not var_list:
return
name_to_var = {v.name: v for v in var_list}
total_size = 0
for v_name in sorted(list(name_to_var)):
v = name_to_var[v_name]
v_size = int(np.prod(np.array(v.shape.as_list())))
if verbose:
tf.logging.info("Weight %s\tshape %s\tsize %d",
v.name[:-2].ljust(80),
str(v.shape).ljust(20), v_size)
total_size += v_size
tf.logging.info("%s Total size: %d", tag, total_size)
|
[
"def",
"log_variable_sizes",
"(",
"var_list",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"var_list",
"is",
"None",
":",
"var_list",
"=",
"tf",
".",
"trainable_variables",
"(",
")",
"if",
"tag",
"is",
"None",
":",
"tag",
"=",
"\"Trainable Variables\"",
"if",
"not",
"var_list",
":",
"return",
"name_to_var",
"=",
"{",
"v",
".",
"name",
":",
"v",
"for",
"v",
"in",
"var_list",
"}",
"total_size",
"=",
"0",
"for",
"v_name",
"in",
"sorted",
"(",
"list",
"(",
"name_to_var",
")",
")",
":",
"v",
"=",
"name_to_var",
"[",
"v_name",
"]",
"v_size",
"=",
"int",
"(",
"np",
".",
"prod",
"(",
"np",
".",
"array",
"(",
"v",
".",
"shape",
".",
"as_list",
"(",
")",
")",
")",
")",
"if",
"verbose",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Weight %s\\tshape %s\\tsize %d\"",
",",
"v",
".",
"name",
"[",
":",
"-",
"2",
"]",
".",
"ljust",
"(",
"80",
")",
",",
"str",
"(",
"v",
".",
"shape",
")",
".",
"ljust",
"(",
"20",
")",
",",
"v_size",
")",
"total_size",
"+=",
"v_size",
"tf",
".",
"logging",
".",
"info",
"(",
"\"%s Total size: %d\"",
",",
"tag",
",",
"total_size",
")"
] |
Log the sizes and shapes of variables, and the total size.
Args:
var_list: a list of variables; defaults to trainable_variables
tag: a string; defaults to "Trainable Variables"
verbose: bool, if True, log every weight; otherwise, log total size only.
|
[
"Log",
"the",
"sizes",
"and",
"shapes",
"of",
"variables",
"and",
"the",
"total",
"size",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L301-L327
|
train
|
Log the sizes and shapes of variables and the total size.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1M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8s,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(0b1111 + 0o41) + '\157' + chr(1148 - 1098) + chr(0b110011) + chr(0b110100 + 0o3), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000011 + 0o54) + chr(53) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(0b10 + 0o65) + chr(0b11100 + 0o31), 50104 - 50096), ehT0Px3KOsy9('\060' + chr(0b1000100 + 0o53) + '\x31' + '\062' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(784 - 730) + chr(0b1011 + 0o45), 11064 - 11056), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\065' + chr(575 - 527), 31538 - 31530), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1101111) + chr(890 - 839) + chr(0b10 + 0o63) + chr(0b1 + 0o65), 0b1000), ehT0Px3KOsy9(chr(1819 - 1771) + '\x6f' + chr(2454 - 2404) + chr(50) + '\x30', 65208 - 65200), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b110110) + chr(452 - 404), 0b1000), ehT0Px3KOsy9(chr(2012 - 1964) + chr(111) + chr(0b101010 + 0o10) + chr(2466 - 2416), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061', 18074 - 18066), ehT0Px3KOsy9('\060' + chr(6283 - 6172) + '\063' + '\060' + '\065', 47688 - 47680), ehT0Px3KOsy9(chr(1475 - 1427) + chr(0b1101111) + chr(76 - 25) + chr(49) + chr(0b11011 + 0o27), 50797 - 50789), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(10914 - 10803) + chr(758 - 707) + chr(1608 - 1553), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + '\x35' + chr(0b100010 + 0o24), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(1962 - 1908) + chr(0b110100 + 0o3), 45272 - 45264), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + chr(1356 - 1306) + chr(55) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1860 - 1811) + '\x35' + chr(0b110010), 4664 - 4656), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + '\x33' + chr(53) + '\066', 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(1263 - 1211) + chr(0b110001), 14301 - 14293), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x37' + chr(331 - 279), 51421 - 51413), ehT0Px3KOsy9(chr(919 - 871) + chr(111) + chr(0b110001) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(95 - 46) + chr(0b110110) + chr(2237 - 2184), ord("\x08")), ehT0Px3KOsy9(chr(1594 - 1546) + chr(111) + chr(2117 - 2067) + chr(0b110111) + chr(1197 - 1148), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011101 + 0o22) + '\062' + chr(844 - 790), 5363 - 5355), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011 + 0o0) + chr(1421 - 1371) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1538 - 1489) + '\061' + chr(50), 40230 - 40222), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(0b110000) + '\x34', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b110001) + chr(0b100011 + 0o22), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\066' + chr(1600 - 1552), 37089 - 37081), ehT0Px3KOsy9('\x30' + chr(0b1010000 + 0o37) + chr(0b11000 + 0o33) + chr(0b11110 + 0o26) + chr(54), 46059 - 46051), ehT0Px3KOsy9(chr(588 - 540) + '\x6f' + chr(0b110110) + chr(0b100000 + 0o24), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(49) + '\x30' + chr(0b1110 + 0o43), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(779 - 729) + chr(0b110111) + chr(0b11111 + 0o21), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101110 + 0o101) + chr(668 - 617) + '\063' + '\x30', 46179 - 46171), ehT0Px3KOsy9(chr(1643 - 1595) + chr(4585 - 4474) + chr(0b1011 + 0o50) + '\x30' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101010 + 0o11) + chr(50) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\065' + chr(1733 - 1683), 62493 - 62485), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1000 + 0o52) + '\062' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2716 - 2605) + chr(767 - 716) + chr(1115 - 1065) + '\061', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(53) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb1'), chr(0b1000001 + 0o43) + chr(0b1011100 + 0o11) + '\x63' + chr(428 - 317) + '\x64' + '\x65')(chr(13656 - 13539) + chr(0b1001010 + 0o52) + chr(102) + '\055' + chr(0b101001 + 0o17)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def RHP3rUMNQZGt(WjzhQmqLR1lh=None, CPdEsc5O1sf7=None, j5jgrsOGZdZ4=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 0o10)):
if WjzhQmqLR1lh is None:
WjzhQmqLR1lh = IDJ2eXGCBCDu.trainable_variables()
if CPdEsc5O1sf7 is None:
CPdEsc5O1sf7 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb[\x9c:\x9e\t\x8c\xfc\xd52W\xa4\xb8vOU\xd7\x0f\x9d'), chr(9185 - 9085) + chr(101) + chr(3877 - 3778) + '\157' + '\x64' + chr(0b1000100 + 0o41))('\165' + chr(116) + chr(102) + chr(45) + chr(822 - 766))
if not WjzhQmqLR1lh:
return
ZLzvgroSQtUZ = {cMbll0QYhULo.AIvJRzLdDfgF: cMbll0QYhULo for cMbll0QYhULo in WjzhQmqLR1lh}
aRDYUgtuFxYy = ehT0Px3KOsy9('\060' + chr(0b100101 + 0o112) + chr(0b10000 + 0o40), 8)
for hGIUk39KzeRE in vUlqIvNSaRMa(YyaZ4tpXu4lf(ZLzvgroSQtUZ)):
cMbll0QYhULo = ZLzvgroSQtUZ[hGIUk39KzeRE]
b7NTcmRwo2af = ehT0Px3KOsy9(WqUC3KWvYVup.lBYk79l4Nk8h(WqUC3KWvYVup.B0ePDhpqxN5n(cMbll0QYhULo.shape.as_list())))
if j5jgrsOGZdZ4:
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc\x1e\xb5+\x85\x0b\x89\xa7\xda~[\xae'), chr(100) + '\x65' + '\x63' + chr(0b1101111) + chr(0b1010 + 0o132) + '\x65')(chr(0b1110101) + chr(116) + '\x66' + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8L\x944\x98\x1c\xce\xb0\x902$\xb6\xc3lFV\xcb\x0f\xce\xc1\x1c+P\xca\x1f\xa4#\xfe\xe8P\xc6\x14a\x9d\xbc'), '\x64' + '\145' + '\x63' + '\x6f' + chr(8147 - 8047) + '\145')('\x75' + '\x74' + chr(0b1100110) + chr(1123 - 1078) + chr(0b110010 + 0o6)), xafqLlk3kkUe(cMbll0QYhULo.name[:-ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100101 + 0o15), ord("\x08"))], xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3C\x88 \x84'), chr(7381 - 7281) + chr(0b1100101) + '\x63' + chr(0b111000 + 0o67) + chr(9777 - 9677) + chr(101))(chr(0b1110101) + '\x74' + '\x66' + chr(0b101101 + 0o0) + '\x38'))(ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101 + 0o54) + chr(1801 - 1751) + chr(48), 20058 - 20050)), xafqLlk3kkUe(M8_cKLkHVB2V(cMbll0QYhULo.shape), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3C\x88 \x84'), chr(100) + '\145' + chr(0b1100011) + chr(4217 - 4106) + chr(3633 - 3533) + '\145')('\x75' + '\164' + chr(9271 - 9169) + chr(45) + chr(56)))(ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(5452 - 5341) + '\062' + chr(0b110100), ord("\x08"))), b7NTcmRwo2af)
aRDYUgtuFxYy += b7NTcmRwo2af
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc\x1e\xb5+\x85\x0b\x89\xa7\xda~[\xae'), '\x64' + chr(7293 - 7192) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b101101 + 0o70))(chr(1647 - 1530) + chr(0b1000111 + 0o55) + chr(0b1100110) + chr(0b100 + 0o51) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbaZ\xdd\x07\x9f\x1c\x8f\xfc\x90ah\xbf\xaf%\x0e\x12\xdf'), chr(0b1100100) + chr(0b1011011 + 0o12) + chr(0b1101 + 0o126) + '\157' + '\x64' + chr(0b1100101))('\165' + chr(2112 - 1996) + chr(102) + '\x2d' + chr(0b110010 + 0o6)), CPdEsc5O1sf7, aRDYUgtuFxYy)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
summarize_variables
|
def summarize_variables(var_list=None, tag=None):
"""Summarize the variables.
Args:
var_list: a list of variables; defaults to trainable_variables.
tag: name scope of the summary; defaults to training_variables/.
"""
if var_list is None:
var_list = tf.trainable_variables()
if tag is None:
tag = "training_variables/"
name_to_var = {v.name: v for v in var_list}
for v_name in list(name_to_var):
v = name_to_var[v_name]
tf.summary.histogram(tag + v_name, v)
|
python
|
def summarize_variables(var_list=None, tag=None):
"""Summarize the variables.
Args:
var_list: a list of variables; defaults to trainable_variables.
tag: name scope of the summary; defaults to training_variables/.
"""
if var_list is None:
var_list = tf.trainable_variables()
if tag is None:
tag = "training_variables/"
name_to_var = {v.name: v for v in var_list}
for v_name in list(name_to_var):
v = name_to_var[v_name]
tf.summary.histogram(tag + v_name, v)
|
[
"def",
"summarize_variables",
"(",
"var_list",
"=",
"None",
",",
"tag",
"=",
"None",
")",
":",
"if",
"var_list",
"is",
"None",
":",
"var_list",
"=",
"tf",
".",
"trainable_variables",
"(",
")",
"if",
"tag",
"is",
"None",
":",
"tag",
"=",
"\"training_variables/\"",
"name_to_var",
"=",
"{",
"v",
".",
"name",
":",
"v",
"for",
"v",
"in",
"var_list",
"}",
"for",
"v_name",
"in",
"list",
"(",
"name_to_var",
")",
":",
"v",
"=",
"name_to_var",
"[",
"v_name",
"]",
"tf",
".",
"summary",
".",
"histogram",
"(",
"tag",
"+",
"v_name",
",",
"v",
")"
] |
Summarize the variables.
Args:
var_list: a list of variables; defaults to trainable_variables.
tag: name scope of the summary; defaults to training_variables/.
|
[
"Summarize",
"the",
"variables",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L330-L345
|
train
|
Summarize the variables.
|
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,V5s4UV3vw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Bx4,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(1337 - 1289) + '\x6f' + chr(55), 24485 - 24477), ehT0Px3KOsy9(chr(372 - 324) + chr(0b1101111) + '\x37' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(51) + chr(887 - 834), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9998 - 9887) + chr(51) + '\062' + chr(2700 - 2646), 48413 - 48405), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b110110) + chr(975 - 922), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + '\x31' + '\x34' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\066' + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b110101) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(340 - 292) + chr(111) + '\062' + chr(0b11000 + 0o34), 58142 - 58134), ehT0Px3KOsy9(chr(0b110000) + chr(11049 - 10938) + chr(0b100000 + 0o22) + chr(55) + chr(1499 - 1447), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1100 + 0o47) + chr(922 - 871) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(1660 - 1610) + chr(0b11111 + 0o21) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + chr(51) + '\066' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\066' + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(52) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1706 - 1658) + chr(0b1101111) + chr(1532 - 1477) + chr(0b10101 + 0o33), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\061' + chr(977 - 927), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(238 - 188) + chr(1667 - 1612), 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(0b110011) + '\x31' + '\x32', 8), ehT0Px3KOsy9(chr(48) + chr(0b1100110 + 0o11) + '\062' + chr(0b100110 + 0o16) + chr(975 - 923), 34499 - 34491), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000000 + 0o57) + chr(0b110001) + chr(1712 - 1662) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\061' + chr(1109 - 1056), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(54) + chr(0b110101), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\x35' + chr(55), 61390 - 61382), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(877 - 827) + '\066' + chr(380 - 326), 55157 - 55149), ehT0Px3KOsy9(chr(1098 - 1050) + '\x6f' + '\063' + chr(0b101111 + 0o2) + chr(53), 8), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(0b10000 + 0o43) + '\x37' + chr(0b100111 + 0o17), 0b1000), ehT0Px3KOsy9(chr(710 - 662) + '\157' + chr(2288 - 2238) + chr(52) + chr(48), 23265 - 23257), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(2045 - 1992) + '\063', 40485 - 40477), ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + chr(51) + '\x31' + chr(53), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\065' + chr(1001 - 952), 4201 - 4193), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(2088 - 2037) + chr(0b11101 + 0o31), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110110) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(51) + chr(0b101001 + 0o14), 0b1000), ehT0Px3KOsy9(chr(944 - 896) + '\x6f' + chr(0b110011) + chr(0b110101) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2405 - 2294) + chr(0b110011) + '\063' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(2515 - 2404) + chr(0b110001) + chr(0b10101 + 0o41) + chr(590 - 536), 64225 - 64217), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(53), 14603 - 14595)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + chr(53) + chr(0b1110 + 0o42), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b')'), chr(0b1100100) + chr(0b110001 + 0o64) + chr(0b1100011) + '\157' + '\144' + chr(8489 - 8388))('\x75' + chr(116) + chr(0b1100011 + 0o3) + chr(0b1011 + 0o42) + chr(0b100100 + 0o24)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def YZ1slExkkc8U(WjzhQmqLR1lh=None, CPdEsc5O1sf7=None):
if WjzhQmqLR1lh is None:
WjzhQmqLR1lh = IDJ2eXGCBCDu.trainable_variables()
if CPdEsc5O1sf7 is None:
CPdEsc5O1sf7 = xafqLlk3kkUe(SXOLrMavuUCe(b'sM<\xbf\x7f\x9c\x0b\x96\xf3b\xdd\xaa\xee\x91\xd1\x89]\xb9\xf8'), chr(4896 - 4796) + '\x65' + chr(99) + chr(8413 - 8302) + chr(0b1011101 + 0o7) + '\145')(chr(600 - 483) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b1 + 0o67))
ZLzvgroSQtUZ = {cMbll0QYhULo.AIvJRzLdDfgF: cMbll0QYhULo for cMbll0QYhULo in WjzhQmqLR1lh}
for hGIUk39KzeRE in YyaZ4tpXu4lf(ZLzvgroSQtUZ):
cMbll0QYhULo = ZLzvgroSQtUZ[hGIUk39KzeRE]
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'X{i\x8cf\xcc\x07\x85\xf9@\xc9\x89'), chr(100) + '\x65' + chr(0b1100011) + chr(11967 - 11856) + chr(100) + '\145')('\165' + chr(0b1110100) + chr(102) + '\055' + '\070'))(CPdEsc5O1sf7 + hGIUk39KzeRE, cMbll0QYhULo)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/optimize.py
|
get_variable_initializer
|
def get_variable_initializer(hparams):
"""Get variable initializer from hparams."""
if not hparams.initializer:
return None
mlperf_log.transformer_print(key=mlperf_log.MODEL_HP_INITIALIZER_GAIN,
value=hparams.initializer_gain,
hparams=hparams)
if not tf.executing_eagerly():
tf.logging.info("Using variable initializer: %s", hparams.initializer)
if hparams.initializer == "orthogonal":
return tf.orthogonal_initializer(gain=hparams.initializer_gain)
elif hparams.initializer == "uniform":
max_val = 0.1 * hparams.initializer_gain
return tf.random_uniform_initializer(-max_val, max_val)
elif hparams.initializer == "normal_unit_scaling":
return tf.variance_scaling_initializer(
hparams.initializer_gain, mode="fan_avg", distribution="normal")
elif hparams.initializer == "uniform_unit_scaling":
return tf.variance_scaling_initializer(
hparams.initializer_gain, mode="fan_avg", distribution="uniform")
elif hparams.initializer == "xavier":
return tf.initializers.glorot_uniform()
else:
raise ValueError("Unrecognized initializer: %s" % hparams.initializer)
|
python
|
def get_variable_initializer(hparams):
"""Get variable initializer from hparams."""
if not hparams.initializer:
return None
mlperf_log.transformer_print(key=mlperf_log.MODEL_HP_INITIALIZER_GAIN,
value=hparams.initializer_gain,
hparams=hparams)
if not tf.executing_eagerly():
tf.logging.info("Using variable initializer: %s", hparams.initializer)
if hparams.initializer == "orthogonal":
return tf.orthogonal_initializer(gain=hparams.initializer_gain)
elif hparams.initializer == "uniform":
max_val = 0.1 * hparams.initializer_gain
return tf.random_uniform_initializer(-max_val, max_val)
elif hparams.initializer == "normal_unit_scaling":
return tf.variance_scaling_initializer(
hparams.initializer_gain, mode="fan_avg", distribution="normal")
elif hparams.initializer == "uniform_unit_scaling":
return tf.variance_scaling_initializer(
hparams.initializer_gain, mode="fan_avg", distribution="uniform")
elif hparams.initializer == "xavier":
return tf.initializers.glorot_uniform()
else:
raise ValueError("Unrecognized initializer: %s" % hparams.initializer)
|
[
"def",
"get_variable_initializer",
"(",
"hparams",
")",
":",
"if",
"not",
"hparams",
".",
"initializer",
":",
"return",
"None",
"mlperf_log",
".",
"transformer_print",
"(",
"key",
"=",
"mlperf_log",
".",
"MODEL_HP_INITIALIZER_GAIN",
",",
"value",
"=",
"hparams",
".",
"initializer_gain",
",",
"hparams",
"=",
"hparams",
")",
"if",
"not",
"tf",
".",
"executing_eagerly",
"(",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"\"Using variable initializer: %s\"",
",",
"hparams",
".",
"initializer",
")",
"if",
"hparams",
".",
"initializer",
"==",
"\"orthogonal\"",
":",
"return",
"tf",
".",
"orthogonal_initializer",
"(",
"gain",
"=",
"hparams",
".",
"initializer_gain",
")",
"elif",
"hparams",
".",
"initializer",
"==",
"\"uniform\"",
":",
"max_val",
"=",
"0.1",
"*",
"hparams",
".",
"initializer_gain",
"return",
"tf",
".",
"random_uniform_initializer",
"(",
"-",
"max_val",
",",
"max_val",
")",
"elif",
"hparams",
".",
"initializer",
"==",
"\"normal_unit_scaling\"",
":",
"return",
"tf",
".",
"variance_scaling_initializer",
"(",
"hparams",
".",
"initializer_gain",
",",
"mode",
"=",
"\"fan_avg\"",
",",
"distribution",
"=",
"\"normal\"",
")",
"elif",
"hparams",
".",
"initializer",
"==",
"\"uniform_unit_scaling\"",
":",
"return",
"tf",
".",
"variance_scaling_initializer",
"(",
"hparams",
".",
"initializer_gain",
",",
"mode",
"=",
"\"fan_avg\"",
",",
"distribution",
"=",
"\"uniform\"",
")",
"elif",
"hparams",
".",
"initializer",
"==",
"\"xavier\"",
":",
"return",
"tf",
".",
"initializers",
".",
"glorot_uniform",
"(",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Unrecognized initializer: %s\"",
"%",
"hparams",
".",
"initializer",
")"
] |
Get variable initializer from hparams.
|
[
"Get",
"variable",
"initializer",
"from",
"hparams",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L348-L373
|
train
|
Get variable initializer from hparams.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadl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_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + '\x32' + '\062' + '\066', 54287 - 54279), ehT0Px3KOsy9(chr(287 - 239) + chr(0b111000 + 0o67) + chr(933 - 882) + '\x33' + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(0b110001) + chr(1988 - 1936) + '\x33', 33336 - 33328), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + '\x33' + chr(0b100111 + 0o13), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\x36' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + chr(2011 - 1960) + chr(49) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(0b11001 + 0o31) + '\064' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(0b100100 + 0o16) + chr(1396 - 1342) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(796 - 745) + chr(0b111 + 0o51) + '\x31', 13335 - 13327), ehT0Px3KOsy9('\060' + chr(5779 - 5668) + chr(0b100 + 0o56) + chr(0b100000 + 0o24) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(0b1011 + 0o144) + chr(0b1100 + 0o46) + chr(0b100000 + 0o24) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(510 - 461) + chr(0b100101 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(8823 - 8712) + chr(0b110011) + chr(49) + chr(51), 13651 - 13643), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(53) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b11111 + 0o22) + chr(49) + chr(0b110001 + 0o0), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(1892 - 1837) + '\065', 0b1000), ehT0Px3KOsy9(chr(1649 - 1601) + chr(0b1101111) + chr(0b110101) + '\x35', 27036 - 27028), ehT0Px3KOsy9('\x30' + chr(9289 - 9178) + chr(0b110011) + '\062' + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(11553 - 11442) + chr(1706 - 1657) + '\x30', 50873 - 50865), ehT0Px3KOsy9(chr(48) + chr(11889 - 11778) + chr(2164 - 2115) + '\x30' + chr(0b11010 + 0o31), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000101 + 0o52) + '\061' + '\x32' + chr(0b101101 + 0o5), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + '\063' + chr(0b110101 + 0o0) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(10606 - 10495) + '\x32', 0o10), ehT0Px3KOsy9(chr(798 - 750) + chr(11510 - 11399) + chr(0b110010) + chr(51) + chr(1791 - 1736), 0b1000), ehT0Px3KOsy9(chr(119 - 71) + chr(0b1101 + 0o142) + chr(0b11 + 0o60) + chr(0b110010) + chr(2594 - 2540), 0o10), ehT0Px3KOsy9(chr(569 - 521) + '\x6f' + '\x37' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101010 + 0o5) + chr(0b0 + 0o62) + chr(2636 - 2581) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110110) + '\x33', 31794 - 31786), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1788 - 1738) + chr(49) + chr(79 - 28), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1111 + 0o44) + chr(2172 - 2121) + chr(363 - 314), 22196 - 22188), ehT0Px3KOsy9(chr(716 - 668) + chr(6028 - 5917) + '\x32' + '\063' + '\061', 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(2016 - 1961) + '\065', 8), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(0b11101 + 0o25) + chr(0b110110) + '\x31', 31858 - 31850), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(650 - 599), 10517 - 10509), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), 13280 - 13272), ehT0Px3KOsy9(chr(0b110000) + chr(3148 - 3037) + chr(1845 - 1796) + chr(54) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(8170 - 8059) + '\x32' + chr(0b110011) + chr(52), 13205 - 13197), ehT0Px3KOsy9('\060' + chr(0b1001001 + 0o46) + chr(0b110010) + '\060' + '\x36', 0b1000), ehT0Px3KOsy9(chr(2152 - 2104) + chr(1811 - 1700) + chr(50) + chr(2697 - 2642) + chr(1992 - 1939), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(6782 - 6671) + chr(54 - 1) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8'), '\144' + chr(0b1011101 + 0o10) + chr(0b1010101 + 0o16) + chr(0b1011 + 0o144) + chr(0b1100100) + '\x65')(chr(0b1110101) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def D6yQUJv0STzz(n4ljua2gi1Pr):
if not xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), chr(100) + chr(101) + '\x63' + '\x6f' + '\144' + chr(7209 - 7108))(chr(12759 - 12642) + chr(116) + chr(0b1100110) + '\x2d' + '\x38')):
return None
xafqLlk3kkUe(mcP9wB7s3wV8, xafqLlk3kkUe(SXOLrMavuUCe(b"\xe2\xaf`\ri\x96\xa1\xd2\xd8\xa4\xd2\xfd\xfe\xb9\xc2'I"), '\x64' + '\x65' + chr(0b10 + 0o141) + '\x6f' + chr(100) + '\x65')(chr(4681 - 4564) + chr(0b1110100) + '\x66' + '\055' + chr(56)))(key=xafqLlk3kkUe(mcP9wB7s3wV8, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb\x92E&V\xaf\x86\xf0\xea\x88\xee\xeb\xda\x82\xea\x05tw\x90Z\x1c\x15\xa9K\xd1'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b1100101))('\165' + chr(0b11100 + 0o130) + chr(0b1100110) + '\055' + chr(0b100 + 0o64))), value=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xecR\x01Y\xb2\x96\xec\xd4\xb1\xd7\x9a'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(6751 - 6640) + chr(0b1100100) + '\x65')('\x75' + chr(116) + chr(102) + chr(45) + chr(0b101110 + 0o12))), hparams=n4ljua2gi1Pr)
if not xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xa5d\x00o\x84\xa7\xce\xd2\x9e\xc5\xc3\xe9\xae\xd9%D'), '\x64' + '\145' + '\x63' + '\157' + '\x64' + '\x65')('\x75' + chr(0b101100 + 0o110) + '\x66' + '\x2d' + chr(56)))():
xafqLlk3kkUe(IDJ2eXGCBCDu.logging, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xeaI\x1bo\x93\xa9\x97\xdf\xad\xfa\xc9'), chr(100) + chr(5577 - 5476) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(117) + '\164' + '\x66' + chr(725 - 680) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc3\xaeh\r}\xd0\xb8\xc1\xc7\xa8\xc1\xc0\xe2\xae\x8b SD\xa1a">\x81x\xfa\xa4\x03\x98V\xf8'), chr(3771 - 3671) + chr(0b1100101) + chr(99) + chr(111) + chr(100) + '\145')(chr(0b1110101) + chr(116) + chr(0b110001 + 0o65) + chr(1400 - 1355) + '\070'), xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), '\144' + chr(2974 - 2873) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(0b110100 + 0o61))('\x75' + '\x74' + chr(0b1100110) + chr(0b100110 + 0o7) + chr(0b1011 + 0o55))))
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), chr(0b101101 + 0o67) + chr(101) + '\x63' + '\157' + '\144' + chr(0b1000111 + 0o36))('\x75' + '\164' + chr(0b1000101 + 0o41) + chr(0b11000 + 0o25) + '\x38')) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9\xafu\x0bu\x97\xa1\xce\xd4\xad'), '\x64' + '\x65' + chr(99) + chr(0b1101111) + '\144' + '\x65')(chr(0b1011111 + 0o26) + '\164' + chr(0b1011010 + 0o14) + '\055' + chr(0b100110 + 0o22)):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf9\xafu\x0bu\x97\xa1\xce\xd4\xad\xff\xcb\xe0\xa2\xdf \\A\xbcr& '), '\x64' + chr(101) + chr(185 - 86) + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + chr(0b1010 + 0o152) + chr(1861 - 1759) + chr(0b101101) + chr(1949 - 1893)))(gain=xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xecR\x01Y\xb2\x96\xec\xd4\xb1\xd7\x9a'), chr(2275 - 2175) + chr(6763 - 6662) + chr(993 - 894) + chr(0b1000110 + 0o51) + chr(0b1100100) + chr(1513 - 1412))(chr(117) + chr(116) + chr(0b111 + 0o137) + chr(45) + chr(0b111000))))
elif xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), chr(1315 - 1215) + chr(0b1100101) + chr(0b1 + 0o142) + '\x6f' + chr(4190 - 4090) + chr(0b1100101 + 0o0))(chr(3178 - 3061) + chr(116) + '\146' + '\055' + chr(0b11100 + 0o34))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3\xb3h\x05u\x82\xa3'), chr(0b1100100) + '\145' + '\143' + chr(0b101100 + 0o103) + chr(0b1001101 + 0o27) + chr(0b1100101))(chr(0b1010011 + 0o42) + chr(116) + chr(0b10 + 0o144) + '\x2d' + chr(799 - 743)):
VnEEVinV1no4 = 0.1 * n4ljua2gi1Pr.S1SbCBXLapw8
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4\xbco\x07u\x9d\x91\xd5\xdb\xa8\xc6\xcd\xfc\xa6\xf4 SD\xa1a">\x81x\xfa\xa4'), '\x64' + chr(4601 - 4500) + chr(0b1100011) + chr(6060 - 5949) + '\144' + '\x65')(chr(0b10111 + 0o136) + chr(0b111110 + 0o66) + chr(102) + chr(1857 - 1812) + chr(2733 - 2677)))(-VnEEVinV1no4, VnEEVinV1no4)
elif xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), '\144' + chr(5850 - 5749) + chr(0b100111 + 0o74) + chr(0b1101100 + 0o3) + chr(0b1100100) + '\145')(chr(117) + chr(0b1110100) + '\x66' + chr(0b111 + 0o46) + chr(2789 - 2733))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\xb2s\x0e{\x9c\x91\xd5\xdb\xa8\xd4\xfd\xfd\xa8\xca%TC\xb2'), chr(7475 - 7375) + '\145' + chr(0b1100011) + chr(686 - 575) + chr(4653 - 4553) + chr(5921 - 5820))('\165' + chr(0b1110100) + chr(0b1001110 + 0o30) + chr(0b10000 + 0o35) + chr(56)):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xbcs\n{\x9e\xad\xc5\xea\xb2\xc3\xc3\xe2\xa2\xc5.bD\xbba7;\x89n\xf6\xac\\\xca'), '\x64' + chr(101) + chr(0b1100011) + '\x6f' + chr(8292 - 8192) + chr(8882 - 8781))(chr(0b1110101) + chr(0b110100 + 0o100) + chr(102) + chr(0b100111 + 0o6) + chr(0b10 + 0o66)))(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xecR\x01Y\xb2\x96\xec\xd4\xb1\xd7\x9a'), '\144' + '\145' + chr(3633 - 3534) + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1001111 + 0o46) + chr(0b1110100) + '\146' + chr(904 - 859) + chr(437 - 381))), mode=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xbco<{\x86\xa9'), chr(0b1100100) + chr(101) + chr(99) + chr(0b111110 + 0o61) + chr(2951 - 2851) + chr(9182 - 9081))(chr(0b1110101) + '\x74' + chr(102) + chr(45) + chr(56)), distribution=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8\xb2s\x0e{\x9c'), '\144' + chr(0b1100101) + '\143' + '\157' + chr(0b1011100 + 0o10) + chr(0b110 + 0o137))('\165' + chr(116) + chr(0b1001100 + 0o32) + '\x2d' + '\070'))
elif xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), chr(100) + chr(0b1100101) + '\143' + chr(0b1101111) + '\x64' + chr(1773 - 1672))(chr(117) + chr(0b1011011 + 0o31) + chr(102) + '\x2d' + '\070')) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3\xb3h\x05u\x82\xa3\xff\xc0\xaf\xc9\xd6\xd1\xb8\xc8(QD\xbbo'), '\144' + chr(0b1100101) + chr(0b101110 + 0o65) + chr(0b1101111) + chr(2678 - 2578) + '\145')('\x75' + chr(116) + chr(102) + chr(45) + chr(0b10010 + 0o46)):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xbcs\n{\x9e\xad\xc5\xea\xb2\xc3\xc3\xe2\xa2\xc5.bD\xbba7;\x89n\xf6\xac\\\xca'), chr(100) + chr(6953 - 6852) + chr(1456 - 1357) + chr(0b1101111) + '\144' + '\x65')(chr(0b111101 + 0o70) + chr(0b1110100) + chr(0b1100110) + chr(0b10100 + 0o31) + chr(0b111000)))(xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5\xecR\x01Y\xb2\x96\xec\xd4\xb1\xd7\x9a'), chr(7559 - 7459) + '\145' + chr(0b11 + 0o140) + chr(9013 - 8902) + chr(0b1100100) + '\145')(chr(0b110111 + 0o76) + '\164' + chr(0b101111 + 0o67) + chr(0b101101) + '\070')), mode=xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0\xbco<{\x86\xa9'), chr(2207 - 2107) + chr(7731 - 7630) + chr(99) + '\x6f' + chr(0b111010 + 0o52) + '\x65')(chr(3994 - 3877) + chr(0b1000011 + 0o61) + chr(0b1100110) + chr(1013 - 968) + chr(56)), distribution=xafqLlk3kkUe(SXOLrMavuUCe(b'\xe3\xb3h\x05u\x82\xa3'), '\x64' + '\x65' + '\143' + '\157' + chr(100) + chr(101))('\x75' + chr(0b1110100) + chr(0b10100 + 0o122) + '\x2d' + chr(0b111000)))
elif xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), chr(100) + chr(1158 - 1057) + chr(8083 - 7984) + '\157' + '\144' + chr(3907 - 3806))(chr(117) + '\164' + '\146' + '\055' + chr(56))) == xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\xbcw\n\x7f\x82'), chr(100) + '\145' + chr(0b1100011) + chr(4454 - 4343) + chr(0b100101 + 0o77) + '\x65')('\165' + chr(0b1011000 + 0o34) + chr(102) + chr(0b101101) + chr(0b111000)):
return xafqLlk3kkUe(IDJ2eXGCBCDu.initializers, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1\xb1n\x11u\x84\x91\xd5\xdb\xa8\xc6\xcd\xfc\xa6'), '\144' + '\x65' + '\x63' + '\x6f' + chr(2941 - 2841) + '\x65')(chr(5306 - 5189) + chr(5879 - 5763) + chr(102) + chr(45) + chr(276 - 220)))()
else:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc3\xb3s\x06y\x9f\xa9\xce\xdc\xbb\xc5\xc6\xae\xa2\xc5 ID\xb4d*(\x8dp\xa5\xf6\x1c\xcb'), '\x64' + chr(101) + '\143' + '\x6f' + '\144' + chr(0b110001 + 0o64))('\165' + '\164' + chr(1158 - 1056) + chr(0b100101 + 0o10) + chr(56)) % xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd\xaag\x16C\x8a\xa5\xf9\x80\x82\x95\x95'), chr(0b1100100) + chr(2696 - 2595) + '\x63' + chr(192 - 81) + '\144' + chr(0b110101 + 0o60))('\x75' + '\x74' + chr(6654 - 6552) + chr(1569 - 1524) + chr(1882 - 1826))))
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/vqa_layers.py
|
summarize_tensors
|
def summarize_tensors(tensor_dict, tag=None):
"""Summarize the tensors.
Args:
tensor_dict: a dictionary of tensors.
tag: name scope of the summary; defaults to tensors/.
"""
if tag is None:
tag = "tensors/"
for t_name in list(tensor_dict):
t = tensor_dict[t_name]
tf.summary.histogram(tag + t_name, t)
|
python
|
def summarize_tensors(tensor_dict, tag=None):
"""Summarize the tensors.
Args:
tensor_dict: a dictionary of tensors.
tag: name scope of the summary; defaults to tensors/.
"""
if tag is None:
tag = "tensors/"
for t_name in list(tensor_dict):
t = tensor_dict[t_name]
tf.summary.histogram(tag + t_name, t)
|
[
"def",
"summarize_tensors",
"(",
"tensor_dict",
",",
"tag",
"=",
"None",
")",
":",
"if",
"tag",
"is",
"None",
":",
"tag",
"=",
"\"tensors/\"",
"for",
"t_name",
"in",
"list",
"(",
"tensor_dict",
")",
":",
"t",
"=",
"tensor_dict",
"[",
"t_name",
"]",
"tf",
".",
"summary",
".",
"histogram",
"(",
"tag",
"+",
"t_name",
",",
"t",
")"
] |
Summarize the tensors.
Args:
tensor_dict: a dictionary of tensors.
tag: name scope of the summary; defaults to tensors/.
|
[
"Summarize",
"the",
"tensors",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vqa_layers.py#L33-L45
|
train
|
Summarize the tensors.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8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R,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(1328 - 1280) + chr(0b110001 + 0o76) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11 + 0o60) + '\062' + chr(0b100110 + 0o21), 0b1000), ehT0Px3KOsy9(chr(1530 - 1482) + chr(6219 - 6108) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(9041 - 8930) + chr(51) + '\067' + '\060', 54916 - 54908), ehT0Px3KOsy9(chr(48) + chr(0b1100100 + 0o13) + '\063' + '\060' + '\067', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101000 + 0o12) + chr(2070 - 2019), 54333 - 54325), ehT0Px3KOsy9(chr(1762 - 1714) + '\157' + chr(195 - 144) + chr(963 - 915) + chr(116 - 61), 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + '\x32' + '\x32' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\064' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(0b11011 + 0o30) + chr(2415 - 2360), 59444 - 59436), ehT0Px3KOsy9('\060' + '\157' + chr(435 - 386) + '\x32', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100000 + 0o21) + '\x31' + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110101) + chr(404 - 352), 0o10), ehT0Px3KOsy9(chr(1771 - 1723) + chr(0b1101111) + chr(51) + chr(0b101110 + 0o6) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(50) + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1111 + 0o140) + chr(322 - 271), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\062' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + '\061' + '\x35' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + '\x31' + chr(1446 - 1397) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1110 + 0o45) + chr(0b110001) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(105 - 55) + chr(0b11011 + 0o26) + chr(280 - 229), ord("\x08")), ehT0Px3KOsy9(chr(1616 - 1568) + chr(6441 - 6330) + '\061' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10 + 0o155) + '\x33' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(1222 - 1174) + '\x6f' + chr(575 - 524) + '\x33' + chr(1830 - 1778), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(53) + '\060', 5387 - 5379), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110101) + chr(1046 - 996), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b11111 + 0o23) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(51) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(11135 - 11024) + '\x33' + '\x32' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110011) + '\x31', 48524 - 48516), ehT0Px3KOsy9(chr(761 - 713) + chr(111) + '\x35' + chr(0b101100 + 0o12), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1011 + 0o50) + '\065' + chr(800 - 752), 36487 - 36479), ehT0Px3KOsy9(chr(48) + '\157' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48 - 0) + '\157' + '\062' + chr(1549 - 1501) + chr(52), 18568 - 18560), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011100 + 0o23) + chr(0b110011) + chr(55) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10111 + 0o33) + chr(893 - 839), ord("\x08")), ehT0Px3KOsy9(chr(810 - 762) + chr(111) + chr(704 - 655) + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\x36' + '\064', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(10892 - 10781) + chr(127 - 74) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'.'), chr(8688 - 8588) + chr(6937 - 6836) + '\x63' + chr(9078 - 8967) + '\x64' + chr(4508 - 4407))(chr(117) + chr(5008 - 4892) + chr(102) + chr(1684 - 1639) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def zE2WcV9hZT0q(M_ynUZjgsw4O, CPdEsc5O1sf7=None):
if CPdEsc5O1sf7 is None:
CPdEsc5O1sf7 = xafqLlk3kkUe(SXOLrMavuUCe(b'tt\xb9p\x97\xb5`\xe8'), chr(100) + '\x65' + chr(0b1100011) + chr(0b1010110 + 0o31) + chr(100) + chr(0b1100101))(chr(0b1110101) + '\x74' + '\146' + chr(0b101101) + chr(0b110001 + 0o7))
for xZdAbxgU3KYp in YyaZ4tpXu4lf(M_ynUZjgsw4O):
YeT3l7JgTbWR = M_ynUZjgsw4O[xZdAbxgU3KYp]
xafqLlk3kkUe(IDJ2eXGCBCDu.summary, xafqLlk3kkUe(SXOLrMavuUCe(b'_U\xe3Y\x8f\xfeq\xb3\xc2w\xea['), chr(100) + chr(0b1100101) + chr(0b10111 + 0o114) + chr(7783 - 7672) + chr(100) + chr(0b1100101))('\165' + chr(0b110000 + 0o104) + chr(920 - 818) + chr(0b101101) + chr(1584 - 1528)))(CPdEsc5O1sf7 + xZdAbxgU3KYp, YeT3l7JgTbWR)
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/vqa_layers.py
|
image_embedding
|
def image_embedding(images,
model_fn=resnet_v1_152,
trainable=True,
is_training=True,
weight_decay=0.0001,
batch_norm_decay=0.997,
batch_norm_epsilon=1e-5,
batch_norm_scale=True,
add_summaries=False,
reuse=False):
"""Extract image features from pretrained resnet model."""
is_resnet_training = trainable and is_training
batch_norm_params = {
"is_training": is_resnet_training,
"trainable": trainable,
"decay": batch_norm_decay,
"epsilon": batch_norm_epsilon,
"scale": batch_norm_scale,
}
if trainable:
weights_regularizer = tf.contrib.layers.l2_regularizer(weight_decay)
else:
weights_regularizer = None
with tf.variable_scope(model_fn.__name__, [images], reuse=reuse) as scope:
with slim.arg_scope(
[slim.conv2d],
weights_regularizer=weights_regularizer,
trainable=trainable):
with slim.arg_scope(
[slim.conv2d],
weights_initializer=slim.variance_scaling_initializer(),
activation_fn=tf.nn.relu,
normalizer_fn=slim.batch_norm,
normalizer_params=batch_norm_params):
with slim.arg_scope([slim.batch_norm],
is_training=is_resnet_training,
trainable=trainable):
with slim.arg_scope([slim.max_pool2d], padding="SAME"):
net, end_points = model_fn(
images, num_classes=None, global_pool=False,
is_training=is_resnet_training,
reuse=reuse, scope=scope)
if add_summaries:
for v in end_points.values():
tf.contrib.layers.summaries.summarize_activation(v)
return net
|
python
|
def image_embedding(images,
model_fn=resnet_v1_152,
trainable=True,
is_training=True,
weight_decay=0.0001,
batch_norm_decay=0.997,
batch_norm_epsilon=1e-5,
batch_norm_scale=True,
add_summaries=False,
reuse=False):
"""Extract image features from pretrained resnet model."""
is_resnet_training = trainable and is_training
batch_norm_params = {
"is_training": is_resnet_training,
"trainable": trainable,
"decay": batch_norm_decay,
"epsilon": batch_norm_epsilon,
"scale": batch_norm_scale,
}
if trainable:
weights_regularizer = tf.contrib.layers.l2_regularizer(weight_decay)
else:
weights_regularizer = None
with tf.variable_scope(model_fn.__name__, [images], reuse=reuse) as scope:
with slim.arg_scope(
[slim.conv2d],
weights_regularizer=weights_regularizer,
trainable=trainable):
with slim.arg_scope(
[slim.conv2d],
weights_initializer=slim.variance_scaling_initializer(),
activation_fn=tf.nn.relu,
normalizer_fn=slim.batch_norm,
normalizer_params=batch_norm_params):
with slim.arg_scope([slim.batch_norm],
is_training=is_resnet_training,
trainable=trainable):
with slim.arg_scope([slim.max_pool2d], padding="SAME"):
net, end_points = model_fn(
images, num_classes=None, global_pool=False,
is_training=is_resnet_training,
reuse=reuse, scope=scope)
if add_summaries:
for v in end_points.values():
tf.contrib.layers.summaries.summarize_activation(v)
return net
|
[
"def",
"image_embedding",
"(",
"images",
",",
"model_fn",
"=",
"resnet_v1_152",
",",
"trainable",
"=",
"True",
",",
"is_training",
"=",
"True",
",",
"weight_decay",
"=",
"0.0001",
",",
"batch_norm_decay",
"=",
"0.997",
",",
"batch_norm_epsilon",
"=",
"1e-5",
",",
"batch_norm_scale",
"=",
"True",
",",
"add_summaries",
"=",
"False",
",",
"reuse",
"=",
"False",
")",
":",
"is_resnet_training",
"=",
"trainable",
"and",
"is_training",
"batch_norm_params",
"=",
"{",
"\"is_training\"",
":",
"is_resnet_training",
",",
"\"trainable\"",
":",
"trainable",
",",
"\"decay\"",
":",
"batch_norm_decay",
",",
"\"epsilon\"",
":",
"batch_norm_epsilon",
",",
"\"scale\"",
":",
"batch_norm_scale",
",",
"}",
"if",
"trainable",
":",
"weights_regularizer",
"=",
"tf",
".",
"contrib",
".",
"layers",
".",
"l2_regularizer",
"(",
"weight_decay",
")",
"else",
":",
"weights_regularizer",
"=",
"None",
"with",
"tf",
".",
"variable_scope",
"(",
"model_fn",
".",
"__name__",
",",
"[",
"images",
"]",
",",
"reuse",
"=",
"reuse",
")",
"as",
"scope",
":",
"with",
"slim",
".",
"arg_scope",
"(",
"[",
"slim",
".",
"conv2d",
"]",
",",
"weights_regularizer",
"=",
"weights_regularizer",
",",
"trainable",
"=",
"trainable",
")",
":",
"with",
"slim",
".",
"arg_scope",
"(",
"[",
"slim",
".",
"conv2d",
"]",
",",
"weights_initializer",
"=",
"slim",
".",
"variance_scaling_initializer",
"(",
")",
",",
"activation_fn",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"normalizer_fn",
"=",
"slim",
".",
"batch_norm",
",",
"normalizer_params",
"=",
"batch_norm_params",
")",
":",
"with",
"slim",
".",
"arg_scope",
"(",
"[",
"slim",
".",
"batch_norm",
"]",
",",
"is_training",
"=",
"is_resnet_training",
",",
"trainable",
"=",
"trainable",
")",
":",
"with",
"slim",
".",
"arg_scope",
"(",
"[",
"slim",
".",
"max_pool2d",
"]",
",",
"padding",
"=",
"\"SAME\"",
")",
":",
"net",
",",
"end_points",
"=",
"model_fn",
"(",
"images",
",",
"num_classes",
"=",
"None",
",",
"global_pool",
"=",
"False",
",",
"is_training",
"=",
"is_resnet_training",
",",
"reuse",
"=",
"reuse",
",",
"scope",
"=",
"scope",
")",
"if",
"add_summaries",
":",
"for",
"v",
"in",
"end_points",
".",
"values",
"(",
")",
":",
"tf",
".",
"contrib",
".",
"layers",
".",
"summaries",
".",
"summarize_activation",
"(",
"v",
")",
"return",
"net"
] |
Extract image features from pretrained resnet model.
|
[
"Extract",
"image",
"features",
"from",
"pretrained",
"resnet",
"model",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vqa_layers.py#L48-L99
|
train
|
Extract image features from pretrained resnet model.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvb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nectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b110010) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + chr(49) + '\062' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101110 + 0o1) + chr(0b10011 + 0o40) + chr(0b110001) + chr(1489 - 1439), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1893 - 1845) + chr(0b1101111 + 0o0) + '\x33' + chr(317 - 269) + chr(0b1110 + 0o42), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(975 - 864) + '\062' + chr(50) + chr(0b110001), 16446 - 16438), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(1571 - 1522) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(9392 - 9281) + chr(50) + chr(0b100110 + 0o13), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(1131 - 1079) + chr(51), 36146 - 36138), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\x32' + '\061' + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110111) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(0b100010 + 0o115) + chr(0b11000 + 0o34), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(0b10011 + 0o37) + chr(0b110011) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + chr(875 - 825) + chr(72 - 23), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + '\061' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(0b100010 + 0o17) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(1512 - 1458) + '\x35', 24761 - 24753), ehT0Px3KOsy9(chr(2208 - 2160) + '\157' + chr(0b100010 + 0o21) + chr(48) + chr(0b100100 + 0o20), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10 + 0o60) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(494 - 443) + chr(0b110011) + chr(0b110011), 58531 - 58523), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + '\x36' + chr(88 - 39), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(1971 - 1918) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(586 - 475) + chr(0b110010) + chr(0b100011 + 0o15) + chr(0b110101), 47555 - 47547), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + chr(49) + chr(1931 - 1882) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b100 + 0o55) + '\065', 16300 - 16292), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(2600 - 2547) + chr(0b100000 + 0o20), 40608 - 40600), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(0b100001 + 0o21) + '\x35' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10010 + 0o40) + chr(2359 - 2309) + chr(1306 - 1258), 0o10), ehT0Px3KOsy9(chr(1457 - 1409) + chr(111) + '\x31' + chr(349 - 296) + chr(1588 - 1537), ord("\x08")), ehT0Px3KOsy9(chr(1290 - 1242) + chr(111) + chr(0b11000 + 0o36) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10330 - 10219) + chr(0b10101 + 0o34) + '\x33' + chr(52), 30093 - 30085), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110001) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x35' + '\x36', 0o10), ehT0Px3KOsy9(chr(942 - 894) + '\x6f' + chr(0b1 + 0o62) + chr(0b110101 + 0o2) + chr(888 - 833), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(1577 - 1529) + '\x32', 0o10), ehT0Px3KOsy9(chr(895 - 847) + '\157' + chr(49) + chr(0b110110) + chr(515 - 464), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011 + 0o144) + chr(413 - 362) + chr(0b110100) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(1690 - 1636) + chr(0b110101), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1683 - 1630) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'~'), chr(7669 - 7569) + chr(101) + chr(0b1100011) + chr(1038 - 927) + chr(6190 - 6090) + chr(0b1100101))('\165' + '\164' + chr(0b11 + 0o143) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def zfW0CyX6nCUj(YJOmEcibG8C0, zXZmJGZDQ0u3=yqEJXCHGF2sO, blO62vIs9J6u=ehT0Px3KOsy9(chr(505 - 457) + chr(549 - 438) + '\x31', 52779 - 52771), XQJVi3cQFN5l=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8), eB4rJl6fUxw9=0.0001, aTa43vS1ZMeR=0.997, UY5KrO0Dq1IO=1e-05, z1NMnbz40f3s=ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31', 8), uiY28l2fUxa3=ehT0Px3KOsy9(chr(447 - 399) + chr(4654 - 4543) + chr(0b110000), 47276 - 47268), pmC5wdSFgdFj=ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110000), 8)):
es84svzVpCuB = blO62vIs9J6u and XQJVi3cQFN5l
Ed7vX6MaiLyB = {xafqLlk3kkUe(SXOLrMavuUCe(b"9'\x95{\xb2\xf0\xe3\x7f\n\xe0X"), chr(0b111 + 0o135) + chr(101) + '\x63' + '\157' + '\x64' + '\145')(chr(2632 - 2515) + chr(0b1110100) + chr(7146 - 7044) + chr(260 - 215) + '\x38'): es84svzVpCuB, xafqLlk3kkUe(SXOLrMavuUCe(b'$&\xabf\xae\xf0\xe8}\x06'), chr(1198 - 1098) + chr(0b1100101) + '\x63' + chr(111) + '\x64' + '\145')(chr(117) + chr(11689 - 11573) + chr(102) + '\055' + chr(56)): blO62vIs9J6u, xafqLlk3kkUe(SXOLrMavuUCe(b'41\xa9n\xb9'), chr(0b1100100) + chr(0b1100101) + chr(3305 - 3206) + '\x6f' + chr(0b1100100) + '\x65')(chr(117) + chr(116) + chr(102) + chr(0b11111 + 0o16) + chr(0b11011 + 0o35)): aTa43vS1ZMeR, xafqLlk3kkUe(SXOLrMavuUCe(b'5$\xb9f\xac\xfe\xe4'), '\x64' + '\145' + chr(99) + chr(6180 - 6069) + chr(502 - 402) + '\x65')(chr(0b1110010 + 0o3) + '\164' + chr(0b1010000 + 0o26) + chr(0b1101 + 0o40) + '\x38'): UY5KrO0Dq1IO, xafqLlk3kkUe(SXOLrMavuUCe(b'#7\xabc\xa5'), '\144' + chr(5453 - 5352) + '\143' + chr(111) + '\144' + chr(0b1100101))(chr(0b1110101) + '\x74' + '\146' + '\055' + chr(0b0 + 0o70)): z1NMnbz40f3s}
if blO62vIs9J6u:
ucIO6MONfJ8j = IDJ2eXGCBCDu.contrib.layers.l2_regularizer(eB4rJl6fUxw9)
else:
ucIO6MONfJ8j = None
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'&5\xb8f\xa1\xf3\xe6t<\xfd\\k\xebt'), chr(100) + chr(0b10 + 0o143) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(3132 - 3031))('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + '\x38'))(xafqLlk3kkUe(zXZmJGZDQ0u3, xafqLlk3kkUe(SXOLrMavuUCe(b'\x176\xafe\xf4\xfe\xd0`(\xc2~2'), '\144' + '\145' + chr(0b1100011) + chr(111) + '\144' + chr(101))('\x75' + '\x74' + chr(102) + '\055' + '\070')), [YJOmEcibG8C0], reuse=pmC5wdSFgdFj) as CJBHNoj4zKoT:
with xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'1&\xadP\xb3\xf2\xe5a\x06'), chr(0b100010 + 0o102) + '\x65' + chr(0b1100011) + chr(0b111100 + 0o63) + chr(0b1100100) + chr(8378 - 8277))(chr(2161 - 2044) + chr(116) + chr(0b1100110) + chr(0b1 + 0o54) + '\070'))([xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'3;\xa4y\xf2\xf5'), chr(0b1100100) + chr(101) + chr(2047 - 1948) + chr(0b1100100 + 0o13) + chr(100) + chr(0b110011 + 0o62))(chr(0b1110101) + chr(8253 - 8137) + chr(102) + chr(1568 - 1523) + chr(0b110001 + 0o7)))], weights_regularizer=ucIO6MONfJ8j, trainable=blO62vIs9J6u):
with xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'1&\xadP\xb3\xf2\xe5a\x06'), '\144' + chr(7494 - 7393) + chr(0b10010 + 0o121) + chr(0b1101111) + '\x64' + chr(101))(chr(117) + '\164' + chr(0b1100110) + chr(45) + '\x38'))([xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'3;\xa4y\xf2\xf5'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(0b1100101))('\x75' + chr(0b1011 + 0o151) + chr(120 - 18) + '\x2d' + chr(0b111000)))], weights_initializer=xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'&5\xb8f\xa1\xff\xe9t<\xfd\\e\xf7xv\xee\x16\x9c\xaaz\xaf\x18\r\xe9%\xf7\xcd\xd8'), chr(0b1001 + 0o133) + chr(6434 - 6333) + chr(0b1100011) + '\157' + chr(0b1100100) + '\145')(chr(117) + chr(11712 - 11596) + chr(0b11101 + 0o111) + '\055' + '\070'))(), activation_fn=xafqLlk3kkUe(IDJ2eXGCBCDu.nn, xafqLlk3kkUe(SXOLrMavuUCe(b'"1\xa6z'), chr(2876 - 2776) + chr(0b1011010 + 0o13) + '\143' + chr(8827 - 8716) + '\x64' + '\x65')(chr(0b100000 + 0o125) + chr(116) + '\146' + chr(45) + chr(0b101110 + 0o12))), normalizer_fn=xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'25\xbel\xa8\xce\xe4~\x11\xe3'), chr(0b110101 + 0o57) + chr(101) + chr(0b1100011) + '\x6f' + '\144' + chr(101))('\x75' + chr(0b1101100 + 0o10) + chr(449 - 347) + chr(0b101101) + chr(56))), normalizer_params=Ed7vX6MaiLyB):
with xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'1&\xadP\xb3\xf2\xe5a\x06'), chr(3355 - 3255) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(100) + chr(0b10100 + 0o121))(chr(0b1110101) + chr(0b1110100) + chr(102) + '\x2d' + chr(639 - 583)))([xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'25\xbel\xa8\xce\xe4~\x11\xe3'), chr(100) + chr(0b1001110 + 0o27) + chr(2514 - 2415) + '\x6f' + chr(0b1100100) + chr(0b1100101))('\165' + '\164' + chr(102) + '\055' + chr(1417 - 1361)))], is_training=es84svzVpCuB, trainable=blO62vIs9J6u):
with xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'1&\xadP\xb3\xf2\xe5a\x06'), chr(5553 - 5453) + '\145' + chr(0b100 + 0o137) + chr(111) + chr(0b1 + 0o143) + chr(0b100011 + 0o102))(chr(0b1010000 + 0o45) + chr(0b1110100) + chr(3417 - 3315) + '\x2d' + chr(56)))([xafqLlk3kkUe(F2vh0VQFKrSF, xafqLlk3kkUe(SXOLrMavuUCe(b'=5\xb2P\xb0\xfe\xe5}Q\xea'), chr(2049 - 1949) + chr(101) + chr(8459 - 8360) + chr(0b1101111) + '\144' + '\x65')('\165' + '\x74' + '\146' + chr(0b101 + 0o50) + chr(56)))], padding=xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x15\x87J'), chr(3792 - 3692) + '\x65' + chr(0b10000 + 0o123) + chr(0b1101111) + '\144' + chr(101))(chr(10472 - 10355) + chr(11204 - 11088) + chr(102) + chr(45) + '\x38')):
(DyzboKL9cczb, dy86g9LlSYFa) = zXZmJGZDQ0u3(YJOmEcibG8C0, num_classes=None, global_pool=ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + '\x30', 8), is_training=es84svzVpCuB, reuse=pmC5wdSFgdFj, scope=CJBHNoj4zKoT)
if uiY28l2fUxa3:
for cMbll0QYhULo in xafqLlk3kkUe(dy86g9LlSYFa, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\x04\xa4L\x8e\xe4\xbf%+\xbf[f'), chr(0b1100100) + '\x65' + '\x63' + chr(6873 - 6762) + chr(0b1100100) + '\x65')('\x75' + chr(5328 - 5212) + '\146' + chr(1453 - 1408) + chr(0b111000)))():
xafqLlk3kkUe(IDJ2eXGCBCDu.contrib.layers.summaries, xafqLlk3kkUe(SXOLrMavuUCe(b'#!\xa7b\xa1\xe3\xe3k\x06\xd1^g\xefxn\xe8=\x9c\xab}'), chr(0b1100100) + chr(0b1011010 + 0o13) + chr(99) + chr(0b100011 + 0o114) + chr(0b11001 + 0o113) + '\x65')('\165' + chr(0b1110100) + chr(102) + '\055' + chr(0b111000)))(cMbll0QYhULo)
return DyzboKL9cczb
|
tensorflow/tensor2tensor
|
tensor2tensor/layers/vqa_layers.py
|
multihead_attention
|
def multihead_attention(query_antecedent,
memory_antecedent,
bias,
total_key_depth,
total_value_depth,
output_depth,
num_heads,
dropout_rate,
shared_rel=False,
max_relative_position=None,
image_shapes=None,
attention_type="dot_product",
block_length=128,
block_width=128,
q_filter_width=1,
kv_filter_width=1,
q_padding="VALID",
kv_padding="VALID",
cache=None,
gap_size=0,
num_memory_blocks=2,
name="multihead_attention",
save_weights_to=None,
make_image_summary=True,
dropout_broadcast_dims=None,
max_length=None,
vars_3d=False,
scale_dotproduct=True,
**kwargs):
"""Multihead scaled-dot-product attention with input/output transformations.
Args:
query_antecedent: a Tensor with shape [batch, length_q, channels]
memory_antecedent: a Tensor with shape [batch, length_m, channels] or None
bias: bias Tensor (see attention_bias())
total_key_depth: an integer
total_value_depth: an integer
output_depth: an integer
num_heads: an integer dividing total_key_depth and total_value_depth
dropout_rate: a floating point number
shared_rel: boolean to share relative embeddings
max_relative_position: Maximum distance between inputs to generate
unique relation embeddings for. Only relevant
when using "dot_product_relative" attention.
image_shapes: optional tuple of integer scalars.
see comments for attention_image_summary()
attention_type: a string, either "dot_product", "dot_product_relative",
"local_mask_right", "local_unmasked", "masked_dilated_1d",
"unmasked_dilated_1d", graph, or any attention function
with the signature (query, key, value, **kwargs)
block_length: an integer - relevant for "local_mask_right"
block_width: an integer - relevant for "local_unmasked"
q_filter_width: An integer specifying how wide you want the query to be.
kv_filter_width: An integer specifying how wide you want the keys and values
to be.
q_padding: One of "VALID", "SAME" or "LEFT". Default is VALID: No padding.
kv_padding: One of "VALID", "SAME" or "LEFT". Default is "VALID":
no padding.
cache: dict containing Tensors which are the results of previous
attentions, used for fast decoding. Expects the dict to contrain two
keys ('k' and 'v'), for the initial call the values for these keys
should be empty Tensors of the appropriate shape.
'k' [batch_size, 0, key_channels]
'v' [batch_size, 0, value_channels]
gap_size: Integer option for dilated attention to indicate spacing between
memory blocks.
num_memory_blocks: Integer option to indicate how many memory blocks to look
at.
name: an optional string.
save_weights_to: an optional dictionary to capture attention weights
for vizualization; the weights tensor will be appended there under
a string key created from the variable scope (including name).
make_image_summary: Whether to make an attention image summary.
dropout_broadcast_dims: an optional list of integers less than 4
specifying in which dimensions to broadcast the dropout decisions.
saves memory.
max_length: an integer - needed by relative attention
vars_3d: use 3-dimensional variables for input/output transformations
scale_dotproduct: whether to normalize the attention product.
**kwargs (dict): Parameters for the attention function
Caching:
WARNING: For decoder self-attention, i.e. when memory_antecedent == None,
the caching assumes that the bias contains future masking.
The caching works by saving all the previous key and value values so that
you are able to send just the last query location to this attention
function. I.e. if the cache dict is provided it assumes the query is of the
shape [batch_size, 1, hidden_dim] rather than the full memory.
Returns:
The result of the attention transformation. The output shape is
[batch_size, length_q, hidden_dim]
unless the cache dict is provided in which case only the last memory
position is calculated and the output shape is [batch_size, 1, hidden_dim]
Optionally returns an additional loss parameters (ex: load balance loss for
the experts) returned by the attention_type function.
Raises:
ValueError: if the key depth or value depth are not divisible by the
number of attention heads.
"""
if total_key_depth % num_heads != 0:
raise ValueError("Key depth (%d) must be divisible by the number of "
"attention heads (%d)." % (total_key_depth, num_heads))
if total_value_depth % num_heads != 0:
raise ValueError("Value depth (%d) must be divisible by the number of "
"attention heads (%d)." % (total_value_depth, num_heads))
vars_3d_num_heads = num_heads if vars_3d else 0
with tf.variable_scope(name, default_name="multihead_attention",
values=[query_antecedent, memory_antecedent]):
if cache is None or memory_antecedent is None:
q, k, v = common_attention.compute_qkv(
query_antecedent, memory_antecedent,
total_key_depth, total_value_depth, q_filter_width,
kv_filter_width, q_padding, kv_padding,
vars_3d_num_heads=vars_3d_num_heads)
if cache is not None:
if attention_type != "dot_product":
# TODO(petershaw): Support caching when using relative position
# representations, i.e. "dot_product_relative" attention.
raise NotImplementedError(
"Caching is not guaranteed to work with attention types other than"
" dot_product.")
if bias is None:
raise ValueError("Bias required for caching. See function docstring "
"for details.")
if memory_antecedent is not None:
# Encoder-Decoder Attention Cache
q = common_attention.compute_attention_component(
query_antecedent, total_key_depth,
q_filter_width, q_padding, "q",
vars_3d_num_heads=vars_3d_num_heads)
k = cache["k_encdec"]
v = cache["v_encdec"]
else:
k = common_attention.split_heads(k, num_heads)
v = common_attention.split_heads(v, num_heads)
decode_loop_step = kwargs.get("decode_loop_step")
if decode_loop_step is None:
k = cache["k"] = tf.concat([cache["k"], k], axis=2)
v = cache["v"] = tf.concat([cache["v"], v], axis=2)
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_k = tf.transpose(cache["k"], perm=[2, 0, 1, 3])
tmp_k = inplace_ops.alias_inplace_update(
tmp_k, decode_loop_step, tf.squeeze(k, axis=2))
k = cache["k"] = tf.transpose(tmp_k, perm=[1, 2, 0, 3])
tmp_v = tf.transpose(cache["v"], perm=[2, 0, 1, 3])
tmp_v = inplace_ops.alias_inplace_update(
tmp_v, decode_loop_step, tf.squeeze(v, axis=2))
v = cache["v"] = tf.transpose(tmp_v, perm=[1, 2, 0, 3])
q = common_attention.split_heads(q, num_heads)
if cache is None:
k = common_attention.split_heads(k, num_heads)
v = common_attention.split_heads(v, num_heads)
key_depth_per_head = total_key_depth // num_heads
if not vars_3d:
if scale_dotproduct:
q *= key_depth_per_head**-0.5
additional_returned_value = None
if callable(attention_type): # Generic way to extend multihead_attention
x = attention_type(q, k, v, **kwargs)
if isinstance(x, tuple):
x, additional_returned_value = x # Unpack
elif attention_type == "dot_product":
x = common_attention.dot_product_attention(
q, k, v, bias, dropout_rate, image_shapes,
save_weights_to=save_weights_to,
make_image_summary=make_image_summary,
dropout_broadcast_dims=dropout_broadcast_dims)
elif attention_type == "dot_product_relative":
x = common_attention.dot_product_attention_relative(
q,
k,
v,
bias,
max_relative_position,
dropout_rate,
image_shapes,
make_image_summary=make_image_summary)
elif attention_type == "dot_product_relative_v2":
x = common_attention.dot_product_self_attention_relative_v2(
q,
k,
v,
bias,
max_length,
dropout_rate,
image_shapes,
make_image_summary=make_image_summary,
dropout_broadcast_dims=dropout_broadcast_dims)
elif attention_type == "local_within_block_mask_right":
x = common_attention.masked_within_block_local_attention_1d(
q, k, v, block_length=block_length)
elif attention_type == "rel_local_mask_right":
x = common_attention.masked_rel_local_attention_1d(
q, k, v, block_length=block_length,
make_image_summary=make_image_summary,
dropout_rate=dropout_rate,
share_rel_embed=shared_rel)
elif attention_type == "local_mask_right":
x = common_attention.masked_local_attention_1d(
q,
k,
v,
block_length=block_length,
make_image_summary=make_image_summary)
elif attention_type == "local_unmasked":
x = common_attention.local_attention_1d(
q, k, v, block_length=block_length, filter_width=block_width)
elif attention_type == "masked_dilated_1d":
x = common_attention.masked_dilated_self_attention_1d(
q, k, v, block_length, block_width,
gap_size, num_memory_blocks)
else:
assert attention_type == "unmasked_dilated_1d"
x = common_attention.dilated_self_attention_1d(
q, k, v, block_length, block_width,
gap_size, num_memory_blocks)
x = common_attention.combine_heads(x)
# Set last dim specifically.
x.set_shape(x.shape.as_list()[:-1] + [total_value_depth])
if vars_3d:
o_var = tf.get_variable(
"o", [num_heads, total_value_depth // num_heads, output_depth])
o_var = tf.cast(o_var, x.dtype)
o_var = tf.reshape(o_var, [total_value_depth, output_depth])
x = tf.tensordot(x, o_var, axes=1)
else:
x = common_layers.dense(
x, output_depth, use_bias=False, name="output_transform")
if additional_returned_value is not None:
return x, additional_returned_value
return x
|
python
|
def multihead_attention(query_antecedent,
memory_antecedent,
bias,
total_key_depth,
total_value_depth,
output_depth,
num_heads,
dropout_rate,
shared_rel=False,
max_relative_position=None,
image_shapes=None,
attention_type="dot_product",
block_length=128,
block_width=128,
q_filter_width=1,
kv_filter_width=1,
q_padding="VALID",
kv_padding="VALID",
cache=None,
gap_size=0,
num_memory_blocks=2,
name="multihead_attention",
save_weights_to=None,
make_image_summary=True,
dropout_broadcast_dims=None,
max_length=None,
vars_3d=False,
scale_dotproduct=True,
**kwargs):
"""Multihead scaled-dot-product attention with input/output transformations.
Args:
query_antecedent: a Tensor with shape [batch, length_q, channels]
memory_antecedent: a Tensor with shape [batch, length_m, channels] or None
bias: bias Tensor (see attention_bias())
total_key_depth: an integer
total_value_depth: an integer
output_depth: an integer
num_heads: an integer dividing total_key_depth and total_value_depth
dropout_rate: a floating point number
shared_rel: boolean to share relative embeddings
max_relative_position: Maximum distance between inputs to generate
unique relation embeddings for. Only relevant
when using "dot_product_relative" attention.
image_shapes: optional tuple of integer scalars.
see comments for attention_image_summary()
attention_type: a string, either "dot_product", "dot_product_relative",
"local_mask_right", "local_unmasked", "masked_dilated_1d",
"unmasked_dilated_1d", graph, or any attention function
with the signature (query, key, value, **kwargs)
block_length: an integer - relevant for "local_mask_right"
block_width: an integer - relevant for "local_unmasked"
q_filter_width: An integer specifying how wide you want the query to be.
kv_filter_width: An integer specifying how wide you want the keys and values
to be.
q_padding: One of "VALID", "SAME" or "LEFT". Default is VALID: No padding.
kv_padding: One of "VALID", "SAME" or "LEFT". Default is "VALID":
no padding.
cache: dict containing Tensors which are the results of previous
attentions, used for fast decoding. Expects the dict to contrain two
keys ('k' and 'v'), for the initial call the values for these keys
should be empty Tensors of the appropriate shape.
'k' [batch_size, 0, key_channels]
'v' [batch_size, 0, value_channels]
gap_size: Integer option for dilated attention to indicate spacing between
memory blocks.
num_memory_blocks: Integer option to indicate how many memory blocks to look
at.
name: an optional string.
save_weights_to: an optional dictionary to capture attention weights
for vizualization; the weights tensor will be appended there under
a string key created from the variable scope (including name).
make_image_summary: Whether to make an attention image summary.
dropout_broadcast_dims: an optional list of integers less than 4
specifying in which dimensions to broadcast the dropout decisions.
saves memory.
max_length: an integer - needed by relative attention
vars_3d: use 3-dimensional variables for input/output transformations
scale_dotproduct: whether to normalize the attention product.
**kwargs (dict): Parameters for the attention function
Caching:
WARNING: For decoder self-attention, i.e. when memory_antecedent == None,
the caching assumes that the bias contains future masking.
The caching works by saving all the previous key and value values so that
you are able to send just the last query location to this attention
function. I.e. if the cache dict is provided it assumes the query is of the
shape [batch_size, 1, hidden_dim] rather than the full memory.
Returns:
The result of the attention transformation. The output shape is
[batch_size, length_q, hidden_dim]
unless the cache dict is provided in which case only the last memory
position is calculated and the output shape is [batch_size, 1, hidden_dim]
Optionally returns an additional loss parameters (ex: load balance loss for
the experts) returned by the attention_type function.
Raises:
ValueError: if the key depth or value depth are not divisible by the
number of attention heads.
"""
if total_key_depth % num_heads != 0:
raise ValueError("Key depth (%d) must be divisible by the number of "
"attention heads (%d)." % (total_key_depth, num_heads))
if total_value_depth % num_heads != 0:
raise ValueError("Value depth (%d) must be divisible by the number of "
"attention heads (%d)." % (total_value_depth, num_heads))
vars_3d_num_heads = num_heads if vars_3d else 0
with tf.variable_scope(name, default_name="multihead_attention",
values=[query_antecedent, memory_antecedent]):
if cache is None or memory_antecedent is None:
q, k, v = common_attention.compute_qkv(
query_antecedent, memory_antecedent,
total_key_depth, total_value_depth, q_filter_width,
kv_filter_width, q_padding, kv_padding,
vars_3d_num_heads=vars_3d_num_heads)
if cache is not None:
if attention_type != "dot_product":
# TODO(petershaw): Support caching when using relative position
# representations, i.e. "dot_product_relative" attention.
raise NotImplementedError(
"Caching is not guaranteed to work with attention types other than"
" dot_product.")
if bias is None:
raise ValueError("Bias required for caching. See function docstring "
"for details.")
if memory_antecedent is not None:
# Encoder-Decoder Attention Cache
q = common_attention.compute_attention_component(
query_antecedent, total_key_depth,
q_filter_width, q_padding, "q",
vars_3d_num_heads=vars_3d_num_heads)
k = cache["k_encdec"]
v = cache["v_encdec"]
else:
k = common_attention.split_heads(k, num_heads)
v = common_attention.split_heads(v, num_heads)
decode_loop_step = kwargs.get("decode_loop_step")
if decode_loop_step is None:
k = cache["k"] = tf.concat([cache["k"], k], axis=2)
v = cache["v"] = tf.concat([cache["v"], v], axis=2)
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_k = tf.transpose(cache["k"], perm=[2, 0, 1, 3])
tmp_k = inplace_ops.alias_inplace_update(
tmp_k, decode_loop_step, tf.squeeze(k, axis=2))
k = cache["k"] = tf.transpose(tmp_k, perm=[1, 2, 0, 3])
tmp_v = tf.transpose(cache["v"], perm=[2, 0, 1, 3])
tmp_v = inplace_ops.alias_inplace_update(
tmp_v, decode_loop_step, tf.squeeze(v, axis=2))
v = cache["v"] = tf.transpose(tmp_v, perm=[1, 2, 0, 3])
q = common_attention.split_heads(q, num_heads)
if cache is None:
k = common_attention.split_heads(k, num_heads)
v = common_attention.split_heads(v, num_heads)
key_depth_per_head = total_key_depth // num_heads
if not vars_3d:
if scale_dotproduct:
q *= key_depth_per_head**-0.5
additional_returned_value = None
if callable(attention_type): # Generic way to extend multihead_attention
x = attention_type(q, k, v, **kwargs)
if isinstance(x, tuple):
x, additional_returned_value = x # Unpack
elif attention_type == "dot_product":
x = common_attention.dot_product_attention(
q, k, v, bias, dropout_rate, image_shapes,
save_weights_to=save_weights_to,
make_image_summary=make_image_summary,
dropout_broadcast_dims=dropout_broadcast_dims)
elif attention_type == "dot_product_relative":
x = common_attention.dot_product_attention_relative(
q,
k,
v,
bias,
max_relative_position,
dropout_rate,
image_shapes,
make_image_summary=make_image_summary)
elif attention_type == "dot_product_relative_v2":
x = common_attention.dot_product_self_attention_relative_v2(
q,
k,
v,
bias,
max_length,
dropout_rate,
image_shapes,
make_image_summary=make_image_summary,
dropout_broadcast_dims=dropout_broadcast_dims)
elif attention_type == "local_within_block_mask_right":
x = common_attention.masked_within_block_local_attention_1d(
q, k, v, block_length=block_length)
elif attention_type == "rel_local_mask_right":
x = common_attention.masked_rel_local_attention_1d(
q, k, v, block_length=block_length,
make_image_summary=make_image_summary,
dropout_rate=dropout_rate,
share_rel_embed=shared_rel)
elif attention_type == "local_mask_right":
x = common_attention.masked_local_attention_1d(
q,
k,
v,
block_length=block_length,
make_image_summary=make_image_summary)
elif attention_type == "local_unmasked":
x = common_attention.local_attention_1d(
q, k, v, block_length=block_length, filter_width=block_width)
elif attention_type == "masked_dilated_1d":
x = common_attention.masked_dilated_self_attention_1d(
q, k, v, block_length, block_width,
gap_size, num_memory_blocks)
else:
assert attention_type == "unmasked_dilated_1d"
x = common_attention.dilated_self_attention_1d(
q, k, v, block_length, block_width,
gap_size, num_memory_blocks)
x = common_attention.combine_heads(x)
# Set last dim specifically.
x.set_shape(x.shape.as_list()[:-1] + [total_value_depth])
if vars_3d:
o_var = tf.get_variable(
"o", [num_heads, total_value_depth // num_heads, output_depth])
o_var = tf.cast(o_var, x.dtype)
o_var = tf.reshape(o_var, [total_value_depth, output_depth])
x = tf.tensordot(x, o_var, axes=1)
else:
x = common_layers.dense(
x, output_depth, use_bias=False, name="output_transform")
if additional_returned_value is not None:
return x, additional_returned_value
return x
|
[
"def",
"multihead_attention",
"(",
"query_antecedent",
",",
"memory_antecedent",
",",
"bias",
",",
"total_key_depth",
",",
"total_value_depth",
",",
"output_depth",
",",
"num_heads",
",",
"dropout_rate",
",",
"shared_rel",
"=",
"False",
",",
"max_relative_position",
"=",
"None",
",",
"image_shapes",
"=",
"None",
",",
"attention_type",
"=",
"\"dot_product\"",
",",
"block_length",
"=",
"128",
",",
"block_width",
"=",
"128",
",",
"q_filter_width",
"=",
"1",
",",
"kv_filter_width",
"=",
"1",
",",
"q_padding",
"=",
"\"VALID\"",
",",
"kv_padding",
"=",
"\"VALID\"",
",",
"cache",
"=",
"None",
",",
"gap_size",
"=",
"0",
",",
"num_memory_blocks",
"=",
"2",
",",
"name",
"=",
"\"multihead_attention\"",
",",
"save_weights_to",
"=",
"None",
",",
"make_image_summary",
"=",
"True",
",",
"dropout_broadcast_dims",
"=",
"None",
",",
"max_length",
"=",
"None",
",",
"vars_3d",
"=",
"False",
",",
"scale_dotproduct",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"total_key_depth",
"%",
"num_heads",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"Key depth (%d) must be divisible by the number of \"",
"\"attention heads (%d).\"",
"%",
"(",
"total_key_depth",
",",
"num_heads",
")",
")",
"if",
"total_value_depth",
"%",
"num_heads",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"Value depth (%d) must be divisible by the number of \"",
"\"attention heads (%d).\"",
"%",
"(",
"total_value_depth",
",",
"num_heads",
")",
")",
"vars_3d_num_heads",
"=",
"num_heads",
"if",
"vars_3d",
"else",
"0",
"with",
"tf",
".",
"variable_scope",
"(",
"name",
",",
"default_name",
"=",
"\"multihead_attention\"",
",",
"values",
"=",
"[",
"query_antecedent",
",",
"memory_antecedent",
"]",
")",
":",
"if",
"cache",
"is",
"None",
"or",
"memory_antecedent",
"is",
"None",
":",
"q",
",",
"k",
",",
"v",
"=",
"common_attention",
".",
"compute_qkv",
"(",
"query_antecedent",
",",
"memory_antecedent",
",",
"total_key_depth",
",",
"total_value_depth",
",",
"q_filter_width",
",",
"kv_filter_width",
",",
"q_padding",
",",
"kv_padding",
",",
"vars_3d_num_heads",
"=",
"vars_3d_num_heads",
")",
"if",
"cache",
"is",
"not",
"None",
":",
"if",
"attention_type",
"!=",
"\"dot_product\"",
":",
"# TODO(petershaw): Support caching when using relative position",
"# representations, i.e. \"dot_product_relative\" attention.",
"raise",
"NotImplementedError",
"(",
"\"Caching is not guaranteed to work with attention types other than\"",
"\" dot_product.\"",
")",
"if",
"bias",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Bias required for caching. See function docstring \"",
"\"for details.\"",
")",
"if",
"memory_antecedent",
"is",
"not",
"None",
":",
"# Encoder-Decoder Attention Cache",
"q",
"=",
"common_attention",
".",
"compute_attention_component",
"(",
"query_antecedent",
",",
"total_key_depth",
",",
"q_filter_width",
",",
"q_padding",
",",
"\"q\"",
",",
"vars_3d_num_heads",
"=",
"vars_3d_num_heads",
")",
"k",
"=",
"cache",
"[",
"\"k_encdec\"",
"]",
"v",
"=",
"cache",
"[",
"\"v_encdec\"",
"]",
"else",
":",
"k",
"=",
"common_attention",
".",
"split_heads",
"(",
"k",
",",
"num_heads",
")",
"v",
"=",
"common_attention",
".",
"split_heads",
"(",
"v",
",",
"num_heads",
")",
"decode_loop_step",
"=",
"kwargs",
".",
"get",
"(",
"\"decode_loop_step\"",
")",
"if",
"decode_loop_step",
"is",
"None",
":",
"k",
"=",
"cache",
"[",
"\"k\"",
"]",
"=",
"tf",
".",
"concat",
"(",
"[",
"cache",
"[",
"\"k\"",
"]",
",",
"k",
"]",
",",
"axis",
"=",
"2",
")",
"v",
"=",
"cache",
"[",
"\"v\"",
"]",
"=",
"tf",
".",
"concat",
"(",
"[",
"cache",
"[",
"\"v\"",
"]",
",",
"v",
"]",
",",
"axis",
"=",
"2",
")",
"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_k",
"=",
"tf",
".",
"transpose",
"(",
"cache",
"[",
"\"k\"",
"]",
",",
"perm",
"=",
"[",
"2",
",",
"0",
",",
"1",
",",
"3",
"]",
")",
"tmp_k",
"=",
"inplace_ops",
".",
"alias_inplace_update",
"(",
"tmp_k",
",",
"decode_loop_step",
",",
"tf",
".",
"squeeze",
"(",
"k",
",",
"axis",
"=",
"2",
")",
")",
"k",
"=",
"cache",
"[",
"\"k\"",
"]",
"=",
"tf",
".",
"transpose",
"(",
"tmp_k",
",",
"perm",
"=",
"[",
"1",
",",
"2",
",",
"0",
",",
"3",
"]",
")",
"tmp_v",
"=",
"tf",
".",
"transpose",
"(",
"cache",
"[",
"\"v\"",
"]",
",",
"perm",
"=",
"[",
"2",
",",
"0",
",",
"1",
",",
"3",
"]",
")",
"tmp_v",
"=",
"inplace_ops",
".",
"alias_inplace_update",
"(",
"tmp_v",
",",
"decode_loop_step",
",",
"tf",
".",
"squeeze",
"(",
"v",
",",
"axis",
"=",
"2",
")",
")",
"v",
"=",
"cache",
"[",
"\"v\"",
"]",
"=",
"tf",
".",
"transpose",
"(",
"tmp_v",
",",
"perm",
"=",
"[",
"1",
",",
"2",
",",
"0",
",",
"3",
"]",
")",
"q",
"=",
"common_attention",
".",
"split_heads",
"(",
"q",
",",
"num_heads",
")",
"if",
"cache",
"is",
"None",
":",
"k",
"=",
"common_attention",
".",
"split_heads",
"(",
"k",
",",
"num_heads",
")",
"v",
"=",
"common_attention",
".",
"split_heads",
"(",
"v",
",",
"num_heads",
")",
"key_depth_per_head",
"=",
"total_key_depth",
"//",
"num_heads",
"if",
"not",
"vars_3d",
":",
"if",
"scale_dotproduct",
":",
"q",
"*=",
"key_depth_per_head",
"**",
"-",
"0.5",
"additional_returned_value",
"=",
"None",
"if",
"callable",
"(",
"attention_type",
")",
":",
"# Generic way to extend multihead_attention",
"x",
"=",
"attention_type",
"(",
"q",
",",
"k",
",",
"v",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"x",
",",
"tuple",
")",
":",
"x",
",",
"additional_returned_value",
"=",
"x",
"# Unpack",
"elif",
"attention_type",
"==",
"\"dot_product\"",
":",
"x",
"=",
"common_attention",
".",
"dot_product_attention",
"(",
"q",
",",
"k",
",",
"v",
",",
"bias",
",",
"dropout_rate",
",",
"image_shapes",
",",
"save_weights_to",
"=",
"save_weights_to",
",",
"make_image_summary",
"=",
"make_image_summary",
",",
"dropout_broadcast_dims",
"=",
"dropout_broadcast_dims",
")",
"elif",
"attention_type",
"==",
"\"dot_product_relative\"",
":",
"x",
"=",
"common_attention",
".",
"dot_product_attention_relative",
"(",
"q",
",",
"k",
",",
"v",
",",
"bias",
",",
"max_relative_position",
",",
"dropout_rate",
",",
"image_shapes",
",",
"make_image_summary",
"=",
"make_image_summary",
")",
"elif",
"attention_type",
"==",
"\"dot_product_relative_v2\"",
":",
"x",
"=",
"common_attention",
".",
"dot_product_self_attention_relative_v2",
"(",
"q",
",",
"k",
",",
"v",
",",
"bias",
",",
"max_length",
",",
"dropout_rate",
",",
"image_shapes",
",",
"make_image_summary",
"=",
"make_image_summary",
",",
"dropout_broadcast_dims",
"=",
"dropout_broadcast_dims",
")",
"elif",
"attention_type",
"==",
"\"local_within_block_mask_right\"",
":",
"x",
"=",
"common_attention",
".",
"masked_within_block_local_attention_1d",
"(",
"q",
",",
"k",
",",
"v",
",",
"block_length",
"=",
"block_length",
")",
"elif",
"attention_type",
"==",
"\"rel_local_mask_right\"",
":",
"x",
"=",
"common_attention",
".",
"masked_rel_local_attention_1d",
"(",
"q",
",",
"k",
",",
"v",
",",
"block_length",
"=",
"block_length",
",",
"make_image_summary",
"=",
"make_image_summary",
",",
"dropout_rate",
"=",
"dropout_rate",
",",
"share_rel_embed",
"=",
"shared_rel",
")",
"elif",
"attention_type",
"==",
"\"local_mask_right\"",
":",
"x",
"=",
"common_attention",
".",
"masked_local_attention_1d",
"(",
"q",
",",
"k",
",",
"v",
",",
"block_length",
"=",
"block_length",
",",
"make_image_summary",
"=",
"make_image_summary",
")",
"elif",
"attention_type",
"==",
"\"local_unmasked\"",
":",
"x",
"=",
"common_attention",
".",
"local_attention_1d",
"(",
"q",
",",
"k",
",",
"v",
",",
"block_length",
"=",
"block_length",
",",
"filter_width",
"=",
"block_width",
")",
"elif",
"attention_type",
"==",
"\"masked_dilated_1d\"",
":",
"x",
"=",
"common_attention",
".",
"masked_dilated_self_attention_1d",
"(",
"q",
",",
"k",
",",
"v",
",",
"block_length",
",",
"block_width",
",",
"gap_size",
",",
"num_memory_blocks",
")",
"else",
":",
"assert",
"attention_type",
"==",
"\"unmasked_dilated_1d\"",
"x",
"=",
"common_attention",
".",
"dilated_self_attention_1d",
"(",
"q",
",",
"k",
",",
"v",
",",
"block_length",
",",
"block_width",
",",
"gap_size",
",",
"num_memory_blocks",
")",
"x",
"=",
"common_attention",
".",
"combine_heads",
"(",
"x",
")",
"# Set last dim specifically.",
"x",
".",
"set_shape",
"(",
"x",
".",
"shape",
".",
"as_list",
"(",
")",
"[",
":",
"-",
"1",
"]",
"+",
"[",
"total_value_depth",
"]",
")",
"if",
"vars_3d",
":",
"o_var",
"=",
"tf",
".",
"get_variable",
"(",
"\"o\"",
",",
"[",
"num_heads",
",",
"total_value_depth",
"//",
"num_heads",
",",
"output_depth",
"]",
")",
"o_var",
"=",
"tf",
".",
"cast",
"(",
"o_var",
",",
"x",
".",
"dtype",
")",
"o_var",
"=",
"tf",
".",
"reshape",
"(",
"o_var",
",",
"[",
"total_value_depth",
",",
"output_depth",
"]",
")",
"x",
"=",
"tf",
".",
"tensordot",
"(",
"x",
",",
"o_var",
",",
"axes",
"=",
"1",
")",
"else",
":",
"x",
"=",
"common_layers",
".",
"dense",
"(",
"x",
",",
"output_depth",
",",
"use_bias",
"=",
"False",
",",
"name",
"=",
"\"output_transform\"",
")",
"if",
"additional_returned_value",
"is",
"not",
"None",
":",
"return",
"x",
",",
"additional_returned_value",
"return",
"x"
] |
Multihead scaled-dot-product attention with input/output transformations.
Args:
query_antecedent: a Tensor with shape [batch, length_q, channels]
memory_antecedent: a Tensor with shape [batch, length_m, channels] or None
bias: bias Tensor (see attention_bias())
total_key_depth: an integer
total_value_depth: an integer
output_depth: an integer
num_heads: an integer dividing total_key_depth and total_value_depth
dropout_rate: a floating point number
shared_rel: boolean to share relative embeddings
max_relative_position: Maximum distance between inputs to generate
unique relation embeddings for. Only relevant
when using "dot_product_relative" attention.
image_shapes: optional tuple of integer scalars.
see comments for attention_image_summary()
attention_type: a string, either "dot_product", "dot_product_relative",
"local_mask_right", "local_unmasked", "masked_dilated_1d",
"unmasked_dilated_1d", graph, or any attention function
with the signature (query, key, value, **kwargs)
block_length: an integer - relevant for "local_mask_right"
block_width: an integer - relevant for "local_unmasked"
q_filter_width: An integer specifying how wide you want the query to be.
kv_filter_width: An integer specifying how wide you want the keys and values
to be.
q_padding: One of "VALID", "SAME" or "LEFT". Default is VALID: No padding.
kv_padding: One of "VALID", "SAME" or "LEFT". Default is "VALID":
no padding.
cache: dict containing Tensors which are the results of previous
attentions, used for fast decoding. Expects the dict to contrain two
keys ('k' and 'v'), for the initial call the values for these keys
should be empty Tensors of the appropriate shape.
'k' [batch_size, 0, key_channels]
'v' [batch_size, 0, value_channels]
gap_size: Integer option for dilated attention to indicate spacing between
memory blocks.
num_memory_blocks: Integer option to indicate how many memory blocks to look
at.
name: an optional string.
save_weights_to: an optional dictionary to capture attention weights
for vizualization; the weights tensor will be appended there under
a string key created from the variable scope (including name).
make_image_summary: Whether to make an attention image summary.
dropout_broadcast_dims: an optional list of integers less than 4
specifying in which dimensions to broadcast the dropout decisions.
saves memory.
max_length: an integer - needed by relative attention
vars_3d: use 3-dimensional variables for input/output transformations
scale_dotproduct: whether to normalize the attention product.
**kwargs (dict): Parameters for the attention function
Caching:
WARNING: For decoder self-attention, i.e. when memory_antecedent == None,
the caching assumes that the bias contains future masking.
The caching works by saving all the previous key and value values so that
you are able to send just the last query location to this attention
function. I.e. if the cache dict is provided it assumes the query is of the
shape [batch_size, 1, hidden_dim] rather than the full memory.
Returns:
The result of the attention transformation. The output shape is
[batch_size, length_q, hidden_dim]
unless the cache dict is provided in which case only the last memory
position is calculated and the output shape is [batch_size, 1, hidden_dim]
Optionally returns an additional loss parameters (ex: load balance loss for
the experts) returned by the attention_type function.
Raises:
ValueError: if the key depth or value depth are not divisible by the
number of attention heads.
|
[
"Multihead",
"scaled",
"-",
"dot",
"-",
"product",
"attention",
"with",
"input",
"/",
"output",
"transformations",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/vqa_layers.py#L102-L347
|
train
|
Multihead attention with input and output transformations.
|
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,hIlP7994q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4,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(0b100000 + 0o117) + '\061' + '\065' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10111 + 0o33) + chr(0b110010), 6674 - 6666), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(2229 - 2178) + chr(1099 - 1050) + chr(0b1000 + 0o55), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b110001) + '\060', 55923 - 55915), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\060' + chr(54), 0o10), ehT0Px3KOsy9(chr(1880 - 1832) + chr(0b1101100 + 0o3) + chr(0b11011 + 0o30) + chr(0b11000 + 0o31) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(736 - 688) + chr(111) + '\x31' + chr(1103 - 1054) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11111 + 0o24) + chr(48) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11011 + 0o124) + chr(50) + chr(0b11111 + 0o21) + chr(0b101000 + 0o12), 0o10), ehT0Px3KOsy9(chr(2097 - 2049) + chr(5155 - 5044) + chr(0b110001) + chr(0b110000 + 0o1) + '\067', 42480 - 42472), ehT0Px3KOsy9(chr(48) + chr(0b1100100 + 0o13) + '\062' + '\x36' + chr(0b10110 + 0o35), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(7056 - 6945) + chr(51) + '\x37' + chr(0b11000 + 0o30), 0b1000), ehT0Px3KOsy9(chr(1913 - 1865) + '\x6f' + chr(1421 - 1372) + '\065' + '\065', 0b1000), ehT0Px3KOsy9(chr(70 - 22) + chr(0b1011101 + 0o22) + chr(0b110010 + 0o0) + chr(578 - 524) + chr(0b10101 + 0o41), 46872 - 46864), ehT0Px3KOsy9('\060' + chr(4281 - 4170) + chr(0b110011) + chr(2140 - 2086) + chr(2002 - 1953), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2448 - 2398) + chr(49) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(704 - 650) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b1111 + 0o43) + chr(1973 - 1923), ord("\x08")), ehT0Px3KOsy9(chr(1389 - 1341) + chr(0b1101111) + chr(0b110011) + chr(0b10011 + 0o44) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(5955 - 5844) + chr(51) + chr(54) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1100110 + 0o11) + chr(0b110101) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + chr(0b1001 + 0o55) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\x37' + chr(0b10 + 0o61), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(0b0 + 0o61) + '\x31', 0b1000), ehT0Px3KOsy9(chr(2037 - 1989) + '\x6f' + '\062' + chr(0b110100) + chr(0b10111 + 0o35), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110) + '\064', 45426 - 45418), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(50) + '\063', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(514 - 461) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(1058 - 1004) + chr(255 - 202), 23685 - 23677), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1111 + 0o44) + '\063' + chr(2599 - 2545), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100011 + 0o14) + chr(1213 - 1163) + chr(49) + chr(49), 36202 - 36194), ehT0Px3KOsy9('\x30' + chr(2063 - 1952) + '\x31' + chr(0b110101) + '\x33', 62628 - 62620), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(0b110010) + '\066', 51583 - 51575), ehT0Px3KOsy9(chr(1260 - 1212) + chr(0b1101111) + chr(55) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(973 - 925) + '\x6f' + chr(2237 - 2187) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b101 + 0o54) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(48) + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3545 - 3434) + chr(0b110001) + chr(49) + chr(865 - 817), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1238 - 1190), 0b1000), ehT0Px3KOsy9(chr(1026 - 978) + chr(2211 - 2100) + '\x33' + chr(0b1101 + 0o50) + chr(0b110000), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1981 - 1933) + '\x6f' + '\065' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'F'), chr(100) + chr(0b1010011 + 0o22) + chr(0b1100011) + chr(111) + chr(0b1100100) + '\145')(chr(0b11100 + 0o131) + '\164' + chr(7990 - 7888) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def wtXJzTtEIREs(ENas6b3HzFya, LWkuqV72y7LV, IKTrMTySqz10, _jxqy0P17UFy, F9lUBuHPQMmX, EkLrr8g1UZri, vRVqPOZ1hUG7, iI9Z069HML_u, PCprZFqm0QIL=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11000 + 0o30), 8), Fskwuexcn3MJ=None, IHMu1EGwZgDx=None, lZ1GB4L2oMeG=xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c}\xb9\x976\xb9%\xa7\xf7,\xc7'), chr(0b1100100) + '\145' + '\143' + '\x6f' + chr(100) + chr(0b101011 + 0o72))(chr(0b110 + 0o157) + chr(6194 - 6078) + '\146' + chr(184 - 139) + '\070'), MMwtQ0bPonxt=ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\060' + chr(48), 21808 - 21800), H_cF2TKAb4ed=ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11 + 0o57) + chr(0b1000 + 0o50) + chr(0b100110 + 0o12), 8), XyxggehBkXcJ=ehT0Px3KOsy9(chr(844 - 796) + chr(111) + '\061', 0b1000), LcrULzWXUBMx=ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + '\061', 8), lvmOA71tir9r=xafqLlk3kkUe(SXOLrMavuUCe(b'>S\x81\x81\x02'), '\144' + chr(475 - 374) + chr(0b110110 + 0o55) + chr(111) + '\144' + '\x65')(chr(0b1110101) + '\x74' + '\x66' + chr(1179 - 1134) + chr(0b10010 + 0o46)), Vm51G2bCyoNS=xafqLlk3kkUe(SXOLrMavuUCe(b'>S\x81\x81\x02'), chr(0b1111 + 0o125) + '\145' + chr(0b10 + 0o141) + chr(0b1101111) + '\x64' + chr(101))(chr(0b110110 + 0o77) + '\x74' + '\146' + chr(0b101101) + '\070'), j1lPDdxcDbRB=None, GI5dabVzUMZT=ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1001000 + 0o47) + '\x30', 8), csKD83Egmo1G=ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + chr(919 - 869), ord("\x08")), AIvJRzLdDfgF=xafqLlk3kkUe(SXOLrMavuUCe(b'\x05g\xa1\xbc/\xa3/\xa2\xe6\x10\xd2\x8c\x19\xd3\x9f\xfa\xd8\xfd\x92'), chr(100) + chr(101) + chr(0b1100011) + '\x6f' + chr(100) + chr(101))('\165' + '\164' + chr(102) + chr(0b1001 + 0o44) + chr(2170 - 2114)), zWaF_2VBEDjk=None, NC2xHNLwzxcH=ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b110010 + 0o75) + chr(49), 8), Tovc3lDEHg6s=None, _o7pVXAdOCRy=None, ATCcziaCSlIY=ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(48), 8), HWMcCLkdyHpU=ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(49), 8), **M8EIoTs2GJXE):
if _jxqy0P17UFy % vRVqPOZ1hUG7 != ehT0Px3KOsy9('\060' + chr(111) + chr(635 - 587), 8):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'#w\xb4\xe8"\xae:\xb7\xeao\x9b\xdd\t\x9f\xd1\xe3\xc4\xe1\x88\xd3OP\x9b-\xcdB\xfa_\x1c\xbc\xe5\x0e6]h\xaa\xf2 e\xc8\x06g\xa0\xaa#\xb9j\xac\xe4o\xd2\x8c\x19\xd3\x9f\xfa\xd8\xfd\x92\xd3EP\xda-\xd7\x14\xbb\t\x11\xf7\xa7'), chr(0b1100010 + 0o2) + chr(0b1100101) + chr(5646 - 5547) + chr(0b101011 + 0o104) + chr(100) + '\x65')(chr(0b10101 + 0o140) + '\164' + '\146' + '\x2d' + '\x38') % (_jxqy0P17UFy, vRVqPOZ1hUG7))
if F9lUBuHPQMmX % vRVqPOZ1hUG7 != ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + '\060', 8):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'>s\xa1\xbd#\xeb.\xa6\xf2;\xdb\xd8E\x93\x95\xa7\x91\xff\x89\x80Y\x15\xd9,\x84P\xfaZ\x1c\xad\xe0\tzZ1\xe8\xffht\x80\r2\xa3\xbd+\xa9/\xb1\xa2 \xd5\xd8\x0c\xc2\x85\xeb\xdf\xe6\x95\x9cC\x15\xd3,\xc5P\xe0\x0c]\xfb\xedB8'), '\x64' + '\x65' + chr(2678 - 2579) + chr(0b1101111) + chr(7225 - 7125) + chr(3203 - 3102))(chr(7152 - 7035) + chr(9236 - 9120) + chr(102) + '\x2d' + '\x38') % (F9lUBuHPQMmX, vRVqPOZ1hUG7))
UlWL1V3BA5Ze = vRVqPOZ1hUG7 if ATCcziaCSlIY else ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + '\x30', 8)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"\x1es\xbf\xa1'\xa9&\xa6\xdd<\xd0\x97\x1d\xd3"), '\x64' + chr(0b1000011 + 0o42) + chr(99) + chr(6963 - 6852) + '\144' + chr(101))(chr(4076 - 3959) + chr(0b1101100 + 0o10) + chr(0b110101 + 0o61) + chr(45) + chr(0b10101 + 0o43)))(AIvJRzLdDfgF, default_name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x05g\xa1\xbc/\xa3/\xa2\xe6\x10\xd2\x8c\x19\xd3\x9f\xfa\xd8\xfd\x92'), chr(0b110111 + 0o55) + chr(1799 - 1698) + chr(0b11111 + 0o104) + chr(111) + chr(100) + chr(101))(chr(0b110101 + 0o100) + chr(0b1110100) + chr(0b100000 + 0o106) + '\055' + chr(523 - 467)), values=[ENas6b3HzFya, LWkuqV72y7LV]):
if j1lPDdxcDbRB is None or LWkuqV72y7LV is None:
(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo) = WOnrfm4dlYcf.compute_qkv(ENas6b3HzFya, LWkuqV72y7LV, _jxqy0P17UFy, F9lUBuHPQMmX, XyxggehBkXcJ, LcrULzWXUBMx, lvmOA71tir9r, Vm51G2bCyoNS, vars_3d_num_heads=UlWL1V3BA5Ze)
if j1lPDdxcDbRB is not None:
if lZ1GB4L2oMeG != xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c}\xb9\x976\xb9%\xa7\xf7,\xc7'), chr(0b1100100) + chr(0b1100101) + chr(6103 - 6004) + chr(4188 - 4077) + chr(0b1100100) + chr(0b1100101))(chr(10897 - 10780) + '\164' + chr(102) + chr(0b1111 + 0o36) + '\x38'):
raise _zJ24Vce7wp0(xafqLlk3kkUe(SXOLrMavuUCe(b'+s\xae\xa0/\xa5-\xe3\xeb<\x93\x96\x02\xc2\xd1\xe9\xc4\xf3\x8e\x92CA\xde,\xc0\x14\xe7CU\xa9\xe6\x19}\x1ff\xe3\xf2 \x89\x1cf\xa8\xa62\xa2%\xad\xa2;\xca\x88\x08\xc5\xd1\xe1\xc5\xfa\x99\x81\rA\xd3(\xca\x14\xf7C\x01\x81\xf9\x19y[d\xe9\xf2f'), chr(100) + chr(0b101111 + 0o66) + chr(0b1100011) + '\157' + chr(0b1100100) + '\145')(chr(5346 - 5229) + chr(0b1110100) + chr(102) + chr(0b101101) + '\070'))
if IKTrMTySqz10 is None:
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"*{\xac\xbbf\xb9/\xb2\xf7&\xc1\x9d\t\x96\x97\xe1\xc3\xb2\x9f\x92N]\xd2'\xc3\x1a\xb3\x7f\x10\xbb\xa9\rcQr\xfe\xef'n\xc8\x0c}\xae\xbb2\xb9#\xad\xe5o\xd5\x97\x1f\x96\x95\xeb\xc5\xf3\x95\x9f^\x1b"), chr(6034 - 5934) + chr(0b1100101) + '\143' + chr(0b1101001 + 0o6) + '\144' + '\x65')(chr(0b1101011 + 0o12) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + '\070'))
if LWkuqV72y7LV is not None:
WtwjCI_b3w8O = WOnrfm4dlYcf.compute_attention_component(ENas6b3HzFya, _jxqy0P17UFy, XyxggehBkXcJ, lvmOA71tir9r, xafqLlk3kkUe(SXOLrMavuUCe(b'\x19'), chr(0b100010 + 0o102) + chr(101) + chr(0b1010000 + 0o23) + chr(111) + '\x64' + chr(493 - 392))(chr(0b1110101) + '\164' + chr(102) + chr(1031 - 986) + '\070'), vars_3d_num_heads=UlWL1V3BA5Ze)
OolUPRJhRaJd = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x03M\xa8\xa6%\xaf/\xa0'), chr(100) + chr(7574 - 7473) + chr(99) + chr(111) + '\144' + chr(101))(chr(117) + chr(0b1110000 + 0o4) + chr(102) + chr(0b10000 + 0o35) + chr(56))]
cMbll0QYhULo = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x1eM\xa8\xa6%\xaf/\xa0'), '\144' + chr(0b1011110 + 0o7) + chr(7619 - 7520) + chr(6343 - 6232) + chr(100) + '\145')('\165' + chr(4436 - 4320) + '\146' + chr(45) + '\070')]
else:
OolUPRJhRaJd = WOnrfm4dlYcf.split_heads(OolUPRJhRaJd, vRVqPOZ1hUG7)
cMbll0QYhULo = WOnrfm4dlYcf.split_heads(cMbll0QYhULo, vRVqPOZ1hUG7)
Et0FYCPsowFY = M8EIoTs2GJXE.get(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0cw\xae\xa7"\xae\x15\xaf\xed \xc3\xa7\x1e\xc2\x94\xfe'), '\x64' + chr(0b1100101) + '\x63' + '\157' + chr(0b1100100) + chr(101))('\x75' + '\x74' + '\146' + chr(141 - 96) + chr(0b111000)))
if Et0FYCPsowFY is None:
OolUPRJhRaJd = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x03'), chr(0b1100100) + chr(101) + chr(4545 - 4446) + chr(0b10111 + 0o130) + '\x64' + '\145')('\165' + '\164' + '\x66' + chr(45) + '\070')] = IDJ2eXGCBCDu.concat([j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x03'), chr(0b110111 + 0o55) + chr(101) + chr(0b1010010 + 0o21) + chr(0b1000110 + 0o51) + '\x64' + chr(0b1010101 + 0o20))(chr(4017 - 3900) + chr(116) + chr(102) + chr(45) + '\070')], OolUPRJhRaJd], axis=ehT0Px3KOsy9(chr(454 - 406) + chr(0b1101111) + chr(0b110010), 8))
cMbll0QYhULo = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e'), chr(4584 - 4484) + chr(3593 - 3492) + chr(99) + '\157' + chr(0b1111 + 0o125) + chr(101))(chr(0b1110101) + chr(0b1000111 + 0o55) + chr(0b10 + 0o144) + chr(1180 - 1135) + chr(789 - 733))] = IDJ2eXGCBCDu.concat([j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e'), chr(0b1000100 + 0o40) + chr(0b1111 + 0o126) + chr(99) + chr(111) + chr(100) + chr(0b1100101))('\165' + chr(116) + chr(0b10000 + 0o126) + chr(0b1000 + 0o45) + chr(566 - 510))], cMbll0QYhULo], axis=ehT0Px3KOsy9('\x30' + chr(1432 - 1321) + chr(0b1000 + 0o52), 8))
else:
yz3P3FVAg4Tk = IDJ2eXGCBCDu.transpose(j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x03'), chr(5830 - 5730) + chr(101) + chr(5214 - 5115) + chr(0b10011 + 0o134) + chr(0b1100100) + chr(0b1001101 + 0o30))('\165' + chr(116) + chr(0b1001111 + 0o27) + '\x2d' + '\x38')], perm=[ehT0Px3KOsy9(chr(48) + '\157' + chr(50), 8), ehT0Px3KOsy9(chr(48) + chr(375 - 264) + '\060', 8), ehT0Px3KOsy9(chr(478 - 430) + chr(0b1101111) + chr(0b100010 + 0o17), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063', 21559 - 21551)])
yz3P3FVAg4Tk = GanXbkgpxGLx.alias_inplace_update(yz3P3FVAg4Tk, Et0FYCPsowFY, IDJ2eXGCBCDu.squeeze(OolUPRJhRaJd, axis=ehT0Px3KOsy9(chr(48) + chr(111) + '\x32', 8)))
OolUPRJhRaJd = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x03'), chr(2289 - 2189) + '\x65' + '\x63' + chr(111) + chr(0b1100100) + '\145')(chr(117) + '\164' + '\146' + chr(45) + chr(56))] = IDJ2eXGCBCDu.transpose(yz3P3FVAg4Tk, perm=[ehT0Px3KOsy9(chr(574 - 526) + chr(7477 - 7366) + chr(49), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100 + 0o54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1012 - 961), 8)])
Znn1Rt4whjHv = IDJ2eXGCBCDu.transpose(j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e'), '\x64' + chr(0b11 + 0o142) + chr(0b1011 + 0o130) + chr(0b1101111) + '\x64' + '\x65')(chr(0b1010110 + 0o37) + chr(0b100000 + 0o124) + '\146' + chr(0b101101) + chr(0b1 + 0o67))], perm=[ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50), 8), ehT0Px3KOsy9(chr(292 - 244) + chr(0b100011 + 0o114) + chr(0b100110 + 0o12), 8), ehT0Px3KOsy9(chr(893 - 845) + '\x6f' + '\061', 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + '\063', 8)])
Znn1Rt4whjHv = GanXbkgpxGLx.alias_inplace_update(Znn1Rt4whjHv, Et0FYCPsowFY, IDJ2eXGCBCDu.squeeze(cMbll0QYhULo, axis=ehT0Px3KOsy9('\060' + '\x6f' + '\062', 8)))
cMbll0QYhULo = j1lPDdxcDbRB[xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e'), '\144' + chr(0b1100101) + chr(4006 - 3907) + chr(111) + chr(0b100 + 0o140) + chr(0b111111 + 0o46))(chr(0b100 + 0o161) + chr(0b0 + 0o164) + chr(102) + chr(0b1111 + 0o36) + chr(2491 - 2435))] = IDJ2eXGCBCDu.transpose(Znn1Rt4whjHv, perm=[ehT0Px3KOsy9(chr(48) + chr(3255 - 3144) + chr(0b10000 + 0o41), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(50), 8), ehT0Px3KOsy9(chr(48) + chr(3163 - 3052) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(1625 - 1574), 8)])
WtwjCI_b3w8O = WOnrfm4dlYcf.split_heads(WtwjCI_b3w8O, vRVqPOZ1hUG7)
if j1lPDdxcDbRB is None:
OolUPRJhRaJd = WOnrfm4dlYcf.split_heads(OolUPRJhRaJd, vRVqPOZ1hUG7)
cMbll0QYhULo = WOnrfm4dlYcf.split_heads(cMbll0QYhULo, vRVqPOZ1hUG7)
SwYdOFe3xV4H = _jxqy0P17UFy // vRVqPOZ1hUG7
if not ATCcziaCSlIY:
if HWMcCLkdyHpU:
WtwjCI_b3w8O *= SwYdOFe3xV4H ** (-0.5)
b02C5juXis9p = None
if tzcpInYwBvYW(lZ1GB4L2oMeG):
OeWW0F1dBPRQ = lZ1GB4L2oMeG(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, **M8EIoTs2GJXE)
if PlSM16l2KDPD(OeWW0F1dBPRQ, KNyTy8rYcwji):
(OeWW0F1dBPRQ, b02C5juXis9p) = OeWW0F1dBPRQ
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c}\xb9\x976\xb9%\xa7\xf7,\xc7'), chr(1820 - 1720) + chr(0b1011 + 0o132) + chr(99) + chr(0b100 + 0o153) + chr(2949 - 2849) + chr(101))(chr(0b100010 + 0o123) + chr(0b1010100 + 0o40) + chr(1051 - 949) + '\x2d' + '\x38'):
OeWW0F1dBPRQ = WOnrfm4dlYcf.dot_product_attention(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, IKTrMTySqz10, iI9Z069HML_u, IHMu1EGwZgDx, save_weights_to=zWaF_2VBEDjk, make_image_summary=NC2xHNLwzxcH, dropout_broadcast_dims=Tovc3lDEHg6s)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c}\xb9\x976\xb9%\xa7\xf7,\xc7\xa7\x1f\xd3\x9d\xef\xc5\xfb\x8a\x96'), chr(0b1100100) + chr(3884 - 3783) + chr(0b1011110 + 0o5) + chr(2480 - 2369) + chr(0b1100100) + chr(101))('\x75' + chr(6231 - 6115) + chr(102) + chr(45) + chr(0b101111 + 0o11)):
OeWW0F1dBPRQ = WOnrfm4dlYcf.dot_product_attention_relative(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, IKTrMTySqz10, Fskwuexcn3MJ, iI9Z069HML_u, IHMu1EGwZgDx, make_image_summary=NC2xHNLwzxcH)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c}\xb9\x976\xb9%\xa7\xf7,\xc7\xa7\x1f\xd3\x9d\xef\xc5\xfb\x8a\x96rC\x89'), '\x64' + chr(101) + '\x63' + '\x6f' + chr(8960 - 8860) + chr(0b1110 + 0o127))(chr(8279 - 8162) + '\x74' + chr(0b1011 + 0o133) + chr(0b101101) + chr(0b111000)):
OeWW0F1dBPRQ = WOnrfm4dlYcf.dot_product_self_attention_relative_v2(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, IKTrMTySqz10, _o7pVXAdOCRy, iI9Z069HML_u, IHMu1EGwZgDx, make_image_summary=NC2xHNLwzxcH, dropout_broadcast_dims=Tovc3lDEHg6s)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b"\x04}\xae\xa9*\x94=\xaa\xf6'\xda\x962\xd4\x9d\xe1\xd2\xf9\xa3\x9eLF\xd0\x16\xd6]\xf4D\x01"), chr(8774 - 8674) + chr(2079 - 1978) + '\x63' + chr(0b1101111) + '\144' + '\x65')(chr(0b11101 + 0o130) + chr(0b1101110 + 0o6) + chr(0b101111 + 0o67) + '\x2d' + chr(0b111000)):
OeWW0F1dBPRQ = WOnrfm4dlYcf.masked_within_block_local_attention_1d(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, block_length=MMwtQ0bPonxt)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1aw\xa1\x97*\xa4)\xa2\xee\x10\xde\x99\x1e\xdd\xae\xfc\xd8\xf5\x94\x87'), chr(1785 - 1685) + chr(0b1010001 + 0o24) + chr(8987 - 8888) + '\157' + '\x64' + chr(0b1100101))(chr(0b110001 + 0o104) + chr(116) + chr(0b101110 + 0o70) + '\055' + '\x38'):
OeWW0F1dBPRQ = WOnrfm4dlYcf.masked_rel_local_attention_1d(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, block_length=MMwtQ0bPonxt, make_image_summary=NC2xHNLwzxcH, dropout_rate=iI9Z069HML_u, share_rel_embed=PCprZFqm0QIL)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b"\x04}\xae\xa9*\x94'\xa2\xf1$\xec\x8a\x04\xd1\x99\xfa"), chr(100) + '\145' + chr(0b1001011 + 0o30) + chr(4251 - 4140) + chr(100) + chr(0b1100101))(chr(0b1010001 + 0o44) + chr(116) + '\x66' + '\055' + chr(104 - 48)):
OeWW0F1dBPRQ = WOnrfm4dlYcf.masked_local_attention_1d(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, block_length=MMwtQ0bPonxt, make_image_summary=NC2xHNLwzxcH)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x04}\xae\xa9*\x94?\xad\xef.\xc0\x93\x08\xd2'), chr(0b1100100) + chr(0b110000 + 0o65) + chr(0b1011000 + 0o13) + chr(111) + chr(0b1100100) + '\x65')(chr(0b1110100 + 0o1) + '\164' + chr(2596 - 2494) + chr(1092 - 1047) + chr(56)):
OeWW0F1dBPRQ = WOnrfm4dlYcf.local_attention_1d(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, block_length=MMwtQ0bPonxt, filter_width=H_cF2TKAb4ed)
elif lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x05s\xbe\xa3#\xaf\x15\xa7\xeb#\xd2\x8c\x08\xd2\xae\xbf\xd5'), chr(6984 - 6884) + chr(5398 - 5297) + '\x63' + chr(0b1101111) + chr(0b1100100) + '\145')('\165' + chr(0b1110100) + '\146' + chr(0b101101 + 0o0) + chr(0b101011 + 0o15)):
OeWW0F1dBPRQ = WOnrfm4dlYcf.masked_dilated_self_attention_1d(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, MMwtQ0bPonxt, H_cF2TKAb4ed, GI5dabVzUMZT, csKD83Egmo1G)
else:
assert lZ1GB4L2oMeG == xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d|\xa0\xa95\xa0/\xa7\xdd+\xda\x94\x0c\xc2\x94\xea\xee\xa3\x98'), chr(7607 - 7507) + chr(0b110111 + 0o56) + chr(5743 - 5644) + chr(11244 - 11133) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1100110) + '\055' + chr(0b111000))
OeWW0F1dBPRQ = WOnrfm4dlYcf.dilated_self_attention_1d(WtwjCI_b3w8O, OolUPRJhRaJd, cMbll0QYhULo, MMwtQ0bPonxt, H_cF2TKAb4ed, GI5dabVzUMZT, csKD83Egmo1G)
OeWW0F1dBPRQ = WOnrfm4dlYcf.combine_heads(OeWW0F1dBPRQ)
xafqLlk3kkUe(OeWW0F1dBPRQ, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1bw\xb9\x975\xa3+\xb3\xe7'), '\x64' + '\x65' + '\x63' + chr(0b111010 + 0o65) + '\144' + '\145')(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b110011 + 0o5)))(xafqLlk3kkUe(OeWW0F1dBPRQ.shape, xafqLlk3kkUe(SXOLrMavuUCe(b'\ta\x92\xa4/\xb8>'), chr(0b1100100) + chr(0b111011 + 0o52) + chr(0b1011001 + 0o12) + chr(11274 - 11163) + '\x64' + '\145')(chr(117) + chr(0b1110100) + '\x66' + chr(1764 - 1719) + chr(393 - 337)))()[:-ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(7098 - 6987) + '\x31', 8)] + [F9lUBuHPQMmX])
if ATCcziaCSlIY:
JUtal7GNKsm2 = IDJ2eXGCBCDu.get_variable(xafqLlk3kkUe(SXOLrMavuUCe(b'\x07'), '\144' + '\x65' + chr(0b1100011) + '\x6f' + chr(100) + chr(101))(chr(0b1110101) + chr(116) + '\x66' + '\055' + chr(601 - 545)), [vRVqPOZ1hUG7, F9lUBuHPQMmX // vRVqPOZ1hUG7, EkLrr8g1UZri])
JUtal7GNKsm2 = IDJ2eXGCBCDu.cast(JUtal7GNKsm2, OeWW0F1dBPRQ.jSV9IKnemH7K)
JUtal7GNKsm2 = IDJ2eXGCBCDu.reshape(JUtal7GNKsm2, [F9lUBuHPQMmX, EkLrr8g1UZri])
OeWW0F1dBPRQ = IDJ2eXGCBCDu.tensordot(OeWW0F1dBPRQ, JUtal7GNKsm2, axes=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31', 8))
else:
OeWW0F1dBPRQ = jSKPaHwSAfVv.dense(OeWW0F1dBPRQ, EkLrr8g1UZri, use_bias=ehT0Px3KOsy9('\x30' + chr(287 - 176) + chr(978 - 930), 8), name=xafqLlk3kkUe(SXOLrMavuUCe(b'\x07g\xb9\xb83\xbf\x15\xb7\xf0.\xdd\x8b\x0b\xd9\x83\xe3'), chr(100) + chr(0b1100101) + '\x63' + chr(0b1000011 + 0o54) + chr(7148 - 7048) + '\x65')('\165' + chr(116) + chr(102) + chr(834 - 789) + '\070'))
if b02C5juXis9p is not None:
return (OeWW0F1dBPRQ, b02C5juXis9p)
return OeWW0F1dBPRQ
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/audio.py
|
_get_timit
|
def _get_timit(directory):
"""Extract TIMIT datasets to directory unless directory/timit exists."""
if os.path.exists(os.path.join(directory, "timit")):
return
assert FLAGS.timit_paths
for path in FLAGS.timit_paths.split(","):
with tf.gfile.GFile(path) as f:
with tarfile.open(fileobj=f, mode="r:gz") as timit_compressed:
timit_compressed.extractall(directory)
|
python
|
def _get_timit(directory):
"""Extract TIMIT datasets to directory unless directory/timit exists."""
if os.path.exists(os.path.join(directory, "timit")):
return
assert FLAGS.timit_paths
for path in FLAGS.timit_paths.split(","):
with tf.gfile.GFile(path) as f:
with tarfile.open(fileobj=f, mode="r:gz") as timit_compressed:
timit_compressed.extractall(directory)
|
[
"def",
"_get_timit",
"(",
"directory",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"\"timit\"",
")",
")",
":",
"return",
"assert",
"FLAGS",
".",
"timit_paths",
"for",
"path",
"in",
"FLAGS",
".",
"timit_paths",
".",
"split",
"(",
"\",\"",
")",
":",
"with",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"path",
")",
"as",
"f",
":",
"with",
"tarfile",
".",
"open",
"(",
"fileobj",
"=",
"f",
",",
"mode",
"=",
"\"r:gz\"",
")",
"as",
"timit_compressed",
":",
"timit_compressed",
".",
"extractall",
"(",
"directory",
")"
] |
Extract TIMIT datasets to directory unless directory/timit exists.
|
[
"Extract",
"TIMIT",
"datasets",
"to",
"directory",
"unless",
"directory",
"/",
"timit",
"exists",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/audio.py#L44-L53
|
train
|
Extract TIMIT datasets to directory unless directory / timit exists.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkX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DCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001 + 0o2) + '\063', 38494 - 38486), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1011100 + 0o23) + chr(51) + '\x30' + chr(1637 - 1588), 0b1000), ehT0Px3KOsy9(chr(447 - 399) + chr(0b1000100 + 0o53) + chr(0b101101 + 0o6) + chr(0b110100) + chr(645 - 592), 0o10), ehT0Px3KOsy9('\060' + chr(10509 - 10398) + chr(50) + chr(0b110001) + chr(0b11 + 0o63), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110110) + chr(53), 0o10), ehT0Px3KOsy9(chr(774 - 726) + '\157' + chr(0b10100 + 0o37) + '\065' + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(55) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(48) + chr(1031 - 978), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2895 - 2840) + chr(0b10011 + 0o36), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(0b100011 + 0o17) + chr(0b10100 + 0o42) + chr(1860 - 1807), 28541 - 28533), ehT0Px3KOsy9(chr(1320 - 1272) + chr(0b1010011 + 0o34) + chr(1701 - 1651) + chr(0b110101) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7857 - 7746) + chr(2306 - 2255) + '\x35' + chr(0b11101 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + '\x33' + '\066' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(188 - 139) + chr(0b100 + 0o60) + chr(988 - 933), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(2188 - 2139) + chr(50) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(1146 - 1035) + '\x33' + chr(0b100 + 0o60) + chr(1666 - 1618), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(596 - 547) + chr(0b1000 + 0o55), 0o10), ehT0Px3KOsy9(chr(1027 - 979) + '\x6f' + '\x32' + chr(0b11101 + 0o26) + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(11416 - 11305) + chr(2201 - 2151) + '\062' + '\x35', 0o10), ehT0Px3KOsy9(chr(1996 - 1948) + chr(2795 - 2684) + chr(49) + '\x33' + chr(1567 - 1513), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(51) + chr(1718 - 1665), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(55) + chr(1467 - 1419), 0b1000), ehT0Px3KOsy9(chr(1852 - 1804) + chr(3760 - 3649) + chr(97 - 47) + chr(0b100 + 0o63) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010 + 0o0) + chr(876 - 827) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(680 - 630) + '\062' + chr(55), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(48) + chr(53), 14098 - 14090), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b101101 + 0o5) + chr(0b101101 + 0o11) + '\x34', 0o10), ehT0Px3KOsy9(chr(1534 - 1486) + chr(0b1101111) + chr(49) + '\060' + chr(2078 - 2027), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1010001 + 0o36) + chr(0b110011) + chr(973 - 925) + '\066', 25619 - 25611), ehT0Px3KOsy9(chr(48) + chr(214 - 103) + chr(51) + chr(0b100001 + 0o22) + '\067', 39870 - 39862), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(1120 - 1072) + chr(1517 - 1467), 48827 - 48819), ehT0Px3KOsy9('\060' + '\157' + chr(0b1110 + 0o44) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(2039 - 1989) + chr(50) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100101 + 0o112) + chr(2522 - 2471) + chr(0b100010 + 0o23) + chr(0b110011), 11381 - 11373), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(54) + chr(1262 - 1207), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2059 - 2010) + chr(852 - 802) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(2222 - 2174) + '\x6f' + chr(50) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + '\066' + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x36' + '\062', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(1300 - 1252), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'5'), chr(100) + chr(0b110001 + 0o64) + chr(0b1000110 + 0o35) + chr(111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b111100 + 0o70) + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ZoVTweU_k_oo(EVVr9bEHclel):
if xafqLlk3kkUe(oqhJDdMJfuwx.path, xafqLlk3kkUe(SXOLrMavuUCe(b'~\xb9\x8c\xfdA\x9f'), chr(100) + chr(0b10110 + 0o117) + '\143' + '\157' + chr(0b100000 + 0o104) + chr(0b1100101))(chr(0b1000101 + 0o60) + chr(0b1110100) + chr(0b1100110) + chr(265 - 220) + chr(0b111000)))(xafqLlk3kkUe(oqhJDdMJfuwx.path, xafqLlk3kkUe(SXOLrMavuUCe(b'q\xae\x8c\xe0'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(0b10010 + 0o122) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b110011 + 0o63) + chr(0b11101 + 0o20) + '\070'))(EVVr9bEHclel, xafqLlk3kkUe(SXOLrMavuUCe(b'o\xa8\x88\xe7A'), '\x64' + '\x65' + chr(6225 - 6126) + chr(111) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(116) + '\x66' + chr(0b11000 + 0o25) + '\x38'))):
return
assert xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'o\xa8\x88\xe7A\xb3M$M\xdd\xdb'), chr(100) + '\x65' + chr(99) + '\x6f' + chr(0b1100100) + chr(0b1100010 + 0o3))(chr(0b1111 + 0o146) + chr(0b1110100) + '\x66' + chr(45) + chr(56)))
for EaCjyhZptSer in xafqLlk3kkUe(vUTZFbqN0o8F.timit_paths, xafqLlk3kkUe(SXOLrMavuUCe(b'h\xb1\x89\xe7A'), chr(8206 - 8106) + '\145' + '\143' + '\x6f' + chr(0b1010111 + 0o15) + '\145')(chr(3745 - 3628) + '\x74' + chr(102) + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'7'), chr(100) + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(0b111100 + 0o52) + chr(770 - 725) + chr(1507 - 1451))):
with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\\\x87\x8c\xe2P'), '\144' + chr(0b1010 + 0o133) + '\143' + '\157' + '\x64' + '\145')('\165' + '\164' + chr(0b1100110) + chr(571 - 526) + '\070'))(EaCjyhZptSer) as EGyt1xfPT1P6:
with xafqLlk3kkUe(RxqDt8LqC5Ns, xafqLlk3kkUe(SXOLrMavuUCe(b't\xb1\x80\xe0'), chr(100) + chr(8999 - 8898) + '\x63' + chr(111) + chr(0b10100 + 0o120) + chr(101))(chr(6889 - 6772) + chr(116) + chr(102) + '\x2d' + '\x38'))(fileobj=EGyt1xfPT1P6, mode=xafqLlk3kkUe(SXOLrMavuUCe(b'i\xfb\x82\xf4'), '\x64' + chr(2699 - 2598) + chr(9357 - 9258) + '\x6f' + '\144' + chr(3625 - 3524))(chr(0b1110101) + chr(0b1110100) + chr(9889 - 9787) + chr(0b11000 + 0o25) + '\070')) as tQs3fZ736nEZ:
xafqLlk3kkUe(tQs3fZ736nEZ, xafqLlk3kkUe(SXOLrMavuUCe(b'~\xb9\x91\xfcT\x8fI$U\xd9'), '\x64' + chr(0b1100101) + chr(99) + '\157' + chr(0b1100100) + '\x65')(chr(117) + chr(0b1110100) + chr(10057 - 9955) + chr(0b100000 + 0o15) + chr(56)))(EVVr9bEHclel)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/audio.py
|
_collect_data
|
def _collect_data(directory, input_ext, target_ext):
"""Traverses directory collecting input and target files."""
# Directory from string to tuple pair of strings
# key: the filepath to a datafile including the datafile's basename. Example,
# if the datafile was "/path/to/datafile.wav" then the key would be
# "/path/to/datafile"
# value: a pair of strings (input_filepath, target_filepath)
data_files = {}
for root, _, filenames in os.walk(directory):
input_files = [filename for filename in filenames if input_ext in filename]
for input_filename in input_files:
basename = input_filename.strip(input_ext)
input_file = os.path.join(root, input_filename)
target_file = os.path.join(root, basename + target_ext)
key = os.path.join(root, basename)
assert os.path.exists(target_file)
assert key not in data_files
data_files[key] = (input_file, target_file)
return data_files
|
python
|
def _collect_data(directory, input_ext, target_ext):
"""Traverses directory collecting input and target files."""
# Directory from string to tuple pair of strings
# key: the filepath to a datafile including the datafile's basename. Example,
# if the datafile was "/path/to/datafile.wav" then the key would be
# "/path/to/datafile"
# value: a pair of strings (input_filepath, target_filepath)
data_files = {}
for root, _, filenames in os.walk(directory):
input_files = [filename for filename in filenames if input_ext in filename]
for input_filename in input_files:
basename = input_filename.strip(input_ext)
input_file = os.path.join(root, input_filename)
target_file = os.path.join(root, basename + target_ext)
key = os.path.join(root, basename)
assert os.path.exists(target_file)
assert key not in data_files
data_files[key] = (input_file, target_file)
return data_files
|
[
"def",
"_collect_data",
"(",
"directory",
",",
"input_ext",
",",
"target_ext",
")",
":",
"# Directory from string to tuple pair of strings",
"# key: the filepath to a datafile including the datafile's basename. Example,",
"# if the datafile was \"/path/to/datafile.wav\" then the key would be",
"# \"/path/to/datafile\"",
"# value: a pair of strings (input_filepath, target_filepath)",
"data_files",
"=",
"{",
"}",
"for",
"root",
",",
"_",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"directory",
")",
":",
"input_files",
"=",
"[",
"filename",
"for",
"filename",
"in",
"filenames",
"if",
"input_ext",
"in",
"filename",
"]",
"for",
"input_filename",
"in",
"input_files",
":",
"basename",
"=",
"input_filename",
".",
"strip",
"(",
"input_ext",
")",
"input_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"input_filename",
")",
"target_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"basename",
"+",
"target_ext",
")",
"key",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"basename",
")",
"assert",
"os",
".",
"path",
".",
"exists",
"(",
"target_file",
")",
"assert",
"key",
"not",
"in",
"data_files",
"data_files",
"[",
"key",
"]",
"=",
"(",
"input_file",
",",
"target_file",
")",
"return",
"data_files"
] |
Traverses directory collecting input and target files.
|
[
"Traverses",
"directory",
"collecting",
"input",
"and",
"target",
"files",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/audio.py#L56-L74
|
train
|
Traverses a directory collecting input and target files.
|
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) + '\x6f' + chr(0b10011 + 0o40) + chr(0b11110 + 0o24), 56053 - 56045), ehT0Px3KOsy9(chr(0b110000) + chr(0b10101 + 0o132) + chr(0b110001) + chr(1304 - 1250) + chr(0b110001), 12458 - 12450), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + chr(50) + '\x33' + chr(306 - 251), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\066' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2774 - 2663) + chr(0b110010) + chr(1998 - 1947) + '\x34', 7635 - 7627), ehT0Px3KOsy9('\x30' + '\x6f' + chr(678 - 628) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x34', 10708 - 10700), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(686 - 638), 58099 - 58091), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110 + 0o55) + '\067' + chr(0b11111 + 0o22), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1838 - 1788) + chr(0b110101) + chr(0b100111 + 0o14), 12069 - 12061), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(0b110011) + chr(1489 - 1435), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(49) + chr(1175 - 1121) + '\x35', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(1233 - 1183) + chr(2695 - 2642), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(2332 - 2281) + '\x35' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(0b100101 + 0o16) + chr(0b1000 + 0o57) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1698 - 1650) + chr(343 - 232) + chr(0b110010) + chr(48) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\x35' + chr(2778 - 2723), 0b1000), ehT0Px3KOsy9(chr(2174 - 2126) + chr(0b111101 + 0o62) + chr(0b110011) + chr(50) + '\x31', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(49) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100111 + 0o13) + '\x35' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(1644 - 1590) + chr(1115 - 1063), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(0b101 + 0o55) + '\x36' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1100001 + 0o16) + '\062' + '\x35' + '\060', 21434 - 21426), ehT0Px3KOsy9(chr(448 - 400) + '\157' + chr(0b110101) + chr(0b0 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(5261 - 5150) + chr(2397 - 2343) + chr(0b100011 + 0o23), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(53) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(0b110010) + chr(49), 28927 - 28919), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(51) + chr(0b110100) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b110101) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4356 - 4245) + chr(0b110010) + chr(0b110010), 23514 - 23506), ehT0Px3KOsy9(chr(1047 - 999) + chr(111) + chr(0b110010 + 0o2) + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\060' + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\063' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b110010 + 0o0), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + chr(0b1111 + 0o44) + chr(1594 - 1545) + chr(0b1110 + 0o43), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(55) + chr(1527 - 1478), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11010 + 0o30) + chr(2704 - 2652) + chr(52), 33272 - 33264), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(50) + chr(1780 - 1729), 31372 - 31364), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\x37' + '\x34', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + chr(2541 - 2488) + chr(48), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'4'), chr(0b1100100) + chr(0b11011 + 0o112) + chr(0b1100011) + chr(3706 - 3595) + chr(100) + chr(101))(chr(117) + chr(0b1110100) + chr(102) + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Au6893XWGQTu(EVVr9bEHclel, UpkX53Rv1DfH, rtv2YnEQt3Wj):
KAyZjSEftgFC = {}
for (FiL2Xt3u2AMN, VNGQdHSFPrso, Xs6zu3BFE2Ws) in xafqLlk3kkUe(oqhJDdMJfuwx, xafqLlk3kkUe(SXOLrMavuUCe(b'm\x10\xf3\x98'), chr(0b100111 + 0o75) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\x64' + chr(4508 - 4407))(chr(6124 - 6007) + chr(13212 - 13096) + chr(6491 - 6389) + '\x2d' + '\x38'))(EVVr9bEHclel):
jbeEfwtorT8X = [xw4DsBfIJ22E for xw4DsBfIJ22E in Xs6zu3BFE2Ws if UpkX53Rv1DfH in xw4DsBfIJ22E]
for e4aUvqeGbvPz in jbeEfwtorT8X:
g_1BfC8eoU5Q = e4aUvqeGbvPz.strip(UpkX53Rv1DfH)
ZS43hVvGhK4C = oqhJDdMJfuwx.path.join(FiL2Xt3u2AMN, e4aUvqeGbvPz)
CRIagLW0mIXH = oqhJDdMJfuwx.path.join(FiL2Xt3u2AMN, g_1BfC8eoU5Q + rtv2YnEQt3Wj)
K3J4ZwSlE0sT = oqhJDdMJfuwx.path.join(FiL2Xt3u2AMN, g_1BfC8eoU5Q)
assert xafqLlk3kkUe(oqhJDdMJfuwx.path, xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\t\xf6\x80\xe8f'), chr(2946 - 2846) + chr(101) + chr(3685 - 3586) + '\x6f' + '\x64' + chr(101))(chr(0b100001 + 0o124) + chr(9013 - 8897) + chr(0b1100110) + chr(1730 - 1685) + chr(1914 - 1858)))(CRIagLW0mIXH)
assert K3J4ZwSlE0sT not in KAyZjSEftgFC
KAyZjSEftgFC[K3J4ZwSlE0sT] = (ZS43hVvGhK4C, CRIagLW0mIXH)
return KAyZjSEftgFC
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/audio.py
|
timit_generator
|
def timit_generator(data_dir,
tmp_dir,
training,
how_many,
start_from=0,
eos_list=None,
vocab_filename=None,
vocab_size=0):
"""Data generator for TIMIT transcription problem.
Args:
data_dir: path to the data directory.
tmp_dir: path to temporary storage directory.
training: a Boolean; if true, we use the train set, otherwise the test set.
how_many: how many inputs and labels to generate.
start_from: from which input to start.
eos_list: optional list of end of sentence tokens, otherwise use default
value `1`.
vocab_filename: file within `tmp_dir` to read vocabulary from. If this is
not provided then the target sentence will be encoded by character.
vocab_size: integer target to generate vocabulary size to.
Yields:
A dictionary representing the images with the following fields:
* inputs: a float sequence containing the audio data
* audio/channel_count: an integer
* audio/sample_count: an integer
* audio/sample_width: an integer
* targets: an integer sequence representing the encoded sentence
"""
del data_dir
eos_list = [1] if eos_list is None else eos_list
if vocab_filename is not None:
# TODO(lukaszkaiser): Correct this call to generate a vocabulary. No data
# sources are being passed.
# vocab_symbolizer = generator_utils.get_or_generate_vocab(
# data_dir, tmp_dir, vocab_filename, vocab_size)
del vocab_size
vocab_symbolizer = None
assert False
_get_timit(tmp_dir)
datasets = (_TIMIT_TRAIN_DATASETS if training else _TIMIT_TEST_DATASETS)
i = 0
for timit_data_dir, (audio_ext, transcription_ext) in datasets:
timit_data_dir = os.path.join(tmp_dir, timit_data_dir)
data_files = _collect_data(timit_data_dir, audio_ext, transcription_ext)
data_pairs = data_files.values()
for input_file, target_file in sorted(data_pairs)[start_from:]:
if i == how_many:
return
i += 1
audio_data, sample_count, sample_width, num_channels = _get_audio_data(
input_file)
text_data = _get_text_data(target_file)
if vocab_filename is None:
label = [ord(c) for c in text_data] + eos_list
else:
label = vocab_symbolizer.encode(text_data) + eos_list
yield {
"inputs": audio_data,
"audio/channel_count": [num_channels],
"audio/sample_count": [sample_count],
"audio/sample_width": [sample_width],
"targets": label
}
|
python
|
def timit_generator(data_dir,
tmp_dir,
training,
how_many,
start_from=0,
eos_list=None,
vocab_filename=None,
vocab_size=0):
"""Data generator for TIMIT transcription problem.
Args:
data_dir: path to the data directory.
tmp_dir: path to temporary storage directory.
training: a Boolean; if true, we use the train set, otherwise the test set.
how_many: how many inputs and labels to generate.
start_from: from which input to start.
eos_list: optional list of end of sentence tokens, otherwise use default
value `1`.
vocab_filename: file within `tmp_dir` to read vocabulary from. If this is
not provided then the target sentence will be encoded by character.
vocab_size: integer target to generate vocabulary size to.
Yields:
A dictionary representing the images with the following fields:
* inputs: a float sequence containing the audio data
* audio/channel_count: an integer
* audio/sample_count: an integer
* audio/sample_width: an integer
* targets: an integer sequence representing the encoded sentence
"""
del data_dir
eos_list = [1] if eos_list is None else eos_list
if vocab_filename is not None:
# TODO(lukaszkaiser): Correct this call to generate a vocabulary. No data
# sources are being passed.
# vocab_symbolizer = generator_utils.get_or_generate_vocab(
# data_dir, tmp_dir, vocab_filename, vocab_size)
del vocab_size
vocab_symbolizer = None
assert False
_get_timit(tmp_dir)
datasets = (_TIMIT_TRAIN_DATASETS if training else _TIMIT_TEST_DATASETS)
i = 0
for timit_data_dir, (audio_ext, transcription_ext) in datasets:
timit_data_dir = os.path.join(tmp_dir, timit_data_dir)
data_files = _collect_data(timit_data_dir, audio_ext, transcription_ext)
data_pairs = data_files.values()
for input_file, target_file in sorted(data_pairs)[start_from:]:
if i == how_many:
return
i += 1
audio_data, sample_count, sample_width, num_channels = _get_audio_data(
input_file)
text_data = _get_text_data(target_file)
if vocab_filename is None:
label = [ord(c) for c in text_data] + eos_list
else:
label = vocab_symbolizer.encode(text_data) + eos_list
yield {
"inputs": audio_data,
"audio/channel_count": [num_channels],
"audio/sample_count": [sample_count],
"audio/sample_width": [sample_width],
"targets": label
}
|
[
"def",
"timit_generator",
"(",
"data_dir",
",",
"tmp_dir",
",",
"training",
",",
"how_many",
",",
"start_from",
"=",
"0",
",",
"eos_list",
"=",
"None",
",",
"vocab_filename",
"=",
"None",
",",
"vocab_size",
"=",
"0",
")",
":",
"del",
"data_dir",
"eos_list",
"=",
"[",
"1",
"]",
"if",
"eos_list",
"is",
"None",
"else",
"eos_list",
"if",
"vocab_filename",
"is",
"not",
"None",
":",
"# TODO(lukaszkaiser): Correct this call to generate a vocabulary. No data",
"# sources are being passed.",
"# vocab_symbolizer = generator_utils.get_or_generate_vocab(",
"# data_dir, tmp_dir, vocab_filename, vocab_size)",
"del",
"vocab_size",
"vocab_symbolizer",
"=",
"None",
"assert",
"False",
"_get_timit",
"(",
"tmp_dir",
")",
"datasets",
"=",
"(",
"_TIMIT_TRAIN_DATASETS",
"if",
"training",
"else",
"_TIMIT_TEST_DATASETS",
")",
"i",
"=",
"0",
"for",
"timit_data_dir",
",",
"(",
"audio_ext",
",",
"transcription_ext",
")",
"in",
"datasets",
":",
"timit_data_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"timit_data_dir",
")",
"data_files",
"=",
"_collect_data",
"(",
"timit_data_dir",
",",
"audio_ext",
",",
"transcription_ext",
")",
"data_pairs",
"=",
"data_files",
".",
"values",
"(",
")",
"for",
"input_file",
",",
"target_file",
"in",
"sorted",
"(",
"data_pairs",
")",
"[",
"start_from",
":",
"]",
":",
"if",
"i",
"==",
"how_many",
":",
"return",
"i",
"+=",
"1",
"audio_data",
",",
"sample_count",
",",
"sample_width",
",",
"num_channels",
"=",
"_get_audio_data",
"(",
"input_file",
")",
"text_data",
"=",
"_get_text_data",
"(",
"target_file",
")",
"if",
"vocab_filename",
"is",
"None",
":",
"label",
"=",
"[",
"ord",
"(",
"c",
")",
"for",
"c",
"in",
"text_data",
"]",
"+",
"eos_list",
"else",
":",
"label",
"=",
"vocab_symbolizer",
".",
"encode",
"(",
"text_data",
")",
"+",
"eos_list",
"yield",
"{",
"\"inputs\"",
":",
"audio_data",
",",
"\"audio/channel_count\"",
":",
"[",
"num_channels",
"]",
",",
"\"audio/sample_count\"",
":",
"[",
"sample_count",
"]",
",",
"\"audio/sample_width\"",
":",
"[",
"sample_width",
"]",
",",
"\"targets\"",
":",
"label",
"}"
] |
Data generator for TIMIT transcription problem.
Args:
data_dir: path to the data directory.
tmp_dir: path to temporary storage directory.
training: a Boolean; if true, we use the train set, otherwise the test set.
how_many: how many inputs and labels to generate.
start_from: from which input to start.
eos_list: optional list of end of sentence tokens, otherwise use default
value `1`.
vocab_filename: file within `tmp_dir` to read vocabulary from. If this is
not provided then the target sentence will be encoded by character.
vocab_size: integer target to generate vocabulary size to.
Yields:
A dictionary representing the images with the following fields:
* inputs: a float sequence containing the audio data
* audio/channel_count: an integer
* audio/sample_count: an integer
* audio/sample_width: an integer
* targets: an integer sequence representing the encoded sentence
|
[
"Data",
"generator",
"for",
"TIMIT",
"transcription",
"problem",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/audio.py#L98-L162
|
train
|
Generate TIMIT transcription problem.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV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YW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\157' + chr(52) + chr(2435 - 2381), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + '\x31' + chr(0b1000 + 0o51) + chr(52), 50837 - 50829), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110001) + '\065' + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101111 + 0o100) + chr(0b11111 + 0o23) + '\066' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(6747 - 6636) + chr(0b110010) + chr(0b10 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(1031 - 983) + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(877 - 822), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(99 - 49) + chr(0b10110 + 0o35) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b10101 + 0o132) + chr(0b110101), 28033 - 28025), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(0b110110) + '\066', 30629 - 30621), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(52) + '\x31', 48689 - 48681), ehT0Px3KOsy9('\060' + chr(5696 - 5585) + chr(0b110010) + chr(0b101011 + 0o11) + '\x30', 3622 - 3614), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\x33' + '\064' + '\062', 0b1000), ehT0Px3KOsy9(chr(818 - 770) + chr(8526 - 8415) + chr(0b1000 + 0o53) + chr(569 - 521), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11000 + 0o127) + chr(0b1010 + 0o51) + chr(2790 - 2737), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101010 + 0o105) + chr(0b110011) + chr(52 - 2) + chr(2236 - 2185), 0b1000), ehT0Px3KOsy9(chr(48) + chr(5590 - 5479) + chr(0b110010) + chr(0b10000 + 0o43) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + '\x32' + chr(2333 - 2282) + chr(0b100111 + 0o20), 0b1000), ehT0Px3KOsy9('\x30' + chr(2790 - 2679) + chr(0b110010) + chr(887 - 837) + chr(0b110000 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2399 - 2347) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(0b110011) + chr(1318 - 1269) + chr(0b110011), 22007 - 21999), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(483 - 372) + chr(341 - 291) + chr(55) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3832 - 3721) + '\061' + '\067' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + '\062' + chr(388 - 340) + chr(48), 31290 - 31282), ehT0Px3KOsy9(chr(664 - 616) + '\x6f' + chr(2196 - 2147) + chr(0b100 + 0o63) + chr(49), 52043 - 52035), ehT0Px3KOsy9(chr(610 - 562) + chr(111) + chr(1063 - 1014) + '\066' + chr(0b11011 + 0o26), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001000 + 0o47) + chr(0b10010 + 0o40) + chr(253 - 200) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110110) + chr(1925 - 1877), 7099 - 7091), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\x33' + chr(49), 59351 - 59343), ehT0Px3KOsy9(chr(0b110000) + chr(7296 - 7185) + chr(50) + chr(0b11001 + 0o36) + chr(295 - 245), 8), ehT0Px3KOsy9(chr(1101 - 1053) + chr(0b1101111) + chr(50) + chr(369 - 319) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110101) + chr(2636 - 2583), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(12163 - 12052) + '\064' + chr(467 - 414), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10100 + 0o37) + chr(0b110000) + '\063', 0b1000), ehT0Px3KOsy9(chr(1793 - 1745) + '\x6f' + chr(0b100100 + 0o17) + '\x36' + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101 + 0o0), 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1000111 + 0o50) + chr(0b101100 + 0o10), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001010 + 0o45) + chr(1169 - 1118) + chr(2100 - 2047) + chr(0b110100), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + chr(199 - 146) + '\x30', 43967 - 43959)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x08'), chr(100) + chr(0b1100101) + chr(99) + chr(5461 - 5350) + chr(1523 - 1423) + '\145')(chr(4741 - 4624) + '\x74' + '\x66' + chr(0b1100 + 0o41) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def xkv0D9HOsM4m(kVFRD544hi_1, JsZ36NJUqtml, H15mhcYcioqz, HMrjUI4R_mvf, dPV5mRckKEXT=ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(48), 8), wH0XksGV0lgx=None, EwmY7ynOlhiF=None, CeyMIoSyrpkQ=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101 + 0o142) + chr(1748 - 1700), 8)):
del kVFRD544hi_1
wH0XksGV0lgx = [ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31', ord("\x08"))] if wH0XksGV0lgx is None else wH0XksGV0lgx
if EwmY7ynOlhiF is not None:
del CeyMIoSyrpkQ
oEy5exls4zF9 = None
assert ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1 + 0o57), 8)
ZoVTweU_k_oo(JsZ36NJUqtml)
yFP4suyTsK4d = ufvF86qWyIkh if H15mhcYcioqz else qaO2yNLUdK62
WVxHKyX45z_L = ehT0Px3KOsy9('\060' + '\x6f' + chr(2258 - 2210), 8)
for (O9tx1ynTpVls, (LeJJ8E2afn7A, vJU_tft1QIW0)) in yFP4suyTsK4d:
O9tx1ynTpVls = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, O9tx1ynTpVls)
KAyZjSEftgFC = Au6893XWGQTu(O9tx1ynTpVls, LeJJ8E2afn7A, vJU_tft1QIW0)
E8A46haPB4Lg = KAyZjSEftgFC.SPnCNu54H1db()
for (ZS43hVvGhK4C, CRIagLW0mIXH) in vUlqIvNSaRMa(E8A46haPB4Lg)[dPV5mRckKEXT:]:
if WVxHKyX45z_L == HMrjUI4R_mvf:
return
WVxHKyX45z_L += ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061', 8)
(Ec94A1r1frqT, dxusqLPGCrt4, hA8DhFV4eGXo, X1ZpHSxyKbHn) = hHDfFNNRAqGb(ZS43hVvGhK4C)
c5rB3y3v56Y5 = KfB_83YWb0oj(CRIagLW0mIXH)
if EwmY7ynOlhiF is None:
TRUOLFLuD08x = [Jp8aZ6mjyZZT(qzn1Ctg9WgNh) for qzn1Ctg9WgNh in c5rB3y3v56Y5] + wH0XksGV0lgx
else:
TRUOLFLuD08x = oEy5exls4zF9.encode(c5rB3y3v56Y5) + wH0XksGV0lgx
yield {xafqLlk3kkUe(SXOLrMavuUCe(b'O"\x1a\xc6e<'), '\144' + '\145' + '\143' + chr(111) + '\144' + chr(0b1010000 + 0o25))(chr(0b1110101) + chr(0b1100101 + 0o17) + chr(2163 - 2061) + '\x2d' + '\x38'): Ec94A1r1frqT, xafqLlk3kkUe(SXOLrMavuUCe(b'G9\x0e\xda~`\xfam\x97O\xce\x87tL~\xbc\xee\xf1\xe0'), chr(8249 - 8149) + '\x65' + chr(99) + '\157' + '\x64' + '\145')('\x75' + chr(435 - 319) + chr(0b1010 + 0o134) + chr(0b101101) + chr(56)): [X1ZpHSxyKbHn], xafqLlk3kkUe(SXOLrMavuUCe(b'G9\x0e\xda~`\xead\x9bQ\xcc\x87Gpr\xa6\xf5\xeb'), chr(0b1011111 + 0o5) + chr(0b1100101) + chr(8904 - 8805) + '\x6f' + chr(8747 - 8647) + chr(698 - 597))('\x75' + chr(0b1101100 + 0o10) + chr(102) + '\x2d' + chr(0b1000 + 0o60)): [dxusqLPGCrt4], xafqLlk3kkUe(SXOLrMavuUCe(b'G9\x0e\xda~`\xead\x9bQ\xcc\x87Gdt\xb7\xef\xf7'), '\144' + chr(0b1001010 + 0o33) + '\x63' + '\x6f' + chr(0b1100100) + chr(6052 - 5951))('\x75' + '\164' + '\146' + chr(45) + chr(0b111000)): [hA8DhFV4eGXo], xafqLlk3kkUe(SXOLrMavuUCe(b'R-\x18\xd4t;\xea'), chr(100) + '\145' + chr(99) + chr(11509 - 11398) + '\144' + chr(101))('\x75' + '\164' + '\146' + '\x2d' + chr(0b10111 + 0o41)): TRUOLFLuD08x}
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/wikitext103.py
|
_build_vocab
|
def _build_vocab(filename, vocab_dir, vocab_name):
"""Reads a file to build a vocabulary.
Args:
filename: file to read list of words from.
vocab_dir: directory where to save the vocabulary.
vocab_name: vocab file name.
Returns:
text encoder.
"""
vocab_path = os.path.join(vocab_dir, vocab_name)
if not tf.gfile.Exists(vocab_path):
with tf.gfile.GFile(filename, "r") as f:
data = f.read().split()
counter = collections.Counter(data)
count_pairs = sorted(counter.items(), key=lambda x: (-x[1], x[0]))
words, _ = list(zip(*count_pairs))
encoder = text_encoder.TokenTextEncoder(None, vocab_list=words)
encoder.store_to_file(vocab_path)
else:
encoder = text_encoder.TokenTextEncoder(vocab_path)
return encoder
|
python
|
def _build_vocab(filename, vocab_dir, vocab_name):
"""Reads a file to build a vocabulary.
Args:
filename: file to read list of words from.
vocab_dir: directory where to save the vocabulary.
vocab_name: vocab file name.
Returns:
text encoder.
"""
vocab_path = os.path.join(vocab_dir, vocab_name)
if not tf.gfile.Exists(vocab_path):
with tf.gfile.GFile(filename, "r") as f:
data = f.read().split()
counter = collections.Counter(data)
count_pairs = sorted(counter.items(), key=lambda x: (-x[1], x[0]))
words, _ = list(zip(*count_pairs))
encoder = text_encoder.TokenTextEncoder(None, vocab_list=words)
encoder.store_to_file(vocab_path)
else:
encoder = text_encoder.TokenTextEncoder(vocab_path)
return encoder
|
[
"def",
"_build_vocab",
"(",
"filename",
",",
"vocab_dir",
",",
"vocab_name",
")",
":",
"vocab_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"vocab_dir",
",",
"vocab_name",
")",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"vocab_path",
")",
":",
"with",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
".",
"split",
"(",
")",
"counter",
"=",
"collections",
".",
"Counter",
"(",
"data",
")",
"count_pairs",
"=",
"sorted",
"(",
"counter",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"(",
"-",
"x",
"[",
"1",
"]",
",",
"x",
"[",
"0",
"]",
")",
")",
"words",
",",
"_",
"=",
"list",
"(",
"zip",
"(",
"*",
"count_pairs",
")",
")",
"encoder",
"=",
"text_encoder",
".",
"TokenTextEncoder",
"(",
"None",
",",
"vocab_list",
"=",
"words",
")",
"encoder",
".",
"store_to_file",
"(",
"vocab_path",
")",
"else",
":",
"encoder",
"=",
"text_encoder",
".",
"TokenTextEncoder",
"(",
"vocab_path",
")",
"return",
"encoder"
] |
Reads a file to build a vocabulary.
Args:
filename: file to read list of words from.
vocab_dir: directory where to save the vocabulary.
vocab_name: vocab file name.
Returns:
text encoder.
|
[
"Reads",
"a",
"file",
"to",
"build",
"a",
"vocabulary",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/wikitext103.py#L37-L59
|
train
|
Reads a file to build a vocabulary.
|
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(chr(0b110000) + chr(0b1101111) + chr(0b101010 + 0o11) + '\x35' + chr(0b110111), 48669 - 48661), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110100) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(4643 - 4532) + chr(0b110100) + '\065', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2429 - 2378) + '\x30', 33997 - 33989), ehT0Px3KOsy9(chr(2073 - 2025) + chr(9598 - 9487) + chr(0b110010) + '\x37' + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1619 - 1508) + chr(0b110011) + chr(49) + chr(0b101100 + 0o13), 37270 - 37262), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\x35' + '\x37', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10000 + 0o43) + chr(987 - 939) + chr(0b110001), 60093 - 60085), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b110000) + chr(1726 - 1673), 18216 - 18208), ehT0Px3KOsy9('\x30' + chr(6959 - 6848) + chr(0b110000 + 0o3) + chr(1382 - 1330) + chr(1525 - 1477), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100011 + 0o17) + chr(0b110001 + 0o5) + chr(513 - 464), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(0b1101 + 0o45) + chr(52) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110101 + 0o72) + chr(1835 - 1786) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\063' + '\x35', 22081 - 22073), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(51) + chr(55), 4334 - 4326), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b101 + 0o53) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(2187 - 2139) + chr(111) + '\065' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(11832 - 11721) + chr(0b110010) + '\063', 54246 - 54238), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b11010 + 0o125) + chr(0b101110 + 0o3) + '\x30' + chr(0b110111), 25736 - 25728), ehT0Px3KOsy9('\060' + chr(0b1100 + 0o143) + chr(0b1111 + 0o42) + chr(1204 - 1154) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1900 - 1849) + chr(335 - 283), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + chr(0b0 + 0o63) + chr(545 - 491) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(404 - 355) + chr(49) + chr(0b11111 + 0o27), 61541 - 61533), ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + '\x32', 0b1000), ehT0Px3KOsy9(chr(1301 - 1253) + chr(0b11100 + 0o123) + chr(0b110011) + chr(53) + chr(55), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(436 - 388) + '\157' + chr(51) + chr(1981 - 1927) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1374 - 1326) + chr(111) + chr(0b11001 + 0o32) + chr(49) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(1168 - 1115), 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + '\062' + '\x33' + '\x36', 52567 - 52559), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(54), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + chr(123 - 73) + chr(991 - 941) + chr(54), 0o10), ehT0Px3KOsy9(chr(1696 - 1648) + '\157' + chr(0b110010) + chr(1151 - 1098), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b101010 + 0o105) + chr(1239 - 1189) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(909 - 858) + '\061' + chr(2025 - 1970), 8), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(48) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(757 - 706) + chr(1585 - 1534) + chr(0b1110 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2184 - 2073) + chr(49), 16887 - 16879), ehT0Px3KOsy9('\060' + chr(4441 - 4330) + '\061' + '\x37' + chr(0b100111 + 0o17), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x37' + chr(0b110010), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + 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'\xc1'), '\x64' + '\x65' + chr(0b1100011) + chr(0b1001001 + 0o46) + chr(100) + '\145')(chr(117) + chr(0b1110100) + '\x66' + chr(0b0 + 0o55) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ITNmwpAgrirJ(xw4DsBfIJ22E, jQPzVuGI0sJA, CAY9HHsWlyPg):
rbbFI9rmibl3 = oqhJDdMJfuwx.path.join(jQPzVuGI0sJA, CAY9HHsWlyPg)
if not xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xaa]Lk\xca\xbc'), '\144' + chr(7006 - 6905) + chr(99) + chr(0b1001011 + 0o44) + '\x64' + chr(0b100011 + 0o102))(chr(117) + '\164' + chr(7460 - 7358) + chr(0b100000 + 0o15) + chr(56)))(rbbFI9rmibl3):
with xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8cLt\xdb'), chr(0b1000011 + 0o41) + chr(9880 - 9779) + '\143' + '\x6f' + '\x64' + chr(0b1001 + 0o134))(chr(117) + chr(0b1011 + 0o151) + chr(0b1110 + 0o130) + '\055' + '\070'))(xw4DsBfIJ22E, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9d'), chr(0b10001 + 0o123) + '\x65' + '\143' + chr(9358 - 9247) + '\x64' + chr(0b1100101))(chr(0b1110101) + '\x74' + '\146' + chr(905 - 860) + chr(2404 - 2348))) as EGyt1xfPT1P6:
ULnjp6D6efFH = EGyt1xfPT1P6.read().split()
pD5Ye7vZLivj = FGhnnwoh1Dd8.Counter(ULnjp6D6efFH)
Uzbfosj30Ffz = vUlqIvNSaRMa(pD5Ye7vZLivj.NzveIZ3IlSH9(), key=lambda OeWW0F1dBPRQ: (-OeWW0F1dBPRQ[ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + '\061', 8)], OeWW0F1dBPRQ[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(48), 5786 - 5778)]))
(o34DiSJcu6N2, VNGQdHSFPrso) = YyaZ4tpXu4lf(pZ0NK2y6HRbn(*Uzbfosj30Ffz))
hoK3K1TwFlkr = nCRDzZ_Is9fz.TokenTextEncoder(None, vocab_list=o34DiSJcu6N2)
xafqLlk3kkUe(hoK3K1TwFlkr, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9cQJj\xdb\x90\x9b\xae\x1a\x86\xd8\xcbn'), chr(0b1100100 + 0o0) + '\145' + chr(0b1100011) + '\x6f' + chr(0b101001 + 0o73) + chr(101))('\x75' + chr(690 - 574) + chr(102) + '\055' + chr(0b100001 + 0o27)))(rbbFI9rmibl3)
else:
hoK3K1TwFlkr = nCRDzZ_Is9fz.TokenTextEncoder(rbbFI9rmibl3)
return hoK3K1TwFlkr
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/wikitext103.py
|
_maybe_download_corpus
|
def _maybe_download_corpus(tmp_dir, vocab_type):
"""Download and unpack the corpus.
Args:
tmp_dir: directory containing dataset.
vocab_type: which vocabulary are we using.
Returns:
The list of names of files.
"""
if vocab_type == text_problems.VocabType.CHARACTER:
dataset_url = ("https://s3.amazonaws.com/research.metamind.io/wikitext"
"/wikitext-103-raw-v1.zip")
dir_name = "wikitext-103-raw"
else:
dataset_url = ("https://s3.amazonaws.com/research.metamind.io/wikitext"
"/wikitext-103-v1.zip")
dir_name = "wikitext-103"
fname = os.path.basename(dataset_url)
compressed_filepath = generator_utils.maybe_download(tmp_dir, fname,
dataset_url)
zip_ref = zipfile.ZipFile(compressed_filepath, "r")
zip_ref.extractall(tmp_dir)
zip_ref.close()
files = os.path.join(tmp_dir, dir_name, "*")
train_file, valid_file, test_file = None, None, None
for f in tf.gfile.Glob(files):
fname = os.path.basename(f)
if "train" in fname:
train_file = f
elif "valid" in fname:
valid_file = f
elif "test" in fname:
test_file = f
assert train_file, "Training file not found"
assert valid_file, "Validation file not found"
assert test_file, "Testing file not found"
return train_file, valid_file, test_file
|
python
|
def _maybe_download_corpus(tmp_dir, vocab_type):
"""Download and unpack the corpus.
Args:
tmp_dir: directory containing dataset.
vocab_type: which vocabulary are we using.
Returns:
The list of names of files.
"""
if vocab_type == text_problems.VocabType.CHARACTER:
dataset_url = ("https://s3.amazonaws.com/research.metamind.io/wikitext"
"/wikitext-103-raw-v1.zip")
dir_name = "wikitext-103-raw"
else:
dataset_url = ("https://s3.amazonaws.com/research.metamind.io/wikitext"
"/wikitext-103-v1.zip")
dir_name = "wikitext-103"
fname = os.path.basename(dataset_url)
compressed_filepath = generator_utils.maybe_download(tmp_dir, fname,
dataset_url)
zip_ref = zipfile.ZipFile(compressed_filepath, "r")
zip_ref.extractall(tmp_dir)
zip_ref.close()
files = os.path.join(tmp_dir, dir_name, "*")
train_file, valid_file, test_file = None, None, None
for f in tf.gfile.Glob(files):
fname = os.path.basename(f)
if "train" in fname:
train_file = f
elif "valid" in fname:
valid_file = f
elif "test" in fname:
test_file = f
assert train_file, "Training file not found"
assert valid_file, "Validation file not found"
assert test_file, "Testing file not found"
return train_file, valid_file, test_file
|
[
"def",
"_maybe_download_corpus",
"(",
"tmp_dir",
",",
"vocab_type",
")",
":",
"if",
"vocab_type",
"==",
"text_problems",
".",
"VocabType",
".",
"CHARACTER",
":",
"dataset_url",
"=",
"(",
"\"https://s3.amazonaws.com/research.metamind.io/wikitext\"",
"\"/wikitext-103-raw-v1.zip\"",
")",
"dir_name",
"=",
"\"wikitext-103-raw\"",
"else",
":",
"dataset_url",
"=",
"(",
"\"https://s3.amazonaws.com/research.metamind.io/wikitext\"",
"\"/wikitext-103-v1.zip\"",
")",
"dir_name",
"=",
"\"wikitext-103\"",
"fname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"dataset_url",
")",
"compressed_filepath",
"=",
"generator_utils",
".",
"maybe_download",
"(",
"tmp_dir",
",",
"fname",
",",
"dataset_url",
")",
"zip_ref",
"=",
"zipfile",
".",
"ZipFile",
"(",
"compressed_filepath",
",",
"\"r\"",
")",
"zip_ref",
".",
"extractall",
"(",
"tmp_dir",
")",
"zip_ref",
".",
"close",
"(",
")",
"files",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"dir_name",
",",
"\"*\"",
")",
"train_file",
",",
"valid_file",
",",
"test_file",
"=",
"None",
",",
"None",
",",
"None",
"for",
"f",
"in",
"tf",
".",
"gfile",
".",
"Glob",
"(",
"files",
")",
":",
"fname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"f",
")",
"if",
"\"train\"",
"in",
"fname",
":",
"train_file",
"=",
"f",
"elif",
"\"valid\"",
"in",
"fname",
":",
"valid_file",
"=",
"f",
"elif",
"\"test\"",
"in",
"fname",
":",
"test_file",
"=",
"f",
"assert",
"train_file",
",",
"\"Training file not found\"",
"assert",
"valid_file",
",",
"\"Validation file not found\"",
"assert",
"test_file",
",",
"\"Testing file not found\"",
"return",
"train_file",
",",
"valid_file",
",",
"test_file"
] |
Download and unpack the corpus.
Args:
tmp_dir: directory containing dataset.
vocab_type: which vocabulary are we using.
Returns:
The list of names of files.
|
[
"Download",
"and",
"unpack",
"the",
"corpus",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d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ByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + chr(0b100111 + 0o14) + '\x34' + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(1609 - 1498) + '\x31' + chr(0b101001 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(299 - 251) + '\x6f' + '\x31' + '\x37' + chr(0b110011), 46457 - 46449), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + '\061' + '\063' + chr(2516 - 2465), 53897 - 53889), ehT0Px3KOsy9('\060' + chr(1467 - 1356) + chr(671 - 621) + chr(52) + chr(53), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b110100) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(48) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + '\x32' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4704 - 4593) + '\063' + chr(0b110101) + chr(1249 - 1201), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3439 - 3328) + chr(0b110101) + chr(55), 46019 - 46011), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(50) + chr(0b110001 + 0o0) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b10010 + 0o44) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101011 + 0o104) + chr(51) + '\x34' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + '\x31' + '\x34' + chr(614 - 559), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b101001 + 0o15) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101100 + 0o103) + chr(0b110101) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(54) + '\x36', 10190 - 10182), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11110 + 0o23) + chr(52) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(1050 - 1000) + chr(1670 - 1621), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(55) + chr(48), 27943 - 27935), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(0b110001) + chr(317 - 262) + '\x34', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\x37' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(50) + chr(815 - 760) + '\x37', 1518 - 1510), ehT0Px3KOsy9('\x30' + chr(0b10110 + 0o131) + chr(738 - 683) + chr(1319 - 1271), 44476 - 44468), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1010 + 0o50) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11100 + 0o27) + chr(0b110111) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + '\x31' + chr(321 - 273) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x36' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110110) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(3550 - 3439) + chr(50) + '\x34' + chr(0b1110 + 0o45), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + chr(51) + '\061' + chr(51), 0b1000), ehT0Px3KOsy9(chr(1808 - 1760) + chr(111) + chr(0b1 + 0o61) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101000 + 0o13) + chr(49) + chr(1613 - 1564), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11111 + 0o120) + '\066' + chr(53), 26651 - 26643), ehT0Px3KOsy9('\x30' + chr(5282 - 5171) + '\061' + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100 + 0o143) + chr(2369 - 2320) + chr(1442 - 1389) + '\x36', 15859 - 15851), ehT0Px3KOsy9(chr(2015 - 1967) + '\157' + chr(49) + chr(1960 - 1909) + '\060', 4670 - 4662), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b110001) + chr(1943 - 1890), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b110101 + 0o72) + chr(50) + chr(1835 - 1780) + chr(55), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110100 + 0o0) + '\x30', 31724 - 31716)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1011000 + 0o27) + '\065' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc'), chr(0b1001 + 0o133) + chr(2500 - 2399) + chr(5616 - 5517) + chr(0b1001010 + 0o45) + chr(1092 - 992) + chr(0b101001 + 0o74))('\x75' + chr(0b1110100) + chr(102) + chr(0b101101) + chr(110 - 54)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def nOhugYfEsDse(JsZ36NJUqtml, u9HmDYfas07P):
if u9HmDYfas07P == xafqLlk3kkUe(GkH56QMxhclz.VocabType, xafqLlk3kkUe(SXOLrMavuUCe(b"\xa1@:\t\xe4'\xd7\xd3\xba"), chr(100) + chr(0b10100 + 0o121) + chr(0b1100011) + '\x6f' + chr(100) + chr(101))(chr(0b100101 + 0o120) + '\164' + chr(102) + '\055' + '\x38')):
DqYzvcYFcLnE = xafqLlk3kkUe(SXOLrMavuUCe(b"\x8a|\x0f+\xd6^\xac\xb9\x9b\x1c\xa5\x96\x8a\x06\x89A\xd8\x03\xe6\xcbR\x1e\xd0U8\x88'\x83S\xc2\xb9w\xa1\x1b(\x0b,\xec\xd2I\x8clU2\xcaK\xf4\xff\x83F\xff\x92\x9f\x13\xdcY\xdf\t\xf8\xcc\x19\x05\xcb\x15&\xcaq\xddD\xc2\xbc9\xbf\x04k\x141\xfd"), chr(8134 - 8034) + '\x65' + '\x63' + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1000100 + 0o60) + '\x66' + '\055' + '\070')
iAm9284i4LwH = xafqLlk3kkUe(SXOLrMavuUCe(b'\x95a\x102\xd1\x01\xfb\xe2\xc5\x1e\xbb\xc4\xca\x15\x92Y'), chr(6698 - 6598) + chr(5127 - 5026) + '\x63' + chr(111) + '\144' + chr(5215 - 5114))('\x75' + chr(285 - 169) + chr(102) + chr(45) + '\x38')
else:
DqYzvcYFcLnE = xafqLlk3kkUe(SXOLrMavuUCe(b"\x8a|\x0f+\xd6^\xac\xb9\x9b\x1c\xa5\x96\x8a\x06\x89A\xd8\x03\xe6\xcbR\x1e\xd0U8\x88'\x83S\xc2\xb9w\xa1\x1b(\x0b,\xec\xd2I\x8clU2\xcaK\xf4\xff\x83F\xff\x92\x9f\x13\xdcY\xdf\t\xf8\xcc\x19\x05\xcb\x15&\xcaq\xdd@\x92\xe5n\xa0E"), '\144' + '\x65' + '\x63' + '\157' + chr(4831 - 4731) + chr(0b111 + 0o136))('\x75' + chr(12956 - 12840) + chr(9035 - 8933) + chr(0b100001 + 0o14) + chr(0b111000))
iAm9284i4LwH = xafqLlk3kkUe(SXOLrMavuUCe(b'\x95a\x102\xd1\x01\xfb\xe2\xc5\x1e\xbb\xc4'), '\x64' + chr(0b11011 + 0o112) + chr(0b11101 + 0o106) + chr(11240 - 11129) + chr(0b1100100) + chr(0b100000 + 0o105))(chr(6852 - 6735) + '\164' + chr(102) + chr(0b101101) + chr(0b111000))
t3WbF0Ae42Pu = oqhJDdMJfuwx.path.basename(DqYzvcYFcLnE)
kLDY7zEPTscL = g1Z_RG9zP4cD.maybe_download(JsZ36NJUqtml, t3WbF0Ae42Pu, DqYzvcYFcLnE)
Beno10LPAbTt = PFu838VwaBva.ZipFile(kLDY7zEPTscL, xafqLlk3kkUe(SXOLrMavuUCe(b'\x90'), chr(0b1100100) + chr(0b110001 + 0o64) + '\143' + '\x6f' + '\x64' + chr(101))('\165' + chr(0b1001 + 0o153) + '\146' + chr(45) + '\070'))
xafqLlk3kkUe(Beno10LPAbTt, xafqLlk3kkUe(SXOLrMavuUCe(b'\x87p\x0f)\xc4\x07\xf7\xf7\x84C'), chr(0b1100100) + chr(101) + chr(358 - 259) + '\x6f' + chr(5814 - 5714) + chr(101))('\165' + chr(0b1110001 + 0o3) + '\x66' + chr(290 - 245) + chr(709 - 653)))(JsZ36NJUqtml)
xafqLlk3kkUe(Beno10LPAbTt, xafqLlk3kkUe(SXOLrMavuUCe(b'\x81d\x14(\xc0'), chr(0b100111 + 0o75) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(8375 - 8275) + chr(0b1100101))(chr(0b1110101) + chr(9041 - 8925) + '\x66' + chr(1712 - 1667) + '\070'))()
uyc48vokp5OE = oqhJDdMJfuwx.path.join(JsZ36NJUqtml, iAm9284i4LwH, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8'), chr(1753 - 1653) + chr(0b1100101) + chr(9442 - 9343) + '\157' + '\x64' + '\x65')(chr(9329 - 9212) + chr(0b1110100) + chr(0b1001100 + 0o32) + '\055' + chr(0b110010 + 0o6)))
(QmW5h7O9ZXMO, wZUFh_buh7pc, bERgZTpXEjSy) = (None, None, None)
for EGyt1xfPT1P6 in xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa5d\x149'), chr(0b1100100) + '\x65' + chr(0b110 + 0o135) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + '\164' + '\146' + chr(45) + '\x38'))(uyc48vokp5OE):
t3WbF0Ae42Pu = oqhJDdMJfuwx.path.basename(EGyt1xfPT1P6)
if xafqLlk3kkUe(SXOLrMavuUCe(b'\x96z\x1a2\xcb'), chr(0b100011 + 0o101) + chr(6886 - 6785) + chr(6917 - 6818) + chr(0b1101111) + '\x64' + '\145')('\x75' + '\x74' + chr(0b101010 + 0o74) + '\x2d' + '\070') in t3WbF0Ae42Pu:
QmW5h7O9ZXMO = EGyt1xfPT1P6
elif xafqLlk3kkUe(SXOLrMavuUCe(b'\x94i\x172\xc1'), '\x64' + chr(101) + chr(0b11010 + 0o111) + chr(0b1101111) + chr(0b100010 + 0o102) + chr(1161 - 1060))(chr(0b1110101) + chr(4338 - 4222) + '\x66' + '\055' + chr(1261 - 1205)) in t3WbF0Ae42Pu:
wZUFh_buh7pc = EGyt1xfPT1P6
elif xafqLlk3kkUe(SXOLrMavuUCe(b'\x96m\x08/'), '\x64' + chr(101) + chr(1098 - 999) + '\157' + chr(0b11010 + 0o112) + chr(0b1010100 + 0o21))('\x75' + '\164' + chr(4859 - 4757) + chr(0b1000 + 0o45) + chr(0b11101 + 0o33)) in t3WbF0Ae42Pu:
bERgZTpXEjSy = EGyt1xfPT1P6
assert QmW5h7O9ZXMO, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6z\x1a2\xcb\r\xed\xf1\xc8I\xe2\x9b\x82G\x9dA\xc2B\xf7\xd7\t\x13\xdb'), chr(4726 - 4626) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(0b1001000 + 0o34) + chr(0b1100101))(chr(13371 - 13254) + '\164' + chr(0b110100 + 0o62) + chr(0b1011 + 0o42) + chr(0b11001 + 0o37))
assert wZUFh_buh7pc, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4i\x172\xc1\x05\xf7\xff\x87A\xab\x91\x8e\x0b\x96\x0e\xd8\r\xe5\x98\x1a\x12\xcaVs'), chr(0b11101 + 0o107) + chr(0b111101 + 0o50) + chr(2255 - 2156) + chr(111) + chr(100) + '\145')('\165' + '\164' + '\x66' + chr(275 - 230) + chr(0b1001 + 0o57))
assert bERgZTpXEjSy, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6m\x08/\xcc\n\xe4\xb6\x8eF\xe7\x92\xc7\t\x9cZ\x96\x04\xfe\xcd\x12\x19'), chr(100) + '\145' + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(0b1100010 + 0o23) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(1665 - 1609))
return (QmW5h7O9ZXMO, wZUFh_buh7pc, bERgZTpXEjSy)
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/aligned.py
|
get_batch_coordinate
|
def get_batch_coordinate(x):
"""Return a flat int32 tensor of shape [1, batch_size*length, 1]."""
# Compute the batch coordinate before flattening all batches
batch_coordinate = tf.expand_dims(
common_attention.coordinate_tensor(
common_layers.shape_list(x)[:-1], axis=0),
axis=-1)
return batch_coordinate
|
python
|
def get_batch_coordinate(x):
"""Return a flat int32 tensor of shape [1, batch_size*length, 1]."""
# Compute the batch coordinate before flattening all batches
batch_coordinate = tf.expand_dims(
common_attention.coordinate_tensor(
common_layers.shape_list(x)[:-1], axis=0),
axis=-1)
return batch_coordinate
|
[
"def",
"get_batch_coordinate",
"(",
"x",
")",
":",
"# Compute the batch coordinate before flattening all batches",
"batch_coordinate",
"=",
"tf",
".",
"expand_dims",
"(",
"common_attention",
".",
"coordinate_tensor",
"(",
"common_layers",
".",
"shape_list",
"(",
"x",
")",
"[",
":",
"-",
"1",
"]",
",",
"axis",
"=",
"0",
")",
",",
"axis",
"=",
"-",
"1",
")",
"return",
"batch_coordinate"
] |
Return a flat int32 tensor of shape [1, batch_size*length, 1].
|
[
"Return",
"a",
"flat",
"int32",
"tensor",
"of",
"shape",
"[",
"1",
"batch_size",
"*",
"length",
"1",
"]",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/aligned.py#L228-L235
|
train
|
Return a flat int32 tensor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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(10973 - 10862) + '\064' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x36' + '\x32', 49318 - 49310), ehT0Px3KOsy9(chr(1340 - 1292) + chr(0b1101111) + '\062' + '\x31' + chr(179 - 127), 49933 - 49925), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(476 - 365) + chr(169 - 118) + chr(55) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(2233 - 2185) + chr(0b1011011 + 0o24) + '\062' + '\x34' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(987 - 876) + '\061' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101001 + 0o106) + chr(0b11 + 0o57) + '\x30' + chr(52), 0b1000), ehT0Px3KOsy9(chr(1629 - 1581) + chr(0b1101111) + '\062' + chr(355 - 306) + chr(565 - 515), ord("\x08")), ehT0Px3KOsy9(chr(470 - 422) + chr(0b1011010 + 0o25) + chr(53) + '\063', 9148 - 9140), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b11111 + 0o30) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1059 - 1008) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(52), 0o10), ehT0Px3KOsy9(chr(347 - 299) + chr(8646 - 8535) + chr(87 - 38) + chr(0b110001) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10088 - 9977) + chr(103 - 54) + chr(446 - 391) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1071 - 1023) + chr(111) + '\x33' + chr(51) + '\067', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100 + 0o55) + chr(0b110010) + chr(0b110011), 2105 - 2097), ehT0Px3KOsy9('\x30' + chr(0b1011 + 0o144) + chr(0b11 + 0o57) + chr(0b110001) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8117 - 8006) + '\x34' + chr(0b110100), 59151 - 59143), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(0b110001) + chr(0b0 + 0o61), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(8970 - 8859) + '\x31' + chr(0b100100 + 0o14) + chr(54), 40113 - 40105), ehT0Px3KOsy9(chr(1282 - 1234) + chr(0b1101111) + chr(0b110001), 10221 - 10213), ehT0Px3KOsy9(chr(0b110000) + chr(2074 - 1963) + '\062' + '\062', 26447 - 26439), ehT0Px3KOsy9(chr(0b110000) + chr(7940 - 7829) + chr(0b11 + 0o57) + '\061' + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101010 + 0o11) + chr(0b11110 + 0o23) + chr(0b1101 + 0o46), 0o10), ehT0Px3KOsy9(chr(1764 - 1716) + chr(0b1000011 + 0o54) + '\063' + '\061' + chr(924 - 869), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061', 8), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + chr(214 - 165) + chr(0b110111) + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(12084 - 11973) + chr(1874 - 1825) + chr(0b10111 + 0o36) + '\061', 38776 - 38768), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\067' + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\x34' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + chr(0b110011) + '\x30' + chr(1634 - 1582), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5868 - 5757) + chr(0b110011) + '\x33' + chr(614 - 559), 8), ehT0Px3KOsy9(chr(772 - 724) + '\x6f' + '\063' + chr(162 - 113) + chr(0b0 + 0o63), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2065 - 2016) + '\064' + chr(1570 - 1518), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1000100 + 0o53) + '\063' + '\x36' + chr(2162 - 2111), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(542 - 491) + '\066' + chr(54), 63343 - 63335), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + '\063' + chr(0b10011 + 0o41) + chr(0b11010 + 0o27), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\067' + '\061', 43830 - 43822), ehT0Px3KOsy9(chr(979 - 931) + chr(0b1101111) + chr(0b101100 + 0o7) + chr(0b110100) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(2399 - 2344), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(53) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f'), chr(0b1100100) + '\x65' + '\143' + '\157' + chr(0b1100100 + 0o0) + chr(0b1100101))('\165' + '\x74' + chr(0b1100110) + '\x2d' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def X86yhumeavQI(OeWW0F1dBPRQ):
E6EllSXMFF9I = IDJ2eXGCBCDu.expand_dims(WOnrfm4dlYcf.coordinate_tensor(jSKPaHwSAfVv.shape_list(OeWW0F1dBPRQ)[:-ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + chr(423 - 374), 8)], axis=ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000), ord("\x08"))), axis=-ehT0Px3KOsy9(chr(48) + chr(111) + '\061', 8))
return E6EllSXMFF9I
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/aligned.py
|
aligned_base
|
def aligned_base():
"""Set of hyperparameters.
languagemodel_wiki_scramble1k50, 1gpu, 7k steps (10min): log(ppl)_eval = 2.60
12.0 steps/sec on P100
8gpu (8x batch), 7k steps: log(ppl)_eval = 2.00
Returns:
a hparams object
"""
hparams = common_hparams.basic_params1()
hparams.hidden_size = 512
hparams.batch_size = 5000
hparams.max_length = 0
hparams.min_length_bucket = 1024
hparams.dropout = 0.0
hparams.layer_prepostprocess_dropout = 0.0
hparams.label_smoothing = 0.0
hparams.clip_grad_norm = 0. # i.e. no gradient clipping
hparams.optimizer_adam_epsilon = 1e-9
hparams.learning_rate_decay_scheme = "noam"
hparams.learning_rate = 0.1
hparams.learning_rate_warmup_steps = 2000
hparams.initializer_gain = 1.0
hparams.initializer = "uniform_unit_scaling"
hparams.weight_decay = 0.0
hparams.optimizer_adam_beta1 = 0.9
hparams.optimizer_adam_beta2 = 0.98
hparams.shared_embedding_and_softmax_weights = True
hparams.add_hparam("ffn_hidden_sizes", "2048") # Add new ones like this.
hparams.moe_num_experts = 32
hparams.layer_preprocess_sequence = "n"
hparams.layer_postprocess_sequence = "da"
hparams.add_hparam("layers", "timing," + "conv,att,ffn," * 2)
# attention-related flags
hparams.add_hparam("num_heads", 8)
hparams.add_hparam("attention_key_channels", 0)
hparams.add_hparam("attention_value_channels", 0)
# All hyperparameters ending in "dropout" are automatically set to 0.0
# when not in training mode.
hparams.add_hparam("attention_dropout", 0.0)
hparams.add_hparam("pos", "timing") # timing, none
# moe params. local attention moe.
hparams.add_hparam("attention_local", False)
hparams.add_hparam("attention_moe_k", 2)
hparams.add_hparam("attention_num_experts", 16)
hparams.add_hparam("attention_split_batch", False)
# Key, query and value dimensions for the attention
hparams.add_hparam("attention_kq_size", 128)
hparams.add_hparam("attention_v_size", 256)
# Loss coef for load balancing
hparams.add_hparam("attention_load_balance", 2e-2)
hparams.add_hparam("diet_experts", False)
hparams.add_hparam("memory_efficient_ffn", False)
hparams.add_hparam("local_attention_window", 128)
hparams.add_hparam("attention_num_groups", 8)
hparams.add_hparam("memory_target_density", 2.0)
hparams.add_hparam("multiplicative_overhead", 1.25)
hparams.add_hparam("multiplicative_overhead_eval", 2.0)
hparams.add_hparam("attention_image_summary", True)
# LSH params
hparams.add_hparam("lsh_truncated", True)
# For testing right-masking.
# This is not implemented in all layers.
hparams.add_hparam("mask_right", False)
return hparams
|
python
|
def aligned_base():
"""Set of hyperparameters.
languagemodel_wiki_scramble1k50, 1gpu, 7k steps (10min): log(ppl)_eval = 2.60
12.0 steps/sec on P100
8gpu (8x batch), 7k steps: log(ppl)_eval = 2.00
Returns:
a hparams object
"""
hparams = common_hparams.basic_params1()
hparams.hidden_size = 512
hparams.batch_size = 5000
hparams.max_length = 0
hparams.min_length_bucket = 1024
hparams.dropout = 0.0
hparams.layer_prepostprocess_dropout = 0.0
hparams.label_smoothing = 0.0
hparams.clip_grad_norm = 0. # i.e. no gradient clipping
hparams.optimizer_adam_epsilon = 1e-9
hparams.learning_rate_decay_scheme = "noam"
hparams.learning_rate = 0.1
hparams.learning_rate_warmup_steps = 2000
hparams.initializer_gain = 1.0
hparams.initializer = "uniform_unit_scaling"
hparams.weight_decay = 0.0
hparams.optimizer_adam_beta1 = 0.9
hparams.optimizer_adam_beta2 = 0.98
hparams.shared_embedding_and_softmax_weights = True
hparams.add_hparam("ffn_hidden_sizes", "2048") # Add new ones like this.
hparams.moe_num_experts = 32
hparams.layer_preprocess_sequence = "n"
hparams.layer_postprocess_sequence = "da"
hparams.add_hparam("layers", "timing," + "conv,att,ffn," * 2)
# attention-related flags
hparams.add_hparam("num_heads", 8)
hparams.add_hparam("attention_key_channels", 0)
hparams.add_hparam("attention_value_channels", 0)
# All hyperparameters ending in "dropout" are automatically set to 0.0
# when not in training mode.
hparams.add_hparam("attention_dropout", 0.0)
hparams.add_hparam("pos", "timing") # timing, none
# moe params. local attention moe.
hparams.add_hparam("attention_local", False)
hparams.add_hparam("attention_moe_k", 2)
hparams.add_hparam("attention_num_experts", 16)
hparams.add_hparam("attention_split_batch", False)
# Key, query and value dimensions for the attention
hparams.add_hparam("attention_kq_size", 128)
hparams.add_hparam("attention_v_size", 256)
# Loss coef for load balancing
hparams.add_hparam("attention_load_balance", 2e-2)
hparams.add_hparam("diet_experts", False)
hparams.add_hparam("memory_efficient_ffn", False)
hparams.add_hparam("local_attention_window", 128)
hparams.add_hparam("attention_num_groups", 8)
hparams.add_hparam("memory_target_density", 2.0)
hparams.add_hparam("multiplicative_overhead", 1.25)
hparams.add_hparam("multiplicative_overhead_eval", 2.0)
hparams.add_hparam("attention_image_summary", True)
# LSH params
hparams.add_hparam("lsh_truncated", True)
# For testing right-masking.
# This is not implemented in all layers.
hparams.add_hparam("mask_right", False)
return hparams
|
[
"def",
"aligned_base",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"hparams",
".",
"hidden_size",
"=",
"512",
"hparams",
".",
"batch_size",
"=",
"5000",
"hparams",
".",
"max_length",
"=",
"0",
"hparams",
".",
"min_length_bucket",
"=",
"1024",
"hparams",
".",
"dropout",
"=",
"0.0",
"hparams",
".",
"layer_prepostprocess_dropout",
"=",
"0.0",
"hparams",
".",
"label_smoothing",
"=",
"0.0",
"hparams",
".",
"clip_grad_norm",
"=",
"0.",
"# i.e. no gradient clipping",
"hparams",
".",
"optimizer_adam_epsilon",
"=",
"1e-9",
"hparams",
".",
"learning_rate_decay_scheme",
"=",
"\"noam\"",
"hparams",
".",
"learning_rate",
"=",
"0.1",
"hparams",
".",
"learning_rate_warmup_steps",
"=",
"2000",
"hparams",
".",
"initializer_gain",
"=",
"1.0",
"hparams",
".",
"initializer",
"=",
"\"uniform_unit_scaling\"",
"hparams",
".",
"weight_decay",
"=",
"0.0",
"hparams",
".",
"optimizer_adam_beta1",
"=",
"0.9",
"hparams",
".",
"optimizer_adam_beta2",
"=",
"0.98",
"hparams",
".",
"shared_embedding_and_softmax_weights",
"=",
"True",
"hparams",
".",
"add_hparam",
"(",
"\"ffn_hidden_sizes\"",
",",
"\"2048\"",
")",
"# Add new ones like this.",
"hparams",
".",
"moe_num_experts",
"=",
"32",
"hparams",
".",
"layer_preprocess_sequence",
"=",
"\"n\"",
"hparams",
".",
"layer_postprocess_sequence",
"=",
"\"da\"",
"hparams",
".",
"add_hparam",
"(",
"\"layers\"",
",",
"\"timing,\"",
"+",
"\"conv,att,ffn,\"",
"*",
"2",
")",
"# attention-related flags",
"hparams",
".",
"add_hparam",
"(",
"\"num_heads\"",
",",
"8",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_key_channels\"",
",",
"0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_value_channels\"",
",",
"0",
")",
"# All hyperparameters ending in \"dropout\" are automatically set to 0.0",
"# when not in training mode.",
"hparams",
".",
"add_hparam",
"(",
"\"attention_dropout\"",
",",
"0.0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"pos\"",
",",
"\"timing\"",
")",
"# timing, none",
"# moe params. local attention moe.",
"hparams",
".",
"add_hparam",
"(",
"\"attention_local\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_moe_k\"",
",",
"2",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_num_experts\"",
",",
"16",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_split_batch\"",
",",
"False",
")",
"# Key, query and value dimensions for the attention",
"hparams",
".",
"add_hparam",
"(",
"\"attention_kq_size\"",
",",
"128",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_v_size\"",
",",
"256",
")",
"# Loss coef for load balancing",
"hparams",
".",
"add_hparam",
"(",
"\"attention_load_balance\"",
",",
"2e-2",
")",
"hparams",
".",
"add_hparam",
"(",
"\"diet_experts\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"memory_efficient_ffn\"",
",",
"False",
")",
"hparams",
".",
"add_hparam",
"(",
"\"local_attention_window\"",
",",
"128",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_num_groups\"",
",",
"8",
")",
"hparams",
".",
"add_hparam",
"(",
"\"memory_target_density\"",
",",
"2.0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"multiplicative_overhead\"",
",",
"1.25",
")",
"hparams",
".",
"add_hparam",
"(",
"\"multiplicative_overhead_eval\"",
",",
"2.0",
")",
"hparams",
".",
"add_hparam",
"(",
"\"attention_image_summary\"",
",",
"True",
")",
"# LSH params",
"hparams",
".",
"add_hparam",
"(",
"\"lsh_truncated\"",
",",
"True",
")",
"# For testing right-masking.",
"# This is not implemented in all layers.",
"hparams",
".",
"add_hparam",
"(",
"\"mask_right\"",
",",
"False",
")",
"return",
"hparams"
] |
Set of hyperparameters.
languagemodel_wiki_scramble1k50, 1gpu, 7k steps (10min): log(ppl)_eval = 2.60
12.0 steps/sec on P100
8gpu (8x batch), 7k steps: log(ppl)_eval = 2.00
Returns:
a hparams object
|
[
"Set",
"of",
"hyperparameters",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/aligned.py#L239-L305
|
train
|
Set of hyperparameters.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6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pDQB3,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) + '\x33' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4132 - 4021) + chr(0b110101) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101011 + 0o104) + chr(0b11110 + 0o24) + chr(217 - 165), 0b1000), ehT0Px3KOsy9(chr(733 - 685) + chr(0b10001 + 0o136) + chr(165 - 112) + '\x37', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\063' + '\x35', 32653 - 32645), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + chr(0b110010), 47399 - 47391), ehT0Px3KOsy9(chr(1424 - 1376) + chr(111) + chr(51) + '\x33' + '\x31', 7479 - 7471), ehT0Px3KOsy9(chr(146 - 98) + chr(0b1101111) + '\063' + chr(0b110010) + chr(0b11001 + 0o27), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\061' + chr(0b10100 + 0o35), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11355 - 11244) + chr(720 - 667) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111101 + 0o62) + chr(51) + chr(55) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110011) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10110 + 0o33) + '\065' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(1030 - 982) + chr(0b1000100 + 0o53) + '\x32' + '\x36' + chr(608 - 557), 29900 - 29892), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(50) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + '\063' + chr(49) + '\x33', 46497 - 46489), ehT0Px3KOsy9(chr(0b110000) + chr(11492 - 11381) + chr(0b10000 + 0o42) + '\060' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1647 - 1599) + '\x6f' + '\x31' + '\067' + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(53) + chr(0b10111 + 0o36), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x37' + chr(2239 - 2188), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10001 + 0o42) + '\x33' + chr(0b110110), 10760 - 10752), ehT0Px3KOsy9(chr(1906 - 1858) + '\157' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b10011 + 0o36) + '\067' + '\063', 8), ehT0Px3KOsy9(chr(1093 - 1045) + chr(0b1101111) + chr(0b1 + 0o66) + chr(0b110001), 56003 - 55995), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\067', 0o10), ehT0Px3KOsy9(chr(2018 - 1970) + '\157' + chr(1081 - 1030) + chr(0b1110 + 0o51) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101010 + 0o5) + chr(0b101000 + 0o13) + chr(1527 - 1473) + chr(1939 - 1887), 0o10), ehT0Px3KOsy9('\060' + chr(1758 - 1647) + chr(0b10110 + 0o40) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110 + 0o151) + '\062' + chr(0b10 + 0o64) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(1968 - 1916) + '\x31', 45645 - 45637), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\157' + chr(0b101011 + 0o14) + '\x34', 25229 - 25221), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110000) + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(50) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(410 - 299) + chr(0b110110) + chr(1315 - 1262), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b111 + 0o52) + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110111) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + '\x35' + chr(2666 - 2611), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2249 - 2198) + chr(55) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b101100 + 0o12) + chr(0b101110 + 0o4), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x32' + chr(0b110010), 60408 - 60400)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0'), chr(0b1010110 + 0o16) + chr(0b1100101) + chr(8979 - 8880) + chr(111) + '\144' + chr(101))('\x75' + chr(5150 - 5034) + chr(0b1100110) + '\x2d' + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def _WE5BcFS6BsJ():
n4ljua2gi1Pr = vLnG3ZpOXWXZ.basic_params1()
n4ljua2gi1Pr.qzoyXN3kdhDL = ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(48) + chr(48) + chr(0b100110 + 0o12), 2894 - 2886)
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b110001) + chr(0b100011 + 0o23) + chr(49) + chr(97 - 49), 56366 - 56358)
n4ljua2gi1Pr._o7pVXAdOCRy = ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + '\x30', 29216 - 29208)
n4ljua2gi1Pr.lhJm4Z32JlM2 = ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\060' + chr(0b100100 + 0o14) + chr(48), 0o10)
n4ljua2gi1Pr.ag0mwEgWzjYv = 0.0
n4ljua2gi1Pr.RW_xSzp18UeS = 0.0
n4ljua2gi1Pr.FSjUgdaczzRk = 0.0
n4ljua2gi1Pr.SdNSZNVkVjLh = 0.0
n4ljua2gi1Pr.o17O_bIptWdl = 1e-09
n4ljua2gi1Pr.v3ZnJE9Hdub1 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0@uB'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(5472 - 5372) + chr(4312 - 4211))(chr(0b1110101) + chr(0b1100100 + 0o20) + chr(102) + '\055' + chr(82 - 26))
n4ljua2gi1Pr.QGSIpd_yUNzU = 0.1
n4ljua2gi1Pr.fHyhoyGmdvM9 = ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b10111 + 0o40) + chr(0b110010) + chr(946 - 898), 0o10)
n4ljua2gi1Pr.S1SbCBXLapw8 = 1.0
n4ljua2gi1Pr.kwfuYzkY5C57 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xebA}I2X\xb4\x8f<@\x95\xa85\xc0\xf2\xaa\xee\x12\x03\\'), '\x64' + '\x65' + chr(7301 - 7202) + '\157' + chr(100) + chr(4655 - 4554))('\165' + '\164' + '\146' + chr(0b101101) + chr(2237 - 2181))
n4ljua2gi1Pr.eB4rJl6fUxw9 = 0.0
n4ljua2gi1Pr.GcOjyd7zcDH8 = 0.9
n4ljua2gi1Pr.CBOVKNT0M9cG = 0.98
n4ljua2gi1Pr.qVamxim0L2I1 = ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49), 0o10)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(0b10101 + 0o117) + '\145' + chr(9797 - 9698) + '\x6f' + chr(0b1100100) + chr(0b110101 + 0o60))('\x75' + chr(116) + '\146' + chr(45) + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf8Izp5C\xbd\xb4,@\xa3\xaf\x03\xc9\xf4\xb8'), chr(8892 - 8792) + '\x65' + chr(99) + chr(111) + chr(582 - 482) + chr(0b1100101))('\165' + chr(0b1110100) + '\146' + chr(1749 - 1704) + chr(261 - 205)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xac\x1f \x17'), chr(0b100111 + 0o75) + '\145' + chr(0b110101 + 0o56) + '\x6f' + chr(0b1100100) + chr(0b100010 + 0o103))(chr(9423 - 9306) + chr(4144 - 4028) + chr(102) + chr(45) + '\070'))
n4ljua2gi1Pr.r99iQzD4Y8i3 = ehT0Px3KOsy9('\060' + chr(0b1101111) + '\064' + chr(0b110000), 0o10)
n4ljua2gi1Pr.WjY1aZ7lwLOu = xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0'), chr(9943 - 9843) + chr(0b101100 + 0o71) + '\x63' + '\x6f' + chr(100) + chr(3678 - 3577))('\x75' + chr(2904 - 2788) + '\146' + chr(0b101101) + '\x38')
n4ljua2gi1Pr.s6T_PoakASTI = xafqLlk3kkUe(SXOLrMavuUCe(b'\xfaN'), chr(1830 - 1730) + '\x65' + chr(99) + '\157' + chr(7984 - 7884) + '\145')(chr(0b110101 + 0o100) + chr(0b100110 + 0o116) + '\x66' + '\055' + chr(56))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(0b1100111 + 0o10) + '\x64' + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2NmJ/Y'), '\x64' + chr(2059 - 1958) + chr(99) + '\x6f' + chr(7414 - 7314) + chr(101))(chr(117) + chr(116) + '\146' + chr(0b100110 + 0o7) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xeaFyF3M\xf5'), chr(100) + chr(0b1100101) + chr(0b10010 + 0o121) + chr(111) + chr(100) + chr(101))(chr(0b1011011 + 0o32) + chr(0b1001010 + 0o52) + '\146' + '\x2d' + '\070') + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd@zYqK\xad\xa4eH\x9a\xb2F'), '\x64' + '\145' + chr(0b101011 + 0o70) + chr(0b1101111) + chr(100) + chr(0b1100101))('\x75' + chr(0b1110100) + chr(102) + chr(952 - 907) + chr(56)) * ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32', 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + '\x65' + chr(99) + chr(0b1100010 + 0o15) + chr(0b1000010 + 0o42) + chr(0b100000 + 0o105))(chr(0b1101011 + 0o12) + chr(7213 - 7097) + chr(0b1100110) + '\x2d' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0Zyp5O\xb8\xb4:'), '\x64' + chr(0b1100101) + '\143' + '\x6f' + chr(1859 - 1759) + chr(101))(chr(6696 - 6579) + chr(11659 - 11543) + '\146' + chr(45) + '\070'), ehT0Px3KOsy9(chr(752 - 704) + chr(0b1101111) + chr(49) + '\x30', 0o10))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + '\x65' + '\143' + chr(6932 - 6821) + chr(0b1010100 + 0o20) + '\145')('\x75' + '\164' + '\x66' + chr(226 - 181) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x97\xb9\x13\xec\xf2\xa3\xe3\x15\x03^\xb2q"), chr(5776 - 5676) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(6640 - 6540) + chr(101))(chr(0b1000101 + 0o60) + '\164' + chr(0b1011 + 0o133) + '\055' + chr(56)), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + chr(614 - 566), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + chr(9495 - 9394) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(0b1100101))('\x75' + chr(116) + chr(0b1100110) + chr(653 - 608) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x8a\xbd\x06\xc6\xf4\x94\xe1\x13\x0cU\xb0g\x17J"), chr(5756 - 5656) + '\x65' + chr(99) + chr(10476 - 10365) + '\144' + chr(0b1100101))(chr(2915 - 2798) + '\164' + '\146' + chr(0b11011 + 0o22) + chr(0b1000 + 0o60)), ehT0Px3KOsy9('\060' + '\157' + chr(0b110000), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(7443 - 7343) + chr(0b1100101) + chr(0b1010000 + 0o23) + chr(0b1101111) + chr(100) + '\x65')(chr(0b1101000 + 0o15) + chr(116) + chr(8450 - 8348) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x98\xae\x05\xc3\xfe\xbe\xf6"), chr(7756 - 7656) + chr(0b1000110 + 0o37) + chr(3868 - 3769) + '\157' + chr(0b1100100) + '\x65')(chr(7702 - 7585) + '\x74' + '\x66' + chr(0b101101) + '\070'), 0.0)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(0b1100100) + chr(10007 - 9906) + chr(99) + chr(1671 - 1560) + chr(100) + chr(6641 - 6540))('\x75' + '\164' + chr(0b1100110) + '\x2d' + chr(0b100110 + 0o22)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xee@g'), '\144' + chr(8605 - 8504) + chr(99) + chr(0b1101111) + chr(3784 - 3684) + '\x65')(chr(3695 - 3578) + chr(0b1110100) + chr(0b1100110) + chr(0b100110 + 0o7) + chr(0b1111 + 0o51)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xeaFyF3M'), chr(0b1100100) + chr(101) + '\x63' + chr(0b11001 + 0o126) + chr(0b1100100 + 0o0) + chr(10020 - 9919))(chr(0b1110101) + '\164' + '\146' + '\055' + '\070'))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + chr(9483 - 9382) + chr(99) + '\x6f' + chr(0b111010 + 0o52) + chr(1333 - 1232))('\x75' + '\x74' + chr(0b1100110) + '\x2d' + chr(0b100100 + 0o24)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x90\xb3\t\xd2\xfd"), chr(8236 - 8136) + chr(9633 - 9532) + chr(0b1110 + 0o125) + chr(7311 - 7200) + chr(0b110001 + 0o63) + chr(6439 - 6338))('\x75' + chr(116) + chr(102) + chr(0b100000 + 0o15) + '\x38'), ehT0Px3KOsy9(chr(1725 - 1677) + chr(9940 - 9829) + chr(48), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(100) + chr(0b1100101) + chr(0b10000 + 0o123) + '\x6f' + chr(100) + chr(0b1100101))('\165' + '\x74' + '\x66' + '\055' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x91\xb3\x0f\xec\xfa"), '\x64' + chr(7620 - 7519) + chr(99) + '\157' + chr(0b111111 + 0o45) + '\145')(chr(0b1110101) + chr(0b11010 + 0o132) + chr(102) + chr(0b101101) + chr(0b10111 + 0o41)), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(100) + chr(0b1001111 + 0o26) + '\x63' + '\x6f' + chr(0b1100100) + '\145')('\165' + chr(0b10010 + 0o142) + chr(0b1100110) + '\x2d' + '\x38'))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x92\xa9\x07\xec\xf4\xb3\xf2\x1e\x1fO\xad"), chr(100) + chr(8182 - 8081) + chr(2763 - 2664) + chr(111) + chr(0b1100100) + '\x65')('\165' + '\x74' + '\x66' + chr(45) + chr(0b11111 + 0o31)), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b110000), 0o10))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\x64' + chr(101) + chr(99) + '\157' + chr(100) + chr(0b10 + 0o143))(chr(117) + chr(2401 - 2285) + '\146' + chr(0b101101) + chr(947 - 891)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x8f\xac\x06\xda\xe5\x94\xe0\x1a\x19X\xb6"), chr(100) + '\145' + '\143' + chr(0b1101111) + chr(0b1100100) + '\x65')(chr(3029 - 2912) + '\164' + chr(0b110010 + 0o64) + '\x2d' + '\070'), ehT0Px3KOsy9('\060' + chr(0b110001 + 0o76) + '\x30', 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(0b1100010 + 0o2) + chr(7327 - 7226) + chr(0b1000011 + 0o40) + '\x6f' + '\144' + chr(101))('\165' + chr(8368 - 8252) + chr(0b11100 + 0o112) + chr(0b10101 + 0o30) + chr(2254 - 2198)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x97\xad5\xc0\xf8\xb1\xe7"), chr(100) + chr(10141 - 10040) + chr(99) + '\157' + chr(0b1011110 + 0o6) + '\x65')(chr(117) + '\x74' + chr(0b100100 + 0o102) + '\x2d' + chr(56)), ehT0Px3KOsy9('\x30' + chr(1905 - 1794) + chr(50) + '\x30' + chr(0b11101 + 0o23), 62831 - 62823))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(100) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\144' + chr(101))(chr(0b1110 + 0o147) + chr(116) + '\146' + chr(1592 - 1547) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x8a\x83\x19\xda\xeb\xae"), chr(0b1100100) + chr(101) + chr(8122 - 8023) + chr(0b1101111) + '\144' + chr(101))(chr(0b1010110 + 0o37) + '\x74' + '\146' + '\055' + chr(0b111000)), ehT0Px3KOsy9(chr(48) + chr(7457 - 7346) + chr(0b110100) + '\060' + chr(48), ord("\x08")))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + chr(0b1100101) + '\x63' + '\157' + '\x64' + '\145')(chr(8533 - 8416) + '\x74' + chr(0b1100110) + chr(0b1110 + 0o37) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x90\xb3\x0b\xd7\xce\xa9\xe3\x17\x0cU\xbdg"), '\x64' + '\145' + chr(0b1100011) + chr(0b1100000 + 0o17) + '\144' + chr(0b1000010 + 0o43))(chr(0b1110101) + '\x74' + '\146' + '\x2d' + chr(0b111000)), 0.02)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(4603 - 4503) + chr(101) + '\x63' + chr(0b1101111) + chr(5655 - 5555) + chr(0b1100101))('\x75' + chr(0b1110100) + '\146' + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xfaFq[\x02O\xa1\xa0,\\\x88\xaf'), chr(5673 - 5573) + '\145' + chr(0b10010 + 0o121) + '\x6f' + chr(8216 - 8116) + '\x65')('\165' + chr(0b1110100) + chr(0b1100110) + chr(1513 - 1468) + chr(2038 - 1982)), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(100) + chr(101) + chr(1634 - 1535) + '\157' + '\x64' + '\145')(chr(117) + chr(0b0 + 0o164) + chr(102) + chr(0b101101) + chr(0b10001 + 0o47)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3Jy@/S\x86\xb5/H\x95\xbf\x03\xd6\xff\xbf\xdd\x1d\x0bU'), chr(0b1100100) + chr(101) + chr(0b1100011) + '\157' + '\144' + chr(101))(chr(3826 - 3709) + chr(0b100010 + 0o122) + '\x66' + chr(0b111 + 0o46) + chr(0b101100 + 0o14)), ehT0Px3KOsy9(chr(1160 - 1112) + '\x6f' + chr(48), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(111) + chr(0b1100100 + 0o0) + chr(0b1100 + 0o131))('\165' + '\164' + chr(0b1000101 + 0o41) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2@wN1u\xb8\xa4=K\x92\xa8\x03\xdc\xff\x94\xf5\x12\x03_\xb1u'), chr(0b1100100) + chr(5895 - 5794) + chr(682 - 583) + chr(0b1101111) + chr(0b110010 + 0o62) + '\x65')(chr(117) + '\164' + chr(102) + '\x2d' + chr(0b1010 + 0o56)), ehT0Px3KOsy9('\060' + chr(5903 - 5792) + '\x32' + chr(0b111 + 0o51) + '\x30', 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + '\145' + '\143' + '\157' + '\x64' + chr(101))('\165' + chr(0b101001 + 0o113) + '\x66' + '\x2d' + chr(1906 - 1850)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x92\xa9\x07\xec\xf6\xb9\xed\x0e\x1dH"), '\144' + '\145' + '\143' + '\x6f' + chr(0b1100100) + '\145')(chr(4170 - 4053) + chr(0b1010100 + 0o40) + '\146' + '\055' + '\070'), ehT0Px3KOsy9('\060' + chr(9996 - 9885) + '\061' + chr(0b110000), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\144' + '\145' + '\x63' + chr(0b1101111) + chr(2760 - 2660) + chr(101))('\x75' + chr(0b1011110 + 0o26) + chr(102) + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3Jy@/S\x86\xa4(\\\x9b\xb9\x1e\xec\xf5\xae\xec\x08\x04O\xa7'), '\144' + chr(101) + chr(0b1101 + 0o126) + chr(11503 - 11392) + '\144' + chr(0b1100101))(chr(0b111010 + 0o73) + chr(0b1000101 + 0o57) + chr(0b1100110) + chr(607 - 562) + chr(56)), 2.0)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\x64' + '\x65' + '\x63' + '\x6f' + chr(100) + chr(0b101101 + 0o70))(chr(0b1110101) + '\x74' + chr(0b1000001 + 0o45) + chr(1740 - 1695) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3Zx[4Z\xb5\xb9*O\x88\xb5\x1c\xd6\xce\xa4\xf4\x1e\x1fS\xbbc\x1f'), chr(0b1100100) + '\145' + chr(564 - 465) + chr(111) + chr(0b101000 + 0o74) + chr(101))('\x75' + chr(0b100000 + 0o124) + chr(0b1100110) + chr(45) + chr(56)), 1.25)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), chr(0b100101 + 0o77) + chr(0b11001 + 0o114) + chr(7062 - 6963) + '\x6f' + '\x64' + chr(3870 - 3769))(chr(117) + chr(116) + chr(3535 - 3433) + chr(45) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3Zx[4Z\xb5\xb9*O\x88\xb5\x1c\xd6\xce\xa4\xf4\x1e\x1fS\xbbc\x1ffz\x8c\x95Z'), '\x64' + '\x65' + chr(0b11 + 0o140) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(821 - 719) + '\055' + chr(3129 - 3073)), 2.0)
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\x64' + chr(3700 - 3599) + '\143' + chr(0b1101111) + '\144' + chr(1782 - 1681))(chr(0b1100110 + 0o17) + chr(0b111111 + 0o65) + chr(0b1100110) + chr(45) + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b"\xff[`J3^\xb0\xbf'q\x95\xb1\x0b\xd4\xf4\x94\xf1\x0e\x00V\xbfp\x02"), chr(100) + chr(0b1100101) + chr(139 - 40) + '\x6f' + chr(100) + chr(0b110111 + 0o56))(chr(1906 - 1789) + '\x74' + '\x66' + '\x2d' + chr(0b110 + 0o62)), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001), 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\x64' + chr(2596 - 2495) + chr(1112 - 1013) + '\157' + '\x64' + '\x65')(chr(0b1101010 + 0o13) + '\x74' + chr(0b1011111 + 0o7) + '\055' + chr(0b10010 + 0o46)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\\|p)X\xac\xbe*O\x88\xb9\x0e'), '\144' + chr(101) + '\x63' + chr(0b1011110 + 0o21) + chr(0b111 + 0o135) + chr(0b1011000 + 0o15))(chr(117) + chr(10246 - 10130) + chr(5643 - 5541) + chr(0b101101) + chr(56)), ehT0Px3KOsy9('\x30' + chr(111) + '\x31', 8))
xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xffKpp5Z\xb8\xa2(C'), '\x64' + '\145' + '\x63' + chr(111) + chr(0b1 + 0o143) + '\x65')(chr(0b1110101) + '\164' + chr(0b1001000 + 0o36) + chr(1187 - 1142) + chr(0b110101 + 0o3)))(xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3NgD\x02X\xb0\xb7!Z'), chr(0b110 + 0o136) + chr(0b1100100 + 0o1) + chr(1190 - 1091) + '\x6f' + '\144' + chr(9776 - 9675))('\165' + chr(0b1110100) + chr(0b1100110) + chr(519 - 474) + '\070'), ehT0Px3KOsy9(chr(0b110000) + chr(11771 - 11660) + chr(48), 8))
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/models/research/aligned.py
|
aligned_8k_grouped
|
def aligned_8k_grouped():
"""version for languagemodel_wiki_scramble8k50.
languagemodel_wiki_scramble1k50, 1gpu, 7k steps: log(ppl)_eval = 2.92
3.3 steps/sec on P100
8gpu (8x batch), 7k steps: log(ppl)_eval = 2.15
Returns:
a hparams object
"""
hparams = aligned_grouped()
hparams.batch_size = 8192
# hparams.attention_image_summary = False
hparams.num_groups = 16
hparams.multiplicative_overhead = 1.1
return hparams
|
python
|
def aligned_8k_grouped():
"""version for languagemodel_wiki_scramble8k50.
languagemodel_wiki_scramble1k50, 1gpu, 7k steps: log(ppl)_eval = 2.92
3.3 steps/sec on P100
8gpu (8x batch), 7k steps: log(ppl)_eval = 2.15
Returns:
a hparams object
"""
hparams = aligned_grouped()
hparams.batch_size = 8192
# hparams.attention_image_summary = False
hparams.num_groups = 16
hparams.multiplicative_overhead = 1.1
return hparams
|
[
"def",
"aligned_8k_grouped",
"(",
")",
":",
"hparams",
"=",
"aligned_grouped",
"(",
")",
"hparams",
".",
"batch_size",
"=",
"8192",
"# hparams.attention_image_summary = False",
"hparams",
".",
"num_groups",
"=",
"16",
"hparams",
".",
"multiplicative_overhead",
"=",
"1.1",
"return",
"hparams"
] |
version for languagemodel_wiki_scramble8k50.
languagemodel_wiki_scramble1k50, 1gpu, 7k steps: log(ppl)_eval = 2.92
3.3 steps/sec on P100
8gpu (8x batch), 7k steps: log(ppl)_eval = 2.15
Returns:
a hparams object
|
[
"version",
"for",
"languagemodel_wiki_scramble8k50",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/aligned.py#L512-L527
|
train
|
version for languagemodel_wiki_scramble8k50. aligned_8k_grouped 8gpu
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo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_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(965 - 912), 13275 - 13267), ehT0Px3KOsy9(chr(48) + chr(4099 - 3988) + '\063' + chr(0b10011 + 0o44) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9186 - 9075) + '\x36' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1647 - 1597) + chr(52) + chr(1647 - 1598), 28635 - 28627), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110100) + chr(0b1011 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(1585 - 1537) + chr(111) + chr(0b110011) + '\x36' + chr(2151 - 2098), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(2419 - 2308) + chr(439 - 388) + chr(445 - 393) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(54) + '\067', 7960 - 7952), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + chr(1782 - 1729) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1010011 + 0o34) + chr(813 - 763) + chr(0b110001) + chr(0b10010 + 0o44), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + chr(0b11011 + 0o27) + chr(48) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(55) + '\066', 4745 - 4737), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b111 + 0o51) + '\x36', 0b1000), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + '\061' + chr(269 - 217) + chr(0b11000 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b101110 + 0o101) + chr(0b110010) + '\060' + chr(55), 0b1000), ehT0Px3KOsy9(chr(1010 - 962) + chr(8058 - 7947) + chr(449 - 400) + chr(0b110001) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(0b110001) + chr(49) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(2524 - 2469) + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101111 + 0o3) + chr(0b110000) + chr(53), 22168 - 22160), ehT0Px3KOsy9('\060' + '\x6f' + '\x34' + '\x35', 22528 - 22520), ehT0Px3KOsy9(chr(48) + '\157' + '\066' + chr(0b110011 + 0o3), 0o10), ehT0Px3KOsy9(chr(671 - 623) + chr(5429 - 5318) + chr(1809 - 1759) + '\062' + '\x32', 20303 - 20295), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(0b10101 + 0o35) + '\066' + chr(0b1111 + 0o45), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + chr(0b110011) + chr(387 - 337) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2481 - 2370) + chr(0b110000 + 0o3) + '\061' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(1392 - 1344) + chr(111) + chr(0b11 + 0o60) + '\x31' + chr(52), 29134 - 29126), ehT0Px3KOsy9(chr(2034 - 1986) + chr(111) + chr(51) + chr(0b11111 + 0o25) + chr(0b100010 + 0o22), 15374 - 15366), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b110111) + chr(0b100101 + 0o16), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\x36' + chr(0b110100), 42161 - 42153), ehT0Px3KOsy9('\x30' + '\157' + chr(474 - 424) + '\060' + chr(0b101010 + 0o13), 8), ehT0Px3KOsy9(chr(1865 - 1817) + chr(0b100111 + 0o110) + chr(431 - 381) + chr(0b10100 + 0o34) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2429 - 2318) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(1546 - 1498) + '\x6f' + chr(49) + '\064' + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10010 + 0o41) + chr(0b110010) + chr(52), 0b1000), ehT0Px3KOsy9(chr(610 - 562) + '\x6f' + '\063' + '\066' + chr(1697 - 1649), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(349 - 300) + chr(2474 - 2419) + '\064', 52776 - 52768), ehT0Px3KOsy9('\060' + chr(0b100000 + 0o117) + '\x33' + chr(0b11 + 0o55) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\x30' + chr(1111 - 1000) + '\062' + '\x31' + chr(0b1101 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(0b110001) + chr(2821 - 2766) + chr(49), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2020 - 1972) + '\x6f' + '\065' + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'#'), chr(0b1100100) + chr(5352 - 5251) + chr(99) + chr(111) + chr(100) + '\145')(chr(9982 - 9865) + '\x74' + '\146' + '\x2d' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def CdJsCdEV0kSL():
n4ljua2gi1Pr = xj5R3O9s7BWR()
n4ljua2gi1Pr.ix9dZyeAmUxY = ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\x32' + chr(0b101001 + 0o7) + '\x30' + chr(0b10010 + 0o36) + chr(0b11111 + 0o21), 0b1000)
n4ljua2gi1Pr.a39It4XsxVZ1 = ehT0Px3KOsy9('\x30' + chr(6752 - 6641) + chr(0b10101 + 0o35) + '\060', ord("\x08"))
n4ljua2gi1Pr.ePNcD4dNf0TN = 1.1
return n4ljua2gi1Pr
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
_merge_beam_dim
|
def _merge_beam_dim(tensor):
"""Reshapes first two dimensions in to single dimension.
Args:
tensor: Tensor to reshape of shape [A, B, ...]
Returns:
Reshaped tensor of shape [A*B, ...]
"""
shape = common_layers.shape_list(tensor)
shape[0] *= shape[1] # batch -> batch * beam_size
shape.pop(1) # Remove beam dim
return tf.reshape(tensor, shape)
|
python
|
def _merge_beam_dim(tensor):
"""Reshapes first two dimensions in to single dimension.
Args:
tensor: Tensor to reshape of shape [A, B, ...]
Returns:
Reshaped tensor of shape [A*B, ...]
"""
shape = common_layers.shape_list(tensor)
shape[0] *= shape[1] # batch -> batch * beam_size
shape.pop(1) # Remove beam dim
return tf.reshape(tensor, shape)
|
[
"def",
"_merge_beam_dim",
"(",
"tensor",
")",
":",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"tensor",
")",
"shape",
"[",
"0",
"]",
"*=",
"shape",
"[",
"1",
"]",
"# batch -> batch * beam_size",
"shape",
".",
"pop",
"(",
"1",
")",
"# Remove beam dim",
"return",
"tf",
".",
"reshape",
"(",
"tensor",
",",
"shape",
")"
] |
Reshapes first two dimensions in to single dimension.
Args:
tensor: Tensor to reshape of shape [A, B, ...]
Returns:
Reshaped tensor of shape [A*B, ...]
|
[
"Reshapes",
"first",
"two",
"dimensions",
"in",
"to",
"single",
"dimension",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L37-L49
|
train
|
Reshapes first two dimensions in to single 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,FXUco0R3m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NS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110100) + chr(960 - 907), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100001 + 0o20) + '\x33' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(1996 - 1948) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(2482 - 2432) + chr(0b110100) + '\x30', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(1102 - 1048) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(0b110001) + '\x34', 2152 - 2144), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + '\x31' + chr(1179 - 1129), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + '\063' + '\x37' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(0b101110 + 0o4) + '\x33' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4836 - 4725) + chr(0b110010) + '\067' + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b101111 + 0o100) + chr(50) + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b101100 + 0o13) + chr(0b11001 + 0o27), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1 + 0o66) + '\062', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(764 - 715) + chr(0b101100 + 0o6) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(1605 - 1494) + '\063' + chr(0b101111 + 0o2) + chr(0b110111), 15575 - 15567), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(0b110001) + chr(54) + chr(1022 - 968), ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + '\064' + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1532 - 1481) + '\062' + chr(0b0 + 0o64), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + chr(1679 - 1624) + chr(0b10101 + 0o40), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110110) + chr(2141 - 2093), 41184 - 41176), ehT0Px3KOsy9('\060' + chr(4413 - 4302) + chr(0b110010) + chr(2118 - 2065) + chr(0b100110 + 0o12), 0o10), ehT0Px3KOsy9(chr(1506 - 1458) + chr(0b1101111) + chr(51) + chr(52) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\062' + chr(0b101111 + 0o1) + chr(55), 16069 - 16061), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\064' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(521 - 468) + '\066', 0o10), ehT0Px3KOsy9(chr(2281 - 2233) + '\157' + chr(51) + '\x30' + chr(1939 - 1889), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101111 + 0o4) + chr(0b101010 + 0o6) + chr(0b1100 + 0o50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(51) + chr(241 - 190), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110111) + chr(54), 11027 - 11019), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(50) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10110 + 0o131) + '\x32' + chr(907 - 857) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6098 - 5987) + chr(1334 - 1285) + chr(49) + chr(0b110011), 29592 - 29584), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b110111) + chr(0b11100 + 0o27), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(53) + '\x30', 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(0b110010) + chr(0b101101 + 0o5) + chr(51), 35825 - 35817), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(0b1101 + 0o44) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(3280 - 3169) + chr(0b110011) + chr(228 - 173) + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100110 + 0o11) + chr(0b11011 + 0o27) + chr(330 - 280) + '\x30', 0o10), ehT0Px3KOsy9(chr(453 - 405) + chr(0b1101111) + '\061' + chr(1466 - 1411) + chr(0b0 + 0o61), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110110) + chr(0b11001 + 0o30), 20917 - 20909)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(3296 - 3185) + '\065' + '\060', 5029 - 5021)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), chr(0b1011 + 0o131) + chr(3775 - 3674) + chr(9550 - 9451) + chr(111) + chr(5053 - 4953) + chr(2908 - 2807))(chr(117) + chr(0b1110100) + chr(102) + chr(45) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def YCBNoHs6fDAT(LK3cpXJU3UM0):
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(LK3cpXJU3UM0)
nauYfLglTpcb[ehT0Px3KOsy9('\060' + '\157' + '\x30', 20548 - 20540)] *= nauYfLglTpcb[ehT0Px3KOsy9('\060' + chr(2193 - 2082) + chr(49), 0o10)]
xafqLlk3kkUe(nauYfLglTpcb, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd542'), chr(0b11010 + 0o112) + '\x65' + '\143' + chr(111) + chr(6282 - 6182) + '\x65')(chr(1941 - 1824) + chr(9427 - 9311) + chr(0b100000 + 0o106) + chr(45) + chr(2763 - 2707)))(ehT0Px3KOsy9(chr(1861 - 1813) + chr(4569 - 4458) + chr(0b110001), 8))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7>1\xc8\xd5|o'), chr(2786 - 2686) + chr(101) + '\143' + '\157' + chr(0b1100100) + '\145')(chr(5398 - 5281) + chr(0b1110100) + chr(4747 - 4645) + chr(45) + '\070'))(LK3cpXJU3UM0, nauYfLglTpcb)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
_unmerge_beam_dim
|
def _unmerge_beam_dim(tensor, batch_size, beam_size):
"""Reshapes first dimension back to [batch_size, beam_size].
Args:
tensor: Tensor to reshape of shape [batch_size*beam_size, ...]
batch_size: Tensor, original batch size.
beam_size: int, original beam size.
Returns:
Reshaped tensor of shape [batch_size, beam_size, ...]
"""
shape = common_layers.shape_list(tensor)
new_shape = [batch_size] + [beam_size] + shape[1:]
return tf.reshape(tensor, new_shape)
|
python
|
def _unmerge_beam_dim(tensor, batch_size, beam_size):
"""Reshapes first dimension back to [batch_size, beam_size].
Args:
tensor: Tensor to reshape of shape [batch_size*beam_size, ...]
batch_size: Tensor, original batch size.
beam_size: int, original beam size.
Returns:
Reshaped tensor of shape [batch_size, beam_size, ...]
"""
shape = common_layers.shape_list(tensor)
new_shape = [batch_size] + [beam_size] + shape[1:]
return tf.reshape(tensor, new_shape)
|
[
"def",
"_unmerge_beam_dim",
"(",
"tensor",
",",
"batch_size",
",",
"beam_size",
")",
":",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"tensor",
")",
"new_shape",
"=",
"[",
"batch_size",
"]",
"+",
"[",
"beam_size",
"]",
"+",
"shape",
"[",
"1",
":",
"]",
"return",
"tf",
".",
"reshape",
"(",
"tensor",
",",
"new_shape",
")"
] |
Reshapes first dimension back to [batch_size, beam_size].
Args:
tensor: Tensor to reshape of shape [batch_size*beam_size, ...]
batch_size: Tensor, original batch size.
beam_size: int, original beam size.
Returns:
Reshaped tensor of shape [batch_size, beam_size, ...]
|
[
"Reshapes",
"first",
"dimension",
"back",
"to",
"[",
"batch_size",
"beam_size",
"]",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L52-L65
|
train
|
Reshapes first dimension back to [ batch_size beam_size... )
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O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,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' + '\x33' + chr(941 - 891) + chr(1589 - 1537), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b110110) + chr(0b11011 + 0o33), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + '\061' + '\063', 41659 - 41651), ehT0Px3KOsy9(chr(696 - 648) + chr(0b1101111) + chr(0b110010) + chr(0b110110) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + '\061' + chr(52) + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + chr(53) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101101 + 0o102) + chr(0b11 + 0o57) + '\x34' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(50), 0o10), ehT0Px3KOsy9(chr(261 - 213) + chr(111) + chr(0b101000 + 0o11) + chr(53) + chr(483 - 430), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b100001 + 0o17) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000011 + 0o54) + chr(0b110010) + '\x35' + '\063', 19535 - 19527), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(1086 - 975) + '\063' + '\x35' + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(2680 - 2569) + '\061' + chr(0b10100 + 0o35) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(7503 - 7392) + '\063' + chr(55) + chr(0b100111 + 0o11), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + '\061' + chr(50) + chr(50), 18279 - 18271), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(0b11101 + 0o31) + chr(1510 - 1458), 0b1000), ehT0Px3KOsy9(chr(1167 - 1119) + chr(0b1101111) + chr(0b101 + 0o55) + chr(54) + chr(1701 - 1650), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b110010 + 0o75) + chr(0b1001 + 0o52) + '\062' + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(3940 - 3829) + '\061' + chr(0b110101) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(55) + chr(0b1001 + 0o55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b10101 + 0o132) + chr(0b110 + 0o53) + chr(0b110111) + chr(0b100010 + 0o25), 24871 - 24863), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11011 + 0o26) + chr(1298 - 1247) + chr(1221 - 1173), 0o10), ehT0Px3KOsy9(chr(2145 - 2097) + '\x6f' + '\063' + chr(0b110001) + chr(0b11111 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(1307 - 1259) + chr(0b1101111) + chr(0b100110 + 0o13), 16932 - 16924), ehT0Px3KOsy9(chr(2152 - 2104) + '\157' + chr(0b110011) + chr(0b1100 + 0o44) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(50) + '\061' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(2033 - 1984) + '\x33' + '\062', 16064 - 16056), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11 + 0o64) + chr(1232 - 1182), 26250 - 26242), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + '\063' + chr(0b0 + 0o67), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x37' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(55) + chr(0b11010 + 0o32), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51), 45701 - 45693), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + chr(0b110011) + chr(0b110011) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101110 + 0o101) + chr(0b101101 + 0o5) + '\x36' + chr(0b100011 + 0o22), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b11 + 0o61) + chr(0b10010 + 0o37), 33265 - 33257), ehT0Px3KOsy9(chr(615 - 567) + '\x6f' + '\x31' + chr(48) + chr(2375 - 2326), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11455 - 11344) + '\x33' + chr(0b11 + 0o60) + '\066', 27183 - 27175), ehT0Px3KOsy9(chr(48) + chr(0b1101010 + 0o5) + chr(1974 - 1924) + chr(0b110000) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(1654 - 1605) + '\061' + chr(51), 56047 - 56039)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\157' + '\x35' + '\060', 45047 - 45039)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa'), chr(9276 - 9176) + '\x65' + '\143' + chr(6000 - 5889) + chr(0b1100100) + chr(0b1100101))(chr(0b1100100 + 0o21) + chr(0b1110100) + '\x66' + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def vbtE39Uwakua(LK3cpXJU3UM0, ix9dZyeAmUxY, PQZjDxhiHJGf):
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(LK3cpXJU3UM0)
P7dVzv6_yXeE = [ix9dZyeAmUxY] + [PQZjDxhiHJGf] + nauYfLglTpcb[ehT0Px3KOsy9(chr(48) + '\157' + chr(49), 8):]
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6\x13x\xd8\x07_\xc6'), chr(0b1010 + 0o132) + chr(0b1000111 + 0o36) + chr(0b1010000 + 0o23) + chr(111) + chr(0b1100100) + chr(8578 - 8477))('\165' + '\164' + '\146' + chr(0b10011 + 0o32) + chr(0b11000 + 0o40)))(LK3cpXJU3UM0, P7dVzv6_yXeE)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
_expand_to_beam_size
|
def _expand_to_beam_size(tensor, beam_size):
"""Tiles a given tensor by beam_size.
Args:
tensor: tensor to tile [batch_size, ...]
beam_size: How much to tile the tensor by.
Returns:
Tiled tensor [batch_size, beam_size, ...]
"""
tensor = tf.expand_dims(tensor, axis=1)
tile_dims = [1] * tensor.shape.ndims
tile_dims[1] = beam_size
return tf.tile(tensor, tile_dims)
|
python
|
def _expand_to_beam_size(tensor, beam_size):
"""Tiles a given tensor by beam_size.
Args:
tensor: tensor to tile [batch_size, ...]
beam_size: How much to tile the tensor by.
Returns:
Tiled tensor [batch_size, beam_size, ...]
"""
tensor = tf.expand_dims(tensor, axis=1)
tile_dims = [1] * tensor.shape.ndims
tile_dims[1] = beam_size
return tf.tile(tensor, tile_dims)
|
[
"def",
"_expand_to_beam_size",
"(",
"tensor",
",",
"beam_size",
")",
":",
"tensor",
"=",
"tf",
".",
"expand_dims",
"(",
"tensor",
",",
"axis",
"=",
"1",
")",
"tile_dims",
"=",
"[",
"1",
"]",
"*",
"tensor",
".",
"shape",
".",
"ndims",
"tile_dims",
"[",
"1",
"]",
"=",
"beam_size",
"return",
"tf",
".",
"tile",
"(",
"tensor",
",",
"tile_dims",
")"
] |
Tiles a given tensor by beam_size.
Args:
tensor: tensor to tile [batch_size, ...]
beam_size: How much to tile the tensor by.
Returns:
Tiled tensor [batch_size, beam_size, ...]
|
[
"Tiles",
"a",
"given",
"tensor",
"by",
"beam_size",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L68-L82
|
train
|
Tiles a given tensor by beam_size.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994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w4,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(0b11011 + 0o25) + chr(2085 - 1974) + '\x35' + chr(49), 18711 - 18703), ehT0Px3KOsy9('\x30' + chr(0b1100101 + 0o12) + chr(0b110011) + chr(0b110011) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\x33', 0o10), ehT0Px3KOsy9(chr(482 - 434) + chr(111) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(1446 - 1397) + chr(0b11001 + 0o36) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11010 + 0o31) + chr(0b101011 + 0o12) + chr(0b100110 + 0o13), 21875 - 21867), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(703 - 650) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(0b101110 + 0o3) + chr(54) + chr(0b110100), 37894 - 37886), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(0b10100 + 0o40) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9835 - 9724) + chr(0b110010) + '\064' + chr(2207 - 2159), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(5795 - 5684) + chr(0b110001) + '\065' + chr(0b1110 + 0o46), 0o10), ehT0Px3KOsy9(chr(914 - 866) + chr(111) + '\061' + chr(0b101110 + 0o3) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b110100) + chr(0b1001 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(0b100110 + 0o20) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101110 + 0o5) + '\x35' + chr(112 - 58), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7383 - 7272) + '\x37' + chr(2487 - 2433), 0o10), ehT0Px3KOsy9(chr(2301 - 2253) + chr(0b1101111) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + chr(0b10 + 0o155) + '\063' + '\066' + chr(0b110100), 32522 - 32514), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + chr(51) + chr(2682 - 2628) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\x33' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1059 - 1011) + chr(111) + '\x31' + chr(0b110 + 0o57) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(0b110111) + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(11014 - 10903) + chr(1914 - 1863) + '\062' + chr(1529 - 1474), 0o10), ehT0Px3KOsy9(chr(115 - 67) + '\157' + chr(0b10100 + 0o35) + chr(1918 - 1866), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b110011) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + '\061' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11344 - 11233) + '\062' + chr(0b11100 + 0o24) + chr(52), 51024 - 51016), ehT0Px3KOsy9('\x30' + chr(0b110011 + 0o74) + chr(0b110010) + chr(52) + chr(2585 - 2533), 0o10), ehT0Px3KOsy9('\060' + chr(0b100 + 0o153) + chr(0b110010) + chr(55) + chr(1758 - 1703), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(50) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11011 + 0o30) + chr(0b10100 + 0o34) + chr(0b100101 + 0o20), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\x35' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b100110 + 0o21) + chr(1001 - 947), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(2222 - 2174) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100001 + 0o25), 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(0b110011), 28834 - 28826), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(1388 - 1338), ord("\x08")), ehT0Px3KOsy9(chr(767 - 719) + chr(4173 - 4062) + chr(0b0 + 0o62) + '\066' + '\060', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(724 - 676) + '\x6f' + chr(53) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x07'), chr(0b1100100) + chr(101) + '\x63' + '\157' + chr(6346 - 6246) + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def TBVwc7QrrXec(LK3cpXJU3UM0, PQZjDxhiHJGf):
LK3cpXJU3UM0 = IDJ2eXGCBCDu.expand_dims(LK3cpXJU3UM0, axis=ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + '\061', 3702 - 3694))
CJ3pk1E0sqJ2 = [ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(1298 - 1187) + '\x31', 8)] * LK3cpXJU3UM0.shape.ndims
CJ3pk1E0sqJ2[ehT0Px3KOsy9(chr(48) + chr(111) + chr(49), 8)] = PQZjDxhiHJGf
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b']\xb2ge'), '\x64' + '\x65' + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1010000 + 0o25))('\x75' + chr(11534 - 11418) + '\x66' + chr(45) + chr(0b10000 + 0o50)))(LK3cpXJU3UM0, CJ3pk1E0sqJ2)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
get_state_shape_invariants
|
def get_state_shape_invariants(tensor):
"""Returns the shape of the tensor but sets middle dims to None."""
shape = tensor.shape.as_list()
for i in range(1, len(shape) - 1):
shape[i] = None
return tf.TensorShape(shape)
|
python
|
def get_state_shape_invariants(tensor):
"""Returns the shape of the tensor but sets middle dims to None."""
shape = tensor.shape.as_list()
for i in range(1, len(shape) - 1):
shape[i] = None
return tf.TensorShape(shape)
|
[
"def",
"get_state_shape_invariants",
"(",
"tensor",
")",
":",
"shape",
"=",
"tensor",
".",
"shape",
".",
"as_list",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"shape",
")",
"-",
"1",
")",
":",
"shape",
"[",
"i",
"]",
"=",
"None",
"return",
"tf",
".",
"TensorShape",
"(",
"shape",
")"
] |
Returns the shape of the tensor but sets middle dims to None.
|
[
"Returns",
"the",
"shape",
"of",
"the",
"tensor",
"but",
"sets",
"middle",
"dims",
"to",
"None",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L85-L90
|
train
|
Returns the shape of the tensor but sets middle dims to None.
|
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,qqrhSmCS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VFey,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(513 - 465) + '\157' + chr(0b10 + 0o60) + '\064' + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(0b100101 + 0o17) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1011001 + 0o26) + '\061' + chr(1856 - 1807) + chr(1347 - 1299), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + '\x36' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(53) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + '\063' + chr(0b110110) + chr(53), 25535 - 25527), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34' + chr(48), 0o10), ehT0Px3KOsy9('\060' + chr(0b110010 + 0o75) + '\063' + chr(2130 - 2082) + chr(1292 - 1241), 12594 - 12586), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100 + 0o56) + '\x32' + '\064', 49232 - 49224), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(49) + chr(787 - 733), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b110010) + chr(1771 - 1719) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(4423 - 4312) + '\062' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\063' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + '\064' + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100000 + 0o22) + chr(0b110011) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b1110 + 0o50) + chr(0b100000 + 0o25), 8), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\066' + chr(786 - 734), 19275 - 19267), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\062' + '\064', 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(53) + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + chr(1671 - 1560) + chr(0b110111) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(50) + chr(308 - 259) + chr(0b100110 + 0o13), 0b1000), ehT0Px3KOsy9(chr(1581 - 1533) + chr(111) + chr(51) + chr(2722 - 2668) + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b110000) + chr(11078 - 10967) + '\x33' + chr(55) + chr(0b110010 + 0o0), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + '\066' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(54) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2108 - 1997) + chr(0b110110) + '\066', 473 - 465), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(54) + chr(675 - 625), 60808 - 60800), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(0b110010) + chr(0b110 + 0o54) + chr(53), 36590 - 36582), ehT0Px3KOsy9(chr(0b110000) + chr(0b100110 + 0o111) + chr(50) + chr(55) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3479 - 3368) + '\x32' + '\x33' + chr(0b0 + 0o62), 0o10), ehT0Px3KOsy9(chr(1413 - 1365) + chr(111) + chr(0b110001) + chr(53) + chr(0b0 + 0o65), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(0b110010 + 0o1) + '\x32' + chr(0b101001 + 0o13), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10111 + 0o32) + chr(0b1010 + 0o55) + '\x34', 24319 - 24311), ehT0Px3KOsy9(chr(1952 - 1904) + chr(0b100001 + 0o116) + chr(0b110101) + chr(2354 - 2304), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001 + 0o146) + chr(51) + chr(0b110100) + chr(0b10011 + 0o40), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(653 - 598) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(3369 - 3258) + chr(0b101111 + 0o2) + chr(0b0 + 0o60), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(0b110101) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8d'), chr(100) + chr(101) + '\x63' + chr(111) + '\144' + chr(0b101001 + 0o74))(chr(117) + '\x74' + '\x66' + chr(0b101101) + chr(0b0 + 0o70)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def r4hXCIyiAfqZ(LK3cpXJU3UM0):
nauYfLglTpcb = LK3cpXJU3UM0.shape.as_list()
for WVxHKyX45z_L in vQr8gNKaIaWE(ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001), 0b1000), c2A0yzQpDQB3(nauYfLglTpcb) - ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + '\x31', 8)):
nauYfLglTpcb[WVxHKyX45z_L] = None
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf7F&\x85C\x87s\xabj\xe4\xeb'), chr(0b1100100) + chr(101) + chr(0b101010 + 0o71) + chr(6898 - 6787) + chr(1502 - 1402) + chr(0b1001111 + 0o26))(chr(0b1100111 + 0o16) + chr(0b1101101 + 0o7) + '\x66' + chr(45) + chr(0b101100 + 0o14)))(nauYfLglTpcb)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
compute_batch_indices
|
def compute_batch_indices(batch_size, beam_size):
"""Computes the i'th coordinate that contains the batch index for gathers.
Batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..]. It says which
batch the beam item is in. This will create the i of the i,j coordinate
needed for the gather.
Args:
batch_size: Batch size
beam_size: Size of the beam.
Returns:
batch_pos: [batch_size, beam_size] tensor of ids
"""
batch_pos = tf.range(batch_size * beam_size) // beam_size
batch_pos = tf.reshape(batch_pos, [batch_size, beam_size])
return batch_pos
|
python
|
def compute_batch_indices(batch_size, beam_size):
"""Computes the i'th coordinate that contains the batch index for gathers.
Batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..]. It says which
batch the beam item is in. This will create the i of the i,j coordinate
needed for the gather.
Args:
batch_size: Batch size
beam_size: Size of the beam.
Returns:
batch_pos: [batch_size, beam_size] tensor of ids
"""
batch_pos = tf.range(batch_size * beam_size) // beam_size
batch_pos = tf.reshape(batch_pos, [batch_size, beam_size])
return batch_pos
|
[
"def",
"compute_batch_indices",
"(",
"batch_size",
",",
"beam_size",
")",
":",
"batch_pos",
"=",
"tf",
".",
"range",
"(",
"batch_size",
"*",
"beam_size",
")",
"//",
"beam_size",
"batch_pos",
"=",
"tf",
".",
"reshape",
"(",
"batch_pos",
",",
"[",
"batch_size",
",",
"beam_size",
"]",
")",
"return",
"batch_pos"
] |
Computes the i'th coordinate that contains the batch index for gathers.
Batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..]. It says which
batch the beam item is in. This will create the i of the i,j coordinate
needed for the gather.
Args:
batch_size: Batch size
beam_size: Size of the beam.
Returns:
batch_pos: [batch_size, beam_size] tensor of ids
|
[
"Computes",
"the",
"i",
"th",
"coordinate",
"that",
"contains",
"the",
"batch",
"index",
"for",
"gathers",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L93-L108
|
train
|
Computes the i th coordinate that contains the batch index for gather.
|
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,koCeDPYT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ZZT,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(2555 - 2444) + chr(2407 - 2355) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1692 - 1644) + '\x6f' + '\x31' + chr(0b110000) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(275 - 224) + '\065' + '\x31', 0o10), ehT0Px3KOsy9(chr(69 - 21) + chr(0b1101111) + '\x33' + '\063' + chr(890 - 839), 0o10), ehT0Px3KOsy9(chr(2113 - 2065) + chr(0b1101111) + chr(608 - 557) + chr(0b110100) + '\067', 0o10), ehT0Px3KOsy9(chr(414 - 366) + '\x6f' + chr(0b110011) + chr(0b101011 + 0o13) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\060' + chr(711 - 663), ord("\x08")), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\157' + '\061' + '\064' + chr(0b11001 + 0o30), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + chr(49) + chr(1305 - 1257) + '\060', 8), ehT0Px3KOsy9('\x30' + chr(111) + '\065' + chr(0b10 + 0o56), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110000) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b101001 + 0o106) + chr(0b101110 + 0o3) + chr(48) + chr(0b100 + 0o61), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10111 + 0o130) + chr(0b110001) + chr(410 - 357) + chr(0b100 + 0o63), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1010010 + 0o35) + chr(0b110001) + '\x35' + chr(0b100 + 0o60), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\065' + '\061', 8), ehT0Px3KOsy9('\x30' + chr(8248 - 8137) + '\067' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(4355 - 4244) + chr(0b11011 + 0o26) + chr(50) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b110001) + chr(54), 62620 - 62612), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101101 + 0o5) + chr(0b10111 + 0o36) + chr(0b110001 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(0b110010) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\x34' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1374 - 1326) + chr(0b1000101 + 0o52) + chr(50) + '\063', 783 - 775), ehT0Px3KOsy9(chr(127 - 79) + chr(1381 - 1270) + chr(51) + '\067' + '\062', 47048 - 47040), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(55), 30031 - 30023), ehT0Px3KOsy9(chr(2199 - 2151) + '\x6f' + chr(0b110001) + chr(0b110110) + '\063', 0o10), ehT0Px3KOsy9(chr(2175 - 2127) + '\157' + '\061' + chr(0b110011) + chr(1088 - 1034), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(2084 - 2029), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + '\x33' + '\x35', 65016 - 65008), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110001) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(0b10001 + 0o41) + chr(0b1111 + 0o45), 8), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(3170 - 3059) + '\063' + chr(0b110 + 0o56) + chr(54), 0b1000), ehT0Px3KOsy9(chr(669 - 621) + chr(111) + chr(53 - 4) + '\x34' + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(54) + chr(2258 - 2208), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101000 + 0o11) + chr(451 - 403) + chr(357 - 306), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + '\066' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(231 - 182) + chr(0b110001) + '\x37', 53208 - 53200), ehT0Px3KOsy9('\x30' + chr(3777 - 3666) + '\067', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1001 + 0o51) + '\x37' + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1942 - 1890) + chr(0b11100 + 0o27), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10000 + 0o43) + chr(144 - 90) + chr(0b1110 + 0o43), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(53) + chr(1726 - 1678), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c'), '\144' + chr(0b10100 + 0o121) + chr(99) + '\x6f' + '\x64' + chr(101))(chr(0b1001010 + 0o53) + chr(0b1110100) + '\146' + '\055' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def DZBjHthzFDZN(ix9dZyeAmUxY, PQZjDxhiHJGf):
E43v_LHTD3cD = IDJ2eXGCBCDu.range(ix9dZyeAmUxY * PQZjDxhiHJGf) // PQZjDxhiHJGf
E43v_LHTD3cD = IDJ2eXGCBCDu.reshape(E43v_LHTD3cD, [ix9dZyeAmUxY, PQZjDxhiHJGf])
return E43v_LHTD3cD
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
fast_tpu_gather
|
def fast_tpu_gather(params, indices, name=None):
"""Fast gather implementation for models running on TPU.
This function use one_hot and batch matmul to do gather, which is faster
than gather_nd on TPU. For params that have dtype of int32 (sequences to
gather from), batch_gather is used to keep accuracy.
Args:
params: A tensor from which to gather values.
[batch_size, original_size, ...]
indices: A tensor used as the index to gather values.
[batch_size, selected_size].
name: A string, name of the operation (optional).
Returns:
gather_result: A tensor that has the same rank as params.
[batch_size, selected_size, ...]
"""
with tf.name_scope(name):
dtype = params.dtype
def _gather(params, indices):
"""Fast gather using one_hot and batch matmul."""
if dtype != tf.float32:
params = tf.to_float(params)
shape = common_layers.shape_list(params)
indices_shape = common_layers.shape_list(indices)
ndims = params.shape.ndims
# Adjust the shape of params to match one-hot indices, which is the
# requirement of Batch MatMul.
if ndims == 2:
params = tf.expand_dims(params, axis=-1)
if ndims > 3:
params = tf.reshape(params, [shape[0], shape[1], -1])
gather_result = tf.matmul(
tf.one_hot(indices, shape[1], dtype=params.dtype), params)
if ndims == 2:
gather_result = tf.squeeze(gather_result, axis=-1)
if ndims > 3:
shape[1] = indices_shape[1]
gather_result = tf.reshape(gather_result, shape)
if dtype != tf.float32:
gather_result = tf.cast(gather_result, dtype)
return gather_result
# If the dtype is int, use the gather instead of one_hot matmul to avoid
# precision loss. The max int value can be represented by bfloat16 in MXU is
# 256, which is smaller than the possible id values. Encoding/decoding can
# potentially used to make it work, but the benenfit is small right now.
if dtype.is_integer:
gather_result = tf.batch_gather(params, indices)
else:
gather_result = _gather(params, indices)
return gather_result
|
python
|
def fast_tpu_gather(params, indices, name=None):
"""Fast gather implementation for models running on TPU.
This function use one_hot and batch matmul to do gather, which is faster
than gather_nd on TPU. For params that have dtype of int32 (sequences to
gather from), batch_gather is used to keep accuracy.
Args:
params: A tensor from which to gather values.
[batch_size, original_size, ...]
indices: A tensor used as the index to gather values.
[batch_size, selected_size].
name: A string, name of the operation (optional).
Returns:
gather_result: A tensor that has the same rank as params.
[batch_size, selected_size, ...]
"""
with tf.name_scope(name):
dtype = params.dtype
def _gather(params, indices):
"""Fast gather using one_hot and batch matmul."""
if dtype != tf.float32:
params = tf.to_float(params)
shape = common_layers.shape_list(params)
indices_shape = common_layers.shape_list(indices)
ndims = params.shape.ndims
# Adjust the shape of params to match one-hot indices, which is the
# requirement of Batch MatMul.
if ndims == 2:
params = tf.expand_dims(params, axis=-1)
if ndims > 3:
params = tf.reshape(params, [shape[0], shape[1], -1])
gather_result = tf.matmul(
tf.one_hot(indices, shape[1], dtype=params.dtype), params)
if ndims == 2:
gather_result = tf.squeeze(gather_result, axis=-1)
if ndims > 3:
shape[1] = indices_shape[1]
gather_result = tf.reshape(gather_result, shape)
if dtype != tf.float32:
gather_result = tf.cast(gather_result, dtype)
return gather_result
# If the dtype is int, use the gather instead of one_hot matmul to avoid
# precision loss. The max int value can be represented by bfloat16 in MXU is
# 256, which is smaller than the possible id values. Encoding/decoding can
# potentially used to make it work, but the benenfit is small right now.
if dtype.is_integer:
gather_result = tf.batch_gather(params, indices)
else:
gather_result = _gather(params, indices)
return gather_result
|
[
"def",
"fast_tpu_gather",
"(",
"params",
",",
"indices",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
")",
":",
"dtype",
"=",
"params",
".",
"dtype",
"def",
"_gather",
"(",
"params",
",",
"indices",
")",
":",
"\"\"\"Fast gather using one_hot and batch matmul.\"\"\"",
"if",
"dtype",
"!=",
"tf",
".",
"float32",
":",
"params",
"=",
"tf",
".",
"to_float",
"(",
"params",
")",
"shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"params",
")",
"indices_shape",
"=",
"common_layers",
".",
"shape_list",
"(",
"indices",
")",
"ndims",
"=",
"params",
".",
"shape",
".",
"ndims",
"# Adjust the shape of params to match one-hot indices, which is the",
"# requirement of Batch MatMul.",
"if",
"ndims",
"==",
"2",
":",
"params",
"=",
"tf",
".",
"expand_dims",
"(",
"params",
",",
"axis",
"=",
"-",
"1",
")",
"if",
"ndims",
">",
"3",
":",
"params",
"=",
"tf",
".",
"reshape",
"(",
"params",
",",
"[",
"shape",
"[",
"0",
"]",
",",
"shape",
"[",
"1",
"]",
",",
"-",
"1",
"]",
")",
"gather_result",
"=",
"tf",
".",
"matmul",
"(",
"tf",
".",
"one_hot",
"(",
"indices",
",",
"shape",
"[",
"1",
"]",
",",
"dtype",
"=",
"params",
".",
"dtype",
")",
",",
"params",
")",
"if",
"ndims",
"==",
"2",
":",
"gather_result",
"=",
"tf",
".",
"squeeze",
"(",
"gather_result",
",",
"axis",
"=",
"-",
"1",
")",
"if",
"ndims",
">",
"3",
":",
"shape",
"[",
"1",
"]",
"=",
"indices_shape",
"[",
"1",
"]",
"gather_result",
"=",
"tf",
".",
"reshape",
"(",
"gather_result",
",",
"shape",
")",
"if",
"dtype",
"!=",
"tf",
".",
"float32",
":",
"gather_result",
"=",
"tf",
".",
"cast",
"(",
"gather_result",
",",
"dtype",
")",
"return",
"gather_result",
"# If the dtype is int, use the gather instead of one_hot matmul to avoid",
"# precision loss. The max int value can be represented by bfloat16 in MXU is",
"# 256, which is smaller than the possible id values. Encoding/decoding can",
"# potentially used to make it work, but the benenfit is small right now.",
"if",
"dtype",
".",
"is_integer",
":",
"gather_result",
"=",
"tf",
".",
"batch_gather",
"(",
"params",
",",
"indices",
")",
"else",
":",
"gather_result",
"=",
"_gather",
"(",
"params",
",",
"indices",
")",
"return",
"gather_result"
] |
Fast gather implementation for models running on TPU.
This function use one_hot and batch matmul to do gather, which is faster
than gather_nd on TPU. For params that have dtype of int32 (sequences to
gather from), batch_gather is used to keep accuracy.
Args:
params: A tensor from which to gather values.
[batch_size, original_size, ...]
indices: A tensor used as the index to gather values.
[batch_size, selected_size].
name: A string, name of the operation (optional).
Returns:
gather_result: A tensor that has the same rank as params.
[batch_size, selected_size, ...]
|
[
"Fast",
"gather",
"implementation",
"for",
"models",
"running",
"on",
"TPU",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L111-L165
|
train
|
Fast gather implementation for models running on TPU.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbD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Q,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(0b101 + 0o60) + chr(48), 29431 - 29423), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(0b101 + 0o56) + chr(53) + chr(50), 60028 - 60020), ehT0Px3KOsy9(chr(1415 - 1367) + '\x6f' + chr(177 - 126) + chr(0b101100 + 0o11) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1768 - 1717) + chr(1335 - 1287) + '\067', 45286 - 45278), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(55) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + '\x36' + chr(0b101010 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101110 + 0o5) + chr(53) + chr(0b110110), 43770 - 43762), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b110011) + chr(50) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(612 - 564) + chr(0b1101111) + chr(0b10110 + 0o34) + chr(0b101000 + 0o10) + '\066', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(396 - 346) + '\067' + '\x31', 34508 - 34500), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(1085 - 1036) + chr(0b110010), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\062' + '\064' + chr(174 - 121), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b101101 + 0o5), 42404 - 42396), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + '\062', 29962 - 29954), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(0b100111 + 0o14) + '\x31' + chr(1646 - 1593), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110000) + chr(1721 - 1672), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4727 - 4616) + chr(0b110001) + chr(2442 - 2389), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11426 - 11315) + '\061' + chr(2377 - 2323) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(0b10000 + 0o44), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(49) + '\066', 40899 - 40891), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(10889 - 10778) + '\x32' + chr(48) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(748 - 700) + '\157' + chr(0b100111 + 0o14) + chr(0b110011) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110100) + '\063', 41428 - 41420), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101111 + 0o4) + '\065' + chr(2243 - 2191), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010011 + 0o34) + chr(0b1101 + 0o50) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + chr(0b110010) + '\x30' + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(781 - 731) + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x35', 0o10), ehT0Px3KOsy9(chr(87 - 39) + chr(0b1101111) + '\x32' + chr(0b11110 + 0o26) + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(433 - 382) + chr(1588 - 1539) + chr(0b10011 + 0o44), 0b1000), ehT0Px3KOsy9(chr(298 - 250) + '\x6f' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1544 - 1493) + chr(242 - 190) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(513 - 460), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11000 + 0o31) + chr(0b110000) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(9832 - 9721) + chr(51) + '\x36', 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b111111 + 0o60) + '\061' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\063' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\065' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\066' + chr(0b110011), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(824 - 771) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x06'), chr(100) + chr(9687 - 9586) + '\143' + chr(0b111110 + 0o61) + chr(0b100010 + 0o102) + chr(0b1100101))(chr(11380 - 11263) + chr(0b1110100) + chr(102) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def k9b50MT4kqHF(nEbJZ4wfte2w, pIcoaXENl5Pw, AIvJRzLdDfgF=None):
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'F\x8b\x86\xa2%C\x8d\xbb\xf6\xdc'), chr(7615 - 7515) + chr(0b1100101) + '\143' + chr(0b1000111 + 0o50) + chr(100) + '\145')(chr(0b1101110 + 0o7) + '\x74' + '\x66' + '\055' + chr(108 - 52)))(AIvJRzLdDfgF):
jSV9IKnemH7K = nEbJZ4wfte2w.jSV9IKnemH7K
def v7ZyGpsBPSI7(nEbJZ4wfte2w, pIcoaXENl5Pw):
if jSV9IKnemH7K != xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'N\x86\x84\xa6\x0e\x03\xdc'), '\x64' + '\145' + '\143' + chr(111) + chr(0b1100 + 0o130) + '\145')(chr(0b10010 + 0o143) + '\x74' + chr(0b1100110) + chr(0b101101) + chr(476 - 420))):
nEbJZ4wfte2w = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(nEbJZ4wfte2w)
nauYfLglTpcb = jSKPaHwSAfVv.shape_list(nEbJZ4wfte2w)
UhH8ltAAfilq = jSKPaHwSAfVv.shape_list(pIcoaXENl5Pw)
OLYL2NTQs758 = nEbJZ4wfte2w.shape.ndims
if OLYL2NTQs758 == ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(50), ord("\x08")):
nEbJZ4wfte2w = IDJ2eXGCBCDu.expand_dims(nEbJZ4wfte2w, axis=-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49), 28353 - 28345))
if OLYL2NTQs758 > ehT0Px3KOsy9('\060' + chr(5925 - 5814) + chr(1666 - 1615), 8):
nEbJZ4wfte2w = IDJ2eXGCBCDu.reshape(nEbJZ4wfte2w, [nauYfLglTpcb[ehT0Px3KOsy9(chr(48) + chr(0b1100101 + 0o12) + chr(0b10011 + 0o35), ord("\x08"))], nauYfLglTpcb[ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), 8)], -ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), 8)])
c9x5tYtVG9MG = IDJ2eXGCBCDu.matmul(IDJ2eXGCBCDu.Hq3fv4Yp0EhD(pIcoaXENl5Pw, nauYfLglTpcb[ehT0Px3KOsy9(chr(535 - 487) + '\157' + '\061', 8)], dtype=nEbJZ4wfte2w.jSV9IKnemH7K), nEbJZ4wfte2w)
if OLYL2NTQs758 == ehT0Px3KOsy9('\x30' + chr(111) + chr(1117 - 1067), 8):
c9x5tYtVG9MG = IDJ2eXGCBCDu.squeeze(c9x5tYtVG9MG, axis=-ehT0Px3KOsy9('\060' + '\157' + chr(1406 - 1357), 8))
if OLYL2NTQs758 > ehT0Px3KOsy9('\x30' + '\157' + '\x33', 8):
nauYfLglTpcb[ehT0Px3KOsy9('\060' + chr(2843 - 2732) + chr(0b110001), 8)] = UhH8ltAAfilq[ehT0Px3KOsy9(chr(2187 - 2139) + chr(0b1110 + 0o141) + chr(49), 8)]
c9x5tYtVG9MG = IDJ2eXGCBCDu.reshape(c9x5tYtVG9MG, nauYfLglTpcb)
if jSV9IKnemH7K != xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'N\x86\x84\xa6\x0e\x03\xdc'), '\144' + '\145' + chr(1480 - 1381) + chr(0b1010001 + 0o36) + '\144' + chr(0b1100101))(chr(117) + chr(7239 - 7123) + '\146' + chr(1172 - 1127) + chr(1175 - 1119))):
c9x5tYtVG9MG = IDJ2eXGCBCDu.cast(c9x5tYtVG9MG, jSV9IKnemH7K)
return c9x5tYtVG9MG
if xafqLlk3kkUe(jSV9IKnemH7K, xafqLlk3kkUe(SXOLrMavuUCe(b'A\x99\xb4\xae\x14D\x8b\xb3\xe3\xcb'), '\144' + chr(0b1100101) + chr(9393 - 9294) + '\x6f' + chr(0b111101 + 0o47) + chr(0b1100101))(chr(0b1110101) + chr(1042 - 926) + chr(102) + chr(1234 - 1189) + chr(0b0 + 0o70))):
c9x5tYtVG9MG = IDJ2eXGCBCDu.batch_gather(nEbJZ4wfte2w, pIcoaXENl5Pw)
else:
c9x5tYtVG9MG = v7ZyGpsBPSI7(nEbJZ4wfte2w, pIcoaXENl5Pw)
return c9x5tYtVG9MG
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
_create_make_unique
|
def _create_make_unique(inputs):
"""Replaces the lower bits of each element with iota.
The iota is used to derive the index, and also serves the purpose to
make each element unique to break ties.
Args:
inputs: A tensor with rank of 2 and dtype of tf.float32.
[batch_size, original_size].
Returns:
A tensor after element wise transformation, with dtype the same as inputs.
[batch_size, original_size].
Raises:
ValueError: If the rank of the input tensor does not equal 2.
"""
if inputs.shape.ndims != 2:
raise ValueError("Input of top_k_with_unique must be rank-2 "
"but got: %s" % inputs.shape)
height = inputs.shape[0]
width = inputs.shape[1]
zeros = tf.zeros([height, width], dtype=tf.int32)
# Count_mask is used to mask away the low order bits to ensure that every
# element is distinct.
log2_ceiling = int(math.ceil(math.log(int(width), 2)))
next_power_of_two = 1 << log2_ceiling
count_mask = ~(next_power_of_two - 1)
count_mask_r0 = tf.constant(count_mask)
count_mask_r2 = tf.fill([height, width], count_mask_r0)
# Smallest_normal is the bit representation of the smallest positive normal
# floating point number. The sign is zero, exponent is one, and the fraction
# is zero.
smallest_normal = 1 << 23
smallest_normal_r0 = tf.constant(smallest_normal, dtype=tf.int32)
smallest_normal_r2 = tf.fill([height, width], smallest_normal_r0)
# Low_bit_mask is used to mask away the sign bit when computing the absolute
# value.
low_bit_mask = ~(1 << 31)
low_bit_mask_r0 = tf.constant(low_bit_mask, dtype=tf.int32)
low_bit_mask_r2 = tf.fill([height, width], low_bit_mask_r0)
iota = tf.tile(tf.expand_dims(tf.range(width, dtype=tf.int32), 0),
[height, 1])
# Compare the absolute value with positive zero to handle negative zero.
input_r2 = tf.bitcast(inputs, tf.int32)
abs_r2 = tf.bitwise.bitwise_and(input_r2, low_bit_mask_r2)
if_zero_r2 = tf.equal(abs_r2, zeros)
smallest_normal_preserving_sign_r2 = tf.bitwise.bitwise_or(
input_r2, smallest_normal_r2)
input_no_zeros_r2 = tf.where(
if_zero_r2, smallest_normal_preserving_sign_r2, input_r2)
# Discard the low-order bits and replace with iota.
and_r2 = tf.bitwise.bitwise_and(input_no_zeros_r2, count_mask_r2)
or_r2 = tf.bitwise.bitwise_or(and_r2, iota)
return tf.bitcast(or_r2, tf.float32)
|
python
|
def _create_make_unique(inputs):
"""Replaces the lower bits of each element with iota.
The iota is used to derive the index, and also serves the purpose to
make each element unique to break ties.
Args:
inputs: A tensor with rank of 2 and dtype of tf.float32.
[batch_size, original_size].
Returns:
A tensor after element wise transformation, with dtype the same as inputs.
[batch_size, original_size].
Raises:
ValueError: If the rank of the input tensor does not equal 2.
"""
if inputs.shape.ndims != 2:
raise ValueError("Input of top_k_with_unique must be rank-2 "
"but got: %s" % inputs.shape)
height = inputs.shape[0]
width = inputs.shape[1]
zeros = tf.zeros([height, width], dtype=tf.int32)
# Count_mask is used to mask away the low order bits to ensure that every
# element is distinct.
log2_ceiling = int(math.ceil(math.log(int(width), 2)))
next_power_of_two = 1 << log2_ceiling
count_mask = ~(next_power_of_two - 1)
count_mask_r0 = tf.constant(count_mask)
count_mask_r2 = tf.fill([height, width], count_mask_r0)
# Smallest_normal is the bit representation of the smallest positive normal
# floating point number. The sign is zero, exponent is one, and the fraction
# is zero.
smallest_normal = 1 << 23
smallest_normal_r0 = tf.constant(smallest_normal, dtype=tf.int32)
smallest_normal_r2 = tf.fill([height, width], smallest_normal_r0)
# Low_bit_mask is used to mask away the sign bit when computing the absolute
# value.
low_bit_mask = ~(1 << 31)
low_bit_mask_r0 = tf.constant(low_bit_mask, dtype=tf.int32)
low_bit_mask_r2 = tf.fill([height, width], low_bit_mask_r0)
iota = tf.tile(tf.expand_dims(tf.range(width, dtype=tf.int32), 0),
[height, 1])
# Compare the absolute value with positive zero to handle negative zero.
input_r2 = tf.bitcast(inputs, tf.int32)
abs_r2 = tf.bitwise.bitwise_and(input_r2, low_bit_mask_r2)
if_zero_r2 = tf.equal(abs_r2, zeros)
smallest_normal_preserving_sign_r2 = tf.bitwise.bitwise_or(
input_r2, smallest_normal_r2)
input_no_zeros_r2 = tf.where(
if_zero_r2, smallest_normal_preserving_sign_r2, input_r2)
# Discard the low-order bits and replace with iota.
and_r2 = tf.bitwise.bitwise_and(input_no_zeros_r2, count_mask_r2)
or_r2 = tf.bitwise.bitwise_or(and_r2, iota)
return tf.bitcast(or_r2, tf.float32)
|
[
"def",
"_create_make_unique",
"(",
"inputs",
")",
":",
"if",
"inputs",
".",
"shape",
".",
"ndims",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"\"Input of top_k_with_unique must be rank-2 \"",
"\"but got: %s\"",
"%",
"inputs",
".",
"shape",
")",
"height",
"=",
"inputs",
".",
"shape",
"[",
"0",
"]",
"width",
"=",
"inputs",
".",
"shape",
"[",
"1",
"]",
"zeros",
"=",
"tf",
".",
"zeros",
"(",
"[",
"height",
",",
"width",
"]",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"# Count_mask is used to mask away the low order bits to ensure that every",
"# element is distinct.",
"log2_ceiling",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"math",
".",
"log",
"(",
"int",
"(",
"width",
")",
",",
"2",
")",
")",
")",
"next_power_of_two",
"=",
"1",
"<<",
"log2_ceiling",
"count_mask",
"=",
"~",
"(",
"next_power_of_two",
"-",
"1",
")",
"count_mask_r0",
"=",
"tf",
".",
"constant",
"(",
"count_mask",
")",
"count_mask_r2",
"=",
"tf",
".",
"fill",
"(",
"[",
"height",
",",
"width",
"]",
",",
"count_mask_r0",
")",
"# Smallest_normal is the bit representation of the smallest positive normal",
"# floating point number. The sign is zero, exponent is one, and the fraction",
"# is zero.",
"smallest_normal",
"=",
"1",
"<<",
"23",
"smallest_normal_r0",
"=",
"tf",
".",
"constant",
"(",
"smallest_normal",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"smallest_normal_r2",
"=",
"tf",
".",
"fill",
"(",
"[",
"height",
",",
"width",
"]",
",",
"smallest_normal_r0",
")",
"# Low_bit_mask is used to mask away the sign bit when computing the absolute",
"# value.",
"low_bit_mask",
"=",
"~",
"(",
"1",
"<<",
"31",
")",
"low_bit_mask_r0",
"=",
"tf",
".",
"constant",
"(",
"low_bit_mask",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
"low_bit_mask_r2",
"=",
"tf",
".",
"fill",
"(",
"[",
"height",
",",
"width",
"]",
",",
"low_bit_mask_r0",
")",
"iota",
"=",
"tf",
".",
"tile",
"(",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"range",
"(",
"width",
",",
"dtype",
"=",
"tf",
".",
"int32",
")",
",",
"0",
")",
",",
"[",
"height",
",",
"1",
"]",
")",
"# Compare the absolute value with positive zero to handle negative zero.",
"input_r2",
"=",
"tf",
".",
"bitcast",
"(",
"inputs",
",",
"tf",
".",
"int32",
")",
"abs_r2",
"=",
"tf",
".",
"bitwise",
".",
"bitwise_and",
"(",
"input_r2",
",",
"low_bit_mask_r2",
")",
"if_zero_r2",
"=",
"tf",
".",
"equal",
"(",
"abs_r2",
",",
"zeros",
")",
"smallest_normal_preserving_sign_r2",
"=",
"tf",
".",
"bitwise",
".",
"bitwise_or",
"(",
"input_r2",
",",
"smallest_normal_r2",
")",
"input_no_zeros_r2",
"=",
"tf",
".",
"where",
"(",
"if_zero_r2",
",",
"smallest_normal_preserving_sign_r2",
",",
"input_r2",
")",
"# Discard the low-order bits and replace with iota.",
"and_r2",
"=",
"tf",
".",
"bitwise",
".",
"bitwise_and",
"(",
"input_no_zeros_r2",
",",
"count_mask_r2",
")",
"or_r2",
"=",
"tf",
".",
"bitwise",
".",
"bitwise_or",
"(",
"and_r2",
",",
"iota",
")",
"return",
"tf",
".",
"bitcast",
"(",
"or_r2",
",",
"tf",
".",
"float32",
")"
] |
Replaces the lower bits of each element with iota.
The iota is used to derive the index, and also serves the purpose to
make each element unique to break ties.
Args:
inputs: A tensor with rank of 2 and dtype of tf.float32.
[batch_size, original_size].
Returns:
A tensor after element wise transformation, with dtype the same as inputs.
[batch_size, original_size].
Raises:
ValueError: If the rank of the input tensor does not equal 2.
|
[
"Replaces",
"the",
"lower",
"bits",
"of",
"each",
"element",
"with",
"iota",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L168-L229
|
train
|
Creates a tensor after element wise transformation that replaces the lower bits of each element with iota.
|
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(48) + '\x6f' + chr(555 - 505) + chr(54) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1001 + 0o50) + chr(353 - 303) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(187 - 136) + chr(0b111 + 0o55) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4161 - 4050) + '\x33' + chr(55) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\063' + chr(49), 0o10), ehT0Px3KOsy9(chr(1537 - 1489) + chr(0b111011 + 0o64) + chr(0b110100) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + '\061', 19114 - 19106), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(50) + chr(2596 - 2545), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101011 + 0o4) + '\063' + chr(0b1000 + 0o53) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(259 - 148) + chr(50) + '\x34' + chr(0b10111 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(7580 - 7469) + '\x32' + '\067' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(49) + chr(0b10 + 0o56) + chr(0b101010 + 0o7), 0b1000), ehT0Px3KOsy9(chr(1124 - 1076) + chr(0b1011000 + 0o27) + chr(49) + chr(645 - 592) + chr(1668 - 1618), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(55) + chr(0b110000), 61181 - 61173), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(50) + '\x33', 8), ehT0Px3KOsy9(chr(1150 - 1102) + chr(0b1101111) + '\063' + chr(2073 - 2021) + '\x32', 0o10), ehT0Px3KOsy9(chr(1391 - 1343) + '\157' + chr(0b11010 + 0o30) + chr(1859 - 1808) + '\061', 8), ehT0Px3KOsy9(chr(48) + chr(0b10101 + 0o132) + '\x32' + chr(0b11111 + 0o22) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111 + 0o0) + chr(0b11100 + 0o27) + '\066' + chr(2253 - 2203), 1407 - 1399), ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + '\x33' + chr(0b101001 + 0o14) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11101 + 0o27) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1704 - 1655) + '\x34' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6539 - 6428) + '\x32' + chr(1588 - 1538) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1281 - 1231) + chr(1753 - 1700) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(11537 - 11426) + chr(0b10000 + 0o43) + '\065' + chr(53), 6430 - 6422), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(0b101011 + 0o10) + '\065' + '\062', 0o10), ehT0Px3KOsy9(chr(1542 - 1494) + '\157' + chr(0b110111) + chr(1671 - 1620), 20503 - 20495), ehT0Px3KOsy9('\060' + chr(0b10010 + 0o135) + chr(50) + '\064' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1129 - 1081) + '\157' + chr(0b110100) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(136 - 88) + '\x6f' + chr(1947 - 1898) + '\x30' + chr(0b110001 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(12130 - 12019) + '\062' + chr(53) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(2296 - 2246) + chr(2403 - 2348) + '\063', 8), ehT0Px3KOsy9('\060' + chr(4205 - 4094) + chr(2149 - 2099) + '\065' + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(704 - 653) + chr(0b110001) + '\062', 48220 - 48212), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + '\063' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(661 - 550) + chr(0b11110 + 0o24) + '\x33' + chr(0b10111 + 0o33), 0o10), ehT0Px3KOsy9(chr(48) + chr(5222 - 5111) + chr(330 - 278) + '\x30', 1907 - 1899), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(51), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(53) + chr(0b11111 + 0o21), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b'), chr(100) + '\145' + chr(0b1001000 + 0o33) + chr(0b1000001 + 0o56) + chr(100) + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + chr(1605 - 1560) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def nrHjY4cJ6Rqr(vXoupepMtCXU):
if xafqLlk3kkUe(vXoupepMtCXU.shape, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdb`:\x8a\x88'), chr(0b1100100) + chr(0b1100101) + chr(1905 - 1806) + '\157' + '\x64' + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b1010101 + 0o21) + chr(45) + chr(2706 - 2650))) != ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1100000 + 0o17) + chr(1034 - 984), 0b1000):
raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xfcj#\x92\x8f\xb9Ig3\xaf\xcf\xcb\x1e\x01g$\x8b\xed\xe5\xad\x99L\x0f`\xe0\xcb\xcd\x87N\xd6Qc\xcd\xde\x89\xb8\xb8\xf4K.\x87$1\x92\x8f\xb9Ang\xe1\x80\x9e2'), chr(0b10 + 0o142) + '\x65' + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\145')('\165' + chr(116) + chr(102) + chr(45) + '\070') % xafqLlk3kkUe(vXoupepMtCXU, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdbe&\xbe\x9d\xd5AmG\xab\xc3\xd9'), chr(0b1100100) + chr(0b1100101) + '\143' + chr(8730 - 8619) + chr(0b100010 + 0o102) + chr(0b1100101))('\165' + '\x74' + chr(102) + chr(45) + '\070')))
ehbUULKuygfC = vXoupepMtCXU.nauYfLglTpcb[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\060', ord("\x08"))]
mPx09rBTrGXR = vXoupepMtCXU.nauYfLglTpcb[ehT0Px3KOsy9(chr(1348 - 1300) + chr(0b100111 + 0o110) + chr(1464 - 1415), 8)]
_rHwoyvtca4E = IDJ2eXGCBCDu.zeros([ehbUULKuygfC, mPx09rBTrGXR], dtype=IDJ2eXGCBCDu.int32)
DrAazXTrUteR = ehT0Px3KOsy9(yhiZVkosCjBm.ceil(yhiZVkosCjBm.log(ehT0Px3KOsy9(mPx09rBTrGXR), ehT0Px3KOsy9('\060' + chr(0b1010011 + 0o34) + chr(0b110010), 8))))
HrCxf4Dl54Tn = ehT0Px3KOsy9(chr(615 - 567) + '\157' + chr(2123 - 2074), 8) << DrAazXTrUteR
VgJJZAymCxSr = ~(HrCxf4Dl54Tn - ehT0Px3KOsy9('\060' + chr(8482 - 8371) + chr(49), 8))
pQUIPwnIcMzC = IDJ2eXGCBCDu.constant(VgJJZAymCxSr)
oBKEhcv2FJX_ = IDJ2eXGCBCDu.fill([ehbUULKuygfC, mPx09rBTrGXR], pQUIPwnIcMzC)
I6qCHIQbNIGq = ehT0Px3KOsy9('\x30' + chr(11531 - 11420) + chr(0b1 + 0o60), 8) << ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(1535 - 1485) + chr(403 - 348), 0o10)
mfYBQyd00lvT = IDJ2eXGCBCDu.constant(I6qCHIQbNIGq, dtype=IDJ2eXGCBCDu.int32)
ZTMnVw7vu0WR = IDJ2eXGCBCDu.fill([ehbUULKuygfC, mPx09rBTrGXR], mfYBQyd00lvT)
ouOgRdmSvF_C = ~(ehT0Px3KOsy9('\x30' + chr(6644 - 6533) + chr(0b110001), 8) << ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11010 + 0o31) + '\x37', 0b1000))
ampuGuEu3VTW = IDJ2eXGCBCDu.constant(ouOgRdmSvF_C, dtype=IDJ2eXGCBCDu.int32)
xxJXdcmmCVRr = IDJ2eXGCBCDu.fill([ehbUULKuygfC, mPx09rBTrGXR], ampuGuEu3VTW)
nx1Iw6p_Mq90 = IDJ2eXGCBCDu.tile(IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.range(mPx09rBTrGXR, dtype=IDJ2eXGCBCDu.int32), ehT0Px3KOsy9(chr(1060 - 1012) + '\x6f' + '\060', 8)), [ehbUULKuygfC, ehT0Px3KOsy9('\060' + chr(111) + '\x31', 8)])
TGuWCsyBzb9H = IDJ2eXGCBCDu.bitcast(vXoupepMtCXU, IDJ2eXGCBCDu.int32)
yYPhcp6TB9pk = IDJ2eXGCBCDu.bitwise.bitwise_and(TGuWCsyBzb9H, xxJXdcmmCVRr)
ZDMctPOj00au = IDJ2eXGCBCDu.equal(yYPhcp6TB9pk, _rHwoyvtca4E)
bdF4Z1vaznFb = IDJ2eXGCBCDu.bitwise.bitwise_or(TGuWCsyBzb9H, ZTMnVw7vu0WR)
tIVBJg79ceBs = IDJ2eXGCBCDu.dRFAC59yQBm_(ZDMctPOj00au, bdF4Z1vaznFb, TGuWCsyBzb9H)
_NQSNqB8V1yS = IDJ2eXGCBCDu.bitwise.bitwise_and(tIVBJg79ceBs, oBKEhcv2FJX_)
WteuApI8aKXL = IDJ2eXGCBCDu.bitwise.bitwise_or(_NQSNqB8V1yS, nx1Iw6p_Mq90)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"\xd7m'\x84\x9a\xeaR"), chr(0b1100100) + '\x65' + '\143' + '\157' + '\144' + '\145')(chr(0b1110101) + '\164' + chr(0b100001 + 0o105) + '\055' + chr(0b111000)))(WteuApI8aKXL, xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3h<\x86\x8f\xaa\x14'), '\x64' + '\145' + chr(99) + chr(111) + chr(5920 - 5820) + '\145')('\165' + chr(116) + chr(0b1100110) + chr(0b10011 + 0o32) + '\x38')))
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
_create_topk_unique
|
def _create_topk_unique(inputs, k):
"""Creates the top k values in sorted order with indices.
Args:
inputs: A tensor with rank of 2. [batch_size, original_size].
k: An integer, number of top elements to select.
Returns:
topk_r2: A tensor, the k largest elements. [batch_size, k].
topk_indices_r2: A tensor, indices of the top k values. [batch_size, k].
"""
height = inputs.shape[0]
width = inputs.shape[1]
neg_inf_r0 = tf.constant(-np.inf, dtype=tf.float32)
ones = tf.ones([height, width], dtype=tf.float32)
neg_inf_r2 = ones * neg_inf_r0
inputs = tf.where(tf.is_nan(inputs), neg_inf_r2, inputs)
# Select the current largest value k times and keep them in topk_r2. The
# selected largest values are marked as the smallest value to avoid being
# selected again.
tmp = inputs
topk_r2 = tf.zeros([height, k], dtype=tf.float32)
for i in range(k):
kth_order_statistic = tf.reduce_max(tmp, axis=1, keepdims=True)
k_mask = tf.tile(tf.expand_dims(tf.equal(tf.range(k), tf.fill([k], i)), 0),
[height, 1])
topk_r2 = tf.where(k_mask, tf.tile(kth_order_statistic, [1, k]), topk_r2)
ge_r2 = tf.greater_equal(inputs, tf.tile(kth_order_statistic, [1, width]))
tmp = tf.where(ge_r2, neg_inf_r2, inputs)
log2_ceiling = int(math.ceil(math.log(float(int(width)), 2)))
next_power_of_two = 1 << log2_ceiling
count_mask = next_power_of_two - 1
mask_r0 = tf.constant(count_mask)
mask_r2 = tf.fill([height, k], mask_r0)
topk_r2_s32 = tf.bitcast(topk_r2, tf.int32)
topk_indices_r2 = tf.bitwise.bitwise_and(topk_r2_s32, mask_r2)
return topk_r2, topk_indices_r2
|
python
|
def _create_topk_unique(inputs, k):
"""Creates the top k values in sorted order with indices.
Args:
inputs: A tensor with rank of 2. [batch_size, original_size].
k: An integer, number of top elements to select.
Returns:
topk_r2: A tensor, the k largest elements. [batch_size, k].
topk_indices_r2: A tensor, indices of the top k values. [batch_size, k].
"""
height = inputs.shape[0]
width = inputs.shape[1]
neg_inf_r0 = tf.constant(-np.inf, dtype=tf.float32)
ones = tf.ones([height, width], dtype=tf.float32)
neg_inf_r2 = ones * neg_inf_r0
inputs = tf.where(tf.is_nan(inputs), neg_inf_r2, inputs)
# Select the current largest value k times and keep them in topk_r2. The
# selected largest values are marked as the smallest value to avoid being
# selected again.
tmp = inputs
topk_r2 = tf.zeros([height, k], dtype=tf.float32)
for i in range(k):
kth_order_statistic = tf.reduce_max(tmp, axis=1, keepdims=True)
k_mask = tf.tile(tf.expand_dims(tf.equal(tf.range(k), tf.fill([k], i)), 0),
[height, 1])
topk_r2 = tf.where(k_mask, tf.tile(kth_order_statistic, [1, k]), topk_r2)
ge_r2 = tf.greater_equal(inputs, tf.tile(kth_order_statistic, [1, width]))
tmp = tf.where(ge_r2, neg_inf_r2, inputs)
log2_ceiling = int(math.ceil(math.log(float(int(width)), 2)))
next_power_of_two = 1 << log2_ceiling
count_mask = next_power_of_two - 1
mask_r0 = tf.constant(count_mask)
mask_r2 = tf.fill([height, k], mask_r0)
topk_r2_s32 = tf.bitcast(topk_r2, tf.int32)
topk_indices_r2 = tf.bitwise.bitwise_and(topk_r2_s32, mask_r2)
return topk_r2, topk_indices_r2
|
[
"def",
"_create_topk_unique",
"(",
"inputs",
",",
"k",
")",
":",
"height",
"=",
"inputs",
".",
"shape",
"[",
"0",
"]",
"width",
"=",
"inputs",
".",
"shape",
"[",
"1",
"]",
"neg_inf_r0",
"=",
"tf",
".",
"constant",
"(",
"-",
"np",
".",
"inf",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
"ones",
"=",
"tf",
".",
"ones",
"(",
"[",
"height",
",",
"width",
"]",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
"neg_inf_r2",
"=",
"ones",
"*",
"neg_inf_r0",
"inputs",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"is_nan",
"(",
"inputs",
")",
",",
"neg_inf_r2",
",",
"inputs",
")",
"# Select the current largest value k times and keep them in topk_r2. The",
"# selected largest values are marked as the smallest value to avoid being",
"# selected again.",
"tmp",
"=",
"inputs",
"topk_r2",
"=",
"tf",
".",
"zeros",
"(",
"[",
"height",
",",
"k",
"]",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
"for",
"i",
"in",
"range",
"(",
"k",
")",
":",
"kth_order_statistic",
"=",
"tf",
".",
"reduce_max",
"(",
"tmp",
",",
"axis",
"=",
"1",
",",
"keepdims",
"=",
"True",
")",
"k_mask",
"=",
"tf",
".",
"tile",
"(",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"equal",
"(",
"tf",
".",
"range",
"(",
"k",
")",
",",
"tf",
".",
"fill",
"(",
"[",
"k",
"]",
",",
"i",
")",
")",
",",
"0",
")",
",",
"[",
"height",
",",
"1",
"]",
")",
"topk_r2",
"=",
"tf",
".",
"where",
"(",
"k_mask",
",",
"tf",
".",
"tile",
"(",
"kth_order_statistic",
",",
"[",
"1",
",",
"k",
"]",
")",
",",
"topk_r2",
")",
"ge_r2",
"=",
"tf",
".",
"greater_equal",
"(",
"inputs",
",",
"tf",
".",
"tile",
"(",
"kth_order_statistic",
",",
"[",
"1",
",",
"width",
"]",
")",
")",
"tmp",
"=",
"tf",
".",
"where",
"(",
"ge_r2",
",",
"neg_inf_r2",
",",
"inputs",
")",
"log2_ceiling",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"math",
".",
"log",
"(",
"float",
"(",
"int",
"(",
"width",
")",
")",
",",
"2",
")",
")",
")",
"next_power_of_two",
"=",
"1",
"<<",
"log2_ceiling",
"count_mask",
"=",
"next_power_of_two",
"-",
"1",
"mask_r0",
"=",
"tf",
".",
"constant",
"(",
"count_mask",
")",
"mask_r2",
"=",
"tf",
".",
"fill",
"(",
"[",
"height",
",",
"k",
"]",
",",
"mask_r0",
")",
"topk_r2_s32",
"=",
"tf",
".",
"bitcast",
"(",
"topk_r2",
",",
"tf",
".",
"int32",
")",
"topk_indices_r2",
"=",
"tf",
".",
"bitwise",
".",
"bitwise_and",
"(",
"topk_r2_s32",
",",
"mask_r2",
")",
"return",
"topk_r2",
",",
"topk_indices_r2"
] |
Creates the top k values in sorted order with indices.
Args:
inputs: A tensor with rank of 2. [batch_size, original_size].
k: An integer, number of top elements to select.
Returns:
topk_r2: A tensor, the k largest elements. [batch_size, k].
topk_indices_r2: A tensor, indices of the top k values. [batch_size, k].
|
[
"Creates",
"the",
"top",
"k",
"values",
"in",
"sorted",
"order",
"with",
"indices",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L232-L270
|
train
|
Creates the top k values in sorted order with indices.
|
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(0b110000) + '\157' + chr(50) + '\x32' + chr(0b1001 + 0o55), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b10110 + 0o131) + chr(0b110100) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1032 - 983) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(54) + chr(0b101110 + 0o7), 34538 - 34530), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(593 - 543) + chr(1848 - 1796) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + '\x33' + chr(0b110001) + chr(0b10101 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2055 - 1944) + chr(0b110001) + chr(53) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b101000 + 0o107) + chr(0b110001) + '\x31' + '\066', 16536 - 16528), ehT0Px3KOsy9('\x30' + chr(0b1101011 + 0o4) + chr(51) + '\x35' + chr(0b110010), 22106 - 22098), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1011 + 0o46) + chr(52), 47743 - 47735), ehT0Px3KOsy9(chr(1699 - 1651) + '\157' + '\x32' + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(10075 - 9964) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + chr(0b110100) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(1331 - 1281) + chr(52) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + '\066' + chr(2494 - 2440), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + '\062' + chr(0b110001) + chr(51), 0o10), ehT0Px3KOsy9(chr(1640 - 1592) + '\x6f' + chr(49) + chr(0b100101 + 0o20) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + '\x32' + '\066' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + chr(49) + chr(966 - 915) + chr(1528 - 1477), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011101 + 0o22) + chr(0b11011 + 0o26) + '\061' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(1742 - 1631) + chr(51) + chr(0b101110 + 0o5) + '\067', 60903 - 60895), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + '\063' + chr(0b110011) + chr(0b101110 + 0o4), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1385 - 1336) + chr(52), 8), ehT0Px3KOsy9('\060' + chr(11441 - 11330) + chr(0b110010) + chr(0b110100) + chr(55), 50686 - 50678), ehT0Px3KOsy9(chr(48) + chr(111) + chr(55) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1515 - 1467) + chr(0b10 + 0o155) + chr(0b110001) + '\x32' + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(0b110000) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1250 - 1202) + chr(111) + chr(0b1110 + 0o43) + chr(2148 - 2096) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1193 - 1144) + '\067' + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + '\061' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\066' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + '\x31' + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(831 - 780) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(315 - 204) + '\x33' + chr(50) + chr(0b100010 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(2150 - 2102) + chr(0b1101111) + '\067' + chr(0b110001), 35255 - 35247), ehT0Px3KOsy9(chr(835 - 787) + chr(0b1011110 + 0o21) + chr(0b110011) + '\x35' + chr(1566 - 1518), 0b1000), ehT0Px3KOsy9(chr(479 - 431) + '\x6f' + '\061' + chr(0b10101 + 0o36) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1000 + 0o52) + chr(0b110010) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111101 + 0o62) + '\062' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1296 - 1248) + '\x6f' + '\061' + chr(51), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(5834 - 5723) + chr(0b11111 + 0o26) + chr(0b1011 + 0o45), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8'), '\144' + chr(0b111101 + 0o50) + '\143' + '\157' + chr(100) + chr(101))(chr(0b1001000 + 0o55) + chr(6206 - 6090) + chr(0b1100110) + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def hU6RdcA4Ib8B(vXoupepMtCXU, OolUPRJhRaJd):
ehbUULKuygfC = vXoupepMtCXU.nauYfLglTpcb[ehT0Px3KOsy9('\x30' + chr(111) + '\060', 0b1000)]
mPx09rBTrGXR = vXoupepMtCXU.nauYfLglTpcb[ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(3362 - 3251) + '\x31', 31996 - 31988)]
m5BhmHRj8Xyb = IDJ2eXGCBCDu.constant(-WqUC3KWvYVup.inf, dtype=IDJ2eXGCBCDu.float32)
Q9MMic9MQj7n = IDJ2eXGCBCDu.ones([ehbUULKuygfC, mPx09rBTrGXR], dtype=IDJ2eXGCBCDu.float32)
OxrtB9BzTx5a = Q9MMic9MQj7n * m5BhmHRj8Xyb
vXoupepMtCXU = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.is_nan(vXoupepMtCXU), OxrtB9BzTx5a, vXoupepMtCXU)
J8N_NsgU9OIv = vXoupepMtCXU
aQjOCLPwNDtL = IDJ2eXGCBCDu.zeros([ehbUULKuygfC, OolUPRJhRaJd], dtype=IDJ2eXGCBCDu.float32)
for WVxHKyX45z_L in vQr8gNKaIaWE(OolUPRJhRaJd):
jrpAwJm7PDqZ = IDJ2eXGCBCDu.reduce_max(J8N_NsgU9OIv, axis=ehT0Px3KOsy9('\x30' + chr(0b111110 + 0o61) + '\x31', 8), keepdims=ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b101101 + 0o102) + chr(0b110001), 8))
UwsnNXjfhxhs = IDJ2eXGCBCDu.tile(IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.equal(IDJ2eXGCBCDu.range(OolUPRJhRaJd), IDJ2eXGCBCDu.fill([OolUPRJhRaJd], WVxHKyX45z_L)), ehT0Px3KOsy9('\060' + '\x6f' + '\x30', 8)), [ehbUULKuygfC, ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101011 + 0o6), 8)])
aQjOCLPwNDtL = IDJ2eXGCBCDu.dRFAC59yQBm_(UwsnNXjfhxhs, IDJ2eXGCBCDu.tile(jrpAwJm7PDqZ, [ehT0Px3KOsy9(chr(1754 - 1706) + chr(111) + chr(49), 8), OolUPRJhRaJd]), aQjOCLPwNDtL)
Szat8MYd8PAF = IDJ2eXGCBCDu.greater_equal(vXoupepMtCXU, IDJ2eXGCBCDu.tile(jrpAwJm7PDqZ, [ehT0Px3KOsy9('\x30' + chr(111) + '\061', 8), mPx09rBTrGXR]))
J8N_NsgU9OIv = IDJ2eXGCBCDu.dRFAC59yQBm_(Szat8MYd8PAF, OxrtB9BzTx5a, vXoupepMtCXU)
DrAazXTrUteR = ehT0Px3KOsy9(yhiZVkosCjBm.ceil(yhiZVkosCjBm.log(kkSX4ccExqw4(ehT0Px3KOsy9(mPx09rBTrGXR)), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010 + 0o0), 0o10))))
HrCxf4Dl54Tn = ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001), 8) << DrAazXTrUteR
VgJJZAymCxSr = HrCxf4Dl54Tn - ehT0Px3KOsy9(chr(48) + '\157' + '\x31', 8)
hiwR717ZugoE = IDJ2eXGCBCDu.constant(VgJJZAymCxSr)
uyr_B0LJ1cTu = IDJ2eXGCBCDu.fill([ehbUULKuygfC, OolUPRJhRaJd], hiwR717ZugoE)
O4bBEKuEJrUT = IDJ2eXGCBCDu.bitcast(aQjOCLPwNDtL, IDJ2eXGCBCDu.int32)
vzoWsM8ddWz_ = IDJ2eXGCBCDu.bitwise.bitwise_and(O4bBEKuEJrUT, uyr_B0LJ1cTu)
return (aQjOCLPwNDtL, vzoWsM8ddWz_)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
top_k_with_unique
|
def top_k_with_unique(inputs, k):
"""Finds the values and indices of the k largests entries.
Instead of doing sort like tf.nn.top_k, this function finds the max value
k times. The running time is proportional to k, which is be faster when k
is small. The current implementation supports only inputs of rank 2.
In addition, iota is used to replace the lower bits of each element, this
makes the selection more stable when there are equal elements. The
overhead is that output values are approximated.
Args:
inputs: A tensor with rank of 2. [batch_size, original_size].
k: An integer, number of top elements to select.
Returns:
top_values: A tensor, the k largest elements in sorted order.
[batch_size, k].
indices: A tensor, indices of the top_values. [batch_size, k].
"""
unique_inputs = _create_make_unique(tf.cast(inputs, tf.float32))
top_values, indices = _create_topk_unique(unique_inputs, k)
top_values = tf.cast(top_values, inputs.dtype)
return top_values, indices
|
python
|
def top_k_with_unique(inputs, k):
"""Finds the values and indices of the k largests entries.
Instead of doing sort like tf.nn.top_k, this function finds the max value
k times. The running time is proportional to k, which is be faster when k
is small. The current implementation supports only inputs of rank 2.
In addition, iota is used to replace the lower bits of each element, this
makes the selection more stable when there are equal elements. The
overhead is that output values are approximated.
Args:
inputs: A tensor with rank of 2. [batch_size, original_size].
k: An integer, number of top elements to select.
Returns:
top_values: A tensor, the k largest elements in sorted order.
[batch_size, k].
indices: A tensor, indices of the top_values. [batch_size, k].
"""
unique_inputs = _create_make_unique(tf.cast(inputs, tf.float32))
top_values, indices = _create_topk_unique(unique_inputs, k)
top_values = tf.cast(top_values, inputs.dtype)
return top_values, indices
|
[
"def",
"top_k_with_unique",
"(",
"inputs",
",",
"k",
")",
":",
"unique_inputs",
"=",
"_create_make_unique",
"(",
"tf",
".",
"cast",
"(",
"inputs",
",",
"tf",
".",
"float32",
")",
")",
"top_values",
",",
"indices",
"=",
"_create_topk_unique",
"(",
"unique_inputs",
",",
"k",
")",
"top_values",
"=",
"tf",
".",
"cast",
"(",
"top_values",
",",
"inputs",
".",
"dtype",
")",
"return",
"top_values",
",",
"indices"
] |
Finds the values and indices of the k largests entries.
Instead of doing sort like tf.nn.top_k, this function finds the max value
k times. The running time is proportional to k, which is be faster when k
is small. The current implementation supports only inputs of rank 2.
In addition, iota is used to replace the lower bits of each element, this
makes the selection more stable when there are equal elements. The
overhead is that output values are approximated.
Args:
inputs: A tensor with rank of 2. [batch_size, original_size].
k: An integer, number of top elements to select.
Returns:
top_values: A tensor, the k largest elements in sorted order.
[batch_size, k].
indices: A tensor, indices of the top_values. [batch_size, k].
|
[
"Finds",
"the",
"values",
"and",
"indices",
"of",
"the",
"k",
"largests",
"entries",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L273-L295
|
train
|
Finds the values and indices of the k largests entries in sorted order.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9I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QKaLo,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(0b110011) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(3717 - 3606) + '\x35' + '\x36', 6572 - 6564), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11 + 0o56) + '\061' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1684 - 1636) + '\157' + chr(0b110110) + '\060', 0b1000), ehT0Px3KOsy9(chr(906 - 858) + chr(662 - 551) + '\062' + '\060' + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(130 - 81) + chr(369 - 314), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\067', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\x37' + chr(0b1 + 0o57), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + '\x37' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + '\063' + chr(0b111 + 0o57) + '\x37', 11493 - 11485), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101111 + 0o2) + '\064' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(887 - 839) + chr(0b1001 + 0o146) + chr(0b101001 + 0o11) + '\x32' + '\x36', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(1585 - 1536) + chr(0b110101) + '\x34', 49742 - 49734), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\x33' + '\x31' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11825 - 11714) + '\062' + chr(0b101110 + 0o6) + '\x34', 56156 - 56148), ehT0Px3KOsy9('\x30' + chr(5062 - 4951) + chr(515 - 465) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\063' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2374 - 2325) + chr(0b110000 + 0o2) + chr(1846 - 1797), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(305 - 194) + '\063' + chr(0b1101 + 0o50) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(9450 - 9339) + '\x31' + '\x32' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11001 + 0o30) + chr(54) + '\x33', 29854 - 29846), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(0b110001) + chr(55) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b101101 + 0o102) + chr(907 - 858) + chr(0b1010 + 0o47) + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(0b110000 + 0o77) + chr(51) + '\x33' + chr(1335 - 1287), 48687 - 48679), ehT0Px3KOsy9(chr(795 - 747) + '\x6f' + chr(2592 - 2541) + chr(0b11 + 0o55) + '\067', 2197 - 2189), ehT0Px3KOsy9('\060' + chr(517 - 406) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(1086 - 1037) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10111 + 0o130) + chr(51) + '\x37' + chr(0b110110), 7103 - 7095), ehT0Px3KOsy9(chr(828 - 780) + chr(10264 - 10153) + '\x32' + chr(920 - 865) + chr(2456 - 2404), 0o10), ehT0Px3KOsy9(chr(48) + chr(10278 - 10167) + '\x32' + '\x37', 60238 - 60230), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1422 - 1371) + chr(54) + '\x37', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(221 - 171) + '\x34' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b101 + 0o152) + '\x32' + chr(50) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2487 - 2437) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(2687 - 2633) + chr(0b100 + 0o54), 14760 - 14752), ehT0Px3KOsy9(chr(48) + chr(11370 - 11259) + '\x33' + chr(51), 8), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b110000 + 0o7) + chr(0b11111 + 0o21), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\065' + '\x31', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + '\065' + chr(0b10011 + 0o35), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'5'), chr(0b1100100) + chr(7517 - 7416) + chr(3308 - 3209) + chr(1746 - 1635) + chr(100) + chr(6850 - 6749))(chr(11767 - 11650) + '\x74' + '\146' + chr(289 - 244) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def UxMoDnekZSiD(vXoupepMtCXU, OolUPRJhRaJd):
Y_uRCykPIggO = nrHjY4cJ6Rqr(IDJ2eXGCBCDu.cast(vXoupepMtCXU, IDJ2eXGCBCDu.float32))
(JBTdIufF8Ewo, pIcoaXENl5Pw) = hU6RdcA4Ib8B(Y_uRCykPIggO, OolUPRJhRaJd)
JBTdIufF8Ewo = IDJ2eXGCBCDu.cast(JBTdIufF8Ewo, vXoupepMtCXU.jSV9IKnemH7K)
return (JBTdIufF8Ewo, pIcoaXENl5Pw)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
compute_topk_scores_and_seq
|
def compute_topk_scores_and_seq(sequences,
scores,
scores_to_gather,
flags,
beam_size,
batch_size,
prefix="default",
states_to_gather=None,
use_tpu=False,
use_top_k_with_unique=True):
"""Given sequences and scores, will gather the top k=beam size sequences.
This function is used to grow alive, and finished. It takes sequences,
scores, and flags, and returns the top k from sequences, scores_to_gather,
and flags based on the values in scores.
This method permits easy introspection using tfdbg. It adds three named ops
that are prefixed by `prefix`:
- _topk_seq: the tensor for topk_seq returned by this method.
- _topk_flags: the tensor for topk_finished_flags returned by this method.
- _topk_scores: the tensor for tokp_gathered_scores returned by this method.
Args:
sequences: Tensor of sequences that we need to gather from.
[batch_size, beam_size, seq_length]
scores: Tensor of scores for each sequence in sequences.
[batch_size, beam_size]. We will use these to compute the topk.
scores_to_gather: Tensor of scores for each sequence in sequences.
[batch_size, beam_size]. We will return the gathered scores from here.
Scores to gather is different from scores because for grow_alive, we will
need to return log_probs, while for grow_finished, we will need to return
the length penalized scores.
flags: Tensor of bools for sequences that say whether a sequence has reached
EOS or not
beam_size: int
batch_size: int
prefix: string that will prefix unique names for the ops run.
states_to_gather: dict (possibly nested) of decoding states.
use_tpu: A bool, whether to compute topk scores and sequences on TPU.
use_top_k_with_unique: bool, whether to use a fast (but decreased precision)
top_k during TPU beam search.
Returns:
Tuple of
(topk_seq [batch_size, beam_size, decode_length],
topk_gathered_scores [batch_size, beam_size],
topk_finished_flags[batch_size, beam_size])
"""
if not use_tpu:
_, topk_indexes = tf.nn.top_k(scores, k=beam_size)
# The next three steps are to create coordinates for tf.gather_nd to pull
# out the topk sequences from sequences based on scores.
# batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..]. It says which
# batch the beam item is in. This will create the i of the i,j coordinate
# needed for the gather
batch_pos = compute_batch_indices(batch_size, beam_size)
# top coordinates will give us the actual coordinates to do the gather.
# stacking will create a tensor of dimension batch * beam * 2, where the
# last dimension contains the i,j gathering coordinates.
top_coordinates = tf.stack([batch_pos, topk_indexes], axis=2)
# Gather up the highest scoring sequences. For each operation added, give
# it a concrete name to simplify observing these operations with tfdbg.
# Clients can capture these tensors by watching these node names.
def gather(tensor, name):
return tf.gather_nd(tensor, top_coordinates, name=(prefix + name))
topk_seq = gather(sequences, "_topk_seq")
topk_flags = gather(flags, "_topk_flags")
topk_gathered_scores = gather(scores_to_gather, "_topk_scores")
if states_to_gather:
topk_gathered_states = nest.map_structure(
lambda state: gather(state, "_topk_states"), states_to_gather)
else:
topk_gathered_states = states_to_gather
else:
if use_top_k_with_unique:
_, topk_indexes = top_k_with_unique(scores, k=beam_size)
else:
_, topk_indexes = tf.nn.top_k(scores, k=beam_size)
# Gather up the highest scoring sequences. For each operation added, give
# it a concrete name to simplify observing these operations with tfdbg.
# Clients can capture these tensors by watching these node names.
topk_seq = fast_tpu_gather(sequences, topk_indexes, prefix + "_topk_seq")
topk_flags = fast_tpu_gather(flags, topk_indexes, prefix + "_topk_flags")
topk_gathered_scores = fast_tpu_gather(scores_to_gather, topk_indexes,
prefix + "_topk_scores")
if states_to_gather:
topk_gathered_states = nest.map_structure(
# pylint: disable=g-long-lambda
lambda state: fast_tpu_gather(state, topk_indexes,
prefix + "_topk_states"),
states_to_gather)
else:
topk_gathered_states = states_to_gather
return topk_seq, topk_gathered_scores, topk_flags, topk_gathered_states
|
python
|
def compute_topk_scores_and_seq(sequences,
scores,
scores_to_gather,
flags,
beam_size,
batch_size,
prefix="default",
states_to_gather=None,
use_tpu=False,
use_top_k_with_unique=True):
"""Given sequences and scores, will gather the top k=beam size sequences.
This function is used to grow alive, and finished. It takes sequences,
scores, and flags, and returns the top k from sequences, scores_to_gather,
and flags based on the values in scores.
This method permits easy introspection using tfdbg. It adds three named ops
that are prefixed by `prefix`:
- _topk_seq: the tensor for topk_seq returned by this method.
- _topk_flags: the tensor for topk_finished_flags returned by this method.
- _topk_scores: the tensor for tokp_gathered_scores returned by this method.
Args:
sequences: Tensor of sequences that we need to gather from.
[batch_size, beam_size, seq_length]
scores: Tensor of scores for each sequence in sequences.
[batch_size, beam_size]. We will use these to compute the topk.
scores_to_gather: Tensor of scores for each sequence in sequences.
[batch_size, beam_size]. We will return the gathered scores from here.
Scores to gather is different from scores because for grow_alive, we will
need to return log_probs, while for grow_finished, we will need to return
the length penalized scores.
flags: Tensor of bools for sequences that say whether a sequence has reached
EOS or not
beam_size: int
batch_size: int
prefix: string that will prefix unique names for the ops run.
states_to_gather: dict (possibly nested) of decoding states.
use_tpu: A bool, whether to compute topk scores and sequences on TPU.
use_top_k_with_unique: bool, whether to use a fast (but decreased precision)
top_k during TPU beam search.
Returns:
Tuple of
(topk_seq [batch_size, beam_size, decode_length],
topk_gathered_scores [batch_size, beam_size],
topk_finished_flags[batch_size, beam_size])
"""
if not use_tpu:
_, topk_indexes = tf.nn.top_k(scores, k=beam_size)
# The next three steps are to create coordinates for tf.gather_nd to pull
# out the topk sequences from sequences based on scores.
# batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..]. It says which
# batch the beam item is in. This will create the i of the i,j coordinate
# needed for the gather
batch_pos = compute_batch_indices(batch_size, beam_size)
# top coordinates will give us the actual coordinates to do the gather.
# stacking will create a tensor of dimension batch * beam * 2, where the
# last dimension contains the i,j gathering coordinates.
top_coordinates = tf.stack([batch_pos, topk_indexes], axis=2)
# Gather up the highest scoring sequences. For each operation added, give
# it a concrete name to simplify observing these operations with tfdbg.
# Clients can capture these tensors by watching these node names.
def gather(tensor, name):
return tf.gather_nd(tensor, top_coordinates, name=(prefix + name))
topk_seq = gather(sequences, "_topk_seq")
topk_flags = gather(flags, "_topk_flags")
topk_gathered_scores = gather(scores_to_gather, "_topk_scores")
if states_to_gather:
topk_gathered_states = nest.map_structure(
lambda state: gather(state, "_topk_states"), states_to_gather)
else:
topk_gathered_states = states_to_gather
else:
if use_top_k_with_unique:
_, topk_indexes = top_k_with_unique(scores, k=beam_size)
else:
_, topk_indexes = tf.nn.top_k(scores, k=beam_size)
# Gather up the highest scoring sequences. For each operation added, give
# it a concrete name to simplify observing these operations with tfdbg.
# Clients can capture these tensors by watching these node names.
topk_seq = fast_tpu_gather(sequences, topk_indexes, prefix + "_topk_seq")
topk_flags = fast_tpu_gather(flags, topk_indexes, prefix + "_topk_flags")
topk_gathered_scores = fast_tpu_gather(scores_to_gather, topk_indexes,
prefix + "_topk_scores")
if states_to_gather:
topk_gathered_states = nest.map_structure(
# pylint: disable=g-long-lambda
lambda state: fast_tpu_gather(state, topk_indexes,
prefix + "_topk_states"),
states_to_gather)
else:
topk_gathered_states = states_to_gather
return topk_seq, topk_gathered_scores, topk_flags, topk_gathered_states
|
[
"def",
"compute_topk_scores_and_seq",
"(",
"sequences",
",",
"scores",
",",
"scores_to_gather",
",",
"flags",
",",
"beam_size",
",",
"batch_size",
",",
"prefix",
"=",
"\"default\"",
",",
"states_to_gather",
"=",
"None",
",",
"use_tpu",
"=",
"False",
",",
"use_top_k_with_unique",
"=",
"True",
")",
":",
"if",
"not",
"use_tpu",
":",
"_",
",",
"topk_indexes",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"scores",
",",
"k",
"=",
"beam_size",
")",
"# The next three steps are to create coordinates for tf.gather_nd to pull",
"# out the topk sequences from sequences based on scores.",
"# batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..]. It says which",
"# batch the beam item is in. This will create the i of the i,j coordinate",
"# needed for the gather",
"batch_pos",
"=",
"compute_batch_indices",
"(",
"batch_size",
",",
"beam_size",
")",
"# top coordinates will give us the actual coordinates to do the gather.",
"# stacking will create a tensor of dimension batch * beam * 2, where the",
"# last dimension contains the i,j gathering coordinates.",
"top_coordinates",
"=",
"tf",
".",
"stack",
"(",
"[",
"batch_pos",
",",
"topk_indexes",
"]",
",",
"axis",
"=",
"2",
")",
"# Gather up the highest scoring sequences. For each operation added, give",
"# it a concrete name to simplify observing these operations with tfdbg.",
"# Clients can capture these tensors by watching these node names.",
"def",
"gather",
"(",
"tensor",
",",
"name",
")",
":",
"return",
"tf",
".",
"gather_nd",
"(",
"tensor",
",",
"top_coordinates",
",",
"name",
"=",
"(",
"prefix",
"+",
"name",
")",
")",
"topk_seq",
"=",
"gather",
"(",
"sequences",
",",
"\"_topk_seq\"",
")",
"topk_flags",
"=",
"gather",
"(",
"flags",
",",
"\"_topk_flags\"",
")",
"topk_gathered_scores",
"=",
"gather",
"(",
"scores_to_gather",
",",
"\"_topk_scores\"",
")",
"if",
"states_to_gather",
":",
"topk_gathered_states",
"=",
"nest",
".",
"map_structure",
"(",
"lambda",
"state",
":",
"gather",
"(",
"state",
",",
"\"_topk_states\"",
")",
",",
"states_to_gather",
")",
"else",
":",
"topk_gathered_states",
"=",
"states_to_gather",
"else",
":",
"if",
"use_top_k_with_unique",
":",
"_",
",",
"topk_indexes",
"=",
"top_k_with_unique",
"(",
"scores",
",",
"k",
"=",
"beam_size",
")",
"else",
":",
"_",
",",
"topk_indexes",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"scores",
",",
"k",
"=",
"beam_size",
")",
"# Gather up the highest scoring sequences. For each operation added, give",
"# it a concrete name to simplify observing these operations with tfdbg.",
"# Clients can capture these tensors by watching these node names.",
"topk_seq",
"=",
"fast_tpu_gather",
"(",
"sequences",
",",
"topk_indexes",
",",
"prefix",
"+",
"\"_topk_seq\"",
")",
"topk_flags",
"=",
"fast_tpu_gather",
"(",
"flags",
",",
"topk_indexes",
",",
"prefix",
"+",
"\"_topk_flags\"",
")",
"topk_gathered_scores",
"=",
"fast_tpu_gather",
"(",
"scores_to_gather",
",",
"topk_indexes",
",",
"prefix",
"+",
"\"_topk_scores\"",
")",
"if",
"states_to_gather",
":",
"topk_gathered_states",
"=",
"nest",
".",
"map_structure",
"(",
"# pylint: disable=g-long-lambda",
"lambda",
"state",
":",
"fast_tpu_gather",
"(",
"state",
",",
"topk_indexes",
",",
"prefix",
"+",
"\"_topk_states\"",
")",
",",
"states_to_gather",
")",
"else",
":",
"topk_gathered_states",
"=",
"states_to_gather",
"return",
"topk_seq",
",",
"topk_gathered_scores",
",",
"topk_flags",
",",
"topk_gathered_states"
] |
Given sequences and scores, will gather the top k=beam size sequences.
This function is used to grow alive, and finished. It takes sequences,
scores, and flags, and returns the top k from sequences, scores_to_gather,
and flags based on the values in scores.
This method permits easy introspection using tfdbg. It adds three named ops
that are prefixed by `prefix`:
- _topk_seq: the tensor for topk_seq returned by this method.
- _topk_flags: the tensor for topk_finished_flags returned by this method.
- _topk_scores: the tensor for tokp_gathered_scores returned by this method.
Args:
sequences: Tensor of sequences that we need to gather from.
[batch_size, beam_size, seq_length]
scores: Tensor of scores for each sequence in sequences.
[batch_size, beam_size]. We will use these to compute the topk.
scores_to_gather: Tensor of scores for each sequence in sequences.
[batch_size, beam_size]. We will return the gathered scores from here.
Scores to gather is different from scores because for grow_alive, we will
need to return log_probs, while for grow_finished, we will need to return
the length penalized scores.
flags: Tensor of bools for sequences that say whether a sequence has reached
EOS or not
beam_size: int
batch_size: int
prefix: string that will prefix unique names for the ops run.
states_to_gather: dict (possibly nested) of decoding states.
use_tpu: A bool, whether to compute topk scores and sequences on TPU.
use_top_k_with_unique: bool, whether to use a fast (but decreased precision)
top_k during TPU beam search.
Returns:
Tuple of
(topk_seq [batch_size, beam_size, decode_length],
topk_gathered_scores [batch_size, beam_size],
topk_finished_flags[batch_size, beam_size])
|
[
"Given",
"sequences",
"and",
"scores",
"will",
"gather",
"the",
"top",
"k",
"=",
"beam",
"size",
"sequences",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L298-L393
|
train
|
This function is used to gather the top k scores from sequences and scores_to_gather and flags based on the values in scores_to_gather and flags.
|
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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S3dE_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(767 - 719) + '\x6f' + chr(0b110010) + chr(0b10 + 0o57) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b10100 + 0o34) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(7184 - 7073) + chr(726 - 676) + chr(1018 - 970) + chr(0b101100 + 0o5), 40110 - 40102), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b111000 + 0o67) + '\x33' + chr(0b110100) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b110010) + chr(455 - 406), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001 + 0o2) + chr(48) + chr(48), 53153 - 53145), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(1001 - 946) + chr(0b100011 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100111 + 0o14) + chr(2498 - 2448) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(0b110010) + chr(54) + chr(0b1011 + 0o46), 14023 - 14015), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110101) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + chr(0b1000 + 0o57), 47400 - 47392), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1989 - 1938) + chr(0b10 + 0o56) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(0b100101 + 0o16) + '\x33' + chr(53), 0b1000), ehT0Px3KOsy9(chr(2120 - 2072) + chr(111) + chr(0b101101 + 0o5) + chr(0b101011 + 0o10) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + chr(55) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b11 + 0o154) + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(0b10001 + 0o43) + '\x37', 25358 - 25350), ehT0Px3KOsy9(chr(0b110000) + chr(4569 - 4458) + chr(2548 - 2495) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100001 + 0o25) + chr(1766 - 1712), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(165 - 54) + chr(1419 - 1368) + chr(55) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2272 - 2161) + chr(0b110100) + chr(0b110001), 40554 - 40546), ehT0Px3KOsy9(chr(1955 - 1907) + '\157' + '\063' + chr(0b100010 + 0o21) + '\x36', 0o10), ehT0Px3KOsy9(chr(2100 - 2052) + chr(111) + chr(0b110111) + chr(55), 0o10), ehT0Px3KOsy9(chr(1132 - 1084) + '\157' + chr(837 - 785) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(0b1001 + 0o51) + chr(0b1100 + 0o47) + chr(1944 - 1893), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(833 - 781) + chr(734 - 681), ord("\x08")), ehT0Px3KOsy9(chr(388 - 340) + chr(11720 - 11609) + chr(49) + chr(0b1111 + 0o45) + chr(52), 0b1000), ehT0Px3KOsy9(chr(1530 - 1482) + chr(0b1101111) + chr(51) + chr(0b11 + 0o55) + chr(1359 - 1310), ord("\x08")), ehT0Px3KOsy9(chr(358 - 310) + chr(0b111110 + 0o61) + chr(715 - 665) + '\x31' + '\x35', 0o10), ehT0Px3KOsy9(chr(628 - 580) + chr(0b110100 + 0o73) + chr(55) + chr(1656 - 1603), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\x31' + '\061' + chr(0b110101), 51020 - 51012), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(1767 - 1719) + chr(1498 - 1446), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(0b110000) + chr(1535 - 1484), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(528 - 417) + chr(0b110001) + chr(0b101110 + 0o5) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(285 - 174) + chr(49) + '\x30' + chr(2097 - 2042), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(4661 - 4550) + chr(0b110001) + '\x32' + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + chr(0b101101 + 0o12) + '\x32', 24577 - 24569), ehT0Px3KOsy9('\x30' + chr(0b1010111 + 0o30) + '\x33' + chr(53) + chr(1804 - 1756), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x37', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1010 + 0o145) + chr(1947 - 1894) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa4'), chr(0b11110 + 0o106) + '\145' + '\x63' + chr(0b1101111) + chr(0b1100100) + '\145')('\165' + '\164' + '\146' + chr(1604 - 1559) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ug1GN6Tv0wJt(wsAG9QSgV2xG, b8rpGniBNUPr, tneKl2J4M5rW, T57JZWaIWbrd, PQZjDxhiHJGf, ix9dZyeAmUxY, K1Ha0XjJTAE7=xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\xa7\xe7\x81\xe4\xac\xcb'), chr(3247 - 3147) + '\x65' + chr(6733 - 6634) + chr(0b10001 + 0o136) + chr(0b11 + 0o141) + chr(0b1011101 + 0o10))('\165' + '\x74' + '\146' + chr(45) + '\x38'), fliE9Za6w_i5=None, L4eE7kczIJwa=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1010 + 0o46), ord("\x08")), EvZxy6QSzaKS=ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(0b110001), ord("\x08"))):
if not L4eE7kczIJwa:
(VNGQdHSFPrso, fCLaBVYool0M) = IDJ2eXGCBCDu.nn.top_k(b8rpGniBNUPr, k=PQZjDxhiHJGf)
E43v_LHTD3cD = DZBjHthzFDZN(ix9dZyeAmUxY, PQZjDxhiHJGf)
sVd92flyd08h = IDJ2eXGCBCDu.stack([E43v_LHTD3cD, fCLaBVYool0M], axis=ehT0Px3KOsy9('\x30' + chr(6424 - 6313) + chr(958 - 908), 8))
def kGr_8mTaGpVE(LK3cpXJU3UM0, AIvJRzLdDfgF):
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xed\xa3\xf5\x88\xf4\xb2\xe0\xbe\xd5'), chr(0b100110 + 0o76) + '\145' + chr(0b101001 + 0o72) + chr(0b110101 + 0o72) + chr(100) + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(0b101101) + '\x38'))(LK3cpXJU3UM0, sVd92flyd08h, name=K1Ha0XjJTAE7 + AIvJRzLdDfgF)
G174XbOlOSko = kGr_8mTaGpVE(wsAG9QSgV2xG, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xcc\xb5\xc0'), '\x64' + chr(101) + chr(0b1100011) + '\157' + chr(4100 - 4000) + '\x65')(chr(0b1101101 + 0o10) + '\164' + chr(0b1100110) + chr(45) + chr(0b111000)))
GwavRHwTgHIZ = kGr_8mTaGpVE(T57JZWaIWbrd, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xd9\xbc\xd0LD'), chr(0b1011101 + 0o7) + '\145' + chr(1230 - 1131) + chr(0b1101111) + chr(4131 - 4031) + chr(101))(chr(0b1110101) + chr(0b1110100) + '\146' + '\055' + chr(0b111000)))
czxruUidlJ1w = kGr_8mTaGpVE(tneKl2J4M5rW, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xcc\xb3\xdeYR\xb4'), chr(7772 - 7672) + chr(0b110101 + 0o60) + '\143' + '\157' + chr(100) + chr(101))(chr(10505 - 10388) + chr(0b10000 + 0o144) + chr(102) + chr(0b11000 + 0o25) + chr(0b111000)))
if fliE9Za6w_i5:
PpjrtQ7VFmRr = mnU87WrcOgNU.map_structure(lambda KKFQISrGeiAm: kGr_8mTaGpVE(KKFQISrGeiAm, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xcc\xa4\xd0_R\xb4'), chr(100) + chr(101) + chr(6642 - 6543) + '\157' + chr(3845 - 3745) + '\x65')(chr(8827 - 8710) + '\x74' + '\x66' + chr(45) + chr(0b110 + 0o62))), fliE9Za6w_i5)
else:
PpjrtQ7VFmRr = fliE9Za6w_i5
else:
if EvZxy6QSzaKS:
(VNGQdHSFPrso, fCLaBVYool0M) = UxMoDnekZSiD(b8rpGniBNUPr, k=PQZjDxhiHJGf)
else:
(VNGQdHSFPrso, fCLaBVYool0M) = IDJ2eXGCBCDu.nn.top_k(b8rpGniBNUPr, k=PQZjDxhiHJGf)
G174XbOlOSko = k9b50MT4kqHF(wsAG9QSgV2xG, fCLaBVYool0M, K1Ha0XjJTAE7 + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xcc\xb5\xc0'), '\144' + chr(8444 - 8343) + '\x63' + chr(0b101010 + 0o105) + chr(3700 - 3600) + chr(0b1001010 + 0o33))(chr(0b1000101 + 0o60) + chr(13268 - 13152) + chr(0b100011 + 0o103) + chr(0b100011 + 0o12) + chr(0b111000)))
GwavRHwTgHIZ = k9b50MT4kqHF(T57JZWaIWbrd, fCLaBVYool0M, K1Ha0XjJTAE7 + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xd9\xbc\xd0LD'), '\x64' + chr(0b1010100 + 0o21) + '\143' + chr(0b1101111) + chr(0b111110 + 0o46) + chr(0b1100101))(chr(4595 - 4478) + chr(116) + chr(102) + chr(45) + '\x38'))
czxruUidlJ1w = k9b50MT4kqHF(tneKl2J4M5rW, fCLaBVYool0M, K1Ha0XjJTAE7 + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xcc\xb3\xdeYR\xb4'), '\144' + '\145' + '\x63' + '\157' + chr(0b1100100) + chr(0b1100101))('\165' + '\164' + chr(102) + chr(1576 - 1531) + chr(0b1111 + 0o51)))
if fliE9Za6w_i5:
PpjrtQ7VFmRr = mnU87WrcOgNU.map_structure(lambda KKFQISrGeiAm: k9b50MT4kqHF(KKFQISrGeiAm, fCLaBVYool0M, K1Ha0XjJTAE7 + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5\xb6\xee\x90\xfa\x9f\xcc\xa4\xd0_R\xb4'), '\144' + chr(0b1100101) + '\143' + chr(111) + chr(100) + '\145')(chr(117) + '\x74' + chr(0b111 + 0o137) + '\x2d' + chr(56))), fliE9Za6w_i5)
else:
PpjrtQ7VFmRr = fliE9Za6w_i5
return (G174XbOlOSko, czxruUidlJ1w, GwavRHwTgHIZ, PpjrtQ7VFmRr)
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/beam_search.py
|
beam_search
|
def beam_search(symbols_to_logits_fn,
initial_ids,
beam_size,
decode_length,
vocab_size,
alpha,
states=None,
eos_id=EOS_ID,
stop_early=True,
use_tpu=False,
use_top_k_with_unique=True):
"""Beam search with length penalties.
Requires a function that can take the currently decoded symbols and return
the logits for the next symbol. The implementation is inspired by
https://arxiv.org/abs/1609.08144.
When running, the beam search steps can be visualized by using tfdbg to watch
the operations generating the output ids for each beam step. These operations
have the pattern:
(alive|finished)_topk_(seq,scores)
Operations marked `alive` represent the new beam sequences that will be
processed in the next step. Operations marked `finished` represent the
completed beam sequences, which may be padded with 0s if no beams finished.
Operations marked `seq` store the full beam sequence for the time step.
Operations marked `scores` store the sequence's final log scores.
The beam search steps will be processed sequentially in order, so when
capturing observed from these operations, tensors, clients can make
assumptions about which step is being recorded.
WARNING: Assumes 2nd dimension of tensors in `states` and not invariant, this
means that the shape of the 2nd dimension of these tensors will not be
available (i.e. set to None) inside symbols_to_logits_fn.
Args:
symbols_to_logits_fn: Interface to the model, to provide logits.
Shoud take [batch_size, decoded_ids] and return [batch_size, vocab_size]
initial_ids: Ids to start off the decoding, this will be the first thing
handed to symbols_to_logits_fn (after expanding to beam size)
[batch_size]
beam_size: Size of the beam.
decode_length: Number of steps to decode for.
vocab_size: Size of the vocab, must equal the size of the logits returned by
symbols_to_logits_fn
alpha: alpha for length penalty.
states: dict (possibly nested) of decoding states.
eos_id: ID for end of sentence.
stop_early: a boolean - stop once best sequence is provably determined.
use_tpu: A bool, whether to do beam search on TPU.
use_top_k_with_unique: bool, whether to use a fast (but decreased precision)
top_k during TPU beam search.
Returns:
Tuple of
(decoded beams [batch_size, beam_size, decode_length]
decoding probabilities [batch_size, beam_size])
"""
batch_size = common_layers.shape_list(initial_ids)[0]
# Assume initial_ids are prob 1.0
initial_log_probs = tf.constant([[0.] + [-INF] * (beam_size - 1)])
# Expand to beam_size (batch_size, beam_size)
alive_log_probs = tf.tile(initial_log_probs, [batch_size, 1])
# Expand each batch and state to beam_size
alive_seq = _expand_to_beam_size(initial_ids, beam_size)
alive_seq = tf.expand_dims(alive_seq, axis=2) # (batch_size, beam_size, 1)
if use_tpu:
alive_seq = tf.tile(alive_seq, [1, 1, decode_length + 1])
if states:
states = nest.map_structure(
lambda state: _expand_to_beam_size(state, beam_size), states)
else:
states = {}
# Finished will keep track of all the sequences that have finished so far
# Finished log probs will be negative infinity in the beginning
# finished_flags will keep track of booleans
finished_seq = tf.zeros(common_layers.shape_list(alive_seq), tf.int32)
# Setting the scores of the initial to negative infinity.
finished_scores = tf.ones([batch_size, beam_size]) * -INF
finished_flags = tf.zeros([batch_size, beam_size], tf.bool)
def grow_finished(finished_seq, finished_scores, finished_flags, curr_seq,
curr_scores, curr_finished):
"""Given sequences and scores, will gather the top k=beam size sequences.
Args:
finished_seq: Current finished sequences.
[batch_size, beam_size, current_decoded_length]
finished_scores: scores for each of these sequences.
[batch_size, beam_size]
finished_flags: finished bools for each of these sequences.
[batch_size, beam_size]
curr_seq: current topk sequence that has been grown by one position.
[batch_size, beam_size, current_decoded_length]
curr_scores: scores for each of these sequences. [batch_size, beam_size]
curr_finished: Finished flags for each of these sequences.
[batch_size, beam_size]
Returns:
Tuple of
(Topk sequences based on scores,
log probs of these sequences,
Finished flags of these sequences)
"""
if not use_tpu:
# First append a column of 0'ids to finished to make the same length with
# finished scores
finished_seq = tf.concat(
[finished_seq,
tf.zeros([batch_size, beam_size, 1], tf.int32)], axis=2)
# Set the scores of the unfinished seq in curr_seq to large negative
# values
curr_scores += (1. - tf.to_float(curr_finished)) * -INF
# concatenating the sequences and scores along beam axis
curr_finished_seq = tf.concat([finished_seq, curr_seq], axis=1)
curr_finished_scores = tf.concat([finished_scores, curr_scores], axis=1)
curr_finished_flags = tf.concat([finished_flags, curr_finished], axis=1)
return compute_topk_scores_and_seq(
curr_finished_seq,
curr_finished_scores,
curr_finished_scores,
curr_finished_flags,
beam_size,
batch_size,
"grow_finished",
use_tpu=use_tpu,
use_top_k_with_unique=use_top_k_with_unique)
def grow_alive(curr_seq, curr_scores, curr_log_probs, curr_finished, states):
"""Given sequences and scores, will gather the top k=beam size sequences.
Args:
curr_seq: current topk sequence that has been grown by one position.
[batch_size, beam_size, i+1]
curr_scores: scores for each of these sequences. [batch_size, beam_size]
curr_log_probs: log probs for each of these sequences.
[batch_size, beam_size]
curr_finished: Finished flags for each of these sequences.
[batch_size, beam_size]
states: dict (possibly nested) of decoding states.
Returns:
Tuple of
(Topk sequences based on scores,
log probs of these sequences,
Finished flags of these sequences)
"""
# Set the scores of the finished seq in curr_seq to large negative
# values
curr_scores += tf.to_float(curr_finished) * -INF
return compute_topk_scores_and_seq(curr_seq, curr_scores, curr_log_probs,
curr_finished, beam_size, batch_size,
"grow_alive", states, use_tpu=use_tpu)
def grow_topk(i, alive_seq, alive_log_probs, states):
r"""Inner beam search loop.
This function takes the current alive sequences, and grows them to topk
sequences where k = 2*beam. We use 2*beam because, we could have beam_size
number of sequences that might hit <EOS> and there will be no alive
sequences to continue. With 2*beam_size, this will not happen. This relies
on the assumption the vocab size is > beam size. If this is true, we'll
have at least beam_size non <EOS> extensions if we extract the next top
2*beam words.
Length penalty is given by = (5+len(decode)/6) ^ -\alpha. Pls refer to
https://arxiv.org/abs/1609.08144.
Args:
i: loop index
alive_seq: Topk sequences decoded so far [batch_size, beam_size, i+1]
alive_log_probs: probabilities of these sequences. [batch_size, beam_size]
states: dict (possibly nested) of decoding states.
Returns:
Tuple of
(Topk sequences extended by the next word,
The log probs of these sequences,
The scores with length penalty of these sequences,
Flags indicating which of these sequences have finished decoding,
dict of transformed decoding states)
"""
# Get the logits for all the possible next symbols
if use_tpu and states:
flat_ids = tf.reshape(
tf.slice(alive_seq, [0, 0, i], [batch_size, beam_size, 1]),
[batch_size * beam_size, -1])
else:
flat_ids = tf.reshape(alive_seq, [batch_size * beam_size, -1])
# (batch_size * beam_size, decoded_length)
if states:
flat_states = nest.map_structure(_merge_beam_dim, states)
flat_logits, flat_states = symbols_to_logits_fn(flat_ids, i, flat_states)
states = nest.map_structure(
lambda t: _unmerge_beam_dim(t, batch_size, beam_size), flat_states)
elif use_tpu:
flat_logits = symbols_to_logits_fn(flat_ids, i)
else:
flat_logits = symbols_to_logits_fn(flat_ids)
logits = tf.reshape(flat_logits, [batch_size, beam_size, -1])
# Convert logits to normalized log probs
candidate_log_probs = common_layers.log_prob_from_logits(logits)
# Multiply the probabilities by the current probabilities of the beam.
# (batch_size, beam_size, vocab_size) + (batch_size, beam_size, 1)
log_probs = candidate_log_probs + tf.expand_dims(alive_log_probs, axis=2)
length_penalty = tf.pow(((5. + tf.to_float(i + 1)) / 6.), alpha)
curr_scores = log_probs / length_penalty
# Flatten out (beam_size, vocab_size) probs in to a list of possibilities
flat_curr_scores = tf.reshape(curr_scores, [-1, beam_size * vocab_size])
if use_tpu and use_top_k_with_unique:
topk_scores, topk_ids = top_k_with_unique(
flat_curr_scores, k=beam_size * 2)
else:
topk_scores, topk_ids = tf.nn.top_k(flat_curr_scores, k=beam_size * 2)
# Recovering the log probs because we will need to send them back
topk_log_probs = topk_scores * length_penalty
# Work out what beam the top probs are in.
topk_beam_index = topk_ids // vocab_size
topk_ids %= vocab_size # Unflatten the ids
if not use_tpu:
# The next three steps are to create coordinates for tf.gather_nd to pull
# out the correct sequences from id's that we need to grow.
# We will also use the coordinates to gather the booleans of the beam
# items that survived.
batch_pos = compute_batch_indices(batch_size, beam_size * 2)
# top beams will give us the actual coordinates to do the gather.
# stacking will create a tensor of dimension batch * beam * 2, where the
# last dimension contains the i,j gathering coordinates.
topk_coordinates = tf.stack([batch_pos, topk_beam_index], axis=2)
# Gather up the most probable 2*beams both for the ids and
# finished_in_alive bools
topk_seq = tf.gather_nd(alive_seq, topk_coordinates)
if states:
states = nest.map_structure(
lambda state: tf.gather_nd(state, topk_coordinates), states)
# Append the most probable alive
topk_seq = tf.concat([topk_seq, tf.expand_dims(topk_ids, axis=2)], axis=2)
else:
# Gather up the most probable 2*beams both for the ids and
# finished_in_alive bools
topk_seq = fast_tpu_gather(alive_seq, topk_beam_index)
if states:
states = nest.map_structure(
lambda state: fast_tpu_gather(state, topk_beam_index), states)
# Update the most probable alive
topk_seq = tf.transpose(topk_seq, perm=[2, 0, 1])
topk_seq = inplace_ops.alias_inplace_update(topk_seq, i + 1, topk_ids)
topk_seq = tf.transpose(topk_seq, perm=[1, 2, 0])
topk_finished = tf.equal(topk_ids, eos_id)
return topk_seq, topk_log_probs, topk_scores, topk_finished, states
def inner_loop(i, alive_seq, alive_log_probs, finished_seq, finished_scores,
finished_flags, states):
"""Inner beam search loop.
There are three groups of tensors, alive, finished, and topk.
The alive group contains information about the current alive sequences
The topk group contains information about alive + topk current decoded words
the finished group contains information about finished sentences, that is,
the ones that have decoded to <EOS>. These are what we return.
The general beam search algorithm is as follows:
While we haven't terminated (pls look at termination condition)
1. Grow the current alive to get beam*2 topk sequences
2. Among the topk, keep the top beam_size ones that haven't reached EOS
into alive
3. Among the topk, keep the top beam_size ones have reached EOS into
finished
Repeat
To make things simple with using fixed size tensors, we will end
up inserting unfinished sequences into finished in the beginning. To stop
that we add -ve INF to the score of the unfinished sequence so that when a
true finished sequence does appear, it will have a higher score than all the
unfinished ones.
Args:
i: loop index
alive_seq: Topk sequences decoded so far [batch_size, beam_size, i+1]
alive_log_probs: probabilities of the beams. [batch_size, beam_size]
finished_seq: Current finished sequences.
[batch_size, beam_size, i+1]
finished_scores: scores for each of these sequences.
[batch_size, beam_size]
finished_flags: finished bools for each of these sequences.
[batch_size, beam_size]
states: dict (possibly nested) of decoding states.
Returns:
Tuple of
(Incremented loop index
New alive sequences,
Log probs of the alive sequences,
New finished sequences,
Scores of the new finished sequences,
Flags indicating which sequence in finished as reached EOS,
dict of final decoding states)
"""
# Each inner loop, we carry out three steps:
# 1. Get the current topk items.
# 2. Extract the ones that have finished and haven't finished
# 3. Recompute the contents of finished based on scores.
topk_seq, topk_log_probs, topk_scores, topk_finished, states = grow_topk(
i, alive_seq, alive_log_probs, states)
alive_seq, alive_log_probs, _, states = grow_alive(
topk_seq, topk_scores, topk_log_probs, topk_finished, states)
finished_seq, finished_scores, finished_flags, _ = grow_finished(
finished_seq, finished_scores, finished_flags, topk_seq, topk_scores,
topk_finished)
return (i + 1, alive_seq, alive_log_probs, finished_seq, finished_scores,
finished_flags, states)
def _is_finished(i, unused_alive_seq, alive_log_probs, unused_finished_seq,
finished_scores, unused_finished_in_finished, unused_states):
"""Checking termination condition.
We terminate when we decoded up to decode_length or the lowest scoring item
in finished has a greater score that the highest prob item in alive divided
by the max length penalty
Args:
i: loop index
alive_log_probs: probabilities of the beams. [batch_size, beam_size]
finished_scores: scores for each of these sequences.
[batch_size, beam_size]
Returns:
Bool.
"""
max_length_penalty = tf.pow(((5. + tf.to_float(decode_length)) / 6.), alpha)
# The best possible score of the most likely alive sequence.
lower_bound_alive_scores = alive_log_probs[:, 0] / max_length_penalty
if not stop_early:
# by considering the min score (in the top N beams) we ensure that
# the decoder will keep decoding until there is at least one beam
# (in the top N) that can be improved (w.r.t. the alive beams).
# any unfinished beam will have score -INF - thus the min
# will always be -INF if there is at least one unfinished beam -
# which means the bound_is_met condition cannot be true in this case.
lowest_score_of_finished_in_finished = tf.reduce_min(finished_scores)
else:
# by taking the max score we only care about the first beam;
# as soon as this first beam cannot be beaten from the alive beams
# the beam decoder can stop.
# similarly to the above, if the top beam is not completed, its
# finished_score is -INF, thus it will not activate the
# bound_is_met condition. (i.e., decoder will keep going on).
# note we need to find the max for every sequence eparately - so, we need
# to keep the batch dimension (see axis=1)
lowest_score_of_finished_in_finished = tf.reduce_max(finished_scores,
axis=1)
bound_is_met = tf.reduce_all(
tf.greater(lowest_score_of_finished_in_finished,
lower_bound_alive_scores))
return tf.logical_and(
tf.less(i, decode_length), tf.logical_not(bound_is_met))
inner_shape = tf.TensorShape([None, None, None])
if use_tpu:
inner_shape = tf.TensorShape([batch_size, beam_size, decode_length + 1])
if use_tpu:
state_struc = nest.map_structure(lambda state: state.get_shape(), states)
else:
state_struc = nest.map_structure(get_state_shape_invariants, states)
(_, alive_seq, alive_log_probs, finished_seq, finished_scores,
finished_flags, states) = tf.while_loop(
_is_finished,
inner_loop, [
tf.constant(0), alive_seq, alive_log_probs, finished_seq,
finished_scores, finished_flags, states
],
shape_invariants=[
tf.TensorShape([]),
inner_shape,
alive_log_probs.get_shape(),
inner_shape,
finished_scores.get_shape(),
finished_flags.get_shape(),
state_struc
],
parallel_iterations=1,
back_prop=False)
alive_seq.set_shape((None, beam_size, None))
finished_seq.set_shape((None, beam_size, None))
# Accounting for corner case: It's possible that no sequence in alive for a
# particular batch item ever reached EOS. In that case, we should just copy
# the contents of alive for that batch item. tf.reduce_any(finished_flags, 1)
# if 0, means that no sequence for that batch index had reached EOS. We need
# to do the same for the scores as well.
finished_seq = tf.where(
tf.reduce_any(finished_flags, 1), finished_seq, alive_seq)
finished_scores = tf.where(
tf.reduce_any(finished_flags, 1), finished_scores, alive_log_probs)
return finished_seq, finished_scores, states
|
python
|
def beam_search(symbols_to_logits_fn,
initial_ids,
beam_size,
decode_length,
vocab_size,
alpha,
states=None,
eos_id=EOS_ID,
stop_early=True,
use_tpu=False,
use_top_k_with_unique=True):
"""Beam search with length penalties.
Requires a function that can take the currently decoded symbols and return
the logits for the next symbol. The implementation is inspired by
https://arxiv.org/abs/1609.08144.
When running, the beam search steps can be visualized by using tfdbg to watch
the operations generating the output ids for each beam step. These operations
have the pattern:
(alive|finished)_topk_(seq,scores)
Operations marked `alive` represent the new beam sequences that will be
processed in the next step. Operations marked `finished` represent the
completed beam sequences, which may be padded with 0s if no beams finished.
Operations marked `seq` store the full beam sequence for the time step.
Operations marked `scores` store the sequence's final log scores.
The beam search steps will be processed sequentially in order, so when
capturing observed from these operations, tensors, clients can make
assumptions about which step is being recorded.
WARNING: Assumes 2nd dimension of tensors in `states` and not invariant, this
means that the shape of the 2nd dimension of these tensors will not be
available (i.e. set to None) inside symbols_to_logits_fn.
Args:
symbols_to_logits_fn: Interface to the model, to provide logits.
Shoud take [batch_size, decoded_ids] and return [batch_size, vocab_size]
initial_ids: Ids to start off the decoding, this will be the first thing
handed to symbols_to_logits_fn (after expanding to beam size)
[batch_size]
beam_size: Size of the beam.
decode_length: Number of steps to decode for.
vocab_size: Size of the vocab, must equal the size of the logits returned by
symbols_to_logits_fn
alpha: alpha for length penalty.
states: dict (possibly nested) of decoding states.
eos_id: ID for end of sentence.
stop_early: a boolean - stop once best sequence is provably determined.
use_tpu: A bool, whether to do beam search on TPU.
use_top_k_with_unique: bool, whether to use a fast (but decreased precision)
top_k during TPU beam search.
Returns:
Tuple of
(decoded beams [batch_size, beam_size, decode_length]
decoding probabilities [batch_size, beam_size])
"""
batch_size = common_layers.shape_list(initial_ids)[0]
# Assume initial_ids are prob 1.0
initial_log_probs = tf.constant([[0.] + [-INF] * (beam_size - 1)])
# Expand to beam_size (batch_size, beam_size)
alive_log_probs = tf.tile(initial_log_probs, [batch_size, 1])
# Expand each batch and state to beam_size
alive_seq = _expand_to_beam_size(initial_ids, beam_size)
alive_seq = tf.expand_dims(alive_seq, axis=2) # (batch_size, beam_size, 1)
if use_tpu:
alive_seq = tf.tile(alive_seq, [1, 1, decode_length + 1])
if states:
states = nest.map_structure(
lambda state: _expand_to_beam_size(state, beam_size), states)
else:
states = {}
# Finished will keep track of all the sequences that have finished so far
# Finished log probs will be negative infinity in the beginning
# finished_flags will keep track of booleans
finished_seq = tf.zeros(common_layers.shape_list(alive_seq), tf.int32)
# Setting the scores of the initial to negative infinity.
finished_scores = tf.ones([batch_size, beam_size]) * -INF
finished_flags = tf.zeros([batch_size, beam_size], tf.bool)
def grow_finished(finished_seq, finished_scores, finished_flags, curr_seq,
curr_scores, curr_finished):
"""Given sequences and scores, will gather the top k=beam size sequences.
Args:
finished_seq: Current finished sequences.
[batch_size, beam_size, current_decoded_length]
finished_scores: scores for each of these sequences.
[batch_size, beam_size]
finished_flags: finished bools for each of these sequences.
[batch_size, beam_size]
curr_seq: current topk sequence that has been grown by one position.
[batch_size, beam_size, current_decoded_length]
curr_scores: scores for each of these sequences. [batch_size, beam_size]
curr_finished: Finished flags for each of these sequences.
[batch_size, beam_size]
Returns:
Tuple of
(Topk sequences based on scores,
log probs of these sequences,
Finished flags of these sequences)
"""
if not use_tpu:
# First append a column of 0'ids to finished to make the same length with
# finished scores
finished_seq = tf.concat(
[finished_seq,
tf.zeros([batch_size, beam_size, 1], tf.int32)], axis=2)
# Set the scores of the unfinished seq in curr_seq to large negative
# values
curr_scores += (1. - tf.to_float(curr_finished)) * -INF
# concatenating the sequences and scores along beam axis
curr_finished_seq = tf.concat([finished_seq, curr_seq], axis=1)
curr_finished_scores = tf.concat([finished_scores, curr_scores], axis=1)
curr_finished_flags = tf.concat([finished_flags, curr_finished], axis=1)
return compute_topk_scores_and_seq(
curr_finished_seq,
curr_finished_scores,
curr_finished_scores,
curr_finished_flags,
beam_size,
batch_size,
"grow_finished",
use_tpu=use_tpu,
use_top_k_with_unique=use_top_k_with_unique)
def grow_alive(curr_seq, curr_scores, curr_log_probs, curr_finished, states):
"""Given sequences and scores, will gather the top k=beam size sequences.
Args:
curr_seq: current topk sequence that has been grown by one position.
[batch_size, beam_size, i+1]
curr_scores: scores for each of these sequences. [batch_size, beam_size]
curr_log_probs: log probs for each of these sequences.
[batch_size, beam_size]
curr_finished: Finished flags for each of these sequences.
[batch_size, beam_size]
states: dict (possibly nested) of decoding states.
Returns:
Tuple of
(Topk sequences based on scores,
log probs of these sequences,
Finished flags of these sequences)
"""
# Set the scores of the finished seq in curr_seq to large negative
# values
curr_scores += tf.to_float(curr_finished) * -INF
return compute_topk_scores_and_seq(curr_seq, curr_scores, curr_log_probs,
curr_finished, beam_size, batch_size,
"grow_alive", states, use_tpu=use_tpu)
def grow_topk(i, alive_seq, alive_log_probs, states):
r"""Inner beam search loop.
This function takes the current alive sequences, and grows them to topk
sequences where k = 2*beam. We use 2*beam because, we could have beam_size
number of sequences that might hit <EOS> and there will be no alive
sequences to continue. With 2*beam_size, this will not happen. This relies
on the assumption the vocab size is > beam size. If this is true, we'll
have at least beam_size non <EOS> extensions if we extract the next top
2*beam words.
Length penalty is given by = (5+len(decode)/6) ^ -\alpha. Pls refer to
https://arxiv.org/abs/1609.08144.
Args:
i: loop index
alive_seq: Topk sequences decoded so far [batch_size, beam_size, i+1]
alive_log_probs: probabilities of these sequences. [batch_size, beam_size]
states: dict (possibly nested) of decoding states.
Returns:
Tuple of
(Topk sequences extended by the next word,
The log probs of these sequences,
The scores with length penalty of these sequences,
Flags indicating which of these sequences have finished decoding,
dict of transformed decoding states)
"""
# Get the logits for all the possible next symbols
if use_tpu and states:
flat_ids = tf.reshape(
tf.slice(alive_seq, [0, 0, i], [batch_size, beam_size, 1]),
[batch_size * beam_size, -1])
else:
flat_ids = tf.reshape(alive_seq, [batch_size * beam_size, -1])
# (batch_size * beam_size, decoded_length)
if states:
flat_states = nest.map_structure(_merge_beam_dim, states)
flat_logits, flat_states = symbols_to_logits_fn(flat_ids, i, flat_states)
states = nest.map_structure(
lambda t: _unmerge_beam_dim(t, batch_size, beam_size), flat_states)
elif use_tpu:
flat_logits = symbols_to_logits_fn(flat_ids, i)
else:
flat_logits = symbols_to_logits_fn(flat_ids)
logits = tf.reshape(flat_logits, [batch_size, beam_size, -1])
# Convert logits to normalized log probs
candidate_log_probs = common_layers.log_prob_from_logits(logits)
# Multiply the probabilities by the current probabilities of the beam.
# (batch_size, beam_size, vocab_size) + (batch_size, beam_size, 1)
log_probs = candidate_log_probs + tf.expand_dims(alive_log_probs, axis=2)
length_penalty = tf.pow(((5. + tf.to_float(i + 1)) / 6.), alpha)
curr_scores = log_probs / length_penalty
# Flatten out (beam_size, vocab_size) probs in to a list of possibilities
flat_curr_scores = tf.reshape(curr_scores, [-1, beam_size * vocab_size])
if use_tpu and use_top_k_with_unique:
topk_scores, topk_ids = top_k_with_unique(
flat_curr_scores, k=beam_size * 2)
else:
topk_scores, topk_ids = tf.nn.top_k(flat_curr_scores, k=beam_size * 2)
# Recovering the log probs because we will need to send them back
topk_log_probs = topk_scores * length_penalty
# Work out what beam the top probs are in.
topk_beam_index = topk_ids // vocab_size
topk_ids %= vocab_size # Unflatten the ids
if not use_tpu:
# The next three steps are to create coordinates for tf.gather_nd to pull
# out the correct sequences from id's that we need to grow.
# We will also use the coordinates to gather the booleans of the beam
# items that survived.
batch_pos = compute_batch_indices(batch_size, beam_size * 2)
# top beams will give us the actual coordinates to do the gather.
# stacking will create a tensor of dimension batch * beam * 2, where the
# last dimension contains the i,j gathering coordinates.
topk_coordinates = tf.stack([batch_pos, topk_beam_index], axis=2)
# Gather up the most probable 2*beams both for the ids and
# finished_in_alive bools
topk_seq = tf.gather_nd(alive_seq, topk_coordinates)
if states:
states = nest.map_structure(
lambda state: tf.gather_nd(state, topk_coordinates), states)
# Append the most probable alive
topk_seq = tf.concat([topk_seq, tf.expand_dims(topk_ids, axis=2)], axis=2)
else:
# Gather up the most probable 2*beams both for the ids and
# finished_in_alive bools
topk_seq = fast_tpu_gather(alive_seq, topk_beam_index)
if states:
states = nest.map_structure(
lambda state: fast_tpu_gather(state, topk_beam_index), states)
# Update the most probable alive
topk_seq = tf.transpose(topk_seq, perm=[2, 0, 1])
topk_seq = inplace_ops.alias_inplace_update(topk_seq, i + 1, topk_ids)
topk_seq = tf.transpose(topk_seq, perm=[1, 2, 0])
topk_finished = tf.equal(topk_ids, eos_id)
return topk_seq, topk_log_probs, topk_scores, topk_finished, states
def inner_loop(i, alive_seq, alive_log_probs, finished_seq, finished_scores,
finished_flags, states):
"""Inner beam search loop.
There are three groups of tensors, alive, finished, and topk.
The alive group contains information about the current alive sequences
The topk group contains information about alive + topk current decoded words
the finished group contains information about finished sentences, that is,
the ones that have decoded to <EOS>. These are what we return.
The general beam search algorithm is as follows:
While we haven't terminated (pls look at termination condition)
1. Grow the current alive to get beam*2 topk sequences
2. Among the topk, keep the top beam_size ones that haven't reached EOS
into alive
3. Among the topk, keep the top beam_size ones have reached EOS into
finished
Repeat
To make things simple with using fixed size tensors, we will end
up inserting unfinished sequences into finished in the beginning. To stop
that we add -ve INF to the score of the unfinished sequence so that when a
true finished sequence does appear, it will have a higher score than all the
unfinished ones.
Args:
i: loop index
alive_seq: Topk sequences decoded so far [batch_size, beam_size, i+1]
alive_log_probs: probabilities of the beams. [batch_size, beam_size]
finished_seq: Current finished sequences.
[batch_size, beam_size, i+1]
finished_scores: scores for each of these sequences.
[batch_size, beam_size]
finished_flags: finished bools for each of these sequences.
[batch_size, beam_size]
states: dict (possibly nested) of decoding states.
Returns:
Tuple of
(Incremented loop index
New alive sequences,
Log probs of the alive sequences,
New finished sequences,
Scores of the new finished sequences,
Flags indicating which sequence in finished as reached EOS,
dict of final decoding states)
"""
# Each inner loop, we carry out three steps:
# 1. Get the current topk items.
# 2. Extract the ones that have finished and haven't finished
# 3. Recompute the contents of finished based on scores.
topk_seq, topk_log_probs, topk_scores, topk_finished, states = grow_topk(
i, alive_seq, alive_log_probs, states)
alive_seq, alive_log_probs, _, states = grow_alive(
topk_seq, topk_scores, topk_log_probs, topk_finished, states)
finished_seq, finished_scores, finished_flags, _ = grow_finished(
finished_seq, finished_scores, finished_flags, topk_seq, topk_scores,
topk_finished)
return (i + 1, alive_seq, alive_log_probs, finished_seq, finished_scores,
finished_flags, states)
def _is_finished(i, unused_alive_seq, alive_log_probs, unused_finished_seq,
finished_scores, unused_finished_in_finished, unused_states):
"""Checking termination condition.
We terminate when we decoded up to decode_length or the lowest scoring item
in finished has a greater score that the highest prob item in alive divided
by the max length penalty
Args:
i: loop index
alive_log_probs: probabilities of the beams. [batch_size, beam_size]
finished_scores: scores for each of these sequences.
[batch_size, beam_size]
Returns:
Bool.
"""
max_length_penalty = tf.pow(((5. + tf.to_float(decode_length)) / 6.), alpha)
# The best possible score of the most likely alive sequence.
lower_bound_alive_scores = alive_log_probs[:, 0] / max_length_penalty
if not stop_early:
# by considering the min score (in the top N beams) we ensure that
# the decoder will keep decoding until there is at least one beam
# (in the top N) that can be improved (w.r.t. the alive beams).
# any unfinished beam will have score -INF - thus the min
# will always be -INF if there is at least one unfinished beam -
# which means the bound_is_met condition cannot be true in this case.
lowest_score_of_finished_in_finished = tf.reduce_min(finished_scores)
else:
# by taking the max score we only care about the first beam;
# as soon as this first beam cannot be beaten from the alive beams
# the beam decoder can stop.
# similarly to the above, if the top beam is not completed, its
# finished_score is -INF, thus it will not activate the
# bound_is_met condition. (i.e., decoder will keep going on).
# note we need to find the max for every sequence eparately - so, we need
# to keep the batch dimension (see axis=1)
lowest_score_of_finished_in_finished = tf.reduce_max(finished_scores,
axis=1)
bound_is_met = tf.reduce_all(
tf.greater(lowest_score_of_finished_in_finished,
lower_bound_alive_scores))
return tf.logical_and(
tf.less(i, decode_length), tf.logical_not(bound_is_met))
inner_shape = tf.TensorShape([None, None, None])
if use_tpu:
inner_shape = tf.TensorShape([batch_size, beam_size, decode_length + 1])
if use_tpu:
state_struc = nest.map_structure(lambda state: state.get_shape(), states)
else:
state_struc = nest.map_structure(get_state_shape_invariants, states)
(_, alive_seq, alive_log_probs, finished_seq, finished_scores,
finished_flags, states) = tf.while_loop(
_is_finished,
inner_loop, [
tf.constant(0), alive_seq, alive_log_probs, finished_seq,
finished_scores, finished_flags, states
],
shape_invariants=[
tf.TensorShape([]),
inner_shape,
alive_log_probs.get_shape(),
inner_shape,
finished_scores.get_shape(),
finished_flags.get_shape(),
state_struc
],
parallel_iterations=1,
back_prop=False)
alive_seq.set_shape((None, beam_size, None))
finished_seq.set_shape((None, beam_size, None))
# Accounting for corner case: It's possible that no sequence in alive for a
# particular batch item ever reached EOS. In that case, we should just copy
# the contents of alive for that batch item. tf.reduce_any(finished_flags, 1)
# if 0, means that no sequence for that batch index had reached EOS. We need
# to do the same for the scores as well.
finished_seq = tf.where(
tf.reduce_any(finished_flags, 1), finished_seq, alive_seq)
finished_scores = tf.where(
tf.reduce_any(finished_flags, 1), finished_scores, alive_log_probs)
return finished_seq, finished_scores, states
|
[
"def",
"beam_search",
"(",
"symbols_to_logits_fn",
",",
"initial_ids",
",",
"beam_size",
",",
"decode_length",
",",
"vocab_size",
",",
"alpha",
",",
"states",
"=",
"None",
",",
"eos_id",
"=",
"EOS_ID",
",",
"stop_early",
"=",
"True",
",",
"use_tpu",
"=",
"False",
",",
"use_top_k_with_unique",
"=",
"True",
")",
":",
"batch_size",
"=",
"common_layers",
".",
"shape_list",
"(",
"initial_ids",
")",
"[",
"0",
"]",
"# Assume initial_ids are prob 1.0",
"initial_log_probs",
"=",
"tf",
".",
"constant",
"(",
"[",
"[",
"0.",
"]",
"+",
"[",
"-",
"INF",
"]",
"*",
"(",
"beam_size",
"-",
"1",
")",
"]",
")",
"# Expand to beam_size (batch_size, beam_size)",
"alive_log_probs",
"=",
"tf",
".",
"tile",
"(",
"initial_log_probs",
",",
"[",
"batch_size",
",",
"1",
"]",
")",
"# Expand each batch and state to beam_size",
"alive_seq",
"=",
"_expand_to_beam_size",
"(",
"initial_ids",
",",
"beam_size",
")",
"alive_seq",
"=",
"tf",
".",
"expand_dims",
"(",
"alive_seq",
",",
"axis",
"=",
"2",
")",
"# (batch_size, beam_size, 1)",
"if",
"use_tpu",
":",
"alive_seq",
"=",
"tf",
".",
"tile",
"(",
"alive_seq",
",",
"[",
"1",
",",
"1",
",",
"decode_length",
"+",
"1",
"]",
")",
"if",
"states",
":",
"states",
"=",
"nest",
".",
"map_structure",
"(",
"lambda",
"state",
":",
"_expand_to_beam_size",
"(",
"state",
",",
"beam_size",
")",
",",
"states",
")",
"else",
":",
"states",
"=",
"{",
"}",
"# Finished will keep track of all the sequences that have finished so far",
"# Finished log probs will be negative infinity in the beginning",
"# finished_flags will keep track of booleans",
"finished_seq",
"=",
"tf",
".",
"zeros",
"(",
"common_layers",
".",
"shape_list",
"(",
"alive_seq",
")",
",",
"tf",
".",
"int32",
")",
"# Setting the scores of the initial to negative infinity.",
"finished_scores",
"=",
"tf",
".",
"ones",
"(",
"[",
"batch_size",
",",
"beam_size",
"]",
")",
"*",
"-",
"INF",
"finished_flags",
"=",
"tf",
".",
"zeros",
"(",
"[",
"batch_size",
",",
"beam_size",
"]",
",",
"tf",
".",
"bool",
")",
"def",
"grow_finished",
"(",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"curr_seq",
",",
"curr_scores",
",",
"curr_finished",
")",
":",
"\"\"\"Given sequences and scores, will gather the top k=beam size sequences.\n\n Args:\n finished_seq: Current finished sequences.\n [batch_size, beam_size, current_decoded_length]\n finished_scores: scores for each of these sequences.\n [batch_size, beam_size]\n finished_flags: finished bools for each of these sequences.\n [batch_size, beam_size]\n curr_seq: current topk sequence that has been grown by one position.\n [batch_size, beam_size, current_decoded_length]\n curr_scores: scores for each of these sequences. [batch_size, beam_size]\n curr_finished: Finished flags for each of these sequences.\n [batch_size, beam_size]\n Returns:\n Tuple of\n (Topk sequences based on scores,\n log probs of these sequences,\n Finished flags of these sequences)\n \"\"\"",
"if",
"not",
"use_tpu",
":",
"# First append a column of 0'ids to finished to make the same length with",
"# finished scores",
"finished_seq",
"=",
"tf",
".",
"concat",
"(",
"[",
"finished_seq",
",",
"tf",
".",
"zeros",
"(",
"[",
"batch_size",
",",
"beam_size",
",",
"1",
"]",
",",
"tf",
".",
"int32",
")",
"]",
",",
"axis",
"=",
"2",
")",
"# Set the scores of the unfinished seq in curr_seq to large negative",
"# values",
"curr_scores",
"+=",
"(",
"1.",
"-",
"tf",
".",
"to_float",
"(",
"curr_finished",
")",
")",
"*",
"-",
"INF",
"# concatenating the sequences and scores along beam axis",
"curr_finished_seq",
"=",
"tf",
".",
"concat",
"(",
"[",
"finished_seq",
",",
"curr_seq",
"]",
",",
"axis",
"=",
"1",
")",
"curr_finished_scores",
"=",
"tf",
".",
"concat",
"(",
"[",
"finished_scores",
",",
"curr_scores",
"]",
",",
"axis",
"=",
"1",
")",
"curr_finished_flags",
"=",
"tf",
".",
"concat",
"(",
"[",
"finished_flags",
",",
"curr_finished",
"]",
",",
"axis",
"=",
"1",
")",
"return",
"compute_topk_scores_and_seq",
"(",
"curr_finished_seq",
",",
"curr_finished_scores",
",",
"curr_finished_scores",
",",
"curr_finished_flags",
",",
"beam_size",
",",
"batch_size",
",",
"\"grow_finished\"",
",",
"use_tpu",
"=",
"use_tpu",
",",
"use_top_k_with_unique",
"=",
"use_top_k_with_unique",
")",
"def",
"grow_alive",
"(",
"curr_seq",
",",
"curr_scores",
",",
"curr_log_probs",
",",
"curr_finished",
",",
"states",
")",
":",
"\"\"\"Given sequences and scores, will gather the top k=beam size sequences.\n\n Args:\n curr_seq: current topk sequence that has been grown by one position.\n [batch_size, beam_size, i+1]\n curr_scores: scores for each of these sequences. [batch_size, beam_size]\n curr_log_probs: log probs for each of these sequences.\n [batch_size, beam_size]\n curr_finished: Finished flags for each of these sequences.\n [batch_size, beam_size]\n states: dict (possibly nested) of decoding states.\n Returns:\n Tuple of\n (Topk sequences based on scores,\n log probs of these sequences,\n Finished flags of these sequences)\n \"\"\"",
"# Set the scores of the finished seq in curr_seq to large negative",
"# values",
"curr_scores",
"+=",
"tf",
".",
"to_float",
"(",
"curr_finished",
")",
"*",
"-",
"INF",
"return",
"compute_topk_scores_and_seq",
"(",
"curr_seq",
",",
"curr_scores",
",",
"curr_log_probs",
",",
"curr_finished",
",",
"beam_size",
",",
"batch_size",
",",
"\"grow_alive\"",
",",
"states",
",",
"use_tpu",
"=",
"use_tpu",
")",
"def",
"grow_topk",
"(",
"i",
",",
"alive_seq",
",",
"alive_log_probs",
",",
"states",
")",
":",
"r\"\"\"Inner beam search loop.\n\n This function takes the current alive sequences, and grows them to topk\n sequences where k = 2*beam. We use 2*beam because, we could have beam_size\n number of sequences that might hit <EOS> and there will be no alive\n sequences to continue. With 2*beam_size, this will not happen. This relies\n on the assumption the vocab size is > beam size. If this is true, we'll\n have at least beam_size non <EOS> extensions if we extract the next top\n 2*beam words.\n Length penalty is given by = (5+len(decode)/6) ^ -\\alpha. Pls refer to\n https://arxiv.org/abs/1609.08144.\n\n Args:\n i: loop index\n alive_seq: Topk sequences decoded so far [batch_size, beam_size, i+1]\n alive_log_probs: probabilities of these sequences. [batch_size, beam_size]\n states: dict (possibly nested) of decoding states.\n Returns:\n Tuple of\n (Topk sequences extended by the next word,\n The log probs of these sequences,\n The scores with length penalty of these sequences,\n Flags indicating which of these sequences have finished decoding,\n dict of transformed decoding states)\n \"\"\"",
"# Get the logits for all the possible next symbols",
"if",
"use_tpu",
"and",
"states",
":",
"flat_ids",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"slice",
"(",
"alive_seq",
",",
"[",
"0",
",",
"0",
",",
"i",
"]",
",",
"[",
"batch_size",
",",
"beam_size",
",",
"1",
"]",
")",
",",
"[",
"batch_size",
"*",
"beam_size",
",",
"-",
"1",
"]",
")",
"else",
":",
"flat_ids",
"=",
"tf",
".",
"reshape",
"(",
"alive_seq",
",",
"[",
"batch_size",
"*",
"beam_size",
",",
"-",
"1",
"]",
")",
"# (batch_size * beam_size, decoded_length)",
"if",
"states",
":",
"flat_states",
"=",
"nest",
".",
"map_structure",
"(",
"_merge_beam_dim",
",",
"states",
")",
"flat_logits",
",",
"flat_states",
"=",
"symbols_to_logits_fn",
"(",
"flat_ids",
",",
"i",
",",
"flat_states",
")",
"states",
"=",
"nest",
".",
"map_structure",
"(",
"lambda",
"t",
":",
"_unmerge_beam_dim",
"(",
"t",
",",
"batch_size",
",",
"beam_size",
")",
",",
"flat_states",
")",
"elif",
"use_tpu",
":",
"flat_logits",
"=",
"symbols_to_logits_fn",
"(",
"flat_ids",
",",
"i",
")",
"else",
":",
"flat_logits",
"=",
"symbols_to_logits_fn",
"(",
"flat_ids",
")",
"logits",
"=",
"tf",
".",
"reshape",
"(",
"flat_logits",
",",
"[",
"batch_size",
",",
"beam_size",
",",
"-",
"1",
"]",
")",
"# Convert logits to normalized log probs",
"candidate_log_probs",
"=",
"common_layers",
".",
"log_prob_from_logits",
"(",
"logits",
")",
"# Multiply the probabilities by the current probabilities of the beam.",
"# (batch_size, beam_size, vocab_size) + (batch_size, beam_size, 1)",
"log_probs",
"=",
"candidate_log_probs",
"+",
"tf",
".",
"expand_dims",
"(",
"alive_log_probs",
",",
"axis",
"=",
"2",
")",
"length_penalty",
"=",
"tf",
".",
"pow",
"(",
"(",
"(",
"5.",
"+",
"tf",
".",
"to_float",
"(",
"i",
"+",
"1",
")",
")",
"/",
"6.",
")",
",",
"alpha",
")",
"curr_scores",
"=",
"log_probs",
"/",
"length_penalty",
"# Flatten out (beam_size, vocab_size) probs in to a list of possibilities",
"flat_curr_scores",
"=",
"tf",
".",
"reshape",
"(",
"curr_scores",
",",
"[",
"-",
"1",
",",
"beam_size",
"*",
"vocab_size",
"]",
")",
"if",
"use_tpu",
"and",
"use_top_k_with_unique",
":",
"topk_scores",
",",
"topk_ids",
"=",
"top_k_with_unique",
"(",
"flat_curr_scores",
",",
"k",
"=",
"beam_size",
"*",
"2",
")",
"else",
":",
"topk_scores",
",",
"topk_ids",
"=",
"tf",
".",
"nn",
".",
"top_k",
"(",
"flat_curr_scores",
",",
"k",
"=",
"beam_size",
"*",
"2",
")",
"# Recovering the log probs because we will need to send them back",
"topk_log_probs",
"=",
"topk_scores",
"*",
"length_penalty",
"# Work out what beam the top probs are in.",
"topk_beam_index",
"=",
"topk_ids",
"//",
"vocab_size",
"topk_ids",
"%=",
"vocab_size",
"# Unflatten the ids",
"if",
"not",
"use_tpu",
":",
"# The next three steps are to create coordinates for tf.gather_nd to pull",
"# out the correct sequences from id's that we need to grow.",
"# We will also use the coordinates to gather the booleans of the beam",
"# items that survived.",
"batch_pos",
"=",
"compute_batch_indices",
"(",
"batch_size",
",",
"beam_size",
"*",
"2",
")",
"# top beams will give us the actual coordinates to do the gather.",
"# stacking will create a tensor of dimension batch * beam * 2, where the",
"# last dimension contains the i,j gathering coordinates.",
"topk_coordinates",
"=",
"tf",
".",
"stack",
"(",
"[",
"batch_pos",
",",
"topk_beam_index",
"]",
",",
"axis",
"=",
"2",
")",
"# Gather up the most probable 2*beams both for the ids and",
"# finished_in_alive bools",
"topk_seq",
"=",
"tf",
".",
"gather_nd",
"(",
"alive_seq",
",",
"topk_coordinates",
")",
"if",
"states",
":",
"states",
"=",
"nest",
".",
"map_structure",
"(",
"lambda",
"state",
":",
"tf",
".",
"gather_nd",
"(",
"state",
",",
"topk_coordinates",
")",
",",
"states",
")",
"# Append the most probable alive",
"topk_seq",
"=",
"tf",
".",
"concat",
"(",
"[",
"topk_seq",
",",
"tf",
".",
"expand_dims",
"(",
"topk_ids",
",",
"axis",
"=",
"2",
")",
"]",
",",
"axis",
"=",
"2",
")",
"else",
":",
"# Gather up the most probable 2*beams both for the ids and",
"# finished_in_alive bools",
"topk_seq",
"=",
"fast_tpu_gather",
"(",
"alive_seq",
",",
"topk_beam_index",
")",
"if",
"states",
":",
"states",
"=",
"nest",
".",
"map_structure",
"(",
"lambda",
"state",
":",
"fast_tpu_gather",
"(",
"state",
",",
"topk_beam_index",
")",
",",
"states",
")",
"# Update the most probable alive",
"topk_seq",
"=",
"tf",
".",
"transpose",
"(",
"topk_seq",
",",
"perm",
"=",
"[",
"2",
",",
"0",
",",
"1",
"]",
")",
"topk_seq",
"=",
"inplace_ops",
".",
"alias_inplace_update",
"(",
"topk_seq",
",",
"i",
"+",
"1",
",",
"topk_ids",
")",
"topk_seq",
"=",
"tf",
".",
"transpose",
"(",
"topk_seq",
",",
"perm",
"=",
"[",
"1",
",",
"2",
",",
"0",
"]",
")",
"topk_finished",
"=",
"tf",
".",
"equal",
"(",
"topk_ids",
",",
"eos_id",
")",
"return",
"topk_seq",
",",
"topk_log_probs",
",",
"topk_scores",
",",
"topk_finished",
",",
"states",
"def",
"inner_loop",
"(",
"i",
",",
"alive_seq",
",",
"alive_log_probs",
",",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"states",
")",
":",
"\"\"\"Inner beam search loop.\n\n There are three groups of tensors, alive, finished, and topk.\n The alive group contains information about the current alive sequences\n The topk group contains information about alive + topk current decoded words\n the finished group contains information about finished sentences, that is,\n the ones that have decoded to <EOS>. These are what we return.\n The general beam search algorithm is as follows:\n While we haven't terminated (pls look at termination condition)\n 1. Grow the current alive to get beam*2 topk sequences\n 2. Among the topk, keep the top beam_size ones that haven't reached EOS\n into alive\n 3. Among the topk, keep the top beam_size ones have reached EOS into\n finished\n Repeat\n To make things simple with using fixed size tensors, we will end\n up inserting unfinished sequences into finished in the beginning. To stop\n that we add -ve INF to the score of the unfinished sequence so that when a\n true finished sequence does appear, it will have a higher score than all the\n unfinished ones.\n\n Args:\n i: loop index\n alive_seq: Topk sequences decoded so far [batch_size, beam_size, i+1]\n alive_log_probs: probabilities of the beams. [batch_size, beam_size]\n finished_seq: Current finished sequences.\n [batch_size, beam_size, i+1]\n finished_scores: scores for each of these sequences.\n [batch_size, beam_size]\n finished_flags: finished bools for each of these sequences.\n [batch_size, beam_size]\n states: dict (possibly nested) of decoding states.\n\n Returns:\n Tuple of\n (Incremented loop index\n New alive sequences,\n Log probs of the alive sequences,\n New finished sequences,\n Scores of the new finished sequences,\n Flags indicating which sequence in finished as reached EOS,\n dict of final decoding states)\n \"\"\"",
"# Each inner loop, we carry out three steps:",
"# 1. Get the current topk items.",
"# 2. Extract the ones that have finished and haven't finished",
"# 3. Recompute the contents of finished based on scores.",
"topk_seq",
",",
"topk_log_probs",
",",
"topk_scores",
",",
"topk_finished",
",",
"states",
"=",
"grow_topk",
"(",
"i",
",",
"alive_seq",
",",
"alive_log_probs",
",",
"states",
")",
"alive_seq",
",",
"alive_log_probs",
",",
"_",
",",
"states",
"=",
"grow_alive",
"(",
"topk_seq",
",",
"topk_scores",
",",
"topk_log_probs",
",",
"topk_finished",
",",
"states",
")",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"_",
"=",
"grow_finished",
"(",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"topk_seq",
",",
"topk_scores",
",",
"topk_finished",
")",
"return",
"(",
"i",
"+",
"1",
",",
"alive_seq",
",",
"alive_log_probs",
",",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"states",
")",
"def",
"_is_finished",
"(",
"i",
",",
"unused_alive_seq",
",",
"alive_log_probs",
",",
"unused_finished_seq",
",",
"finished_scores",
",",
"unused_finished_in_finished",
",",
"unused_states",
")",
":",
"\"\"\"Checking termination condition.\n\n We terminate when we decoded up to decode_length or the lowest scoring item\n in finished has a greater score that the highest prob item in alive divided\n by the max length penalty\n\n Args:\n i: loop index\n alive_log_probs: probabilities of the beams. [batch_size, beam_size]\n finished_scores: scores for each of these sequences.\n [batch_size, beam_size]\n\n Returns:\n Bool.\n \"\"\"",
"max_length_penalty",
"=",
"tf",
".",
"pow",
"(",
"(",
"(",
"5.",
"+",
"tf",
".",
"to_float",
"(",
"decode_length",
")",
")",
"/",
"6.",
")",
",",
"alpha",
")",
"# The best possible score of the most likely alive sequence.",
"lower_bound_alive_scores",
"=",
"alive_log_probs",
"[",
":",
",",
"0",
"]",
"/",
"max_length_penalty",
"if",
"not",
"stop_early",
":",
"# by considering the min score (in the top N beams) we ensure that",
"# the decoder will keep decoding until there is at least one beam",
"# (in the top N) that can be improved (w.r.t. the alive beams).",
"# any unfinished beam will have score -INF - thus the min",
"# will always be -INF if there is at least one unfinished beam -",
"# which means the bound_is_met condition cannot be true in this case.",
"lowest_score_of_finished_in_finished",
"=",
"tf",
".",
"reduce_min",
"(",
"finished_scores",
")",
"else",
":",
"# by taking the max score we only care about the first beam;",
"# as soon as this first beam cannot be beaten from the alive beams",
"# the beam decoder can stop.",
"# similarly to the above, if the top beam is not completed, its",
"# finished_score is -INF, thus it will not activate the",
"# bound_is_met condition. (i.e., decoder will keep going on).",
"# note we need to find the max for every sequence eparately - so, we need",
"# to keep the batch dimension (see axis=1)",
"lowest_score_of_finished_in_finished",
"=",
"tf",
".",
"reduce_max",
"(",
"finished_scores",
",",
"axis",
"=",
"1",
")",
"bound_is_met",
"=",
"tf",
".",
"reduce_all",
"(",
"tf",
".",
"greater",
"(",
"lowest_score_of_finished_in_finished",
",",
"lower_bound_alive_scores",
")",
")",
"return",
"tf",
".",
"logical_and",
"(",
"tf",
".",
"less",
"(",
"i",
",",
"decode_length",
")",
",",
"tf",
".",
"logical_not",
"(",
"bound_is_met",
")",
")",
"inner_shape",
"=",
"tf",
".",
"TensorShape",
"(",
"[",
"None",
",",
"None",
",",
"None",
"]",
")",
"if",
"use_tpu",
":",
"inner_shape",
"=",
"tf",
".",
"TensorShape",
"(",
"[",
"batch_size",
",",
"beam_size",
",",
"decode_length",
"+",
"1",
"]",
")",
"if",
"use_tpu",
":",
"state_struc",
"=",
"nest",
".",
"map_structure",
"(",
"lambda",
"state",
":",
"state",
".",
"get_shape",
"(",
")",
",",
"states",
")",
"else",
":",
"state_struc",
"=",
"nest",
".",
"map_structure",
"(",
"get_state_shape_invariants",
",",
"states",
")",
"(",
"_",
",",
"alive_seq",
",",
"alive_log_probs",
",",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"states",
")",
"=",
"tf",
".",
"while_loop",
"(",
"_is_finished",
",",
"inner_loop",
",",
"[",
"tf",
".",
"constant",
"(",
"0",
")",
",",
"alive_seq",
",",
"alive_log_probs",
",",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"states",
"]",
",",
"shape_invariants",
"=",
"[",
"tf",
".",
"TensorShape",
"(",
"[",
"]",
")",
",",
"inner_shape",
",",
"alive_log_probs",
".",
"get_shape",
"(",
")",
",",
"inner_shape",
",",
"finished_scores",
".",
"get_shape",
"(",
")",
",",
"finished_flags",
".",
"get_shape",
"(",
")",
",",
"state_struc",
"]",
",",
"parallel_iterations",
"=",
"1",
",",
"back_prop",
"=",
"False",
")",
"alive_seq",
".",
"set_shape",
"(",
"(",
"None",
",",
"beam_size",
",",
"None",
")",
")",
"finished_seq",
".",
"set_shape",
"(",
"(",
"None",
",",
"beam_size",
",",
"None",
")",
")",
"# Accounting for corner case: It's possible that no sequence in alive for a",
"# particular batch item ever reached EOS. In that case, we should just copy",
"# the contents of alive for that batch item. tf.reduce_any(finished_flags, 1)",
"# if 0, means that no sequence for that batch index had reached EOS. We need",
"# to do the same for the scores as well.",
"finished_seq",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"reduce_any",
"(",
"finished_flags",
",",
"1",
")",
",",
"finished_seq",
",",
"alive_seq",
")",
"finished_scores",
"=",
"tf",
".",
"where",
"(",
"tf",
".",
"reduce_any",
"(",
"finished_flags",
",",
"1",
")",
",",
"finished_scores",
",",
"alive_log_probs",
")",
"return",
"finished_seq",
",",
"finished_scores",
",",
"states"
] |
Beam search with length penalties.
Requires a function that can take the currently decoded symbols and return
the logits for the next symbol. The implementation is inspired by
https://arxiv.org/abs/1609.08144.
When running, the beam search steps can be visualized by using tfdbg to watch
the operations generating the output ids for each beam step. These operations
have the pattern:
(alive|finished)_topk_(seq,scores)
Operations marked `alive` represent the new beam sequences that will be
processed in the next step. Operations marked `finished` represent the
completed beam sequences, which may be padded with 0s if no beams finished.
Operations marked `seq` store the full beam sequence for the time step.
Operations marked `scores` store the sequence's final log scores.
The beam search steps will be processed sequentially in order, so when
capturing observed from these operations, tensors, clients can make
assumptions about which step is being recorded.
WARNING: Assumes 2nd dimension of tensors in `states` and not invariant, this
means that the shape of the 2nd dimension of these tensors will not be
available (i.e. set to None) inside symbols_to_logits_fn.
Args:
symbols_to_logits_fn: Interface to the model, to provide logits.
Shoud take [batch_size, decoded_ids] and return [batch_size, vocab_size]
initial_ids: Ids to start off the decoding, this will be the first thing
handed to symbols_to_logits_fn (after expanding to beam size)
[batch_size]
beam_size: Size of the beam.
decode_length: Number of steps to decode for.
vocab_size: Size of the vocab, must equal the size of the logits returned by
symbols_to_logits_fn
alpha: alpha for length penalty.
states: dict (possibly nested) of decoding states.
eos_id: ID for end of sentence.
stop_early: a boolean - stop once best sequence is provably determined.
use_tpu: A bool, whether to do beam search on TPU.
use_top_k_with_unique: bool, whether to use a fast (but decreased precision)
top_k during TPU beam search.
Returns:
Tuple of
(decoded beams [batch_size, beam_size, decode_length]
decoding probabilities [batch_size, beam_size])
|
[
"Beam",
"search",
"with",
"length",
"penalties",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/beam_search.py#L396-L813
|
train
|
This function is used to run a beam search on the current state of the current beam.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvx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m1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(6271 - 6160) + '\x33' + chr(0b110001) + chr(0b100010 + 0o20), 0b1000), ehT0Px3KOsy9(chr(48) + chr(246 - 135) + chr(53) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(503 - 452) + chr(2152 - 2098), 51907 - 51899), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(9960 - 9849) + '\063' + '\066' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1079 - 1029) + '\x32' + chr(1958 - 1905), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101001 + 0o6) + chr(0b10100 + 0o37) + chr(1115 - 1064) + chr(0b11110 + 0o27), 30912 - 30904), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1010010 + 0o35) + chr(0b110011) + chr(0b110010 + 0o4) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b111010 + 0o65) + chr(51) + '\060' + chr(1125 - 1074), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + '\063' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x35' + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101110 + 0o101) + chr(0b110001) + chr(51) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110110) + chr(55), 26190 - 26182), ehT0Px3KOsy9('\x30' + '\157' + chr(1985 - 1934) + chr(0b11101 + 0o31) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(0b110010) + chr(927 - 879) + chr(0b10001 + 0o37), 16636 - 16628), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(2401 - 2348) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(208 - 160) + chr(0b1101111) + '\x32' + '\x32' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(0b11101 + 0o27), 58709 - 58701), ehT0Px3KOsy9(chr(1042 - 994) + chr(6982 - 6871) + chr(51) + chr(0b110001) + chr(53), 0o10), ehT0Px3KOsy9(chr(933 - 885) + chr(111) + chr(0b100111 + 0o14) + chr(1473 - 1421) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1100 + 0o47) + chr(0b10001 + 0o40) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b0 + 0o60) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010010 + 0o35) + chr(0b110011) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1135 - 1087) + chr(111) + chr(0b110001) + '\x32' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(52) + '\062', 0o10), ehT0Px3KOsy9(chr(68 - 20) + chr(456 - 345) + chr(860 - 811) + chr(0b100001 + 0o21) + chr(2049 - 1998), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110001) + chr(2258 - 2203), 0b1000), ehT0Px3KOsy9(chr(533 - 485) + '\x6f' + '\x33' + chr(481 - 431) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\064' + chr(867 - 817), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b110001) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(48) + '\x36', 60909 - 60901), ehT0Px3KOsy9('\060' + chr(7958 - 7847) + chr(0b110001) + chr(0b110000) + chr(218 - 164), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b101000 + 0o16) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(354 - 306) + '\157' + '\x37' + chr(0b110111), 43515 - 43507), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(10151 - 10040) + chr(0b110100) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b10 + 0o56) + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110111) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010101 + 0o32) + chr(0b101100 + 0o12) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + '\x32' + chr(0b110111) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(0b110100) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001 + 0o0) + '\x35' + chr(0b11 + 0o57), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1531 - 1483) + chr(0b101101 + 0o102) + '\x35' + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4'), chr(100) + chr(4706 - 4605) + chr(2233 - 2134) + chr(111) + chr(100) + chr(101))('\x75' + chr(116) + chr(4099 - 3997) + chr(45) + chr(0b100110 + 0o22)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def M4QqcqvVKFSA(P8dwKNPITUWX, WPnuojygthCW, PQZjDxhiHJGf, U6Ej34SVvx1Y, CeyMIoSyrpkQ, gDUX9w35YHFE, jI0E6zso5mLP=None, fRohXOUUw5Jd=AcdgioUvW3hs, T4duFYlPEBkL=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1460 - 1411), ord("\x08")), L4eE7kczIJwa=ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b101011 + 0o104) + chr(48), 0b1000), EvZxy6QSzaKS=ehT0Px3KOsy9('\060' + '\x6f' + chr(49), 8)):
ix9dZyeAmUxY = jSKPaHwSAfVv.shape_list(WPnuojygthCW)[ehT0Px3KOsy9('\x30' + chr(5600 - 5489) + chr(0b1 + 0o57), 8)]
kmeq_73L7tbm = IDJ2eXGCBCDu.constant([[0.0] + [-Beq_KPB9VfOK] * (PQZjDxhiHJGf - ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(6205 - 6094) + '\061', 8))])
Mu3O72XtHq9z = IDJ2eXGCBCDu.tile(kmeq_73L7tbm, [ix9dZyeAmUxY, ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100010 + 0o17), 8)])
w4ZWaaofukt3 = TBVwc7QrrXec(WPnuojygthCW, PQZjDxhiHJGf)
w4ZWaaofukt3 = IDJ2eXGCBCDu.expand_dims(w4ZWaaofukt3, axis=ehT0Px3KOsy9('\060' + '\157' + '\062', ord("\x08")))
if L4eE7kczIJwa:
w4ZWaaofukt3 = IDJ2eXGCBCDu.tile(w4ZWaaofukt3, [ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(0b100111 + 0o12), 8), ehT0Px3KOsy9(chr(48) + chr(4542 - 4431) + chr(0b110001), 8), U6Ej34SVvx1Y + ehT0Px3KOsy9(chr(2203 - 2155) + chr(6030 - 5919) + '\061', 8)])
if jI0E6zso5mLP:
jI0E6zso5mLP = mnU87WrcOgNU.map_structure(lambda KKFQISrGeiAm: TBVwc7QrrXec(KKFQISrGeiAm, PQZjDxhiHJGf), jI0E6zso5mLP)
else:
jI0E6zso5mLP = {}
vWNlygdLfUqs = IDJ2eXGCBCDu.zeros(jSKPaHwSAfVv.shape_list(w4ZWaaofukt3), IDJ2eXGCBCDu.int32)
MA_Uygx7Zqms = IDJ2eXGCBCDu.ones([ix9dZyeAmUxY, PQZjDxhiHJGf]) * -Beq_KPB9VfOK
ISd_qjFkoOhi = IDJ2eXGCBCDu.zeros([ix9dZyeAmUxY, PQZjDxhiHJGf], IDJ2eXGCBCDu.bool)
def w1CQLzCL4_07(vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, qRCH1XkBJN9a, Fyl4YxthJ9h1, TOf8xqt5WA9M):
if not L4eE7kczIJwa:
vWNlygdLfUqs = IDJ2eXGCBCDu.concat([vWNlygdLfUqs, IDJ2eXGCBCDu.zeros([ix9dZyeAmUxY, PQZjDxhiHJGf, ehT0Px3KOsy9(chr(1781 - 1733) + chr(0b1101111) + chr(0b110001), 8)], IDJ2eXGCBCDu.int32)], axis=ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101010 + 0o10), 8))
Fyl4YxthJ9h1 += (1.0 - IDJ2eXGCBCDu.ZUL3kHBGU8Uu(TOf8xqt5WA9M)) * -Beq_KPB9VfOK
deYOd8TYOkd4 = IDJ2eXGCBCDu.concat([vWNlygdLfUqs, qRCH1XkBJN9a], axis=ehT0Px3KOsy9('\x30' + '\x6f' + '\x31', 8))
JDJliAPZ0k5I = IDJ2eXGCBCDu.concat([MA_Uygx7Zqms, Fyl4YxthJ9h1], axis=ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + chr(0b11011 + 0o26), 8))
ci7LozYZmSdc = IDJ2eXGCBCDu.concat([ISd_qjFkoOhi, TOf8xqt5WA9M], axis=ehT0Px3KOsy9(chr(1668 - 1620) + chr(111) + '\061', 8))
return ug1GN6Tv0wJt(deYOd8TYOkd4, JDJliAPZ0k5I, JDJliAPZ0k5I, ci7LozYZmSdc, PQZjDxhiHJGf, ix9dZyeAmUxY, xafqLlk3kkUe(SXOLrMavuUCe(b'\xadZ\xb1\x81\xca\xbb\x98\xadvZ7R\x90'), '\x64' + '\145' + chr(0b111100 + 0o47) + chr(4658 - 4547) + chr(0b1001110 + 0o26) + '\145')('\x75' + chr(6989 - 6873) + '\x66' + chr(45) + '\070'), use_tpu=L4eE7kczIJwa, use_top_k_with_unique=EvZxy6QSzaKS)
def yQesyr9DHM5k(qRCH1XkBJN9a, Fyl4YxthJ9h1, _mKrZ6AY2WBm, TOf8xqt5WA9M, jI0E6zso5mLP):
Fyl4YxthJ9h1 += IDJ2eXGCBCDu.ZUL3kHBGU8Uu(TOf8xqt5WA9M) * -Beq_KPB9VfOK
return ug1GN6Tv0wJt(qRCH1XkBJN9a, Fyl4YxthJ9h1, _mKrZ6AY2WBm, TOf8xqt5WA9M, PQZjDxhiHJGf, ix9dZyeAmUxY, xafqLlk3kkUe(SXOLrMavuUCe(b'\xadZ\xb1\x81\xca\xbc\x9d\xaaiL'), '\144' + chr(0b1001000 + 0o35) + chr(0b1100011) + chr(111) + '\144' + chr(0b1011100 + 0o11))('\x75' + chr(0b1100100 + 0o20) + chr(0b101010 + 0o74) + chr(45) + chr(1434 - 1378)), jI0E6zso5mLP, use_tpu=L4eE7kczIJwa)
def wCpKt04Hpq9P(WVxHKyX45z_L, w4ZWaaofukt3, Mu3O72XtHq9z, jI0E6zso5mLP):
if L4eE7kczIJwa and jI0E6zso5mLP:
yg5hpWsDHKfw = IDJ2eXGCBCDu.reshape(IDJ2eXGCBCDu.slice(w4ZWaaofukt3, [ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10001 + 0o37), 8), ehT0Px3KOsy9(chr(472 - 424) + '\157' + chr(0b110000), 8), WVxHKyX45z_L], [ix9dZyeAmUxY, PQZjDxhiHJGf, ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1001 + 0o50), 8)]), [ix9dZyeAmUxY * PQZjDxhiHJGf, -ehT0Px3KOsy9(chr(48) + chr(1060 - 949) + chr(0b110001), 8)])
else:
yg5hpWsDHKfw = IDJ2eXGCBCDu.reshape(w4ZWaaofukt3, [ix9dZyeAmUxY * PQZjDxhiHJGf, -ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b11 + 0o154) + chr(1784 - 1735), 8)])
if jI0E6zso5mLP:
MH1ZxluJWzwE = mnU87WrcOgNU.map_structure(YCBNoHs6fDAT, jI0E6zso5mLP)
(mQgwxqmMBPjj, MH1ZxluJWzwE) = P8dwKNPITUWX(yg5hpWsDHKfw, WVxHKyX45z_L, MH1ZxluJWzwE)
jI0E6zso5mLP = mnU87WrcOgNU.map_structure(lambda YeT3l7JgTbWR: vbtE39Uwakua(YeT3l7JgTbWR, ix9dZyeAmUxY, PQZjDxhiHJGf), MH1ZxluJWzwE)
elif L4eE7kczIJwa:
mQgwxqmMBPjj = P8dwKNPITUWX(yg5hpWsDHKfw, WVxHKyX45z_L)
else:
mQgwxqmMBPjj = P8dwKNPITUWX(yg5hpWsDHKfw)
wF9nmvjsKjYM = IDJ2eXGCBCDu.reshape(mQgwxqmMBPjj, [ix9dZyeAmUxY, PQZjDxhiHJGf, -ehT0Px3KOsy9(chr(0b110000) + chr(1818 - 1707) + '\061', 8)])
n1yo0mki92Cu = jSKPaHwSAfVv.log_prob_from_logits(wF9nmvjsKjYM)
yPp0Syg5g6oO = n1yo0mki92Cu + IDJ2eXGCBCDu.expand_dims(Mu3O72XtHq9z, axis=ehT0Px3KOsy9(chr(1729 - 1681) + chr(111) + chr(0b110010), 8))
X6QgM9bp8fJe = IDJ2eXGCBCDu.pow((5.0 + IDJ2eXGCBCDu.ZUL3kHBGU8Uu(WVxHKyX45z_L + ehT0Px3KOsy9('\x30' + chr(111) + chr(767 - 718), 8))) / 6.0, gDUX9w35YHFE)
Fyl4YxthJ9h1 = yPp0Syg5g6oO / X6QgM9bp8fJe
w8TVdQcyMb5R = IDJ2eXGCBCDu.reshape(Fyl4YxthJ9h1, [-ehT0Px3KOsy9(chr(0b110000) + chr(10346 - 10235) + chr(49), 8), PQZjDxhiHJGf * CeyMIoSyrpkQ])
if L4eE7kczIJwa and EvZxy6QSzaKS:
(P1Q6Z1b2Qhqd, E7TE_bFpoE7N) = UxMoDnekZSiD(w8TVdQcyMb5R, k=PQZjDxhiHJGf * ehT0Px3KOsy9('\060' + chr(8817 - 8706) + '\x32', 8))
else:
(P1Q6Z1b2Qhqd, E7TE_bFpoE7N) = IDJ2eXGCBCDu.nn.top_k(w8TVdQcyMb5R, k=PQZjDxhiHJGf * ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062', 8))
CVIAnbEWwqPf = P1Q6Z1b2Qhqd * X6QgM9bp8fJe
xK3s3wRedhgS = E7TE_bFpoE7N // CeyMIoSyrpkQ
E7TE_bFpoE7N %= CeyMIoSyrpkQ
if not L4eE7kczIJwa:
E43v_LHTD3cD = DZBjHthzFDZN(ix9dZyeAmUxY, PQZjDxhiHJGf * ehT0Px3KOsy9(chr(2282 - 2234) + '\157' + chr(0b10110 + 0o34), 8))
VqL2MKf1kz8g = IDJ2eXGCBCDu.stack([E43v_LHTD3cD, xK3s3wRedhgS], axis=ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b110010), 8))
G174XbOlOSko = IDJ2eXGCBCDu.gather_nd(w4ZWaaofukt3, VqL2MKf1kz8g)
if jI0E6zso5mLP:
jI0E6zso5mLP = mnU87WrcOgNU.map_structure(lambda KKFQISrGeiAm: IDJ2eXGCBCDu.gather_nd(KKFQISrGeiAm, VqL2MKf1kz8g), jI0E6zso5mLP)
G174XbOlOSko = IDJ2eXGCBCDu.concat([G174XbOlOSko, IDJ2eXGCBCDu.expand_dims(E7TE_bFpoE7N, axis=ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1011110 + 0o21) + chr(1089 - 1039), 8))], axis=ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + '\x32', 8))
else:
G174XbOlOSko = k9b50MT4kqHF(w4ZWaaofukt3, xK3s3wRedhgS)
if jI0E6zso5mLP:
jI0E6zso5mLP = mnU87WrcOgNU.map_structure(lambda KKFQISrGeiAm: k9b50MT4kqHF(KKFQISrGeiAm, xK3s3wRedhgS), jI0E6zso5mLP)
G174XbOlOSko = IDJ2eXGCBCDu.transpose(G174XbOlOSko, perm=[ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100101 + 0o15), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1654 - 1606), 8), ehT0Px3KOsy9(chr(1487 - 1439) + chr(111) + chr(49), 8)])
G174XbOlOSko = GanXbkgpxGLx.alias_inplace_update(G174XbOlOSko, WVxHKyX45z_L + ehT0Px3KOsy9('\060' + chr(0b1010011 + 0o34) + chr(49), 8), E7TE_bFpoE7N)
G174XbOlOSko = IDJ2eXGCBCDu.transpose(G174XbOlOSko, perm=[ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1000 + 0o51), 8), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1370 - 1322), 8)])
Y7eL2T6NusRx = IDJ2eXGCBCDu.equal(E7TE_bFpoE7N, fRohXOUUw5Jd)
return (G174XbOlOSko, CVIAnbEWwqPf, P1Q6Z1b2Qhqd, Y7eL2T6NusRx, jI0E6zso5mLP)
def WV64Y4kADLvt(WVxHKyX45z_L, w4ZWaaofukt3, Mu3O72XtHq9z, vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, jI0E6zso5mLP):
(G174XbOlOSko, CVIAnbEWwqPf, P1Q6Z1b2Qhqd, Y7eL2T6NusRx, jI0E6zso5mLP) = wCpKt04Hpq9P(WVxHKyX45z_L, w4ZWaaofukt3, Mu3O72XtHq9z, jI0E6zso5mLP)
(w4ZWaaofukt3, Mu3O72XtHq9z, VNGQdHSFPrso, jI0E6zso5mLP) = yQesyr9DHM5k(G174XbOlOSko, P1Q6Z1b2Qhqd, CVIAnbEWwqPf, Y7eL2T6NusRx, jI0E6zso5mLP)
(vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, VNGQdHSFPrso) = w1CQLzCL4_07(vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, G174XbOlOSko, P1Q6Z1b2Qhqd, Y7eL2T6NusRx)
return (WVxHKyX45z_L + ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2249 - 2200), 8), w4ZWaaofukt3, Mu3O72XtHq9z, vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, jI0E6zso5mLP)
def Wuofu7xSRny7(WVxHKyX45z_L, JxOKxv4phwDM, Mu3O72XtHq9z, fhhNVgma4iK_, MA_Uygx7Zqms, d5y7jMC_W6dn, rTiEp1oigcfE):
uGAU2Gkwzb_S = IDJ2eXGCBCDu.pow((5.0 + IDJ2eXGCBCDu.ZUL3kHBGU8Uu(U6Ej34SVvx1Y)) / 6.0, gDUX9w35YHFE)
nL_azdgdoccu = Mu3O72XtHq9z[:, ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1572 - 1524), 8)] / uGAU2Gkwzb_S
if not T4duFYlPEBkL:
wi8OtLLr9cpP = IDJ2eXGCBCDu.reduce_min(MA_Uygx7Zqms)
else:
wi8OtLLr9cpP = IDJ2eXGCBCDu.reduce_max(MA_Uygx7Zqms, axis=ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b110011 + 0o74) + '\x31', 8))
VWM5PXDt_lpU = IDJ2eXGCBCDu.reduce_all(IDJ2eXGCBCDu.greater(wi8OtLLr9cpP, nL_azdgdoccu))
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6G\xb9\x9f\xf6\xbc\x9d\x9c~G;'), chr(0b1100100) + chr(7728 - 7627) + chr(0b1100011) + chr(0b1101111) + chr(740 - 640) + chr(0b111001 + 0o54))(chr(0b100110 + 0o117) + chr(4417 - 4301) + '\146' + chr(0b101101) + chr(56)))(xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6M\xad\x85'), chr(4793 - 4693) + chr(0b101100 + 0o71) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(101))(chr(3161 - 3044) + chr(116) + '\x66' + '\055' + chr(0b111000)))(WVxHKyX45z_L, U6Ej34SVvx1Y), xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6G\xb9\x9f\xf6\xbc\x9d\x9cqF+'), chr(100) + chr(101) + chr(3021 - 2922) + '\x6f' + chr(100) + chr(1043 - 942))(chr(519 - 402) + chr(0b1110100) + chr(4178 - 4076) + chr(0b101101) + chr(2509 - 2453)))(VWM5PXDt_lpU))
VaXtxCpP5Vpr = IDJ2eXGCBCDu.TensorShape([None, None, None])
if L4eE7kczIJwa:
VaXtxCpP5Vpr = IDJ2eXGCBCDu.TensorShape([ix9dZyeAmUxY, PQZjDxhiHJGf, U6Ej34SVvx1Y + ehT0Px3KOsy9(chr(66 - 18) + chr(111) + chr(0b110001), 8)])
if L4eE7kczIJwa:
hnpUHTcv3AU0 = mnU87WrcOgNU.map_structure(lambda KKFQISrGeiAm: KKFQISrGeiAm.get_shape(), jI0E6zso5mLP)
else:
hnpUHTcv3AU0 = mnU87WrcOgNU.map_structure(r4hXCIyiAfqZ, jI0E6zso5mLP)
(VNGQdHSFPrso, w4ZWaaofukt3, Mu3O72XtHq9z, vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, jI0E6zso5mLP) = IDJ2eXGCBCDu.while_loop(Wuofu7xSRny7, WV64Y4kADLvt, [IDJ2eXGCBCDu.constant(ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + '\x30', 8)), w4ZWaaofukt3, Mu3O72XtHq9z, vWNlygdLfUqs, MA_Uygx7Zqms, ISd_qjFkoOhi, jI0E6zso5mLP], shape_invariants=[IDJ2eXGCBCDu.TensorShape([]), VaXtxCpP5Vpr, Mu3O72XtHq9z.get_shape(), VaXtxCpP5Vpr, MA_Uygx7Zqms.get_shape(), ISd_qjFkoOhi.get_shape(), hnpUHTcv3AU0], parallel_iterations=ehT0Px3KOsy9(chr(48) + chr(0b1010000 + 0o37) + '\061', 8), back_prop=ehT0Px3KOsy9('\060' + '\x6f' + chr(48), 8))
xafqLlk3kkUe(w4ZWaaofukt3, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9M\xaa\xa9\xe6\xb5\x90\xb3z'), '\x64' + chr(101) + chr(0b1100011) + '\157' + chr(0b110111 + 0o55) + '\145')('\165' + '\x74' + chr(0b110011 + 0o63) + chr(45) + chr(2358 - 2302)))((None, PQZjDxhiHJGf, None))
xafqLlk3kkUe(vWNlygdLfUqs, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9M\xaa\xa9\xe6\xb5\x90\xb3z'), chr(0b1100100) + chr(101) + '\x63' + chr(0b101110 + 0o101) + chr(0b1100100) + '\x65')('\165' + chr(0b1110100) + '\x66' + '\055' + chr(0b111000)))((None, PQZjDxhiHJGf, None))
vWNlygdLfUqs = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.reduce_any(ISd_qjFkoOhi, ehT0Px3KOsy9('\060' + '\157' + '\061', 8)), vWNlygdLfUqs, w4ZWaaofukt3)
MA_Uygx7Zqms = IDJ2eXGCBCDu.dRFAC59yQBm_(IDJ2eXGCBCDu.reduce_any(ISd_qjFkoOhi, ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10011 + 0o36), 8)), MA_Uygx7Zqms, Mu3O72XtHq9z)
return (vWNlygdLfUqs, MA_Uygx7Zqms, jI0E6zso5mLP)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
video_augmentation
|
def video_augmentation(features, hue=False, saturate=False, contrast=False):
"""Augments video with optional hue, saturation and constrast.
Args:
features: dict, with keys "inputs", "targets".
features["inputs"], 4-D Tensor, shape=(THWC)
features["targets"], 4-D Tensor, shape=(THWC)
hue: bool, apply hue_transform.
saturate: bool, apply saturation transform.
contrast: bool, apply constrast transform.
Returns:
augment_features: dict with transformed "inputs" and "targets".
"""
inputs, targets = features["inputs"], features["targets"]
in_steps = common_layers.shape_list(inputs)[0]
# makes sure that the same augmentation is applied to both input and targets.
# if input is 4-D, then tf.image applies the same transform across the batch.
video = tf.concat((inputs, targets), axis=0)
if hue:
video = tf.image.random_hue(video, max_delta=0.2)
if saturate:
video = tf.image.random_saturation(video, lower=0.5, upper=1.5)
if contrast:
video = tf.image.random_contrast(video, lower=0.5, upper=1.5)
features["inputs"], features["targets"] = video[:in_steps], video[in_steps:]
return features
|
python
|
def video_augmentation(features, hue=False, saturate=False, contrast=False):
"""Augments video with optional hue, saturation and constrast.
Args:
features: dict, with keys "inputs", "targets".
features["inputs"], 4-D Tensor, shape=(THWC)
features["targets"], 4-D Tensor, shape=(THWC)
hue: bool, apply hue_transform.
saturate: bool, apply saturation transform.
contrast: bool, apply constrast transform.
Returns:
augment_features: dict with transformed "inputs" and "targets".
"""
inputs, targets = features["inputs"], features["targets"]
in_steps = common_layers.shape_list(inputs)[0]
# makes sure that the same augmentation is applied to both input and targets.
# if input is 4-D, then tf.image applies the same transform across the batch.
video = tf.concat((inputs, targets), axis=0)
if hue:
video = tf.image.random_hue(video, max_delta=0.2)
if saturate:
video = tf.image.random_saturation(video, lower=0.5, upper=1.5)
if contrast:
video = tf.image.random_contrast(video, lower=0.5, upper=1.5)
features["inputs"], features["targets"] = video[:in_steps], video[in_steps:]
return features
|
[
"def",
"video_augmentation",
"(",
"features",
",",
"hue",
"=",
"False",
",",
"saturate",
"=",
"False",
",",
"contrast",
"=",
"False",
")",
":",
"inputs",
",",
"targets",
"=",
"features",
"[",
"\"inputs\"",
"]",
",",
"features",
"[",
"\"targets\"",
"]",
"in_steps",
"=",
"common_layers",
".",
"shape_list",
"(",
"inputs",
")",
"[",
"0",
"]",
"# makes sure that the same augmentation is applied to both input and targets.",
"# if input is 4-D, then tf.image applies the same transform across the batch.",
"video",
"=",
"tf",
".",
"concat",
"(",
"(",
"inputs",
",",
"targets",
")",
",",
"axis",
"=",
"0",
")",
"if",
"hue",
":",
"video",
"=",
"tf",
".",
"image",
".",
"random_hue",
"(",
"video",
",",
"max_delta",
"=",
"0.2",
")",
"if",
"saturate",
":",
"video",
"=",
"tf",
".",
"image",
".",
"random_saturation",
"(",
"video",
",",
"lower",
"=",
"0.5",
",",
"upper",
"=",
"1.5",
")",
"if",
"contrast",
":",
"video",
"=",
"tf",
".",
"image",
".",
"random_contrast",
"(",
"video",
",",
"lower",
"=",
"0.5",
",",
"upper",
"=",
"1.5",
")",
"features",
"[",
"\"inputs\"",
"]",
",",
"features",
"[",
"\"targets\"",
"]",
"=",
"video",
"[",
":",
"in_steps",
"]",
",",
"video",
"[",
"in_steps",
":",
"]",
"return",
"features"
] |
Augments video with optional hue, saturation and constrast.
Args:
features: dict, with keys "inputs", "targets".
features["inputs"], 4-D Tensor, shape=(THWC)
features["targets"], 4-D Tensor, shape=(THWC)
hue: bool, apply hue_transform.
saturate: bool, apply saturation transform.
contrast: bool, apply constrast transform.
Returns:
augment_features: dict with transformed "inputs" and "targets".
|
[
"Augments",
"video",
"with",
"optional",
"hue",
"saturation",
"and",
"constrast",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L52-L78
|
train
|
Augments video with optional hue saturation and constrast.
|
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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B_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(366 - 318) + chr(3898 - 3787) + chr(0b10011 + 0o36) + chr(2175 - 2126), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b111 + 0o53) + '\061' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b110111) + '\062', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(55) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x36' + '\x30', 0o10), ehT0Px3KOsy9(chr(682 - 634) + chr(0b1000001 + 0o56) + chr(52) + '\x32', 16148 - 16140), ehT0Px3KOsy9('\060' + '\157' + chr(813 - 762) + chr(0b101 + 0o61) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + '\062' + '\x31' + chr(660 - 605), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1783 - 1732) + chr(0b100000 + 0o23) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b10001 + 0o41) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(52) + '\x34', 30447 - 30439), ehT0Px3KOsy9(chr(2271 - 2223) + chr(111) + chr(0b110011) + chr(0b10111 + 0o32) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(3066 - 2955) + chr(0b110001) + chr(1826 - 1774) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11001 + 0o126) + chr(1803 - 1754) + chr(1447 - 1396), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(127 - 16) + '\x32' + '\x33' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1304 - 1251) + chr(883 - 828), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101110 + 0o101) + chr(0b110010) + chr(0b110101) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + '\x36' + chr(1117 - 1063), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x30' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100110 + 0o21) + chr(0b101100 + 0o4), 23719 - 23711), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11010 + 0o31) + '\063' + chr(0b11111 + 0o22), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101110 + 0o5) + '\x36' + '\060', 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(111) + '\063' + chr(54) + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10111 + 0o32) + '\x35', 36126 - 36118), ehT0Px3KOsy9('\x30' + chr(5555 - 5444) + '\x33' + chr(0b11011 + 0o30) + chr(1979 - 1925), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110000 + 0o1) + '\060' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + '\x36' + '\060', 8), ehT0Px3KOsy9('\060' + chr(2695 - 2584) + chr(50) + chr(50) + chr(0b11111 + 0o27), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(1686 - 1633) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + chr(1694 - 1645) + '\x31' + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\063' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(53) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1011010 + 0o25) + '\063' + chr(0b110100) + chr(0b10110 + 0o33), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + '\064' + chr(0b101110 + 0o2), 16004 - 15996), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(886 - 836), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + '\062' + '\x31' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(48), 7490 - 7482), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + '\063' + chr(0b1111 + 0o50) + '\066', 42086 - 42078), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1844 - 1794) + chr(0b110010) + chr(0b101 + 0o61), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53) + chr(425 - 377), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b"'"), chr(100) + '\145' + chr(99) + '\157' + '\x64' + chr(6227 - 6126))(chr(0b1110101) + chr(1073 - 957) + chr(102) + '\055' + chr(658 - 602)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Lk5uPJ_Bgt5B(EEf4r9nUvta_, BDCKR21ZT4le=ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x30', 16888 - 16880), eogwBaS9OUrK=ehT0Px3KOsy9(chr(48) + chr(0b1010010 + 0o35) + chr(48), 8), ycmj1Rz5MRpl=ehT0Px3KOsy9(chr(0b110000) + chr(12123 - 12012) + chr(0b110000), 8)):
(vXoupepMtCXU, xIEmRseySp3z) = (EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'`\xe1\n\x0e\x04Q'), chr(100) + chr(101) + chr(0b1100011) + chr(2752 - 2641) + chr(0b1100100) + '\145')('\165' + '\x74' + chr(0b11011 + 0o113) + '\055' + chr(0b110110 + 0o2))], EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'}\xee\x08\x1c\x15V\x81'), '\x64' + chr(929 - 828) + '\143' + chr(9499 - 9388) + chr(100) + chr(0b1100101))(chr(117) + '\164' + chr(5425 - 5323) + chr(45) + chr(0b111000))])
uHtTOyjsLt4G = jSKPaHwSAfVv.shape_list(vXoupepMtCXU)[ehT0Px3KOsy9('\060' + chr(111) + '\x30', 8)]
lADoCDXuSFEg = IDJ2eXGCBCDu.concat((vXoupepMtCXU, xIEmRseySp3z), axis=ehT0Px3KOsy9('\060' + '\x6f' + '\x30', 8))
if BDCKR21ZT4le:
lADoCDXuSFEg = IDJ2eXGCBCDu.image.random_hue(lADoCDXuSFEg, max_delta=0.2)
if eogwBaS9OUrK:
lADoCDXuSFEg = IDJ2eXGCBCDu.image.random_saturation(lADoCDXuSFEg, lower=0.5, upper=1.5)
if ycmj1Rz5MRpl:
lADoCDXuSFEg = IDJ2eXGCBCDu.image.random_contrast(lADoCDXuSFEg, lower=0.5, upper=1.5)
(EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'`\xe1\n\x0e\x04Q'), chr(0b1100100) + chr(0b1100101) + chr(0b100 + 0o137) + chr(0b1101111) + '\144' + chr(101))(chr(0b11111 + 0o126) + chr(116) + chr(102) + chr(0b1 + 0o54) + chr(201 - 145))], EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'}\xee\x08\x1c\x15V\x81'), chr(100) + '\145' + chr(4386 - 4287) + chr(4499 - 4388) + chr(100) + '\145')(chr(0b1110101) + chr(116) + chr(0b101010 + 0o74) + chr(0b101101) + chr(2158 - 2102))]) = (lADoCDXuSFEg[:uHtTOyjsLt4G], lADoCDXuSFEg[uHtTOyjsLt4G:])
return EEf4r9nUvta_
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
create_border
|
def create_border(video, color="blue", border_percent=2):
"""Creates a border around each frame to differentiate input and target.
Args:
video: 5-D NumPy array.
color: string, "blue", "red" or "green".
border_percent: Percentarge of the frame covered by the border.
Returns:
video: 5-D NumPy array.
"""
# Do not create border if the video is not in RGB format
if video.shape[-1] != 3:
return video
color_to_axis = {"blue": 2, "red": 0, "green": 1}
axis = color_to_axis[color]
_, _, height, width, _ = video.shape
border_height = np.ceil(border_percent * height / 100.0).astype(np.int)
border_width = np.ceil(border_percent * width / 100.0).astype(np.int)
video[:, :, :border_height, :, axis] = 255
video[:, :, -border_height:, :, axis] = 255
video[:, :, :, :border_width, axis] = 255
video[:, :, :, -border_width:, axis] = 255
return video
|
python
|
def create_border(video, color="blue", border_percent=2):
"""Creates a border around each frame to differentiate input and target.
Args:
video: 5-D NumPy array.
color: string, "blue", "red" or "green".
border_percent: Percentarge of the frame covered by the border.
Returns:
video: 5-D NumPy array.
"""
# Do not create border if the video is not in RGB format
if video.shape[-1] != 3:
return video
color_to_axis = {"blue": 2, "red": 0, "green": 1}
axis = color_to_axis[color]
_, _, height, width, _ = video.shape
border_height = np.ceil(border_percent * height / 100.0).astype(np.int)
border_width = np.ceil(border_percent * width / 100.0).astype(np.int)
video[:, :, :border_height, :, axis] = 255
video[:, :, -border_height:, :, axis] = 255
video[:, :, :, :border_width, axis] = 255
video[:, :, :, -border_width:, axis] = 255
return video
|
[
"def",
"create_border",
"(",
"video",
",",
"color",
"=",
"\"blue\"",
",",
"border_percent",
"=",
"2",
")",
":",
"# Do not create border if the video is not in RGB format",
"if",
"video",
".",
"shape",
"[",
"-",
"1",
"]",
"!=",
"3",
":",
"return",
"video",
"color_to_axis",
"=",
"{",
"\"blue\"",
":",
"2",
",",
"\"red\"",
":",
"0",
",",
"\"green\"",
":",
"1",
"}",
"axis",
"=",
"color_to_axis",
"[",
"color",
"]",
"_",
",",
"_",
",",
"height",
",",
"width",
",",
"_",
"=",
"video",
".",
"shape",
"border_height",
"=",
"np",
".",
"ceil",
"(",
"border_percent",
"*",
"height",
"/",
"100.0",
")",
".",
"astype",
"(",
"np",
".",
"int",
")",
"border_width",
"=",
"np",
".",
"ceil",
"(",
"border_percent",
"*",
"width",
"/",
"100.0",
")",
".",
"astype",
"(",
"np",
".",
"int",
")",
"video",
"[",
":",
",",
":",
",",
":",
"border_height",
",",
":",
",",
"axis",
"]",
"=",
"255",
"video",
"[",
":",
",",
":",
",",
"-",
"border_height",
":",
",",
":",
",",
"axis",
"]",
"=",
"255",
"video",
"[",
":",
",",
":",
",",
":",
",",
":",
"border_width",
",",
"axis",
"]",
"=",
"255",
"video",
"[",
":",
",",
":",
",",
":",
",",
"-",
"border_width",
":",
",",
"axis",
"]",
"=",
"255",
"return",
"video"
] |
Creates a border around each frame to differentiate input and target.
Args:
video: 5-D NumPy array.
color: string, "blue", "red" or "green".
border_percent: Percentarge of the frame covered by the border.
Returns:
video: 5-D NumPy array.
|
[
"Creates",
"a",
"border",
"around",
"each",
"frame",
"to",
"differentiate",
"input",
"and",
"target",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L81-L103
|
train
|
Creates a border around each frame to differentiate input and target.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZz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FWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(1156 - 1045) + '\061' + '\x32' + chr(0b10010 + 0o44), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\x35' + chr(0b110101 + 0o2), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b100 + 0o56) + chr(0b110011) + '\061', 39468 - 39460), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\x36' + chr(2118 - 2068), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + '\062' + chr(0b110100) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + '\062' + chr(49), 18886 - 18878), ehT0Px3KOsy9(chr(923 - 875) + chr(0b1101000 + 0o7) + chr(0b110001) + '\063' + chr(2273 - 2222), 61854 - 61846), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1101 + 0o50) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\065' + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(250 - 200) + '\x34' + chr(0b10111 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101000 + 0o12) + chr(723 - 673) + chr(2281 - 2229), ord("\x08")), ehT0Px3KOsy9(chr(1546 - 1498) + '\157' + '\x37' + chr(0b11010 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(1285 - 1237) + chr(111) + '\x37' + chr(0b110101), 29566 - 29558), ehT0Px3KOsy9(chr(1660 - 1612) + chr(111) + '\x37' + chr(0b110110), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(52) + chr(52), 8), ehT0Px3KOsy9(chr(924 - 876) + chr(0b100000 + 0o117) + chr(0b110001 + 0o2) + chr(896 - 845) + chr(0b110100), 56208 - 56200), ehT0Px3KOsy9('\x30' + chr(1908 - 1797) + chr(0b1011 + 0o46) + chr(0b11100 + 0o31) + '\x31', 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b110101) + chr(0b100 + 0o60), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(2440 - 2390) + chr(0b100111 + 0o14) + '\064', 34121 - 34113), ehT0Px3KOsy9(chr(0b110000) + chr(11268 - 11157) + chr(0b110010) + '\x32' + '\067', 57526 - 57518), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1 + 0o64) + chr(0b11110 + 0o30), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(52) + '\x35', 28562 - 28554), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1150 - 1101) + chr(0b1 + 0o57) + '\x37', 13385 - 13377), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b110010) + chr(502 - 451), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110010) + '\060', 9710 - 9702), ehT0Px3KOsy9('\x30' + chr(111) + chr(1249 - 1200) + chr(0b100100 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(993 - 944) + chr(0b110000) + chr(0b1111 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(111) + chr(0b110010) + chr(0b110101) + chr(49), 7559 - 7551), ehT0Px3KOsy9('\060' + chr(111) + chr(817 - 768) + chr(0b10011 + 0o40) + chr(0b1010 + 0o51), 8), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(1336 - 1285) + '\x37' + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + chr(1957 - 1907) + chr(0b1111 + 0o45) + '\066', 35085 - 35077), ehT0Px3KOsy9(chr(48) + chr(0b110111 + 0o70) + chr(0b110011) + chr(53) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11110 + 0o23) + chr(1903 - 1853) + chr(1547 - 1492), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b110110) + chr(1851 - 1800), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\x35' + '\x30', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(1571 - 1521) + chr(48), 58953 - 58945), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(519 - 466), 55813 - 55805), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(0b110011) + chr(0b110111), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1891 - 1843) + chr(0b111100 + 0o63) + '\x35' + chr(1238 - 1190), 55102 - 55094)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'x'), chr(100) + chr(101) + chr(1073 - 974) + '\x6f' + chr(0b1100100) + chr(0b1000110 + 0o37))(chr(0b1101111 + 0o6) + chr(116) + chr(796 - 694) + '\055' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def oDQYKIzDrk0u(lADoCDXuSFEg, pxiSFVqpMRzu=xafqLlk3kkUe(SXOLrMavuUCe(b'4h\xda\xfc'), chr(2301 - 2201) + '\x65' + chr(0b1001001 + 0o32) + '\x6f' + chr(0b1100100) + chr(101))('\165' + chr(10940 - 10824) + chr(0b1100110) + chr(45) + chr(80 - 24)), Wa6WB2a0Nupm=ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062', ord("\x08"))):
if xafqLlk3kkUe(lADoCDXuSFEg, xafqLlk3kkUe(SXOLrMavuUCe(b'8e\xda\xc0\x94\xe8\xb67}\x19\xc1\xf6'), '\144' + chr(101) + '\143' + chr(111) + chr(0b1010010 + 0o22) + chr(839 - 738))(chr(0b11000 + 0o135) + chr(2005 - 1889) + '\x66' + '\x2d' + chr(0b111000)))[-ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001), ord("\x08"))] != ehT0Px3KOsy9('\x30' + chr(111) + chr(51), 8):
return lADoCDXuSFEg
n93JvrTAQ7dn = {xafqLlk3kkUe(SXOLrMavuUCe(b'4h\xda\xfc'), '\x64' + chr(0b1100101) + chr(9555 - 9456) + '\157' + chr(0b1100100) + '\x65')(chr(117) + '\164' + '\x66' + '\x2d' + chr(2706 - 2650)): ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + '\x32', 8), xafqLlk3kkUe(SXOLrMavuUCe(b'$a\xcb'), chr(3965 - 3865) + chr(0b0 + 0o145) + chr(99) + chr(0b1101000 + 0o7) + '\x64' + chr(101))(chr(9471 - 9354) + chr(0b1110100) + chr(0b1100110) + chr(0b10 + 0o53) + chr(0b111000)): ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(913 - 865), 0b1000), xafqLlk3kkUe(SXOLrMavuUCe(b'1v\xca\xfc\x9c'), '\144' + chr(101) + chr(99) + chr(0b1101111) + chr(1205 - 1105) + chr(0b1100101))('\165' + chr(0b1000111 + 0o55) + '\x66' + chr(0b101101) + chr(56)): ehT0Px3KOsy9(chr(1742 - 1694) + chr(0b111001 + 0o66) + chr(0b110001), 8)}
cRTh61qyvi24 = n93JvrTAQ7dn[pxiSFVqpMRzu]
(VNGQdHSFPrso, VNGQdHSFPrso, ehbUULKuygfC, mPx09rBTrGXR, VNGQdHSFPrso) = lADoCDXuSFEg.nauYfLglTpcb
v5wqVTDNmCyE = WqUC3KWvYVup.ceil(Wa6WB2a0Nupm * ehbUULKuygfC / 100.0).astype(WqUC3KWvYVup.int)
Dw38JO484w2p = WqUC3KWvYVup.ceil(Wa6WB2a0Nupm * mPx09rBTrGXR / 100.0).astype(WqUC3KWvYVup.int)
lADoCDXuSFEg[:, :, :v5wqVTDNmCyE, :, cRTh61qyvi24] = ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\067' + chr(0b11011 + 0o34), 8)
lADoCDXuSFEg[:, :, -v5wqVTDNmCyE:, :, cRTh61qyvi24] = ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(4471 - 4360) + chr(1024 - 973) + chr(0b110101 + 0o2) + '\x37', 8)
lADoCDXuSFEg[:, :, :, :Dw38JO484w2p, cRTh61qyvi24] = ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\067' + chr(855 - 800), 8)
lADoCDXuSFEg[:, :, :, -Dw38JO484w2p:, cRTh61qyvi24] = ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2185 - 2134) + chr(2293 - 2238) + chr(55), 8)
return lADoCDXuSFEg
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
convert_videos_to_summaries
|
def convert_videos_to_summaries(input_videos, output_videos, target_videos,
tag, decode_hparams,
display_ground_truth=False):
"""Converts input, output and target videos into video summaries.
Args:
input_videos: 5-D NumPy array, (NTHWC) conditioning frames.
output_videos: 5-D NumPy array, (NTHWC) model predictions.
target_videos: 5-D NumPy array, (NTHWC) target frames.
tag: tf summary tag.
decode_hparams: HParams.
display_ground_truth: Whether or not to display ground truth videos.
Returns:
summaries: a list of tf frame-by-frame and video summaries.
"""
fps = decode_hparams.frames_per_second
border_percent = decode_hparams.border_percent
max_outputs = decode_hparams.max_display_outputs
target_steps = target_videos.shape[1]
all_summaries = []
input_videos = create_border(
input_videos, color="blue", border_percent=border_percent)
target_videos = create_border(
target_videos, color="red", border_percent=border_percent)
output_videos = create_border(
output_videos, color="red", border_percent=border_percent)
all_input = np.concatenate((input_videos, target_videos), axis=1)
all_output = np.concatenate((input_videos, output_videos), axis=1)
output_summ_vals, _ = common_video.py_gif_summary(
"%s/output" % tag, all_output, max_outputs=max_outputs, fps=fps,
return_summary_value=True)
all_summaries.extend(output_summ_vals)
# Optionally display ground truth.
if display_ground_truth:
input_summ_vals, _ = common_video.py_gif_summary(
"%s/input" % tag, all_input, max_outputs=max_outputs, fps=fps,
return_summary_value=True)
all_summaries.extend(input_summ_vals)
# Frame-by-frame summaries
iterable = zip(output_videos[:max_outputs, :target_steps],
target_videos[:max_outputs])
for ind, (input_video, output_video) in enumerate(iterable):
t, h, w, c = input_video.shape
# Tile vertically
input_frames = np.reshape(input_video, (t*h, w, c))
output_frames = np.reshape(output_video, (t*h, w, c))
# Concat across width.
all_frames = np.concatenate((input_frames, output_frames), axis=1)
tag = "input/output/%s_sample_%d" % (tag, ind)
frame_by_frame_summ = image_utils.image_to_tf_summary_value(
all_frames, tag=tag)
all_summaries.append(frame_by_frame_summ)
return all_summaries
|
python
|
def convert_videos_to_summaries(input_videos, output_videos, target_videos,
tag, decode_hparams,
display_ground_truth=False):
"""Converts input, output and target videos into video summaries.
Args:
input_videos: 5-D NumPy array, (NTHWC) conditioning frames.
output_videos: 5-D NumPy array, (NTHWC) model predictions.
target_videos: 5-D NumPy array, (NTHWC) target frames.
tag: tf summary tag.
decode_hparams: HParams.
display_ground_truth: Whether or not to display ground truth videos.
Returns:
summaries: a list of tf frame-by-frame and video summaries.
"""
fps = decode_hparams.frames_per_second
border_percent = decode_hparams.border_percent
max_outputs = decode_hparams.max_display_outputs
target_steps = target_videos.shape[1]
all_summaries = []
input_videos = create_border(
input_videos, color="blue", border_percent=border_percent)
target_videos = create_border(
target_videos, color="red", border_percent=border_percent)
output_videos = create_border(
output_videos, color="red", border_percent=border_percent)
all_input = np.concatenate((input_videos, target_videos), axis=1)
all_output = np.concatenate((input_videos, output_videos), axis=1)
output_summ_vals, _ = common_video.py_gif_summary(
"%s/output" % tag, all_output, max_outputs=max_outputs, fps=fps,
return_summary_value=True)
all_summaries.extend(output_summ_vals)
# Optionally display ground truth.
if display_ground_truth:
input_summ_vals, _ = common_video.py_gif_summary(
"%s/input" % tag, all_input, max_outputs=max_outputs, fps=fps,
return_summary_value=True)
all_summaries.extend(input_summ_vals)
# Frame-by-frame summaries
iterable = zip(output_videos[:max_outputs, :target_steps],
target_videos[:max_outputs])
for ind, (input_video, output_video) in enumerate(iterable):
t, h, w, c = input_video.shape
# Tile vertically
input_frames = np.reshape(input_video, (t*h, w, c))
output_frames = np.reshape(output_video, (t*h, w, c))
# Concat across width.
all_frames = np.concatenate((input_frames, output_frames), axis=1)
tag = "input/output/%s_sample_%d" % (tag, ind)
frame_by_frame_summ = image_utils.image_to_tf_summary_value(
all_frames, tag=tag)
all_summaries.append(frame_by_frame_summ)
return all_summaries
|
[
"def",
"convert_videos_to_summaries",
"(",
"input_videos",
",",
"output_videos",
",",
"target_videos",
",",
"tag",
",",
"decode_hparams",
",",
"display_ground_truth",
"=",
"False",
")",
":",
"fps",
"=",
"decode_hparams",
".",
"frames_per_second",
"border_percent",
"=",
"decode_hparams",
".",
"border_percent",
"max_outputs",
"=",
"decode_hparams",
".",
"max_display_outputs",
"target_steps",
"=",
"target_videos",
".",
"shape",
"[",
"1",
"]",
"all_summaries",
"=",
"[",
"]",
"input_videos",
"=",
"create_border",
"(",
"input_videos",
",",
"color",
"=",
"\"blue\"",
",",
"border_percent",
"=",
"border_percent",
")",
"target_videos",
"=",
"create_border",
"(",
"target_videos",
",",
"color",
"=",
"\"red\"",
",",
"border_percent",
"=",
"border_percent",
")",
"output_videos",
"=",
"create_border",
"(",
"output_videos",
",",
"color",
"=",
"\"red\"",
",",
"border_percent",
"=",
"border_percent",
")",
"all_input",
"=",
"np",
".",
"concatenate",
"(",
"(",
"input_videos",
",",
"target_videos",
")",
",",
"axis",
"=",
"1",
")",
"all_output",
"=",
"np",
".",
"concatenate",
"(",
"(",
"input_videos",
",",
"output_videos",
")",
",",
"axis",
"=",
"1",
")",
"output_summ_vals",
",",
"_",
"=",
"common_video",
".",
"py_gif_summary",
"(",
"\"%s/output\"",
"%",
"tag",
",",
"all_output",
",",
"max_outputs",
"=",
"max_outputs",
",",
"fps",
"=",
"fps",
",",
"return_summary_value",
"=",
"True",
")",
"all_summaries",
".",
"extend",
"(",
"output_summ_vals",
")",
"# Optionally display ground truth.",
"if",
"display_ground_truth",
":",
"input_summ_vals",
",",
"_",
"=",
"common_video",
".",
"py_gif_summary",
"(",
"\"%s/input\"",
"%",
"tag",
",",
"all_input",
",",
"max_outputs",
"=",
"max_outputs",
",",
"fps",
"=",
"fps",
",",
"return_summary_value",
"=",
"True",
")",
"all_summaries",
".",
"extend",
"(",
"input_summ_vals",
")",
"# Frame-by-frame summaries",
"iterable",
"=",
"zip",
"(",
"output_videos",
"[",
":",
"max_outputs",
",",
":",
"target_steps",
"]",
",",
"target_videos",
"[",
":",
"max_outputs",
"]",
")",
"for",
"ind",
",",
"(",
"input_video",
",",
"output_video",
")",
"in",
"enumerate",
"(",
"iterable",
")",
":",
"t",
",",
"h",
",",
"w",
",",
"c",
"=",
"input_video",
".",
"shape",
"# Tile vertically",
"input_frames",
"=",
"np",
".",
"reshape",
"(",
"input_video",
",",
"(",
"t",
"*",
"h",
",",
"w",
",",
"c",
")",
")",
"output_frames",
"=",
"np",
".",
"reshape",
"(",
"output_video",
",",
"(",
"t",
"*",
"h",
",",
"w",
",",
"c",
")",
")",
"# Concat across width.",
"all_frames",
"=",
"np",
".",
"concatenate",
"(",
"(",
"input_frames",
",",
"output_frames",
")",
",",
"axis",
"=",
"1",
")",
"tag",
"=",
"\"input/output/%s_sample_%d\"",
"%",
"(",
"tag",
",",
"ind",
")",
"frame_by_frame_summ",
"=",
"image_utils",
".",
"image_to_tf_summary_value",
"(",
"all_frames",
",",
"tag",
"=",
"tag",
")",
"all_summaries",
".",
"append",
"(",
"frame_by_frame_summ",
")",
"return",
"all_summaries"
] |
Converts input, output and target videos into video summaries.
Args:
input_videos: 5-D NumPy array, (NTHWC) conditioning frames.
output_videos: 5-D NumPy array, (NTHWC) model predictions.
target_videos: 5-D NumPy array, (NTHWC) target frames.
tag: tf summary tag.
decode_hparams: HParams.
display_ground_truth: Whether or not to display ground truth videos.
Returns:
summaries: a list of tf frame-by-frame and video summaries.
|
[
"Converts",
"input",
"output",
"and",
"target",
"videos",
"into",
"video",
"summaries",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L106-L162
|
train
|
Converts input output and target videos into video summaries.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,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iVQ77y,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(1087 - 1039) + '\x6f' + chr(0b101 + 0o56) + chr(0b110000 + 0o6) + chr(2111 - 2063), 3455 - 3447), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b110100) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(1344 - 1296) + '\066', 30175 - 30167), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + '\061' + chr(0b10 + 0o60) + '\x34', 0b1000), ehT0Px3KOsy9(chr(372 - 324) + chr(0b1101101 + 0o2) + chr(1926 - 1876) + chr(0b10010 + 0o44) + '\x37', 0o10), ehT0Px3KOsy9(chr(449 - 401) + chr(111) + '\061' + chr(0b110000) + chr(690 - 641), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11011 + 0o27) + chr(2564 - 2511), ord("\x08")), ehT0Px3KOsy9(chr(186 - 138) + '\x6f' + chr(2517 - 2466) + '\062' + chr(0b11001 + 0o33), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2109 - 2059) + chr(0b11011 + 0o25) + chr(114 - 62), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + chr(0b110001) + '\066' + '\x33', 45975 - 45967), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(51) + '\x36', 20365 - 20357), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\065' + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b110000) + chr(1951 - 1901), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\066' + chr(788 - 733), 12489 - 12481), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(716 - 667) + chr(0b101000 + 0o11) + chr(0b1100 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(52) + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\x35' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1732 - 1684) + chr(0b1101111) + chr(50) + chr(0b110100) + chr(51), 30273 - 30265), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101 + 0o55) + chr(0b110011) + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(2033 - 1983), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(5584 - 5473) + '\x31' + chr(2039 - 1986) + chr(55), 0o10), ehT0Px3KOsy9(chr(57 - 9) + chr(111) + '\x31' + chr(345 - 291) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(3259 - 3148) + '\x36', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b110011) + chr(51), 31619 - 31611), ehT0Px3KOsy9('\060' + chr(0b1100110 + 0o11) + chr(0b110100) + chr(470 - 416), 0o10), ehT0Px3KOsy9(chr(866 - 818) + '\x6f' + '\063' + chr(2225 - 2171) + chr(55), 6548 - 6540), ehT0Px3KOsy9(chr(1815 - 1767) + '\157' + '\063' + '\063' + chr(0b100111 + 0o14), 8), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + '\x35' + chr(0b101100 + 0o13), ord("\x08")), ehT0Px3KOsy9(chr(1114 - 1066) + chr(2971 - 2860) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(392 - 341) + chr(53) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(63 - 15) + chr(5224 - 5113) + chr(0b10101 + 0o36) + chr(54) + chr(0b100000 + 0o24), 0b1000), ehT0Px3KOsy9(chr(1261 - 1213) + chr(0b110011 + 0o74) + chr(51) + chr(0b0 + 0o65) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(2430 - 2380) + '\x31' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(49) + chr(0b110100) + chr(55), 46045 - 46037), ehT0Px3KOsy9(chr(2092 - 2044) + chr(0b1101111) + chr(1572 - 1520) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1981 - 1933) + chr(0b1101111) + chr(1635 - 1586) + '\066' + chr(1914 - 1859), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x30' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1183 - 1135) + chr(2129 - 2018) + chr(0b110011) + chr(866 - 818) + '\064', 0o10), ehT0Px3KOsy9(chr(738 - 690) + chr(0b111101 + 0o62) + chr(0b110011) + chr(0b110011) + chr(0b110100), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(53) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xde'), chr(100) + chr(0b1100101) + '\x63' + chr(0b1001100 + 0o43) + chr(0b1100100) + '\x65')(chr(117) + chr(0b1110100) + chr(4358 - 4256) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def QIQSwMOUMdrg(coYF7C2iRpEM, leCoNtSD7xVh, LaJ5xIopsph7, CPdEsc5O1sf7, LrQSWg3uwmK8, XRv01gLhTaBy=ehT0Px3KOsy9(chr(541 - 493) + chr(0b111 + 0o150) + chr(48), 33319 - 33311)):
ToH1dgLAm5iP = LrQSWg3uwmK8.frames_per_second
Wa6WB2a0Nupm = LrQSWg3uwmK8.border_percent
i7r136MIYrlH = LrQSWg3uwmK8.max_display_outputs
VaVdxwYFMhS4 = LaJ5xIopsph7.nauYfLglTpcb[ehT0Px3KOsy9('\x30' + chr(0b0 + 0o157) + chr(49), 0b1000)]
iZHoCS1AMe0Q = []
coYF7C2iRpEM = oDQYKIzDrk0u(coYF7C2iRpEM, color=xafqLlk3kkUe(SXOLrMavuUCe(b'\x92I31'), chr(0b1010100 + 0o20) + chr(0b101 + 0o140) + '\143' + chr(111) + chr(100) + '\x65')(chr(0b111 + 0o156) + chr(3944 - 3828) + chr(102) + chr(1528 - 1483) + '\070'), border_percent=Wa6WB2a0Nupm)
LaJ5xIopsph7 = oDQYKIzDrk0u(LaJ5xIopsph7, color=xafqLlk3kkUe(SXOLrMavuUCe(b'\x82@"'), chr(0b101000 + 0o74) + '\x65' + '\x63' + '\157' + '\144' + '\145')(chr(13106 - 12989) + chr(116) + chr(102) + '\x2d' + chr(2468 - 2412)), border_percent=Wa6WB2a0Nupm)
leCoNtSD7xVh = oDQYKIzDrk0u(leCoNtSD7xVh, color=xafqLlk3kkUe(SXOLrMavuUCe(b'\x82@"'), chr(0b10111 + 0o115) + '\145' + '\143' + '\157' + chr(0b101011 + 0o71) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(0b1010000 + 0o26) + chr(45) + chr(0b111000)), border_percent=Wa6WB2a0Nupm)
FTcz_LIQ6H4U = WqUC3KWvYVup.concatenate((coYF7C2iRpEM, LaJ5xIopsph7), axis=ehT0Px3KOsy9(chr(680 - 632) + '\x6f' + chr(0b1001 + 0o50), 8))
GMoUYxdw2uMK = WqUC3KWvYVup.concatenate((coYF7C2iRpEM, leCoNtSD7xVh), axis=ehT0Px3KOsy9('\060' + '\157' + '\x31', 8))
(HttNNZsdrVWX, VNGQdHSFPrso) = feDooRjkbHzt.py_gif_summary(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5Vi;\xc25e\xa1\xf0'), chr(0b1100100) + chr(0b1100010 + 0o3) + chr(0b1101 + 0o126) + chr(1778 - 1667) + '\x64' + '\145')(chr(117) + chr(116) + chr(0b1100110) + chr(1688 - 1643) + chr(56)) % CPdEsc5O1sf7, GMoUYxdw2uMK, max_outputs=i7r136MIYrlH, fps=ToH1dgLAm5iP, return_summary_value=ehT0Px3KOsy9(chr(48) + chr(794 - 683) + chr(1770 - 1721), 8))
xafqLlk3kkUe(iZHoCS1AMe0Q, xafqLlk3kkUe(SXOLrMavuUCe(b'\x95]21\xd9%'), '\144' + chr(101) + chr(99) + '\157' + chr(0b1100100) + chr(0b100010 + 0o103))(chr(0b1100111 + 0o16) + '\x74' + chr(0b1100110) + chr(45) + '\x38'))(HttNNZsdrVWX)
if XRv01gLhTaBy:
(ttJGl8kCqYpp, VNGQdHSFPrso) = feDooRjkbHzt.py_gif_summary(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5Vi=\xd91`\xa0'), chr(100) + chr(6810 - 6709) + '\x63' + '\x6f' + chr(100) + chr(3058 - 2957))(chr(0b101110 + 0o107) + chr(116) + chr(0b100000 + 0o106) + '\x2d' + chr(0b111000)) % CPdEsc5O1sf7, FTcz_LIQ6H4U, max_outputs=i7r136MIYrlH, fps=ToH1dgLAm5iP, return_summary_value=ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(1193 - 1144), 8))
xafqLlk3kkUe(iZHoCS1AMe0Q, xafqLlk3kkUe(SXOLrMavuUCe(b'\x95]21\xd9%'), chr(100) + '\x65' + chr(2705 - 2606) + '\x6f' + chr(100) + '\x65')('\165' + '\164' + chr(0b111100 + 0o52) + chr(0b11110 + 0o17) + chr(0b10 + 0o66)))(ttJGl8kCqYpp)
B7a8G3ORwfjH = pZ0NK2y6HRbn(leCoNtSD7xVh[:i7r136MIYrlH, :VaVdxwYFMhS4], LaJ5xIopsph7[:i7r136MIYrlH])
for (r3s_x88rHjuC, (juhdAOElwZxR, Nqd7as4pZpHV)) in YlkZvXL8qwsX(B7a8G3ORwfjH):
(YeT3l7JgTbWR, sz4HVsFVF8nL, AOfzRywRzEXp, qzn1Ctg9WgNh) = juhdAOElwZxR.nauYfLglTpcb
E3gpu3p9M1dJ = WqUC3KWvYVup.reshape(juhdAOElwZxR, (YeT3l7JgTbWR * sz4HVsFVF8nL, AOfzRywRzEXp, qzn1Ctg9WgNh))
x8JAYo6CPULA = WqUC3KWvYVup.reshape(Nqd7as4pZpHV, (YeT3l7JgTbWR * sz4HVsFVF8nL, AOfzRywRzEXp, qzn1Ctg9WgNh))
hJU2FOlzyEcy = WqUC3KWvYVup.concatenate((E3gpu3p9M1dJ, x8JAYo6CPULA), axis=ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(49), 8))
CPdEsc5O1sf7 = xafqLlk3kkUe(SXOLrMavuUCe(b'\x99K6!\xc3nz\xa1\xf0\x03\xab\x1e\xed#D\x17S\x8e\xce\xecn\n,#\xbf'), '\x64' + '\145' + '\143' + chr(111) + chr(0b1011100 + 0o10) + chr(0b1000000 + 0o45))(chr(0b1110101) + '\x74' + chr(3416 - 3314) + chr(1471 - 1426) + chr(1984 - 1928)) % (CPdEsc5O1sf7, r3s_x88rHjuC)
JHPVrW4DjlT2 = sOwVd6RdzUcC.image_to_tf_summary_value(hJU2FOlzyEcy, tag=CPdEsc5O1sf7)
xafqLlk3kkUe(iZHoCS1AMe0Q, xafqLlk3kkUe(SXOLrMavuUCe(b'\x91U61\xd9%'), '\x64' + chr(101) + '\143' + chr(7030 - 6919) + '\144' + '\145')(chr(7881 - 7764) + chr(116) + chr(469 - 367) + chr(1857 - 1812) + chr(56)))(JHPVrW4DjlT2)
return iZHoCS1AMe0Q
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
display_video_hooks
|
def display_video_hooks(hook_args):
"""Hooks to display videos at decode time."""
predictions = hook_args.predictions
max_outputs = hook_args.decode_hparams.max_display_outputs
max_decodes = hook_args.decode_hparams.max_display_decodes
with tf.Graph().as_default():
_, best_decodes = video_metrics.compute_video_metrics_from_predictions(
predictions, decode_hparams=hook_args.decode_hparams)
all_summaries = []
# Displays decodes corresponding to the best/worst metric,
for metric, metric_decode_inds in best_decodes.items():
curr_metric_inds = metric_decode_inds[:max_outputs]
best_inputs, best_outputs, best_targets = [], [], []
for sample_ind, decode_ind in enumerate(curr_metric_inds):
curr_decode = predictions[decode_ind][sample_ind]
best_inputs.append(curr_decode["inputs"])
best_outputs.append(curr_decode["outputs"])
best_targets.append(curr_decode["targets"])
best_inputs = np.array(best_inputs, dtype=np.uint8)
best_outputs = np.array(best_outputs, dtype=np.uint8)
best_targets = np.array(best_targets, dtype=np.uint8)
summaries = convert_videos_to_summaries(
best_inputs, best_outputs, best_targets,
tag=metric, decode_hparams=hook_args.decode_hparams)
all_summaries.extend(summaries)
# Display random decodes for ten conditioning frames.
for decode_ind, decode in enumerate(predictions[: max_decodes]):
target_videos = video_metrics.stack_data_given_key(decode, "targets")
output_videos = video_metrics.stack_data_given_key(decode, "outputs")
input_videos = video_metrics.stack_data_given_key(decode, "inputs")
target_videos = np.asarray(target_videos, dtype=np.uint8)
output_videos = np.asarray(output_videos, dtype=np.uint8)
input_videos = np.asarray(input_videos, dtype=np.uint8)
summaries = convert_videos_to_summaries(
input_videos, output_videos, target_videos,
tag="decode_%d" % decode_ind, decode_hparams=hook_args.decode_hparams,
display_ground_truth=decode_ind == 0)
all_summaries.extend(summaries)
return all_summaries
|
python
|
def display_video_hooks(hook_args):
"""Hooks to display videos at decode time."""
predictions = hook_args.predictions
max_outputs = hook_args.decode_hparams.max_display_outputs
max_decodes = hook_args.decode_hparams.max_display_decodes
with tf.Graph().as_default():
_, best_decodes = video_metrics.compute_video_metrics_from_predictions(
predictions, decode_hparams=hook_args.decode_hparams)
all_summaries = []
# Displays decodes corresponding to the best/worst metric,
for metric, metric_decode_inds in best_decodes.items():
curr_metric_inds = metric_decode_inds[:max_outputs]
best_inputs, best_outputs, best_targets = [], [], []
for sample_ind, decode_ind in enumerate(curr_metric_inds):
curr_decode = predictions[decode_ind][sample_ind]
best_inputs.append(curr_decode["inputs"])
best_outputs.append(curr_decode["outputs"])
best_targets.append(curr_decode["targets"])
best_inputs = np.array(best_inputs, dtype=np.uint8)
best_outputs = np.array(best_outputs, dtype=np.uint8)
best_targets = np.array(best_targets, dtype=np.uint8)
summaries = convert_videos_to_summaries(
best_inputs, best_outputs, best_targets,
tag=metric, decode_hparams=hook_args.decode_hparams)
all_summaries.extend(summaries)
# Display random decodes for ten conditioning frames.
for decode_ind, decode in enumerate(predictions[: max_decodes]):
target_videos = video_metrics.stack_data_given_key(decode, "targets")
output_videos = video_metrics.stack_data_given_key(decode, "outputs")
input_videos = video_metrics.stack_data_given_key(decode, "inputs")
target_videos = np.asarray(target_videos, dtype=np.uint8)
output_videos = np.asarray(output_videos, dtype=np.uint8)
input_videos = np.asarray(input_videos, dtype=np.uint8)
summaries = convert_videos_to_summaries(
input_videos, output_videos, target_videos,
tag="decode_%d" % decode_ind, decode_hparams=hook_args.decode_hparams,
display_ground_truth=decode_ind == 0)
all_summaries.extend(summaries)
return all_summaries
|
[
"def",
"display_video_hooks",
"(",
"hook_args",
")",
":",
"predictions",
"=",
"hook_args",
".",
"predictions",
"max_outputs",
"=",
"hook_args",
".",
"decode_hparams",
".",
"max_display_outputs",
"max_decodes",
"=",
"hook_args",
".",
"decode_hparams",
".",
"max_display_decodes",
"with",
"tf",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
":",
"_",
",",
"best_decodes",
"=",
"video_metrics",
".",
"compute_video_metrics_from_predictions",
"(",
"predictions",
",",
"decode_hparams",
"=",
"hook_args",
".",
"decode_hparams",
")",
"all_summaries",
"=",
"[",
"]",
"# Displays decodes corresponding to the best/worst metric,",
"for",
"metric",
",",
"metric_decode_inds",
"in",
"best_decodes",
".",
"items",
"(",
")",
":",
"curr_metric_inds",
"=",
"metric_decode_inds",
"[",
":",
"max_outputs",
"]",
"best_inputs",
",",
"best_outputs",
",",
"best_targets",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"for",
"sample_ind",
",",
"decode_ind",
"in",
"enumerate",
"(",
"curr_metric_inds",
")",
":",
"curr_decode",
"=",
"predictions",
"[",
"decode_ind",
"]",
"[",
"sample_ind",
"]",
"best_inputs",
".",
"append",
"(",
"curr_decode",
"[",
"\"inputs\"",
"]",
")",
"best_outputs",
".",
"append",
"(",
"curr_decode",
"[",
"\"outputs\"",
"]",
")",
"best_targets",
".",
"append",
"(",
"curr_decode",
"[",
"\"targets\"",
"]",
")",
"best_inputs",
"=",
"np",
".",
"array",
"(",
"best_inputs",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"best_outputs",
"=",
"np",
".",
"array",
"(",
"best_outputs",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"best_targets",
"=",
"np",
".",
"array",
"(",
"best_targets",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"summaries",
"=",
"convert_videos_to_summaries",
"(",
"best_inputs",
",",
"best_outputs",
",",
"best_targets",
",",
"tag",
"=",
"metric",
",",
"decode_hparams",
"=",
"hook_args",
".",
"decode_hparams",
")",
"all_summaries",
".",
"extend",
"(",
"summaries",
")",
"# Display random decodes for ten conditioning frames.",
"for",
"decode_ind",
",",
"decode",
"in",
"enumerate",
"(",
"predictions",
"[",
":",
"max_decodes",
"]",
")",
":",
"target_videos",
"=",
"video_metrics",
".",
"stack_data_given_key",
"(",
"decode",
",",
"\"targets\"",
")",
"output_videos",
"=",
"video_metrics",
".",
"stack_data_given_key",
"(",
"decode",
",",
"\"outputs\"",
")",
"input_videos",
"=",
"video_metrics",
".",
"stack_data_given_key",
"(",
"decode",
",",
"\"inputs\"",
")",
"target_videos",
"=",
"np",
".",
"asarray",
"(",
"target_videos",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"output_videos",
"=",
"np",
".",
"asarray",
"(",
"output_videos",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"input_videos",
"=",
"np",
".",
"asarray",
"(",
"input_videos",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"summaries",
"=",
"convert_videos_to_summaries",
"(",
"input_videos",
",",
"output_videos",
",",
"target_videos",
",",
"tag",
"=",
"\"decode_%d\"",
"%",
"decode_ind",
",",
"decode_hparams",
"=",
"hook_args",
".",
"decode_hparams",
",",
"display_ground_truth",
"=",
"decode_ind",
"==",
"0",
")",
"all_summaries",
".",
"extend",
"(",
"summaries",
")",
"return",
"all_summaries"
] |
Hooks to display videos at decode time.
|
[
"Hooks",
"to",
"display",
"videos",
"at",
"decode",
"time",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L165-L206
|
train
|
Hooks to display videos at decode time.
|
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(5126 - 5015) + chr(0b10111 + 0o37) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010111 + 0o30) + chr(1149 - 1095) + chr(0b101000 + 0o17), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + chr(0b10111 + 0o34) + chr(644 - 589), 58298 - 58290), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100100 + 0o15) + '\065' + '\066', 42563 - 42555), ehT0Px3KOsy9('\060' + chr(111) + '\064' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2834 - 2723) + chr(49) + chr(0b101111 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(1743 - 1693) + chr(0b110001) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(4820 - 4709) + chr(0b110001) + chr(49) + chr(82 - 30), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(10516 - 10405) + chr(49) + chr(55) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\063' + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(7026 - 6915) + chr(0b110001) + '\065' + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\063' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(400 - 352) + chr(0b1011010 + 0o25) + chr(0b100 + 0o55) + chr(53) + chr(472 - 418), 8), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(2329 - 2218) + '\x34', 63387 - 63379), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(1631 - 1577) + chr(2311 - 2262), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(586 - 475) + chr(777 - 727) + '\061' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(364 - 316) + chr(0b10100 + 0o133) + '\062' + chr(0b110010) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + '\x32' + chr(0b100000 + 0o21) + '\x33', 10884 - 10876), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + '\x33' + '\062', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b100100 + 0o113) + chr(53) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11010 + 0o30) + '\x37' + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100101 + 0o12) + chr(2305 - 2253) + chr(48), 9443 - 9435), ehT0Px3KOsy9('\x30' + chr(7736 - 7625) + chr(51) + chr(49), 7822 - 7814), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(0b100110 + 0o15) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7509 - 7398) + chr(1234 - 1185) + '\x31' + chr(2200 - 2148), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(52) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11000 + 0o127) + chr(50) + chr(53) + '\x37', 0b1000), ehT0Px3KOsy9(chr(610 - 562) + chr(0b110101 + 0o72) + '\x33' + chr(1187 - 1138) + chr(328 - 278), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(50) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(2218 - 2170) + chr(5003 - 4892) + chr(0b11010 + 0o31) + '\x34' + chr(1503 - 1454), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10101 + 0o36) + chr(0b110110) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10111 + 0o34) + chr(0b110001) + chr(51), 0o10), ehT0Px3KOsy9(chr(986 - 938) + chr(0b1101111) + chr(0b1000 + 0o54) + chr(0b1000 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(693 - 645) + '\x6f' + '\064' + '\x32', 58371 - 58363), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + chr(50) + '\061', 60846 - 60838), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b0 + 0o62) + chr(0b110000 + 0o7) + chr(0b110111 + 0o0), 22543 - 22535), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110110) + '\063', 60670 - 60662), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11011 + 0o27) + '\065' + chr(906 - 856), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(52) + '\060', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1b'), '\x64' + chr(0b1100101) + chr(540 - 441) + chr(0b1011110 + 0o21) + chr(100) + chr(2712 - 2611))(chr(0b111010 + 0o73) + '\x74' + '\146' + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def bKmnoEgkMJnh(OqN47Dvl9DWy):
qIQi_VFCIFZL = OqN47Dvl9DWy.predictions
i7r136MIYrlH = OqN47Dvl9DWy.decode_hparams.max_display_outputs
r5aJ07kGZwNV = OqN47Dvl9DWy.decode_hparams.max_display_decodes
with xafqLlk3kkUe(IDJ2eXGCBCDu.Graph(), xafqLlk3kkUe(SXOLrMavuUCe(b'TD@\nDk\xe89\x14-'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(0b1010000 + 0o37) + chr(2706 - 2606) + '\145')(chr(0b11101 + 0o130) + chr(6651 - 6535) + chr(0b1100110) + chr(45) + chr(2023 - 1967)))():
(VNGQdHSFPrso, chwDc0_mEJQG) = ygpK2xak4TIM.compute_video_metrics_from_predictions(qIQi_VFCIFZL, decode_hparams=OqN47Dvl9DWy.decode_hparams)
iZHoCS1AMe0Q = []
for (UyTbk4dY9zDl, ygdB6tCL2C7c) in xafqLlk3kkUe(chwDc0_mEJQG, xafqLlk3kkUe(SXOLrMavuUCe(b"{Mi\x0bhW\xba\x05\x14\n'\xe2"), '\144' + chr(1062 - 961) + chr(99) + '\x6f' + chr(7804 - 7704) + chr(101))(chr(0b1001010 + 0o53) + '\x74' + chr(0b1100110) + chr(910 - 865) + chr(0b101001 + 0o17)))():
gvLHTl__udGp = ygdB6tCL2C7c[:i7r136MIYrlH]
(mYB7KV1ajYfb, fv5ZxK2cX2OP, NTpmRuFvcLGI) = ([], [], [])
for (ZE9icZxPMz9D, w5YVig6cIsEC) in YlkZvXL8qwsX(gvLHTl__udGp):
wAhphK9BtHTP = qIQi_VFCIFZL[w5YVig6cIsEC][ZE9icZxPMz9D]
xafqLlk3kkUe(mYB7KV1ajYfb, xafqLlk3kkUe(SXOLrMavuUCe(b'TGo\x0bOi'), chr(0b1100100) + chr(0b100010 + 0o103) + '\143' + chr(111) + '\144' + '\145')('\x75' + chr(116) + chr(10350 - 10248) + chr(45) + chr(0b111000)))(wAhphK9BtHTP[xafqLlk3kkUe(SXOLrMavuUCe(b'\\Yo\x1bU~'), chr(9765 - 9665) + chr(6582 - 6481) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(0b11011 + 0o112))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b10010 + 0o33) + '\x38')])
xafqLlk3kkUe(fv5ZxK2cX2OP, xafqLlk3kkUe(SXOLrMavuUCe(b'TGo\x0bOi'), chr(100) + '\x65' + '\x63' + chr(0b1100000 + 0o17) + '\x64' + chr(101))(chr(0b1101 + 0o150) + chr(0b1110100) + '\146' + chr(436 - 391) + chr(0b111000)))(wAhphK9BtHTP[xafqLlk3kkUe(SXOLrMavuUCe(b'ZBk\x1eTy\xfa'), '\144' + chr(0b1100101) + chr(7154 - 7055) + chr(0b1001001 + 0o46) + chr(0b1100100) + chr(927 - 826))('\x75' + '\164' + chr(0b101010 + 0o74) + chr(45) + '\070')])
xafqLlk3kkUe(NTpmRuFvcLGI, xafqLlk3kkUe(SXOLrMavuUCe(b'TGo\x0bOi'), '\144' + '\145' + chr(99) + chr(0b1101111) + '\x64' + '\x65')(chr(0b1010111 + 0o36) + '\164' + '\x66' + chr(0b101101) + chr(0b111000)))(wAhphK9BtHTP[xafqLlk3kkUe(SXOLrMavuUCe(b'AVm\tDy\xfa'), '\x64' + chr(101) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b111000 + 0o56) + chr(0b101101) + '\x38')])
mYB7KV1ajYfb = WqUC3KWvYVup.B0ePDhpqxN5n(mYB7KV1ajYfb, dtype=WqUC3KWvYVup.uint8)
fv5ZxK2cX2OP = WqUC3KWvYVup.B0ePDhpqxN5n(fv5ZxK2cX2OP, dtype=WqUC3KWvYVup.uint8)
NTpmRuFvcLGI = WqUC3KWvYVup.B0ePDhpqxN5n(NTpmRuFvcLGI, dtype=WqUC3KWvYVup.uint8)
Ss61w8pBYeZH = QIQSwMOUMdrg(mYB7KV1ajYfb, fv5ZxK2cX2OP, NTpmRuFvcLGI, tag=UyTbk4dY9zDl, decode_hparams=OqN47Dvl9DWy.decode_hparams)
xafqLlk3kkUe(iZHoCS1AMe0Q, xafqLlk3kkUe(SXOLrMavuUCe(b'POk\x0bOi'), chr(0b1100100) + '\x65' + chr(4622 - 4523) + chr(1911 - 1800) + chr(0b1010011 + 0o21) + chr(0b11111 + 0o106))(chr(13524 - 13407) + chr(6078 - 5962) + '\x66' + chr(45) + chr(0b101110 + 0o12)))(Ss61w8pBYeZH)
for (w5YVig6cIsEC, RSziqSuj39r9) in YlkZvXL8qwsX(qIQi_VFCIFZL[:r5aJ07kGZwNV]):
LaJ5xIopsph7 = ygpK2xak4TIM.stack_data_given_key(RSziqSuj39r9, xafqLlk3kkUe(SXOLrMavuUCe(b'AVm\tDy\xfa'), chr(1838 - 1738) + chr(101) + '\x63' + '\157' + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(116) + '\x66' + chr(0b100000 + 0o15) + chr(2170 - 2114)))
leCoNtSD7xVh = ygpK2xak4TIM.stack_data_given_key(RSziqSuj39r9, xafqLlk3kkUe(SXOLrMavuUCe(b'ZBk\x1eTy\xfa'), chr(7713 - 7613) + chr(101) + chr(0b1000001 + 0o42) + chr(10093 - 9982) + chr(0b110000 + 0o64) + '\x65')(chr(9225 - 9108) + chr(116) + chr(0b1100110) + chr(45) + chr(56)))
coYF7C2iRpEM = ygpK2xak4TIM.stack_data_given_key(RSziqSuj39r9, xafqLlk3kkUe(SXOLrMavuUCe(b'\\Yo\x1bU~'), chr(0b1100100) + chr(0b1011101 + 0o10) + chr(4134 - 4035) + chr(0b11110 + 0o121) + chr(5232 - 5132) + chr(101))(chr(117) + '\x74' + chr(0b1100110) + chr(0b101101) + '\x38'))
LaJ5xIopsph7 = WqUC3KWvYVup.asarray(LaJ5xIopsph7, dtype=WqUC3KWvYVup.uint8)
leCoNtSD7xVh = WqUC3KWvYVup.asarray(leCoNtSD7xVh, dtype=WqUC3KWvYVup.uint8)
coYF7C2iRpEM = WqUC3KWvYVup.asarray(coYF7C2iRpEM, dtype=WqUC3KWvYVup.uint8)
Ss61w8pBYeZH = QIQSwMOUMdrg(coYF7C2iRpEM, leCoNtSD7xVh, LaJ5xIopsph7, tag=xafqLlk3kkUe(SXOLrMavuUCe(b'QR|\x01Eh\xd6i\x1c'), chr(100) + chr(0b1100101) + chr(0b100111 + 0o74) + chr(0b110100 + 0o73) + '\144' + '\145')(chr(0b1001011 + 0o52) + '\x74' + '\146' + '\x2d' + chr(56)) % w5YVig6cIsEC, decode_hparams=OqN47Dvl9DWy.decode_hparams, display_ground_truth=w5YVig6cIsEC == ehT0Px3KOsy9('\x30' + chr(0b1011011 + 0o24) + chr(0b110000), 30651 - 30643))
xafqLlk3kkUe(iZHoCS1AMe0Q, xafqLlk3kkUe(SXOLrMavuUCe(b'POk\x0bOi'), chr(100) + chr(5328 - 5227) + '\x63' + chr(0b111100 + 0o63) + '\x64' + '\x65')('\165' + chr(116) + '\146' + '\055' + chr(0b1100 + 0o54)))(Ss61w8pBYeZH)
return iZHoCS1AMe0Q
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
summarize_video_metrics
|
def summarize_video_metrics(hook_args):
"""Computes video metrics summaries using the decoder output."""
problem_name = hook_args.problem.name
current_problem = hook_args.problem
hparams = hook_args.hparams
output_dirs = hook_args.output_dirs
predictions = hook_args.predictions
frame_shape = [
current_problem.frame_height, current_problem.frame_width,
current_problem.num_channels
]
metrics_graph = tf.Graph()
with metrics_graph.as_default():
if predictions:
metrics_results, _ = video_metrics.compute_video_metrics_from_predictions(
predictions, decode_hparams=hook_args.decode_hparams)
else:
metrics_results, _ = video_metrics.compute_video_metrics_from_png_files(
output_dirs, problem_name, hparams.video_num_target_frames,
frame_shape)
summary_values = []
for name, array in six.iteritems(metrics_results):
for ind, val in enumerate(array):
tag = "metric_{}/{}".format(name, ind)
summary_values.append(tf.Summary.Value(tag=tag, simple_value=val))
return summary_values
|
python
|
def summarize_video_metrics(hook_args):
"""Computes video metrics summaries using the decoder output."""
problem_name = hook_args.problem.name
current_problem = hook_args.problem
hparams = hook_args.hparams
output_dirs = hook_args.output_dirs
predictions = hook_args.predictions
frame_shape = [
current_problem.frame_height, current_problem.frame_width,
current_problem.num_channels
]
metrics_graph = tf.Graph()
with metrics_graph.as_default():
if predictions:
metrics_results, _ = video_metrics.compute_video_metrics_from_predictions(
predictions, decode_hparams=hook_args.decode_hparams)
else:
metrics_results, _ = video_metrics.compute_video_metrics_from_png_files(
output_dirs, problem_name, hparams.video_num_target_frames,
frame_shape)
summary_values = []
for name, array in six.iteritems(metrics_results):
for ind, val in enumerate(array):
tag = "metric_{}/{}".format(name, ind)
summary_values.append(tf.Summary.Value(tag=tag, simple_value=val))
return summary_values
|
[
"def",
"summarize_video_metrics",
"(",
"hook_args",
")",
":",
"problem_name",
"=",
"hook_args",
".",
"problem",
".",
"name",
"current_problem",
"=",
"hook_args",
".",
"problem",
"hparams",
"=",
"hook_args",
".",
"hparams",
"output_dirs",
"=",
"hook_args",
".",
"output_dirs",
"predictions",
"=",
"hook_args",
".",
"predictions",
"frame_shape",
"=",
"[",
"current_problem",
".",
"frame_height",
",",
"current_problem",
".",
"frame_width",
",",
"current_problem",
".",
"num_channels",
"]",
"metrics_graph",
"=",
"tf",
".",
"Graph",
"(",
")",
"with",
"metrics_graph",
".",
"as_default",
"(",
")",
":",
"if",
"predictions",
":",
"metrics_results",
",",
"_",
"=",
"video_metrics",
".",
"compute_video_metrics_from_predictions",
"(",
"predictions",
",",
"decode_hparams",
"=",
"hook_args",
".",
"decode_hparams",
")",
"else",
":",
"metrics_results",
",",
"_",
"=",
"video_metrics",
".",
"compute_video_metrics_from_png_files",
"(",
"output_dirs",
",",
"problem_name",
",",
"hparams",
".",
"video_num_target_frames",
",",
"frame_shape",
")",
"summary_values",
"=",
"[",
"]",
"for",
"name",
",",
"array",
"in",
"six",
".",
"iteritems",
"(",
"metrics_results",
")",
":",
"for",
"ind",
",",
"val",
"in",
"enumerate",
"(",
"array",
")",
":",
"tag",
"=",
"\"metric_{}/{}\"",
".",
"format",
"(",
"name",
",",
"ind",
")",
"summary_values",
".",
"append",
"(",
"tf",
".",
"Summary",
".",
"Value",
"(",
"tag",
"=",
"tag",
",",
"simple_value",
"=",
"val",
")",
")",
"return",
"summary_values"
] |
Computes video metrics summaries using the decoder output.
|
[
"Computes",
"video",
"metrics",
"summaries",
"using",
"the",
"decoder",
"output",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L209-L235
|
train
|
Computes video metrics summaries using the decoder output.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59w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AbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1001110 + 0o41) + chr(0b100010 + 0o21) + '\064' + '\060', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(256 - 206) + chr(1573 - 1525), 57572 - 57564), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + '\062' + chr(119 - 65) + chr(559 - 511), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + '\067' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + chr(0b110010) + '\064' + '\063', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\060' + chr(0b101100 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\065' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(4076 - 3965) + chr(0b1011 + 0o46) + chr(2464 - 2410) + chr(0b100100 + 0o22), 0o10), ehT0Px3KOsy9(chr(1259 - 1211) + chr(0b1011 + 0o144) + '\x32' + chr(0b101110 + 0o5) + chr(0b1001 + 0o50), 0o10), ehT0Px3KOsy9(chr(1240 - 1192) + chr(0b1101111) + chr(0b10101 + 0o36) + chr(2184 - 2133) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + '\x31' + chr(0b110000) + '\x37', 34411 - 34403), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(2099 - 2050) + '\x35' + chr(0b101011 + 0o6), 0b1000), ehT0Px3KOsy9(chr(1953 - 1905) + '\157' + '\x32' + chr(0b0 + 0o60) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1261 - 1210) + chr(48) + chr(51), 50471 - 50463), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32', 39131 - 39123), ehT0Px3KOsy9(chr(0b110000) + chr(0b10011 + 0o134) + '\065' + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011101 + 0o22) + chr(49) + chr(50), 34713 - 34705), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(51) + chr(1143 - 1092), 0o10), ehT0Px3KOsy9('\060' + chr(0b101010 + 0o105) + '\061' + chr(0b100101 + 0o17) + chr(0b110 + 0o60), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\x35' + chr(0b11001 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10383 - 10272) + '\061' + chr(49) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101011 + 0o4) + '\x31' + chr(837 - 785) + chr(1837 - 1783), 8), ehT0Px3KOsy9(chr(2240 - 2192) + '\x6f' + chr(0b110010) + chr(1480 - 1432) + chr(940 - 890), 22135 - 22127), ehT0Px3KOsy9(chr(121 - 73) + chr(111) + chr(0b110001 + 0o3) + '\x34', 40988 - 40980), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101001 + 0o12) + chr(52) + chr(48), 8), ehT0Px3KOsy9('\x30' + chr(0b1101010 + 0o5) + chr(51) + '\x31' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(886 - 838) + chr(0b11110 + 0o121) + '\061' + chr(50) + '\x31', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6946 - 6835) + chr(2225 - 2173) + chr(940 - 890), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(1188 - 1077) + chr(0b100100 + 0o23) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\065' + chr(0b110100 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b110110) + '\x33', 48907 - 48899), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(52) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(2877 - 2766) + '\x32' + chr(0b110101) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(48), 23824 - 23816), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + '\065' + chr(0b110110), 8), ehT0Px3KOsy9(chr(579 - 531) + chr(0b1100000 + 0o17) + '\x32' + chr(48) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(823 - 774) + chr(1976 - 1921) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(51) + chr(52), 19268 - 19260), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b10101 + 0o132) + '\061' + '\065' + chr(0b10 + 0o65), 0o10), ehT0Px3KOsy9('\x30' + chr(2374 - 2263) + chr(243 - 190) + '\x34', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(0b10011 + 0o35), 15094 - 15086)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xce'), chr(100) + chr(0b11011 + 0o112) + '\x63' + '\157' + chr(0b1010110 + 0o16) + chr(101))('\165' + chr(0b1000011 + 0o61) + '\x66' + '\055' + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def TjO2nDqc_6T7(OqN47Dvl9DWy):
wezGpYDorAsK = OqN47Dvl9DWy.problem.AIvJRzLdDfgF
Wpd2OV7PPj9i = OqN47Dvl9DWy.sO7e1A_Mor6Q
n4ljua2gi1Pr = OqN47Dvl9DWy.n4ljua2gi1Pr
Y_PWX8ooWmlm = OqN47Dvl9DWy.output_dirs
qIQi_VFCIFZL = OqN47Dvl9DWy.predictions
eut3NH0zeXzv = [Wpd2OV7PPj9i.frame_height, Wpd2OV7PPj9i.frame_width, Wpd2OV7PPj9i.X1ZpHSxyKbHn]
RSX32OUZxz4t = IDJ2eXGCBCDu.Graph()
with xafqLlk3kkUe(RSX32OUZxz4t, xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\xa3\xef\x1a\xc6"\x8f\x03\xf5\xab'), chr(9820 - 9720) + '\145' + '\x63' + chr(0b101000 + 0o107) + chr(0b100 + 0o140) + chr(6043 - 5942))(chr(117) + '\x74' + chr(0b1010101 + 0o21) + chr(0b111 + 0o46) + '\070'))():
if qIQi_VFCIFZL:
(zNNPMjpThJdN, VNGQdHSFPrso) = ygpK2xak4TIM.compute_video_metrics_from_predictions(qIQi_VFCIFZL, decode_hparams=OqN47Dvl9DWy.decode_hparams)
else:
(zNNPMjpThJdN, VNGQdHSFPrso) = ygpK2xak4TIM.compute_video_metrics_from_png_files(Y_PWX8ooWmlm, wezGpYDorAsK, n4ljua2gi1Pr.UxYiT0ZFW2SZ, eut3NH0zeXzv)
PMX4So8sl3Zb = []
for (AIvJRzLdDfgF, B0ePDhpqxN5n) in xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'\x89\xa4\xd5\x0c\xca0\x8b\x1b\xea'), '\144' + '\x65' + chr(0b11000 + 0o113) + chr(0b111100 + 0o63) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(9115 - 9013) + chr(45) + '\x38'))(zNNPMjpThJdN):
for (r3s_x88rHjuC, pQxH2D_k9sXQ) in YlkZvXL8qwsX(B0ePDhpqxN5n):
CPdEsc5O1sf7 = xafqLlk3kkUe(SXOLrMavuUCe(b"\x8d\xb5\xc4\x0c\xca'\xb1\r\xe4\xf0<\x14"), chr(100) + chr(101) + chr(0b1100011) + chr(0b111101 + 0o62) + '\x64' + chr(0b110001 + 0o64))(chr(0b1110101) + '\164' + '\x66' + '\055' + '\x38').V4roHaS3Ppej(AIvJRzLdDfgF, r3s_x88rHjuC)
xafqLlk3kkUe(PMX4So8sl3Zb, xafqLlk3kkUe(SXOLrMavuUCe(b'\x81\xa0\xc0\x1b\xcd '), chr(0b1100100) + '\145' + chr(7226 - 7127) + chr(111) + '\x64' + chr(0b100 + 0o141))(chr(0b1110010 + 0o3) + chr(0b1110100) + '\x66' + chr(844 - 799) + '\070'))(xafqLlk3kkUe(IDJ2eXGCBCDu.Summary, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6\xb1\xdc\x0b\xc6'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + chr(100) + chr(0b1100101))(chr(0b100101 + 0o120) + chr(0b1110100) + chr(5282 - 5180) + chr(45) + chr(2607 - 2551)))(tag=CPdEsc5O1sf7, simple_value=pQxH2D_k9sXQ))
return PMX4So8sl3Zb
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
debug_video_writer_factory
|
def debug_video_writer_factory(output_dir):
"""Creates a VideoWriter for debug videos."""
if FLAGS.disable_ffmpeg:
return common_video.IndividualFrameWriter(output_dir)
else:
output_path = os.path.join(output_dir, "video.avi")
return common_video.WholeVideoWriter(
fps=10, output_path=output_path, file_format="avi"
)
|
python
|
def debug_video_writer_factory(output_dir):
"""Creates a VideoWriter for debug videos."""
if FLAGS.disable_ffmpeg:
return common_video.IndividualFrameWriter(output_dir)
else:
output_path = os.path.join(output_dir, "video.avi")
return common_video.WholeVideoWriter(
fps=10, output_path=output_path, file_format="avi"
)
|
[
"def",
"debug_video_writer_factory",
"(",
"output_dir",
")",
":",
"if",
"FLAGS",
".",
"disable_ffmpeg",
":",
"return",
"common_video",
".",
"IndividualFrameWriter",
"(",
"output_dir",
")",
"else",
":",
"output_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"\"video.avi\"",
")",
"return",
"common_video",
".",
"WholeVideoWriter",
"(",
"fps",
"=",
"10",
",",
"output_path",
"=",
"output_path",
",",
"file_format",
"=",
"\"avi\"",
")"
] |
Creates a VideoWriter for debug videos.
|
[
"Creates",
"a",
"VideoWriter",
"for",
"debug",
"videos",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L238-L246
|
train
|
Creates a VideoWriter for debug videos.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwE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ipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2216 - 2167) + chr(2594 - 2543), 0b1000), ehT0Px3KOsy9('\x30' + chr(3935 - 3824) + chr(0b110100) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(1945 - 1891) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(1158 - 1047) + '\064' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2058 - 1947) + chr(847 - 798) + chr(0b110010) + chr(54), 61830 - 61822), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + '\062' + chr(54) + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(3868 - 3757) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(578 - 526) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(154 - 104) + chr(51) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101001 + 0o106) + chr(0b110010) + chr(49) + '\x30', 54036 - 54028), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(1768 - 1718), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(55) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(1072 - 1024) + chr(1875 - 1764) + chr(2974 - 2919), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11 + 0o60) + '\060' + '\x33', 37337 - 37329), ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(0b110001) + chr(0b101100 + 0o7) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + '\x32' + chr(1285 - 1230) + '\x32', 26686 - 26678), ehT0Px3KOsy9(chr(2020 - 1972) + chr(0b1001101 + 0o42) + chr(0b110000 + 0o3) + chr(0b101100 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\064' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(798 - 750) + '\x6f' + '\x33' + '\x33' + chr(50), 0o10), ehT0Px3KOsy9(chr(1231 - 1183) + chr(8983 - 8872) + '\x31' + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\064' + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(5512 - 5401) + chr(0b11 + 0o57) + '\x30' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(590 - 539) + '\062' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(0b110010) + chr(0b101110 + 0o7) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2245 - 2195) + chr(0b100100 + 0o23) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b101 + 0o152) + chr(50) + '\x31' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11001 + 0o30) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(51) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(9675 - 9564) + '\x33' + chr(2116 - 2067) + chr(0b1010 + 0o54), 36137 - 36129), ehT0Px3KOsy9(chr(1416 - 1368) + chr(0b111010 + 0o65) + '\x31' + chr(0b110011) + chr(404 - 355), 0o10), ehT0Px3KOsy9('\x30' + chr(0b10 + 0o155) + chr(0b1011 + 0o46) + chr(0b1000 + 0o57), 8), ehT0Px3KOsy9(chr(708 - 660) + chr(1369 - 1258) + chr(50) + chr(0b110011) + chr(1272 - 1223), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51), 51176 - 51168), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(3657 - 3546) + chr(0b110011) + chr(442 - 389) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110000) + chr(0b110100), 12062 - 12054), ehT0Px3KOsy9('\x30' + '\157' + chr(0b0 + 0o61) + '\x32' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(1832 - 1784) + chr(0b1101111) + chr(1775 - 1720) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1123 - 1068) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1772 - 1724) + chr(111) + chr(54) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(0b101 + 0o53) + chr(54), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1812 - 1764) + chr(0b1001011 + 0o44) + '\065' + chr(0b101001 + 0o7), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'%'), chr(0b11001 + 0o113) + chr(7792 - 7691) + chr(99) + '\157' + chr(9797 - 9697) + '\x65')(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b11101 + 0o20) + chr(0b100111 + 0o21)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def W32IvTPzk1z4(nd0OX_BS6_o4):
if xafqLlk3kkUe(vUTZFbqN0o8F, xafqLlk3kkUe(SXOLrMavuUCe(b'oL\x06@4\xdbc\xb9\xfd\xee\x7f\x0eb\xa4'), '\144' + chr(2182 - 2081) + '\143' + chr(4602 - 4491) + chr(0b1100100) + chr(101))('\165' + chr(116) + chr(7254 - 7152) + chr(0b100000 + 0o15) + chr(0b111000))):
return xafqLlk3kkUe(feDooRjkbHzt, xafqLlk3kkUe(SXOLrMavuUCe(b'BK\x11H \xdeb\x93\xfa\xe4T\x0cf\xae=\xedj\x0b\xaem\xd4'), chr(100) + chr(0b1100101) + '\x63' + '\x6f' + chr(100) + chr(0b1010011 + 0o22))(chr(0b1110101) + chr(6255 - 6139) + chr(0b1100110) + '\x2d' + chr(0b111000)))(nd0OX_BS6_o4)
else:
pybif4rGbt58 = oqhJDdMJfuwx.path.join(nd0OX_BS6_o4, xafqLlk3kkUe(SXOLrMavuUCe(b'}L\x11D9\x99g\x90\xf2'), '\x64' + chr(101) + chr(99) + '\157' + chr(100) + chr(0b1010011 + 0o22))('\165' + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(0b110011 + 0o5)))
return xafqLlk3kkUe(feDooRjkbHzt, xafqLlk3kkUe(SXOLrMavuUCe(b'\\M\x1aM3\xe1o\x82\xfe\xe7E\x0cn\xb7=\xc8'), '\x64' + chr(0b1100101) + '\143' + chr(7506 - 7395) + '\x64' + '\145')(chr(0b1110101) + chr(2273 - 2157) + chr(0b1001110 + 0o30) + '\055' + chr(1293 - 1237)))(fps=ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1347 - 1298) + '\062', 63565 - 63557), output_path=pybif4rGbt58, file_format=xafqLlk3kkUe(SXOLrMavuUCe(b'jS\x1c'), '\144' + chr(101) + '\x63' + chr(6657 - 6546) + chr(0b0 + 0o144) + chr(0b1100101))(chr(117) + chr(0b1101010 + 0o12) + chr(102) + chr(45) + chr(0b110010 + 0o6)))
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
VideoProblem.preprocess_example
|
def preprocess_example(self, example, mode, hparams):
"""Runtime preprocessing, e.g., resize example["frame"]."""
if getattr(hparams, "preprocess_resize_frames", None) is not None:
example["frame"] = tf.image.resize_images(
example["frame"], hparams.preprocess_resize_frames,
tf.image.ResizeMethod.BILINEAR)
return example
|
python
|
def preprocess_example(self, example, mode, hparams):
"""Runtime preprocessing, e.g., resize example["frame"]."""
if getattr(hparams, "preprocess_resize_frames", None) is not None:
example["frame"] = tf.image.resize_images(
example["frame"], hparams.preprocess_resize_frames,
tf.image.ResizeMethod.BILINEAR)
return example
|
[
"def",
"preprocess_example",
"(",
"self",
",",
"example",
",",
"mode",
",",
"hparams",
")",
":",
"if",
"getattr",
"(",
"hparams",
",",
"\"preprocess_resize_frames\"",
",",
"None",
")",
"is",
"not",
"None",
":",
"example",
"[",
"\"frame\"",
"]",
"=",
"tf",
".",
"image",
".",
"resize_images",
"(",
"example",
"[",
"\"frame\"",
"]",
",",
"hparams",
".",
"preprocess_resize_frames",
",",
"tf",
".",
"image",
".",
"ResizeMethod",
".",
"BILINEAR",
")",
"return",
"example"
] |
Runtime preprocessing, e.g., resize example["frame"].
|
[
"Runtime",
"preprocessing",
"e",
".",
"g",
".",
"resize",
"example",
"[",
"frame",
"]",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L346-L352
|
train
|
Runtime preprocessing e. g. resize example. frame.
|
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,pz9Flfzs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2Z,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(0b11011 + 0o25) + chr(111) + '\x34' + chr(0b11001 + 0o27), 0b1000), ehT0Px3KOsy9(chr(2240 - 2192) + chr(0b1101111) + '\x36' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(11613 - 11502) + '\x33' + chr(0b110010) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(0b110000 + 0o2) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(8137 - 8026) + '\x31' + chr(50), 53805 - 53797), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(52) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(51) + chr(0b101010 + 0o15), 45037 - 45029), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b1000 + 0o55) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(8345 - 8234) + chr(0b110001), 60290 - 60282), ehT0Px3KOsy9(chr(0b110000) + chr(0b11011 + 0o124) + chr(431 - 378) + chr(0b11110 + 0o30), 0o10), ehT0Px3KOsy9(chr(340 - 292) + chr(4646 - 4535) + chr(50) + chr(51) + '\x30', 34547 - 34539), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\067' + chr(1672 - 1622), 0o10), ehT0Px3KOsy9('\x30' + chr(3092 - 2981) + chr(50) + chr(55) + chr(280 - 232), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(53) + chr(0b101001 + 0o11), 34464 - 34456), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\060' + chr(910 - 856), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(247 - 193) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1252 - 1204) + '\157' + chr(0b110010) + '\061' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(54) + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(0b101111 + 0o100) + '\062' + chr(0b110110) + chr(48), 0o10), ehT0Px3KOsy9(chr(1913 - 1865) + '\157' + chr(0b101110 + 0o4) + chr(0b101100 + 0o6) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b100010 + 0o115) + chr(50) + chr(0b110110) + chr(0b10011 + 0o44), 41166 - 41158), ehT0Px3KOsy9(chr(744 - 696) + chr(111) + '\062' + chr(1287 - 1238), 0b1000), ehT0Px3KOsy9('\060' + chr(2757 - 2646) + '\061' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(712 - 664) + chr(4348 - 4237) + chr(0b110010) + '\063' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(51) + chr(0b100110 + 0o14), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(48) + chr(0b110110), 59261 - 59253), ehT0Px3KOsy9(chr(1909 - 1861) + chr(0b1100100 + 0o13) + chr(49) + chr(0b110101) + chr(2251 - 2200), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1010010 + 0o35) + chr(0b11100 + 0o26) + chr(0b1000 + 0o50) + chr(49), 40692 - 40684), ehT0Px3KOsy9(chr(0b110000) + chr(3782 - 3671) + chr(0b110011) + chr(2474 - 2421) + chr(385 - 336), 62649 - 62641), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(0b10101 + 0o35) + chr(0b110101 + 0o0) + '\x34', 6573 - 6565), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1100 + 0o143) + chr(55) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1781 - 1733) + '\x6f' + chr(0b100 + 0o57) + chr(0b110000) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(6338 - 6227) + chr(0b110001) + chr(0b110001) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2020 - 1966) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1246 - 1198) + '\x6f' + chr(51) + chr(0b110110) + chr(289 - 236), 0o10), ehT0Px3KOsy9(chr(2206 - 2158) + '\157' + chr(0b110010) + chr(51) + chr(0b11111 + 0o27), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b101100 + 0o5), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1100 + 0o47) + chr(0b110100) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(4327 - 4216) + '\065' + chr(0b110110), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(53) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e'), chr(100) + chr(2395 - 2294) + '\x63' + chr(0b1101101 + 0o2) + chr(4120 - 4020) + '\x65')(chr(0b1100100 + 0o21) + chr(116) + chr(0b1100110) + chr(779 - 734) + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def B9yu2Wxtqy36(oVre8I6UXc3b, kP4qaKv0ZkGv, holLFgwB7vsP, n4ljua2gi1Pr):
if xafqLlk3kkUe(n4ljua2gi1Pr, xafqLlk3kkUe(SXOLrMavuUCe(b'PE\xb0\xa4x\x8c\xbc\rr]\xc7\xc8\xddY/\xcf\xebj\xd6\xe1\xd6|h\xee'), '\144' + '\145' + '\x63' + '\157' + chr(100) + '\x65')('\x75' + chr(0b1110100) + chr(102) + chr(419 - 374) + chr(56)), None) is not None:
kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'FE\xb4\xb9o'), chr(0b100011 + 0o101) + '\x65' + chr(99) + chr(0b1101111) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b101000 + 0o114) + chr(0b1011011 + 0o13) + '\x2d' + chr(0b1 + 0o67))] = IDJ2eXGCBCDu.image.resize_images(kP4qaKv0ZkGv[xafqLlk3kkUe(SXOLrMavuUCe(b'FE\xb4\xb9o'), chr(0b1100100) + chr(101) + chr(0b111000 + 0o53) + chr(0b1101111 + 0o0) + '\144' + chr(101))('\x75' + chr(0b1110100) + '\146' + '\x2d' + '\x38')], n4ljua2gi1Pr.preprocess_resize_frames, IDJ2eXGCBCDu.image.ResizeMethod.BILINEAR)
return kP4qaKv0ZkGv
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
VideoProblem.serving_input_fn
|
def serving_input_fn(self, hparams):
"""For serving/predict, assume that only video frames are provided."""
video_input_frames = tf.placeholder(
dtype=tf.float32,
shape=[
None, hparams.video_num_input_frames, self.frame_width,
self.frame_height, self.num_channels
])
# TODO(michalski): add support for passing input_action and input_reward.
return tf.estimator.export.ServingInputReceiver(
features={"inputs": video_input_frames},
receiver_tensors=video_input_frames)
|
python
|
def serving_input_fn(self, hparams):
"""For serving/predict, assume that only video frames are provided."""
video_input_frames = tf.placeholder(
dtype=tf.float32,
shape=[
None, hparams.video_num_input_frames, self.frame_width,
self.frame_height, self.num_channels
])
# TODO(michalski): add support for passing input_action and input_reward.
return tf.estimator.export.ServingInputReceiver(
features={"inputs": video_input_frames},
receiver_tensors=video_input_frames)
|
[
"def",
"serving_input_fn",
"(",
"self",
",",
"hparams",
")",
":",
"video_input_frames",
"=",
"tf",
".",
"placeholder",
"(",
"dtype",
"=",
"tf",
".",
"float32",
",",
"shape",
"=",
"[",
"None",
",",
"hparams",
".",
"video_num_input_frames",
",",
"self",
".",
"frame_width",
",",
"self",
".",
"frame_height",
",",
"self",
".",
"num_channels",
"]",
")",
"# TODO(michalski): add support for passing input_action and input_reward.",
"return",
"tf",
".",
"estimator",
".",
"export",
".",
"ServingInputReceiver",
"(",
"features",
"=",
"{",
"\"inputs\"",
":",
"video_input_frames",
"}",
",",
"receiver_tensors",
"=",
"video_input_frames",
")"
] |
For serving/predict, assume that only video frames are provided.
|
[
"For",
"serving",
"/",
"predict",
"assume",
"that",
"only",
"video",
"frames",
"are",
"provided",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L397-L409
|
train
|
For serving and predict.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u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c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(54) + chr(1654 - 1606), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(0b110111) + chr(0b110011 + 0o0), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + '\x31' + '\060' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11024 - 10913) + chr(49) + chr(0b110100) + chr(0b0 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b101100 + 0o6) + chr(508 - 460), 0b1000), ehT0Px3KOsy9('\x30' + chr(11172 - 11061) + chr(955 - 904) + chr(0b1110 + 0o44) + chr(2481 - 2428), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(0b100 + 0o55) + chr(50) + chr(2631 - 2576), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010101 + 0o32) + chr(0b100110 + 0o14) + '\x36' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(1712 - 1661) + chr(0b100100 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(432 - 379) + chr(0b1110 + 0o50), 0b1000), ehT0Px3KOsy9('\060' + chr(481 - 370) + '\062' + '\065' + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + chr(0b1001 + 0o56) + chr(0b110001), 54812 - 54804), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\x37' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(8867 - 8756) + chr(49) + '\x32' + '\066', 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + chr(2234 - 2185) + chr(50) + chr(0b101010 + 0o15), 8), ehT0Px3KOsy9('\060' + chr(5082 - 4971) + chr(0b101 + 0o54) + chr(0b1111 + 0o44), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\064' + chr(0b100 + 0o62), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(2247 - 2199) + chr(111) + chr(49) + '\x34' + '\x37', 48942 - 48934), ehT0Px3KOsy9(chr(1293 - 1245) + chr(0b1101111) + '\x32' + '\063' + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(267 - 217) + chr(0b110011 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\064' + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b11111 + 0o27) + chr(168 - 115), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(535 - 483), 0o10), ehT0Px3KOsy9(chr(1839 - 1791) + chr(111) + '\x33' + '\x35' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10863 - 10752) + '\x36' + '\066', 50907 - 50899), ehT0Px3KOsy9(chr(2190 - 2142) + '\x6f' + '\062' + '\x30' + chr(0b10 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(2875 - 2764) + chr(720 - 670) + chr(50) + chr(1654 - 1605), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(8443 - 8332) + chr(0b1000 + 0o53) + '\063' + '\x32', 62815 - 62807), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(53) + chr(0b110110), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + '\064', 56792 - 56784), ehT0Px3KOsy9(chr(0b110000) + chr(3602 - 3491) + chr(50) + chr(49) + chr(1879 - 1827), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110000 + 0o1) + '\064' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(2093 - 2042) + '\065' + chr(639 - 584), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(1886 - 1834) + chr(0b100100 + 0o15), 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(11979 - 11868) + chr(49) + chr(0b100 + 0o57) + '\064', 5898 - 5890), ehT0Px3KOsy9(chr(48) + chr(941 - 830) + chr(0b11001 + 0o32) + chr(680 - 632) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110110 + 0o71) + chr(0b101110 + 0o3) + chr(0b110111) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101111 + 0o2) + '\x32' + chr(0b10 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b100 + 0o61) + chr(54), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(82 - 34) + chr(0b110 + 0o151) + '\065' + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e'), chr(9776 - 9676) + chr(0b1011100 + 0o11) + chr(0b1100011) + chr(5511 - 5400) + chr(100) + chr(0b1100101))(chr(0b1111 + 0o146) + chr(0b1101011 + 0o11) + chr(0b1100110) + '\x2d' + chr(1387 - 1331)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def ghrSKrw_4z3G(oVre8I6UXc3b, n4ljua2gi1Pr):
kXnvFyrVJdQq = IDJ2eXGCBCDu.placeholder(dtype=IDJ2eXGCBCDu.float32, shape=[None, n4ljua2gi1Pr.UUXW9NWPZxPI, oVre8I6UXc3b.frame_width, oVre8I6UXc3b.frame_height, oVre8I6UXc3b.X1ZpHSxyKbHn])
return xafqLlk3kkUe(IDJ2eXGCBCDu.estimator.export, xafqLlk3kkUe(SXOLrMavuUCe(b'c\x1e2\x14\xf9\xbb0\xf9\xf4\xde\xdfM\xa934nOa\x02\xec'), '\144' + chr(101) + chr(1044 - 945) + chr(111) + chr(100) + chr(0b1100101))('\165' + chr(116) + chr(7660 - 7558) + chr(45) + chr(961 - 905)))(features={xafqLlk3kkUe(SXOLrMavuUCe(b'Y\x150\x17\xe4\xa6'), chr(100) + chr(101) + chr(0b101010 + 0o71) + chr(0b110011 + 0o74) + '\144' + chr(101))(chr(117) + chr(116) + '\x66' + chr(45) + chr(56)): kXnvFyrVJdQq}, receiver_tensors=kXnvFyrVJdQq)
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
VideoProblem.generate_encoded_samples
|
def generate_encoded_samples(self, data_dir, tmp_dir, dataset_split):
"""Generate samples of the encoded frames with possible extra data.
By default this function just encodes the numpy array returned as "frame"
from `self.generate_samples` into a PNG image. Override this function to
get other encodings on disk.
Args:
data_dir: final data directory. Typically only used in this method to copy
over user-supplied vocab files if there are extra fields needing them.
tmp_dir: temporary directory that you can use for downloading and scratch.
dataset_split: problem.DatasetSplit, which data split to generate samples
for (for example, training and evaluation).
Yields:
Sample: dict<str feature_name, feature value> which is in disk encoding.
Raises:
ValueError: if the frame has a different number of channels than required.
"""
writer = None
with tf.Graph().as_default():
image_t = tf.placeholder(dtype=tf.uint8, shape=(None, None, None))
encoded_image_t = tf.image.encode_png(image_t)
with tf.Session() as sess:
for features in self.generate_samples(data_dir, tmp_dir, dataset_split):
unencoded_frame = features.pop("frame")
self.validate_frame(unencoded_frame)
height, width, _ = unencoded_frame.shape
encoded_frame = sess.run(
encoded_image_t, feed_dict={image_t: unencoded_frame})
features["image/encoded"] = [encoded_frame]
features["image/format"] = ["png"]
features["image/height"] = [height]
features["image/width"] = [width]
has_debug_image = "image/debug" in features
if has_debug_image:
unencoded_debug = features.pop("image/debug")
encoded_debug = sess.run(
encoded_image_t, feed_dict={image_t: unencoded_debug})
features["image/encoded_debug"] = [encoded_debug]
if self.debug_dump_frames_path:
# Defer creating debug writer until we know debug_dump_frames_path.
if writer is None:
if not tf.gfile.Exists(self.debug_dump_frames_path):
tf.gfile.MkDir(self.debug_dump_frames_path)
writer = debug_video_writer_factory(self.debug_dump_frames_path)
img = unencoded_debug if has_debug_image else unencoded_frame
encoded_img = encoded_debug if has_debug_image else encoded_frame
writer.write(img, encoded_img)
yield features
if self.debug_dump_frames_path:
writer.finish_to_disk()
|
python
|
def generate_encoded_samples(self, data_dir, tmp_dir, dataset_split):
"""Generate samples of the encoded frames with possible extra data.
By default this function just encodes the numpy array returned as "frame"
from `self.generate_samples` into a PNG image. Override this function to
get other encodings on disk.
Args:
data_dir: final data directory. Typically only used in this method to copy
over user-supplied vocab files if there are extra fields needing them.
tmp_dir: temporary directory that you can use for downloading and scratch.
dataset_split: problem.DatasetSplit, which data split to generate samples
for (for example, training and evaluation).
Yields:
Sample: dict<str feature_name, feature value> which is in disk encoding.
Raises:
ValueError: if the frame has a different number of channels than required.
"""
writer = None
with tf.Graph().as_default():
image_t = tf.placeholder(dtype=tf.uint8, shape=(None, None, None))
encoded_image_t = tf.image.encode_png(image_t)
with tf.Session() as sess:
for features in self.generate_samples(data_dir, tmp_dir, dataset_split):
unencoded_frame = features.pop("frame")
self.validate_frame(unencoded_frame)
height, width, _ = unencoded_frame.shape
encoded_frame = sess.run(
encoded_image_t, feed_dict={image_t: unencoded_frame})
features["image/encoded"] = [encoded_frame]
features["image/format"] = ["png"]
features["image/height"] = [height]
features["image/width"] = [width]
has_debug_image = "image/debug" in features
if has_debug_image:
unencoded_debug = features.pop("image/debug")
encoded_debug = sess.run(
encoded_image_t, feed_dict={image_t: unencoded_debug})
features["image/encoded_debug"] = [encoded_debug]
if self.debug_dump_frames_path:
# Defer creating debug writer until we know debug_dump_frames_path.
if writer is None:
if not tf.gfile.Exists(self.debug_dump_frames_path):
tf.gfile.MkDir(self.debug_dump_frames_path)
writer = debug_video_writer_factory(self.debug_dump_frames_path)
img = unencoded_debug if has_debug_image else unencoded_frame
encoded_img = encoded_debug if has_debug_image else encoded_frame
writer.write(img, encoded_img)
yield features
if self.debug_dump_frames_path:
writer.finish_to_disk()
|
[
"def",
"generate_encoded_samples",
"(",
"self",
",",
"data_dir",
",",
"tmp_dir",
",",
"dataset_split",
")",
":",
"writer",
"=",
"None",
"with",
"tf",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
":",
"image_t",
"=",
"tf",
".",
"placeholder",
"(",
"dtype",
"=",
"tf",
".",
"uint8",
",",
"shape",
"=",
"(",
"None",
",",
"None",
",",
"None",
")",
")",
"encoded_image_t",
"=",
"tf",
".",
"image",
".",
"encode_png",
"(",
"image_t",
")",
"with",
"tf",
".",
"Session",
"(",
")",
"as",
"sess",
":",
"for",
"features",
"in",
"self",
".",
"generate_samples",
"(",
"data_dir",
",",
"tmp_dir",
",",
"dataset_split",
")",
":",
"unencoded_frame",
"=",
"features",
".",
"pop",
"(",
"\"frame\"",
")",
"self",
".",
"validate_frame",
"(",
"unencoded_frame",
")",
"height",
",",
"width",
",",
"_",
"=",
"unencoded_frame",
".",
"shape",
"encoded_frame",
"=",
"sess",
".",
"run",
"(",
"encoded_image_t",
",",
"feed_dict",
"=",
"{",
"image_t",
":",
"unencoded_frame",
"}",
")",
"features",
"[",
"\"image/encoded\"",
"]",
"=",
"[",
"encoded_frame",
"]",
"features",
"[",
"\"image/format\"",
"]",
"=",
"[",
"\"png\"",
"]",
"features",
"[",
"\"image/height\"",
"]",
"=",
"[",
"height",
"]",
"features",
"[",
"\"image/width\"",
"]",
"=",
"[",
"width",
"]",
"has_debug_image",
"=",
"\"image/debug\"",
"in",
"features",
"if",
"has_debug_image",
":",
"unencoded_debug",
"=",
"features",
".",
"pop",
"(",
"\"image/debug\"",
")",
"encoded_debug",
"=",
"sess",
".",
"run",
"(",
"encoded_image_t",
",",
"feed_dict",
"=",
"{",
"image_t",
":",
"unencoded_debug",
"}",
")",
"features",
"[",
"\"image/encoded_debug\"",
"]",
"=",
"[",
"encoded_debug",
"]",
"if",
"self",
".",
"debug_dump_frames_path",
":",
"# Defer creating debug writer until we know debug_dump_frames_path.",
"if",
"writer",
"is",
"None",
":",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"self",
".",
"debug_dump_frames_path",
")",
":",
"tf",
".",
"gfile",
".",
"MkDir",
"(",
"self",
".",
"debug_dump_frames_path",
")",
"writer",
"=",
"debug_video_writer_factory",
"(",
"self",
".",
"debug_dump_frames_path",
")",
"img",
"=",
"unencoded_debug",
"if",
"has_debug_image",
"else",
"unencoded_frame",
"encoded_img",
"=",
"encoded_debug",
"if",
"has_debug_image",
"else",
"encoded_frame",
"writer",
".",
"write",
"(",
"img",
",",
"encoded_img",
")",
"yield",
"features",
"if",
"self",
".",
"debug_dump_frames_path",
":",
"writer",
".",
"finish_to_disk",
"(",
")"
] |
Generate samples of the encoded frames with possible extra data.
By default this function just encodes the numpy array returned as "frame"
from `self.generate_samples` into a PNG image. Override this function to
get other encodings on disk.
Args:
data_dir: final data directory. Typically only used in this method to copy
over user-supplied vocab files if there are extra fields needing them.
tmp_dir: temporary directory that you can use for downloading and scratch.
dataset_split: problem.DatasetSplit, which data split to generate samples
for (for example, training and evaluation).
Yields:
Sample: dict<str feature_name, feature value> which is in disk encoding.
Raises:
ValueError: if the frame has a different number of channels than required.
|
[
"Generate",
"samples",
"of",
"the",
"encoded",
"frames",
"with",
"possible",
"extra",
"data",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L573-L630
|
train
|
Generates the encoded samples of the unencoded frames.
|
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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OC7R_,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(0b110010) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(53), 46415 - 46407), ehT0Px3KOsy9('\060' + chr(3443 - 3332) + chr(0b110001) + chr(52) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(1491 - 1441) + chr(0b100000 + 0o20) + chr(0b100001 + 0o24), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + '\061' + chr(1747 - 1692) + chr(0b110010), 53096 - 53088), ehT0Px3KOsy9(chr(0b110000) + chr(0b100101 + 0o112) + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + chr(0b110010) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x34' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100111 + 0o14) + chr(2657 - 2603) + chr(0b110010 + 0o1), 46672 - 46664), ehT0Px3KOsy9(chr(1437 - 1389) + chr(0b1101111) + '\063' + '\062' + '\064', 0b1000), ehT0Px3KOsy9('\060' + chr(7798 - 7687) + chr(2018 - 1967) + chr(52) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(10109 - 9998) + chr(54) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(0b110100) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1010011 + 0o34) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110111) + '\x34', 0o10), ehT0Px3KOsy9(chr(167 - 119) + chr(111) + chr(50) + '\067' + chr(0b100110 + 0o16), 8), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(49) + chr(0b110000) + '\x37', 0b1000), ehT0Px3KOsy9(chr(2281 - 2233) + chr(7759 - 7648) + '\066' + chr(2041 - 1990), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8047 - 7936) + chr(50) + '\061' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1482 - 1434) + '\157' + '\063' + chr(903 - 851) + chr(0b110100), 56287 - 56279), ehT0Px3KOsy9(chr(2248 - 2200) + chr(0b101010 + 0o105) + '\063' + chr(51) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b1100 + 0o52) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b10000 + 0o137) + '\061' + chr(0b110011) + '\061', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x35' + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(6157 - 6046) + chr(1199 - 1147) + chr(753 - 699), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100011 + 0o23) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11110 + 0o25) + '\x36' + chr(0b1101 + 0o43), 49880 - 49872), ehT0Px3KOsy9('\x30' + chr(3518 - 3407) + chr(0b110011) + chr(2375 - 2326) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + '\067' + '\064', 47773 - 47765), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(51) + chr(1036 - 986), 0o10), ehT0Px3KOsy9(chr(822 - 774) + chr(0b1101111) + '\061' + '\x33' + chr(1729 - 1680), 8), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101 + 0o142) + '\x33' + '\x31' + chr(0b101001 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b101000 + 0o107) + chr(50) + chr(323 - 271) + chr(2215 - 2166), 18092 - 18084), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(11248 - 11137) + chr(0b110010) + '\065' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11192 - 11081) + chr(50) + chr(0b110101) + chr(0b1011 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(10731 - 10620) + chr(0b100000 + 0o21) + chr(48) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\066' + chr(0b10001 + 0o44), 0b1000), ehT0Px3KOsy9(chr(1637 - 1589) + chr(111) + '\061' + chr(0b110101) + chr(0b100001 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(12321 - 12210) + chr(211 - 161) + '\064' + chr(0b0 + 0o65), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(179 - 68) + chr(962 - 913) + chr(0b110 + 0o54) + chr(0b100001 + 0o20), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + '\065' + chr(0b101011 + 0o5), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'9'), '\x64' + chr(101) + chr(0b1100011) + '\157' + chr(0b1000001 + 0o43) + chr(101))('\165' + chr(0b1011001 + 0o33) + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def JOzOlqoUuHH5(oVre8I6UXc3b, kVFRD544hi_1, JsZ36NJUqtml, XqbfPmad1kJ4):
AkL2ZqopDgiR = None
with xafqLlk3kkUe(IDJ2eXGCBCDu.Graph(), xafqLlk3kkUe(SXOLrMavuUCe(b'vn=\xe1\x1fcs\x95\x9f\xa0'), '\144' + '\x65' + '\143' + chr(111) + '\x64' + chr(0b100111 + 0o76))(chr(0b1001100 + 0o51) + chr(0b1010 + 0o152) + chr(8075 - 7973) + chr(0b101101) + chr(56)))():
xVQVmAlS4mxw = IDJ2eXGCBCDu.placeholder(dtype=IDJ2eXGCBCDu.uint8, shape=(None, None, None))
c37xnNyksrMO = IDJ2eXGCBCDu.image.encode_png(xVQVmAlS4mxw)
with xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'Dx\x11\xf6\x13j|'), chr(100) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + '\x64' + '\145')('\x75' + chr(0b1110100) + chr(0b11101 + 0o111) + chr(0b10011 + 0o32) + chr(0b101111 + 0o11)))() as HVWCHjSQ2I35:
for EEf4r9nUvta_ in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'px\x0c\xe0\x08df\x85\xac\xa7\x86[Qm\xd9\xcf'), '\144' + chr(5518 - 5417) + '\143' + chr(0b1101111) + chr(100) + chr(5301 - 5200))(chr(0b1011 + 0o152) + chr(0b110110 + 0o76) + chr(102) + chr(0b111 + 0o46) + chr(0b111000)))(kVFRD544hi_1, JsZ36NJUqtml, XqbfPmad1kJ4):
UwjwLYYAL6o4 = EEf4r9nUvta_.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'qo\x03\xe8\x1f'), '\144' + '\x65' + '\x63' + chr(4672 - 4561) + chr(0b111100 + 0o50) + chr(101))(chr(0b1110101) + chr(116) + chr(2407 - 2305) + chr(0b100000 + 0o15) + chr(56)))
xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'a|\x0e\xec\x1edf\x85\xac\xb2\x95WLd'), chr(7156 - 7056) + chr(101) + '\x63' + chr(111) + '\144' + chr(7127 - 7026))(chr(0b1110101) + chr(116) + '\146' + chr(0b11000 + 0o25) + chr(3135 - 3079)))(UwjwLYYAL6o4)
(ehbUULKuygfC, mPx09rBTrGXR, VNGQdHSFPrso) = UwjwLYYAL6o4.nauYfLglTpcb
DXtx2Xs7bZm6 = HVWCHjSQ2I35.sgt5BU61bwZ2(c37xnNyksrMO, feed_dict={xVQVmAlS4mxw: UwjwLYYAL6o4})
EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*w\x8e\x90\xbb\x83SE'), chr(100) + '\x65' + chr(0b1100011) + chr(9332 - 9221) + chr(0b101101 + 0o67) + '\145')(chr(0b101110 + 0o107) + chr(0b1011010 + 0o32) + '\146' + '\x2d' + chr(1839 - 1783))] = [DXtx2Xs7bZm6]
EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*t\x8f\x81\xb9\x86B'), chr(100) + chr(0b1100101) + '\x63' + '\x6f' + chr(0b1001011 + 0o31) + chr(8514 - 8413))(chr(0b1001100 + 0o51) + chr(0b1110100) + chr(102) + chr(76 - 31) + chr(2331 - 2275))] = [xafqLlk3kkUe(SXOLrMavuUCe(b'gs\x05'), chr(100) + chr(8746 - 8645) + '\143' + '\157' + '\144' + chr(0b1100101))(chr(117) + chr(1735 - 1619) + '\x66' + chr(0b101101) + '\070')]
EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*z\x85\x9a\xb3\x8fB'), chr(0b1100100) + '\x65' + chr(4439 - 4340) + chr(8284 - 8173) + chr(0b1100100) + chr(101))('\165' + '\x74' + chr(102) + chr(0b101010 + 0o3) + chr(0b111000))] = [ehbUULKuygfC]
EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*e\x89\x97\xa0\x8f'), '\144' + chr(0b11001 + 0o114) + chr(3353 - 3254) + chr(6745 - 6634) + chr(6683 - 6583) + '\145')(chr(117) + chr(0b1110100) + '\x66' + '\055' + chr(56))] = [mPx09rBTrGXR]
wIHiNvqiZToC = xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*v\x85\x91\xa1\x80'), '\x64' + '\x65' + chr(0b1100011) + '\157' + chr(0b1100100) + '\145')(chr(0b1011111 + 0o26) + chr(116) + '\146' + chr(0b101101) + chr(0b111000)) in EEf4r9nUvta_
if wIHiNvqiZToC:
wILrY5y2hGu2 = EEf4r9nUvta_.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*v\x85\x91\xa1\x80'), chr(0b1100100) + chr(0b1100101) + chr(0b101100 + 0o67) + '\157' + chr(0b1000011 + 0o41) + '\145')(chr(0b1101010 + 0o13) + chr(116) + '\x66' + chr(1695 - 1650) + chr(289 - 233)))
bcW0viluRrWZ = HVWCHjSQ2I35.sgt5BU61bwZ2(c37xnNyksrMO, feed_dict={xVQVmAlS4mxw: wILrY5y2hGu2})
EEf4r9nUvta_[xafqLlk3kkUe(SXOLrMavuUCe(b'~p\x03\xe2\x1f*w\x8e\x90\xbb\x83SE^\xd8\xd9%F\xec'), '\x64' + chr(0b110111 + 0o56) + chr(0b101000 + 0o73) + chr(111) + chr(3259 - 3159) + chr(0b11000 + 0o115))('\x75' + '\x74' + '\x66' + '\x2d' + '\070')] = [bcW0viluRrWZ]
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'sx\x00\xf0\x1dZv\x95\x9e\xa4\xb8PS`\xd1\xd94l\xfb\x85\xaa\x9a'), '\x64' + chr(0b1100101) + chr(99) + '\157' + '\x64' + '\x65')(chr(0b1010 + 0o153) + chr(116) + chr(7621 - 7519) + chr(0b101101) + '\x38')):
if AkL2ZqopDgiR is None:
if not xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'Re\x0b\xf6\x0ev'), chr(0b1100100) + chr(4761 - 4660) + chr(9088 - 8989) + chr(7540 - 7429) + chr(0b110111 + 0o55) + chr(0b1100101))('\x75' + chr(0b110011 + 0o101) + '\x66' + '\055' + chr(209 - 153)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'sx\x00\xf0\x1dZv\x95\x9e\xa4\xb8PS`\xd1\xd94l\xfb\x85\xaa\x9a'), chr(2631 - 2531) + '\145' + chr(99) + chr(0b1010100 + 0o33) + chr(100) + '\145')(chr(0b1110101) + '\164' + chr(7015 - 6913) + chr(718 - 673) + chr(56)))):
xafqLlk3kkUe(IDJ2eXGCBCDu.gfile, xafqLlk3kkUe(SXOLrMavuUCe(b'Zv&\xec\x08'), chr(100) + chr(6416 - 6315) + chr(0b100011 + 0o100) + '\x6f' + chr(6343 - 6243) + '\145')('\165' + chr(0b101000 + 0o114) + chr(0b1100110) + chr(243 - 198) + chr(0b111000)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'sx\x00\xf0\x1dZv\x95\x9e\xa4\xb8PS`\xd1\xd94l\xfb\x85\xaa\x9a'), chr(0b1101 + 0o127) + '\145' + chr(0b1011000 + 0o13) + chr(0b110110 + 0o71) + chr(0b110011 + 0o61) + '\x65')(chr(117) + '\164' + '\146' + chr(238 - 193) + '\070')))
AkL2ZqopDgiR = W32IvTPzk1z4(oVre8I6UXc3b.debug_dump_frames_path)
s63jeLEbd8fs = wILrY5y2hGu2 if wIHiNvqiZToC else UwjwLYYAL6o4
JUWCi8w5AFcf = bcW0viluRrWZ if wIHiNvqiZToC else DXtx2Xs7bZm6
xafqLlk3kkUe(AkL2ZqopDgiR, xafqLlk3kkUe(SXOLrMavuUCe(b'`o\x0b\xf1\x1f'), chr(0b100110 + 0o76) + chr(0b1100101) + '\143' + '\157' + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1001110 + 0o30) + '\x2d' + '\x38'))(s63jeLEbd8fs, JUWCi8w5AFcf)
yield EEf4r9nUvta_
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'sx\x00\xf0\x1dZv\x95\x9e\xa4\xb8PS`\xd1\xd94l\xfb\x85\xaa\x9a'), chr(0b1100 + 0o130) + '\x65' + chr(0b1011110 + 0o5) + '\x6f' + chr(0b1100100) + '\x65')(chr(0b1110001 + 0o4) + chr(12695 - 12579) + chr(0b1100110) + chr(0b11001 + 0o24) + '\070')):
xafqLlk3kkUe(AkL2ZqopDgiR, xafqLlk3kkUe(SXOLrMavuUCe(b'qt\x0c\xec\tmM\x94\x9c\x8b\x83_Rj'), chr(0b1100100) + chr(208 - 107) + chr(1616 - 1517) + chr(0b1101111) + chr(0b10001 + 0o123) + chr(0b111000 + 0o55))(chr(117) + chr(116) + chr(4284 - 4182) + chr(401 - 356) + chr(869 - 813)))()
|
tensorflow/tensor2tensor
|
tensor2tensor/data_generators/video_utils.py
|
VideoProblem.generate_data
|
def generate_data(self, data_dir, tmp_dir, task_id=-1):
"""The function generating the data."""
filepath_fns = {
problem.DatasetSplit.TRAIN: self.training_filepaths,
problem.DatasetSplit.EVAL: self.dev_filepaths,
problem.DatasetSplit.TEST: self.test_filepaths,
}
# We set shuffled=True as we don't want to shuffle on disk later.
split_paths = [(split["split"], filepath_fns[split["split"]](
data_dir, split["shards"], shuffled=True))
for split in self.dataset_splits]
all_paths = []
for _, paths in split_paths:
all_paths.extend(paths)
if self.is_generate_per_split:
for split, paths in split_paths:
generator_utils.generate_files(
self.generate_encoded_samples(data_dir, tmp_dir, split),
paths,
cycle_every_n=self.total_number_of_frames // len(paths))
else:
generator_utils.generate_files(
self.generate_encoded_samples(data_dir, tmp_dir,
problem.DatasetSplit.TRAIN),
all_paths,
cycle_every_n=self.total_number_of_frames // len(all_paths))
|
python
|
def generate_data(self, data_dir, tmp_dir, task_id=-1):
"""The function generating the data."""
filepath_fns = {
problem.DatasetSplit.TRAIN: self.training_filepaths,
problem.DatasetSplit.EVAL: self.dev_filepaths,
problem.DatasetSplit.TEST: self.test_filepaths,
}
# We set shuffled=True as we don't want to shuffle on disk later.
split_paths = [(split["split"], filepath_fns[split["split"]](
data_dir, split["shards"], shuffled=True))
for split in self.dataset_splits]
all_paths = []
for _, paths in split_paths:
all_paths.extend(paths)
if self.is_generate_per_split:
for split, paths in split_paths:
generator_utils.generate_files(
self.generate_encoded_samples(data_dir, tmp_dir, split),
paths,
cycle_every_n=self.total_number_of_frames // len(paths))
else:
generator_utils.generate_files(
self.generate_encoded_samples(data_dir, tmp_dir,
problem.DatasetSplit.TRAIN),
all_paths,
cycle_every_n=self.total_number_of_frames // len(all_paths))
|
[
"def",
"generate_data",
"(",
"self",
",",
"data_dir",
",",
"tmp_dir",
",",
"task_id",
"=",
"-",
"1",
")",
":",
"filepath_fns",
"=",
"{",
"problem",
".",
"DatasetSplit",
".",
"TRAIN",
":",
"self",
".",
"training_filepaths",
",",
"problem",
".",
"DatasetSplit",
".",
"EVAL",
":",
"self",
".",
"dev_filepaths",
",",
"problem",
".",
"DatasetSplit",
".",
"TEST",
":",
"self",
".",
"test_filepaths",
",",
"}",
"# We set shuffled=True as we don't want to shuffle on disk later.",
"split_paths",
"=",
"[",
"(",
"split",
"[",
"\"split\"",
"]",
",",
"filepath_fns",
"[",
"split",
"[",
"\"split\"",
"]",
"]",
"(",
"data_dir",
",",
"split",
"[",
"\"shards\"",
"]",
",",
"shuffled",
"=",
"True",
")",
")",
"for",
"split",
"in",
"self",
".",
"dataset_splits",
"]",
"all_paths",
"=",
"[",
"]",
"for",
"_",
",",
"paths",
"in",
"split_paths",
":",
"all_paths",
".",
"extend",
"(",
"paths",
")",
"if",
"self",
".",
"is_generate_per_split",
":",
"for",
"split",
",",
"paths",
"in",
"split_paths",
":",
"generator_utils",
".",
"generate_files",
"(",
"self",
".",
"generate_encoded_samples",
"(",
"data_dir",
",",
"tmp_dir",
",",
"split",
")",
",",
"paths",
",",
"cycle_every_n",
"=",
"self",
".",
"total_number_of_frames",
"//",
"len",
"(",
"paths",
")",
")",
"else",
":",
"generator_utils",
".",
"generate_files",
"(",
"self",
".",
"generate_encoded_samples",
"(",
"data_dir",
",",
"tmp_dir",
",",
"problem",
".",
"DatasetSplit",
".",
"TRAIN",
")",
",",
"all_paths",
",",
"cycle_every_n",
"=",
"self",
".",
"total_number_of_frames",
"//",
"len",
"(",
"all_paths",
")",
")"
] |
The function generating the data.
|
[
"The",
"function",
"generating",
"the",
"data",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/video_utils.py#L632-L659
|
train
|
The function generating the data.
|
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,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_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(0b111 + 0o52) + chr(50) + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x37' + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1011 + 0o46) + '\067' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(1062 - 1014) + chr(111) + chr(195 - 143) + chr(1128 - 1078), 0b1000), ehT0Px3KOsy9(chr(2058 - 2010) + chr(0b1101 + 0o142) + '\x32' + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b10011 + 0o37) + '\x35' + chr(0b100011 + 0o16), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b110010 + 0o75) + '\x32' + '\064' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(0b110100) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1000100 + 0o53) + '\x33' + chr(0b1100 + 0o47) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b110010) + chr(0b101110 + 0o5) + chr(1793 - 1745), ord("\x08")), ehT0Px3KOsy9(chr(934 - 886) + chr(3771 - 3660) + chr(0b11010 + 0o31) + chr(1858 - 1804) + chr(821 - 768), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110110 + 0o71) + chr(51) + chr(54) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b110111) + chr(0b110001), 22615 - 22607), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(700 - 651) + '\061', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(1852 - 1802) + chr(0b110000) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(1087 - 1037) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1238 - 1189) + '\064' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(52) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11011 + 0o26) + chr(1099 - 1050) + chr(0b11101 + 0o30), 33569 - 33561), ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + chr(0b110010) + chr(49) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + '\063', 15683 - 15675), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(1078 - 1028) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(0b110010) + '\x36', 8), ehT0Px3KOsy9(chr(1203 - 1155) + chr(111) + chr(0b110011) + '\x34' + chr(1068 - 1016), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100010 + 0o17) + chr(0b110000) + chr(917 - 868), 0b1000), ehT0Px3KOsy9(chr(1949 - 1901) + '\157' + chr(2299 - 2248) + '\x33' + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110100) + chr(52), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011 + 0o0) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + '\x32' + chr(0b110001) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(0b1111 + 0o44) + chr(0b101001 + 0o10) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b101011 + 0o104) + chr(0b110001) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(0b101010 + 0o105) + chr(0b110000 + 0o1) + chr(51) + '\065', 517 - 509), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b110110) + '\x32', 35797 - 35789), ehT0Px3KOsy9(chr(48) + '\157' + chr(2070 - 2017) + chr(0b11010 + 0o35), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(617 - 506) + '\062' + chr(55), 19749 - 19741), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101 + 0o56) + chr(0b110001) + chr(0b1100 + 0o50), 13518 - 13510), ehT0Px3KOsy9('\x30' + chr(111) + chr(1664 - 1613) + '\063' + chr(1324 - 1273), 32117 - 32109), ehT0Px3KOsy9(chr(48) + chr(0b101 + 0o152) + chr(0b110010) + chr(0b110100) + chr(0b110001 + 0o6), 0b1000), ehT0Px3KOsy9(chr(529 - 481) + chr(0b1101111) + chr(0b110011) + chr(0b110101), 46292 - 46284), ehT0Px3KOsy9(chr(452 - 404) + chr(1219 - 1108) + chr(0b110010) + '\x33', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1010 + 0o53) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'x'), chr(0b11010 + 0o112) + '\145' + chr(0b110000 + 0o63) + '\157' + chr(100) + chr(0b1100101))('\x75' + '\164' + chr(0b0 + 0o146) + chr(45) + chr(56)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def jHQgtlDNFkuG(oVre8I6UXc3b, kVFRD544hi_1, JsZ36NJUqtml, h_MwKIdeQ6Ce=-ehT0Px3KOsy9('\x30' + chr(0b1001011 + 0o44) + chr(1625 - 1576), 50694 - 50686)):
_cbt_2krjisq = {sO7e1A_Mor6Q.DatasetSplit.TRAIN: oVre8I6UXc3b.training_filepaths, sO7e1A_Mor6Q.DatasetSplit.EVAL: oVre8I6UXc3b.dev_filepaths, sO7e1A_Mor6Q.DatasetSplit.TEST: oVre8I6UXc3b.test_filepaths}
RktnV8Bpew25 = [(vsJU7GhuEuh6[xafqLlk3kkUe(SXOLrMavuUCe(b'%O\x14K`'), chr(3350 - 3250) + '\145' + chr(0b1100 + 0o127) + '\x6f' + chr(0b1100100) + chr(4293 - 4192))('\x75' + '\x74' + '\x66' + chr(45) + '\x38')], _cbt_2krjisq[vsJU7GhuEuh6[xafqLlk3kkUe(SXOLrMavuUCe(b'%O\x14K`'), '\x64' + chr(0b1100101) + '\143' + '\157' + chr(288 - 188) + chr(7570 - 7469))('\x75' + chr(0b1101001 + 0o13) + chr(102) + chr(45) + chr(0b111000))]](kVFRD544hi_1, vsJU7GhuEuh6[xafqLlk3kkUe(SXOLrMavuUCe(b'%W\x19Pp\xda'), chr(345 - 245) + chr(0b0 + 0o145) + chr(1199 - 1100) + '\x6f' + chr(100) + chr(0b100110 + 0o77))(chr(0b1001001 + 0o54) + chr(0b100011 + 0o121) + chr(5297 - 5195) + chr(0b101101) + chr(0b11000 + 0o40))], shuffled=ehT0Px3KOsy9(chr(741 - 693) + chr(0b1000110 + 0o51) + '\061', 8))) for vsJU7GhuEuh6 in oVre8I6UXc3b.dataset_splits]
_Iid2TLXSHVv = []
for (VNGQdHSFPrso, L5ghGbOkzBG7) in RktnV8Bpew25:
xafqLlk3kkUe(_Iid2TLXSHVv, xafqLlk3kkUe(SXOLrMavuUCe(b'3G\x0cGz\xcd'), chr(100) + chr(8546 - 8445) + chr(6589 - 6490) + chr(0b1101111) + chr(5551 - 5451) + '\145')(chr(0b1110101) + '\164' + '\146' + chr(0b101101) + chr(0b111000)))(L5ghGbOkzBG7)
if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"?L'Eq\xc7\xc7T\xbb\xec\x90\xa8\xc9,\xf2\x8c\x14T!\xe3\x7f"), chr(0b1100100) + chr(0b1100011 + 0o2) + '\143' + chr(0b101000 + 0o107) + chr(0b101111 + 0o65) + '\x65')('\x75' + chr(7564 - 7448) + '\146' + chr(1921 - 1876) + chr(0b111000))):
for (vsJU7GhuEuh6, L5ghGbOkzBG7) in RktnV8Bpew25:
xafqLlk3kkUe(g1Z_RG9zP4cD, xafqLlk3kkUe(SXOLrMavuUCe(b'1Z\x16Gf\xc8\xd6C\x85\xfe\x9c\x9b\xdc:'), chr(100) + '\145' + chr(6891 - 6792) + '\157' + chr(0b10101 + 0o117) + chr(0b1100101))('\165' + '\164' + chr(3974 - 3872) + chr(45) + chr(56)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'1Z\x16Gf\xc8\xd6C\x85\xfd\x9b\x94\xd6-\xe5\xb78W,\xe7{\xfc3\x97'), '\x64' + chr(0b1100101) + chr(99) + chr(1816 - 1705) + chr(3530 - 3430) + chr(9460 - 9359))('\x75' + '\x74' + '\146' + chr(0b101101) + chr(56)))(kVFRD544hi_1, JsZ36NJUqtml, vsJU7GhuEuh6), L5ghGbOkzBG7, cycle_every_n=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'"P\x0cCx\xf6\xccS\xb7\xfa\x90\x85\xe6&\xe6\x8c\x01V,\xe7n\xe3'), chr(7875 - 7775) + chr(101) + chr(0b1100011) + chr(111) + '\144' + chr(101))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b100001 + 0o14) + chr(0b100 + 0o64))) // c2A0yzQpDQB3(L5ghGbOkzBG7))
else:
xafqLlk3kkUe(g1Z_RG9zP4cD, xafqLlk3kkUe(SXOLrMavuUCe(b'1Z\x16Gf\xc8\xd6C\x85\xfe\x9c\x9b\xdc:'), '\x64' + '\145' + chr(99) + '\157' + '\144' + '\145')(chr(11743 - 11626) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(56)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'1Z\x16Gf\xc8\xd6C\x85\xfd\x9b\x94\xd6-\xe5\xb78W,\xe7{\xfc3\x97'), '\x64' + '\145' + '\x63' + chr(111) + chr(282 - 182) + chr(0b1100101))(chr(9737 - 9620) + chr(116) + chr(0b1100110) + '\x2d' + '\070'))(kVFRD544hi_1, JsZ36NJUqtml, xafqLlk3kkUe(sO7e1A_Mor6Q.DatasetSplit, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02m9kZ'), chr(6985 - 6885) + chr(6260 - 6159) + chr(0b1010001 + 0o22) + '\x6f' + chr(100) + chr(7575 - 7474))('\165' + chr(0b1110100) + '\x66' + chr(0b11000 + 0o25) + chr(56)))), _Iid2TLXSHVv, cycle_every_n=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'"P\x0cCx\xf6\xccS\xb7\xfa\x90\x85\xe6&\xe6\x8c\x01V,\xe7n\xe3'), chr(0b110001 + 0o63) + '\x65' + '\x63' + '\x6f' + chr(100) + chr(0b1100101))(chr(117) + '\x74' + chr(0b1100110) + '\x2d' + chr(2669 - 2613))) // c2A0yzQpDQB3(_Iid2TLXSHVv))
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/expert_utils.py
|
add_scope
|
def add_scope(scope=None, scope_fn=None):
"""Return a decorator which add a TF name/variable scope to a function.
Note that the function returned by the decorator accept an additional 'name'
parameter, which can overwrite the name scope given when the function is
created.
Args:
scope (str): name of the scope. If None, the function name is used.
scope_fn (fct): Either tf.name_scope or tf.variable_scope
Returns:
fct: the add_scope decorator
"""
def decorator(f):
@functools.wraps(f)
def decorated(*args, **kwargs):
name = kwargs.pop("name", None) # Python 2 hack for keyword only args
with scope_fn(name or scope or f.__name__):
return f(*args, **kwargs)
return decorated
return decorator
|
python
|
def add_scope(scope=None, scope_fn=None):
"""Return a decorator which add a TF name/variable scope to a function.
Note that the function returned by the decorator accept an additional 'name'
parameter, which can overwrite the name scope given when the function is
created.
Args:
scope (str): name of the scope. If None, the function name is used.
scope_fn (fct): Either tf.name_scope or tf.variable_scope
Returns:
fct: the add_scope decorator
"""
def decorator(f):
@functools.wraps(f)
def decorated(*args, **kwargs):
name = kwargs.pop("name", None) # Python 2 hack for keyword only args
with scope_fn(name or scope or f.__name__):
return f(*args, **kwargs)
return decorated
return decorator
|
[
"def",
"add_scope",
"(",
"scope",
"=",
"None",
",",
"scope_fn",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"decorated",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"kwargs",
".",
"pop",
"(",
"\"name\"",
",",
"None",
")",
"# Python 2 hack for keyword only args",
"with",
"scope_fn",
"(",
"name",
"or",
"scope",
"or",
"f",
".",
"__name__",
")",
":",
"return",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"decorated",
"return",
"decorator"
] |
Return a decorator which add a TF name/variable scope to a function.
Note that the function returned by the decorator accept an additional 'name'
parameter, which can overwrite the name scope given when the function is
created.
Args:
scope (str): name of the scope. If None, the function name is used.
scope_fn (fct): Either tf.name_scope or tf.variable_scope
Returns:
fct: the add_scope decorator
|
[
"Return",
"a",
"decorator",
"which",
"add",
"a",
"TF",
"name",
"/",
"variable",
"scope",
"to",
"a",
"function",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L40-L64
|
train
|
Returns a decorator which adds a TF name or variable scope to a function.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1Ht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e,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\066' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(2637 - 2526) + chr(1605 - 1555) + '\064' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b11111 + 0o24) + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + '\063' + chr(989 - 941) + chr(827 - 778), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + '\062' + chr(51) + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1706 - 1656) + chr(0b110101) + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\065' + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2248 - 2198) + chr(53) + chr(0b101001 + 0o10), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1624 - 1575) + chr(0b110100) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(3447 - 3336) + chr(0b10001 + 0o41) + chr(1546 - 1494), 13343 - 13335), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(812 - 761) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x36' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(661 - 613) + chr(0b1101111) + chr(51) + chr(0b1101 + 0o44) + '\x30', 46723 - 46715), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(1851 - 1798) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000101 + 0o52) + '\x33' + chr(0b101100 + 0o11) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b110011) + chr(1233 - 1182) + '\061', 0b1000), ehT0Px3KOsy9(chr(669 - 621) + '\x6f' + chr(1775 - 1724), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2011 - 1961) + '\063' + chr(49), 0o10), ehT0Px3KOsy9(chr(658 - 610) + chr(0b1101111) + chr(0b110001) + chr(0b11101 + 0o30) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001 + 0o0) + chr(0b10100 + 0o35) + chr(48), 41437 - 41429), ehT0Px3KOsy9('\x30' + chr(111) + '\x36', 27818 - 27810), ehT0Px3KOsy9(chr(598 - 550) + chr(0b1101111) + chr(0b11101 + 0o26) + chr(50) + chr(2418 - 2365), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(53) + '\066', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(10865 - 10754) + chr(0b101110 + 0o5) + chr(0b11110 + 0o27) + chr(0b100001 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9619 - 9508) + chr(0b110010) + chr(0b11111 + 0o21) + chr(1138 - 1089), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + chr(0b10011 + 0o40) + chr(0b100110 + 0o16) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7004 - 6893) + chr(2029 - 1979) + chr(53) + chr(50), 26325 - 26317), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b100011 + 0o114) + chr(0b100111 + 0o14) + chr(0b110110) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b110101 + 0o72) + '\x33' + '\x30' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b10110 + 0o131) + chr(0b110011) + chr(53) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(53) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(49) + '\x37' + chr(1642 - 1594), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010011 + 0o34) + chr(50) + '\065' + chr(1573 - 1524), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b100011 + 0o20) + chr(627 - 575), 4585 - 4577), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(0b111 + 0o55) + chr(55), 8), ehT0Px3KOsy9('\060' + chr(0b101111 + 0o100) + chr(0b0 + 0o61) + '\066' + '\x37', 50275 - 50267), ehT0Px3KOsy9(chr(1934 - 1886) + chr(6813 - 6702) + chr(0b110100) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b110111) + '\x33', 49941 - 49933), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10000 + 0o41) + chr(131 - 79) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(4483 - 4372) + '\x33' + '\x33' + chr(1837 - 1787), 23719 - 23711)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\065' + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x18'), '\x64' + '\x65' + chr(0b1100011) + chr(12306 - 12195) + '\x64' + chr(0b1001110 + 0o27))(chr(0b1011111 + 0o26) + '\x74' + chr(650 - 548) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def fkiEVT6YL6cQ(CJBHNoj4zKoT=None, LmZxKKidw8Jv=None):
def aInxBLSrGyiI(EGyt1xfPT1P6):
@xafqLlk3kkUe(E6ula8_Zv1yl, xafqLlk3kkUe(SXOLrMavuUCe(b'U\xf7\xd3\xa0\xd0\xf2J\xf0U\\7\x01'), chr(0b1100001 + 0o3) + '\x65' + chr(5251 - 5152) + chr(2473 - 2362) + chr(7676 - 7576) + chr(8563 - 8462))(chr(1406 - 1289) + chr(3962 - 3846) + '\146' + chr(763 - 718) + '\070'))(EGyt1xfPT1P6)
def qArdXhtpcod5(*kJDRfRhcZHjS, **M8EIoTs2GJXE):
AIvJRzLdDfgF = M8EIoTs2GJXE.pop(xafqLlk3kkUe(SXOLrMavuUCe(b'X\xc3\xf1\xa4'), '\144' + '\145' + chr(0b111010 + 0o51) + chr(0b101011 + 0o104) + chr(7958 - 7858) + '\145')(chr(0b110101 + 0o100) + chr(1976 - 1860) + '\x66' + chr(0b100010 + 0o13) + chr(0b100 + 0o64)), None)
with LmZxKKidw8Jv(AIvJRzLdDfgF or CJBHNoj4zKoT or xafqLlk3kkUe(EGyt1xfPT1P6, xafqLlk3kkUe(SXOLrMavuUCe(b'q\xc0\xf9\xab\xa9\xc7v\xd8,X\x19\x06'), chr(4768 - 4668) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + '\144' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b110011 + 0o63) + chr(0b101011 + 0o2) + chr(56)))):
return EGyt1xfPT1P6(*kJDRfRhcZHjS, **M8EIoTs2GJXE)
return qArdXhtpcod5
return aInxBLSrGyiI
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/expert_utils.py
|
_add_variable_proxy_methods
|
def _add_variable_proxy_methods(var, proxy_tensor):
"""Proxy methods of underlying variable.
This enables our custom getters to still work with, e.g., batch norm.
Args:
var: Variable to proxy
proxy_tensor: Tensor that is identity of var
"""
proxy_tensor.read_value = lambda: tf.identity(proxy_tensor)
proxy_tensor.assign_sub = var.assign_sub
proxy_tensor.assign = var.assign
proxy_tensor.initialized_value = var.initialized_value
|
python
|
def _add_variable_proxy_methods(var, proxy_tensor):
"""Proxy methods of underlying variable.
This enables our custom getters to still work with, e.g., batch norm.
Args:
var: Variable to proxy
proxy_tensor: Tensor that is identity of var
"""
proxy_tensor.read_value = lambda: tf.identity(proxy_tensor)
proxy_tensor.assign_sub = var.assign_sub
proxy_tensor.assign = var.assign
proxy_tensor.initialized_value = var.initialized_value
|
[
"def",
"_add_variable_proxy_methods",
"(",
"var",
",",
"proxy_tensor",
")",
":",
"proxy_tensor",
".",
"read_value",
"=",
"lambda",
":",
"tf",
".",
"identity",
"(",
"proxy_tensor",
")",
"proxy_tensor",
".",
"assign_sub",
"=",
"var",
".",
"assign_sub",
"proxy_tensor",
".",
"assign",
"=",
"var",
".",
"assign",
"proxy_tensor",
".",
"initialized_value",
"=",
"var",
".",
"initialized_value"
] |
Proxy methods of underlying variable.
This enables our custom getters to still work with, e.g., batch norm.
Args:
var: Variable to proxy
proxy_tensor: Tensor that is identity of var
|
[
"Proxy",
"methods",
"of",
"underlying",
"variable",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L75-L87
|
train
|
Adds the proxy methods of underlying variable.
This enables our custom getters to still work with e. g. batch norm.
This enables our custom getters to still work with e. g. batch 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,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,NE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rOC7R_,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(0b1100011 + 0o14) + '\062' + chr(49) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + '\061' + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(724 - 674) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(4855 - 4744) + chr(52) + chr(0b1101 + 0o46), ord("\x08")), ehT0Px3KOsy9(chr(985 - 937) + '\x6f' + chr(0b11001 + 0o31) + chr(0b10 + 0o61) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1676 - 1626) + chr(1841 - 1792) + chr(0b11011 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(1819 - 1771) + chr(1568 - 1457) + chr(2287 - 2238) + chr(0b110000) + chr(1169 - 1118), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + chr(0b1110 + 0o44) + chr(515 - 466) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(12310 - 12199) + chr(0b10 + 0o57) + '\063' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(0b11100 + 0o25) + '\x31' + '\064', 45350 - 45342), ehT0Px3KOsy9('\x30' + chr(7474 - 7363) + chr(0b101100 + 0o5) + '\x32' + '\067', 35509 - 35501), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + '\062' + chr(0b110010) + '\064', 8), ehT0Px3KOsy9(chr(582 - 534) + '\157' + chr(1849 - 1800) + chr(0b110001) + chr(162 - 109), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10 + 0o61) + chr(51) + '\x36', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + '\065' + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b110111) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(11288 - 11177) + chr(51) + chr(0b11101 + 0o23) + chr(2300 - 2248), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b100110 + 0o13) + '\064' + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011111 + 0o20) + '\064' + '\063', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + '\x34' + chr(0b1110 + 0o42), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(886 - 837) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + '\061' + '\x31' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100101 + 0o14) + chr(55) + chr(0b100 + 0o55), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(86 - 35) + chr(0b110001 + 0o2) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b100011 + 0o114) + chr(51) + chr(1952 - 1902) + chr(0b110001 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(708 - 654) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\067' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b110111) + chr(0b110010 + 0o2), 0o10), ehT0Px3KOsy9(chr(1108 - 1060) + chr(0b1101111) + chr(0b110011) + '\x31' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1200 - 1089) + chr(0b110000 + 0o4), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(541 - 492) + '\x30' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(4511 - 4400) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(2708 - 2597) + chr(1762 - 1711) + chr(0b110011) + chr(53), 18298 - 18290), ehT0Px3KOsy9('\x30' + chr(10602 - 10491) + '\x31' + '\x32' + chr(2885 - 2830), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110111) + chr(0b11011 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1100001 + 0o16) + '\063' + chr(0b11101 + 0o25) + chr(0b110100), 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(0b10110 + 0o33) + chr(0b1101 + 0o44) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1011001 + 0o26) + '\063' + chr(48) + '\065', 0o10), ehT0Px3KOsy9(chr(134 - 86) + chr(0b1101111) + chr(0b110001 + 0o2) + chr(1874 - 1821) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\063' + '\061' + chr(0b110001), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(965 - 917) + chr(4400 - 4289) + chr(0b110101) + chr(1852 - 1804), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6'), chr(100) + '\145' + chr(0b1001100 + 0o27) + '\x6f' + chr(100) + chr(7047 - 6946))(chr(117) + chr(116) + chr(0b10000 + 0o126) + '\x2d' + '\070') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def Aa3Fm2LKzDic(l38lb8xQZNsE, JINxK7cjiP75):
JINxK7cjiP75.fRE1uNpN4qiY = lambda : IDJ2eXGCBCDu.vFUG5mKXcvYG(JINxK7cjiP75)
JINxK7cjiP75.XItaZem6RDsC = l38lb8xQZNsE.XItaZem6RDsC
JINxK7cjiP75.XH9bAgNQ2txV = l38lb8xQZNsE.XH9bAgNQ2txV
JINxK7cjiP75.Og54ulZMNne0 = l38lb8xQZNsE.Og54ulZMNne0
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/expert_utils.py
|
_rowwise_unsorted_segment_sum
|
def _rowwise_unsorted_segment_sum(values, indices, n):
"""UnsortedSegmentSum on each row.
Args:
values: a `Tensor` with shape `[batch_size, k]`.
indices: an integer `Tensor` with shape `[batch_size, k]`.
n: an integer.
Returns:
A `Tensor` with the same type as `values` and shape `[batch_size, n]`.
"""
batch, k = tf.unstack(tf.shape(indices), num=2)
indices_flat = tf.reshape(indices, [-1]) + tf.div(tf.range(batch * k), k) * n
ret_flat = tf.unsorted_segment_sum(
tf.reshape(values, [-1]), indices_flat, batch * n)
return tf.reshape(ret_flat, [batch, n])
|
python
|
def _rowwise_unsorted_segment_sum(values, indices, n):
"""UnsortedSegmentSum on each row.
Args:
values: a `Tensor` with shape `[batch_size, k]`.
indices: an integer `Tensor` with shape `[batch_size, k]`.
n: an integer.
Returns:
A `Tensor` with the same type as `values` and shape `[batch_size, n]`.
"""
batch, k = tf.unstack(tf.shape(indices), num=2)
indices_flat = tf.reshape(indices, [-1]) + tf.div(tf.range(batch * k), k) * n
ret_flat = tf.unsorted_segment_sum(
tf.reshape(values, [-1]), indices_flat, batch * n)
return tf.reshape(ret_flat, [batch, n])
|
[
"def",
"_rowwise_unsorted_segment_sum",
"(",
"values",
",",
"indices",
",",
"n",
")",
":",
"batch",
",",
"k",
"=",
"tf",
".",
"unstack",
"(",
"tf",
".",
"shape",
"(",
"indices",
")",
",",
"num",
"=",
"2",
")",
"indices_flat",
"=",
"tf",
".",
"reshape",
"(",
"indices",
",",
"[",
"-",
"1",
"]",
")",
"+",
"tf",
".",
"div",
"(",
"tf",
".",
"range",
"(",
"batch",
"*",
"k",
")",
",",
"k",
")",
"*",
"n",
"ret_flat",
"=",
"tf",
".",
"unsorted_segment_sum",
"(",
"tf",
".",
"reshape",
"(",
"values",
",",
"[",
"-",
"1",
"]",
")",
",",
"indices_flat",
",",
"batch",
"*",
"n",
")",
"return",
"tf",
".",
"reshape",
"(",
"ret_flat",
",",
"[",
"batch",
",",
"n",
"]",
")"
] |
UnsortedSegmentSum on each row.
Args:
values: a `Tensor` with shape `[batch_size, k]`.
indices: an integer `Tensor` with shape `[batch_size, k]`.
n: an integer.
Returns:
A `Tensor` with the same type as `values` and shape `[batch_size, n]`.
|
[
"UnsortedSegmentSum",
"on",
"each",
"row",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L267-L281
|
train
|
UnsortedSegmentSum on each row.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ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_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(1388 - 1339), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(305 - 255) + '\066' + chr(49), 4570 - 4562), ehT0Px3KOsy9(chr(1585 - 1537) + '\157' + chr(81 - 30) + chr(629 - 580) + chr(52), 0o10), ehT0Px3KOsy9(chr(542 - 494) + chr(5711 - 5600) + chr(49) + chr(0b1100 + 0o52) + chr(0b0 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + chr(0b10011 + 0o36) + chr(51) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b11111 + 0o23) + '\067', 0b1000), ehT0Px3KOsy9(chr(196 - 148) + chr(111) + chr(0b10010 + 0o40) + chr(52) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\061' + chr(50), 40639 - 40631), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(1278 - 1228) + '\x31' + '\x35', 0o10), ehT0Px3KOsy9(chr(184 - 136) + chr(0b1101111) + chr(141 - 90) + '\x30' + chr(0b110010), 25633 - 25625), ehT0Px3KOsy9(chr(1226 - 1178) + chr(2659 - 2548) + '\063' + '\x33' + chr(332 - 278), 52011 - 52003), ehT0Px3KOsy9('\x30' + chr(0b1101001 + 0o6) + chr(0b110011) + chr(51) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10817 - 10706) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(589 - 541) + '\157' + chr(0b110110 + 0o1) + chr(0b10010 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(627 - 579) + chr(7308 - 7197) + chr(0b110101) + chr(0b11101 + 0o24), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(0b110010) + '\x33' + chr(52), 42856 - 42848), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\065' + chr(595 - 544), 51279 - 51271), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(55), 12917 - 12909), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + '\x32' + '\x32' + '\064', 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(12265 - 12154) + chr(0b110 + 0o54) + chr(0b100000 + 0o24) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(634 - 586) + '\157' + chr(50) + chr(1154 - 1101) + chr(1274 - 1221), 44768 - 44760), ehT0Px3KOsy9(chr(1168 - 1120) + '\157' + '\062' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + chr(0b110001) + chr(1481 - 1430) + chr(0b110 + 0o52), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + chr(641 - 590) + chr(0b10010 + 0o40) + '\067', 5454 - 5446), ehT0Px3KOsy9('\060' + chr(0b110001 + 0o76) + chr(51) + chr(0b110100) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + chr(0b11011 + 0o32) + '\x31', 8), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + '\061' + chr(0b110100) + chr(0b10011 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(772 - 722) + '\x36' + chr(0b10101 + 0o34), 8), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(2344 - 2293) + chr(0b10100 + 0o37) + chr(0b0 + 0o62), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x35' + chr(2555 - 2503), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11101 + 0o24) + chr(0b10 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + '\x32' + chr(50) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1382 - 1334) + chr(0b100110 + 0o111) + chr(0b110001), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1942 - 1891) + '\x36' + chr(0b11001 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100010 + 0o20) + chr(0b110001) + chr(0b11010 + 0o30), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(771 - 722) + chr(0b100111 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b11010 + 0o30) + chr(1023 - 968), 0o10), ehT0Px3KOsy9('\060' + chr(0b1001011 + 0o44) + chr(376 - 327) + chr(736 - 683), 24035 - 24027), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1010000 + 0o37) + chr(0b110110) + chr(1125 - 1073), ord("\x08")), ehT0Px3KOsy9(chr(1189 - 1141) + '\x6f' + chr(49) + chr(0b110000) + chr(54), 23220 - 23212)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(53) + chr(1182 - 1134), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'/'), '\x64' + '\x65' + chr(5638 - 5539) + chr(7780 - 7669) + chr(0b11000 + 0o114) + chr(6670 - 6569))(chr(0b1110101) + '\164' + chr(102) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def faKSxxZs1m9B(SPnCNu54H1db, pIcoaXENl5Pw, m1NkCryOw9Bx):
(dNwAahu8tvoY, OolUPRJhRaJd) = IDJ2eXGCBCDu.unstack(IDJ2eXGCBCDu.nauYfLglTpcb(pIcoaXENl5Pw), num=ehT0Px3KOsy9('\x30' + '\157' + '\062', 0o10))
B2MRJnEHBbgp = IDJ2eXGCBCDu.reshape(pIcoaXENl5Pw, [-ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31', 8)]) + IDJ2eXGCBCDu.div(IDJ2eXGCBCDu.range(dNwAahu8tvoY * OolUPRJhRaJd), OolUPRJhRaJd) * m1NkCryOw9Bx
wJ5ie9RyejzA = IDJ2eXGCBCDu.unsorted_segment_sum(IDJ2eXGCBCDu.reshape(SPnCNu54H1db, [-ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31', 8)]), B2MRJnEHBbgp, dNwAahu8tvoY * m1NkCryOw9Bx)
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b"s\xd4\xbf\x18>'\xc6"), '\144' + '\x65' + '\143' + chr(0b1011000 + 0o27) + chr(324 - 224) + chr(6673 - 6572))(chr(10954 - 10837) + chr(424 - 308) + chr(0b100111 + 0o77) + chr(0b101101) + chr(0b111000)))(wJ5ie9RyejzA, [dNwAahu8tvoY, m1NkCryOw9Bx])
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/expert_utils.py
|
_prob_in_top_k
|
def _prob_in_top_k(
clean_values, noisy_values, noise_stddev, noisy_top_values, k):
"""Helper function to NoisyTopKGating.
Computes the probability that value is in top k, given different random noise.
This gives us a way of backpropagating from a loss that balances the number
of times each expert is in the top k experts per example.
In the case of no noise, pass in None for noise_stddev, and the result will
not be differentiable.
Args:
clean_values: a `Tensor` of shape [batch, n].
noisy_values: a `Tensor` of shape [batch, n]. Equal to clean values plus
normally distributed noise with standard deviation noise_stddev.
noise_stddev: a `Tensor` of shape [batch, n], or None
noisy_top_values: a `Tensor` of shape [batch, m].
"values" Output of tf.top_k(noisy_top_values, m). m >= k+1
k: an integer.
Returns:
a `Tensor` of shape [batch, n].
"""
batch = tf.shape(clean_values)[0]
m = tf.shape(noisy_top_values)[1]
top_values_flat = tf.reshape(noisy_top_values, [-1])
# we want to compute the threshold that a particular value would have to
# exceed in order to make the top k. This computation differs depending
# on whether the value is already in the top k.
threshold_positions_if_in = tf.range(batch) * m + k
threshold_if_in = tf.expand_dims(
tf.gather(top_values_flat, threshold_positions_if_in), 1)
is_in = tf.greater(noisy_values, threshold_if_in)
if noise_stddev is None:
return tf.to_float(is_in)
threshold_positions_if_out = threshold_positions_if_in - 1
threshold_if_out = tf.expand_dims(
tf.gather(top_values_flat, threshold_positions_if_out), 1)
# is each value currently in the top k.
prob_if_in = _normal_distribution_cdf(clean_values - threshold_if_in,
noise_stddev)
prob_if_out = _normal_distribution_cdf(clean_values - threshold_if_out,
noise_stddev)
prob = tf.where(is_in, prob_if_in, prob_if_out)
return prob
|
python
|
def _prob_in_top_k(
clean_values, noisy_values, noise_stddev, noisy_top_values, k):
"""Helper function to NoisyTopKGating.
Computes the probability that value is in top k, given different random noise.
This gives us a way of backpropagating from a loss that balances the number
of times each expert is in the top k experts per example.
In the case of no noise, pass in None for noise_stddev, and the result will
not be differentiable.
Args:
clean_values: a `Tensor` of shape [batch, n].
noisy_values: a `Tensor` of shape [batch, n]. Equal to clean values plus
normally distributed noise with standard deviation noise_stddev.
noise_stddev: a `Tensor` of shape [batch, n], or None
noisy_top_values: a `Tensor` of shape [batch, m].
"values" Output of tf.top_k(noisy_top_values, m). m >= k+1
k: an integer.
Returns:
a `Tensor` of shape [batch, n].
"""
batch = tf.shape(clean_values)[0]
m = tf.shape(noisy_top_values)[1]
top_values_flat = tf.reshape(noisy_top_values, [-1])
# we want to compute the threshold that a particular value would have to
# exceed in order to make the top k. This computation differs depending
# on whether the value is already in the top k.
threshold_positions_if_in = tf.range(batch) * m + k
threshold_if_in = tf.expand_dims(
tf.gather(top_values_flat, threshold_positions_if_in), 1)
is_in = tf.greater(noisy_values, threshold_if_in)
if noise_stddev is None:
return tf.to_float(is_in)
threshold_positions_if_out = threshold_positions_if_in - 1
threshold_if_out = tf.expand_dims(
tf.gather(top_values_flat, threshold_positions_if_out), 1)
# is each value currently in the top k.
prob_if_in = _normal_distribution_cdf(clean_values - threshold_if_in,
noise_stddev)
prob_if_out = _normal_distribution_cdf(clean_values - threshold_if_out,
noise_stddev)
prob = tf.where(is_in, prob_if_in, prob_if_out)
return prob
|
[
"def",
"_prob_in_top_k",
"(",
"clean_values",
",",
"noisy_values",
",",
"noise_stddev",
",",
"noisy_top_values",
",",
"k",
")",
":",
"batch",
"=",
"tf",
".",
"shape",
"(",
"clean_values",
")",
"[",
"0",
"]",
"m",
"=",
"tf",
".",
"shape",
"(",
"noisy_top_values",
")",
"[",
"1",
"]",
"top_values_flat",
"=",
"tf",
".",
"reshape",
"(",
"noisy_top_values",
",",
"[",
"-",
"1",
"]",
")",
"# we want to compute the threshold that a particular value would have to",
"# exceed in order to make the top k. This computation differs depending",
"# on whether the value is already in the top k.",
"threshold_positions_if_in",
"=",
"tf",
".",
"range",
"(",
"batch",
")",
"*",
"m",
"+",
"k",
"threshold_if_in",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"gather",
"(",
"top_values_flat",
",",
"threshold_positions_if_in",
")",
",",
"1",
")",
"is_in",
"=",
"tf",
".",
"greater",
"(",
"noisy_values",
",",
"threshold_if_in",
")",
"if",
"noise_stddev",
"is",
"None",
":",
"return",
"tf",
".",
"to_float",
"(",
"is_in",
")",
"threshold_positions_if_out",
"=",
"threshold_positions_if_in",
"-",
"1",
"threshold_if_out",
"=",
"tf",
".",
"expand_dims",
"(",
"tf",
".",
"gather",
"(",
"top_values_flat",
",",
"threshold_positions_if_out",
")",
",",
"1",
")",
"# is each value currently in the top k.",
"prob_if_in",
"=",
"_normal_distribution_cdf",
"(",
"clean_values",
"-",
"threshold_if_in",
",",
"noise_stddev",
")",
"prob_if_out",
"=",
"_normal_distribution_cdf",
"(",
"clean_values",
"-",
"threshold_if_out",
",",
"noise_stddev",
")",
"prob",
"=",
"tf",
".",
"where",
"(",
"is_in",
",",
"prob_if_in",
",",
"prob_if_out",
")",
"return",
"prob"
] |
Helper function to NoisyTopKGating.
Computes the probability that value is in top k, given different random noise.
This gives us a way of backpropagating from a loss that balances the number
of times each expert is in the top k experts per example.
In the case of no noise, pass in None for noise_stddev, and the result will
not be differentiable.
Args:
clean_values: a `Tensor` of shape [batch, n].
noisy_values: a `Tensor` of shape [batch, n]. Equal to clean values plus
normally distributed noise with standard deviation noise_stddev.
noise_stddev: a `Tensor` of shape [batch, n], or None
noisy_top_values: a `Tensor` of shape [batch, m].
"values" Output of tf.top_k(noisy_top_values, m). m >= k+1
k: an integer.
Returns:
a `Tensor` of shape [batch, n].
|
[
"Helper",
"function",
"to",
"NoisyTopKGating",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L303-L348
|
train
|
Private function that computes the probability that a value is in the top k.
|
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ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ciNl3EEEj,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(665 - 615) + '\065' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1608 - 1558) + chr(0b110111), 36805 - 36797), ehT0Px3KOsy9(chr(915 - 867) + chr(4152 - 4041) + chr(2285 - 2233) + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b11110 + 0o121) + '\062' + chr(0b110010 + 0o3), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(0b110110) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(789 - 739) + chr(49) + chr(1029 - 981), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1 + 0o156) + '\061' + chr(0b110001) + chr(0b110 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b110001 + 0o76) + chr(0b101111 + 0o2) + chr(283 - 232) + chr(0b10110 + 0o36), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(916 - 865) + chr(1745 - 1691) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(6611 - 6500) + chr(0b110010) + '\061' + chr(1624 - 1575), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(2322 - 2269) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1182 - 1134) + chr(0b1101111) + '\064' + chr(298 - 243), 0b1000), ehT0Px3KOsy9(chr(394 - 346) + chr(0b1101111) + '\x32' + chr(54) + chr(736 - 683), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(392 - 344) + '\x34', 15506 - 15498), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(50) + chr(585 - 532), 0b1000), ehT0Px3KOsy9(chr(2244 - 2196) + chr(9884 - 9773) + '\x32' + chr(48) + chr(48), 38840 - 38832), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + '\x36' + '\066', 27536 - 27528), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b10010 + 0o37) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(53) + chr(0b110000 + 0o1), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + '\062' + chr(55) + chr(0b11011 + 0o31), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + '\x31' + chr(0b11001 + 0o31) + chr(2267 - 2217), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(54) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + chr(1321 - 1271) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101011 + 0o4) + chr(0b11111 + 0o24) + chr(0b110100) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001100 + 0o43) + chr(0b110001) + '\061' + chr(0b10011 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(1953 - 1905) + '\x6f' + chr(0b110011) + chr(2112 - 2063), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(791 - 742) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1045 - 997) + '\157' + '\x32' + '\060' + chr(0b110011), 20179 - 20171), ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + '\061' + chr(0b101001 + 0o10) + chr(0b101111 + 0o1), 48860 - 48852), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + '\x34' + chr(2127 - 2076), 7360 - 7352), ehT0Px3KOsy9(chr(1600 - 1552) + '\x6f' + '\x32' + chr(0b110011) + chr(0b1101 + 0o46), 0b1000), ehT0Px3KOsy9(chr(1103 - 1055) + '\157' + chr(51) + chr(50) + chr(1065 - 1016), ord("\x08")), ehT0Px3KOsy9(chr(1713 - 1665) + chr(8249 - 8138) + chr(0b110011) + chr(0b110 + 0o57) + chr(0b100111 + 0o12), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b11000 + 0o37) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(1763 - 1712) + chr(0b1100 + 0o52) + '\x36', 44594 - 44586), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\060' + chr(50), 5518 - 5510), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + chr(0b10101 + 0o36) + chr(0b1111 + 0o43) + chr(0b110000), 52587 - 52579), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100100 + 0o21) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(999 - 951) + chr(111) + '\x32' + chr(1151 - 1102) + chr(0b110100), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + chr(0b110000), 49116 - 49108)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x87'), chr(100) + '\x65' + chr(99) + '\x6f' + chr(100) + '\x65')('\165' + chr(0b1110100) + chr(9340 - 9238) + '\x2d' + chr(2235 - 2179)) + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def GHc1C6bZffyn(P7Ed7OUOeY0F, g6MiGJLl36d_, HqNPvAK_K7F6, NpE9nu8t2Onf, OolUPRJhRaJd):
dNwAahu8tvoY = IDJ2eXGCBCDu.nauYfLglTpcb(P7Ed7OUOeY0F)[ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + '\060', ord("\x08"))]
r8ufID9JCHnI = IDJ2eXGCBCDu.nauYfLglTpcb(NpE9nu8t2Onf)[ehT0Px3KOsy9(chr(48) + chr(0b1010000 + 0o37) + chr(0b1110 + 0o43), ord("\x08"))]
tl5nxqq82LRy = IDJ2eXGCBCDu.reshape(NpE9nu8t2Onf, [-ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2203 - 2154), 8)])
gxFFJnYHCl5Q = IDJ2eXGCBCDu.range(dNwAahu8tvoY) * r8ufID9JCHnI + OolUPRJhRaJd
_843VuVWxB_u = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.kGr_8mTaGpVE(tl5nxqq82LRy, gxFFJnYHCl5Q), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49), 8))
nXQgLPZkvE3s = IDJ2eXGCBCDu.greater(g6MiGJLl36d_, _843VuVWxB_u)
if HqNPvAK_K7F6 is None:
return xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xc2j&\xd9O\xca\n\t\xca\xdc\x18'), chr(0b1011110 + 0o6) + '\145' + '\x63' + chr(0b1101111) + chr(0b100101 + 0o77) + '\x65')('\x75' + '\x74' + '\x66' + chr(0b101101) + chr(0b111000)))(nXQgLPZkvE3s)
jJp1zA4sr2Tg = gxFFJnYHCl5Q - ehT0Px3KOsy9('\x30' + chr(0b1100111 + 0o10) + '\061', 8)
fwIe3dUxmPlT = IDJ2eXGCBCDu.expand_dims(IDJ2eXGCBCDu.kGr_8mTaGpVE(tl5nxqq82LRy, jJp1zA4sr2Tg), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + '\061', 8))
Q19oRx_behg0 = sGYwjKsISGuk(P7Ed7OUOeY0F - _843VuVWxB_u, HqNPvAK_K7F6)
EZj1dNgvvG16 = sGYwjKsISGuk(P7Ed7OUOeY0F - fwIe3dUxmPlT, HqNPvAK_K7F6)
EmFjc7khMaAc = IDJ2eXGCBCDu.dRFAC59yQBm_(nXQgLPZkvE3s, Q19oRx_behg0, EZj1dNgvvG16)
return EmFjc7khMaAc
|
tensorflow/tensor2tensor
|
tensor2tensor/utils/expert_utils.py
|
cv_squared
|
def cv_squared(x):
"""The squared coefficient of variation of a sample.
Useful as a loss to encourage a positive distribution to be more uniform.
Epsilons added for numerical stability.
Returns 0 for an empty Tensor.
Args:
x: a `Tensor`.
Returns:
a `Scalar`.
"""
epsilon = 1e-10
float_size = tf.to_float(tf.size(x)) + epsilon
mean = tf.reduce_sum(x) / float_size
variance = tf.reduce_sum(tf.squared_difference(x, mean)) / float_size
return variance / (tf.square(mean) + epsilon)
|
python
|
def cv_squared(x):
"""The squared coefficient of variation of a sample.
Useful as a loss to encourage a positive distribution to be more uniform.
Epsilons added for numerical stability.
Returns 0 for an empty Tensor.
Args:
x: a `Tensor`.
Returns:
a `Scalar`.
"""
epsilon = 1e-10
float_size = tf.to_float(tf.size(x)) + epsilon
mean = tf.reduce_sum(x) / float_size
variance = tf.reduce_sum(tf.squared_difference(x, mean)) / float_size
return variance / (tf.square(mean) + epsilon)
|
[
"def",
"cv_squared",
"(",
"x",
")",
":",
"epsilon",
"=",
"1e-10",
"float_size",
"=",
"tf",
".",
"to_float",
"(",
"tf",
".",
"size",
"(",
"x",
")",
")",
"+",
"epsilon",
"mean",
"=",
"tf",
".",
"reduce_sum",
"(",
"x",
")",
"/",
"float_size",
"variance",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"squared_difference",
"(",
"x",
",",
"mean",
")",
")",
"/",
"float_size",
"return",
"variance",
"/",
"(",
"tf",
".",
"square",
"(",
"mean",
")",
"+",
"epsilon",
")"
] |
The squared coefficient of variation of a sample.
Useful as a loss to encourage a positive distribution to be more uniform.
Epsilons added for numerical stability.
Returns 0 for an empty Tensor.
Args:
x: a `Tensor`.
Returns:
a `Scalar`.
|
[
"The",
"squared",
"coefficient",
"of",
"variation",
"of",
"a",
"sample",
"."
] |
272500b6efe353aeb638d2745ed56e519462ca31
|
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/expert_utils.py#L351-L368
|
train
|
Computes the squared coefficient of variation of a sample.
|
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,V5s4UV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YI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__
SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(716 - 667) + chr(2210 - 2155), 35941 - 35933), ehT0Px3KOsy9(chr(965 - 917) + '\x6f' + chr(1543 - 1490) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x32' + '\x37' + '\062', 31033 - 31025), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\066' + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x36' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(579 - 531) + chr(9387 - 9276) + chr(0b100100 + 0o15) + chr(0b110000) + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + chr(3206 - 3095) + '\062' + '\062' + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(9549 - 9438) + '\x31' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(498 - 450) + chr(111) + '\x33' + chr(51) + chr(53), 3582 - 3574), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(0b10110 + 0o40) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\x35' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(1911 - 1863) + chr(0b1101111) + chr(0b110001) + chr(0b101001 + 0o10) + chr(0b110000), 5287 - 5279), ehT0Px3KOsy9('\x30' + '\157' + chr(1743 - 1694) + '\x32' + chr(52), 9764 - 9756), ehT0Px3KOsy9(chr(204 - 156) + '\157' + chr(0b110001) + chr(755 - 702) + chr(0b100110 + 0o15), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + chr(0b10010 + 0o41) + chr(1367 - 1312) + chr(2573 - 2521), 0o10), ehT0Px3KOsy9(chr(57 - 9) + '\x6f' + chr(0b100011 + 0o20) + chr(0b11101 + 0o24) + chr(0b0 + 0o64), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(12236 - 12125) + '\065' + chr(893 - 842), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b110100) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\064' + chr(52), 30888 - 30880), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + '\067' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(2541 - 2430) + '\x33' + chr(0b100001 + 0o17) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(1065 - 1017) + '\065', 58745 - 58737), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(9490 - 9379) + '\x31' + '\x37' + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + '\066' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(9821 - 9710) + chr(49) + chr(52 - 4) + chr(0b1010 + 0o50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10010 + 0o41) + '\064' + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\062' + chr(1777 - 1729), 17411 - 17403), ehT0Px3KOsy9(chr(0b110000) + chr(0b110101 + 0o72) + '\x31' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(1578 - 1528) + chr(1528 - 1478) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110111) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(1561 - 1511) + chr(0b110010) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(6574 - 6463) + chr(253 - 204) + chr(0b110000 + 0o1) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110100) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b100000 + 0o27) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(2030 - 1982) + '\x6f' + chr(0b101010 + 0o10) + chr(50) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(0b101001 + 0o12) + chr(0b110011) + chr(0b100100 + 0o21), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(118 - 67) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(12140 - 12029) + chr(0b110011) + chr(0b110100) + chr(0b110000 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(662 - 551) + '\065' + chr(0b1001 + 0o54), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + chr(523 - 475), 20934 - 20926)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)])
def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh):
try:
return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa1'), '\144' + '\145' + chr(99) + chr(8203 - 8092) + '\144' + chr(5592 - 5491))('\x75' + '\164' + chr(0b101010 + 0o74) + chr(45) + '\x38') + _CF03Rifpmdh)
except yROw0HWBk0Qc:
return jFWsnpHpAUWz(RqocVGOryNPv)
def wrwwPr_mZ8_E(OeWW0F1dBPRQ):
Xtig2zAKpR0T = 1e-10
GhhUOhg_TFeb = IDJ2eXGCBCDu.ZUL3kHBGU8Uu(IDJ2eXGCBCDu.NLcc3BCJnQka(OeWW0F1dBPRQ)) + Xtig2zAKpR0T
aJhItC_Vawlw = IDJ2eXGCBCDu.reduce_sum(OeWW0F1dBPRQ) / GhhUOhg_TFeb
nVKbP5sF7181 = IDJ2eXGCBCDu.reduce_sum(IDJ2eXGCBCDu.squared_difference(OeWW0F1dBPRQ, aJhItC_Vawlw)) / GhhUOhg_TFeb
return nVKbP5sF7181 / (xafqLlk3kkUe(IDJ2eXGCBCDu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfc^\xcf\x13A%'), chr(100) + '\x65' + chr(0b1101 + 0o126) + '\x6f' + chr(2636 - 2536) + '\x65')(chr(0b1110101) + '\x74' + chr(2212 - 2110) + '\055' + '\070'))(aJhItC_Vawlw) + Xtig2zAKpR0T)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.