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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10.py | loss | def loss(logits, labels):
"""Add L2Loss to all the trainable variables.
Add summary for "Loss" and "Loss/avg".
Args:
logits: Logits from inference().
labels: Labels from distorted_inputs or inputs(). 1-D tensor
of shape [batch_size]
Returns:
Loss tensor of type float.
"""
# Calcula... | python | def loss(logits, labels):
"""Add L2Loss to all the trainable variables.
Add summary for "Loss" and "Loss/avg".
Args:
logits: Logits from inference().
labels: Labels from distorted_inputs or inputs(). 1-D tensor
of shape [batch_size]
Returns:
Loss tensor of type float.
"""
# Calcula... | [
"def",
"loss",
"(",
"logits",
",",
"labels",
")",
":",
"# Calculate the average cross entropy loss across the batch.",
"labels",
"=",
"tf",
".",
"cast",
"(",
"labels",
",",
"tf",
".",
"int64",
")",
"cross_entropy",
"=",
"tf",
".",
"nn",
".",
"sparse_softmax_cros... | Add L2Loss to all the trainable variables.
Add summary for "Loss" and "Loss/avg".
Args:
logits: Logits from inference().
labels: Labels from distorted_inputs or inputs(). 1-D tensor
of shape [batch_size]
Returns:
Loss tensor of type float. | [
"Add",
"L2Loss",
"to",
"all",
"the",
"trainable",
"variables",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10.py#L274-L295 | train | Adds L2Loss to all the trainable variables. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10.py | _add_loss_summaries | def _add_loss_summaries(total_loss):
"""Add summaries for losses in CIFAR-10 model.
Generates moving average for all losses and associated summaries for
visualizing the performance of the network.
Args:
total_loss: Total loss from loss().
Returns:
loss_averages_op: op for generating moving averages ... | python | def _add_loss_summaries(total_loss):
"""Add summaries for losses in CIFAR-10 model.
Generates moving average for all losses and associated summaries for
visualizing the performance of the network.
Args:
total_loss: Total loss from loss().
Returns:
loss_averages_op: op for generating moving averages ... | [
"def",
"_add_loss_summaries",
"(",
"total_loss",
")",
":",
"# Compute the moving average of all individual losses and the total loss.",
"loss_averages",
"=",
"tf",
".",
"train",
".",
"ExponentialMovingAverage",
"(",
"0.9",
",",
"name",
"=",
"'avg'",
")",
"losses",
"=",
... | Add summaries for losses in CIFAR-10 model.
Generates moving average for all losses and associated summaries for
visualizing the performance of the network.
Args:
total_loss: Total loss from loss().
Returns:
loss_averages_op: op for generating moving averages of losses. | [
"Add",
"summaries",
"for",
"losses",
"in",
"CIFAR",
"-",
"10",
"model",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10.py#L298-L322 | train | Adds summaries for all losses and associated summaries for the total loss. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10.py | train | def train(total_loss, global_step):
"""Train CIFAR-10 model.
Create an optimizer and apply to all trainable variables. Add moving
average for all trainable variables.
Args:
total_loss: Total loss from loss().
global_step: Integer Variable counting the number of training steps
processed.
Return... | python | def train(total_loss, global_step):
"""Train CIFAR-10 model.
Create an optimizer and apply to all trainable variables. Add moving
average for all trainable variables.
Args:
total_loss: Total loss from loss().
global_step: Integer Variable counting the number of training steps
processed.
Return... | [
"def",
"train",
"(",
"total_loss",
",",
"global_step",
")",
":",
"# Variables that affect learning rate.",
"num_batches_per_epoch",
"=",
"NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN",
"/",
"FLAGS",
".",
"batch_size",
"decay_steps",
"=",
"int",
"(",
"num_batches_per_epoch",
"*",
"NUM... | Train CIFAR-10 model.
Create an optimizer and apply to all trainable variables. Add moving
average for all trainable variables.
Args:
total_loss: Total loss from loss().
global_step: Integer Variable counting the number of training steps
processed.
Returns:
train_op: op for training. | [
"Train",
"CIFAR",
"-",
"10",
"model",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10.py#L325-L378 | train | Train CIFAR - 10 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/variables.py | add_variable | def add_variable(var, restore=True):
"""Adds a variable to the MODEL_VARIABLES collection.
Optionally it will add the variable to the VARIABLES_TO_RESTORE collection.
Args:
var: a variable.
restore: whether the variable should be added to the
VARIABLES_TO_RESTORE collection.
"""
collections... | python | def add_variable(var, restore=True):
"""Adds a variable to the MODEL_VARIABLES collection.
Optionally it will add the variable to the VARIABLES_TO_RESTORE collection.
Args:
var: a variable.
restore: whether the variable should be added to the
VARIABLES_TO_RESTORE collection.
"""
collections... | [
"def",
"add_variable",
"(",
"var",
",",
"restore",
"=",
"True",
")",
":",
"collections",
"=",
"[",
"MODEL_VARIABLES",
"]",
"if",
"restore",
":",
"collections",
".",
"append",
"(",
"VARIABLES_TO_RESTORE",
")",
"for",
"collection",
"in",
"collections",
":",
"i... | Adds a variable to the MODEL_VARIABLES collection.
Optionally it will add the variable to the VARIABLES_TO_RESTORE collection.
Args:
var: a variable.
restore: whether the variable should be added to the
VARIABLES_TO_RESTORE collection. | [
"Adds",
"a",
"variable",
"to",
"the",
"MODEL_VARIABLES",
"collection",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/variables.py#L96-L111 | train | Adds a variable to the MODEL_VARIABLES collection. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/variables.py | get_variables | def get_variables(scope=None, suffix=None):
"""Gets the list of variables, filtered by scope and/or suffix.
Args:
scope: an optional scope for filtering the variables to return.
suffix: an optional suffix for filtering the variables to return.
Returns:
a copied list of variables with scope and suffi... | python | def get_variables(scope=None, suffix=None):
"""Gets the list of variables, filtered by scope and/or suffix.
Args:
scope: an optional scope for filtering the variables to return.
suffix: an optional suffix for filtering the variables to return.
Returns:
a copied list of variables with scope and suffi... | [
"def",
"get_variables",
"(",
"scope",
"=",
"None",
",",
"suffix",
"=",
"None",
")",
":",
"candidates",
"=",
"tf",
".",
"get_collection",
"(",
"MODEL_VARIABLES",
",",
"scope",
")",
"[",
":",
"]",
"if",
"suffix",
"is",
"not",
"None",
":",
"candidates",
"... | Gets the list of variables, filtered by scope and/or suffix.
Args:
scope: an optional scope for filtering the variables to return.
suffix: an optional suffix for filtering the variables to return.
Returns:
a copied list of variables with scope and suffix. | [
"Gets",
"the",
"list",
"of",
"variables",
"filtered",
"by",
"scope",
"and",
"/",
"or",
"suffix",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/variables.py#L114-L127 | train | Gets the list of variables filtered by scope and suffix. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/variables.py | get_unique_variable | def get_unique_variable(name):
"""Gets the variable uniquely identified by that name.
Args:
name: a name that uniquely identifies the variable.
Returns:
a tensorflow variable.
Raises:
ValueError: if no variable uniquely identified by the name exists.
"""
candidates = tf.get_collection(tf.Grap... | python | def get_unique_variable(name):
"""Gets the variable uniquely identified by that name.
Args:
name: a name that uniquely identifies the variable.
Returns:
a tensorflow variable.
Raises:
ValueError: if no variable uniquely identified by the name exists.
"""
candidates = tf.get_collection(tf.Grap... | [
"def",
"get_unique_variable",
"(",
"name",
")",
":",
"candidates",
"=",
"tf",
".",
"get_collection",
"(",
"tf",
".",
"GraphKeys",
".",
"GLOBAL_VARIABLES",
",",
"name",
")",
"if",
"not",
"candidates",
":",
"raise",
"ValueError",
"(",
"'Couldnt find variable %s'",... | Gets the variable uniquely identified by that name.
Args:
name: a name that uniquely identifies the variable.
Returns:
a tensorflow variable.
Raises:
ValueError: if no variable uniquely identified by the name exists. | [
"Gets",
"the",
"variable",
"uniquely",
"identified",
"by",
"that",
"name",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/variables.py#L152-L171 | train | Gets the variable uniquely identified by that 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/variables.py | variable_device | def variable_device(device, name):
"""Fix the variable device to colocate its ops."""
if callable(device):
var_name = tf.get_variable_scope().name + '/' + name
var_def = tf.NodeDef(name=var_name, op='Variable')
device = device(var_def)
if device is None:
device = ''
return device | python | def variable_device(device, name):
"""Fix the variable device to colocate its ops."""
if callable(device):
var_name = tf.get_variable_scope().name + '/' + name
var_def = tf.NodeDef(name=var_name, op='Variable')
device = device(var_def)
if device is None:
device = ''
return device | [
"def",
"variable_device",
"(",
"device",
",",
"name",
")",
":",
"if",
"callable",
"(",
"device",
")",
":",
"var_name",
"=",
"tf",
".",
"get_variable_scope",
"(",
")",
".",
"name",
"+",
"'/'",
"+",
"name",
"var_def",
"=",
"tf",
".",
"NodeDef",
"(",
"n... | Fix the variable device to colocate its ops. | [
"Fix",
"the",
"variable",
"device",
"to",
"colocate",
"its",
"ops",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/variables.py#L209-L217 | train | Fix the variable device to colocate its ops. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/variables.py | global_step | def global_step(device=''):
"""Returns the global step variable.
Args:
device: Optional device to place the variable. It can be an string or a
function that is called to get the device for the variable.
Returns:
the tensor representing the global step variable.
"""
global_step_ref = tf.get_col... | python | def global_step(device=''):
"""Returns the global step variable.
Args:
device: Optional device to place the variable. It can be an string or a
function that is called to get the device for the variable.
Returns:
the tensor representing the global step variable.
"""
global_step_ref = tf.get_col... | [
"def",
"global_step",
"(",
"device",
"=",
"''",
")",
":",
"global_step_ref",
"=",
"tf",
".",
"get_collection",
"(",
"tf",
".",
"GraphKeys",
".",
"GLOBAL_STEP",
")",
"if",
"global_step_ref",
":",
"return",
"global_step_ref",
"[",
"0",
"]",
"else",
":",
"col... | Returns the global step variable.
Args:
device: Optional device to place the variable. It can be an string or a
function that is called to get the device for the variable.
Returns:
the tensor representing the global step variable. | [
"Returns",
"the",
"global",
"step",
"variable",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/variables.py#L221-L244 | train | Returns the global step variable. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/variables.py | variable | def variable(name, shape=None, dtype=tf.float32, initializer=None,
regularizer=None, trainable=True, collections=None, device='',
restore=True):
"""Gets an existing variable with these parameters or creates a new one.
It also add itself to a group with its name.
Args:
name: the n... | python | def variable(name, shape=None, dtype=tf.float32, initializer=None,
regularizer=None, trainable=True, collections=None, device='',
restore=True):
"""Gets an existing variable with these parameters or creates a new one.
It also add itself to a group with its name.
Args:
name: the n... | [
"def",
"variable",
"(",
"name",
",",
"shape",
"=",
"None",
",",
"dtype",
"=",
"tf",
".",
"float32",
",",
"initializer",
"=",
"None",
",",
"regularizer",
"=",
"None",
",",
"trainable",
"=",
"True",
",",
"collections",
"=",
"None",
",",
"device",
"=",
... | Gets an existing variable with these parameters or creates a new one.
It also add itself to a group with its name.
Args:
name: the name of the new or existing variable.
shape: shape of the new or existing variable.
dtype: type of the new or existing variable (defaults to `DT_FLOAT`).
initializer... | [
"Gets",
"an",
"existing",
"variable",
"with",
"these",
"parameters",
"or",
"creates",
"a",
"new",
"one",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/variables.py#L248-L289 | train | Gets an existing variable with these parameters or creates a new one. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/inception_eval.py | _eval_once | def _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op):
"""Runs Eval once.
Args:
saver: Saver.
summary_writer: Summary writer.
top_1_op: Top 1 op.
top_5_op: Top 5 op.
summary_op: Summary op.
"""
with tf.Session() as sess:
ckpt = tf.train.get_checkpoint_state(FLAGS.checkpo... | python | def _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op):
"""Runs Eval once.
Args:
saver: Saver.
summary_writer: Summary writer.
top_1_op: Top 1 op.
top_5_op: Top 5 op.
summary_op: Summary op.
"""
with tf.Session() as sess:
ckpt = tf.train.get_checkpoint_state(FLAGS.checkpo... | [
"def",
"_eval_once",
"(",
"saver",
",",
"summary_writer",
",",
"top_1_op",
",",
"top_5_op",
",",
"summary_op",
")",
":",
"with",
"tf",
".",
"Session",
"(",
")",
"as",
"sess",
":",
"ckpt",
"=",
"tf",
".",
"train",
".",
"get_checkpoint_state",
"(",
"FLAGS"... | Runs Eval once.
Args:
saver: Saver.
summary_writer: Summary writer.
top_1_op: Top 1 op.
top_5_op: Top 5 op.
summary_op: Summary op. | [
"Runs",
"Eval",
"once",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_eval.py#L55-L128 | train | Runs Eval once. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/inception_eval.py | evaluate | def evaluate(dataset):
"""Evaluate model on Dataset for a number of steps."""
with tf.Graph().as_default():
# Get images and labels from the dataset.
images, labels = image_processing.inputs(dataset)
# Number of classes in the Dataset label set plus 1.
# Label 0 is reserved for an (unused) backgrou... | python | def evaluate(dataset):
"""Evaluate model on Dataset for a number of steps."""
with tf.Graph().as_default():
# Get images and labels from the dataset.
images, labels = image_processing.inputs(dataset)
# Number of classes in the Dataset label set plus 1.
# Label 0 is reserved for an (unused) backgrou... | [
"def",
"evaluate",
"(",
"dataset",
")",
":",
"with",
"tf",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
":",
"# Get images and labels from the dataset.",
"images",
",",
"labels",
"=",
"image_processing",
".",
"inputs",
"(",
"dataset",
")",
"# Number of... | Evaluate model on Dataset for a number of steps. | [
"Evaluate",
"model",
"on",
"Dataset",
"for",
"a",
"number",
"of",
"steps",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_eval.py#L131-L166 | train | Evaluate model on Dataset for a number of steps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/pipeline.py | _run_model | def _run_model(iterator, args, tf_args):
"""mapPartitions function to run single-node inferencing from a checkpoint/saved_model, using the model's input/output mappings.
Args:
:iterator: input RDD partition iterator.
:args: arguments for TFModel, in argparse format
:tf_args: arguments for TensorFlow in... | python | def _run_model(iterator, args, tf_args):
"""mapPartitions function to run single-node inferencing from a checkpoint/saved_model, using the model's input/output mappings.
Args:
:iterator: input RDD partition iterator.
:args: arguments for TFModel, in argparse format
:tf_args: arguments for TensorFlow in... | [
"def",
"_run_model",
"(",
"iterator",
",",
"args",
",",
"tf_args",
")",
":",
"single_node_env",
"(",
"tf_args",
")",
"logging",
".",
"info",
"(",
"\"===== input_mapping: {}\"",
".",
"format",
"(",
"args",
".",
"input_mapping",
")",
")",
"logging",
".",
"info... | mapPartitions function to run single-node inferencing from a checkpoint/saved_model, using the model's input/output mappings.
Args:
:iterator: input RDD partition iterator.
:args: arguments for TFModel, in argparse format
:tf_args: arguments for TensorFlow inferencing code, in argparse or ARGV format.
... | [
"mapPartitions",
"function",
"to",
"run",
"single",
"-",
"node",
"inferencing",
"from",
"a",
"checkpoint",
"/",
"saved_model",
"using",
"the",
"model",
"s",
"input",
"/",
"output",
"mappings",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/pipeline.py#L483-L564 | train | mapPartitions function to run single - node inferencing from a checkpoint or saved_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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/pipeline.py | single_node_env | def single_node_env(args):
"""Sets up environment for a single-node TF session.
Args:
:args: command line arguments as either argparse args or argv list
"""
# setup ARGV for the TF process
if isinstance(args, list):
sys.argv = args
elif args.argv:
sys.argv = args.argv
# setup ENV for Had... | python | def single_node_env(args):
"""Sets up environment for a single-node TF session.
Args:
:args: command line arguments as either argparse args or argv list
"""
# setup ARGV for the TF process
if isinstance(args, list):
sys.argv = args
elif args.argv:
sys.argv = args.argv
# setup ENV for Had... | [
"def",
"single_node_env",
"(",
"args",
")",
":",
"# setup ARGV for the TF process",
"if",
"isinstance",
"(",
"args",
",",
"list",
")",
":",
"sys",
".",
"argv",
"=",
"args",
"elif",
"args",
".",
"argv",
":",
"sys",
".",
"argv",
"=",
"args",
".",
"argv",
... | Sets up environment for a single-node TF session.
Args:
:args: command line arguments as either argparse args or argv list | [
"Sets",
"up",
"environment",
"for",
"a",
"single",
"-",
"node",
"TF",
"session",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/pipeline.py#L567-L581 | train | Sets up the environment for a single - node TF session. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/pipeline.py | get_meta_graph_def | def get_meta_graph_def(saved_model_dir, tag_set):
"""Utility function to read a meta_graph_def from disk.
From `saved_model_cli.py <https://github.com/tensorflow/tensorflow/blob/8e0e8d41a3a8f2d4a6100c2ea1dc9d6c6c4ad382/tensorflow/python/tools/saved_model_cli.py#L186>`_
Args:
:saved_model_dir: path to saved_... | python | def get_meta_graph_def(saved_model_dir, tag_set):
"""Utility function to read a meta_graph_def from disk.
From `saved_model_cli.py <https://github.com/tensorflow/tensorflow/blob/8e0e8d41a3a8f2d4a6100c2ea1dc9d6c6c4ad382/tensorflow/python/tools/saved_model_cli.py#L186>`_
Args:
:saved_model_dir: path to saved_... | [
"def",
"get_meta_graph_def",
"(",
"saved_model_dir",
",",
"tag_set",
")",
":",
"saved_model",
"=",
"reader",
".",
"read_saved_model",
"(",
"saved_model_dir",
")",
"set_of_tags",
"=",
"set",
"(",
"tag_set",
".",
"split",
"(",
"','",
")",
")",
"for",
"meta_graph... | Utility function to read a meta_graph_def from disk.
From `saved_model_cli.py <https://github.com/tensorflow/tensorflow/blob/8e0e8d41a3a8f2d4a6100c2ea1dc9d6c6c4ad382/tensorflow/python/tools/saved_model_cli.py#L186>`_
Args:
:saved_model_dir: path to saved_model.
:tag_set: list of string tags identifying th... | [
"Utility",
"function",
"to",
"read",
"a",
"meta_graph_def",
"from",
"disk",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/pipeline.py#L584-L601 | train | Utility function to read a meta_graph_def from disk. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/pipeline.py | yield_batch | def yield_batch(iterable, batch_size, num_tensors=1):
"""Generator that yields batches of a DataFrame iterator.
Args:
:iterable: Spark partition iterator.
:batch_size: number of items to retrieve per invocation.
:num_tensors: number of tensors (columns) expected in each item.
Returns:
An array o... | python | def yield_batch(iterable, batch_size, num_tensors=1):
"""Generator that yields batches of a DataFrame iterator.
Args:
:iterable: Spark partition iterator.
:batch_size: number of items to retrieve per invocation.
:num_tensors: number of tensors (columns) expected in each item.
Returns:
An array o... | [
"def",
"yield_batch",
"(",
"iterable",
",",
"batch_size",
",",
"num_tensors",
"=",
"1",
")",
":",
"tensors",
"=",
"[",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"num_tensors",
")",
"]",
"for",
"item",
"in",
"iterable",
":",
"if",
"item",
"is",
"None"... | Generator that yields batches of a DataFrame iterator.
Args:
:iterable: Spark partition iterator.
:batch_size: number of items to retrieve per invocation.
:num_tensors: number of tensors (columns) expected in each item.
Returns:
An array of ``num_tensors`` arrays, each of length `batch_size` | [
"Generator",
"that",
"yields",
"batches",
"of",
"a",
"DataFrame",
"iterator",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/pipeline.py#L604-L626 | train | Generator that yields batches of a Spark partition iterator. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/pipeline.py | TFEstimator._fit | def _fit(self, dataset):
"""Trains a TensorFlow model and returns a TFModel instance with the same args/params pointing to a checkpoint or saved_model on disk.
Args:
:dataset: A Spark DataFrame with columns that will be mapped to TensorFlow tensors.
Returns:
A TFModel representing the trained ... | python | def _fit(self, dataset):
"""Trains a TensorFlow model and returns a TFModel instance with the same args/params pointing to a checkpoint or saved_model on disk.
Args:
:dataset: A Spark DataFrame with columns that will be mapped to TensorFlow tensors.
Returns:
A TFModel representing the trained ... | [
"def",
"_fit",
"(",
"self",
",",
"dataset",
")",
":",
"sc",
"=",
"SparkContext",
".",
"getOrCreate",
"(",
")",
"logging",
".",
"info",
"(",
"\"===== 1. train args: {0}\"",
".",
"format",
"(",
"self",
".",
"args",
")",
")",
"logging",
".",
"info",
"(",
... | Trains a TensorFlow model and returns a TFModel instance with the same args/params pointing to a checkpoint or saved_model on disk.
Args:
:dataset: A Spark DataFrame with columns that will be mapped to TensorFlow tensors.
Returns:
A TFModel representing the trained model, backed on disk by a Tenso... | [
"Trains",
"a",
"TensorFlow",
"model",
"and",
"returns",
"a",
"TFModel",
"instance",
"with",
"the",
"same",
"args",
"/",
"params",
"pointing",
"to",
"a",
"checkpoint",
"or",
"saved_model",
"on",
"disk",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/pipeline.py#L368-L420 | train | Trains a TensorFlow model and returns a TFModel instance with the same args and params pointing to a checkpoint or saved_model on disk. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/pipeline.py | TFModel._transform | def _transform(self, dataset):
"""Transforms the input DataFrame by applying the _run_model() mapPartitions function.
Args:
:dataset: A Spark DataFrame for TensorFlow inferencing.
"""
spark = SparkSession.builder.getOrCreate()
# set a deterministic order for input/output columns (lexicograph... | python | def _transform(self, dataset):
"""Transforms the input DataFrame by applying the _run_model() mapPartitions function.
Args:
:dataset: A Spark DataFrame for TensorFlow inferencing.
"""
spark = SparkSession.builder.getOrCreate()
# set a deterministic order for input/output columns (lexicograph... | [
"def",
"_transform",
"(",
"self",
",",
"dataset",
")",
":",
"spark",
"=",
"SparkSession",
".",
"builder",
".",
"getOrCreate",
"(",
")",
"# set a deterministic order for input/output columns (lexicographic by key)",
"input_cols",
"=",
"[",
"col",
"for",
"col",
",",
"... | Transforms the input DataFrame by applying the _run_model() mapPartitions function.
Args:
:dataset: A Spark DataFrame for TensorFlow inferencing. | [
"Transforms",
"the",
"input",
"DataFrame",
"by",
"applying",
"the",
"_run_model",
"()",
"mapPartitions",
"function",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/pipeline.py#L448-L475 | train | Transforms the input DataFrame by applying the _run_model function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFCluster.py | run | def run(sc, map_fun, tf_args, num_executors, num_ps, tensorboard=False, input_mode=InputMode.TENSORFLOW,
log_dir=None, driver_ps_nodes=False, master_node=None, reservation_timeout=600, queues=['input', 'output', 'error'],
eval_node=False):
"""Starts the TensorFlowOnSpark cluster and Runs the TensorFlo... | python | def run(sc, map_fun, tf_args, num_executors, num_ps, tensorboard=False, input_mode=InputMode.TENSORFLOW,
log_dir=None, driver_ps_nodes=False, master_node=None, reservation_timeout=600, queues=['input', 'output', 'error'],
eval_node=False):
"""Starts the TensorFlowOnSpark cluster and Runs the TensorFlo... | [
"def",
"run",
"(",
"sc",
",",
"map_fun",
",",
"tf_args",
",",
"num_executors",
",",
"num_ps",
",",
"tensorboard",
"=",
"False",
",",
"input_mode",
"=",
"InputMode",
".",
"TENSORFLOW",
",",
"log_dir",
"=",
"None",
",",
"driver_ps_nodes",
"=",
"False",
",",
... | Starts the TensorFlowOnSpark cluster and Runs the TensorFlow "main" function on the Spark executors
Args:
:sc: SparkContext
:map_fun: user-supplied TensorFlow "main" function
:tf_args: ``argparse`` args, or command-line ``ARGV``. These will be passed to the ``map_fun``.
:num_executors: number of Spa... | [
"Starts",
"the",
"TensorFlowOnSpark",
"cluster",
"and",
"Runs",
"the",
"TensorFlow",
"main",
"function",
"on",
"the",
"Spark",
"executors"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFCluster.py#L211-L379 | train | Starts the TensorFlowOnSpark cluster and runs the main function on Spark executors. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFCluster.py | TFCluster.train | def train(self, dataRDD, num_epochs=0, feed_timeout=600, qname='input'):
"""*For InputMode.SPARK only*. Feeds Spark RDD partitions into the TensorFlow worker nodes
It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD.
Since epochs are implemented via ``RDD.union()``... | python | def train(self, dataRDD, num_epochs=0, feed_timeout=600, qname='input'):
"""*For InputMode.SPARK only*. Feeds Spark RDD partitions into the TensorFlow worker nodes
It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD.
Since epochs are implemented via ``RDD.union()``... | [
"def",
"train",
"(",
"self",
",",
"dataRDD",
",",
"num_epochs",
"=",
"0",
",",
"feed_timeout",
"=",
"600",
",",
"qname",
"=",
"'input'",
")",
":",
"logging",
".",
"info",
"(",
"\"Feeding training data\"",
")",
"assert",
"self",
".",
"input_mode",
"==",
"... | *For InputMode.SPARK only*. Feeds Spark RDD partitions into the TensorFlow worker nodes
It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD.
Since epochs are implemented via ``RDD.union()`` and the entire RDD must generally be processed in full, it is recommended
t... | [
"*",
"For",
"InputMode",
".",
"SPARK",
"only",
"*",
".",
"Feeds",
"Spark",
"RDD",
"partitions",
"into",
"the",
"TensorFlow",
"worker",
"nodes"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFCluster.py#L61-L92 | train | Train the cluster on the input 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFCluster.py | TFCluster.inference | def inference(self, dataRDD, feed_timeout=600, qname='input'):
"""*For InputMode.SPARK only*: Feeds Spark RDD partitions into the TensorFlow worker nodes and returns an RDD of results
It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD and provide valid data for the outp... | python | def inference(self, dataRDD, feed_timeout=600, qname='input'):
"""*For InputMode.SPARK only*: Feeds Spark RDD partitions into the TensorFlow worker nodes and returns an RDD of results
It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD and provide valid data for the outp... | [
"def",
"inference",
"(",
"self",
",",
"dataRDD",
",",
"feed_timeout",
"=",
"600",
",",
"qname",
"=",
"'input'",
")",
":",
"logging",
".",
"info",
"(",
"\"Feeding inference data\"",
")",
"assert",
"self",
".",
"input_mode",
"==",
"InputMode",
".",
"SPARK",
... | *For InputMode.SPARK only*: Feeds Spark RDD partitions into the TensorFlow worker nodes and returns an RDD of results
It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD and provide valid data for the output RDD.
This will use the distributed TensorFlow cluster for infe... | [
"*",
"For",
"InputMode",
".",
"SPARK",
"only",
"*",
":",
"Feeds",
"Spark",
"RDD",
"partitions",
"into",
"the",
"TensorFlow",
"worker",
"nodes",
"and",
"returns",
"an",
"RDD",
"of",
"results"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFCluster.py#L94-L113 | train | Feeds the data into the TensorFlow worker nodes and returns an RDD of the inference results. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFCluster.py | TFCluster.shutdown | def shutdown(self, ssc=None, grace_secs=0, timeout=259200):
"""Stops the distributed TensorFlow cluster.
For InputMode.SPARK, this will be executed AFTER the `TFCluster.train()` or `TFCluster.inference()` method completes.
For InputMode.TENSORFLOW, this will be executed IMMEDIATELY after `TFCluster.run()` ... | python | def shutdown(self, ssc=None, grace_secs=0, timeout=259200):
"""Stops the distributed TensorFlow cluster.
For InputMode.SPARK, this will be executed AFTER the `TFCluster.train()` or `TFCluster.inference()` method completes.
For InputMode.TENSORFLOW, this will be executed IMMEDIATELY after `TFCluster.run()` ... | [
"def",
"shutdown",
"(",
"self",
",",
"ssc",
"=",
"None",
",",
"grace_secs",
"=",
"0",
",",
"timeout",
"=",
"259200",
")",
":",
"logging",
".",
"info",
"(",
"\"Stopping TensorFlow nodes\"",
")",
"# identify ps/workers",
"ps_list",
",",
"worker_list",
",",
"ev... | Stops the distributed TensorFlow cluster.
For InputMode.SPARK, this will be executed AFTER the `TFCluster.train()` or `TFCluster.inference()` method completes.
For InputMode.TENSORFLOW, this will be executed IMMEDIATELY after `TFCluster.run()` and will wait until the TF worker nodes complete.
Args:
... | [
"Stops",
"the",
"distributed",
"TensorFlow",
"cluster",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFCluster.py#L115-L201 | train | Stops the distributed TensorFlow 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _int64_feature | def _int64_feature(value):
"""Wrapper for inserting int64 features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(int64_list=tf.train.Int64List(value=value)) | python | def _int64_feature(value):
"""Wrapper for inserting int64 features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(int64_list=tf.train.Int64List(value=value)) | [
"def",
"_int64_feature",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"[",
"value",
"]",
"return",
"tf",
".",
"train",
".",
"Feature",
"(",
"int64_list",
"=",
"tf",
".",
"train",
".",
"Int64Lis... | Wrapper for inserting int64 features into Example proto. | [
"Wrapper",
"for",
"inserting",
"int64",
"features",
"into",
"Example",
"proto",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L158-L162 | train | Wrapper for inserting int64 features into Example proto. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _float_feature | def _float_feature(value):
"""Wrapper for inserting float features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(float_list=tf.train.FloatList(value=value)) | python | def _float_feature(value):
"""Wrapper for inserting float features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(float_list=tf.train.FloatList(value=value)) | [
"def",
"_float_feature",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"[",
"value",
"]",
"return",
"tf",
".",
"train",
".",
"Feature",
"(",
"float_list",
"=",
"tf",
".",
"train",
".",
"FloatLis... | Wrapper for inserting float features into Example proto. | [
"Wrapper",
"for",
"inserting",
"float",
"features",
"into",
"Example",
"proto",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L165-L169 | train | Wrapper for inserting float features into Example proto. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _convert_to_example | def _convert_to_example(filename, image_buffer, label, synset, human, bbox,
height, width):
"""Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, iden... | python | def _convert_to_example(filename, image_buffer, label, synset, human, bbox,
height, width):
"""Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, iden... | [
"def",
"_convert_to_example",
"(",
"filename",
",",
"image_buffer",
",",
"label",
",",
"synset",
",",
"human",
",",
"bbox",
",",
"height",
",",
"width",
")",
":",
"xmin",
"=",
"[",
"]",
"ymin",
"=",
"[",
"]",
"xmax",
"=",
"[",
"]",
"ymax",
"=",
"["... | Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, identifier for the ground truth for the network
synset: string, unique WordNet ID specifying the label, e.g., 'n02323233'... | [
"Build",
"an",
"Example",
"proto",
"for",
"an",
"example",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L177-L225 | train | Convert an image file to an example. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _process_image | def _process_image(filename, coder):
"""Process a single image file.
Args:
filename: string, path to an image file e.g., '/path/to/example.JPG'.
coder: instance of ImageCoder to provide TensorFlow image coding utils.
Returns:
image_buffer: string, JPEG encoding of RGB image.
height: integer, imag... | python | def _process_image(filename, coder):
"""Process a single image file.
Args:
filename: string, path to an image file e.g., '/path/to/example.JPG'.
coder: instance of ImageCoder to provide TensorFlow image coding utils.
Returns:
image_buffer: string, JPEG encoding of RGB image.
height: integer, imag... | [
"def",
"_process_image",
"(",
"filename",
",",
"coder",
")",
":",
"# Read the image file.",
"with",
"tf",
".",
"gfile",
".",
"FastGFile",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"image_data",
"=",
"f",
".",
"read",
"(",
")",
"# Clean the dirty da... | Process a single image file.
Args:
filename: string, path to an image file e.g., '/path/to/example.JPG'.
coder: instance of ImageCoder to provide TensorFlow image coding utils.
Returns:
image_buffer: string, JPEG encoding of RGB image.
height: integer, image height in pixels.
width: integer, im... | [
"Process",
"a",
"single",
"image",
"file",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L304-L338 | train | Process a single image 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _find_human_readable_labels | def _find_human_readable_labels(synsets, synset_to_human):
"""Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readab... | python | def _find_human_readable_labels(synsets, synset_to_human):
"""Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readab... | [
"def",
"_find_human_readable_labels",
"(",
"synsets",
",",
"synset_to_human",
")",
":",
"humans",
"=",
"[",
"]",
"for",
"s",
"in",
"synsets",
":",
"assert",
"s",
"in",
"synset_to_human",
",",
"(",
"'Failed to find: %s'",
"%",
"s",
")",
"humans",
".",
"append... | Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readable strings corresponding to each synset. | [
"Build",
"a",
"list",
"of",
"human",
"-",
"readable",
"labels",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L540-L555 | train | Find the human - readable labels for a list of strings. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _find_image_bounding_boxes | def _find_image_bounding_boxes(filenames, image_to_bboxes):
"""Find the bounding boxes for a given image file.
Args:
filenames: list of strings; each string is a path to an image file.
image_to_bboxes: dictionary mapping image file names to a list of
bounding boxes. This list contains 0+ bounding box... | python | def _find_image_bounding_boxes(filenames, image_to_bboxes):
"""Find the bounding boxes for a given image file.
Args:
filenames: list of strings; each string is a path to an image file.
image_to_bboxes: dictionary mapping image file names to a list of
bounding boxes. This list contains 0+ bounding box... | [
"def",
"_find_image_bounding_boxes",
"(",
"filenames",
",",
"image_to_bboxes",
")",
":",
"num_image_bbox",
"=",
"0",
"bboxes",
"=",
"[",
"]",
"for",
"f",
"in",
"filenames",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"f",
")",
"if",
"b... | Find the bounding boxes for a given image file.
Args:
filenames: list of strings; each string is a path to an image file.
image_to_bboxes: dictionary mapping image file names to a list of
bounding boxes. This list contains 0+ bounding boxes.
Returns:
List of bounding boxes for each image. Note th... | [
"Find",
"the",
"bounding",
"boxes",
"for",
"a",
"given",
"image",
"file",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L558-L581 | train | Find the bounding boxes for a given image 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _process_dataset | def _process_dataset(name, directory, num_shards, synset_to_human,
image_to_bboxes):
"""Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of ... | python | def _process_dataset(name, directory, num_shards, synset_to_human,
image_to_bboxes):
"""Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of ... | [
"def",
"_process_dataset",
"(",
"name",
",",
"directory",
",",
"num_shards",
",",
"synset_to_human",
",",
"image_to_bboxes",
")",
":",
"filenames",
",",
"synsets",
",",
"labels",
"=",
"_find_image_files",
"(",
"directory",
",",
"FLAGS",
".",
"labels_file",
")",
... | Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of shards for this data set.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red... | [
"Process",
"a",
"complete",
"data",
"set",
"and",
"save",
"it",
"as",
"a",
"TFRecord",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L584-L601 | train | Process a complete data set and save it as a TFRecord. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _build_synset_lookup | def _build_synset_lookup(imagenet_metadata_file):
"""Build lookup for synset to human-readable label.
Args:
imagenet_metadata_file: string, path to file containing mapping from
synset to human-readable label.
Assumes each line of the file looks like:
n02119247 black fox
n021193... | python | def _build_synset_lookup(imagenet_metadata_file):
"""Build lookup for synset to human-readable label.
Args:
imagenet_metadata_file: string, path to file containing mapping from
synset to human-readable label.
Assumes each line of the file looks like:
n02119247 black fox
n021193... | [
"def",
"_build_synset_lookup",
"(",
"imagenet_metadata_file",
")",
":",
"lines",
"=",
"tf",
".",
"gfile",
".",
"FastGFile",
"(",
"imagenet_metadata_file",
",",
"'r'",
")",
".",
"readlines",
"(",
")",
"synset_to_human",
"=",
"{",
"}",
"for",
"l",
"in",
"lines... | Build lookup for synset to human-readable label.
Args:
imagenet_metadata_file: string, path to file containing mapping from
synset to human-readable label.
Assumes each line of the file looks like:
n02119247 black fox
n02119359 silver fox
n02119477 red fox, Vulpes f... | [
"Build",
"lookup",
"for",
"synset",
"to",
"human",
"-",
"readable",
"label",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L604-L633 | train | Build a dictionary of synset to human - readable label. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_imagenet_data.py | _build_bounding_box_lookup | def _build_bounding_box_lookup(bounding_box_file):
"""Build a lookup from image file to bounding boxes.
Args:
bounding_box_file: string, path to file with bounding boxes annotations.
Assumes each line of the file looks like:
n00007846_64193.JPEG,0.0060,0.2620,0.7545,0.9940
where each lin... | python | def _build_bounding_box_lookup(bounding_box_file):
"""Build a lookup from image file to bounding boxes.
Args:
bounding_box_file: string, path to file with bounding boxes annotations.
Assumes each line of the file looks like:
n00007846_64193.JPEG,0.0060,0.2620,0.7545,0.9940
where each lin... | [
"def",
"_build_bounding_box_lookup",
"(",
"bounding_box_file",
")",
":",
"lines",
"=",
"tf",
".",
"gfile",
".",
"FastGFile",
"(",
"bounding_box_file",
",",
"'r'",
")",
".",
"readlines",
"(",
")",
"images_to_bboxes",
"=",
"{",
"}",
"num_bbox",
"=",
"0",
"num_... | Build a lookup from image file to bounding boxes.
Args:
bounding_box_file: string, path to file with bounding boxes annotations.
Assumes each line of the file looks like:
n00007846_64193.JPEG,0.0060,0.2620,0.7545,0.9940
where each line corresponds to one bounding box annotation associated
... | [
"Build",
"a",
"lookup",
"from",
"image",
"file",
"to",
"bounding",
"boxes",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_imagenet_data.py#L636-L681 | train | Build a lookup from image file to bounding 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... |
yahoo/TensorFlowOnSpark | examples/mnist/estimator/mnist_estimator.py | cnn_model_fn | def cnn_model_fn(features, labels, mode):
"""Model function for CNN."""
# Input Layer
# Reshape X to 4-D tensor: [batch_size, width, height, channels]
# MNIST images are 28x28 pixels, and have one color channel
input_layer = tf.reshape(features["x"], [-1, 28, 28, 1])
# Convolutional Layer #1
# Computes 3... | python | def cnn_model_fn(features, labels, mode):
"""Model function for CNN."""
# Input Layer
# Reshape X to 4-D tensor: [batch_size, width, height, channels]
# MNIST images are 28x28 pixels, and have one color channel
input_layer = tf.reshape(features["x"], [-1, 28, 28, 1])
# Convolutional Layer #1
# Computes 3... | [
"def",
"cnn_model_fn",
"(",
"features",
",",
"labels",
",",
"mode",
")",
":",
"# Input Layer",
"# Reshape X to 4-D tensor: [batch_size, width, height, channels]",
"# MNIST images are 28x28 pixels, and have one color channel",
"input_layer",
"=",
"tf",
".",
"reshape",
"(",
"feat... | Model function for CNN. | [
"Model",
"function",
"for",
"CNN",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/estimator/mnist_estimator.py#L26-L115 | train | Model function for CNN. | 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... |
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10_input.py | read_cifar10 | def read_cifar10(filename_queue):
"""Reads and parses examples from CIFAR10 data files.
Recommendation: if you want N-way read parallelism, call this function
N times. This will give you N independent Readers reading different
files & positions within those files, which will give better mixing of
examples.
... | python | def read_cifar10(filename_queue):
"""Reads and parses examples from CIFAR10 data files.
Recommendation: if you want N-way read parallelism, call this function
N times. This will give you N independent Readers reading different
files & positions within those files, which will give better mixing of
examples.
... | [
"def",
"read_cifar10",
"(",
"filename_queue",
")",
":",
"class",
"CIFAR10Record",
"(",
"object",
")",
":",
"pass",
"result",
"=",
"CIFAR10Record",
"(",
")",
"# Dimensions of the images in the CIFAR-10 dataset.",
"# See http://www.cs.toronto.edu/~kriz/cifar.html for a descriptio... | Reads and parses examples from CIFAR10 data files.
Recommendation: if you want N-way read parallelism, call this function
N times. This will give you N independent Readers reading different
files & positions within those files, which will give better mixing of
examples.
Args:
filename_queue: A queue of... | [
"Reads",
"and",
"parses",
"examples",
"from",
"CIFAR10",
"data",
"files",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10_input.py#L38-L98 | train | Reads and parses examples from CIFAR - 10 data 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... |
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10_input.py | _generate_image_and_label_batch | def _generate_image_and_label_batch(image, label, min_queue_examples,
batch_size, shuffle):
"""Construct a queued batch of images and labels.
Args:
image: 3-D Tensor of [height, width, 3] of type.float32.
label: 1-D Tensor of type.int32
min_queue_examples: int32, min... | python | def _generate_image_and_label_batch(image, label, min_queue_examples,
batch_size, shuffle):
"""Construct a queued batch of images and labels.
Args:
image: 3-D Tensor of [height, width, 3] of type.float32.
label: 1-D Tensor of type.int32
min_queue_examples: int32, min... | [
"def",
"_generate_image_and_label_batch",
"(",
"image",
",",
"label",
",",
"min_queue_examples",
",",
"batch_size",
",",
"shuffle",
")",
":",
"# Create a queue that shuffles the examples, and then",
"# read 'batch_size' images + labels from the example queue.",
"num_preprocess_thread... | Construct a queued batch of images and labels.
Args:
image: 3-D Tensor of [height, width, 3] of type.float32.
label: 1-D Tensor of type.int32
min_queue_examples: int32, minimum number of samples to retain
in the queue that provides of batches of examples.
batch_size: Number of images per batch.... | [
"Construct",
"a",
"queued",
"batch",
"of",
"images",
"and",
"labels",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10_input.py#L101-L137 | train | Generate a queued batch of images 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... |
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10_input.py | distorted_inputs | def distorted_inputs(data_dir, batch_size):
"""Construct distorted input for CIFAR training using the Reader ops.
Args:
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZE, 3] size.
label... | python | def distorted_inputs(data_dir, batch_size):
"""Construct distorted input for CIFAR training using the Reader ops.
Args:
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZE, 3] size.
label... | [
"def",
"distorted_inputs",
"(",
"data_dir",
",",
"batch_size",
")",
":",
"filenames",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"'data_batch_%d.bin'",
"%",
"i",
")",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"6",
")",
"]",
"for... | Construct distorted input for CIFAR training using the Reader ops.
Args:
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZE, 3] size.
labels: Labels. 1D tensor of [batch_size] size. | [
"Construct",
"distorted",
"input",
"for",
"CIFAR",
"training",
"using",
"the",
"Reader",
"ops",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10_input.py#L140-L200 | train | Construct distorted input for CIFAR training using the Reader ops. | 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... |
yahoo/TensorFlowOnSpark | examples/cifar10/cifar10_input.py | inputs | def inputs(eval_data, data_dir, batch_size):
"""Construct input for CIFAR evaluation using the Reader ops.
Args:
eval_data: bool, indicating if one should use the train or eval data set.
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Image... | python | def inputs(eval_data, data_dir, batch_size):
"""Construct input for CIFAR evaluation using the Reader ops.
Args:
eval_data: bool, indicating if one should use the train or eval data set.
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Image... | [
"def",
"inputs",
"(",
"eval_data",
",",
"data_dir",
",",
"batch_size",
")",
":",
"if",
"not",
"eval_data",
":",
"filenames",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"'data_batch_%d.bin'",
"%",
"i",
")",
"for",
"i",
"in",
"xrange... | Construct input for CIFAR evaluation using the Reader ops.
Args:
eval_data: bool, indicating if one should use the train or eval data set.
data_dir: Path to the CIFAR-10 data directory.
batch_size: Number of images per batch.
Returns:
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZ... | [
"Construct",
"input",
"for",
"CIFAR",
"evaluation",
"using",
"the",
"Reader",
"ops",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/cifar10/cifar10_input.py#L203-L257 | train | Construct input for CIFAR evaluation using the Reader ops. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/dfutil.py | saveAsTFRecords | def saveAsTFRecords(df, output_dir):
"""Save a Spark DataFrame as TFRecords.
This will convert the DataFrame rows to TFRecords prior to saving.
Args:
:df: Spark DataFrame
:output_dir: Path to save TFRecords
"""
tf_rdd = df.rdd.mapPartitions(toTFExample(df.dtypes))
tf_rdd.saveAsNewAPIHadoopFile(out... | python | def saveAsTFRecords(df, output_dir):
"""Save a Spark DataFrame as TFRecords.
This will convert the DataFrame rows to TFRecords prior to saving.
Args:
:df: Spark DataFrame
:output_dir: Path to save TFRecords
"""
tf_rdd = df.rdd.mapPartitions(toTFExample(df.dtypes))
tf_rdd.saveAsNewAPIHadoopFile(out... | [
"def",
"saveAsTFRecords",
"(",
"df",
",",
"output_dir",
")",
":",
"tf_rdd",
"=",
"df",
".",
"rdd",
".",
"mapPartitions",
"(",
"toTFExample",
"(",
"df",
".",
"dtypes",
")",
")",
"tf_rdd",
".",
"saveAsNewAPIHadoopFile",
"(",
"output_dir",
",",
"\"org.tensorflo... | Save a Spark DataFrame as TFRecords.
This will convert the DataFrame rows to TFRecords prior to saving.
Args:
:df: Spark DataFrame
:output_dir: Path to save TFRecords | [
"Save",
"a",
"Spark",
"DataFrame",
"as",
"TFRecords",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/dfutil.py#L29-L41 | train | Save a Spark DataFrame as TFRecords. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/dfutil.py | loadTFRecords | def loadTFRecords(sc, input_dir, binary_features=[]):
"""Load TFRecords from disk into a Spark DataFrame.
This will attempt to automatically convert the tf.train.Example features into Spark DataFrame columns of equivalent types.
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, an... | python | def loadTFRecords(sc, input_dir, binary_features=[]):
"""Load TFRecords from disk into a Spark DataFrame.
This will attempt to automatically convert the tf.train.Example features into Spark DataFrame columns of equivalent types.
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, an... | [
"def",
"loadTFRecords",
"(",
"sc",
",",
"input_dir",
",",
"binary_features",
"=",
"[",
"]",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"tfr_rdd",
"=",
"sc",
".",
"newAPIHadoopFile",
"(",
"input_dir",
",",
"\"org.tensorflow.hadoop.io.TFRecordFileInputFormat\"",
... | Load TFRecords from disk into a Spark DataFrame.
This will attempt to automatically convert the tf.train.Example features into Spark DataFrame columns of equivalent types.
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrame... | [
"Load",
"TFRecords",
"from",
"disk",
"into",
"a",
"Spark",
"DataFrame",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/dfutil.py#L44-L81 | train | Load TFRecords from disk into a Spark DataFrame. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/dfutil.py | toTFExample | def toTFExample(dtypes):
"""mapPartition function to convert a Spark RDD of Row into an RDD of serialized tf.train.Example bytestring.
Note that tf.train.Example is a fairly flat structure with limited datatypes, e.g. tf.train.FloatList,
tf.train.Int64List, and tf.train.BytesList, so most DataFrame types will be... | python | def toTFExample(dtypes):
"""mapPartition function to convert a Spark RDD of Row into an RDD of serialized tf.train.Example bytestring.
Note that tf.train.Example is a fairly flat structure with limited datatypes, e.g. tf.train.FloatList,
tf.train.Int64List, and tf.train.BytesList, so most DataFrame types will be... | [
"def",
"toTFExample",
"(",
"dtypes",
")",
":",
"def",
"_toTFExample",
"(",
"iter",
")",
":",
"# supported type mappings between DataFrame.dtypes and tf.train.Feature types",
"float_dtypes",
"=",
"[",
"'float'",
",",
"'double'",
"]",
"int64_dtypes",
"=",
"[",
"'boolean'"... | mapPartition function to convert a Spark RDD of Row into an RDD of serialized tf.train.Example bytestring.
Note that tf.train.Example is a fairly flat structure with limited datatypes, e.g. tf.train.FloatList,
tf.train.Int64List, and tf.train.BytesList, so most DataFrame types will be coerced into one of these typ... | [
"mapPartition",
"function",
"to",
"convert",
"a",
"Spark",
"RDD",
"of",
"Row",
"into",
"an",
"RDD",
"of",
"serialized",
"tf",
".",
"train",
".",
"Example",
"bytestring",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/dfutil.py#L84-L131 | train | mapPartition function to convert a Spark RDD of Row into an RDD of serialized tf. train. Example bytestrings. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/dfutil.py | infer_schema | def infer_schema(example, binary_features=[]):
"""Given a tf.train.Example, infer the Spark DataFrame schema (StructFields).
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrames DTypes (StringType and BinaryType), so we requ... | python | def infer_schema(example, binary_features=[]):
"""Given a tf.train.Example, infer the Spark DataFrame schema (StructFields).
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrames DTypes (StringType and BinaryType), so we requ... | [
"def",
"infer_schema",
"(",
"example",
",",
"binary_features",
"=",
"[",
"]",
")",
":",
"def",
"_infer_sql_type",
"(",
"k",
",",
"v",
")",
":",
"# special handling for binary features",
"if",
"k",
"in",
"binary_features",
":",
"return",
"BinaryType",
"(",
")",... | Given a tf.train.Example, infer the Spark DataFrame schema (StructFields).
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrames DTypes (StringType and BinaryType), so we require a "hint"
from the caller in the ``binary_featu... | [
"Given",
"a",
"tf",
".",
"train",
".",
"Example",
"infer",
"the",
"Spark",
"DataFrame",
"schema",
"(",
"StructFields",
")",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/dfutil.py#L134-L168 | train | Given a tf. train. Example infer the Spark DataFrame schema. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/dfutil.py | fromTFExample | def fromTFExample(iter, binary_features=[]):
"""mapPartition function to convert an RDD of serialized tf.train.Example bytestring into an RDD of Row.
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrames DTypes (StringType an... | python | def fromTFExample(iter, binary_features=[]):
"""mapPartition function to convert an RDD of serialized tf.train.Example bytestring into an RDD of Row.
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrames DTypes (StringType an... | [
"def",
"fromTFExample",
"(",
"iter",
",",
"binary_features",
"=",
"[",
"]",
")",
":",
"# convert from protobuf-like dict to DataFrame-friendly dict",
"def",
"_get_value",
"(",
"k",
",",
"v",
")",
":",
"if",
"v",
".",
"int64_list",
".",
"value",
":",
"result",
... | mapPartition function to convert an RDD of serialized tf.train.Example bytestring into an RDD of Row.
Note: TensorFlow represents both strings and binary types as tf.train.BytesList, and we need to
disambiguate these types for Spark DataFrames DTypes (StringType and BinaryType), so we require a "hint"
from the c... | [
"mapPartition",
"function",
"to",
"convert",
"an",
"RDD",
"of",
"serialized",
"tf",
".",
"train",
".",
"Example",
"bytestring",
"into",
"an",
"RDD",
"of",
"Row",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/dfutil.py#L171-L212 | train | mapPartition function to convert an RDD of serialized tf. train. Example bytestring into an RDD of Row. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/wide_deep/census_main.py | build_estimator | def build_estimator(model_dir, model_type, model_column_fn, inter_op, intra_op, ctx):
"""Build an estimator appropriate for the given model type."""
wide_columns, deep_columns = model_column_fn()
hidden_units = [100, 75, 50, 25]
# Create a tf.estimator.RunConfig to ensure the model is run on CPU, which
# tra... | python | def build_estimator(model_dir, model_type, model_column_fn, inter_op, intra_op, ctx):
"""Build an estimator appropriate for the given model type."""
wide_columns, deep_columns = model_column_fn()
hidden_units = [100, 75, 50, 25]
# Create a tf.estimator.RunConfig to ensure the model is run on CPU, which
# tra... | [
"def",
"build_estimator",
"(",
"model_dir",
",",
"model_type",
",",
"model_column_fn",
",",
"inter_op",
",",
"intra_op",
",",
"ctx",
")",
":",
"wide_columns",
",",
"deep_columns",
"=",
"model_column_fn",
"(",
")",
"hidden_units",
"=",
"[",
"100",
",",
"75",
... | Build an estimator appropriate for the given model type. | [
"Build",
"an",
"estimator",
"appropriate",
"for",
"the",
"given",
"model",
"type",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_main.py#L46-L77 | train | Build an estimator appropriate for the given model type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/wide_deep/census_main.py | run_census | def run_census(flags_obj, ctx):
"""Construct all necessary functions and call run_loop.
Args:
flags_obj: Object containing user specified flags.
"""
train_file = os.path.join(flags_obj.data_dir, census_dataset.TRAINING_FILE)
test_file = os.path.join(flags_obj.data_dir, census_dataset.EVAL_FILE)
# Trai... | python | def run_census(flags_obj, ctx):
"""Construct all necessary functions and call run_loop.
Args:
flags_obj: Object containing user specified flags.
"""
train_file = os.path.join(flags_obj.data_dir, census_dataset.TRAINING_FILE)
test_file = os.path.join(flags_obj.data_dir, census_dataset.EVAL_FILE)
# Trai... | [
"def",
"run_census",
"(",
"flags_obj",
",",
"ctx",
")",
":",
"train_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"flags_obj",
".",
"data_dir",
",",
"census_dataset",
".",
"TRAINING_FILE",
")",
"test_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | Construct all necessary functions and call run_loop.
Args:
flags_obj: Object containing user specified flags. | [
"Construct",
"all",
"necessary",
"functions",
"and",
"call",
"run_loop",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_main.py#L80-L122 | train | Construct all necessary functions and call run_loop. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/inception_model.py | inception_v3 | def inception_v3(inputs,
dropout_keep_prob=0.8,
num_classes=1000,
is_training=True,
restore_logits=True,
scope=''):
"""Latest Inception from http://arxiv.org/abs/1512.00567.
"Rethinking the Inception Architecture for Computer Vi... | python | def inception_v3(inputs,
dropout_keep_prob=0.8,
num_classes=1000,
is_training=True,
restore_logits=True,
scope=''):
"""Latest Inception from http://arxiv.org/abs/1512.00567.
"Rethinking the Inception Architecture for Computer Vi... | [
"def",
"inception_v3",
"(",
"inputs",
",",
"dropout_keep_prob",
"=",
"0.8",
",",
"num_classes",
"=",
"1000",
",",
"is_training",
"=",
"True",
",",
"restore_logits",
"=",
"True",
",",
"scope",
"=",
"''",
")",
":",
"# end_points will collect relevant activations for... | Latest Inception from http://arxiv.org/abs/1512.00567.
"Rethinking the Inception Architecture for Computer Vision"
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens,
Zbigniew Wojna
Args:
inputs: a tensor of size [batch_size, height, width, channels].
dropout_keep_prob: dropout... | [
"Latest",
"Inception",
"from",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1512",
".",
"00567",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/inception_model.py#L52-L330 | train | Latest Inception from http://arxiv. org / abs / 1512. 00567. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/inception_model.py | inception_v3_parameters | def inception_v3_parameters(weight_decay=0.00004, stddev=0.1,
batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
"""Yields the scope with the default parameters for inception_v3.
Args:
weight_decay: the weight decay for weights variables.
stddev: standard deviation of the trunc... | python | def inception_v3_parameters(weight_decay=0.00004, stddev=0.1,
batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
"""Yields the scope with the default parameters for inception_v3.
Args:
weight_decay: the weight decay for weights variables.
stddev: standard deviation of the trunc... | [
"def",
"inception_v3_parameters",
"(",
"weight_decay",
"=",
"0.00004",
",",
"stddev",
"=",
"0.1",
",",
"batch_norm_decay",
"=",
"0.9997",
",",
"batch_norm_epsilon",
"=",
"0.001",
")",
":",
"# Set weight_decay for weights in Conv and FC layers.",
"with",
"scopes",
".",
... | Yields the scope with the default parameters for inception_v3.
Args:
weight_decay: the weight decay for weights variables.
stddev: standard deviation of the truncated guassian weight distribution.
batch_norm_decay: decay for the moving average of batch_norm momentums.
batch_norm_epsilon: small float ... | [
"Yields",
"the",
"scope",
"with",
"the",
"default",
"parameters",
"for",
"inception_v3",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/inception_model.py#L333-L356 | train | Yields the scope with the default parameters needed for inception_v3. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/util.py | single_node_env | def single_node_env(num_gpus=1):
"""Setup environment variables for Hadoop compatibility and GPU allocation"""
import tensorflow as tf
# ensure expanded CLASSPATH w/o glob characters (required for Spark 2.1 + JNI)
if 'HADOOP_PREFIX' in os.environ and 'TFOS_CLASSPATH_UPDATED' not in os.environ:
classpath =... | python | def single_node_env(num_gpus=1):
"""Setup environment variables for Hadoop compatibility and GPU allocation"""
import tensorflow as tf
# ensure expanded CLASSPATH w/o glob characters (required for Spark 2.1 + JNI)
if 'HADOOP_PREFIX' in os.environ and 'TFOS_CLASSPATH_UPDATED' not in os.environ:
classpath =... | [
"def",
"single_node_env",
"(",
"num_gpus",
"=",
"1",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"# ensure expanded CLASSPATH w/o glob characters (required for Spark 2.1 + JNI)",
"if",
"'HADOOP_PREFIX'",
"in",
"os",
".",
"environ",
"and",
"'TFOS_CLASSPATH_UPDATED'",
"not"... | Setup environment variables for Hadoop compatibility and GPU allocation | [
"Setup",
"environment",
"variables",
"for",
"Hadoop",
"compatibility",
"and",
"GPU",
"allocation"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/util.py#L19-L38 | train | Setup environment variables for Hadoop compatibility and GPU allocation | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/util.py | get_ip_address | def get_ip_address():
"""Simple utility to get host IP address."""
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
ip_address = s.getsockname()[0]
except socket_error as sockerr:
if sockerr.errno != errno.ENETUNREACH:
raise sockerr
ip_address = socket... | python | def get_ip_address():
"""Simple utility to get host IP address."""
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
ip_address = s.getsockname()[0]
except socket_error as sockerr:
if sockerr.errno != errno.ENETUNREACH:
raise sockerr
ip_address = socket... | [
"def",
"get_ip_address",
"(",
")",
":",
"try",
":",
"s",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_DGRAM",
")",
"s",
".",
"connect",
"(",
"(",
"\"8.8.8.8\"",
",",
"80",
")",
")",
"ip_address",
"=",
"s",
... | Simple utility to get host IP address. | [
"Simple",
"utility",
"to",
"get",
"host",
"IP",
"address",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/util.py#L41-L54 | train | Simple utility to get host IP address. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/util.py | find_in_path | def find_in_path(path, file):
"""Find a file in a given path string."""
for p in path.split(os.pathsep):
candidate = os.path.join(p, file)
if os.path.exists(candidate) and os.path.isfile(candidate):
return candidate
return False | python | def find_in_path(path, file):
"""Find a file in a given path string."""
for p in path.split(os.pathsep):
candidate = os.path.join(p, file)
if os.path.exists(candidate) and os.path.isfile(candidate):
return candidate
return False | [
"def",
"find_in_path",
"(",
"path",
",",
"file",
")",
":",
"for",
"p",
"in",
"path",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
":",
"candidate",
"=",
"os",
".",
"path",
".",
"join",
"(",
"p",
",",
"file",
")",
"if",
"os",
".",
"path",
".",
... | Find a file in a given path string. | [
"Find",
"a",
"file",
"in",
"a",
"given",
"path",
"string",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/util.py#L57-L63 | train | Find a file in a given path 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/losses.py | l1_regularizer | def l1_regularizer(weight=1.0, scope=None):
"""Define a L1 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
"""
def regularizer(tensor):
with tf.name_scope(scope, 'L1Regularizer', [tensor]):
l1_weight = tf.... | python | def l1_regularizer(weight=1.0, scope=None):
"""Define a L1 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
"""
def regularizer(tensor):
with tf.name_scope(scope, 'L1Regularizer', [tensor]):
l1_weight = tf.... | [
"def",
"l1_regularizer",
"(",
"weight",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"def",
"regularizer",
"(",
"tensor",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'L1Regularizer'",
",",
"[",
"tensor",
"]",
")",
":",
"l1_weight... | Define a L1 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function. | [
"Define",
"a",
"L1",
"regularizer",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/losses.py#L37-L53 | train | Define a L1 regularizer function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/losses.py | l2_regularizer | def l2_regularizer(weight=1.0, scope=None):
"""Define a L2 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
"""
def regularizer(tensor):
with tf.name_scope(scope, 'L2Regularizer', [tensor]):
l2_weight = tf.... | python | def l2_regularizer(weight=1.0, scope=None):
"""Define a L2 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
"""
def regularizer(tensor):
with tf.name_scope(scope, 'L2Regularizer', [tensor]):
l2_weight = tf.... | [
"def",
"l2_regularizer",
"(",
"weight",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"def",
"regularizer",
"(",
"tensor",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'L2Regularizer'",
",",
"[",
"tensor",
"]",
")",
":",
"l2_weight... | Define a L2 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function. | [
"Define",
"a",
"L2",
"regularizer",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/losses.py#L56-L72 | train | Define a L2 regularizer function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/losses.py | l1_l2_regularizer | def l1_l2_regularizer(weight_l1=1.0, weight_l2=1.0, scope=None):
"""Define a L1L2 regularizer.
Args:
weight_l1: scale the L1 loss by this factor.
weight_l2: scale the L2 loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
"""
def regularizer(tensor):
... | python | def l1_l2_regularizer(weight_l1=1.0, weight_l2=1.0, scope=None):
"""Define a L1L2 regularizer.
Args:
weight_l1: scale the L1 loss by this factor.
weight_l2: scale the L2 loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
"""
def regularizer(tensor):
... | [
"def",
"l1_l2_regularizer",
"(",
"weight_l1",
"=",
"1.0",
",",
"weight_l2",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"def",
"regularizer",
"(",
"tensor",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'L1L2Regularizer'",
",",
"[",... | Define a L1L2 regularizer.
Args:
weight_l1: scale the L1 loss by this factor.
weight_l2: scale the L2 loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function. | [
"Define",
"a",
"L1L2",
"regularizer",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/losses.py#L75-L99 | train | Define a L1L2 regularizer. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/losses.py | l1_loss | def l1_loss(tensor, weight=1.0, scope=None):
"""Define a L1Loss, useful for regularize, i.e. lasso.
Args:
tensor: tensor to regularize.
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
the L1 loss op.
"""
with tf.name_scope(scope, 'L1Loss', [tensor]):
... | python | def l1_loss(tensor, weight=1.0, scope=None):
"""Define a L1Loss, useful for regularize, i.e. lasso.
Args:
tensor: tensor to regularize.
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
the L1 loss op.
"""
with tf.name_scope(scope, 'L1Loss', [tensor]):
... | [
"def",
"l1_loss",
"(",
"tensor",
",",
"weight",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'L1Loss'",
",",
"[",
"tensor",
"]",
")",
":",
"weight",
"=",
"tf",
".",
"convert_to_tensor",
"(",
... | Define a L1Loss, useful for regularize, i.e. lasso.
Args:
tensor: tensor to regularize.
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
the L1 loss op. | [
"Define",
"a",
"L1Loss",
"useful",
"for",
"regularize",
"i",
".",
"e",
".",
"lasso",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/losses.py#L102-L119 | train | Define a L1Loss useful for regularize. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/losses.py | l2_loss | def l2_loss(tensor, weight=1.0, scope=None):
"""Define a L2Loss, useful for regularize, i.e. weight decay.
Args:
tensor: tensor to regularize.
weight: an optional weight to modulate the loss.
scope: Optional scope for name_scope.
Returns:
the L2 loss op.
"""
with tf.name_scope(scope, 'L2Loss... | python | def l2_loss(tensor, weight=1.0, scope=None):
"""Define a L2Loss, useful for regularize, i.e. weight decay.
Args:
tensor: tensor to regularize.
weight: an optional weight to modulate the loss.
scope: Optional scope for name_scope.
Returns:
the L2 loss op.
"""
with tf.name_scope(scope, 'L2Loss... | [
"def",
"l2_loss",
"(",
"tensor",
",",
"weight",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'L2Loss'",
",",
"[",
"tensor",
"]",
")",
":",
"weight",
"=",
"tf",
".",
"convert_to_tensor",
"(",
... | Define a L2Loss, useful for regularize, i.e. weight decay.
Args:
tensor: tensor to regularize.
weight: an optional weight to modulate the loss.
scope: Optional scope for name_scope.
Returns:
the L2 loss op. | [
"Define",
"a",
"L2Loss",
"useful",
"for",
"regularize",
"i",
".",
"e",
".",
"weight",
"decay",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/losses.py#L122-L139 | train | Define a L2Loss useful for regularize. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/losses.py | cross_entropy_loss | def cross_entropy_loss(logits, one_hot_labels, label_smoothing=0,
weight=1.0, scope=None):
"""Define a Cross Entropy loss using softmax_cross_entropy_with_logits.
It can scale the loss by weight factor, and smooth the labels.
Args:
logits: [batch_size, num_classes] logits outputs of t... | python | def cross_entropy_loss(logits, one_hot_labels, label_smoothing=0,
weight=1.0, scope=None):
"""Define a Cross Entropy loss using softmax_cross_entropy_with_logits.
It can scale the loss by weight factor, and smooth the labels.
Args:
logits: [batch_size, num_classes] logits outputs of t... | [
"def",
"cross_entropy_loss",
"(",
"logits",
",",
"one_hot_labels",
",",
"label_smoothing",
"=",
"0",
",",
"weight",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"logits",
".",
"get_shape",
"(",
")",
".",
"assert_is_compatible_with",
"(",
"one_hot_labels",
... | Define a Cross Entropy loss using softmax_cross_entropy_with_logits.
It can scale the loss by weight factor, and smooth the labels.
Args:
logits: [batch_size, num_classes] logits outputs of the network .
one_hot_labels: [batch_size, num_classes] target one_hot_encoded labels.
label_smoothing: if great... | [
"Define",
"a",
"Cross",
"Entropy",
"loss",
"using",
"softmax_cross_entropy_with_logits",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/losses.py#L142-L174 | train | Define a Cross Entropy loss using softmax_cross_entropy_with_logits. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/scopes.py | arg_scope | def arg_scope(list_ops_or_scope, **kwargs):
"""Stores the default arguments for the given set of list_ops.
For usage, please see examples at top of the file.
Args:
list_ops_or_scope: List or tuple of operations to set argument scope for or
a dictionary containg the current scope. When list_ops_or_scop... | python | def arg_scope(list_ops_or_scope, **kwargs):
"""Stores the default arguments for the given set of list_ops.
For usage, please see examples at top of the file.
Args:
list_ops_or_scope: List or tuple of operations to set argument scope for or
a dictionary containg the current scope. When list_ops_or_scop... | [
"def",
"arg_scope",
"(",
"list_ops_or_scope",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"list_ops_or_scope",
",",
"dict",
")",
":",
"# Assumes that list_ops_or_scope is a scope that is being reused.",
"if",
"kwargs",
":",
"raise",
"ValueError",
"(",
... | Stores the default arguments for the given set of list_ops.
For usage, please see examples at top of the file.
Args:
list_ops_or_scope: List or tuple of operations to set argument scope for or
a dictionary containg the current scope. When list_ops_or_scope is a dict,
kwargs must be empty. When lis... | [
"Stores",
"the",
"default",
"arguments",
"for",
"the",
"given",
"set",
"of",
"list_ops",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/scopes.py#L85-L135 | train | Stores the default arguments for the given set of list_ops. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/slim/scopes.py | add_arg_scope | def add_arg_scope(func):
"""Decorates a function with args so it can be used within an arg_scope.
Args:
func: function to decorate.
Returns:
A tuple with the decorated function func_with_args().
"""
@functools.wraps(func)
def func_with_args(*args, **kwargs):
current_scope = _current_arg_scope(... | python | def add_arg_scope(func):
"""Decorates a function with args so it can be used within an arg_scope.
Args:
func: function to decorate.
Returns:
A tuple with the decorated function func_with_args().
"""
@functools.wraps(func)
def func_with_args(*args, **kwargs):
current_scope = _current_arg_scope(... | [
"def",
"add_arg_scope",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"func_with_args",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"current_scope",
"=",
"_current_arg_scope",
"(",
")",
"current_args",
"=",
"kwa... | Decorates a function with args so it can be used within an arg_scope.
Args:
func: function to decorate.
Returns:
A tuple with the decorated function func_with_args(). | [
"Decorates",
"a",
"function",
"with",
"args",
"so",
"it",
"can",
"be",
"used",
"within",
"an",
"arg_scope",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/scopes.py#L138-L157 | train | Decorates a function with args so it can be used within an arg_scope. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | _get_manager | def _get_manager(cluster_info, host, executor_id):
"""Returns this executor's "singleton" instance of the multiprocessing.Manager, reconnecting per python-worker if needed.
Args:
:cluster_info: cluster node reservations
:host: host IP address
:executor_id: unique id per executor (created during initial... | python | def _get_manager(cluster_info, host, executor_id):
"""Returns this executor's "singleton" instance of the multiprocessing.Manager, reconnecting per python-worker if needed.
Args:
:cluster_info: cluster node reservations
:host: host IP address
:executor_id: unique id per executor (created during initial... | [
"def",
"_get_manager",
"(",
"cluster_info",
",",
"host",
",",
"executor_id",
")",
":",
"for",
"node",
"in",
"cluster_info",
":",
"if",
"node",
"[",
"'host'",
"]",
"==",
"host",
"and",
"node",
"[",
"'executor_id'",
"]",
"==",
"executor_id",
":",
"addr",
"... | Returns this executor's "singleton" instance of the multiprocessing.Manager, reconnecting per python-worker if needed.
Args:
:cluster_info: cluster node reservations
:host: host IP address
:executor_id: unique id per executor (created during initial call to run())
Returns:
TFManager instance for t... | [
"Returns",
"this",
"executor",
"s",
"singleton",
"instance",
"of",
"the",
"multiprocessing",
".",
"Manager",
"reconnecting",
"per",
"python",
"-",
"worker",
"if",
"needed",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L91-L117 | train | Returns this executor s singleton instance of the multiprocessing. Manager. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | run | def run(fn, tf_args, cluster_meta, tensorboard, log_dir, queues, background):
"""Wraps the user-provided TensorFlow main function in a Spark mapPartitions function.
Args:
:fn: TensorFlow "main" function provided by the user.
:tf_args: ``argparse`` args, or command line ``ARGV``. These will be passed to th... | python | def run(fn, tf_args, cluster_meta, tensorboard, log_dir, queues, background):
"""Wraps the user-provided TensorFlow main function in a Spark mapPartitions function.
Args:
:fn: TensorFlow "main" function provided by the user.
:tf_args: ``argparse`` args, or command line ``ARGV``. These will be passed to th... | [
"def",
"run",
"(",
"fn",
",",
"tf_args",
",",
"cluster_meta",
",",
"tensorboard",
",",
"log_dir",
",",
"queues",
",",
"background",
")",
":",
"def",
"_mapfn",
"(",
"iter",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"# Note: consuming the input iterator help... | Wraps the user-provided TensorFlow main function in a Spark mapPartitions function.
Args:
:fn: TensorFlow "main" function provided by the user.
:tf_args: ``argparse`` args, or command line ``ARGV``. These will be passed to the ``fn``.
:cluster_meta: dictionary of cluster metadata (e.g. cluster_id, reser... | [
"Wraps",
"the",
"user",
"-",
"provided",
"TensorFlow",
"main",
"function",
"in",
"a",
"Spark",
"mapPartitions",
"function",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L120-L369 | train | Wraps the user - provided TensorFlow main function in a Spark mapPartitions function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | train | def train(cluster_info, cluster_meta, feed_timeout=600, qname='input'):
"""Feeds Spark partitions into the shared multiprocessing.Queue.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:cluster_meta: dictionary of cluster metadata (e.g. cluster_id... | python | def train(cluster_info, cluster_meta, feed_timeout=600, qname='input'):
"""Feeds Spark partitions into the shared multiprocessing.Queue.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:cluster_meta: dictionary of cluster metadata (e.g. cluster_id... | [
"def",
"train",
"(",
"cluster_info",
",",
"cluster_meta",
",",
"feed_timeout",
"=",
"600",
",",
"qname",
"=",
"'input'",
")",
":",
"def",
"_train",
"(",
"iter",
")",
":",
"# get shared queue, reconnecting if necessary",
"mgr",
"=",
"_get_manager",
"(",
"cluster_... | Feeds Spark partitions into the shared multiprocessing.Queue.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:cluster_meta: dictionary of cluster metadata (e.g. cluster_id, reservation.Server address, etc)
:feed_timeout: number of seconds after... | [
"Feeds",
"Spark",
"partitions",
"into",
"the",
"shared",
"multiprocessing",
".",
"Queue",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L372-L440 | train | Train Spark partitions into the shared multiprocessing. 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | inference | def inference(cluster_info, feed_timeout=600, qname='input'):
"""Feeds Spark partitions into the shared multiprocessing.Queue and returns inference results.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:feed_timeout: number of seconds after whi... | python | def inference(cluster_info, feed_timeout=600, qname='input'):
"""Feeds Spark partitions into the shared multiprocessing.Queue and returns inference results.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:feed_timeout: number of seconds after whi... | [
"def",
"inference",
"(",
"cluster_info",
",",
"feed_timeout",
"=",
"600",
",",
"qname",
"=",
"'input'",
")",
":",
"def",
"_inference",
"(",
"iter",
")",
":",
"# get shared queue, reconnecting if necessary",
"mgr",
"=",
"_get_manager",
"(",
"cluster_info",
",",
"... | Feeds Spark partitions into the shared multiprocessing.Queue and returns inference results.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:feed_timeout: number of seconds after which data feeding times out (600 sec default)
:qname: *INTERNAL_U... | [
"Feeds",
"Spark",
"partitions",
"into",
"the",
"shared",
"multiprocessing",
".",
"Queue",
"and",
"returns",
"inference",
"results",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L443-L505 | train | Feeds Spark partitions into the shared multiprocessing. Queue and returns inference results. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | shutdown | def shutdown(cluster_info, queues=['input']):
"""Stops all TensorFlow nodes by feeding ``None`` into the multiprocessing.Queues.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc).
:queues: *INTERNAL_USE*
Returns:
A nodeRDD.mapPartitions() fun... | python | def shutdown(cluster_info, queues=['input']):
"""Stops all TensorFlow nodes by feeding ``None`` into the multiprocessing.Queues.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc).
:queues: *INTERNAL_USE*
Returns:
A nodeRDD.mapPartitions() fun... | [
"def",
"shutdown",
"(",
"cluster_info",
",",
"queues",
"=",
"[",
"'input'",
"]",
")",
":",
"def",
"_shutdown",
"(",
"iter",
")",
":",
"host",
"=",
"util",
".",
"get_ip_address",
"(",
")",
"executor_id",
"=",
"util",
".",
"read_executor_id",
"(",
")",
"... | Stops all TensorFlow nodes by feeding ``None`` into the multiprocessing.Queues.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc).
:queues: *INTERNAL_USE*
Returns:
A nodeRDD.mapPartitions() function | [
"Stops",
"all",
"TensorFlow",
"nodes",
"by",
"feeding",
"None",
"into",
"the",
"multiprocessing",
".",
"Queues",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L508-L548 | train | Stops all TensorFlow nodes by feeding None into the multiprocessing. Queues. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | TFNodeContext.start_cluster_server | def start_cluster_server(self, num_gpus=1, rdma=False):
"""Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance."""
return TFNode.start_cluster_server(self, num_gpus, rdma) | python | def start_cluster_server(self, num_gpus=1, rdma=False):
"""Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance."""
return TFNode.start_cluster_server(self, num_gpus, rdma) | [
"def",
"start_cluster_server",
"(",
"self",
",",
"num_gpus",
"=",
"1",
",",
"rdma",
"=",
"False",
")",
":",
"return",
"TFNode",
".",
"start_cluster_server",
"(",
"self",
",",
"num_gpus",
",",
"rdma",
")"
] | Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance. | [
"Convenience",
"function",
"to",
"access",
"TFNode",
".",
"start_cluster_server",
"directly",
"from",
"this",
"object",
"instance",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L61-L63 | train | Convenience function to access TFNode. start_cluster_server directly from this object instance. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | TFNodeContext.export_saved_model | def export_saved_model(self, sess, export_dir, tag_set, signatures):
"""Convenience function to access ``TFNode.export_saved_model`` directly from this object instance."""
TFNode.export_saved_model(sess, export_dir, tag_set, signatures) | python | def export_saved_model(self, sess, export_dir, tag_set, signatures):
"""Convenience function to access ``TFNode.export_saved_model`` directly from this object instance."""
TFNode.export_saved_model(sess, export_dir, tag_set, signatures) | [
"def",
"export_saved_model",
"(",
"self",
",",
"sess",
",",
"export_dir",
",",
"tag_set",
",",
"signatures",
")",
":",
"TFNode",
".",
"export_saved_model",
"(",
"sess",
",",
"export_dir",
",",
"tag_set",
",",
"signatures",
")"
] | Convenience function to access ``TFNode.export_saved_model`` directly from this object instance. | [
"Convenience",
"function",
"to",
"access",
"TFNode",
".",
"export_saved_model",
"directly",
"from",
"this",
"object",
"instance",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L65-L67 | train | Exports the saved model to a 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFSparkNode.py | TFNodeContext.get_data_feed | def get_data_feed(self, train_mode=True, qname_in='input', qname_out='output', input_mapping=None):
"""Convenience function to access ``TFNode.DataFeed`` directly from this object instance."""
return TFNode.DataFeed(self.mgr, train_mode, qname_in, qname_out, input_mapping) | python | def get_data_feed(self, train_mode=True, qname_in='input', qname_out='output', input_mapping=None):
"""Convenience function to access ``TFNode.DataFeed`` directly from this object instance."""
return TFNode.DataFeed(self.mgr, train_mode, qname_in, qname_out, input_mapping) | [
"def",
"get_data_feed",
"(",
"self",
",",
"train_mode",
"=",
"True",
",",
"qname_in",
"=",
"'input'",
",",
"qname_out",
"=",
"'output'",
",",
"input_mapping",
"=",
"None",
")",
":",
"return",
"TFNode",
".",
"DataFeed",
"(",
"self",
".",
"mgr",
",",
"trai... | Convenience function to access ``TFNode.DataFeed`` directly from this object instance. | [
"Convenience",
"function",
"to",
"access",
"TFNode",
".",
"DataFeed",
"directly",
"from",
"this",
"object",
"instance",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFSparkNode.py#L69-L71 | train | Convenience function to access TFNode. DataFeed directly from this object instance. | 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... |
yahoo/TensorFlowOnSpark | examples/wide_deep/census_dataset.py | _download_and_clean_file | def _download_and_clean_file(filename, url):
"""Downloads data from url, and makes changes to match the CSV format."""
temp_file, _ = urllib.request.urlretrieve(url)
with tf.gfile.Open(temp_file, 'r') as temp_eval_file:
with tf.gfile.Open(filename, 'w') as eval_file:
for line in temp_eval_file:
... | python | def _download_and_clean_file(filename, url):
"""Downloads data from url, and makes changes to match the CSV format."""
temp_file, _ = urllib.request.urlretrieve(url)
with tf.gfile.Open(temp_file, 'r') as temp_eval_file:
with tf.gfile.Open(filename, 'w') as eval_file:
for line in temp_eval_file:
... | [
"def",
"_download_and_clean_file",
"(",
"filename",
",",
"url",
")",
":",
"temp_file",
",",
"_",
"=",
"urllib",
".",
"request",
".",
"urlretrieve",
"(",
"url",
")",
"with",
"tf",
".",
"gfile",
".",
"Open",
"(",
"temp_file",
",",
"'r'",
")",
"as",
"temp... | Downloads data from url, and makes changes to match the CSV format. | [
"Downloads",
"data",
"from",
"url",
"and",
"makes",
"changes",
"to",
"match",
"the",
"CSV",
"format",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_dataset.py#L59-L73 | train | Downloads data from url and makes changes to match the CSV format. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/wide_deep/census_dataset.py | download | def download(data_dir):
"""Download census data if it is not already present."""
tf.gfile.MakeDirs(data_dir)
training_file_path = os.path.join(data_dir, TRAINING_FILE)
if not tf.gfile.Exists(training_file_path):
_download_and_clean_file(training_file_path, TRAINING_URL)
eval_file_path = os.path.join(dat... | python | def download(data_dir):
"""Download census data if it is not already present."""
tf.gfile.MakeDirs(data_dir)
training_file_path = os.path.join(data_dir, TRAINING_FILE)
if not tf.gfile.Exists(training_file_path):
_download_and_clean_file(training_file_path, TRAINING_URL)
eval_file_path = os.path.join(dat... | [
"def",
"download",
"(",
"data_dir",
")",
":",
"tf",
".",
"gfile",
".",
"MakeDirs",
"(",
"data_dir",
")",
"training_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"TRAINING_FILE",
")",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exist... | Download census data if it is not already present. | [
"Download",
"census",
"data",
"if",
"it",
"is",
"not",
"already",
"present",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_dataset.py#L76-L86 | train | Download census data if it is not already present. | 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... |
yahoo/TensorFlowOnSpark | examples/wide_deep/census_dataset.py | build_model_columns | def build_model_columns():
"""Builds a set of wide and deep feature columns."""
# Continuous variable columns
age = tf.feature_column.numeric_column('age')
education_num = tf.feature_column.numeric_column('education_num')
capital_gain = tf.feature_column.numeric_column('capital_gain')
capital_loss = tf.feat... | python | def build_model_columns():
"""Builds a set of wide and deep feature columns."""
# Continuous variable columns
age = tf.feature_column.numeric_column('age')
education_num = tf.feature_column.numeric_column('education_num')
capital_gain = tf.feature_column.numeric_column('capital_gain')
capital_loss = tf.feat... | [
"def",
"build_model_columns",
"(",
")",
":",
"# Continuous variable columns",
"age",
"=",
"tf",
".",
"feature_column",
".",
"numeric_column",
"(",
"'age'",
")",
"education_num",
"=",
"tf",
".",
"feature_column",
".",
"numeric_column",
"(",
"'education_num'",
")",
... | Builds a set of wide and deep feature columns. | [
"Builds",
"a",
"set",
"of",
"wide",
"and",
"deep",
"feature",
"columns",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_dataset.py#L89-L157 | train | Builds a set of wide and deep feature columns. | 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... |
yahoo/TensorFlowOnSpark | examples/wide_deep/census_dataset.py | input_fn | def input_fn(data_file, num_epochs, shuffle, batch_size):
"""Generate an input function for the Estimator."""
assert tf.gfile.Exists(data_file), (
'%s not found. Please make sure you have run census_dataset.py and '
'set the --data_dir argument to the correct path.' % data_file)
def parse_csv(value):... | python | def input_fn(data_file, num_epochs, shuffle, batch_size):
"""Generate an input function for the Estimator."""
assert tf.gfile.Exists(data_file), (
'%s not found. Please make sure you have run census_dataset.py and '
'set the --data_dir argument to the correct path.' % data_file)
def parse_csv(value):... | [
"def",
"input_fn",
"(",
"data_file",
",",
"num_epochs",
",",
"shuffle",
",",
"batch_size",
")",
":",
"assert",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"data_file",
")",
",",
"(",
"'%s not found. Please make sure you have run census_dataset.py and '",
"'set the --data_... | Generate an input function for the Estimator. | [
"Generate",
"an",
"input",
"function",
"for",
"the",
"Estimator",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_dataset.py#L160-L186 | train | Generate an input function for the 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/reservation.py | MessageSocket.receive | def receive(self, sock):
"""Receive a message on ``sock``."""
msg = None
data = b''
recv_done = False
recv_len = -1
while not recv_done:
buf = sock.recv(BUFSIZE)
if buf is None or len(buf) == 0:
raise Exception("socket closed")
if recv_len == -1:
recv_len = stru... | python | def receive(self, sock):
"""Receive a message on ``sock``."""
msg = None
data = b''
recv_done = False
recv_len = -1
while not recv_done:
buf = sock.recv(BUFSIZE)
if buf is None or len(buf) == 0:
raise Exception("socket closed")
if recv_len == -1:
recv_len = stru... | [
"def",
"receive",
"(",
"self",
",",
"sock",
")",
":",
"msg",
"=",
"None",
"data",
"=",
"b''",
"recv_done",
"=",
"False",
"recv_len",
"=",
"-",
"1",
"while",
"not",
"recv_done",
":",
"buf",
"=",
"sock",
".",
"recv",
"(",
"BUFSIZE",
")",
"if",
"buf",... | Receive a message on ``sock``. | [
"Receive",
"a",
"message",
"on",
"sock",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L69-L89 | train | Receive a message on the given socket. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/reservation.py | MessageSocket.send | def send(self, sock, msg):
"""Send ``msg`` to destination ``sock``."""
data = pickle.dumps(msg)
buf = struct.pack('>I', len(data)) + data
sock.sendall(buf) | python | def send(self, sock, msg):
"""Send ``msg`` to destination ``sock``."""
data = pickle.dumps(msg)
buf = struct.pack('>I', len(data)) + data
sock.sendall(buf) | [
"def",
"send",
"(",
"self",
",",
"sock",
",",
"msg",
")",
":",
"data",
"=",
"pickle",
".",
"dumps",
"(",
"msg",
")",
"buf",
"=",
"struct",
".",
"pack",
"(",
"'>I'",
",",
"len",
"(",
"data",
")",
")",
"+",
"data",
"sock",
".",
"sendall",
"(",
... | Send ``msg`` to destination ``sock``. | [
"Send",
"msg",
"to",
"destination",
"sock",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L91-L95 | train | Send msg to destination sock. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/reservation.py | Server.await_reservations | def await_reservations(self, sc, status={}, timeout=600):
"""Block until all reservations are received."""
timespent = 0
while not self.reservations.done():
logging.info("waiting for {0} reservations".format(self.reservations.remaining()))
# check status flags for any errors
if 'error' in ... | python | def await_reservations(self, sc, status={}, timeout=600):
"""Block until all reservations are received."""
timespent = 0
while not self.reservations.done():
logging.info("waiting for {0} reservations".format(self.reservations.remaining()))
# check status flags for any errors
if 'error' in ... | [
"def",
"await_reservations",
"(",
"self",
",",
"sc",
",",
"status",
"=",
"{",
"}",
",",
"timeout",
"=",
"600",
")",
":",
"timespent",
"=",
"0",
"while",
"not",
"self",
".",
"reservations",
".",
"done",
"(",
")",
":",
"logging",
".",
"info",
"(",
"\... | Block until all reservations are received. | [
"Block",
"until",
"all",
"reservations",
"are",
"received",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L111-L126 | train | Block until all reservations are received. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/reservation.py | Server.start | def start(self):
"""Start listener in a background thread
Returns:
address of the Server as a tuple of (host, port)
"""
server_sock = self.start_listening_socket()
# hostname may not be resolvable but IP address probably will be
host = self.get_server_ip()
port = server_sock.getsockn... | python | def start(self):
"""Start listener in a background thread
Returns:
address of the Server as a tuple of (host, port)
"""
server_sock = self.start_listening_socket()
# hostname may not be resolvable but IP address probably will be
host = self.get_server_ip()
port = server_sock.getsockn... | [
"def",
"start",
"(",
"self",
")",
":",
"server_sock",
"=",
"self",
".",
"start_listening_socket",
"(",
")",
"# hostname may not be resolvable but IP address probably will be",
"host",
"=",
"self",
".",
"get_server_ip",
"(",
")",
"port",
"=",
"server_sock",
".",
"get... | Start listener in a background thread
Returns:
address of the Server as a tuple of (host, port) | [
"Start",
"listener",
"in",
"a",
"background",
"thread"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L146-L186 | train | Start a listener thread for reservations on the server. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/reservation.py | Client._request | def _request(self, msg_type, msg_data=None):
"""Helper function to wrap msg w/ msg_type."""
msg = {}
msg['type'] = msg_type
if msg_data:
msg['data'] = msg_data
done = False
tries = 0
while not done and tries < MAX_RETRIES:
try:
MessageSocket.send(self, self.sock, msg)
... | python | def _request(self, msg_type, msg_data=None):
"""Helper function to wrap msg w/ msg_type."""
msg = {}
msg['type'] = msg_type
if msg_data:
msg['data'] = msg_data
done = False
tries = 0
while not done and tries < MAX_RETRIES:
try:
MessageSocket.send(self, self.sock, msg)
... | [
"def",
"_request",
"(",
"self",
",",
"msg_type",
",",
"msg_data",
"=",
"None",
")",
":",
"msg",
"=",
"{",
"}",
"msg",
"[",
"'type'",
"]",
"=",
"msg_type",
"if",
"msg_data",
":",
"msg",
"[",
"'data'",
"]",
"=",
"msg_data",
"done",
"=",
"False",
"tri... | Helper function to wrap msg w/ msg_type. | [
"Helper",
"function",
"to",
"wrap",
"msg",
"w",
"/",
"msg_type",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L220-L245 | train | Wrapper function to wrap msg w/ msg_type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/reservation.py | Client.await_reservations | def await_reservations(self):
"""Poll until all reservations completed, then return cluster_info."""
done = False
while not done:
done = self._request('QUERY')
time.sleep(1)
return self.get_reservations() | python | def await_reservations(self):
"""Poll until all reservations completed, then return cluster_info."""
done = False
while not done:
done = self._request('QUERY')
time.sleep(1)
return self.get_reservations() | [
"def",
"await_reservations",
"(",
"self",
")",
":",
"done",
"=",
"False",
"while",
"not",
"done",
":",
"done",
"=",
"self",
".",
"_request",
"(",
"'QUERY'",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"return",
"self",
".",
"get_reservations",
"(",
")"
] | Poll until all reservations completed, then return cluster_info. | [
"Poll",
"until",
"all",
"reservations",
"completed",
"then",
"return",
"cluster_info",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L261-L267 | train | Poll until all reservations completed then return cluster_info. | 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... |
yahoo/TensorFlowOnSpark | examples/mnist/mnist_data_setup.py | toTFExample | def toTFExample(image, label):
"""Serializes an image/label as a TFExample byte string"""
example = tf.train.Example(
features=tf.train.Features(
feature={
'label': tf.train.Feature(int64_list=tf.train.Int64List(value=label.astype("int64"))),
'image': tf.train.Feature(int64_list=tf.train.I... | python | def toTFExample(image, label):
"""Serializes an image/label as a TFExample byte string"""
example = tf.train.Example(
features=tf.train.Features(
feature={
'label': tf.train.Feature(int64_list=tf.train.Int64List(value=label.astype("int64"))),
'image': tf.train.Feature(int64_list=tf.train.I... | [
"def",
"toTFExample",
"(",
"image",
",",
"label",
")",
":",
"example",
"=",
"tf",
".",
"train",
".",
"Example",
"(",
"features",
"=",
"tf",
".",
"train",
".",
"Features",
"(",
"feature",
"=",
"{",
"'label'",
":",
"tf",
".",
"train",
".",
"Feature",
... | Serializes an image/label as a TFExample byte string | [
"Serializes",
"an",
"image",
"/",
"label",
"as",
"a",
"TFExample",
"byte",
"string"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L14-L24 | train | Serializes an image and label as a TFExample byte 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... |
yahoo/TensorFlowOnSpark | examples/mnist/mnist_data_setup.py | fromTFExample | def fromTFExample(bytestr):
"""Deserializes a TFExample from a byte string"""
example = tf.train.Example()
example.ParseFromString(bytestr)
return example | python | def fromTFExample(bytestr):
"""Deserializes a TFExample from a byte string"""
example = tf.train.Example()
example.ParseFromString(bytestr)
return example | [
"def",
"fromTFExample",
"(",
"bytestr",
")",
":",
"example",
"=",
"tf",
".",
"train",
".",
"Example",
"(",
")",
"example",
".",
"ParseFromString",
"(",
"bytestr",
")",
"return",
"example"
] | Deserializes a TFExample from a byte string | [
"Deserializes",
"a",
"TFExample",
"from",
"a",
"byte",
"string"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L27-L31 | train | Deserializes a TFExample from a byte 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... |
yahoo/TensorFlowOnSpark | examples/mnist/mnist_data_setup.py | writeMNIST | def writeMNIST(sc, input_images, input_labels, output, format, num_partitions):
"""Writes MNIST image/label vectors into parallelized files on HDFS"""
# load MNIST gzip into memory
with open(input_images, 'rb') as f:
images = numpy.array(mnist.extract_images(f))
with open(input_labels, 'rb') as f:
if f... | python | def writeMNIST(sc, input_images, input_labels, output, format, num_partitions):
"""Writes MNIST image/label vectors into parallelized files on HDFS"""
# load MNIST gzip into memory
with open(input_images, 'rb') as f:
images = numpy.array(mnist.extract_images(f))
with open(input_labels, 'rb') as f:
if f... | [
"def",
"writeMNIST",
"(",
"sc",
",",
"input_images",
",",
"input_labels",
",",
"output",
",",
"format",
",",
"num_partitions",
")",
":",
"# load MNIST gzip into memory",
"with",
"open",
"(",
"input_images",
",",
"'rb'",
")",
"as",
"f",
":",
"images",
"=",
"n... | Writes MNIST image/label vectors into parallelized files on HDFS | [
"Writes",
"MNIST",
"image",
"/",
"label",
"vectors",
"into",
"parallelized",
"files",
"on",
"HDFS"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L44-L81 | train | Writes MNIST image and label vectors into parallelized files on HDFS | 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... |
yahoo/TensorFlowOnSpark | examples/mnist/mnist_data_setup.py | readMNIST | def readMNIST(sc, output, format):
"""Reads/verifies previously created output"""
output_images = output + "/images"
output_labels = output + "/labels"
imageRDD = None
labelRDD = None
if format == "pickle":
imageRDD = sc.pickleFile(output_images)
labelRDD = sc.pickleFile(output_labels)
elif form... | python | def readMNIST(sc, output, format):
"""Reads/verifies previously created output"""
output_images = output + "/images"
output_labels = output + "/labels"
imageRDD = None
labelRDD = None
if format == "pickle":
imageRDD = sc.pickleFile(output_images)
labelRDD = sc.pickleFile(output_labels)
elif form... | [
"def",
"readMNIST",
"(",
"sc",
",",
"output",
",",
"format",
")",
":",
"output_images",
"=",
"output",
"+",
"\"/images\"",
"output_labels",
"=",
"output",
"+",
"\"/labels\"",
"imageRDD",
"=",
"None",
"labelRDD",
"=",
"None",
"if",
"format",
"==",
"\"pickle\"... | Reads/verifies previously created output | [
"Reads",
"/",
"verifies",
"previously",
"created",
"output"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L94-L120 | train | Reads/verifies previously created output | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/inception_model.py | inference | def inference(images, num_classes, for_training=False, restore_logits=True,
scope=None):
"""Build Inception v3 model architecture.
See here for reference: http://arxiv.org/abs/1512.00567
Args:
images: Images returned from inputs() or distorted_inputs().
num_classes: number of classes
f... | python | def inference(images, num_classes, for_training=False, restore_logits=True,
scope=None):
"""Build Inception v3 model architecture.
See here for reference: http://arxiv.org/abs/1512.00567
Args:
images: Images returned from inputs() or distorted_inputs().
num_classes: number of classes
f... | [
"def",
"inference",
"(",
"images",
",",
"num_classes",
",",
"for_training",
"=",
"False",
",",
"restore_logits",
"=",
"True",
",",
"scope",
"=",
"None",
")",
":",
"# Parameters for BatchNorm.",
"batch_norm_params",
"=",
"{",
"# Decay for the moving averages.",
"'dec... | Build Inception v3 model architecture.
See here for reference: http://arxiv.org/abs/1512.00567
Args:
images: Images returned from inputs() or distorted_inputs().
num_classes: number of classes
for_training: If set to `True`, build the inference model for training.
Kernels that operate differentl... | [
"Build",
"Inception",
"v3",
"model",
"architecture",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_model.py#L48-L95 | train | Builds an Inception v3 model architecture. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/inception_model.py | loss | def loss(logits, labels, batch_size=None):
"""Adds all losses for the model.
Note the final loss is not returned. Instead, the list of losses are collected
by slim.losses. The losses are accumulated in tower_loss() and summed to
calculate the total loss.
Args:
logits: List of logits from inference(). Ea... | python | def loss(logits, labels, batch_size=None):
"""Adds all losses for the model.
Note the final loss is not returned. Instead, the list of losses are collected
by slim.losses. The losses are accumulated in tower_loss() and summed to
calculate the total loss.
Args:
logits: List of logits from inference(). Ea... | [
"def",
"loss",
"(",
"logits",
",",
"labels",
",",
"batch_size",
"=",
"None",
")",
":",
"if",
"not",
"batch_size",
":",
"batch_size",
"=",
"FLAGS",
".",
"batch_size",
"# Reshape the labels into a dense Tensor of",
"# shape [FLAGS.batch_size, num_classes].",
"sparse_label... | Adds all losses for the model.
Note the final loss is not returned. Instead, the list of losses are collected
by slim.losses. The losses are accumulated in tower_loss() and summed to
calculate the total loss.
Args:
logits: List of logits from inference(). Each entry is a 2-D float Tensor.
labels: Labe... | [
"Adds",
"all",
"losses",
"for",
"the",
"model",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_model.py#L98-L135 | train | Adds all losses for the 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFNode.py | hdfs_path | def hdfs_path(ctx, path):
"""Convenience function to create a Tensorflow-compatible absolute HDFS path from relative paths
Args:
:ctx: TFNodeContext containing the metadata specific to this node in the cluster.
:path: path to convert
Returns:
An absolute path prefixed with the correct filesystem sch... | python | def hdfs_path(ctx, path):
"""Convenience function to create a Tensorflow-compatible absolute HDFS path from relative paths
Args:
:ctx: TFNodeContext containing the metadata specific to this node in the cluster.
:path: path to convert
Returns:
An absolute path prefixed with the correct filesystem sch... | [
"def",
"hdfs_path",
"(",
"ctx",
",",
"path",
")",
":",
"# All Hadoop-Compatible File System Schemes (as of Hadoop 3.0.x):",
"HADOOP_SCHEMES",
"=",
"[",
"'adl://'",
",",
"'file://'",
",",
"'hdfs://'",
",",
"'oss://'",
",",
"'s3://'",
",",
"'s3a://'",
",",
"'s3n://'",
... | Convenience function to create a Tensorflow-compatible absolute HDFS path from relative paths
Args:
:ctx: TFNodeContext containing the metadata specific to this node in the cluster.
:path: path to convert
Returns:
An absolute path prefixed with the correct filesystem scheme. | [
"Convenience",
"function",
"to",
"create",
"a",
"Tensorflow",
"-",
"compatible",
"absolute",
"HDFS",
"path",
"from",
"relative",
"paths"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L25-L60 | train | Convenience function to create a Tensorflow - compatible absolute HDFS path from relative paths. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFNode.py | export_saved_model | def export_saved_model(sess, export_dir, tag_set, signatures):
"""Convenience function to export a saved_model using provided arguments
The caller specifies the saved_model signatures in a simplified python dictionary form, as follows::
signatures = {
'signature_def_key': {
'inputs': { 'input_te... | python | def export_saved_model(sess, export_dir, tag_set, signatures):
"""Convenience function to export a saved_model using provided arguments
The caller specifies the saved_model signatures in a simplified python dictionary form, as follows::
signatures = {
'signature_def_key': {
'inputs': { 'input_te... | [
"def",
"export_saved_model",
"(",
"sess",
",",
"export_dir",
",",
"tag_set",
",",
"signatures",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"g",
"=",
"sess",
".",
"graph",
"g",
".",
"_unsafe_unfinalize",
"(",
")",
"# https://github.com/tensorflow/serving/issues/... | Convenience function to export a saved_model using provided arguments
The caller specifies the saved_model signatures in a simplified python dictionary form, as follows::
signatures = {
'signature_def_key': {
'inputs': { 'input_tensor_alias': input_tensor_name },
'outputs': { 'output_tenso... | [
"Convenience",
"function",
"to",
"export",
"a",
"saved_model",
"using",
"provided",
"arguments"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L144-L187 | train | Convenience function to export a saved_model using provided arguments. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFNode.py | DataFeed.next_batch | def next_batch(self, batch_size):
"""Gets a batch of items from the input RDD.
If multiple tensors are provided per row in the input RDD, e.g. tuple of (tensor1, tensor2, ..., tensorN) and:
* no ``input_mapping`` was provided to the DataFeed constructor, this will return an array of ``batch_size`` tuples,... | python | def next_batch(self, batch_size):
"""Gets a batch of items from the input RDD.
If multiple tensors are provided per row in the input RDD, e.g. tuple of (tensor1, tensor2, ..., tensorN) and:
* no ``input_mapping`` was provided to the DataFeed constructor, this will return an array of ``batch_size`` tuples,... | [
"def",
"next_batch",
"(",
"self",
",",
"batch_size",
")",
":",
"logging",
".",
"debug",
"(",
"\"next_batch() invoked\"",
")",
"queue",
"=",
"self",
".",
"mgr",
".",
"get_queue",
"(",
"self",
".",
"qname_in",
")",
"tensors",
"=",
"[",
"]",
"if",
"self",
... | Gets a batch of items from the input RDD.
If multiple tensors are provided per row in the input RDD, e.g. tuple of (tensor1, tensor2, ..., tensorN) and:
* no ``input_mapping`` was provided to the DataFeed constructor, this will return an array of ``batch_size`` tuples,
and the caller is responsible for ... | [
"Gets",
"a",
"batch",
"of",
"items",
"from",
"the",
"input",
"RDD",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L219-L265 | train | Gets a batch of items from the input RDD. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFNode.py | DataFeed.batch_results | def batch_results(self, results):
"""Push a batch of output results to the Spark output RDD of ``TFCluster.inference()``.
Note: this currently expects a one-to-one mapping of input to output data, so the length of the ``results`` array should match the length of
the previously retrieved batch of input data... | python | def batch_results(self, results):
"""Push a batch of output results to the Spark output RDD of ``TFCluster.inference()``.
Note: this currently expects a one-to-one mapping of input to output data, so the length of the ``results`` array should match the length of
the previously retrieved batch of input data... | [
"def",
"batch_results",
"(",
"self",
",",
"results",
")",
":",
"logging",
".",
"debug",
"(",
"\"batch_results() invoked\"",
")",
"queue",
"=",
"self",
".",
"mgr",
".",
"get_queue",
"(",
"self",
".",
"qname_out",
")",
"for",
"item",
"in",
"results",
":",
... | Push a batch of output results to the Spark output RDD of ``TFCluster.inference()``.
Note: this currently expects a one-to-one mapping of input to output data, so the length of the ``results`` array should match the length of
the previously retrieved batch of input data.
Args:
:results: array of out... | [
"Push",
"a",
"batch",
"of",
"output",
"results",
"to",
"the",
"Spark",
"output",
"RDD",
"of",
"TFCluster",
".",
"inference",
"()",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L271-L284 | train | Push a batch of output results to the Spark output RDD of TFCluster. inference. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/TFNode.py | DataFeed.terminate | def terminate(self):
"""Terminate data feeding early.
Since TensorFlow applications can often terminate on conditions unrelated to the training data (e.g. steps, accuracy, etc),
this method signals the data feeding process to ignore any further incoming data. Note that Spark itself does not have a mechani... | python | def terminate(self):
"""Terminate data feeding early.
Since TensorFlow applications can often terminate on conditions unrelated to the training data (e.g. steps, accuracy, etc),
this method signals the data feeding process to ignore any further incoming data. Note that Spark itself does not have a mechani... | [
"def",
"terminate",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"terminate() invoked\"",
")",
"self",
".",
"mgr",
".",
"set",
"(",
"'state'",
",",
"'terminating'",
")",
"# drop remaining items in the queue",
"queue",
"=",
"self",
".",
"mgr",
".",
"... | Terminate data feeding early.
Since TensorFlow applications can often terminate on conditions unrelated to the training data (e.g. steps, accuracy, etc),
this method signals the data feeding process to ignore any further incoming data. Note that Spark itself does not have a mechanism
to terminate an RDD o... | [
"Terminate",
"data",
"feeding",
"early",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L286-L308 | train | Terminate data feeding early. | 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... |
yahoo/TensorFlowOnSpark | examples/mnist/tf/mnist_dist_pipeline.py | export_fun | def export_fun(args):
"""Define/export a single-node TF graph for inferencing"""
# Input placeholder for inferencing
x = tf.placeholder(tf.float32, [None, IMAGE_PIXELS * IMAGE_PIXELS], name="x")
# Variables of the hidden layer
hid_w = tf.Variable(tf.truncated_normal([IMAGE_PIXELS * IMAGE_PIXELS, hidden_units... | python | def export_fun(args):
"""Define/export a single-node TF graph for inferencing"""
# Input placeholder for inferencing
x = tf.placeholder(tf.float32, [None, IMAGE_PIXELS * IMAGE_PIXELS], name="x")
# Variables of the hidden layer
hid_w = tf.Variable(tf.truncated_normal([IMAGE_PIXELS * IMAGE_PIXELS, hidden_units... | [
"def",
"export_fun",
"(",
"args",
")",
":",
"# Input placeholder for inferencing",
"x",
"=",
"tf",
".",
"placeholder",
"(",
"tf",
".",
"float32",
",",
"[",
"None",
",",
"IMAGE_PIXELS",
"*",
"IMAGE_PIXELS",
"]",
",",
"name",
"=",
"\"x\"",
")",
"# Variables of... | Define/export a single-node TF graph for inferencing | [
"Define",
"/",
"export",
"a",
"single",
"-",
"node",
"TF",
"graph",
"for",
"inferencing"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/tf/mnist_dist_pipeline.py#L136-L185 | train | Define a TF graph for inferencing. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/inception_distributed_train.py | train | def train(target, dataset, cluster_spec, ctx):
"""Train Inception on a dataset for a number of steps."""
# Number of workers and parameter servers are infered from the workers and ps
# hosts string.
num_workers = len(cluster_spec.as_dict()['worker'])
num_parameter_servers = len(cluster_spec.as_dict()['ps'])
... | python | def train(target, dataset, cluster_spec, ctx):
"""Train Inception on a dataset for a number of steps."""
# Number of workers and parameter servers are infered from the workers and ps
# hosts string.
num_workers = len(cluster_spec.as_dict()['worker'])
num_parameter_servers = len(cluster_spec.as_dict()['ps'])
... | [
"def",
"train",
"(",
"target",
",",
"dataset",
",",
"cluster_spec",
",",
"ctx",
")",
":",
"# Number of workers and parameter servers are infered from the workers and ps",
"# hosts string.",
"num_workers",
"=",
"len",
"(",
"cluster_spec",
".",
"as_dict",
"(",
")",
"[",
... | Train Inception on a dataset for a number of steps. | [
"Train",
"Inception",
"on",
"a",
"dataset",
"for",
"a",
"number",
"of",
"steps",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_distributed_train.py#L96-L360 | train | Train Inception on a dataset for a number of steps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/inception_export.py | export | def export(_):
FLAGS = tf.app.flags.FLAGS
"""Evaluate model on Dataset for a number of steps."""
#with tf.Graph().as_default():
tf.reset_default_graph()
def preprocess_image(image_buffer):
"""Preprocess JPEG encoded bytes to 3D float Tensor."""
# Decode the string as an RGB JPEG.
# Note that th... | python | def export(_):
FLAGS = tf.app.flags.FLAGS
"""Evaluate model on Dataset for a number of steps."""
#with tf.Graph().as_default():
tf.reset_default_graph()
def preprocess_image(image_buffer):
"""Preprocess JPEG encoded bytes to 3D float Tensor."""
# Decode the string as an RGB JPEG.
# Note that th... | [
"def",
"export",
"(",
"_",
")",
":",
"FLAGS",
"=",
"tf",
".",
"app",
".",
"flags",
".",
"FLAGS",
"#with tf.Graph().as_default():",
"tf",
".",
"reset_default_graph",
"(",
")",
"def",
"preprocess_image",
"(",
"image_buffer",
")",
":",
"\"\"\"Preprocess JPEG encode... | Evaluate model on Dataset for a number of steps. | [
"Evaluate",
"model",
"on",
"Dataset",
"for",
"a",
"number",
"of",
"steps",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_export.py#L30-L115 | train | Evaluate model on Dataset for a number of steps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | tensorflowonspark/gpu_info.py | _get_gpu | def _get_gpu():
"""*DEPRECATED*. Allocates first available GPU using cudaSetDevice(), or returns 0 otherwise."""
# Note: this code executes, but Tensorflow subsequently complains that the "current context was not created by the StreamExecutor cuda_driver API"
system = platform.system()
if system == "Linux":
... | python | def _get_gpu():
"""*DEPRECATED*. Allocates first available GPU using cudaSetDevice(), or returns 0 otherwise."""
# Note: this code executes, but Tensorflow subsequently complains that the "current context was not created by the StreamExecutor cuda_driver API"
system = platform.system()
if system == "Linux":
... | [
"def",
"_get_gpu",
"(",
")",
":",
"# Note: this code executes, but Tensorflow subsequently complains that the \"current context was not created by the StreamExecutor cuda_driver API\"",
"system",
"=",
"platform",
".",
"system",
"(",
")",
"if",
"system",
"==",
"\"Linux\"",
":",
"l... | *DEPRECATED*. Allocates first available GPU using cudaSetDevice(), or returns 0 otherwise. | [
"*",
"DEPRECATED",
"*",
".",
"Allocates",
"first",
"available",
"GPU",
"using",
"cudaSetDevice",
"()",
"or",
"returns",
"0",
"otherwise",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/gpu_info.py#L20-L40 | train | Internal function to get the GPU 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/gpu_info.py | get_gpus | def get_gpus(num_gpu=1, worker_index=-1):
"""Get list of free GPUs according to nvidia-smi.
This will retry for ``MAX_RETRIES`` times until the requested number of GPUs are available.
Args:
:num_gpu: number of GPUs desired.
:worker_index: index "hint" for allocation of available GPUs.
Returns:
Co... | python | def get_gpus(num_gpu=1, worker_index=-1):
"""Get list of free GPUs according to nvidia-smi.
This will retry for ``MAX_RETRIES`` times until the requested number of GPUs are available.
Args:
:num_gpu: number of GPUs desired.
:worker_index: index "hint" for allocation of available GPUs.
Returns:
Co... | [
"def",
"get_gpus",
"(",
"num_gpu",
"=",
"1",
",",
"worker_index",
"=",
"-",
"1",
")",
":",
"# get list of gpus (index, uuid)",
"list_gpus",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"\"nvidia-smi\"",
",",
"\"--list-gpus\"",
"]",
")",
".",
"decode",
"("... | Get list of free GPUs according to nvidia-smi.
This will retry for ``MAX_RETRIES`` times until the requested number of GPUs are available.
Args:
:num_gpu: number of GPUs desired.
:worker_index: index "hint" for allocation of available GPUs.
Returns:
Comma-delimited string of GPU ids, or raises an E... | [
"Get",
"list",
"of",
"free",
"GPUs",
"according",
"to",
"nvidia",
"-",
"smi",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/gpu_info.py#L43-L104 | train | Get list of free GPUs according to nvidia - smi. | 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... |
yahoo/TensorFlowOnSpark | tensorflowonspark/gpu_info.py | _get_free_gpu | def _get_free_gpu(max_gpu_utilization=40, min_free_memory=0.5, num_gpu=1):
"""Get available GPUs according to utilization thresholds.
Args:
:max_gpu_utilization: percent utilization threshold to consider a GPU "free"
:min_free_memory: percent free memory to consider a GPU "free"
:num_gpu: number of req... | python | def _get_free_gpu(max_gpu_utilization=40, min_free_memory=0.5, num_gpu=1):
"""Get available GPUs according to utilization thresholds.
Args:
:max_gpu_utilization: percent utilization threshold to consider a GPU "free"
:min_free_memory: percent free memory to consider a GPU "free"
:num_gpu: number of req... | [
"def",
"_get_free_gpu",
"(",
"max_gpu_utilization",
"=",
"40",
",",
"min_free_memory",
"=",
"0.5",
",",
"num_gpu",
"=",
"1",
")",
":",
"def",
"get_gpu_info",
"(",
")",
":",
"# Get the gpu information",
"gpu_info",
"=",
"subprocess",
".",
"check_output",
"(",
"... | Get available GPUs according to utilization thresholds.
Args:
:max_gpu_utilization: percent utilization threshold to consider a GPU "free"
:min_free_memory: percent free memory to consider a GPU "free"
:num_gpu: number of requested GPUs
Returns:
A tuple of (available_gpus, minimum_free_memory), wh... | [
"Get",
"available",
"GPUs",
"according",
"to",
"utilization",
"thresholds",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/gpu_info.py#L108-L177 | train | Get the available GPUs according to utilization thresholds. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_image_data.py | _convert_to_example | def _convert_to_example(filename, image_buffer, label, text, height, width):
"""Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, identifier for the ground truth for the net... | python | def _convert_to_example(filename, image_buffer, label, text, height, width):
"""Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, identifier for the ground truth for the net... | [
"def",
"_convert_to_example",
"(",
"filename",
",",
"image_buffer",
",",
"label",
",",
"text",
",",
"height",
",",
"width",
")",
":",
"colorspace",
"=",
"'RGB'",
"channels",
"=",
"3",
"image_format",
"=",
"'JPEG'",
"example",
"=",
"tf",
".",
"train",
".",
... | Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, identifier for the ground truth for the network
text: string, unique human-readable, e.g. 'dog'
height: integer, imag... | [
"Build",
"an",
"Example",
"proto",
"for",
"an",
"example",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L119-L147 | train | Convert an example.
to a tf. train. Example proto. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_image_data.py | _process_image_files_batch | def _process_image_files_batch(coder, thread_index, ranges, name, filenames,
texts, labels, num_shards):
"""Processes and saves list of images as TFRecord in 1 thread.
Args:
coder: instance of ImageCoder to provide TensorFlow image coding utils.
thread_index: integer, unique ... | python | def _process_image_files_batch(coder, thread_index, ranges, name, filenames,
texts, labels, num_shards):
"""Processes and saves list of images as TFRecord in 1 thread.
Args:
coder: instance of ImageCoder to provide TensorFlow image coding utils.
thread_index: integer, unique ... | [
"def",
"_process_image_files_batch",
"(",
"coder",
",",
"thread_index",
",",
"ranges",
",",
"name",
",",
"filenames",
",",
"texts",
",",
"labels",
",",
"num_shards",
")",
":",
"# Each thread produces N shards where N = int(num_shards / num_threads).",
"# For instance, if nu... | Processes and saves list of images as TFRecord in 1 thread.
Args:
coder: instance of ImageCoder to provide TensorFlow image coding utils.
thread_index: integer, unique batch to run index is within [0, len(ranges)).
ranges: list of pairs of integers specifying ranges of each batches to
analyze in pa... | [
"Processes",
"and",
"saves",
"list",
"of",
"images",
"as",
"TFRecord",
"in",
"1",
"thread",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L222-L284 | train | Processes and saves list of images as TFRecord in 1 thread. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_image_data.py | _process_image_files | def _process_image_files(name, filenames, texts, labels, num_shards):
"""Process and save list of images as TFRecord of Example protos.
Args:
name: string, unique identifier specifying the data set
filenames: list of strings; each string is a path to an image file
texts: list of strings; each string is... | python | def _process_image_files(name, filenames, texts, labels, num_shards):
"""Process and save list of images as TFRecord of Example protos.
Args:
name: string, unique identifier specifying the data set
filenames: list of strings; each string is a path to an image file
texts: list of strings; each string is... | [
"def",
"_process_image_files",
"(",
"name",
",",
"filenames",
",",
"texts",
",",
"labels",
",",
"num_shards",
")",
":",
"assert",
"len",
"(",
"filenames",
")",
"==",
"len",
"(",
"texts",
")",
"assert",
"len",
"(",
"filenames",
")",
"==",
"len",
"(",
"l... | Process and save list of images as TFRecord of Example protos.
Args:
name: string, unique identifier specifying the data set
filenames: list of strings; each string is a path to an image file
texts: list of strings; each string is human readable, e.g. 'dog'
labels: list of integer; each integer ident... | [
"Process",
"and",
"save",
"list",
"of",
"images",
"as",
"TFRecord",
"of",
"Example",
"protos",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L287-L328 | train | Process and save list of images as TFRecord of Example protos. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_image_data.py | _find_image_files | def _find_image_files(data_dir, labels_file):
"""Build a list of all images files and labels in the data set.
Args:
data_dir: string, path to the root directory of images.
Assumes that the image data set resides in JPEG files located in
the following directory structure.
data_dir/dog/anot... | python | def _find_image_files(data_dir, labels_file):
"""Build a list of all images files and labels in the data set.
Args:
data_dir: string, path to the root directory of images.
Assumes that the image data set resides in JPEG files located in
the following directory structure.
data_dir/dog/anot... | [
"def",
"_find_image_files",
"(",
"data_dir",
",",
"labels_file",
")",
":",
"print",
"(",
"'Determining list of input files and labels from %s.'",
"%",
"data_dir",
")",
"unique_labels",
"=",
"[",
"l",
".",
"strip",
"(",
")",
"for",
"l",
"in",
"tf",
".",
"gfile",
... | Build a list of all images files and labels in the data set.
Args:
data_dir: string, path to the root directory of images.
Assumes that the image data set resides in JPEG files located in
the following directory structure.
data_dir/dog/another-image.JPEG
data_dir/dog/my-image.jpg
... | [
"Build",
"a",
"list",
"of",
"all",
"images",
"files",
"and",
"labels",
"in",
"the",
"data",
"set",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L331-L399 | train | Find all images files and labels in the data set. | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/data/build_image_data.py | _process_dataset | def _process_dataset(name, directory, num_shards, labels_file):
"""Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of shards for this data set.
labels_file:... | python | def _process_dataset(name, directory, num_shards, labels_file):
"""Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of shards for this data set.
labels_file:... | [
"def",
"_process_dataset",
"(",
"name",
",",
"directory",
",",
"num_shards",
",",
"labels_file",
")",
":",
"filenames",
",",
"texts",
",",
"labels",
"=",
"_find_image_files",
"(",
"directory",
",",
"labels_file",
")",
"_process_image_files",
"(",
"name",
",",
... | Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of shards for this data set.
labels_file: string, path to the labels file. | [
"Process",
"a",
"complete",
"data",
"set",
"and",
"save",
"it",
"as",
"a",
"TFRecord",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L402-L412 | train | Process a complete data set and save it as a TFRecord.
Arguments | 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/image_processing.py | inputs | def inputs(dataset, batch_size=None, num_preprocess_threads=None):
"""Generate batches of ImageNet images for evaluation.
Use this function as the inputs for evaluating a network.
Note that some (minimal) image preprocessing occurs during evaluation
including central cropping and resizing of the image to fit ... | python | def inputs(dataset, batch_size=None, num_preprocess_threads=None):
"""Generate batches of ImageNet images for evaluation.
Use this function as the inputs for evaluating a network.
Note that some (minimal) image preprocessing occurs during evaluation
including central cropping and resizing of the image to fit ... | [
"def",
"inputs",
"(",
"dataset",
",",
"batch_size",
"=",
"None",
",",
"num_preprocess_threads",
"=",
"None",
")",
":",
"if",
"not",
"batch_size",
":",
"batch_size",
"=",
"FLAGS",
".",
"batch_size",
"# Force all input processing onto CPU in order to reserve the GPU for",... | Generate batches of ImageNet images for evaluation.
Use this function as the inputs for evaluating a network.
Note that some (minimal) image preprocessing occurs during evaluation
including central cropping and resizing of the image to fit the network.
Args:
dataset: instance of Dataset class specifying ... | [
"Generate",
"batches",
"of",
"ImageNet",
"images",
"for",
"evaluation",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L74-L104 | train | Generate batches of ImageNet images for evaluation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/image_processing.py | distorted_inputs | def distorted_inputs(dataset, batch_size=None, num_preprocess_threads=None):
"""Generate batches of distorted versions of ImageNet images.
Use this function as the inputs for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the netw... | python | def distorted_inputs(dataset, batch_size=None, num_preprocess_threads=None):
"""Generate batches of distorted versions of ImageNet images.
Use this function as the inputs for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the netw... | [
"def",
"distorted_inputs",
"(",
"dataset",
",",
"batch_size",
"=",
"None",
",",
"num_preprocess_threads",
"=",
"None",
")",
":",
"if",
"not",
"batch_size",
":",
"batch_size",
"=",
"FLAGS",
".",
"batch_size",
"# Force all input processing onto CPU in order to reserve the... | Generate batches of distorted versions of ImageNet images.
Use this function as the inputs for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the network invariant to aspects
of the image that do not effect the label.
Args:
... | [
"Generate",
"batches",
"of",
"distorted",
"versions",
"of",
"ImageNet",
"images",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L107-L137 | train | Generate batches of distorted versions of ImageNet images. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/image_processing.py | decode_jpeg | def decode_jpeg(image_buffer, scope=None):
"""Decode a JPEG string into one 3-D float image Tensor.
Args:
image_buffer: scalar string Tensor.
scope: Optional scope for name_scope.
Returns:
3-D float Tensor with values ranging from [0, 1).
"""
with tf.name_scope(values=[image_buffer], name=scope,
... | python | def decode_jpeg(image_buffer, scope=None):
"""Decode a JPEG string into one 3-D float image Tensor.
Args:
image_buffer: scalar string Tensor.
scope: Optional scope for name_scope.
Returns:
3-D float Tensor with values ranging from [0, 1).
"""
with tf.name_scope(values=[image_buffer], name=scope,
... | [
"def",
"decode_jpeg",
"(",
"image_buffer",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image_buffer",
"]",
",",
"name",
"=",
"scope",
",",
"default_name",
"=",
"'decode_jpeg'",
")",
":",
"# Decode the str... | Decode a JPEG string into one 3-D float image Tensor.
Args:
image_buffer: scalar string Tensor.
scope: Optional scope for name_scope.
Returns:
3-D float Tensor with values ranging from [0, 1). | [
"Decode",
"a",
"JPEG",
"string",
"into",
"one",
"3",
"-",
"D",
"float",
"image",
"Tensor",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L140-L161 | train | Decode a JPEG string into one 3 - D float image Tensor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/image_processing.py | distort_color | def distort_color(image, thread_id=0, scope=None):
"""Distort the color of the image.
Each color distortion is non-commutative and thus ordering of the color ops
matters. Ideally we would randomly permute the ordering of the color ops.
Rather then adding that level of complication, we select a distinct orderin... | python | def distort_color(image, thread_id=0, scope=None):
"""Distort the color of the image.
Each color distortion is non-commutative and thus ordering of the color ops
matters. Ideally we would randomly permute the ordering of the color ops.
Rather then adding that level of complication, we select a distinct orderin... | [
"def",
"distort_color",
"(",
"image",
",",
"thread_id",
"=",
"0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image",
"]",
",",
"name",
"=",
"scope",
",",
"default_name",
"=",
"'distort_color'",
")",
... | Distort the color of the image.
Each color distortion is non-commutative and thus ordering of the color ops
matters. Ideally we would randomly permute the ordering of the color ops.
Rather then adding that level of complication, we select a distinct ordering
of color ops for each preprocessing thread.
Args:... | [
"Distort",
"the",
"color",
"of",
"the",
"image",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L164-L195 | train | Distort the color of the 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... |
yahoo/TensorFlowOnSpark | examples/imagenet/inception/image_processing.py | distort_image | def distort_image(image, height, width, bbox, thread_id=0, scope=None):
"""Distort one image for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the network invariant to aspects
of the image that do not effect the label.
Args:
... | python | def distort_image(image, height, width, bbox, thread_id=0, scope=None):
"""Distort one image for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the network invariant to aspects
of the image that do not effect the label.
Args:
... | [
"def",
"distort_image",
"(",
"image",
",",
"height",
",",
"width",
",",
"bbox",
",",
"thread_id",
"=",
"0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image",
",",
"height",
",",
"width",
",",
"b... | Distort one image for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the network invariant to aspects
of the image that do not effect the label.
Args:
image: 3-D float Tensor of image
height: integer
width: integer
... | [
"Distort",
"one",
"image",
"for",
"training",
"a",
"network",
"."
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L198-L276 | train | Distort one image for training a network. | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.