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
alpacahq/pylivetrader
pylivetrader/misc/parallel_utils.py
parallelize
def parallelize(mapfunc, workers=None): ''' Parallelize the mapfunc with multithreading. mapfunc calls will be partitioned by the provided list of arguments. Each item in the list will represent one call's arguments. They can be tuples if the function takes multiple arguments, but one-tupling is not...
python
def parallelize(mapfunc, workers=None): ''' Parallelize the mapfunc with multithreading. mapfunc calls will be partitioned by the provided list of arguments. Each item in the list will represent one call's arguments. They can be tuples if the function takes multiple arguments, but one-tupling is not...
[ "def", "parallelize", "(", "mapfunc", ",", "workers", "=", "None", ")", ":", "workers", "=", "workers", "if", "workers", "else", "_get_default_workers", "(", ")", "def", "wrapper", "(", "args_list", ")", ":", "result", "=", "{", "}", "with", "concurrent", ...
Parallelize the mapfunc with multithreading. mapfunc calls will be partitioned by the provided list of arguments. Each item in the list will represent one call's arguments. They can be tuples if the function takes multiple arguments, but one-tupling is not necessary. If workers argument is not provided...
[ "Parallelize", "the", "mapfunc", "with", "multithreading", ".", "mapfunc", "calls", "will", "be", "partitioned", "by", "the", "provided", "list", "of", "arguments", ".", "Each", "item", "in", "the", "list", "will", "represent", "one", "call", "s", "arguments",...
fd328b6595428c0789d9f218df34623f83a02b8b
https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/misc/parallel_utils.py#L10-L43
train
A function that returns a list of arguments that are parallelized by the provided mapfunc.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
alpacahq/pylivetrader
pylivetrader/data/data_portal.py
DataPortal.get_adjusted_value
def get_adjusted_value( self, assets, field, dt, perspective_dt, data_frequency): ''' TODO: for external data (fetch_csv) support, need to update logic here. ''' return self.backend.get_spot_value( ...
python
def get_adjusted_value( self, assets, field, dt, perspective_dt, data_frequency): ''' TODO: for external data (fetch_csv) support, need to update logic here. ''' return self.backend.get_spot_value( ...
[ "def", "get_adjusted_value", "(", "self", ",", "assets", ",", "field", ",", "dt", ",", "perspective_dt", ",", "data_frequency", ")", ":", "return", "self", ".", "backend", ".", "get_spot_value", "(", "assets", ",", "field", ",", "dt", ",", "data_frequency", ...
TODO: for external data (fetch_csv) support, need to update logic here.
[ "TODO", ":", "for", "external", "data", "(", "fetch_csv", ")", "support", "need", "to", "update", "logic", "here", "." ]
fd328b6595428c0789d9f218df34623f83a02b8b
https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/data/data_portal.py#L39-L52
train
Get the adjusted value for the given object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/util.py
load_df_from_file
def load_df_from_file(file_path, sep=",", header=0): """Wrapper around pandas' read_csv.""" with tf.gfile.Open(file_path) as infile: df = pd.read_csv(infile, sep=sep, header=header) return df
python
def load_df_from_file(file_path, sep=",", header=0): """Wrapper around pandas' read_csv.""" with tf.gfile.Open(file_path) as infile: df = pd.read_csv(infile, sep=sep, header=header) return df
[ "def", "load_df_from_file", "(", "file_path", ",", "sep", "=", "\",\"", ",", "header", "=", "0", ")", ":", "with", "tf", ".", "gfile", ".", "Open", "(", "file_path", ")", "as", "infile", ":", "df", "=", "pd", ".", "read_csv", "(", "infile", ",", "s...
Wrapper around pandas' read_csv.
[ "Wrapper", "around", "pandas", "read_csv", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/util.py#L34-L38
train
Wrapper around pandas read_csv.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/util.py
serialize_to_file
def serialize_to_file(obj, file_name, append=False): """Pickle obj to file_name.""" logging.info("Serializing to file %s.", file_name) with tf.gfile.Open(file_name, "a+" if append else "wb") as output_file: pickle.dump(obj, output_file) logging.info("Done serializing to file %s.", file_name)
python
def serialize_to_file(obj, file_name, append=False): """Pickle obj to file_name.""" logging.info("Serializing to file %s.", file_name) with tf.gfile.Open(file_name, "a+" if append else "wb") as output_file: pickle.dump(obj, output_file) logging.info("Done serializing to file %s.", file_name)
[ "def", "serialize_to_file", "(", "obj", ",", "file_name", ",", "append", "=", "False", ")", ":", "logging", ".", "info", "(", "\"Serializing to file %s.\"", ",", "file_name", ")", "with", "tf", ".", "gfile", ".", "Open", "(", "file_name", ",", "\"a+\"", "i...
Pickle obj to file_name.
[ "Pickle", "obj", "to", "file_name", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/util.py#L62-L67
train
Pickle obj to file_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,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/util.py
savez_two_column
def savez_two_column(matrix, row_offset, file_name, append=False): """Savez_compressed obj to file_name.""" logging.info("Saving obj to file in two column .npz format %s.", file_name) tc = [] for u, items in enumerate(matrix): user = row_offset + u for item in items: tc.append([user, item]) n...
python
def savez_two_column(matrix, row_offset, file_name, append=False): """Savez_compressed obj to file_name.""" logging.info("Saving obj to file in two column .npz format %s.", file_name) tc = [] for u, items in enumerate(matrix): user = row_offset + u for item in items: tc.append([user, item]) n...
[ "def", "savez_two_column", "(", "matrix", ",", "row_offset", ",", "file_name", ",", "append", "=", "False", ")", ":", "logging", ".", "info", "(", "\"Saving obj to file in two column .npz format %s.\"", ",", "file_name", ")", "tc", "=", "[", "]", "for", "u", "...
Savez_compressed obj to file_name.
[ "Savez_compressed", "obj", "to", "file_name", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/util.py#L69-L79
train
Save a compressed matrix to file_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,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/util.py
sorted_product_set
def sorted_product_set(array_a, array_b): """Compute the product set of array_a and array_b and sort it.""" return np.sort( np.concatenate( [array_a[i] * array_b for i in xrange(len(array_a))], axis=0) )[::-1]
python
def sorted_product_set(array_a, array_b): """Compute the product set of array_a and array_b and sort it.""" return np.sort( np.concatenate( [array_a[i] * array_b for i in xrange(len(array_a))], axis=0) )[::-1]
[ "def", "sorted_product_set", "(", "array_a", ",", "array_b", ")", ":", "return", "np", ".", "sort", "(", "np", ".", "concatenate", "(", "[", "array_a", "[", "i", "]", "*", "array_b", "for", "i", "in", "xrange", "(", "len", "(", "array_a", ")", ")", ...
Compute the product set of array_a and array_b and sort it.
[ "Compute", "the", "product", "set", "of", "array_a", "and", "array_b", "and", "sort", "it", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/util.py#L81-L86
train
Compute the product set of array_a and array_b and sort it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/matcher.py
Matcher.set_low_quality_matches_
def set_low_quality_matches_(self, matches, all_matches, match_quality_matrix): """ Produce additional matches for predictions that have only low-quality matches. Specifically, for each ground-truth find the set of predictions that have maximum overlap with it (including ties); for each ...
python
def set_low_quality_matches_(self, matches, all_matches, match_quality_matrix): """ Produce additional matches for predictions that have only low-quality matches. Specifically, for each ground-truth find the set of predictions that have maximum overlap with it (including ties); for each ...
[ "def", "set_low_quality_matches_", "(", "self", ",", "matches", ",", "all_matches", ",", "match_quality_matrix", ")", ":", "# For each gt, find the prediction with which it has highest quality", "highest_quality_foreach_gt", ",", "_", "=", "match_quality_matrix", ".", "max", ...
Produce additional matches for predictions that have only low-quality matches. Specifically, for each ground-truth find the set of predictions that have maximum overlap with it (including ties); for each prediction in that set, if it is unmatched, then match it to the ground-truth with which it ...
[ "Produce", "additional", "matches", "for", "predictions", "that", "have", "only", "low", "-", "quality", "matches", ".", "Specifically", "for", "each", "ground", "-", "truth", "find", "the", "set", "of", "predictions", "that", "have", "maximum", "overlap", "wi...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/matcher.py#L83-L112
train
Sets the given list of matches that have only low - quality matches.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py
eval_detection_voc
def eval_detection_voc(pred_boxlists, gt_boxlists, iou_thresh=0.5, use_07_metric=False): """Evaluate on voc dataset. Args: pred_boxlists(list[BoxList]): pred boxlist, has labels and scores fields. gt_boxlists(list[BoxList]): ground truth boxlist, has labels field. iou_thresh: iou thresh ...
python
def eval_detection_voc(pred_boxlists, gt_boxlists, iou_thresh=0.5, use_07_metric=False): """Evaluate on voc dataset. Args: pred_boxlists(list[BoxList]): pred boxlist, has labels and scores fields. gt_boxlists(list[BoxList]): ground truth boxlist, has labels field. iou_thresh: iou thresh ...
[ "def", "eval_detection_voc", "(", "pred_boxlists", ",", "gt_boxlists", ",", "iou_thresh", "=", "0.5", ",", "use_07_metric", "=", "False", ")", ":", "assert", "len", "(", "gt_boxlists", ")", "==", "len", "(", "pred_boxlists", ")", ",", "\"Length of gt and pred li...
Evaluate on voc dataset. Args: pred_boxlists(list[BoxList]): pred boxlist, has labels and scores fields. gt_boxlists(list[BoxList]): ground truth boxlist, has labels field. iou_thresh: iou thresh use_07_metric: boolean Returns: dict represents the results
[ "Evaluate", "on", "voc", "dataset", ".", "Args", ":", "pred_boxlists", "(", "list", "[", "BoxList", "]", ")", ":", "pred", "boxlist", "has", "labels", "and", "scores", "fields", ".", "gt_boxlists", "(", "list", "[", "BoxList", "]", ")", ":", "ground", ...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py#L48-L65
train
Evaluate on voc 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,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py
calc_detection_voc_prec_rec
def calc_detection_voc_prec_rec(gt_boxlists, pred_boxlists, iou_thresh=0.5): """Calculate precision and recall based on evaluation code of PASCAL VOC. This function calculates precision and recall of predicted bounding boxes obtained from a dataset which has :math:`N` images. The code is based on th...
python
def calc_detection_voc_prec_rec(gt_boxlists, pred_boxlists, iou_thresh=0.5): """Calculate precision and recall based on evaluation code of PASCAL VOC. This function calculates precision and recall of predicted bounding boxes obtained from a dataset which has :math:`N` images. The code is based on th...
[ "def", "calc_detection_voc_prec_rec", "(", "gt_boxlists", ",", "pred_boxlists", ",", "iou_thresh", "=", "0.5", ")", ":", "n_pos", "=", "defaultdict", "(", "int", ")", "score", "=", "defaultdict", "(", "list", ")", "match", "=", "defaultdict", "(", "list", ")...
Calculate precision and recall based on evaluation code of PASCAL VOC. This function calculates precision and recall of predicted bounding boxes obtained from a dataset which has :math:`N` images. The code is based on the evaluation code used in PASCAL VOC Challenge.
[ "Calculate", "precision", "and", "recall", "based", "on", "evaluation", "code", "of", "PASCAL", "VOC", ".", "This", "function", "calculates", "precision", "and", "recall", "of", "predicted", "bounding", "boxes", "obtained", "from", "a", "dataset", "which", "has"...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py#L68-L157
train
Calculates precision and recall of a detection VOC based on evaluation code of PASCAL VOC Challenge.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py
calc_detection_voc_ap
def calc_detection_voc_ap(prec, rec, use_07_metric=False): """Calculate average precisions based on evaluation code of PASCAL VOC. This function calculates average precisions from given precisions and recalls. The code is based on the evaluation code used in PASCAL VOC Challenge. Args: prec ...
python
def calc_detection_voc_ap(prec, rec, use_07_metric=False): """Calculate average precisions based on evaluation code of PASCAL VOC. This function calculates average precisions from given precisions and recalls. The code is based on the evaluation code used in PASCAL VOC Challenge. Args: prec ...
[ "def", "calc_detection_voc_ap", "(", "prec", ",", "rec", ",", "use_07_metric", "=", "False", ")", ":", "n_fg_class", "=", "len", "(", "prec", ")", "ap", "=", "np", ".", "empty", "(", "n_fg_class", ")", "for", "l", "in", "range", "(", "n_fg_class", ")",...
Calculate average precisions based on evaluation code of PASCAL VOC. This function calculates average precisions from given precisions and recalls. The code is based on the evaluation code used in PASCAL VOC Challenge. Args: prec (list of numpy.array): A list of arrays. :obj:`prec[l]...
[ "Calculate", "average", "precisions", "based", "on", "evaluation", "code", "of", "PASCAL", "VOC", ".", "This", "function", "calculates", "average", "precisions", "from", "given", "precisions", "and", "recalls", ".", "The", "code", "is", "based", "on", "the", "...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py#L160-L216
train
Calculates the average precisions of a given set of precisions and recalls.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py
RPNPostProcessor.add_gt_proposals
def add_gt_proposals(self, proposals, targets): """ Arguments: proposals: list[BoxList] targets: list[BoxList] """ # Get the device we're operating on device = proposals[0].bbox.device gt_boxes = [target.copy_with_fields([]) for target in targets]...
python
def add_gt_proposals(self, proposals, targets): """ Arguments: proposals: list[BoxList] targets: list[BoxList] """ # Get the device we're operating on device = proposals[0].bbox.device gt_boxes = [target.copy_with_fields([]) for target in targets]...
[ "def", "add_gt_proposals", "(", "self", ",", "proposals", ",", "targets", ")", ":", "# Get the device we're operating on", "device", "=", "proposals", "[", "0", "]", ".", "bbox", ".", "device", "gt_boxes", "=", "[", "target", ".", "copy_with_fields", "(", "[",...
Arguments: proposals: list[BoxList] targets: list[BoxList]
[ "Arguments", ":", "proposals", ":", "list", "[", "BoxList", "]", "targets", ":", "list", "[", "BoxList", "]" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py#L51-L72
train
Add the objectness of the given proposals to the target list.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py
RPNPostProcessor.forward_for_single_feature_map
def forward_for_single_feature_map(self, anchors, objectness, box_regression): """ Arguments: anchors: list[BoxList] objectness: tensor of size N, A, H, W box_regression: tensor of size N, A * 4, H, W """ device = objectness.device N, A, H, W =...
python
def forward_for_single_feature_map(self, anchors, objectness, box_regression): """ Arguments: anchors: list[BoxList] objectness: tensor of size N, A, H, W box_regression: tensor of size N, A * 4, H, W """ device = objectness.device N, A, H, W =...
[ "def", "forward_for_single_feature_map", "(", "self", ",", "anchors", ",", "objectness", ",", "box_regression", ")", ":", "device", "=", "objectness", ".", "device", "N", ",", "A", ",", "H", ",", "W", "=", "objectness", ".", "shape", "# put in the same format ...
Arguments: anchors: list[BoxList] objectness: tensor of size N, A, H, W box_regression: tensor of size N, A * 4, H, W
[ "Arguments", ":", "anchors", ":", "list", "[", "BoxList", "]", "objectness", ":", "tensor", "of", "size", "N", "A", "H", "W", "box_regression", ":", "tensor", "of", "size", "N", "A", "*", "4", "H", "W" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py#L74-L121
train
Forward for single feature map.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py
RPNPostProcessor.forward
def forward(self, anchors, objectness, box_regression, targets=None): """ Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after ...
python
def forward(self, anchors, objectness, box_regression, targets=None): """ Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after ...
[ "def", "forward", "(", "self", ",", "anchors", ",", "objectness", ",", "box_regression", ",", "targets", "=", "None", ")", ":", "sampled_boxes", "=", "[", "]", "num_levels", "=", "len", "(", "objectness", ")", "anchors", "=", "list", "(", "zip", "(", "...
Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after applying box decoding and NMS
[ "Arguments", ":", "anchors", ":", "list", "[", "list", "[", "BoxList", "]]", "objectness", ":", "list", "[", "tensor", "]", "box_regression", ":", "list", "[", "tensor", "]" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py#L123-L150
train
Forward the list of anchors objectness and box regression and return a list of boxlists.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/random_matrix_ops.py
_dropout_sparse_coo_matrix
def _dropout_sparse_coo_matrix(sparse_matrix, rate, min_dropout_rate, max_dropout_rate): """Drop values from a sparse matrix encoded as a SciPy coo matrix. Args: sparse_matrix: a SciPy coo sparse matrix. rate: if rate > 0 then non-zero elements of the input matrix will ...
python
def _dropout_sparse_coo_matrix(sparse_matrix, rate, min_dropout_rate, max_dropout_rate): """Drop values from a sparse matrix encoded as a SciPy coo matrix. Args: sparse_matrix: a SciPy coo sparse matrix. rate: if rate > 0 then non-zero elements of the input matrix will ...
[ "def", "_dropout_sparse_coo_matrix", "(", "sparse_matrix", ",", "rate", ",", "min_dropout_rate", ",", "max_dropout_rate", ")", ":", "if", "min_dropout_rate", "is", "None", ":", "min_dropout_rate", "=", "FLAGS", ".", "min_dropout_rate", "if", "max_dropout_rate", "is", ...
Drop values from a sparse matrix encoded as a SciPy coo matrix. Args: sparse_matrix: a SciPy coo sparse matrix. rate: if rate > 0 then non-zero elements of the input matrix will be droped uniformly at random. min_dropout_rate: minimum value for the dropout rate. If None FLAGS.min_dropout_rate...
[ "Drop", "values", "from", "a", "sparse", "matrix", "encoded", "as", "a", "SciPy", "coo", "matrix", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/random_matrix_ops.py#L53-L103
train
Drop values from a sparse matrix encoded as a SciPy coo matrix.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/random_matrix_ops.py
shuffle_sparse_coo_matrix
def shuffle_sparse_coo_matrix(sparse_matrix, dropout_rate=0.0, min_dropout_rate=None, max_dropout_rate=None): """Shuffle sparse matrix encoded as a SciPy coo matrix. Args: sparse_matrix: a SciPy coo sparse matrix. dropout_rate: if dropout_rate > 0 then non-zero elements of the...
python
def shuffle_sparse_coo_matrix(sparse_matrix, dropout_rate=0.0, min_dropout_rate=None, max_dropout_rate=None): """Shuffle sparse matrix encoded as a SciPy coo matrix. Args: sparse_matrix: a SciPy coo sparse matrix. dropout_rate: if dropout_rate > 0 then non-zero elements of the...
[ "def", "shuffle_sparse_coo_matrix", "(", "sparse_matrix", ",", "dropout_rate", "=", "0.0", ",", "min_dropout_rate", "=", "None", ",", "max_dropout_rate", "=", "None", ")", ":", "if", "(", "dropout_rate", "<", "0.0", ")", "or", "(", "dropout_rate", ">=", "1.0",...
Shuffle sparse matrix encoded as a SciPy coo matrix. Args: sparse_matrix: a SciPy coo sparse matrix. dropout_rate: if dropout_rate > 0 then non-zero elements of the input matrix will be droped uniformly at random. min_dropout_rate: minimum value for the dropout rate. If None FLAGS.min_dropout...
[ "Shuffle", "sparse", "matrix", "encoded", "as", "a", "SciPy", "coo", "matrix", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/random_matrix_ops.py#L106-L139
train
Shuffle a sparse matrix encoded as a SciPy csr_matrix.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/selfplay.py
play
def play(network): """Plays out a self-play match, returning a MCTSPlayer object containing: - the final position - the n x 362 tensor of floats representing the mcts search probabilities - the n-ary tensor of floats representing the original value-net estimate where n is the numbe...
python
def play(network): """Plays out a self-play match, returning a MCTSPlayer object containing: - the final position - the n x 362 tensor of floats representing the mcts search probabilities - the n-ary tensor of floats representing the original value-net estimate where n is the numbe...
[ "def", "play", "(", "network", ")", ":", "readouts", "=", "FLAGS", ".", "num_readouts", "# defined in strategies.py", "# Disable resign in 5% of games", "if", "random", ".", "random", "(", ")", "<", "FLAGS", ".", "resign_disable_pct", ":", "resign_threshold", "=", ...
Plays out a self-play match, returning a MCTSPlayer object containing: - the final position - the n x 362 tensor of floats representing the mcts search probabilities - the n-ary tensor of floats representing the original value-net estimate where n is the number of moves in the game
[ "Plays", "out", "a", "self", "-", "play", "match", "returning", "a", "MCTSPlayer", "object", "containing", ":", "-", "the", "final", "position", "-", "the", "n", "x", "362", "tensor", "of", "floats", "representing", "the", "mcts", "search", "probabilities", ...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/selfplay.py#L49-L107
train
Plays out a self - play match.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/selfplay.py
run_game
def run_game(load_file, selfplay_dir=None, holdout_dir=None, sgf_dir=None, holdout_pct=0.05): """Takes a played game and record results and game data.""" if sgf_dir is not None: minimal_sgf_dir = os.path.join(sgf_dir, 'clean') full_sgf_dir = os.path.join(sgf_dir, 'full') uti...
python
def run_game(load_file, selfplay_dir=None, holdout_dir=None, sgf_dir=None, holdout_pct=0.05): """Takes a played game and record results and game data.""" if sgf_dir is not None: minimal_sgf_dir = os.path.join(sgf_dir, 'clean') full_sgf_dir = os.path.join(sgf_dir, 'full') uti...
[ "def", "run_game", "(", "load_file", ",", "selfplay_dir", "=", "None", ",", "holdout_dir", "=", "None", ",", "sgf_dir", "=", "None", ",", "holdout_pct", "=", "0.05", ")", ":", "if", "sgf_dir", "is", "not", "None", ":", "minimal_sgf_dir", "=", "os", ".", ...
Takes a played game and record results and game data.
[ "Takes", "a", "played", "game", "and", "record", "results", "and", "game", "data", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/selfplay.py#L110-L147
train
Takes a played game and record results and game 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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/selfplay.py
main
def main(argv): """Entry point for running one selfplay game.""" del argv # Unused flags.mark_flag_as_required('load_file') run_game( load_file=FLAGS.load_file, selfplay_dir=FLAGS.selfplay_dir, holdout_dir=FLAGS.holdout_dir, holdout_pct=FLAGS.holdout_pct, sgf_di...
python
def main(argv): """Entry point for running one selfplay game.""" del argv # Unused flags.mark_flag_as_required('load_file') run_game( load_file=FLAGS.load_file, selfplay_dir=FLAGS.selfplay_dir, holdout_dir=FLAGS.holdout_dir, holdout_pct=FLAGS.holdout_pct, sgf_di...
[ "def", "main", "(", "argv", ")", ":", "del", "argv", "# Unused", "flags", ".", "mark_flag_as_required", "(", "'load_file'", ")", "run_game", "(", "load_file", "=", "FLAGS", ".", "load_file", ",", "selfplay_dir", "=", "FLAGS", ".", "selfplay_dir", ",", "holdo...
Entry point for running one selfplay game.
[ "Entry", "point", "for", "running", "one", "selfplay", "game", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/selfplay.py#L150-L160
train
Entry point for running one selfplay game.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/graph_reduction.py
resize_matrix
def resize_matrix(usv, num_rows, num_cols): """Apply algorith 2 in https://arxiv.org/pdf/1901.08910.pdf. Args: usv: matrix to reduce given in SVD form with the spectrum s in increasing order. num_rows: number of rows in the output matrix. num_cols: number of columns in the output matrix. Return...
python
def resize_matrix(usv, num_rows, num_cols): """Apply algorith 2 in https://arxiv.org/pdf/1901.08910.pdf. Args: usv: matrix to reduce given in SVD form with the spectrum s in increasing order. num_rows: number of rows in the output matrix. num_cols: number of columns in the output matrix. Return...
[ "def", "resize_matrix", "(", "usv", ",", "num_rows", ",", "num_cols", ")", ":", "u", ",", "s", ",", "v", "=", "usv", "k", "=", "min", "(", "num_rows", ",", "num_cols", ")", "u_random_proj", "=", "transform", ".", "resize", "(", "u", "[", ":", ",", ...
Apply algorith 2 in https://arxiv.org/pdf/1901.08910.pdf. Args: usv: matrix to reduce given in SVD form with the spectrum s in increasing order. num_rows: number of rows in the output matrix. num_cols: number of columns in the output matrix. Returns: A resized version of (u, s, v) whose non z...
[ "Apply", "algorith", "2", "in", "https", ":", "//", "arxiv", ".", "org", "/", "pdf", "/", "1901", ".", "08910", ".", "pdf", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/graph_reduction.py#L36-L58
train
Resizes a given matrix to reduce given in SVD form with the spectrum s in increasing 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,cKsTbNGL...
mlperf/training
data_generation/fractal_graph_expansions/graph_reduction.py
normalize_matrix
def normalize_matrix(matrix): """Fold all values of the matrix into [0, 1].""" abs_matrix = np.abs(matrix.copy()) return abs_matrix / abs_matrix.max()
python
def normalize_matrix(matrix): """Fold all values of the matrix into [0, 1].""" abs_matrix = np.abs(matrix.copy()) return abs_matrix / abs_matrix.max()
[ "def", "normalize_matrix", "(", "matrix", ")", ":", "abs_matrix", "=", "np", ".", "abs", "(", "matrix", ".", "copy", "(", ")", ")", "return", "abs_matrix", "/", "abs_matrix", ".", "max", "(", ")" ]
Fold all values of the matrix into [0, 1].
[ "Fold", "all", "values", "of", "the", "matrix", "into", "[", "0", "1", "]", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/data_generation/fractal_graph_expansions/graph_reduction.py#L61-L64
train
Fold all values of the matrix into [ 0 1 ).
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
translation/tensorflow/transformer/translate.py
_get_sorted_inputs
def _get_sorted_inputs(filename): """Read and sort lines from the file sorted by decreasing length. Args: filename: String name of file to read inputs from. Returns: Sorted list of inputs, and dictionary mapping original index->sorted index of each element. """ with tf.gfile.Open(filename) as f: ...
python
def _get_sorted_inputs(filename): """Read and sort lines from the file sorted by decreasing length. Args: filename: String name of file to read inputs from. Returns: Sorted list of inputs, and dictionary mapping original index->sorted index of each element. """ with tf.gfile.Open(filename) as f: ...
[ "def", "_get_sorted_inputs", "(", "filename", ")", ":", "with", "tf", ".", "gfile", ".", "Open", "(", "filename", ")", "as", "f", ":", "records", "=", "f", ".", "read", "(", ")", ".", "split", "(", "\"\\n\"", ")", "inputs", "=", "[", "record", ".",...
Read and sort lines from the file sorted by decreasing length. Args: filename: String name of file to read inputs from. Returns: Sorted list of inputs, and dictionary mapping original index->sorted index of each element.
[ "Read", "and", "sort", "lines", "from", "the", "file", "sorted", "by", "decreasing", "length", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/translate.py#L39-L62
train
Read and sort lines from the file sorted by decreasing length.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
translation/tensorflow/transformer/translate.py
_trim_and_decode
def _trim_and_decode(ids, subtokenizer): """Trim EOS and PAD tokens from ids, and decode to return a string.""" try: index = list(ids).index(tokenizer.EOS_ID) return subtokenizer.decode(ids[:index]) except ValueError: # No EOS found in sequence return subtokenizer.decode(ids)
python
def _trim_and_decode(ids, subtokenizer): """Trim EOS and PAD tokens from ids, and decode to return a string.""" try: index = list(ids).index(tokenizer.EOS_ID) return subtokenizer.decode(ids[:index]) except ValueError: # No EOS found in sequence return subtokenizer.decode(ids)
[ "def", "_trim_and_decode", "(", "ids", ",", "subtokenizer", ")", ":", "try", ":", "index", "=", "list", "(", "ids", ")", ".", "index", "(", "tokenizer", ".", "EOS_ID", ")", "return", "subtokenizer", ".", "decode", "(", "ids", "[", ":", "index", "]", ...
Trim EOS and PAD tokens from ids, and decode to return a string.
[ "Trim", "EOS", "and", "PAD", "tokens", "from", "ids", "and", "decode", "to", "return", "a", "string", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/translate.py#L70-L76
train
Trim EOS and PAD tokens from ids and decode to return a string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
translation/tensorflow/transformer/translate.py
translate_file
def translate_file( estimator, subtokenizer, input_file, output_file=None, print_all_translations=True): """Translate lines in file, and save to output file if specified. Args: estimator: tf.Estimator used to generate the translations. subtokenizer: Subtokenizer object for encoding and decoding sou...
python
def translate_file( estimator, subtokenizer, input_file, output_file=None, print_all_translations=True): """Translate lines in file, and save to output file if specified. Args: estimator: tf.Estimator used to generate the translations. subtokenizer: Subtokenizer object for encoding and decoding sou...
[ "def", "translate_file", "(", "estimator", ",", "subtokenizer", ",", "input_file", ",", "output_file", "=", "None", ",", "print_all_translations", "=", "True", ")", ":", "batch_size", "=", "_DECODE_BATCH_SIZE", "# Read and sort inputs by length. Keep dictionary (original in...
Translate lines in file, and save to output file if specified. Args: estimator: tf.Estimator used to generate the translations. subtokenizer: Subtokenizer object for encoding and decoding source and translated lines. input_file: file containing lines to translate output_file: file that stores ...
[ "Translate", "lines", "in", "file", "and", "save", "to", "output", "file", "if", "specified", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/translate.py#L79-L137
train
Translate lines in file and save to output file if specified.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
translation/tensorflow/transformer/translate.py
translate_text
def translate_text(estimator, subtokenizer, txt): """Translate a single string.""" encoded_txt = _encode_and_add_eos(txt, subtokenizer) def input_fn(): ds = tf.data.Dataset.from_tensors(encoded_txt) ds = ds.batch(_DECODE_BATCH_SIZE) return ds predictions = estimator.predict(input_fn) translation...
python
def translate_text(estimator, subtokenizer, txt): """Translate a single string.""" encoded_txt = _encode_and_add_eos(txt, subtokenizer) def input_fn(): ds = tf.data.Dataset.from_tensors(encoded_txt) ds = ds.batch(_DECODE_BATCH_SIZE) return ds predictions = estimator.predict(input_fn) translation...
[ "def", "translate_text", "(", "estimator", ",", "subtokenizer", ",", "txt", ")", ":", "encoded_txt", "=", "_encode_and_add_eos", "(", "txt", ",", "subtokenizer", ")", "def", "input_fn", "(", ")", ":", "ds", "=", "tf", ".", "data", ".", "Dataset", ".", "f...
Translate a single string.
[ "Translate", "a", "single", "string", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/translate.py#L140-L152
train
Translate a single string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/data/tokenizer.py
Tokenizer.pad_vocabulary
def pad_vocabulary(self, vocab, pad): """ Pads vocabulary to a multiple of 'pad' tokens. :param vocab: list with vocabulary :param pad: integer """ vocab_size = len(vocab) padded_vocab_size = (vocab_size + pad - 1) // pad * pad for i in range(0, padded_vo...
python
def pad_vocabulary(self, vocab, pad): """ Pads vocabulary to a multiple of 'pad' tokens. :param vocab: list with vocabulary :param pad: integer """ vocab_size = len(vocab) padded_vocab_size = (vocab_size + pad - 1) // pad * pad for i in range(0, padded_vo...
[ "def", "pad_vocabulary", "(", "self", ",", "vocab", ",", "pad", ")", ":", "vocab_size", "=", "len", "(", "vocab", ")", "padded_vocab_size", "=", "(", "vocab_size", "+", "pad", "-", "1", ")", "//", "pad", "*", "pad", "for", "i", "in", "range", "(", ...
Pads vocabulary to a multiple of 'pad' tokens. :param vocab: list with vocabulary :param pad: integer
[ "Pads", "vocabulary", "to", "a", "multiple", "of", "pad", "tokens", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/data/tokenizer.py#L44-L56
train
Pads the vocabulary to a multiple of pad tokens.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/data/tokenizer.py
Tokenizer.segment
def segment(self, line): """ Tokenizes single sentence and adds special BOS and EOS tokens. :param line: sentence returns: list representing tokenized sentence """ line = line.strip().split() entry = [self.tok2idx[i] for i in line] entry = [config.BOS] +...
python
def segment(self, line): """ Tokenizes single sentence and adds special BOS and EOS tokens. :param line: sentence returns: list representing tokenized sentence """ line = line.strip().split() entry = [self.tok2idx[i] for i in line] entry = [config.BOS] +...
[ "def", "segment", "(", "self", ",", "line", ")", ":", "line", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "entry", "=", "[", "self", ".", "tok2idx", "[", "i", "]", "for", "i", "in", "line", "]", "entry", "=", "[", "config", "...
Tokenizes single sentence and adds special BOS and EOS tokens. :param line: sentence returns: list representing tokenized sentence
[ "Tokenizes", "single", "sentence", "and", "adds", "special", "BOS", "and", "EOS", "tokens", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/data/tokenizer.py#L75-L86
train
Tokenizes a single sentence and adds special BOS and EOS tokens.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/data/tokenizer.py
Tokenizer.detokenize
def detokenize(self, inputs, delim=' '): """ Detokenizes single sentence and removes token separator characters. :param inputs: sequence of tokens :param delim: tokenization delimiter returns: string representing detokenized sentence """ detok = delim.join([self...
python
def detokenize(self, inputs, delim=' '): """ Detokenizes single sentence and removes token separator characters. :param inputs: sequence of tokens :param delim: tokenization delimiter returns: string representing detokenized sentence """ detok = delim.join([self...
[ "def", "detokenize", "(", "self", ",", "inputs", ",", "delim", "=", "' '", ")", ":", "detok", "=", "delim", ".", "join", "(", "[", "self", ".", "idx2tok", "[", "idx", "]", "for", "idx", "in", "inputs", "]", ")", "detok", "=", "detok", ".", "repla...
Detokenizes single sentence and removes token separator characters. :param inputs: sequence of tokens :param delim: tokenization delimiter returns: string representing detokenized sentence
[ "Detokenizes", "single", "sentence", "and", "removes", "token", "separator", "characters", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/data/tokenizer.py#L88-L105
train
Detokenizes a single sentence and removes token separator characters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/backbone/fpn.py
FPN.forward
def forward(self, x): """ Arguments: x (list[Tensor]): feature maps for each feature level. Returns: results (tuple[Tensor]): feature maps after FPN layers. They are ordered from highest resolution first. """ last_inner = getattr(self, self...
python
def forward(self, x): """ Arguments: x (list[Tensor]): feature maps for each feature level. Returns: results (tuple[Tensor]): feature maps after FPN layers. They are ordered from highest resolution first. """ last_inner = getattr(self, self...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "last_inner", "=", "getattr", "(", "self", ",", "self", ".", "inner_blocks", "[", "-", "1", "]", ")", "(", "x", "[", "-", "1", "]", ")", "results", "=", "[", "]", "results", ".", "append", "(",...
Arguments: x (list[Tensor]): feature maps for each feature level. Returns: results (tuple[Tensor]): feature maps after FPN layers. They are ordered from highest resolution first.
[ "Arguments", ":", "x", "(", "list", "[", "Tensor", "]", ")", ":", "feature", "maps", "for", "each", "feature", "level", ".", "Returns", ":", "results", "(", "tuple", "[", "Tensor", "]", ")", ":", "feature", "maps", "after", "FPN", "layers", ".", "The...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/backbone/fpn.py#L43-L74
train
Forward the feature maps to the next 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,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/utils/logs/benchmark_uploader.py
BigQueryUploader.upload_benchmark_run
def upload_benchmark_run(self, dataset_name, table_name, run_id): """Upload benchmark run information to Bigquery. Args: dataset_name: string, the name of bigquery dataset where the data will be uploaded. table_name: string, the name of bigquery table under the dataset where the dat...
python
def upload_benchmark_run(self, dataset_name, table_name, run_id): """Upload benchmark run information to Bigquery. Args: dataset_name: string, the name of bigquery dataset where the data will be uploaded. table_name: string, the name of bigquery table under the dataset where the dat...
[ "def", "upload_benchmark_run", "(", "self", ",", "dataset_name", ",", "table_name", ",", "run_id", ")", ":", "expected_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_logging_dir", ",", "logger", ".", "BENCHMARK_RUN_LOG_FILE_NAME", ")", "with",...
Upload benchmark run information to Bigquery. Args: dataset_name: string, the name of bigquery dataset where the data will be uploaded. table_name: string, the name of bigquery table under the dataset where the data will be uploaded. run_id: string, a unique ID that will be attach...
[ "Upload", "benchmark", "run", "information", "to", "Bigquery", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/utils/logs/benchmark_uploader.py#L61-L81
train
Uploads benchmark run information to Bigquery.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/utils/logs/benchmark_uploader.py
BigQueryUploader.upload_metric
def upload_metric(self, dataset_name, table_name, run_id): """Upload metric information to Bigquery. Args: dataset_name: string, the name of bigquery dataset where the data will be uploaded. table_name: string, the name of bigquery table under the dataset where the metric data will ...
python
def upload_metric(self, dataset_name, table_name, run_id): """Upload metric information to Bigquery. Args: dataset_name: string, the name of bigquery dataset where the data will be uploaded. table_name: string, the name of bigquery table under the dataset where the metric data will ...
[ "def", "upload_metric", "(", "self", ",", "dataset_name", ",", "table_name", ",", "run_id", ")", ":", "expected_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_logging_dir", ",", "logger", ".", "METRIC_LOG_FILE_NAME", ")", "with", "tf", "."...
Upload metric information to Bigquery. Args: dataset_name: string, the name of bigquery dataset where the data will be uploaded. table_name: string, the name of bigquery table under the dataset where the metric data will be uploaded. This is different from the benchmark_run tabl...
[ "Upload", "metric", "information", "to", "Bigquery", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/utils/logs/benchmark_uploader.py#L83-L108
train
Uploads metric information to Bigquery.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
translation/tensorflow/transformer/compute_bleu.py
bleu_wrapper
def bleu_wrapper(ref_filename, hyp_filename, case_sensitive=False): """Compute BLEU for two files (reference and hypothesis translation).""" ref_lines = tf.gfile.Open(ref_filename).read().strip().splitlines() hyp_lines = tf.gfile.Open(hyp_filename).read().strip().splitlines() if len(ref_lines) != len(hyp_lines...
python
def bleu_wrapper(ref_filename, hyp_filename, case_sensitive=False): """Compute BLEU for two files (reference and hypothesis translation).""" ref_lines = tf.gfile.Open(ref_filename).read().strip().splitlines() hyp_lines = tf.gfile.Open(hyp_filename).read().strip().splitlines() if len(ref_lines) != len(hyp_lines...
[ "def", "bleu_wrapper", "(", "ref_filename", ",", "hyp_filename", ",", "case_sensitive", "=", "False", ")", ":", "ref_lines", "=", "tf", ".", "gfile", ".", "Open", "(", "ref_filename", ")", ".", "read", "(", ")", ".", "strip", "(", ")", ".", "splitlines",...
Compute BLEU for two files (reference and hypothesis translation).
[ "Compute", "BLEU", "for", "two", "files", "(", "reference", "and", "hypothesis", "translation", ")", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/compute_bleu.py#L83-L96
train
Compute BLEU for two files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/evaluate.py
play_match
def play_match(black_model, white_model, games, sgf_dir): """Plays matches between two neural nets. Args: black_model: Path to the model for black player white_model: Path to the model for white player """ with utils.logged_timer("Loading weights"): black_net = dual_net.DualNetw...
python
def play_match(black_model, white_model, games, sgf_dir): """Plays matches between two neural nets. Args: black_model: Path to the model for black player white_model: Path to the model for white player """ with utils.logged_timer("Loading weights"): black_net = dual_net.DualNetw...
[ "def", "play_match", "(", "black_model", ",", "white_model", ",", "games", ",", "sgf_dir", ")", ":", "with", "utils", ".", "logged_timer", "(", "\"Loading weights\"", ")", ":", "black_net", "=", "dual_net", ".", "DualNetwork", "(", "black_model", ")", "white_n...
Plays matches between two neural nets. Args: black_model: Path to the model for black player white_model: Path to the model for white player
[ "Plays", "matches", "between", "two", "neural", "nets", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/evaluate.py#L38-L111
train
Plays matches between two neural nets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/evaluate.py
main
def main(argv): """Play matches between two neural nets.""" _, black_model, white_model = argv utils.ensure_dir_exists(FLAGS.eval_sgf_dir) play_match(black_model, white_model, FLAGS.num_evaluation_games, FLAGS.eval_sgf_dir)
python
def main(argv): """Play matches between two neural nets.""" _, black_model, white_model = argv utils.ensure_dir_exists(FLAGS.eval_sgf_dir) play_match(black_model, white_model, FLAGS.num_evaluation_games, FLAGS.eval_sgf_dir)
[ "def", "main", "(", "argv", ")", ":", "_", ",", "black_model", ",", "white_model", "=", "argv", "utils", ".", "ensure_dir_exists", "(", "FLAGS", ".", "eval_sgf_dir", ")", "play_match", "(", "black_model", ",", "white_model", ",", "FLAGS", ".", "num_evaluatio...
Play matches between two neural nets.
[ "Play", "matches", "between", "two", "neural", "nets", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/evaluate.py#L114-L118
train
Play matches between two neural nets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/scripts/filter_dataset.py
main
def main(): """ Discards all pairs of sentences which can't be decoded by latin-1 encoder. It aims to filter out sentences with rare unicode glyphs and pairs which are most likely not valid English-German sentences. Examples of discarded sentences: ✿★★★Hommage au king de la pop ★★★✿ ✿★★★Q...
python
def main(): """ Discards all pairs of sentences which can't be decoded by latin-1 encoder. It aims to filter out sentences with rare unicode glyphs and pairs which are most likely not valid English-German sentences. Examples of discarded sentences: ✿★★★Hommage au king de la pop ★★★✿ ✿★★★Q...
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "c", "=", "Counter", "(", ")", "skipped", "=", "0", "valid", "=", "0", "data1", "=", "[", "]", "data2", "=", "[", "]", "with", "open", "(", "args", ".", "file1", ")", "as", "f...
Discards all pairs of sentences which can't be decoded by latin-1 encoder. It aims to filter out sentences with rare unicode glyphs and pairs which are most likely not valid English-German sentences. Examples of discarded sentences: ✿★★★Hommage au king de la pop ★★★✿ ✿★★★Que son âme repos... ...
[ "Discards", "all", "pairs", "of", "sentences", "which", "can", "t", "be", "decoded", "by", "latin", "-", "1", "encoder", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/scripts/filter_dataset.py#L17-L75
train
This function is used to get the most likely unicode glyphs and pairs of sentences which can t be decoded by latin - 1 encoder.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/box_coder.py
BoxCoder.encode
def encode(self, reference_boxes, proposals): """ Encode a set of proposals with respect to some reference boxes Arguments: reference_boxes (Tensor): reference boxes proposals (Tensor): boxes to be encoded """ TO_REMOVE = 1 # TODO remove ...
python
def encode(self, reference_boxes, proposals): """ Encode a set of proposals with respect to some reference boxes Arguments: reference_boxes (Tensor): reference boxes proposals (Tensor): boxes to be encoded """ TO_REMOVE = 1 # TODO remove ...
[ "def", "encode", "(", "self", ",", "reference_boxes", ",", "proposals", ")", ":", "TO_REMOVE", "=", "1", "# TODO remove", "ex_widths", "=", "proposals", "[", ":", ",", "2", "]", "-", "proposals", "[", ":", ",", "0", "]", "+", "TO_REMOVE", "ex_heights", ...
Encode a set of proposals with respect to some reference boxes Arguments: reference_boxes (Tensor): reference boxes proposals (Tensor): boxes to be encoded
[ "Encode", "a", "set", "of", "proposals", "with", "respect", "to", "some", "reference", "boxes" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/box_coder.py#L22-L50
train
Encode a set of proposals with respect to some reference boxes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/box_coder.py
BoxCoder.decode
def decode(self, rel_codes, boxes): """ From a set of original boxes and encoded relative box offsets, get the decoded boxes. Arguments: rel_codes (Tensor): encoded boxes boxes (Tensor): reference boxes. """ boxes = boxes.to(rel_codes.dtype) ...
python
def decode(self, rel_codes, boxes): """ From a set of original boxes and encoded relative box offsets, get the decoded boxes. Arguments: rel_codes (Tensor): encoded boxes boxes (Tensor): reference boxes. """ boxes = boxes.to(rel_codes.dtype) ...
[ "def", "decode", "(", "self", ",", "rel_codes", ",", "boxes", ")", ":", "boxes", "=", "boxes", ".", "to", "(", "rel_codes", ".", "dtype", ")", "TO_REMOVE", "=", "1", "# TODO remove", "widths", "=", "boxes", "[", ":", ",", "2", "]", "-", "boxes", "[...
From a set of original boxes and encoded relative box offsets, get the decoded boxes. Arguments: rel_codes (Tensor): encoded boxes boxes (Tensor): reference boxes.
[ "From", "a", "set", "of", "original", "boxes", "and", "encoded", "relative", "box", "offsets", "get", "the", "decoded", "boxes", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/box_coder.py#L52-L95
train
This function takes a set of original boxes and encoded relative box offsets and returns a list of tuples containing the original and encoded boxes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/eval_server/launch_eval.py
launch_eval_job
def launch_eval_job(tag, m1_path, m2_path, job_name, completions): """Launches an evaluator job. tag: name for this eval job (used as top level folder name) m1_path, m2_path: full gs:// paths to the .pb files to match up job_name: string, appended to the container, used to differentiate the job name...
python
def launch_eval_job(tag, m1_path, m2_path, job_name, completions): """Launches an evaluator job. tag: name for this eval job (used as top level folder name) m1_path, m2_path: full gs:// paths to the .pb files to match up job_name: string, appended to the container, used to differentiate the job name...
[ "def", "launch_eval_job", "(", "tag", ",", "m1_path", ",", "m2_path", ",", "job_name", ",", "completions", ")", ":", "print", "(", ")", "if", "not", "re", ".", "match", "(", "r'[a-z0-9-]*$'", ",", "tag", ",", "re", ".", "I", ")", ":", "print", "(", ...
Launches an evaluator job. tag: name for this eval job (used as top level folder name) m1_path, m2_path: full gs:// paths to the .pb files to match up job_name: string, appended to the container, used to differentiate the job names (e.g. 'minigo-cc-evaluator-v5-123-v7-456') completions: the number o...
[ "Launches", "an", "evaluator", "job", ".", "tag", ":", "name", "for", "this", "eval", "job", "(", "used", "as", "top", "level", "folder", "name", ")", "m1_path", "m2_path", ":", "full", "gs", ":", "//", "paths", "to", "the", ".", "pb", "files", "to",...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/eval_server/launch_eval.py#L33-L88
train
Launch an evaluator job.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py
launch_eval_job
def launch_eval_job(m1_path, m2_path, job_name, bucket_name, completions=5, flags_path=None): """Launches an evaluator job. m1_path, m2_path: full gs:// paths to the .pb files to match up job_name: string, appended to the container, used to differentiate the job names (e.g. 'minigo-cc-evaluator-...
python
def launch_eval_job(m1_path, m2_path, job_name, bucket_name, completions=5, flags_path=None): """Launches an evaluator job. m1_path, m2_path: full gs:// paths to the .pb files to match up job_name: string, appended to the container, used to differentiate the job names (e.g. 'minigo-cc-evaluator-...
[ "def", "launch_eval_job", "(", "m1_path", ",", "m2_path", ",", "job_name", ",", "bucket_name", ",", "completions", "=", "5", ",", "flags_path", "=", "None", ")", ":", "if", "not", "all", "(", "[", "m1_path", ",", "m2_path", ",", "job_name", ",", "bucket_...
Launches an evaluator job. m1_path, m2_path: full gs:// paths to the .pb files to match up job_name: string, appended to the container, used to differentiate the job names (e.g. 'minigo-cc-evaluator-v5-123-v7-456') bucket_name: Where to write the sgfs, passed into the job as $BUCKET_NAME completions...
[ "Launches", "an", "evaluator", "job", ".", "m1_path", "m2_path", ":", "full", "gs", ":", "//", "paths", "to", "the", ".", "pb", "files", "to", "match", "up", "job_name", ":", "string", "appended", "to", "the", "container", "used", "to", "differentiate", ...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py#L37-L69
train
Launches an evaluator job.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py
same_run_eval
def same_run_eval(black_num=0, white_num=0, completions=4): """Shorthand to spawn a job matching up two models from the same run, identified by their model number """ if black_num <= 0 or white_num <= 0: print("Need real model numbers") return b = fsdb.get_model(black_num) w = fsdb....
python
def same_run_eval(black_num=0, white_num=0, completions=4): """Shorthand to spawn a job matching up two models from the same run, identified by their model number """ if black_num <= 0 or white_num <= 0: print("Need real model numbers") return b = fsdb.get_model(black_num) w = fsdb....
[ "def", "same_run_eval", "(", "black_num", "=", "0", ",", "white_num", "=", "0", ",", "completions", "=", "4", ")", ":", "if", "black_num", "<=", "0", "or", "white_num", "<=", "0", ":", "print", "(", "\"Need real model numbers\"", ")", "return", "b", "=",...
Shorthand to spawn a job matching up two models from the same run, identified by their model number
[ "Shorthand", "to", "spawn", "a", "job", "matching", "up", "two", "models", "from", "the", "same", "run", "identified", "by", "their", "model", "number" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py#L72-L94
train
Spawns a job matching up two models from the same run
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py
_append_pairs
def _append_pairs(new_pairs): """ Load the pairlist, add new stuff, save it out """ desired_pairs = restore_pairs() or [] desired_pairs += new_pairs print("Adding {} new pairs, queue has {} pairs".format(len(new_pairs), len(desired_pairs))) save_pairs(desired_pairs)
python
def _append_pairs(new_pairs): """ Load the pairlist, add new stuff, save it out """ desired_pairs = restore_pairs() or [] desired_pairs += new_pairs print("Adding {} new pairs, queue has {} pairs".format(len(new_pairs), len(desired_pairs))) save_pairs(desired_pairs)
[ "def", "_append_pairs", "(", "new_pairs", ")", ":", "desired_pairs", "=", "restore_pairs", "(", ")", "or", "[", "]", "desired_pairs", "+=", "new_pairs", "print", "(", "\"Adding {} new pairs, queue has {} pairs\"", ".", "format", "(", "len", "(", "new_pairs", ")", ...
Load the pairlist, add new stuff, save it out
[ "Load", "the", "pairlist", "add", "new", "stuff", "save", "it", "out" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py#L97-L102
train
Add new pairs to the pairlist
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py
add_top_pairs
def add_top_pairs(dry_run=False, pair_now=False): """ Pairs up the top twenty models against each other. #1 plays 2,3,4,5, #2 plays 3,4,5,6 etc. for a total of 15*4 matches. Default behavior is to add the pairs to the working pairlist. `pair_now` will immediately create the pairings on the cluster. ...
python
def add_top_pairs(dry_run=False, pair_now=False): """ Pairs up the top twenty models against each other. #1 plays 2,3,4,5, #2 plays 3,4,5,6 etc. for a total of 15*4 matches. Default behavior is to add the pairs to the working pairlist. `pair_now` will immediately create the pairings on the cluster. ...
[ "def", "add_top_pairs", "(", "dry_run", "=", "False", ",", "pair_now", "=", "False", ")", ":", "top", "=", "ratings", ".", "top_n", "(", "15", ")", "new_pairs", "=", "[", "]", "for", "idx", ",", "t", "in", "enumerate", "(", "top", "[", ":", "10", ...
Pairs up the top twenty models against each other. #1 plays 2,3,4,5, #2 plays 3,4,5,6 etc. for a total of 15*4 matches. Default behavior is to add the pairs to the working pairlist. `pair_now` will immediately create the pairings on the cluster. `dry_run` makes it only print the pairings that would be ...
[ "Pairs", "up", "the", "top", "twenty", "models", "against", "each", "other", ".", "#1", "plays", "2", "3", "4", "5", "#2", "plays", "3", "4", "5", "6", "etc", ".", "for", "a", "total", "of", "15", "*", "4", "matches", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py#L113-L133
train
Adds the top pairs to the working pairlist.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py
zoo_loop
def zoo_loop(sgf_dir=None, max_jobs=40): """Manages creating and cleaning up match jobs. - Load whatever pairs didn't get queued last time, and whatever our most recently seen model was. - Loop and... - If a new model is detected, create and append new pairs to the list - Automaticall...
python
def zoo_loop(sgf_dir=None, max_jobs=40): """Manages creating and cleaning up match jobs. - Load whatever pairs didn't get queued last time, and whatever our most recently seen model was. - Loop and... - If a new model is detected, create and append new pairs to the list - Automaticall...
[ "def", "zoo_loop", "(", "sgf_dir", "=", "None", ",", "max_jobs", "=", "40", ")", ":", "desired_pairs", "=", "restore_pairs", "(", ")", "or", "[", "]", "random", ".", "shuffle", "(", "desired_pairs", ")", "last_model_queued", "=", "restore_last_model", "(", ...
Manages creating and cleaning up match jobs. - Load whatever pairs didn't get queued last time, and whatever our most recently seen model was. - Loop and... - If a new model is detected, create and append new pairs to the list - Automatically queue models from a list of pairs to keep a cl...
[ "Manages", "creating", "and", "cleaning", "up", "match", "jobs", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py#L158-L247
train
This function loops through the list of possible match jobs and creates new ones and deletes them if they are too long.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py
cleanup
def cleanup(api_instance=None): """ Remove completed jobs from the cluster """ api = api_instance or get_api() r = api.list_job_for_all_namespaces() delete_opts = kubernetes.client.V1DeleteOptions( propagation_policy="Background") for job in r.items: if job.status.succeeded == jo...
python
def cleanup(api_instance=None): """ Remove completed jobs from the cluster """ api = api_instance or get_api() r = api.list_job_for_all_namespaces() delete_opts = kubernetes.client.V1DeleteOptions( propagation_policy="Background") for job in r.items: if job.status.succeeded == jo...
[ "def", "cleanup", "(", "api_instance", "=", "None", ")", ":", "api", "=", "api_instance", "or", "get_api", "(", ")", "r", "=", "api", ".", "list_job_for_all_namespaces", "(", ")", "delete_opts", "=", "kubernetes", ".", "client", ".", "V1DeleteOptions", "(", ...
Remove completed jobs from the cluster
[ "Remove", "completed", "jobs", "from", "the", "cluster" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/evaluator/launch_eval.py#L279-L289
train
Remove completed jobs from the cluster
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py
convert_coco_stuff_mat
def convert_coco_stuff_mat(data_dir, out_dir): """Convert to png and save json with path. This currently only contains the segmentation labels for objects+stuff in cocostuff - if we need to combine with other labels from original COCO that will be a TODO.""" sets = ['train', 'val'] categories = [] ...
python
def convert_coco_stuff_mat(data_dir, out_dir): """Convert to png and save json with path. This currently only contains the segmentation labels for objects+stuff in cocostuff - if we need to combine with other labels from original COCO that will be a TODO.""" sets = ['train', 'val'] categories = [] ...
[ "def", "convert_coco_stuff_mat", "(", "data_dir", ",", "out_dir", ")", ":", "sets", "=", "[", "'train'", ",", "'val'", "]", "categories", "=", "[", "]", "json_name", "=", "'coco_stuff_%s.json'", "ann_dict", "=", "{", "}", "for", "data_set", "in", "sets", "...
Convert to png and save json with path. This currently only contains the segmentation labels for objects+stuff in cocostuff - if we need to combine with other labels from original COCO that will be a TODO.
[ "Convert", "to", "png", "and", "save", "json", "with", "path", ".", "This", "currently", "only", "contains", "the", "segmentation", "labels", "for", "objects", "+", "stuff", "in", "cocostuff", "-", "if", "we", "need", "to", "combine", "with", "other", "lab...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py#L53-L90
train
Convert to png and save json with path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py
convert_cityscapes_instance_only
def convert_cityscapes_instance_only( data_dir, out_dir): """Convert from cityscapes format to COCO instance seg format - polygons""" sets = [ 'gtFine_val', 'gtFine_train', 'gtFine_test', # 'gtCoarse_train', # 'gtCoarse_val', # 'gtCoarse_train_extra' ...
python
def convert_cityscapes_instance_only( data_dir, out_dir): """Convert from cityscapes format to COCO instance seg format - polygons""" sets = [ 'gtFine_val', 'gtFine_train', 'gtFine_test', # 'gtCoarse_train', # 'gtCoarse_val', # 'gtCoarse_train_extra' ...
[ "def", "convert_cityscapes_instance_only", "(", "data_dir", ",", "out_dir", ")", ":", "sets", "=", "[", "'gtFine_val'", ",", "'gtFine_train'", ",", "'gtFine_test'", ",", "# 'gtCoarse_train',", "# 'gtCoarse_val',", "# 'gtCoarse_train_extra'", "]", "ann_dirs", "=", "[", ...
Convert from cityscapes format to COCO instance seg format - polygons
[ "Convert", "from", "cityscapes", "format", "to", "COCO", "instance", "seg", "format", "-", "polygons" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py#L101-L211
train
Convert from cityscapes format to COCO instance seg format - polygons
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/cluster/ringmaster/setup_ringmaster.py
get_mg_path
def get_mg_path(model_run, model_num): """ model_run = integer, e.g. 15, 16, corresponding to the v-number model_num = integer, e.g 939, for the model number in that run """ fsdb.switch_base("minigo-pub/v{:d}-19x19".format(model_run)) model = fsdb.get_model(model_num) return os.path.join(fsd...
python
def get_mg_path(model_run, model_num): """ model_run = integer, e.g. 15, 16, corresponding to the v-number model_num = integer, e.g 939, for the model number in that run """ fsdb.switch_base("minigo-pub/v{:d}-19x19".format(model_run)) model = fsdb.get_model(model_num) return os.path.join(fsd...
[ "def", "get_mg_path", "(", "model_run", ",", "model_num", ")", ":", "fsdb", ".", "switch_base", "(", "\"minigo-pub/v{:d}-19x19\"", ".", "format", "(", "model_run", ")", ")", "model", "=", "fsdb", ".", "get_model", "(", "model_num", ")", "return", "os", ".", ...
model_run = integer, e.g. 15, 16, corresponding to the v-number model_num = integer, e.g 939, for the model number in that run
[ "model_run", "=", "integer", "e", ".", "g", ".", "15", "16", "corresponding", "to", "the", "v", "-", "number", "model_num", "=", "integer", "e", ".", "g", "939", "for", "the", "model", "number", "in", "that", "run" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/cluster/ringmaster/setup_ringmaster.py#L47-L54
train
Get the path to the MG file for a given model run and model number.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
make_single_array
def make_single_array(ds, batch_size=8*1024): """Create a single numpy array from a dataset. The dataset must have only one dimension, that is, the length of its `output_shapes` and `output_types` is 1, and its output shape must be `[]`, that is, every tensor in the dataset must be a scalar. A...
python
def make_single_array(ds, batch_size=8*1024): """Create a single numpy array from a dataset. The dataset must have only one dimension, that is, the length of its `output_shapes` and `output_types` is 1, and its output shape must be `[]`, that is, every tensor in the dataset must be a scalar. A...
[ "def", "make_single_array", "(", "ds", ",", "batch_size", "=", "8", "*", "1024", ")", ":", "if", "isinstance", "(", "ds", ".", "output_types", ",", "tuple", ")", "or", "isinstance", "(", "ds", ".", "output_shapes", ",", "tuple", ")", ":", "raise", "Val...
Create a single numpy array from a dataset. The dataset must have only one dimension, that is, the length of its `output_shapes` and `output_types` is 1, and its output shape must be `[]`, that is, every tensor in the dataset must be a scalar. Args: ds: a TF Dataset. batch_size: how ...
[ "Create", "a", "single", "numpy", "array", "from", "a", "dataset", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L106-L141
train
Create a single numpy array from a TF 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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
_histogram_move_keys_by_game
def _histogram_move_keys_by_game(sess, ds, batch_size=8*1024): """Given dataset of key names, return histogram of moves/game. Move counts are written by the game players, so this is mostly useful for repair or backfill. Args: sess: TF session ds: TF dataset containing game move keys. ...
python
def _histogram_move_keys_by_game(sess, ds, batch_size=8*1024): """Given dataset of key names, return histogram of moves/game. Move counts are written by the game players, so this is mostly useful for repair or backfill. Args: sess: TF session ds: TF dataset containing game move keys. ...
[ "def", "_histogram_move_keys_by_game", "(", "sess", ",", "ds", ",", "batch_size", "=", "8", "*", "1024", ")", ":", "ds", "=", "ds", ".", "batch", "(", "batch_size", ")", "# Turns 'g_0000001234_m_133' into 'g_0000001234'", "ds", "=", "ds", ".", "map", "(", "l...
Given dataset of key names, return histogram of moves/game. Move counts are written by the game players, so this is mostly useful for repair or backfill. Args: sess: TF session ds: TF dataset containing game move keys. batch_size: performance tuning parameter
[ "Given", "dataset", "of", "key", "names", "return", "histogram", "of", "moves", "/", "game", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L144-L168
train
Given dataset of key names return histogram of moves and game players.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
_game_keys_as_array
def _game_keys_as_array(ds): """Turn keys of a Bigtable dataset into an array. Take g_GGG_m_MMM and create GGG.MMM numbers. Valuable when visualizing the distribution of a given dataset in the game keyspace. """ ds = ds.map(lambda row_key, cell: row_key) # want 'g_0000001234_m_133' is '000...
python
def _game_keys_as_array(ds): """Turn keys of a Bigtable dataset into an array. Take g_GGG_m_MMM and create GGG.MMM numbers. Valuable when visualizing the distribution of a given dataset in the game keyspace. """ ds = ds.map(lambda row_key, cell: row_key) # want 'g_0000001234_m_133' is '000...
[ "def", "_game_keys_as_array", "(", "ds", ")", ":", "ds", "=", "ds", ".", "map", "(", "lambda", "row_key", ",", "cell", ":", "row_key", ")", "# want 'g_0000001234_m_133' is '0000001234.133' and so forth", "ds", "=", "ds", ".", "map", "(", "lambda", "x", ":", ...
Turn keys of a Bigtable dataset into an array. Take g_GGG_m_MMM and create GGG.MMM numbers. Valuable when visualizing the distribution of a given dataset in the game keyspace.
[ "Turn", "keys", "of", "a", "Bigtable", "dataset", "into", "an", "array", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L171-L186
train
Turn keys of a Bigtable dataset into an array.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
_delete_rows
def _delete_rows(args): """Delete the given row keys from the given Bigtable. The args are (BigtableSpec, row_keys), but are passed as a single argument in order to work with multiprocessing.Pool.map. This is also the reason why this is a top-level function instead of a method. """ btspec...
python
def _delete_rows(args): """Delete the given row keys from the given Bigtable. The args are (BigtableSpec, row_keys), but are passed as a single argument in order to work with multiprocessing.Pool.map. This is also the reason why this is a top-level function instead of a method. """ btspec...
[ "def", "_delete_rows", "(", "args", ")", ":", "btspec", ",", "row_keys", "=", "args", "bt_table", "=", "bigtable", ".", "Client", "(", "btspec", ".", "project", ")", ".", "instance", "(", "btspec", ".", "instance", ")", ".", "table", "(", "btspec", "."...
Delete the given row keys from the given Bigtable. The args are (BigtableSpec, row_keys), but are passed as a single argument in order to work with multiprocessing.Pool.map. This is also the reason why this is a top-level function instead of a method.
[ "Delete", "the", "given", "row", "keys", "from", "the", "given", "Bigtable", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L189-L205
train
Delete the given row keys from the given Bigtable.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
set_fresh_watermark
def set_fresh_watermark(game_queue, count_from, window_size, fresh_fraction=0.05, minimum_fresh=20000): """Sets the metadata cell used to block until some quantity of games have been played. This sets the 'freshness mark' on the `game_queue`, used to block training until enough new ...
python
def set_fresh_watermark(game_queue, count_from, window_size, fresh_fraction=0.05, minimum_fresh=20000): """Sets the metadata cell used to block until some quantity of games have been played. This sets the 'freshness mark' on the `game_queue`, used to block training until enough new ...
[ "def", "set_fresh_watermark", "(", "game_queue", ",", "count_from", ",", "window_size", ",", "fresh_fraction", "=", "0.05", ",", "minimum_fresh", "=", "20000", ")", ":", "already_played", "=", "game_queue", ".", "latest_game_number", "-", "count_from", "print", "(...
Sets the metadata cell used to block until some quantity of games have been played. This sets the 'freshness mark' on the `game_queue`, used to block training until enough new games have been played. The number of fresh games required is the larger of: - The fraction of the total window size ...
[ "Sets", "the", "metadata", "cell", "used", "to", "block", "until", "some", "quantity", "of", "games", "have", "been", "played", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L574-L599
train
Sets the metadata cell used to block until enough new games have been played.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
get_unparsed_moves_from_last_n_games
def get_unparsed_moves_from_last_n_games(games, games_nr, n, moves=2**21, shuffle=True, column_family=TFEXAMPLE, column='example', ...
python
def get_unparsed_moves_from_last_n_games(games, games_nr, n, moves=2**21, shuffle=True, column_family=TFEXAMPLE, column='example', ...
[ "def", "get_unparsed_moves_from_last_n_games", "(", "games", ",", "games_nr", ",", "n", ",", "moves", "=", "2", "**", "21", ",", "shuffle", "=", "True", ",", "column_family", "=", "TFEXAMPLE", ",", "column", "=", "'example'", ",", "values_only", "=", "True",...
Get a dataset of serialized TFExamples from the last N games. Args: games, games_nr: GameQueues of the regular selfplay and calibration (aka 'no resign') games to sample from. n: an integer indicating how many past games should be sourced. moves: an integer indicating how many moves sho...
[ "Get", "a", "dataset", "of", "serialized", "TFExamples", "from", "the", "last", "N", "games", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L602-L651
train
Get a dataset of serialized TFExamples from the last n games.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
count_elements_in_dataset
def count_elements_in_dataset(ds, batch_size=1*1024, parallel_batch=8): """Count and return all the elements in the given dataset. Debugging function. The elements in a dataset cannot be counted without enumerating all of them. By counting in batch and in parallel, this method allows rapid traversal ...
python
def count_elements_in_dataset(ds, batch_size=1*1024, parallel_batch=8): """Count and return all the elements in the given dataset. Debugging function. The elements in a dataset cannot be counted without enumerating all of them. By counting in batch and in parallel, this method allows rapid traversal ...
[ "def", "count_elements_in_dataset", "(", "ds", ",", "batch_size", "=", "1", "*", "1024", ",", "parallel_batch", "=", "8", ")", ":", "with", "tf", ".", "Session", "(", ")", "as", "sess", ":", "dsc", "=", "ds", ".", "apply", "(", "tf", ".", "contrib", ...
Count and return all the elements in the given dataset. Debugging function. The elements in a dataset cannot be counted without enumerating all of them. By counting in batch and in parallel, this method allows rapid traversal of the dataset. Args: ds: The dataset whose elements should be coun...
[ "Count", "and", "return", "all", "the", "elements", "in", "the", "given", "dataset", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L654-L687
train
Count and return all the elements in 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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.create
def create(self): """Create the table underlying the queue. Create the 'metadata' and 'tfexample' column families and their properties. """ if self.bt_table.exists(): utils.dbg('Table already exists') return max_versions_rule = bigtable_column_fa...
python
def create(self): """Create the table underlying the queue. Create the 'metadata' and 'tfexample' column families and their properties. """ if self.bt_table.exists(): utils.dbg('Table already exists') return max_versions_rule = bigtable_column_fa...
[ "def", "create", "(", "self", ")", ":", "if", "self", ".", "bt_table", ".", "exists", "(", ")", ":", "utils", ".", "dbg", "(", "'Table already exists'", ")", "return", "max_versions_rule", "=", "bigtable_column_family", ".", "MaxVersionsGCRule", "(", "1", ")...
Create the table underlying the queue. Create the 'metadata' and 'tfexample' column families and their properties.
[ "Create", "the", "table", "underlying", "the", "queue", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L231-L244
train
Create the table underlying the queue.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.games_by_time
def games_by_time(self, start_game, end_game): """Given a range of games, return the games sorted by time. Returns [(time, game_number), ...] The time will be a `datetime.datetime` and the game number is the integer used as the basis of the row ID. Note that when a cluster of ...
python
def games_by_time(self, start_game, end_game): """Given a range of games, return the games sorted by time. Returns [(time, game_number), ...] The time will be a `datetime.datetime` and the game number is the integer used as the basis of the row ID. Note that when a cluster of ...
[ "def", "games_by_time", "(", "self", ",", "start_game", ",", "end_game", ")", ":", "move_count", "=", "b'move_count'", "rows", "=", "self", ".", "bt_table", ".", "read_rows", "(", "ROWCOUNT_PREFIX", ".", "format", "(", "start_game", ")", ",", "ROWCOUNT_PREFIX"...
Given a range of games, return the games sorted by time. Returns [(time, game_number), ...] The time will be a `datetime.datetime` and the game number is the integer used as the basis of the row ID. Note that when a cluster of self-play nodes are writing concurrently, the game...
[ "Given", "a", "range", "of", "games", "return", "the", "games", "sorted", "by", "time", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L263-L285
train
Given a range of games return the games sorted by time.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.delete_row_range
def delete_row_range(self, format_str, start_game, end_game): """Delete rows related to the given game range. Args: format_str: a string to `.format()` by the game numbers in order to create the row prefixes. start_game: the starting game number of the deletion. ...
python
def delete_row_range(self, format_str, start_game, end_game): """Delete rows related to the given game range. Args: format_str: a string to `.format()` by the game numbers in order to create the row prefixes. start_game: the starting game number of the deletion. ...
[ "def", "delete_row_range", "(", "self", ",", "format_str", ",", "start_game", ",", "end_game", ")", ":", "row_keys", "=", "make_single_array", "(", "self", ".", "tf_table", ".", "keys_by_range_dataset", "(", "format_str", ".", "format", "(", "start_game", ")", ...
Delete rows related to the given game range. Args: format_str: a string to `.format()` by the game numbers in order to create the row prefixes. start_game: the starting game number of the deletion. end_game: the ending game number of the deletion.
[ "Delete", "rows", "related", "to", "the", "given", "game", "range", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L287-L329
train
Delete rows related to the given game range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.trim_games_since
def trim_games_since(self, t, max_games=500000): """Trim off the games since the given time. Search back no more than max_games for this time point, locate the game there, and remove all games since that game, resetting the latest game counter. If `t` is a `datetime.timedelta`,...
python
def trim_games_since(self, t, max_games=500000): """Trim off the games since the given time. Search back no more than max_games for this time point, locate the game there, and remove all games since that game, resetting the latest game counter. If `t` is a `datetime.timedelta`,...
[ "def", "trim_games_since", "(", "self", ",", "t", ",", "max_games", "=", "500000", ")", ":", "latest", "=", "self", ".", "latest_game_number", "earliest", "=", "int", "(", "latest", "-", "max_games", ")", "gbt", "=", "self", ".", "games_by_time", "(", "e...
Trim off the games since the given time. Search back no more than max_games for this time point, locate the game there, and remove all games since that game, resetting the latest game counter. If `t` is a `datetime.timedelta`, then the target time will be found by subtracting t...
[ "Trim", "off", "the", "games", "since", "the", "given", "time", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L331-L363
train
Trim off the games since the given time.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.bleakest_moves
def bleakest_moves(self, start_game, end_game): """Given a range of games, return the bleakest moves. Returns a list of (game, move, q) sorted by q. """ bleak = b'bleakest_q' rows = self.bt_table.read_rows( ROW_PREFIX.format(start_game), ROW_PREFIX.format...
python
def bleakest_moves(self, start_game, end_game): """Given a range of games, return the bleakest moves. Returns a list of (game, move, q) sorted by q. """ bleak = b'bleakest_q' rows = self.bt_table.read_rows( ROW_PREFIX.format(start_game), ROW_PREFIX.format...
[ "def", "bleakest_moves", "(", "self", ",", "start_game", ",", "end_game", ")", ":", "bleak", "=", "b'bleakest_q'", "rows", "=", "self", ".", "bt_table", ".", "read_rows", "(", "ROW_PREFIX", ".", "format", "(", "start_game", ")", ",", "ROW_PREFIX", ".", "fo...
Given a range of games, return the bleakest moves. Returns a list of (game, move, q) sorted by q.
[ "Given", "a", "range", "of", "games", "return", "the", "bleakest", "moves", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L365-L382
train
Given a range of games return the bleakest moves.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.require_fresh_games
def require_fresh_games(self, number_fresh): """Require a given number of fresh games to be played. Args: number_fresh: integer, number of new fresh games needed Increments the cell `table_state=metadata:wait_for_game_number` by the given number of games. This will cause ...
python
def require_fresh_games(self, number_fresh): """Require a given number of fresh games to be played. Args: number_fresh: integer, number of new fresh games needed Increments the cell `table_state=metadata:wait_for_game_number` by the given number of games. This will cause ...
[ "def", "require_fresh_games", "(", "self", ",", "number_fresh", ")", ":", "latest", "=", "self", ".", "latest_game_number", "table_state", "=", "self", ".", "bt_table", ".", "row", "(", "TABLE_STATE", ")", "table_state", ".", "set_cell", "(", "METADATA", ",", ...
Require a given number of fresh games to be played. Args: number_fresh: integer, number of new fresh games needed Increments the cell `table_state=metadata:wait_for_game_number` by the given number of games. This will cause `self.wait_for_fresh_games()` to block until the g...
[ "Require", "a", "given", "number", "of", "fresh", "games", "to", "be", "played", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L384-L399
train
This is a private method that allows the user to require a given number of new fresh games.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.wait_for_fresh_games
def wait_for_fresh_games(self, poll_interval=15.0): """Block caller until required new games have been played. Args: poll_interval: number of seconds to wait between checks If the cell `table_state=metadata:wait_for_game_number` exists, then block the caller, checking every ...
python
def wait_for_fresh_games(self, poll_interval=15.0): """Block caller until required new games have been played. Args: poll_interval: number of seconds to wait between checks If the cell `table_state=metadata:wait_for_game_number` exists, then block the caller, checking every ...
[ "def", "wait_for_fresh_games", "(", "self", ",", "poll_interval", "=", "15.0", ")", ":", "wait_until_game", "=", "self", ".", "read_wait_cell", "(", ")", "if", "not", "wait_until_game", ":", "return", "latest_game", "=", "self", ".", "latest_game_number", "last_...
Block caller until required new games have been played. Args: poll_interval: number of seconds to wait between checks If the cell `table_state=metadata:wait_for_game_number` exists, then block the caller, checking every `poll_interval` seconds, until `table_state=metadata:ga...
[ "Block", "caller", "until", "required", "new", "games", "have", "been", "played", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L401-L427
train
Block the caller until required new games have been played.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.read_wait_cell
def read_wait_cell(self): """Read the value of the cell holding the 'wait' value, Returns the int value of whatever it has, or None if the cell doesn't exist. """ table_state = self.bt_table.read_row( TABLE_STATE, filter_=bigtable_row_filters.ColumnRange...
python
def read_wait_cell(self): """Read the value of the cell holding the 'wait' value, Returns the int value of whatever it has, or None if the cell doesn't exist. """ table_state = self.bt_table.read_row( TABLE_STATE, filter_=bigtable_row_filters.ColumnRange...
[ "def", "read_wait_cell", "(", "self", ")", ":", "table_state", "=", "self", ".", "bt_table", ".", "read_row", "(", "TABLE_STATE", ",", "filter_", "=", "bigtable_row_filters", ".", "ColumnRangeFilter", "(", "METADATA", ",", "WAIT_CELL", ",", "WAIT_CELL", ")", "...
Read the value of the cell holding the 'wait' value, Returns the int value of whatever it has, or None if the cell doesn't exist.
[ "Read", "the", "value", "of", "the", "cell", "holding", "the", "wait", "value" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L429-L450
train
Read the value of the cell holding the wait value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.count_moves_in_game_range
def count_moves_in_game_range(self, game_begin, game_end): """Count the total moves in a game range. Args: game_begin: integer, starting game game_end: integer, ending game Uses the `ct_` keyspace for rapid move summary. """ rows = self.bt_table.read_rows(...
python
def count_moves_in_game_range(self, game_begin, game_end): """Count the total moves in a game range. Args: game_begin: integer, starting game game_end: integer, ending game Uses the `ct_` keyspace for rapid move summary. """ rows = self.bt_table.read_rows(...
[ "def", "count_moves_in_game_range", "(", "self", ",", "game_begin", ",", "game_end", ")", ":", "rows", "=", "self", ".", "bt_table", ".", "read_rows", "(", "ROWCOUNT_PREFIX", ".", "format", "(", "game_begin", ")", ",", "ROWCOUNT_PREFIX", ".", "format", "(", ...
Count the total moves in a game range. Args: game_begin: integer, starting game game_end: integer, ending game Uses the `ct_` keyspace for rapid move summary.
[ "Count", "the", "total", "moves", "in", "a", "game", "range", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L452-L466
train
Counts the total number of moves in a game range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.moves_from_games
def moves_from_games(self, start_game, end_game, moves, shuffle, column_family, column): """Dataset of samples and/or shuffled moves from game range. Args: n: an integer indicating how many past games should be sourced. moves: an integer indicating how man...
python
def moves_from_games(self, start_game, end_game, moves, shuffle, column_family, column): """Dataset of samples and/or shuffled moves from game range. Args: n: an integer indicating how many past games should be sourced. moves: an integer indicating how man...
[ "def", "moves_from_games", "(", "self", ",", "start_game", ",", "end_game", ",", "moves", ",", "shuffle", ",", "column_family", ",", "column", ")", ":", "start_row", "=", "ROW_PREFIX", ".", "format", "(", "start_game", ")", "end_row", "=", "ROW_PREFIX", ".",...
Dataset of samples and/or shuffled moves from game range. Args: n: an integer indicating how many past games should be sourced. moves: an integer indicating how many moves should be sampled from those N games. column_family: name of the column family containing move...
[ "Dataset", "of", "samples", "and", "/", "or", "shuffled", "moves", "from", "game", "range", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L468-L500
train
Returns a dataset of samples and shuffled moves from the given game range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.moves_from_last_n_games
def moves_from_last_n_games(self, n, moves, shuffle, column_family, column): """Randomly choose a given number of moves from the last n games. Args: n: number of games at the end of this GameQueue to source. moves: number of moves to be sampled from...
python
def moves_from_last_n_games(self, n, moves, shuffle, column_family, column): """Randomly choose a given number of moves from the last n games. Args: n: number of games at the end of this GameQueue to source. moves: number of moves to be sampled from...
[ "def", "moves_from_last_n_games", "(", "self", ",", "n", ",", "moves", ",", "shuffle", ",", "column_family", ",", "column", ")", ":", "self", ".", "wait_for_fresh_games", "(", ")", "latest_game", "=", "self", ".", "latest_game_number", "utils", ".", "dbg", "...
Randomly choose a given number of moves from the last n games. Args: n: number of games at the end of this GameQueue to source. moves: number of moves to be sampled from `n` games. shuffle: if True, shuffle the selected moves. column_family: name of the column family...
[ "Randomly", "choose", "a", "given", "number", "of", "moves", "from", "the", "last", "n", "games", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L502-L525
train
Randomly choose a given number of moves from the last n games.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue._write_move_counts
def _write_move_counts(self, sess, h): """Add move counts from the given histogram to the table. Used to update the move counts in an existing table. Should not be needed except for backfill or repair. Args: sess: TF session to use for doing a Bigtable write. tf_t...
python
def _write_move_counts(self, sess, h): """Add move counts from the given histogram to the table. Used to update the move counts in an existing table. Should not be needed except for backfill or repair. Args: sess: TF session to use for doing a Bigtable write. tf_t...
[ "def", "_write_move_counts", "(", "self", ",", "sess", ",", "h", ")", ":", "def", "gen", "(", ")", ":", "for", "k", ",", "v", "in", "h", ".", "items", "(", ")", ":", "# The keys in the histogram may be of type 'bytes'", "k", "=", "str", "(", "k", ",", ...
Add move counts from the given histogram to the table. Used to update the move counts in an existing table. Should not be needed except for backfill or repair. Args: sess: TF session to use for doing a Bigtable write. tf_table: TF Cloud Bigtable to use for writing. ...
[ "Add", "move", "counts", "from", "the", "given", "histogram", "to", "the", "table", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L527-L550
train
Add move counts from the given histogram to the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
GameQueue.update_move_counts
def update_move_counts(self, start_game, end_game, interval=1000): """Used to update the move_count cell for older games. Should not be needed except for backfill or repair. move_count cells will be updated in both g_<game_id>_m_000 rows and ct_<game_id>_<move_count> rows. """ ...
python
def update_move_counts(self, start_game, end_game, interval=1000): """Used to update the move_count cell for older games. Should not be needed except for backfill or repair. move_count cells will be updated in both g_<game_id>_m_000 rows and ct_<game_id>_<move_count> rows. """ ...
[ "def", "update_move_counts", "(", "self", ",", "start_game", ",", "end_game", ",", "interval", "=", "1000", ")", ":", "for", "g", "in", "range", "(", "start_game", ",", "end_game", ",", "interval", ")", ":", "with", "tf", ".", "Session", "(", ")", "as"...
Used to update the move_count cell for older games. Should not be needed except for backfill or repair. move_count cells will be updated in both g_<game_id>_m_000 rows and ct_<game_id>_<move_count> rows.
[ "Used", "to", "update", "the", "move_count", "cell", "for", "older", "games", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L552-L571
train
Used to update the move_count cells for older games.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_main.py
get_filenames
def get_filenames(is_training, data_dir): """Return filenames for dataset.""" if is_training: return [ os.path.join(data_dir, 'train-%05d-of-01024' % i) for i in range(_NUM_TRAIN_FILES)] else: return [ os.path.join(data_dir, 'validation-%05d-of-00128' % i) for i in range(12...
python
def get_filenames(is_training, data_dir): """Return filenames for dataset.""" if is_training: return [ os.path.join(data_dir, 'train-%05d-of-01024' % i) for i in range(_NUM_TRAIN_FILES)] else: return [ os.path.join(data_dir, 'validation-%05d-of-00128' % i) for i in range(12...
[ "def", "get_filenames", "(", "is_training", ",", "data_dir", ")", ":", "if", "is_training", ":", "return", "[", "os", ".", "path", ".", "join", "(", "data_dir", ",", "'train-%05d-of-01024'", "%", "i", ")", "for", "i", "in", "range", "(", "_NUM_TRAIN_FILES"...
Return filenames for dataset.
[ "Return", "filenames", "for", "dataset", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_main.py#L51-L60
train
Return filenames for 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,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_main.py
_parse_example_proto
def _parse_example_proto(example_serialized): """Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields (values are included...
python
def _parse_example_proto(example_serialized): """Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields (values are included...
[ "def", "_parse_example_proto", "(", "example_serialized", ")", ":", "# Dense features in Example proto.", "feature_map", "=", "{", "'image/encoded'", ":", "tf", ".", "FixedLenFeature", "(", "[", "]", ",", "dtype", "=", "tf", ".", "string", ",", "default_value", "=...
Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields (values are included as examples): image/height: 462 image/wid...
[ "Parses", "an", "Example", "proto", "containing", "a", "training", "example", "of", "an", "image", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_main.py#L63-L117
train
Parses an example proto containing a training example of an image.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_main.py
parse_record
def parse_record(raw_record, is_training, dtype): """Parses a record containing a training example of an image. The input record is parsed into a label and image, and the image is passed through preprocessing steps (cropping, flipping, and so on). Args: raw_record: scalar Tensor tf.string containing a ser...
python
def parse_record(raw_record, is_training, dtype): """Parses a record containing a training example of an image. The input record is parsed into a label and image, and the image is passed through preprocessing steps (cropping, flipping, and so on). Args: raw_record: scalar Tensor tf.string containing a ser...
[ "def", "parse_record", "(", "raw_record", ",", "is_training", ",", "dtype", ")", ":", "image_buffer", ",", "label", "=", "_parse_example_proto", "(", "raw_record", ")", "image", "=", "imagenet_preprocessing", ".", "preprocess_image", "(", "image_buffer", "=", "ima...
Parses a record containing a training example of an image. The input record is parsed into a label and image, and the image is passed through preprocessing steps (cropping, flipping, and so on). Args: raw_record: scalar Tensor tf.string containing a serialized Example protocol buffer. is_training:...
[ "Parses", "a", "record", "containing", "a", "training", "example", "of", "an", "image", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_main.py#L120-L145
train
Parses a record containing a training example of an image.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_main.py
input_fn
def input_fn(is_training, data_dir, batch_size, num_epochs=1, num_gpus=None, dtype=tf.float32): """Input function which provides batches for train or eval. Args: is_training: A boolean denoting whether the input is for training. data_dir: The directory containing the input data. batch_size...
python
def input_fn(is_training, data_dir, batch_size, num_epochs=1, num_gpus=None, dtype=tf.float32): """Input function which provides batches for train or eval. Args: is_training: A boolean denoting whether the input is for training. data_dir: The directory containing the input data. batch_size...
[ "def", "input_fn", "(", "is_training", ",", "data_dir", ",", "batch_size", ",", "num_epochs", "=", "1", ",", "num_gpus", "=", "None", ",", "dtype", "=", "tf", ".", "float32", ")", ":", "mlperf_log", ".", "resnet_print", "(", "key", "=", "mlperf_log", "."...
Input function which provides batches for train or eval. Args: is_training: A boolean denoting whether the input is for training. data_dir: The directory containing the input data. batch_size: The number of samples per batch. num_epochs: The number of epochs to repeat the dataset. num_gpus: The n...
[ "Input", "function", "which", "provides", "batches", "for", "train", "or", "eval", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_main.py#L148-L184
train
Input function which provides batches for training or evaluation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_main.py
_get_block_sizes
def _get_block_sizes(resnet_size): """Retrieve the size of each block_layer in the ResNet model. The number of block layers used for the Resnet model varies according to the size of the model. This helper grabs the layer set we want, throwing an error if a non-standard size has been selected. Args: resn...
python
def _get_block_sizes(resnet_size): """Retrieve the size of each block_layer in the ResNet model. The number of block layers used for the Resnet model varies according to the size of the model. This helper grabs the layer set we want, throwing an error if a non-standard size has been selected. Args: resn...
[ "def", "_get_block_sizes", "(", "resnet_size", ")", ":", "choices", "=", "{", "18", ":", "[", "2", ",", "2", ",", "2", ",", "2", "]", ",", "34", ":", "[", "3", ",", "4", ",", "6", ",", "3", "]", ",", "50", ":", "[", "3", ",", "4", ",", ...
Retrieve the size of each block_layer in the ResNet model. The number of block layers used for the Resnet model varies according to the size of the model. This helper grabs the layer set we want, throwing an error if a non-standard size has been selected. Args: resnet_size: The number of convolutional lay...
[ "Retrieve", "the", "size", "of", "each", "block_layer", "in", "the", "ResNet", "model", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_main.py#L242-L273
train
Helper function to get the size of each block_layer in the ResNet 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,cKsTbNGL...
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_main.py
imagenet_model_fn
def imagenet_model_fn(features, labels, mode, params): """Our model_fn for ResNet to be used with our Estimator.""" # Warmup and higher lr may not be valid for fine tuning with small batches # and smaller numbers of training images. if params['fine_tune']: base_lr = .1 else: base_lr = .128 learnin...
python
def imagenet_model_fn(features, labels, mode, params): """Our model_fn for ResNet to be used with our Estimator.""" # Warmup and higher lr may not be valid for fine tuning with small batches # and smaller numbers of training images. if params['fine_tune']: base_lr = .1 else: base_lr = .128 learnin...
[ "def", "imagenet_model_fn", "(", "features", ",", "labels", ",", "mode", ",", "params", ")", ":", "# Warmup and higher lr may not be valid for fine tuning with small batches", "# and smaller numbers of training images.", "if", "params", "[", "'fine_tune'", "]", ":", "base_lr"...
Our model_fn for ResNet to be used with our Estimator.
[ "Our", "model_fn", "for", "ResNet", "to", "be", "used", "with", "our", "Estimator", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_main.py#L276-L308
train
Our model_fn for ResNet to be used with our Estimator.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
gnmt_print
def gnmt_print(*args, **kwargs): """ Wrapper for MLPerf compliance logging calls. All arguments but 'sync' are passed to mlperf_log.gnmt_print function. If 'sync' is set to True then the wrapper will synchronize all distributed workers. 'sync' should be set to True for all compliance tags that requi...
python
def gnmt_print(*args, **kwargs): """ Wrapper for MLPerf compliance logging calls. All arguments but 'sync' are passed to mlperf_log.gnmt_print function. If 'sync' is set to True then the wrapper will synchronize all distributed workers. 'sync' should be set to True for all compliance tags that requi...
[ "def", "gnmt_print", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'sync'", ")", ":", "barrier", "(", ")", "if", "get_rank", "(", ")", "==", "0", ":", "kwargs", "[", "'stack_offset'", "]", "=", "2", "mlper...
Wrapper for MLPerf compliance logging calls. All arguments but 'sync' are passed to mlperf_log.gnmt_print function. If 'sync' is set to True then the wrapper will synchronize all distributed workers. 'sync' should be set to True for all compliance tags that require accurate timing (RUN_START, RUN_STOP e...
[ "Wrapper", "for", "MLPerf", "compliance", "logging", "calls", ".", "All", "arguments", "but", "sync", "are", "passed", "to", "mlperf_log", ".", "gnmt_print", "function", ".", "If", "sync", "is", "set", "to", "True", "then", "the", "wrapper", "will", "synchro...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L16-L28
train
Wrapper for MLPerf compliance logging calls.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
init_lstm_
def init_lstm_(lstm, init_weight=0.1): """ Initializes weights of LSTM layer. Weights and biases are initialized with uniform(-init_weight, init_weight) distribution. :param lstm: instance of torch.nn.LSTM :param init_weight: range for the uniform initializer """ # Initialize hidden-hid...
python
def init_lstm_(lstm, init_weight=0.1): """ Initializes weights of LSTM layer. Weights and biases are initialized with uniform(-init_weight, init_weight) distribution. :param lstm: instance of torch.nn.LSTM :param init_weight: range for the uniform initializer """ # Initialize hidden-hid...
[ "def", "init_lstm_", "(", "lstm", ",", "init_weight", "=", "0.1", ")", ":", "# Initialize hidden-hidden weights", "init", ".", "uniform_", "(", "lstm", ".", "weight_hh_l0", ".", "data", ",", "-", "init_weight", ",", "init_weight", ")", "# Initialize input-hidden w...
Initializes weights of LSTM layer. Weights and biases are initialized with uniform(-init_weight, init_weight) distribution. :param lstm: instance of torch.nn.LSTM :param init_weight: range for the uniform initializer
[ "Initializes", "weights", "of", "LSTM", "layer", ".", "Weights", "and", "biases", "are", "initialized", "with", "uniform", "(", "-", "init_weight", "init_weight", ")", "distribution", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L31-L57
train
Initializes weights and biases of the PyTorch LSTM 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,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
setup_seeds
def setup_seeds(master_seed, epochs, device): """ Generates seeds from one master_seed. Function returns (worker_seeds, shuffling_seeds), worker_seeds are later used to initialize per-worker random number generators (mostly for dropouts), shuffling_seeds are for RNGs resposible for reshuffling the ...
python
def setup_seeds(master_seed, epochs, device): """ Generates seeds from one master_seed. Function returns (worker_seeds, shuffling_seeds), worker_seeds are later used to initialize per-worker random number generators (mostly for dropouts), shuffling_seeds are for RNGs resposible for reshuffling the ...
[ "def", "setup_seeds", "(", "master_seed", ",", "epochs", ",", "device", ")", ":", "if", "master_seed", "is", "None", ":", "# random master seed, random.SystemRandom() uses /dev/urandom on Unix", "master_seed", "=", "random", ".", "SystemRandom", "(", ")", ".", "randin...
Generates seeds from one master_seed. Function returns (worker_seeds, shuffling_seeds), worker_seeds are later used to initialize per-worker random number generators (mostly for dropouts), shuffling_seeds are for RNGs resposible for reshuffling the dataset before each epoch. Seeds are generated on w...
[ "Generates", "seeds", "from", "one", "master_seed", ".", "Function", "returns", "(", "worker_seeds", "shuffling_seeds", ")", "worker_seeds", "are", "later", "used", "to", "initialize", "per", "-", "worker", "random", "number", "generators", "(", "mostly", "for", ...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L86-L127
train
Function creates seeds from one master_seed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
barrier
def barrier(): """ Works as a temporary distributed barrier, currently pytorch doesn't implement barrier for NCCL backend. Calls all_reduce on dummy tensor and synchronizes with GPU. """ if torch.distributed.is_available() and torch.distributed.is_initialized(): torch.distributed.all_red...
python
def barrier(): """ Works as a temporary distributed barrier, currently pytorch doesn't implement barrier for NCCL backend. Calls all_reduce on dummy tensor and synchronizes with GPU. """ if torch.distributed.is_available() and torch.distributed.is_initialized(): torch.distributed.all_red...
[ "def", "barrier", "(", ")", ":", "if", "torch", ".", "distributed", ".", "is_available", "(", ")", "and", "torch", ".", "distributed", ".", "is_initialized", "(", ")", ":", "torch", ".", "distributed", ".", "all_reduce", "(", "torch", ".", "cuda", ".", ...
Works as a temporary distributed barrier, currently pytorch doesn't implement barrier for NCCL backend. Calls all_reduce on dummy tensor and synchronizes with GPU.
[ "Works", "as", "a", "temporary", "distributed", "barrier", "currently", "pytorch", "doesn", "t", "implement", "barrier", "for", "NCCL", "backend", ".", "Calls", "all_reduce", "on", "dummy", "tensor", "and", "synchronizes", "with", "GPU", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L130-L138
train
A temporary distributed barrier for NCCL backend.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
get_rank
def get_rank(): """ Gets distributed rank or returns zero if distributed is not initialized. """ if torch.distributed.is_available() and torch.distributed.is_initialized(): rank = torch.distributed.get_rank() else: rank = 0 return rank
python
def get_rank(): """ Gets distributed rank or returns zero if distributed is not initialized. """ if torch.distributed.is_available() and torch.distributed.is_initialized(): rank = torch.distributed.get_rank() else: rank = 0 return rank
[ "def", "get_rank", "(", ")", ":", "if", "torch", ".", "distributed", ".", "is_available", "(", ")", "and", "torch", ".", "distributed", ".", "is_initialized", "(", ")", ":", "rank", "=", "torch", ".", "distributed", ".", "get_rank", "(", ")", "else", "...
Gets distributed rank or returns zero if distributed is not initialized.
[ "Gets", "distributed", "rank", "or", "returns", "zero", "if", "distributed", "is", "not", "initialized", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L141-L149
train
Gets distributed rank or returns zero if distributed is not initialized
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
get_world_size
def get_world_size(): """ Gets total number of distributed workers or returns one if distributed is not initialized. """ if torch.distributed.is_available() and torch.distributed.is_initialized(): world_size = torch.distributed.get_world_size() else: world_size = 1 return wor...
python
def get_world_size(): """ Gets total number of distributed workers or returns one if distributed is not initialized. """ if torch.distributed.is_available() and torch.distributed.is_initialized(): world_size = torch.distributed.get_world_size() else: world_size = 1 return wor...
[ "def", "get_world_size", "(", ")", ":", "if", "torch", ".", "distributed", ".", "is_available", "(", ")", "and", "torch", ".", "distributed", ".", "is_initialized", "(", ")", ":", "world_size", "=", "torch", ".", "distributed", ".", "get_world_size", "(", ...
Gets total number of distributed workers or returns one if distributed is not initialized.
[ "Gets", "total", "number", "of", "distributed", "workers", "or", "returns", "one", "if", "distributed", "is", "not", "initialized", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L152-L161
train
Gets total number of workers or returns one if distributed is not initialized
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
setup_logging
def setup_logging(log_file=os.devnull): """ Configures logging. By default logs from all workers are printed to the console, entries are prefixed with "N: " where N is the rank of the worker. Logs printed to the console don't include timestaps. Full logs with timestamps are saved to the log_file...
python
def setup_logging(log_file=os.devnull): """ Configures logging. By default logs from all workers are printed to the console, entries are prefixed with "N: " where N is the rank of the worker. Logs printed to the console don't include timestaps. Full logs with timestamps are saved to the log_file...
[ "def", "setup_logging", "(", "log_file", "=", "os", ".", "devnull", ")", ":", "class", "RankFilter", "(", "logging", ".", "Filter", ")", ":", "def", "__init__", "(", "self", ",", "rank", ")", ":", "self", ".", "rank", "=", "rank", "def", "filter", "(...
Configures logging. By default logs from all workers are printed to the console, entries are prefixed with "N: " where N is the rank of the worker. Logs printed to the console don't include timestaps. Full logs with timestamps are saved to the log_file file.
[ "Configures", "logging", ".", "By", "default", "logs", "from", "all", "workers", "are", "printed", "to", "the", "console", "entries", "are", "prefixed", "with", "N", ":", "where", "N", "is", "the", "rank", "of", "the", "worker", ".", "Logs", "printed", "...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L187-L217
train
Configures logging.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
set_device
def set_device(cuda, local_rank): """ Sets device based on local_rank and returns instance of torch.device. :param cuda: if True: use cuda :param local_rank: local rank of the worker """ if cuda: torch.cuda.set_device(local_rank) device = torch.device('cuda') else: d...
python
def set_device(cuda, local_rank): """ Sets device based on local_rank and returns instance of torch.device. :param cuda: if True: use cuda :param local_rank: local rank of the worker """ if cuda: torch.cuda.set_device(local_rank) device = torch.device('cuda') else: d...
[ "def", "set_device", "(", "cuda", ",", "local_rank", ")", ":", "if", "cuda", ":", "torch", ".", "cuda", ".", "set_device", "(", "local_rank", ")", "device", "=", "torch", ".", "device", "(", "'cuda'", ")", "else", ":", "device", "=", "torch", ".", "d...
Sets device based on local_rank and returns instance of torch.device. :param cuda: if True: use cuda :param local_rank: local rank of the worker
[ "Sets", "device", "based", "on", "local_rank", "and", "returns", "instance", "of", "torch", ".", "device", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L220-L232
train
Sets the device based on local_rank and returns instance of torch. device.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
init_distributed
def init_distributed(cuda): """ Initializes distributed backend. :param cuda: (bool) if True initializes nccl backend, if False initializes gloo backend """ world_size = int(os.environ.get('WORLD_SIZE', 1)) distributed = (world_size > 1) if distributed: backend = 'nccl' if c...
python
def init_distributed(cuda): """ Initializes distributed backend. :param cuda: (bool) if True initializes nccl backend, if False initializes gloo backend """ world_size = int(os.environ.get('WORLD_SIZE', 1)) distributed = (world_size > 1) if distributed: backend = 'nccl' if c...
[ "def", "init_distributed", "(", "cuda", ")", ":", "world_size", "=", "int", "(", "os", ".", "environ", ".", "get", "(", "'WORLD_SIZE'", ",", "1", ")", ")", "distributed", "=", "(", "world_size", ">", "1", ")", "if", "distributed", ":", "backend", "=", ...
Initializes distributed backend. :param cuda: (bool) if True initializes nccl backend, if False initializes gloo backend
[ "Initializes", "distributed", "backend", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L235-L249
train
Initializes distributed backend.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
log_env_info
def log_env_info(): """ Prints information about execution environment. """ logging.info('Collecting environment information...') env_info = torch.utils.collect_env.get_pretty_env_info() logging.info(f'{env_info}')
python
def log_env_info(): """ Prints information about execution environment. """ logging.info('Collecting environment information...') env_info = torch.utils.collect_env.get_pretty_env_info() logging.info(f'{env_info}')
[ "def", "log_env_info", "(", ")", ":", "logging", ".", "info", "(", "'Collecting environment information...'", ")", "env_info", "=", "torch", ".", "utils", ".", "collect_env", ".", "get_pretty_env_info", "(", ")", "logging", ".", "info", "(", "f'{env_info}'", ")"...
Prints information about execution environment.
[ "Prints", "information", "about", "execution", "environment", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L252-L258
train
Prints information about execution environment.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
debug_tensor
def debug_tensor(tensor, name): """ Simple utility which helps with debugging. Takes a tensor and outputs: min, max, avg, std, number of NaNs, number of INFs. :param tensor: torch tensor :param name: name of the tensor (only for logging) """ logging.info(name) tensor = tensor.detach...
python
def debug_tensor(tensor, name): """ Simple utility which helps with debugging. Takes a tensor and outputs: min, max, avg, std, number of NaNs, number of INFs. :param tensor: torch tensor :param name: name of the tensor (only for logging) """ logging.info(name) tensor = tensor.detach...
[ "def", "debug_tensor", "(", "tensor", ",", "name", ")", ":", "logging", ".", "info", "(", "name", ")", "tensor", "=", "tensor", ".", "detach", "(", ")", ".", "float", "(", ")", ".", "cpu", "(", ")", ".", "numpy", "(", ")", "logging", ".", "info",...
Simple utility which helps with debugging. Takes a tensor and outputs: min, max, avg, std, number of NaNs, number of INFs. :param tensor: torch tensor :param name: name of the tensor (only for logging)
[ "Simple", "utility", "which", "helps", "with", "debugging", ".", "Takes", "a", "tensor", "and", "outputs", ":", "min", "max", "avg", "std", "number", "of", "NaNs", "number", "of", "INFs", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L338-L351
train
Simple utility which helps with debugging.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
rnn_translator/pytorch/seq2seq/utils.py
AverageMeter.reduce
def reduce(self, op): """ Reduces average value over all workers. :param op: 'sum' or 'mean', reduction operator """ if op not in ('sum', 'mean'): raise NotImplementedError distributed = (get_world_size() > 1) if distributed: # Backward/f...
python
def reduce(self, op): """ Reduces average value over all workers. :param op: 'sum' or 'mean', reduction operator """ if op not in ('sum', 'mean'): raise NotImplementedError distributed = (get_world_size() > 1) if distributed: # Backward/f...
[ "def", "reduce", "(", "self", ",", "op", ")", ":", "if", "op", "not", "in", "(", "'sum'", ",", "'mean'", ")", ":", "raise", "NotImplementedError", "distributed", "=", "(", "get_world_size", "(", ")", ">", "1", ")", "if", "distributed", ":", "# Backward...
Reduces average value over all workers. :param op: 'sum' or 'mean', reduction operator
[ "Reduces", "average", "value", "over", "all", "workers", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/utils.py#L293-L335
train
Reduces the average value over all workers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/data/build.py
build_dataset
def build_dataset(dataset_list, transforms, dataset_catalog, is_train=True): """ Arguments: dataset_list (list[str]): Contains the names of the datasets, i.e., coco_2014_trian, coco_2014_val, etc transforms (callable): transforms to apply to each (image, target) sample datase...
python
def build_dataset(dataset_list, transforms, dataset_catalog, is_train=True): """ Arguments: dataset_list (list[str]): Contains the names of the datasets, i.e., coco_2014_trian, coco_2014_val, etc transforms (callable): transforms to apply to each (image, target) sample datase...
[ "def", "build_dataset", "(", "dataset_list", ",", "transforms", ",", "dataset_catalog", ",", "is_train", "=", "True", ")", ":", "if", "not", "isinstance", "(", "dataset_list", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "RuntimeError", "(", "\"...
Arguments: dataset_list (list[str]): Contains the names of the datasets, i.e., coco_2014_trian, coco_2014_val, etc transforms (callable): transforms to apply to each (image, target) sample dataset_catalog (DatasetCatalog): contains the information on how to construct a da...
[ "Arguments", ":", "dataset_list", "(", "list", "[", "str", "]", ")", ":", "Contains", "the", "names", "of", "the", "datasets", "i", ".", "e", ".", "coco_2014_trian", "coco_2014_val", "etc", "transforms", "(", "callable", ")", ":", "transforms", "to", "appl...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/data/build.py#L17-L58
train
Builds a single dataset from a list of datasets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/structures/image_list.py
to_image_list
def to_image_list(tensors, size_divisible=0): """ tensors can be an ImageList, a torch.Tensor or an iterable of Tensors. It can't be a numpy array. When tensors is an iterable of Tensors, it pads the Tensors with zeros so that they have the same shape """ if isinstance(tensors, torch.Ten...
python
def to_image_list(tensors, size_divisible=0): """ tensors can be an ImageList, a torch.Tensor or an iterable of Tensors. It can't be a numpy array. When tensors is an iterable of Tensors, it pads the Tensors with zeros so that they have the same shape """ if isinstance(tensors, torch.Ten...
[ "def", "to_image_list", "(", "tensors", ",", "size_divisible", "=", "0", ")", ":", "if", "isinstance", "(", "tensors", ",", "torch", ".", "Tensor", ")", "and", "size_divisible", ">", "0", ":", "tensors", "=", "[", "tensors", "]", "if", "isinstance", "(",...
tensors can be an ImageList, a torch.Tensor or an iterable of Tensors. It can't be a numpy array. When tensors is an iterable of Tensors, it pads the Tensors with zeros so that they have the same shape
[ "tensors", "can", "be", "an", "ImageList", "a", "torch", ".", "Tensor", "or", "an", "iterable", "of", "Tensors", ".", "It", "can", "t", "be", "a", "numpy", "array", ".", "When", "tensors", "is", "an", "iterable", "of", "Tensors", "it", "pads", "the", ...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/structures/image_list.py#L29-L70
train
Converts a list of Tensors to a list of ImageLists.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/roi_heads/keypoint_head/keypoint_head.py
ROIKeypointHead.forward
def forward(self, features, proposals, targets=None): """ Arguments: features (list[Tensor]): feature-maps from possibly several levels proposals (list[BoxList]): proposal boxes targets (list[BoxList], optional): the ground-truth targets. Returns: ...
python
def forward(self, features, proposals, targets=None): """ Arguments: features (list[Tensor]): feature-maps from possibly several levels proposals (list[BoxList]): proposal boxes targets (list[BoxList], optional): the ground-truth targets. Returns: ...
[ "def", "forward", "(", "self", ",", "features", ",", "proposals", ",", "targets", "=", "None", ")", ":", "if", "self", ".", "training", ":", "with", "torch", ".", "no_grad", "(", ")", ":", "proposals", "=", "self", ".", "loss_evaluator", ".", "subsampl...
Arguments: features (list[Tensor]): feature-maps from possibly several levels proposals (list[BoxList]): proposal boxes targets (list[BoxList], optional): the ground-truth targets. Returns: x (Tensor): the result of the feature extractor proposals (li...
[ "Arguments", ":", "features", "(", "list", "[", "Tensor", "]", ")", ":", "feature", "-", "maps", "from", "possibly", "several", "levels", "proposals", "(", "list", "[", "BoxList", "]", ")", ":", "proposal", "boxes", "targets", "(", "list", "[", "BoxList"...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/roi_heads/keypoint_head/keypoint_head.py#L18-L46
train
Forward method for the base class.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
get_inference_input
def get_inference_input(): """Set up placeholders for input features/labels. Returns the feature, output tensors that get passed into model_fn.""" return (tf.placeholder(tf.float32, [None, go.N, go.N, features_lib.NEW_FEATURES_PLANES], name='pos_tensor'...
python
def get_inference_input(): """Set up placeholders for input features/labels. Returns the feature, output tensors that get passed into model_fn.""" return (tf.placeholder(tf.float32, [None, go.N, go.N, features_lib.NEW_FEATURES_PLANES], name='pos_tensor'...
[ "def", "get_inference_input", "(", ")", ":", "return", "(", "tf", ".", "placeholder", "(", "tf", ".", "float32", ",", "[", "None", ",", "go", ".", "N", ",", "go", ".", "N", ",", "features_lib", ".", "NEW_FEATURES_PLANES", "]", ",", "name", "=", "'pos...
Set up placeholders for input features/labels. Returns the feature, output tensors that get passed into model_fn.
[ "Set", "up", "placeholders", "for", "input", "features", "/", "labels", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L208-L216
train
Set up placeholders for input features and labels.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
model_fn
def model_fn(features, labels, mode, params): """ Create the model for estimator api Args: features: tensor with shape [BATCH_SIZE, go.N, go.N, features_lib.NEW_FEATURES_PLANES] labels: dict from string to tensor with shape 'pi_tensor': [BATCH_SIZE, go.N * go.N + 1] ...
python
def model_fn(features, labels, mode, params): """ Create the model for estimator api Args: features: tensor with shape [BATCH_SIZE, go.N, go.N, features_lib.NEW_FEATURES_PLANES] labels: dict from string to tensor with shape 'pi_tensor': [BATCH_SIZE, go.N * go.N + 1] ...
[ "def", "model_fn", "(", "features", ",", "labels", ",", "mode", ",", "params", ")", ":", "policy_output", ",", "value_output", ",", "logits", "=", "model_inference_fn", "(", "features", ",", "mode", "==", "tf", ".", "estimator", ".", "ModeKeys", ".", "TRAI...
Create the model for estimator api Args: features: tensor with shape [BATCH_SIZE, go.N, go.N, features_lib.NEW_FEATURES_PLANES] labels: dict from string to tensor with shape 'pi_tensor': [BATCH_SIZE, go.N * go.N + 1] 'value_tensor': [BATCH_SIZE] mode: a t...
[ "Create", "the", "model", "for", "estimator", "api" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L219-L376
train
Create the model for an estimator API.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
model_inference_fn
def model_inference_fn(features, training, params): """Builds just the inference part of the model graph. Args: features: input features tensor. training: True if the model is training. params: A dictionary Returns: (policy_output, value_output, logits) tuple of tensors. ...
python
def model_inference_fn(features, training, params): """Builds just the inference part of the model graph. Args: features: input features tensor. training: True if the model is training. params: A dictionary Returns: (policy_output, value_output, logits) tuple of tensors. ...
[ "def", "model_inference_fn", "(", "features", ",", "training", ",", "params", ")", ":", "mg_batchn", "=", "functools", ".", "partial", "(", "tf", ".", "layers", ".", "batch_normalization", ",", "axis", "=", "-", "1", ",", "momentum", "=", ".95", ",", "ep...
Builds just the inference part of the model graph. Args: features: input features tensor. training: True if the model is training. params: A dictionary Returns: (policy_output, value_output, logits) tuple of tensors.
[ "Builds", "just", "the", "inference", "part", "of", "the", "model", "graph", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L379-L496
train
Builds the inference part of the model graph.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
tpu_model_inference_fn
def tpu_model_inference_fn(features): """Builds the model graph suitable for running on TPU. It does two things: 1) Mark all weights as constant, which improves TPU inference performance because it prevents the weights being transferred to the TPU every call to Session.run(). 2) Adds ...
python
def tpu_model_inference_fn(features): """Builds the model graph suitable for running on TPU. It does two things: 1) Mark all weights as constant, which improves TPU inference performance because it prevents the weights being transferred to the TPU every call to Session.run(). 2) Adds ...
[ "def", "tpu_model_inference_fn", "(", "features", ")", ":", "def", "custom_getter", "(", "getter", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "tf", ".", "control_dependencies", "(", "None", ")", ":", "return", "tf", ".", ...
Builds the model graph suitable for running on TPU. It does two things: 1) Mark all weights as constant, which improves TPU inference performance because it prevents the weights being transferred to the TPU every call to Session.run(). 2) Adds constant to the graph with a unique value and...
[ "Builds", "the", "model", "graph", "suitable", "for", "running", "on", "TPU", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L499-L523
train
Builds the model graph suitable for 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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
bootstrap
def bootstrap(): """Initialize a tf.Estimator run with random initial weights.""" # a bit hacky - forge an initial checkpoint with the name that subsequent # Estimator runs will expect to find. # # Estimator will do this automatically when you call train(), but calling # train() requires data, a...
python
def bootstrap(): """Initialize a tf.Estimator run with random initial weights.""" # a bit hacky - forge an initial checkpoint with the name that subsequent # Estimator runs will expect to find. # # Estimator will do this automatically when you call train(), but calling # train() requires data, a...
[ "def", "bootstrap", "(", ")", ":", "# a bit hacky - forge an initial checkpoint with the name that subsequent", "# Estimator runs will expect to find.", "#", "# Estimator will do this automatically when you call train(), but calling", "# train() requires data, and I didn't feel like creating train...
Initialize a tf.Estimator run with random initial weights.
[ "Initialize", "a", "tf", ".", "Estimator", "run", "with", "random", "initial", "weights", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L582-L599
train
Initialize a tf. Estimator run with random initial weights.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
export_model
def export_model(model_path): """Take the latest checkpoint and copy it to model_path. Assumes that all relevant model files are prefixed by the same name. (For example, foo.index, foo.meta and foo.data-00000-of-00001). Args: model_path: The path (can be a gs:// path) to export model """ ...
python
def export_model(model_path): """Take the latest checkpoint and copy it to model_path. Assumes that all relevant model files are prefixed by the same name. (For example, foo.index, foo.meta and foo.data-00000-of-00001). Args: model_path: The path (can be a gs:// path) to export model """ ...
[ "def", "export_model", "(", "model_path", ")", ":", "estimator", "=", "tf", ".", "estimator", ".", "Estimator", "(", "model_fn", ",", "model_dir", "=", "FLAGS", ".", "work_dir", ",", "params", "=", "FLAGS", ".", "flag_values_dict", "(", ")", ")", "latest_c...
Take the latest checkpoint and copy it to model_path. Assumes that all relevant model files are prefixed by the same name. (For example, foo.index, foo.meta and foo.data-00000-of-00001). Args: model_path: The path (can be a gs:// path) to export model
[ "Take", "the", "latest", "checkpoint", "and", "copy", "it", "to", "model_path", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L602-L619
train
Take the latest checkpoint and copy it to model_path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
freeze_graph_tpu
def freeze_graph_tpu(model_path): """Custom freeze_graph implementation for Cloud TPU.""" assert model_path assert FLAGS.tpu_name if FLAGS.tpu_name.startswith('grpc://'): tpu_grpc_url = FLAGS.tpu_name else: tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver( ...
python
def freeze_graph_tpu(model_path): """Custom freeze_graph implementation for Cloud TPU.""" assert model_path assert FLAGS.tpu_name if FLAGS.tpu_name.startswith('grpc://'): tpu_grpc_url = FLAGS.tpu_name else: tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver( ...
[ "def", "freeze_graph_tpu", "(", "model_path", ")", ":", "assert", "model_path", "assert", "FLAGS", ".", "tpu_name", "if", "FLAGS", ".", "tpu_name", ".", "startswith", "(", "'grpc://'", ")", ":", "tpu_grpc_url", "=", "FLAGS", ".", "tpu_name", "else", ":", "tp...
Custom freeze_graph implementation for Cloud TPU.
[ "Custom", "freeze_graph", "implementation", "for", "Cloud", "TPU", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L630-L671
train
Custom freeze_graph implementation for Cloud 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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/dual_net.py
DualNetwork.initialize_weights
def initialize_weights(self, save_file): """Initialize the weights from the given save_file. Assumes that the graph has been constructed, and the save_file contains weights that match the graph. Used to set the weights to a different version of the player without redifining the e...
python
def initialize_weights(self, save_file): """Initialize the weights from the given save_file. Assumes that the graph has been constructed, and the save_file contains weights that match the graph. Used to set the weights to a different version of the player without redifining the e...
[ "def", "initialize_weights", "(", "self", ",", "save_file", ")", ":", "tf", ".", "train", ".", "Saver", "(", ")", ".", "restore", "(", "self", ".", "sess", ",", "save_file", ")" ]
Initialize the weights from the given save_file. Assumes that the graph has been constructed, and the save_file contains weights that match the graph. Used to set the weights to a different version of the player without redifining the entire graph.
[ "Initialize", "the", "weights", "from", "the", "given", "save_file", ".", "Assumes", "that", "the", "graph", "has", "been", "constructed", "and", "the", "save_file", "contains", "weights", "that", "match", "the", "graph", ".", "Used", "to", "set", "the", "we...
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/dual_net.py#L182-L188
train
Initialize the weights from the given save_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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/mask_flags.py
parse_helpfull_output
def parse_helpfull_output(help_output, regex=FLAG_HELP_RE_PY): """Parses the output of --helpfull. Args: help_output: str, the full output of --helpfull. Returns: A set of flags that are valid flags. """ valid_flags = set() for _, no_prefix, flag_name in regex.findall(help_outp...
python
def parse_helpfull_output(help_output, regex=FLAG_HELP_RE_PY): """Parses the output of --helpfull. Args: help_output: str, the full output of --helpfull. Returns: A set of flags that are valid flags. """ valid_flags = set() for _, no_prefix, flag_name in regex.findall(help_outp...
[ "def", "parse_helpfull_output", "(", "help_output", ",", "regex", "=", "FLAG_HELP_RE_PY", ")", ":", "valid_flags", "=", "set", "(", ")", "for", "_", ",", "no_prefix", ",", "flag_name", "in", "regex", ".", "findall", "(", "help_output", ")", ":", "valid_flags...
Parses the output of --helpfull. Args: help_output: str, the full output of --helpfull. Returns: A set of flags that are valid flags.
[ "Parses", "the", "output", "of", "--", "helpfull", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/mask_flags.py#L50-L64
train
Parses the output of helpfull.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/mask_flags.py
filter_flags
def filter_flags(parsed_flags, valid_flags): """Return the subset of `parsed_flags` that are found in the list `valid_flags`""" def valid_argv(argv): """Figures out if a flag parsed from the flagfile matches a flag in the command about to be run.""" flagname_match = FLAG_RE.match(argv) ...
python
def filter_flags(parsed_flags, valid_flags): """Return the subset of `parsed_flags` that are found in the list `valid_flags`""" def valid_argv(argv): """Figures out if a flag parsed from the flagfile matches a flag in the command about to be run.""" flagname_match = FLAG_RE.match(argv) ...
[ "def", "filter_flags", "(", "parsed_flags", ",", "valid_flags", ")", ":", "def", "valid_argv", "(", "argv", ")", ":", "\"\"\"Figures out if a flag parsed from the flagfile matches a flag in\n the command about to be run.\"\"\"", "flagname_match", "=", "FLAG_RE", ".", "ma...
Return the subset of `parsed_flags` that are found in the list `valid_flags`
[ "Return", "the", "subset", "of", "parsed_flags", "that", "are", "found", "in", "the", "list", "valid_flags" ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/mask_flags.py#L67-L77
train
Return a subset of parsed_flags that are found in the list valid_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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/mask_flags.py
prepare_subprocess_cmd
def prepare_subprocess_cmd(subprocess_cmd): """Prepares a subprocess command by running --helpfull and masking flags. Args: subprocess_cmd: List[str], what would be passed into subprocess.call() i.e. ['python', 'train.py', '--flagfile=flags'] Returns: ['python', 'train.py', '--...
python
def prepare_subprocess_cmd(subprocess_cmd): """Prepares a subprocess command by running --helpfull and masking flags. Args: subprocess_cmd: List[str], what would be passed into subprocess.call() i.e. ['python', 'train.py', '--flagfile=flags'] Returns: ['python', 'train.py', '--...
[ "def", "prepare_subprocess_cmd", "(", "subprocess_cmd", ")", ":", "help_cmd", "=", "subprocess_cmd", "+", "[", "'--helpfull'", "]", "help_output", "=", "subprocess", ".", "run", "(", "help_cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "stdout"...
Prepares a subprocess command by running --helpfull and masking flags. Args: subprocess_cmd: List[str], what would be passed into subprocess.call() i.e. ['python', 'train.py', '--flagfile=flags'] Returns: ['python', 'train.py', '--train_flag=blah', '--more_flags']
[ "Prepares", "a", "subprocess", "command", "by", "running", "--", "helpfull", "and", "masking", "flags", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/mask_flags.py#L80-L100
train
Prepares a subprocess command by running helpfull and masking 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,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/mask_flags.py
run
def run(cmd): """Prepare and run a subprocess cmd, returning a CompletedProcess.""" print("Preparing the following cmd:") cmd = prepare_subprocess_cmd(cmd) print("Running the following cmd:") print('\n'.join(cmd)) return subprocess.run(cmd, stdout=sys.stdout, stderr=sys.stderr)
python
def run(cmd): """Prepare and run a subprocess cmd, returning a CompletedProcess.""" print("Preparing the following cmd:") cmd = prepare_subprocess_cmd(cmd) print("Running the following cmd:") print('\n'.join(cmd)) return subprocess.run(cmd, stdout=sys.stdout, stderr=sys.stderr)
[ "def", "run", "(", "cmd", ")", ":", "print", "(", "\"Preparing the following cmd:\"", ")", "cmd", "=", "prepare_subprocess_cmd", "(", "cmd", ")", "print", "(", "\"Running the following cmd:\"", ")", "print", "(", "'\\n'", ".", "join", "(", "cmd", ")", ")", "...
Prepare and run a subprocess cmd, returning a CompletedProcess.
[ "Prepare", "and", "run", "a", "subprocess", "cmd", "returning", "a", "CompletedProcess", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/mask_flags.py#L103-L109
train
Prepare and run a subprocess cmd returning a CompletedProcess.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mlperf/training
reinforcement/tensorflow/minigo/mask_flags.py
checked_run
def checked_run(cmd): """Prepare and run a subprocess cmd, checking for successful completion.""" completed_process = run(cmd) if completed_process.returncode > 0: print("Command failed! Hanging around in case someone needs a " "docker connection. (Ctrl-C to quit now)") time.s...
python
def checked_run(cmd): """Prepare and run a subprocess cmd, checking for successful completion.""" completed_process = run(cmd) if completed_process.returncode > 0: print("Command failed! Hanging around in case someone needs a " "docker connection. (Ctrl-C to quit now)") time.s...
[ "def", "checked_run", "(", "cmd", ")", ":", "completed_process", "=", "run", "(", "cmd", ")", "if", "completed_process", ".", "returncode", ">", "0", ":", "print", "(", "\"Command failed! Hanging around in case someone needs a \"", "\"docker connection. (Ctrl-C to quit n...
Prepare and run a subprocess cmd, checking for successful completion.
[ "Prepare", "and", "run", "a", "subprocess", "cmd", "checking", "for", "successful", "completion", "." ]
1c6ae725a81d15437a2b2df05cac0673fde5c3a4
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/mask_flags.py#L112-L120
train
Prepare and run a subprocess cmd checking for successful completion.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...