partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Client.await_reservations | Poll until all reservations completed, then return cluster_info. | tensorflowonspark/reservation.py | 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):
"""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() | [
"Poll",
"until",
"all",
"reservations",
"completed",
"then",
"return",
"cluster_info",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/reservation.py#L261-L267 | [
"def",
"await_reservations",
"(",
"self",
")",
":",
"done",
"=",
"False",
"while",
"not",
"done",
":",
"done",
"=",
"self",
".",
"_request",
"(",
"'QUERY'",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"return",
"self",
".",
"get_reservations",
"(",
")"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | toTFExample | Serializes an image/label as a TFExample byte string | examples/mnist/mnist_data_setup.py | 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):
"""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... | [
"Serializes",
"an",
"image",
"/",
"label",
"as",
"a",
"TFExample",
"byte",
"string"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L14-L24 | [
"def",
"toTFExample",
"(",
"image",
",",
"label",
")",
":",
"example",
"=",
"tf",
".",
"train",
".",
"Example",
"(",
"features",
"=",
"tf",
".",
"train",
".",
"Features",
"(",
"feature",
"=",
"{",
"'label'",
":",
"tf",
".",
"train",
".",
"Feature",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | fromTFExample | Deserializes a TFExample from a byte string | examples/mnist/mnist_data_setup.py | def fromTFExample(bytestr):
"""Deserializes a TFExample from a byte string"""
example = tf.train.Example()
example.ParseFromString(bytestr)
return example | def fromTFExample(bytestr):
"""Deserializes a TFExample from a byte string"""
example = tf.train.Example()
example.ParseFromString(bytestr)
return example | [
"Deserializes",
"a",
"TFExample",
"from",
"a",
"byte",
"string"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L27-L31 | [
"def",
"fromTFExample",
"(",
"bytestr",
")",
":",
"example",
"=",
"tf",
".",
"train",
".",
"Example",
"(",
")",
"example",
".",
"ParseFromString",
"(",
"bytestr",
")",
"return",
"example"
] | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | writeMNIST | Writes MNIST image/label vectors into parallelized files on HDFS | examples/mnist/mnist_data_setup.py | 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):
"""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... | [
"Writes",
"MNIST",
"image",
"/",
"label",
"vectors",
"into",
"parallelized",
"files",
"on",
"HDFS"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L44-L81 | [
"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... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | readMNIST | Reads/verifies previously created output | examples/mnist/mnist_data_setup.py | 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):
"""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... | [
"Reads",
"/",
"verifies",
"previously",
"created",
"output"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/mnist_data_setup.py#L94-L120 | [
"def",
"readMNIST",
"(",
"sc",
",",
"output",
",",
"format",
")",
":",
"output_images",
"=",
"output",
"+",
"\"/images\"",
"output_labels",
"=",
"output",
"+",
"\"/labels\"",
"imageRDD",
"=",
"None",
"labelRDD",
"=",
"None",
"if",
"format",
"==",
"\"pickle\"... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | inference | 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... | examples/imagenet/inception/inception_model.py | 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):
"""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... | [
"Build",
"Inception",
"v3",
"model",
"architecture",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_model.py#L48-L95 | [
"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... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | loss | 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... | examples/imagenet/inception/inception_model.py | 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):
"""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... | [
"Adds",
"all",
"losses",
"for",
"the",
"model",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_model.py#L98-L135 | [
"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... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | hdfs_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 scheme. | tensorflowonspark/TFNode.py | 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):
"""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... | [
"Convenience",
"function",
"to",
"create",
"a",
"Tensorflow",
"-",
"compatible",
"absolute",
"HDFS",
"path",
"from",
"relative",
"paths"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L25-L60 | [
"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://'",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | start_cluster_server | Function that wraps the creation of TensorFlow ``tf.train.Server`` for a node in a distributed TensorFlow cluster.
This is intended to be invoked from within the TF ``map_fun``, replacing explicit code to instantiate ``tf.train.ClusterSpec``
and ``tf.train.Server`` objects.
Args:
:ctx: TFNodeContext contain... | tensorflowonspark/TFNode.py | def start_cluster_server(ctx, num_gpus=1, rdma=False):
"""Function that wraps the creation of TensorFlow ``tf.train.Server`` for a node in a distributed TensorFlow cluster.
This is intended to be invoked from within the TF ``map_fun``, replacing explicit code to instantiate ``tf.train.ClusterSpec``
and ``tf.trai... | def start_cluster_server(ctx, num_gpus=1, rdma=False):
"""Function that wraps the creation of TensorFlow ``tf.train.Server`` for a node in a distributed TensorFlow cluster.
This is intended to be invoked from within the TF ``map_fun``, replacing explicit code to instantiate ``tf.train.ClusterSpec``
and ``tf.trai... | [
"Function",
"that",
"wraps",
"the",
"creation",
"of",
"TensorFlow",
"tf",
".",
"train",
".",
"Server",
"for",
"a",
"node",
"in",
"a",
"distributed",
"TensorFlow",
"cluster",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L63-L136 | [
"def",
"start_cluster_server",
"(",
"ctx",
",",
"num_gpus",
"=",
"1",
",",
"rdma",
"=",
"False",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"from",
".",
"import",
"gpu_info",
"logging",
".",
"info",
"(",
"\"{0}: ======== {1}:{2} ========\"",
".",
"format",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | export_saved_model | 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... | tensorflowonspark/TFNode.py | 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):
"""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... | [
"Convenience",
"function",
"to",
"export",
"a",
"saved_model",
"using",
"provided",
"arguments"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L144-L187 | [
"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/... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | DataFeed.next_batch | 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 ... | tensorflowonspark/TFNode.py | 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):
"""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,... | [
"Gets",
"a",
"batch",
"of",
"items",
"from",
"the",
"input",
"RDD",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L219-L265 | [
"def",
"next_batch",
"(",
"self",
",",
"batch_size",
")",
":",
"logging",
".",
"debug",
"(",
"\"next_batch() invoked\"",
")",
"queue",
"=",
"self",
".",
"mgr",
".",
"get_queue",
"(",
"self",
".",
"qname_in",
")",
"tensors",
"=",
"[",
"]",
"if",
"self",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | DataFeed.batch_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... | tensorflowonspark/TFNode.py | 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):
"""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... | [
"Push",
"a",
"batch",
"of",
"output",
"results",
"to",
"the",
"Spark",
"output",
"RDD",
"of",
"TFCluster",
".",
"inference",
"()",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L271-L284 | [
"def",
"batch_results",
"(",
"self",
",",
"results",
")",
":",
"logging",
".",
"debug",
"(",
"\"batch_results() invoked\"",
")",
"queue",
"=",
"self",
".",
"mgr",
".",
"get_queue",
"(",
"self",
".",
"qname_out",
")",
"for",
"item",
"in",
"results",
":",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | DataFeed.terminate | 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... | tensorflowonspark/TFNode.py | 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):
"""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... | [
"Terminate",
"data",
"feeding",
"early",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/TFNode.py#L286-L308 | [
"def",
"terminate",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"terminate() invoked\"",
")",
"self",
".",
"mgr",
".",
"set",
"(",
"'state'",
",",
"'terminating'",
")",
"# drop remaining items in the queue",
"queue",
"=",
"self",
".",
"mgr",
".",
"... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | export_fun | Define/export a single-node TF graph for inferencing | examples/mnist/tf/mnist_dist_pipeline.py | 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):
"""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... | [
"Define",
"/",
"export",
"a",
"single",
"-",
"node",
"TF",
"graph",
"for",
"inferencing"
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/mnist/tf/mnist_dist_pipeline.py#L136-L185 | [
"def",
"export_fun",
"(",
"args",
")",
":",
"# Input placeholder for inferencing",
"x",
"=",
"tf",
".",
"placeholder",
"(",
"tf",
".",
"float32",
",",
"[",
"None",
",",
"IMAGE_PIXELS",
"*",
"IMAGE_PIXELS",
"]",
",",
"name",
"=",
"\"x\"",
")",
"# Variables of... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | train | Train Inception on a dataset for a number of steps. | examples/imagenet/inception/inception_distributed_train.py | 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):
"""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'])
... | [
"Train",
"Inception",
"on",
"a",
"dataset",
"for",
"a",
"number",
"of",
"steps",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_distributed_train.py#L96-L360 | [
"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",
"(",
")",
"[",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | export | Evaluate model on Dataset for a number of steps. | examples/imagenet/inception/inception_export.py | 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
"""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... | [
"Evaluate",
"model",
"on",
"Dataset",
"for",
"a",
"number",
"of",
"steps",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_export.py#L30-L115 | [
"def",
"export",
"(",
"_",
")",
":",
"FLAGS",
"=",
"tf",
".",
"app",
".",
"flags",
".",
"FLAGS",
"#with tf.Graph().as_default():",
"tf",
".",
"reset_default_graph",
"(",
")",
"def",
"preprocess_image",
"(",
"image_buffer",
")",
":",
"\"\"\"Preprocess JPEG encode... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _get_gpu | *DEPRECATED*. Allocates first available GPU using cudaSetDevice(), or returns 0 otherwise. | tensorflowonspark/gpu_info.py | 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():
"""*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":
... | [
"*",
"DEPRECATED",
"*",
".",
"Allocates",
"first",
"available",
"GPU",
"using",
"cudaSetDevice",
"()",
"or",
"returns",
"0",
"otherwise",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/gpu_info.py#L20-L40 | [
"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... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | get_gpus | 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... | tensorflowonspark/gpu_info.py | 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 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... | [
"Get",
"list",
"of",
"free",
"GPUs",
"according",
"to",
"nvidia",
"-",
"smi",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/gpu_info.py#L43-L104 | [
"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",
"("... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _get_free_gpu | 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... | tensorflowonspark/gpu_info.py | 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):
"""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... | [
"Get",
"available",
"GPUs",
"according",
"to",
"utilization",
"thresholds",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/tensorflowonspark/gpu_info.py#L108-L177 | [
"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",
"(",
"... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _convert_to_example | 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... | examples/imagenet/inception/data/build_image_data.py | 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):
"""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... | [
"Build",
"an",
"Example",
"proto",
"for",
"an",
"example",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L119-L147 | [
"def",
"_convert_to_example",
"(",
"filename",
",",
"image_buffer",
",",
"label",
",",
"text",
",",
"height",
",",
"width",
")",
":",
"colorspace",
"=",
"'RGB'",
"channels",
"=",
"3",
"image_format",
"=",
"'JPEG'",
"example",
"=",
"tf",
".",
"train",
".",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _process_image_files_batch | 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... | examples/imagenet/inception/data/build_image_data.py | 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):
"""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 ... | [
"Processes",
"and",
"saves",
"list",
"of",
"images",
"as",
"TFRecord",
"in",
"1",
"thread",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L222-L284 | [
"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... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _process_image_files | 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... | examples/imagenet/inception/data/build_image_data.py | 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):
"""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... | [
"Process",
"and",
"save",
"list",
"of",
"images",
"as",
"TFRecord",
"of",
"Example",
"protos",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L287-L328 | [
"def",
"_process_image_files",
"(",
"name",
",",
"filenames",
",",
"texts",
",",
"labels",
",",
"num_shards",
")",
":",
"assert",
"len",
"(",
"filenames",
")",
"==",
"len",
"(",
"texts",
")",
"assert",
"len",
"(",
"filenames",
")",
"==",
"len",
"(",
"l... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _find_image_files | 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
... | examples/imagenet/inception/data/build_image_data.py | 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):
"""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... | [
"Build",
"a",
"list",
"of",
"all",
"images",
"files",
"and",
"labels",
"in",
"the",
"data",
"set",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L331-L399 | [
"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",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _process_dataset | 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. | examples/imagenet/inception/data/build_image_data.py | 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):
"""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:... | [
"Process",
"a",
"complete",
"data",
"set",
"and",
"save",
"it",
"as",
"a",
"TFRecord",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/build_image_data.py#L402-L412 | [
"def",
"_process_dataset",
"(",
"name",
",",
"directory",
",",
"num_shards",
",",
"labels_file",
")",
":",
"filenames",
",",
"texts",
",",
"labels",
"=",
"_find_image_files",
"(",
"directory",
",",
"labels_file",
")",
"_process_image_files",
"(",
"name",
",",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | inputs | 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 ... | examples/imagenet/inception/image_processing.py | 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):
"""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 ... | [
"Generate",
"batches",
"of",
"ImageNet",
"images",
"for",
"evaluation",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L74-L104 | [
"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",... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | distorted_inputs | 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:
... | examples/imagenet/inception/image_processing.py | 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):
"""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... | [
"Generate",
"batches",
"of",
"distorted",
"versions",
"of",
"ImageNet",
"images",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L107-L137 | [
"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... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | decode_jpeg | 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). | examples/imagenet/inception/image_processing.py | 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):
"""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,
... | [
"Decode",
"a",
"JPEG",
"string",
"into",
"one",
"3",
"-",
"D",
"float",
"image",
"Tensor",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L140-L161 | [
"def",
"decode_jpeg",
"(",
"image_buffer",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image_buffer",
"]",
",",
"name",
"=",
"scope",
",",
"default_name",
"=",
"'decode_jpeg'",
")",
":",
"# Decode the str... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | 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:... | examples/imagenet/inception/image_processing.py | 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):
"""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... | [
"Distort",
"the",
"color",
"of",
"the",
"image",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L164-L195 | [
"def",
"distort_color",
"(",
"image",
",",
"thread_id",
"=",
"0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image",
"]",
",",
"name",
"=",
"scope",
",",
"default_name",
"=",
"'distort_color'",
")",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | distort_image | 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
... | examples/imagenet/inception/image_processing.py | 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):
"""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:
... | [
"Distort",
"one",
"image",
"for",
"training",
"a",
"network",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L198-L276 | [
"def",
"distort_image",
"(",
"image",
",",
"height",
",",
"width",
",",
"bbox",
",",
"thread_id",
"=",
"0",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image",
",",
"height",
",",
"width",
",",
"b... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | eval_image | Prepare one image for evaluation.
Args:
image: 3-D float Tensor
height: integer
width: integer
scope: Optional scope for name_scope.
Returns:
3-D float Tensor of prepared image. | examples/imagenet/inception/image_processing.py | def eval_image(image, height, width, scope=None):
"""Prepare one image for evaluation.
Args:
image: 3-D float Tensor
height: integer
width: integer
scope: Optional scope for name_scope.
Returns:
3-D float Tensor of prepared image.
"""
with tf.name_scope(values=[image, height, width], name... | def eval_image(image, height, width, scope=None):
"""Prepare one image for evaluation.
Args:
image: 3-D float Tensor
height: integer
width: integer
scope: Optional scope for name_scope.
Returns:
3-D float Tensor of prepared image.
"""
with tf.name_scope(values=[image, height, width], name... | [
"Prepare",
"one",
"image",
"for",
"evaluation",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L279-L301 | [
"def",
"eval_image",
"(",
"image",
",",
"height",
",",
"width",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"values",
"=",
"[",
"image",
",",
"height",
",",
"width",
"]",
",",
"name",
"=",
"scope",
",",
"default_name",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | image_preprocessing | Decode and preprocess one image for evaluation or training.
Args:
image_buffer: JPEG encoded string Tensor
bbox: 3-D float Tensor of bounding boxes arranged [1, num_boxes, coords]
where each coordinate is [0, 1) and the coordinates are arranged as
[ymin, xmin, ymax, xmax].
train: boolean
... | examples/imagenet/inception/image_processing.py | def image_preprocessing(image_buffer, bbox, train, thread_id=0):
"""Decode and preprocess one image for evaluation or training.
Args:
image_buffer: JPEG encoded string Tensor
bbox: 3-D float Tensor of bounding boxes arranged [1, num_boxes, coords]
where each coordinate is [0, 1) and the coordinates a... | def image_preprocessing(image_buffer, bbox, train, thread_id=0):
"""Decode and preprocess one image for evaluation or training.
Args:
image_buffer: JPEG encoded string Tensor
bbox: 3-D float Tensor of bounding boxes arranged [1, num_boxes, coords]
where each coordinate is [0, 1) and the coordinates a... | [
"Decode",
"and",
"preprocess",
"one",
"image",
"for",
"evaluation",
"or",
"training",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L304-L336 | [
"def",
"image_preprocessing",
"(",
"image_buffer",
",",
"bbox",
",",
"train",
",",
"thread_id",
"=",
"0",
")",
":",
"if",
"bbox",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Please supply a bounding box.'",
")",
"image",
"=",
"decode_jpeg",
"(",
"image_bu... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | parse_example_proto | Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
containing serialized Example protocol buffers. Each Example proto contains
the following fields:
image/height: 462
image/width: 581
image/colorspace: 'RGB... | examples/imagenet/inception/image_processing.py | def parse_example_proto(example_serialized):
"""Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
containing serialized Example protocol buffers. Each Example proto contains
the following fields:
image/height: 4... | def parse_example_proto(example_serialized):
"""Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
containing serialized Example protocol buffers. Each Example proto contains
the following fields:
image/height: 4... | [
"Parses",
"an",
"Example",
"proto",
"containing",
"a",
"training",
"example",
"of",
"an",
"image",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L339-L407 | [
"def",
"parse_example_proto",
"(",
"example_serialized",
")",
":",
"# Dense features in Example proto.",
"feature_map",
"=",
"{",
"'image/encoded'",
":",
"tf",
".",
"FixedLenFeature",
"(",
"[",
"]",
",",
"dtype",
"=",
"tf",
".",
"string",
",",
"default_value",
"="... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | batch_inputs | Contruct batches of training or evaluation examples from the image dataset.
Args:
dataset: instance of Dataset class specifying the dataset.
See dataset.py for details.
batch_size: integer
train: boolean
num_preprocess_threads: integer, total number of preprocessing threads
num_readers: int... | examples/imagenet/inception/image_processing.py | def batch_inputs(dataset, batch_size, train, num_preprocess_threads=None,
num_readers=1):
"""Contruct batches of training or evaluation examples from the image dataset.
Args:
dataset: instance of Dataset class specifying the dataset.
See dataset.py for details.
batch_size: integer
... | def batch_inputs(dataset, batch_size, train, num_preprocess_threads=None,
num_readers=1):
"""Contruct batches of training or evaluation examples from the image dataset.
Args:
dataset: instance of Dataset class specifying the dataset.
See dataset.py for details.
batch_size: integer
... | [
"Contruct",
"batches",
"of",
"training",
"or",
"evaluation",
"examples",
"from",
"the",
"image",
"dataset",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L410-L513 | [
"def",
"batch_inputs",
"(",
"dataset",
",",
"batch_size",
",",
"train",
",",
"num_preprocess_threads",
"=",
"None",
",",
"num_readers",
"=",
"1",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"'batch_processing'",
")",
":",
"data_files",
"=",
"dataset",
".... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | setup_external_libs | Download external libraries from PyPI to SPARK_EC2_DIR/lib/ and prepend them to our PATH. | scripts/spark_ec2.py | def setup_external_libs(libs):
"""
Download external libraries from PyPI to SPARK_EC2_DIR/lib/ and prepend them to our PATH.
"""
PYPI_URL_PREFIX = "https://pypi.python.org/packages/source"
SPARK_EC2_LIB_DIR = os.path.join(SPARK_EC2_DIR, "lib")
if not os.path.exists(SPARK_EC2_LIB_DIR):
p... | def setup_external_libs(libs):
"""
Download external libraries from PyPI to SPARK_EC2_DIR/lib/ and prepend them to our PATH.
"""
PYPI_URL_PREFIX = "https://pypi.python.org/packages/source"
SPARK_EC2_LIB_DIR = os.path.join(SPARK_EC2_DIR, "lib")
if not os.path.exists(SPARK_EC2_LIB_DIR):
p... | [
"Download",
"external",
"libraries",
"from",
"PyPI",
"to",
"SPARK_EC2_DIR",
"/",
"lib",
"/",
"and",
"prepend",
"them",
"to",
"our",
"PATH",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L111-L151 | [
"def",
"setup_external_libs",
"(",
"libs",
")",
":",
"PYPI_URL_PREFIX",
"=",
"\"https://pypi.python.org/packages/source\"",
"SPARK_EC2_LIB_DIR",
"=",
"os",
".",
"path",
".",
"join",
"(",
"SPARK_EC2_DIR",
",",
"\"lib\"",
")",
"if",
"not",
"os",
".",
"path",
".",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | get_existing_cluster | Get the EC2 instances in an existing cluster if available.
Returns a tuple of lists of EC2 instance objects for the masters and slaves. | scripts/spark_ec2.py | def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
"""
Get the EC2 instances in an existing cluster if available.
Returns a tuple of lists of EC2 instance objects for the masters and slaves.
"""
print("Searching for existing cluster {c} in region {r}...".format(
c=clust... | def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
"""
Get the EC2 instances in an existing cluster if available.
Returns a tuple of lists of EC2 instance objects for the masters and slaves.
"""
print("Searching for existing cluster {c} in region {r}...".format(
c=clust... | [
"Get",
"the",
"EC2",
"instances",
"in",
"an",
"existing",
"cluster",
"if",
"available",
".",
"Returns",
"a",
"tuple",
"of",
"lists",
"of",
"EC2",
"instance",
"objects",
"for",
"the",
"masters",
"and",
"slaves",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L757-L792 | [
"def",
"get_existing_cluster",
"(",
"conn",
",",
"opts",
",",
"cluster_name",
",",
"die_on_error",
"=",
"True",
")",
":",
"print",
"(",
"\"Searching for existing cluster {c} in region {r}...\"",
".",
"format",
"(",
"c",
"=",
"cluster_name",
",",
"r",
"=",
"opts",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | is_ssh_available | Check if SSH is available on a host. | scripts/spark_ec2.py | def is_ssh_available(host, opts, print_ssh_output=True):
"""
Check if SSH is available on a host.
"""
s = subprocess.Popen(
ssh_command(opts) + ['-t', '-t', '-o', 'ConnectTimeout=3',
'%s@%s' % (opts.user, host), stringify_command('true')],
stdout=subprocess.P... | def is_ssh_available(host, opts, print_ssh_output=True):
"""
Check if SSH is available on a host.
"""
s = subprocess.Popen(
ssh_command(opts) + ['-t', '-t', '-o', 'ConnectTimeout=3',
'%s@%s' % (opts.user, host), stringify_command('true')],
stdout=subprocess.P... | [
"Check",
"if",
"SSH",
"is",
"available",
"on",
"a",
"host",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L882-L907 | [
"def",
"is_ssh_available",
"(",
"host",
",",
"opts",
",",
"print_ssh_output",
"=",
"True",
")",
":",
"s",
"=",
"subprocess",
".",
"Popen",
"(",
"ssh_command",
"(",
"opts",
")",
"+",
"[",
"'-t'",
",",
"'-t'",
",",
"'-o'",
",",
"'ConnectTimeout=3'",
",",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | is_cluster_ssh_available | Check if SSH is available on all the instances in a cluster. | scripts/spark_ec2.py | def is_cluster_ssh_available(cluster_instances, opts):
"""
Check if SSH is available on all the instances in a cluster.
"""
for i in cluster_instances:
dns_name = get_dns_name(i, opts.private_ips)
if not is_ssh_available(host=dns_name, opts=opts):
return False
else:
... | def is_cluster_ssh_available(cluster_instances, opts):
"""
Check if SSH is available on all the instances in a cluster.
"""
for i in cluster_instances:
dns_name = get_dns_name(i, opts.private_ips)
if not is_ssh_available(host=dns_name, opts=opts):
return False
else:
... | [
"Check",
"if",
"SSH",
"is",
"available",
"on",
"all",
"the",
"instances",
"in",
"a",
"cluster",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L910-L919 | [
"def",
"is_cluster_ssh_available",
"(",
"cluster_instances",
",",
"opts",
")",
":",
"for",
"i",
"in",
"cluster_instances",
":",
"dns_name",
"=",
"get_dns_name",
"(",
"i",
",",
"opts",
".",
"private_ips",
")",
"if",
"not",
"is_ssh_available",
"(",
"host",
"=",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | wait_for_cluster_state | Wait for all the instances in the cluster to reach a designated state.
cluster_instances: a list of boto.ec2.instance.Instance
cluster_state: a string representing the desired state of all the instances in the cluster
value can be 'ssh-ready' or a valid value from boto.ec2.instance.InstanceState suc... | scripts/spark_ec2.py | def wait_for_cluster_state(conn, opts, cluster_instances, cluster_state):
"""
Wait for all the instances in the cluster to reach a designated state.
cluster_instances: a list of boto.ec2.instance.Instance
cluster_state: a string representing the desired state of all the instances in the cluster
... | def wait_for_cluster_state(conn, opts, cluster_instances, cluster_state):
"""
Wait for all the instances in the cluster to reach a designated state.
cluster_instances: a list of boto.ec2.instance.Instance
cluster_state: a string representing the desired state of all the instances in the cluster
... | [
"Wait",
"for",
"all",
"the",
"instances",
"in",
"the",
"cluster",
"to",
"reach",
"a",
"designated",
"state",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L922-L973 | [
"def",
"wait_for_cluster_state",
"(",
"conn",
",",
"opts",
",",
"cluster_instances",
",",
"cluster_state",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"Waiting for cluster to enter '{s}' state.\"",
".",
"format",
"(",
"s",
"=",
"cluster_state",
")",
")",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | ImagenetData.download_message | Instruction to download and extract the tarball from Flowers website. | examples/imagenet/inception/imagenet_data.py | def download_message(self):
"""Instruction to download and extract the tarball from Flowers website."""
print('Failed to find any ImageNet %s files'% self.subset)
print('')
print('If you have already downloaded and processed the data, then make '
'sure to set --data_dir to point to the direct... | def download_message(self):
"""Instruction to download and extract the tarball from Flowers website."""
print('Failed to find any ImageNet %s files'% self.subset)
print('')
print('If you have already downloaded and processed the data, then make '
'sure to set --data_dir to point to the direct... | [
"Instruction",
"to",
"download",
"and",
"extract",
"the",
"tarball",
"from",
"Flowers",
"website",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/imagenet_data.py#L44-L59 | [
"def",
"download_message",
"(",
"self",
")",
":",
"print",
"(",
"'Failed to find any ImageNet %s files'",
"%",
"self",
".",
"subset",
")",
"print",
"(",
"''",
")",
"print",
"(",
"'If you have already downloaded and processed the data, then make '",
"'sure to set --data_dir ... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | define_wide_deep_flags | Add supervised learning flags, as well as wide-deep model type. | examples/wide_deep/wide_deep_run_loop.py | def define_wide_deep_flags():
"""Add supervised learning flags, as well as wide-deep model type."""
flags_core.define_base()
flags_core.define_benchmark()
flags_core.define_performance(
num_parallel_calls=False, inter_op=True, intra_op=True,
synthetic_data=False, max_train_steps=False, dtype=False,
... | def define_wide_deep_flags():
"""Add supervised learning flags, as well as wide-deep model type."""
flags_core.define_base()
flags_core.define_benchmark()
flags_core.define_performance(
num_parallel_calls=False, inter_op=True, intra_op=True,
synthetic_data=False, max_train_steps=False, dtype=False,
... | [
"Add",
"supervised",
"learning",
"flags",
"as",
"well",
"as",
"wide",
"-",
"deep",
"model",
"type",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/wide_deep_run_loop.py#L37-L54 | [
"def",
"define_wide_deep_flags",
"(",
")",
":",
"flags_core",
".",
"define_base",
"(",
")",
"flags_core",
".",
"define_benchmark",
"(",
")",
"flags_core",
".",
"define_performance",
"(",
"num_parallel_calls",
"=",
"False",
",",
"inter_op",
"=",
"True",
",",
"int... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | export_model | Export to SavedModel format.
Args:
model: Estimator object
model_type: string indicating model type. "wide", "deep" or "wide_deep"
export_dir: directory to export the model.
model_column_fn: Function to generate model feature columns. | examples/wide_deep/wide_deep_run_loop.py | def export_model(model, model_type, export_dir, model_column_fn):
"""Export to SavedModel format.
Args:
model: Estimator object
model_type: string indicating model type. "wide", "deep" or "wide_deep"
export_dir: directory to export the model.
model_column_fn: Function to generate model feature colu... | def export_model(model, model_type, export_dir, model_column_fn):
"""Export to SavedModel format.
Args:
model: Estimator object
model_type: string indicating model type. "wide", "deep" or "wide_deep"
export_dir: directory to export the model.
model_column_fn: Function to generate model feature colu... | [
"Export",
"to",
"SavedModel",
"format",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/wide_deep_run_loop.py#L57-L77 | [
"def",
"export_model",
"(",
"model",
",",
"model_type",
",",
"export_dir",
",",
"model_column_fn",
")",
":",
"wide_columns",
",",
"deep_columns",
"=",
"model_column_fn",
"(",
")",
"if",
"model_type",
"==",
"'wide'",
":",
"columns",
"=",
"wide_columns",
"elif",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | run_loop | Define training loop. | examples/wide_deep/wide_deep_run_loop.py | def run_loop(name, train_input_fn, eval_input_fn, model_column_fn,
build_estimator_fn, flags_obj, tensors_to_log, early_stop=False):
"""Define training loop."""
model_helpers.apply_clean(flags.FLAGS)
model = build_estimator_fn(
model_dir=flags_obj.model_dir, model_type=flags_obj.model_type,
... | def run_loop(name, train_input_fn, eval_input_fn, model_column_fn,
build_estimator_fn, flags_obj, tensors_to_log, early_stop=False):
"""Define training loop."""
model_helpers.apply_clean(flags.FLAGS)
model = build_estimator_fn(
model_dir=flags_obj.model_dir, model_type=flags_obj.model_type,
... | [
"Define",
"training",
"loop",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/wide_deep_run_loop.py#L80-L131 | [
"def",
"run_loop",
"(",
"name",
",",
"train_input_fn",
",",
"eval_input_fn",
",",
"model_column_fn",
",",
"build_estimator_fn",
",",
"flags_obj",
",",
"tensors_to_log",
",",
"early_stop",
"=",
"False",
")",
":",
"model_helpers",
".",
"apply_clean",
"(",
"flags",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _tower_loss | Calculate the total loss on a single tower running the ImageNet model.
We perform 'batch splitting'. This means that we cut up a batch across
multiple GPU's. For instance, if the batch size = 32 and num_gpus = 2,
then each tower will operate on an batch of 16 images.
Args:
images: Images. 4D tensor of siz... | examples/imagenet/inception/inception_train.py | def _tower_loss(images, labels, num_classes, scope, reuse_variables=None):
"""Calculate the total loss on a single tower running the ImageNet model.
We perform 'batch splitting'. This means that we cut up a batch across
multiple GPU's. For instance, if the batch size = 32 and num_gpus = 2,
then each tower will... | def _tower_loss(images, labels, num_classes, scope, reuse_variables=None):
"""Calculate the total loss on a single tower running the ImageNet model.
We perform 'batch splitting'. This means that we cut up a batch across
multiple GPU's. For instance, if the batch size = 32 and num_gpus = 2,
then each tower will... | [
"Calculate",
"the",
"total",
"loss",
"on",
"a",
"single",
"tower",
"running",
"the",
"ImageNet",
"model",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_train.py#L82-L140 | [
"def",
"_tower_loss",
"(",
"images",
",",
"labels",
",",
"num_classes",
",",
"scope",
",",
"reuse_variables",
"=",
"None",
")",
":",
"# When fine-tuning a model, we do not restore the logits but instead we",
"# randomly initialize the logits. The number of classes in the output of ... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | train | Train on dataset for a number of steps. | examples/imagenet/inception/inception_train.py | def train(dataset):
"""Train on dataset for a number of steps."""
with tf.Graph().as_default(), tf.device('/cpu:0'):
# Create a variable to count the number of train() calls. This equals the
# number of batches processed * FLAGS.num_gpus.
global_step = tf.get_variable(
'global_step', [],
... | def train(dataset):
"""Train on dataset for a number of steps."""
with tf.Graph().as_default(), tf.device('/cpu:0'):
# Create a variable to count the number of train() calls. This equals the
# number of batches processed * FLAGS.num_gpus.
global_step = tf.get_variable(
'global_step', [],
... | [
"Train",
"on",
"dataset",
"for",
"a",
"number",
"of",
"steps",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_train.py#L181-L357 | [
"def",
"train",
"(",
"dataset",
")",
":",
"with",
"tf",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
",",
"tf",
".",
"device",
"(",
"'/cpu:0'",
")",
":",
"# Create a variable to count the number of train() calls. This equals the",
"# number of batches proces... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | batch_norm | Adds a Batch Normalization layer.
Args:
inputs: a tensor of size [batch_size, height, width, channels]
or [batch_size, channels].
decay: decay for the moving average.
center: If True, subtract beta. If False, beta is not created and ignored.
scale: If True, multiply by gamma. If False, ga... | examples/imagenet/inception/slim/ops.py | def batch_norm(inputs,
decay=0.999,
center=True,
scale=False,
epsilon=0.001,
moving_vars='moving_vars',
activation=None,
is_training=True,
trainable=True,
restore=True,
s... | def batch_norm(inputs,
decay=0.999,
center=True,
scale=False,
epsilon=0.001,
moving_vars='moving_vars',
activation=None,
is_training=True,
trainable=True,
restore=True,
s... | [
"Adds",
"a",
"Batch",
"Normalization",
"layer",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L43-L132 | [
"def",
"batch_norm",
"(",
"inputs",
",",
"decay",
"=",
"0.999",
",",
"center",
"=",
"True",
",",
"scale",
"=",
"False",
",",
"epsilon",
"=",
"0.001",
",",
"moving_vars",
"=",
"'moving_vars'",
",",
"activation",
"=",
"None",
",",
"is_training",
"=",
"True... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | _two_element_tuple | Converts `int_or_tuple` to height, width.
Several of the functions that follow accept arguments as either
a tuple of 2 integers or a single integer. A single integer
indicates that the 2 values of the tuple are the same.
This functions normalizes the input value by always returning a tuple.
Args:
int_... | examples/imagenet/inception/slim/ops.py | def _two_element_tuple(int_or_tuple):
"""Converts `int_or_tuple` to height, width.
Several of the functions that follow accept arguments as either
a tuple of 2 integers or a single integer. A single integer
indicates that the 2 values of the tuple are the same.
This functions normalizes the input value by ... | def _two_element_tuple(int_or_tuple):
"""Converts `int_or_tuple` to height, width.
Several of the functions that follow accept arguments as either
a tuple of 2 integers or a single integer. A single integer
indicates that the 2 values of the tuple are the same.
This functions normalizes the input value by ... | [
"Converts",
"int_or_tuple",
"to",
"height",
"width",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L135-L163 | [
"def",
"_two_element_tuple",
"(",
"int_or_tuple",
")",
":",
"if",
"isinstance",
"(",
"int_or_tuple",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"if",
"len",
"(",
"int_or_tuple",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'Must be a list with 2 ele... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | conv2d | Adds a 2D convolution followed by an optional batch_norm layer.
conv2d creates a variable called 'weights', representing the convolutional
kernel, that is convolved with the input. If `batch_norm_params` is None, a
second variable called 'biases' is added to the result of the convolution
operation.
Args:
... | examples/imagenet/inception/slim/ops.py | def conv2d(inputs,
num_filters_out,
kernel_size,
stride=1,
padding='SAME',
activation=tf.nn.relu,
stddev=0.01,
bias=0.0,
weight_decay=0,
batch_norm_params=None,
is_training=True,
trainable=True,
... | def conv2d(inputs,
num_filters_out,
kernel_size,
stride=1,
padding='SAME',
activation=tf.nn.relu,
stddev=0.01,
bias=0.0,
weight_decay=0,
batch_norm_params=None,
is_training=True,
trainable=True,
... | [
"Adds",
"a",
"2D",
"convolution",
"followed",
"by",
"an",
"optional",
"batch_norm",
"layer",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L167-L246 | [
"def",
"conv2d",
"(",
"inputs",
",",
"num_filters_out",
",",
"kernel_size",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"'SAME'",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"stddev",
"=",
"0.01",
",",
"bias",
"=",
"0.0",
",",
"weigh... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | fc | Adds a fully connected layer followed by an optional batch_norm layer.
FC creates a variable called 'weights', representing the fully connected
weight matrix, that is multiplied by the input. If `batch_norm` is None, a
second variable called 'biases' is added to the result of the initial
vector-matrix multipli... | examples/imagenet/inception/slim/ops.py | def fc(inputs,
num_units_out,
activation=tf.nn.relu,
stddev=0.01,
bias=0.0,
weight_decay=0,
batch_norm_params=None,
is_training=True,
trainable=True,
restore=True,
scope=None,
reuse=None):
"""Adds a fully connected layer followed by an optio... | def fc(inputs,
num_units_out,
activation=tf.nn.relu,
stddev=0.01,
bias=0.0,
weight_decay=0,
batch_norm_params=None,
is_training=True,
trainable=True,
restore=True,
scope=None,
reuse=None):
"""Adds a fully connected layer followed by an optio... | [
"Adds",
"a",
"fully",
"connected",
"layer",
"followed",
"by",
"an",
"optional",
"batch_norm",
"layer",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L250-L317 | [
"def",
"fc",
"(",
"inputs",
",",
"num_units_out",
",",
"activation",
"=",
"tf",
".",
"nn",
".",
"relu",
",",
"stddev",
"=",
"0.01",
",",
"bias",
"=",
"0.0",
",",
"weight_decay",
"=",
"0",
",",
"batch_norm_params",
"=",
"None",
",",
"is_training",
"=",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | one_hot_encoding | Transform numeric labels into onehot_labels.
Args:
labels: [batch_size] target labels.
num_classes: total number of classes.
scope: Optional scope for name_scope.
Returns:
one hot encoding of the labels. | examples/imagenet/inception/slim/ops.py | def one_hot_encoding(labels, num_classes, scope=None):
"""Transform numeric labels into onehot_labels.
Args:
labels: [batch_size] target labels.
num_classes: total number of classes.
scope: Optional scope for name_scope.
Returns:
one hot encoding of the labels.
"""
with tf.name_scope(scope, '... | def one_hot_encoding(labels, num_classes, scope=None):
"""Transform numeric labels into onehot_labels.
Args:
labels: [batch_size] target labels.
num_classes: total number of classes.
scope: Optional scope for name_scope.
Returns:
one hot encoding of the labels.
"""
with tf.name_scope(scope, '... | [
"Transform",
"numeric",
"labels",
"into",
"onehot_labels",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L320-L338 | [
"def",
"one_hot_encoding",
"(",
"labels",
",",
"num_classes",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'OneHotEncoding'",
",",
"[",
"labels",
"]",
")",
":",
"batch_size",
"=",
"labels",
".",
"get_shape",
"... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | max_pool | Adds a Max Pooling layer.
It is assumed by the wrapper that the pooling is only done per image and not
in depth or batch.
Args:
inputs: a tensor of size [batch_size, height, width, depth].
kernel_size: a list of length 2: [kernel_height, kernel_width] of the
pooling kernel over which the op is com... | examples/imagenet/inception/slim/ops.py | def max_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
"""Adds a Max Pooling layer.
It is assumed by the wrapper that the pooling is only done per image and not
in depth or batch.
Args:
inputs: a tensor of size [batch_size, height, width, depth].
kernel_size: a list of length 2: [ke... | def max_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
"""Adds a Max Pooling layer.
It is assumed by the wrapper that the pooling is only done per image and not
in depth or batch.
Args:
inputs: a tensor of size [batch_size, height, width, depth].
kernel_size: a list of length 2: [ke... | [
"Adds",
"a",
"Max",
"Pooling",
"layer",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L342-L370 | [
"def",
"max_pool",
"(",
"inputs",
",",
"kernel_size",
",",
"stride",
"=",
"2",
",",
"padding",
"=",
"'VALID'",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'MaxPool'",
",",
"[",
"inputs",
"]",
")",
":",
... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | dropout | Returns a dropout layer applied to the input.
Args:
inputs: the tensor to pass to the Dropout layer.
keep_prob: the probability of keeping each input unit.
is_training: whether or not the model is in training mode. If so, dropout is
applied and values scaled. Otherwise, inputs is returned.
scope:... | examples/imagenet/inception/slim/ops.py | def dropout(inputs, keep_prob=0.5, is_training=True, scope=None):
"""Returns a dropout layer applied to the input.
Args:
inputs: the tensor to pass to the Dropout layer.
keep_prob: the probability of keeping each input unit.
is_training: whether or not the model is in training mode. If so, dropout is
... | def dropout(inputs, keep_prob=0.5, is_training=True, scope=None):
"""Returns a dropout layer applied to the input.
Args:
inputs: the tensor to pass to the Dropout layer.
keep_prob: the probability of keeping each input unit.
is_training: whether or not the model is in training mode. If so, dropout is
... | [
"Returns",
"a",
"dropout",
"layer",
"applied",
"to",
"the",
"input",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L404-L421 | [
"def",
"dropout",
"(",
"inputs",
",",
"keep_prob",
"=",
"0.5",
",",
"is_training",
"=",
"True",
",",
"scope",
"=",
"None",
")",
":",
"if",
"is_training",
"and",
"keep_prob",
">",
"0",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'Dropout'"... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | flatten | Flattens the input while maintaining the batch_size.
Assumes that the first dimension represents the batch.
Args:
inputs: a tensor of size [batch_size, ...].
scope: Optional scope for name_scope.
Returns:
a flattened tensor with shape [batch_size, k].
Raises:
ValueError: if inputs.shape is ... | examples/imagenet/inception/slim/ops.py | def flatten(inputs, scope=None):
"""Flattens the input while maintaining the batch_size.
Assumes that the first dimension represents the batch.
Args:
inputs: a tensor of size [batch_size, ...].
scope: Optional scope for name_scope.
Returns:
a flattened tensor with shape [batch_size, k].
Raise... | def flatten(inputs, scope=None):
"""Flattens the input while maintaining the batch_size.
Assumes that the first dimension represents the batch.
Args:
inputs: a tensor of size [batch_size, ...].
scope: Optional scope for name_scope.
Returns:
a flattened tensor with shape [batch_size, k].
Raise... | [
"Flattens",
"the",
"input",
"while",
"maintaining",
"the",
"batch_size",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L424-L443 | [
"def",
"flatten",
"(",
"inputs",
",",
"scope",
"=",
"None",
")",
":",
"if",
"len",
"(",
"inputs",
".",
"get_shape",
"(",
")",
")",
"<",
"2",
":",
"raise",
"ValueError",
"(",
"'Inputs must be have a least 2 dimensions'",
")",
"dims",
"=",
"inputs",
".",
"... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | repeat_op | Build a sequential Tower starting from inputs by using an op repeatedly.
It creates new scopes for each operation by increasing the counter.
Example: given repeat_op(3, _, ops.conv2d, 64, [3, 3], scope='conv1')
it will repeat the given op under the following variable_scopes:
conv1/Conv
conv1/Conv_1... | examples/imagenet/inception/slim/ops.py | def repeat_op(repetitions, inputs, op, *args, **kwargs):
"""Build a sequential Tower starting from inputs by using an op repeatedly.
It creates new scopes for each operation by increasing the counter.
Example: given repeat_op(3, _, ops.conv2d, 64, [3, 3], scope='conv1')
it will repeat the given op under the ... | def repeat_op(repetitions, inputs, op, *args, **kwargs):
"""Build a sequential Tower starting from inputs by using an op repeatedly.
It creates new scopes for each operation by increasing the counter.
Example: given repeat_op(3, _, ops.conv2d, 64, [3, 3], scope='conv1')
it will repeat the given op under the ... | [
"Build",
"a",
"sequential",
"Tower",
"starting",
"from",
"inputs",
"by",
"using",
"an",
"op",
"repeatedly",
"."
] | yahoo/TensorFlowOnSpark | python | https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L446-L473 | [
"def",
"repeat_op",
"(",
"repetitions",
",",
"inputs",
",",
"op",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"scope",
"=",
"kwargs",
".",
"pop",
"(",
"'scope'",
",",
"None",
")",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
",",
"'R... | 5e4b6c185ab722fd0104ede0377e1149ea8d6f7c |
train | RPCManager.do_rpc | Wraps a given RPC function by producing an awaitable function suitable to be run in the asyncio
event loop. The wrapped function catches all unhandled exceptions and reports them to the exception
future, which consumers can await upon to listen for unhandled exceptions.
The wrapped function als... | sdk/python/lib/pulumi/runtime/rpc_manager.py | def do_rpc(self, name: str, rpc_function: Callable[..., Awaitable[None]]) -> Callable[..., Awaitable[None]]:
"""
Wraps a given RPC function by producing an awaitable function suitable to be run in the asyncio
event loop. The wrapped function catches all unhandled exceptions and reports them to t... | def do_rpc(self, name: str, rpc_function: Callable[..., Awaitable[None]]) -> Callable[..., Awaitable[None]]:
"""
Wraps a given RPC function by producing an awaitable function suitable to be run in the asyncio
event loop. The wrapped function catches all unhandled exceptions and reports them to t... | [
"Wraps",
"a",
"given",
"RPC",
"function",
"by",
"producing",
"an",
"awaitable",
"function",
"suitable",
"to",
"be",
"run",
"in",
"the",
"asyncio",
"event",
"loop",
".",
"The",
"wrapped",
"function",
"catches",
"all",
"unhandled",
"exceptions",
"and",
"reports"... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc_manager.py#L49-L87 | [
"def",
"do_rpc",
"(",
"self",
",",
"name",
":",
"str",
",",
"rpc_function",
":",
"Callable",
"[",
"...",
",",
"Awaitable",
"[",
"None",
"]",
"]",
")",
"->",
"Callable",
"[",
"...",
",",
"Awaitable",
"[",
"None",
"]",
"]",
":",
"async",
"def",
"rpc_... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | register_resource | registerResource registers a new resource object with a given type t and name. It returns the auto-generated
URN and the ID that will resolve after the deployment has completed. All properties will be initialized to property
objects that the registration operation will resolve at the right time (or remain unr... | sdk/python/lib/pulumi/runtime/resource.py | def register_resource(res: 'Resource', ty: str, name: str, custom: bool, props: 'Inputs', opts: Optional['ResourceOptions']):
"""
registerResource registers a new resource object with a given type t and name. It returns the auto-generated
URN and the ID that will resolve after the deployment has completed.... | def register_resource(res: 'Resource', ty: str, name: str, custom: bool, props: 'Inputs', opts: Optional['ResourceOptions']):
"""
registerResource registers a new resource object with a given type t and name. It returns the auto-generated
URN and the ID that will resolve after the deployment has completed.... | [
"registerResource",
"registers",
"a",
"new",
"resource",
"object",
"with",
"a",
"given",
"type",
"t",
"and",
"name",
".",
"It",
"returns",
"the",
"auto",
"-",
"generated",
"URN",
"and",
"the",
"ID",
"that",
"will",
"resolve",
"after",
"the",
"deployment",
... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/resource.py#L123-L234 | [
"def",
"register_resource",
"(",
"res",
":",
"'Resource'",
",",
"ty",
":",
"str",
",",
"name",
":",
"str",
",",
"custom",
":",
"bool",
",",
"props",
":",
"'Inputs'",
",",
"opts",
":",
"Optional",
"[",
"'ResourceOptions'",
"]",
")",
":",
"log",
".",
"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | configure | Configure sets the current ambient settings bag to the one given. | sdk/python/lib/pulumi/runtime/settings.py | def configure(settings: Settings):
"""
Configure sets the current ambient settings bag to the one given.
"""
if not settings or not isinstance(settings, Settings):
raise TypeError('Settings is expected to be non-None and of type Settings')
global SETTINGS # pylint: disable=global-statement
... | def configure(settings: Settings):
"""
Configure sets the current ambient settings bag to the one given.
"""
if not settings or not isinstance(settings, Settings):
raise TypeError('Settings is expected to be non-None and of type Settings')
global SETTINGS # pylint: disable=global-statement
... | [
"Configure",
"sets",
"the",
"current",
"ambient",
"settings",
"bag",
"to",
"the",
"one",
"given",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L70-L77 | [
"def",
"configure",
"(",
"settings",
":",
"Settings",
")",
":",
"if",
"not",
"settings",
"or",
"not",
"isinstance",
"(",
"settings",
",",
"Settings",
")",
":",
"raise",
"TypeError",
"(",
"'Settings is expected to be non-None and of type Settings'",
")",
"global",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | get_project | Returns the current project name. | sdk/python/lib/pulumi/runtime/settings.py | def get_project() -> Optional[str]:
"""
Returns the current project name.
"""
project = SETTINGS.project
if not project:
require_test_mode_enabled()
raise RunError('Missing project name; for test mode, please set PULUMI_NODEJS_PROJECT')
return project | def get_project() -> Optional[str]:
"""
Returns the current project name.
"""
project = SETTINGS.project
if not project:
require_test_mode_enabled()
raise RunError('Missing project name; for test mode, please set PULUMI_NODEJS_PROJECT')
return project | [
"Returns",
"the",
"current",
"project",
"name",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L107-L115 | [
"def",
"get_project",
"(",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"project",
"=",
"SETTINGS",
".",
"project",
"if",
"not",
"project",
":",
"require_test_mode_enabled",
"(",
")",
"raise",
"RunError",
"(",
"'Missing project name; for test mode, please set PULUMI... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | get_stack | Returns the current stack name. | sdk/python/lib/pulumi/runtime/settings.py | def get_stack() -> Optional[str]:
"""
Returns the current stack name.
"""
stack = SETTINGS.stack
if not stack:
require_test_mode_enabled()
raise RunError('Missing stack name; for test mode, please set PULUMI_NODEJS_STACK')
return stack | def get_stack() -> Optional[str]:
"""
Returns the current stack name.
"""
stack = SETTINGS.stack
if not stack:
require_test_mode_enabled()
raise RunError('Missing stack name; for test mode, please set PULUMI_NODEJS_STACK')
return stack | [
"Returns",
"the",
"current",
"stack",
"name",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L125-L133 | [
"def",
"get_stack",
"(",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"stack",
"=",
"SETTINGS",
".",
"stack",
"if",
"not",
"stack",
":",
"require_test_mode_enabled",
"(",
")",
"raise",
"RunError",
"(",
"'Missing stack name; for test mode, please set PULUMI_NODEJS_ST... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | get_monitor | Returns the current resource monitoring service client for RPC communications. | sdk/python/lib/pulumi/runtime/settings.py | def get_monitor() -> Optional[resource_pb2_grpc.ResourceMonitorStub]:
"""
Returns the current resource monitoring service client for RPC communications.
"""
monitor = SETTINGS.monitor
if not monitor:
require_test_mode_enabled()
return monitor | def get_monitor() -> Optional[resource_pb2_grpc.ResourceMonitorStub]:
"""
Returns the current resource monitoring service client for RPC communications.
"""
monitor = SETTINGS.monitor
if not monitor:
require_test_mode_enabled()
return monitor | [
"Returns",
"the",
"current",
"resource",
"monitoring",
"service",
"client",
"for",
"RPC",
"communications",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L143-L150 | [
"def",
"get_monitor",
"(",
")",
"->",
"Optional",
"[",
"resource_pb2_grpc",
".",
"ResourceMonitorStub",
"]",
":",
"monitor",
"=",
"SETTINGS",
".",
"monitor",
"if",
"not",
"monitor",
":",
"require_test_mode_enabled",
"(",
")",
"return",
"monitor"
] | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | serialize_properties | Serializes an arbitrary Input bag into a Protobuf structure, keeping track of the list
of dependent resources in the `deps` list. Serializing properties is inherently async
because it awaits any futures that are contained transitively within the input bag. | sdk/python/lib/pulumi/runtime/rpc.py | async def serialize_properties(inputs: 'Inputs',
property_deps: Dict[str, List['Resource']],
input_transformer: Optional[Callable[[str], str]] = None) -> struct_pb2.Struct:
"""
Serializes an arbitrary Input bag into a Protobuf structure, keeping trac... | async def serialize_properties(inputs: 'Inputs',
property_deps: Dict[str, List['Resource']],
input_transformer: Optional[Callable[[str], str]] = None) -> struct_pb2.Struct:
"""
Serializes an arbitrary Input bag into a Protobuf structure, keeping trac... | [
"Serializes",
"an",
"arbitrary",
"Input",
"bag",
"into",
"a",
"Protobuf",
"structure",
"keeping",
"track",
"of",
"the",
"list",
"of",
"dependent",
"resources",
"in",
"the",
"deps",
"list",
".",
"Serializing",
"properties",
"is",
"inherently",
"async",
"because",... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L46-L70 | [
"async",
"def",
"serialize_properties",
"(",
"inputs",
":",
"'Inputs'",
",",
"property_deps",
":",
"Dict",
"[",
"str",
",",
"List",
"[",
"'Resource'",
"]",
"]",
",",
"input_transformer",
":",
"Optional",
"[",
"Callable",
"[",
"[",
"str",
"]",
",",
"str",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | serialize_property | Serializes a single Input into a form suitable for remoting to the engine, awaiting
any futures required to do so. | sdk/python/lib/pulumi/runtime/rpc.py | async def serialize_property(value: 'Input[Any]',
deps: List['Resource'],
input_transformer: Optional[Callable[[str], str]] = None) -> Any:
"""
Serializes a single Input into a form suitable for remoting to the engine, awaiting
any futures required t... | async def serialize_property(value: 'Input[Any]',
deps: List['Resource'],
input_transformer: Optional[Callable[[str], str]] = None) -> Any:
"""
Serializes a single Input into a form suitable for remoting to the engine, awaiting
any futures required t... | [
"Serializes",
"a",
"single",
"Input",
"into",
"a",
"form",
"suitable",
"for",
"remoting",
"to",
"the",
"engine",
"awaiting",
"any",
"futures",
"required",
"to",
"do",
"so",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L74-L159 | [
"async",
"def",
"serialize_property",
"(",
"value",
":",
"'Input[Any]'",
",",
"deps",
":",
"List",
"[",
"'Resource'",
"]",
",",
"input_transformer",
":",
"Optional",
"[",
"Callable",
"[",
"[",
"str",
"]",
",",
"str",
"]",
"]",
"=",
"None",
")",
"->",
"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | deserialize_properties | Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal
Python types. | sdk/python/lib/pulumi/runtime/rpc.py | def deserialize_properties(props_struct: struct_pb2.Struct) -> Any:
"""
Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal
Python types.
"""
# Check out this link for details on what sort of types Protobuf is going to generate:
# https://developers.google.com/... | def deserialize_properties(props_struct: struct_pb2.Struct) -> Any:
"""
Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal
Python types.
"""
# Check out this link for details on what sort of types Protobuf is going to generate:
# https://developers.google.com/... | [
"Deserializes",
"a",
"protobuf",
"struct_pb2",
".",
"Struct",
"into",
"a",
"Python",
"dictionary",
"containing",
"normal",
"Python",
"types",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L162-L203 | [
"def",
"deserialize_properties",
"(",
"props_struct",
":",
"struct_pb2",
".",
"Struct",
")",
"->",
"Any",
":",
"# Check out this link for details on what sort of types Protobuf is going to generate:",
"# https://developers.google.com/protocol-buffers/docs/reference/python-generated",
"#"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | deserialize_property | Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic
Python values. | sdk/python/lib/pulumi/runtime/rpc.py | def deserialize_property(value: Any) -> Any:
"""
Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic
Python values.
"""
if value == UNKNOWN:
return None
# ListValues are projected to lists
if isinstance(value, struct_pb2.ListValue):
return [d... | def deserialize_property(value: Any) -> Any:
"""
Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic
Python values.
"""
if value == UNKNOWN:
return None
# ListValues are projected to lists
if isinstance(value, struct_pb2.ListValue):
return [d... | [
"Deserializes",
"a",
"single",
"protobuf",
"value",
"(",
"either",
"Struct",
"or",
"ListValue",
")",
"into",
"idiomatic",
"Python",
"values",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L206-L223 | [
"def",
"deserialize_property",
"(",
"value",
":",
"Any",
")",
"->",
"Any",
":",
"if",
"value",
"==",
"UNKNOWN",
":",
"return",
"None",
"# ListValues are projected to lists",
"if",
"isinstance",
"(",
"value",
",",
"struct_pb2",
".",
"ListValue",
")",
":",
"retu... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | translate_output_properties | Recursively rewrite keys of objects returned by the engine to conform with a naming
convention specified by the resource's implementation of `translate_output_property`.
If output is a `dict`, every key is translated using `translate_output_property` while every value is transformed
by recursing.
If o... | sdk/python/lib/pulumi/runtime/rpc.py | def translate_output_properties(res: 'Resource', output: Any) -> Any:
"""
Recursively rewrite keys of objects returned by the engine to conform with a naming
convention specified by the resource's implementation of `translate_output_property`.
If output is a `dict`, every key is translated using `trans... | def translate_output_properties(res: 'Resource', output: Any) -> Any:
"""
Recursively rewrite keys of objects returned by the engine to conform with a naming
convention specified by the resource's implementation of `translate_output_property`.
If output is a `dict`, every key is translated using `trans... | [
"Recursively",
"rewrite",
"keys",
"of",
"objects",
"returned",
"by",
"the",
"engine",
"to",
"conform",
"with",
"a",
"naming",
"convention",
"specified",
"by",
"the",
"resource",
"s",
"implementation",
"of",
"translate_output_property",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L274-L292 | [
"def",
"translate_output_properties",
"(",
"res",
":",
"'Resource'",
",",
"output",
":",
"Any",
")",
"->",
"Any",
":",
"if",
"isinstance",
"(",
"output",
",",
"dict",
")",
":",
"return",
"{",
"res",
".",
"translate_output_property",
"(",
"k",
")",
":",
"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | resolve_outputs_due_to_exception | Resolves all outputs with resolvers exceptionally, using the given exception as the reason why the resolver has
failed to resolve.
:param resolvers: Resolvers associated with a resource's outputs.
:param exn: The exception that occured when trying (and failing) to create this resource. | sdk/python/lib/pulumi/runtime/rpc.py | def resolve_outputs_due_to_exception(resolvers: Dict[str, Resolver], exn: Exception):
"""
Resolves all outputs with resolvers exceptionally, using the given exception as the reason why the resolver has
failed to resolve.
:param resolvers: Resolvers associated with a resource's outputs.
:param exn: ... | def resolve_outputs_due_to_exception(resolvers: Dict[str, Resolver], exn: Exception):
"""
Resolves all outputs with resolvers exceptionally, using the given exception as the reason why the resolver has
failed to resolve.
:param resolvers: Resolvers associated with a resource's outputs.
:param exn: ... | [
"Resolves",
"all",
"outputs",
"with",
"resolvers",
"exceptionally",
"using",
"the",
"given",
"exception",
"as",
"the",
"reason",
"why",
"the",
"resolver",
"has",
"failed",
"to",
"resolve",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L363-L373 | [
"def",
"resolve_outputs_due_to_exception",
"(",
"resolvers",
":",
"Dict",
"[",
"str",
",",
"Resolver",
"]",
",",
"exn",
":",
"Exception",
")",
":",
"for",
"key",
",",
"resolve",
"in",
"resolvers",
".",
"items",
"(",
")",
":",
"log",
".",
"debug",
"(",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.get | Returns an optional configuration value by its key, or None if it doesn't exist.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist.
:rtype: Optional[str] | sdk/python/lib/pulumi/config.py | def get(self, key: str) -> Optional[str]:
"""
Returns an optional configuration value by its key, or None if it doesn't exist.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist.
:rtype: Optional[str]
""... | def get(self, key: str) -> Optional[str]:
"""
Returns an optional configuration value by its key, or None if it doesn't exist.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist.
:rtype: Optional[str]
""... | [
"Returns",
"an",
"optional",
"configuration",
"value",
"by",
"its",
"key",
"or",
"None",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L50-L58 | [
"def",
"get",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"get_config",
"(",
"self",
".",
"full_key",
"(",
"key",
")",
")"
] | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.get_bool | Returns an optional configuration value, as a bool, by its key, or None if it doesn't exist.
If the configuration value isn't a legal boolean, this function will throw an error.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exis... | sdk/python/lib/pulumi/config.py | def get_bool(self, key: str) -> Optional[bool]:
"""
Returns an optional configuration value, as a bool, by its key, or None if it doesn't exist.
If the configuration value isn't a legal boolean, this function will throw an error.
:param str key: The requested configuration key.
... | def get_bool(self, key: str) -> Optional[bool]:
"""
Returns an optional configuration value, as a bool, by its key, or None if it doesn't exist.
If the configuration value isn't a legal boolean, this function will throw an error.
:param str key: The requested configuration key.
... | [
"Returns",
"an",
"optional",
"configuration",
"value",
"as",
"a",
"bool",
"by",
"its",
"key",
"or",
"None",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"the",
"configuration",
"value",
"isn",
"t",
"a",
"legal",
"boolean",
"this",
"function",
"will",
"t... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L60-L77 | [
"def",
"get_bool",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Optional",
"[",
"bool",
"]",
":",
"v",
"=",
"self",
".",
"get",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"return",
"None",
"if",
"v",
"in",
"[",
"'true'",
",",
"'True'",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.get_int | Returns an optional configuration value, as an int, by its key, or None if it doesn't exist.
If the configuration value isn't a legal int, this function will throw an error.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist.
... | sdk/python/lib/pulumi/config.py | def get_int(self, key: str) -> Optional[int]:
"""
Returns an optional configuration value, as an int, by its key, or None if it doesn't exist.
If the configuration value isn't a legal int, this function will throw an error.
:param str key: The requested configuration key.
:retur... | def get_int(self, key: str) -> Optional[int]:
"""
Returns an optional configuration value, as an int, by its key, or None if it doesn't exist.
If the configuration value isn't a legal int, this function will throw an error.
:param str key: The requested configuration key.
:retur... | [
"Returns",
"an",
"optional",
"configuration",
"value",
"as",
"an",
"int",
"by",
"its",
"key",
"or",
"None",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"the",
"configuration",
"value",
"isn",
"t",
"a",
"legal",
"int",
"this",
"function",
"will",
"throw... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L79-L95 | [
"def",
"get_int",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"v",
"=",
"self",
".",
"get",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"return",
"None",
"try",
":",
"return",
"int",
"(",
"v",
")",
"ex... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.get_float | Returns an optional configuration value, as a float, by its key, or None if it doesn't exist.
If the configuration value isn't a legal float, this function will throw an error.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist... | sdk/python/lib/pulumi/config.py | def get_float(self, key: str) -> Optional[float]:
"""
Returns an optional configuration value, as a float, by its key, or None if it doesn't exist.
If the configuration value isn't a legal float, this function will throw an error.
:param str key: The requested configuration key.
... | def get_float(self, key: str) -> Optional[float]:
"""
Returns an optional configuration value, as a float, by its key, or None if it doesn't exist.
If the configuration value isn't a legal float, this function will throw an error.
:param str key: The requested configuration key.
... | [
"Returns",
"an",
"optional",
"configuration",
"value",
"as",
"a",
"float",
"by",
"its",
"key",
"or",
"None",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"the",
"configuration",
"value",
"isn",
"t",
"a",
"legal",
"float",
"this",
"function",
"will",
"th... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L97-L113 | [
"def",
"get_float",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"v",
"=",
"self",
".",
"get",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"return",
"None",
"try",
":",
"return",
"float",
"(",
"v",
")",... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.require | Returns a configuration value by its given key. If it doesn't exist, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: str
:raises ConfigMissingError: The configuration value did not exist. | sdk/python/lib/pulumi/config.py | def require(self, key: str) -> str:
"""
Returns a configuration value by its given key. If it doesn't exist, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: str
:raises ConfigMissingError: The configur... | def require(self, key: str) -> str:
"""
Returns a configuration value by its given key. If it doesn't exist, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: str
:raises ConfigMissingError: The configur... | [
"Returns",
"a",
"configuration",
"value",
"by",
"its",
"given",
"key",
".",
"If",
"it",
"doesn",
"t",
"exist",
"an",
"error",
"is",
"thrown",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L115-L127 | [
"def",
"require",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"str",
":",
"v",
"=",
"self",
".",
"get",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"raise",
"ConfigMissingError",
"(",
"self",
".",
"full_key",
"(",
"key",
")",
")",
"return"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.require_bool | Returns a configuration value, as a bool, by its given key. If it doesn't exist, or the
configuration value is not a legal bool, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: bool
:raises ConfigMissingError:... | sdk/python/lib/pulumi/config.py | def require_bool(self, key: str) -> bool:
"""
Returns a configuration value, as a bool, by its given key. If it doesn't exist, or the
configuration value is not a legal bool, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's v... | def require_bool(self, key: str) -> bool:
"""
Returns a configuration value, as a bool, by its given key. If it doesn't exist, or the
configuration value is not a legal bool, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's v... | [
"Returns",
"a",
"configuration",
"value",
"as",
"a",
"bool",
"by",
"its",
"given",
"key",
".",
"If",
"it",
"doesn",
"t",
"exist",
"or",
"the",
"configuration",
"value",
"is",
"not",
"a",
"legal",
"bool",
"an",
"error",
"is",
"thrown",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L129-L143 | [
"def",
"require_bool",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"bool",
":",
"v",
"=",
"self",
".",
"get_bool",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"raise",
"ConfigMissingError",
"(",
"self",
".",
"full_key",
"(",
"key",
")",
")",... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.require_int | Returns a configuration value, as an int, by its given key. If it doesn't exist, or the
configuration value is not a legal int, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: int
:raises ConfigMissingError: T... | sdk/python/lib/pulumi/config.py | def require_int(self, key: str) -> int:
"""
Returns a configuration value, as an int, by its given key. If it doesn't exist, or the
configuration value is not a legal int, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's valu... | def require_int(self, key: str) -> int:
"""
Returns a configuration value, as an int, by its given key. If it doesn't exist, or the
configuration value is not a legal int, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's valu... | [
"Returns",
"a",
"configuration",
"value",
"as",
"an",
"int",
"by",
"its",
"given",
"key",
".",
"If",
"it",
"doesn",
"t",
"exist",
"or",
"the",
"configuration",
"value",
"is",
"not",
"a",
"legal",
"int",
"an",
"error",
"is",
"thrown",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L145-L159 | [
"def",
"require_int",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"int",
":",
"v",
"=",
"self",
".",
"get_int",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"raise",
"ConfigMissingError",
"(",
"self",
".",
"full_key",
"(",
"key",
")",
")",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Config.require_float | Returns a configuration value, as a float, by its given key. If it doesn't exist, or the
configuration value is not a legal number, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: float
:raises ConfigMissingEr... | sdk/python/lib/pulumi/config.py | def require_float(self, key: str) -> float:
"""
Returns a configuration value, as a float, by its given key. If it doesn't exist, or the
configuration value is not a legal number, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration ke... | def require_float(self, key: str) -> float:
"""
Returns a configuration value, as a float, by its given key. If it doesn't exist, or the
configuration value is not a legal number, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration ke... | [
"Returns",
"a",
"configuration",
"value",
"as",
"a",
"float",
"by",
"its",
"given",
"key",
".",
"If",
"it",
"doesn",
"t",
"exist",
"or",
"the",
"configuration",
"value",
"is",
"not",
"a",
"legal",
"number",
"an",
"error",
"is",
"thrown",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L161-L175 | [
"def",
"require_float",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"float",
":",
"v",
"=",
"self",
".",
"get_float",
"(",
"key",
")",
"if",
"v",
"is",
"None",
":",
"raise",
"ConfigMissingError",
"(",
"self",
".",
"full_key",
"(",
"key",
")",
"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | asset | Decorator to annotate the Asset class. Registers the decorated class
as the Asset known type. | sdk/python/lib/pulumi/runtime/known_types.py | def asset(class_obj: type) -> type:
"""
Decorator to annotate the Asset class. Registers the decorated class
as the Asset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _asset_resource_type
_asset_resource_type = class_obj
return class_obj | def asset(class_obj: type) -> type:
"""
Decorator to annotate the Asset class. Registers the decorated class
as the Asset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _asset_resource_type
_asset_resource_type = class_obj
return class_obj | [
"Decorator",
"to",
"annotate",
"the",
"Asset",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"Asset",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L66-L74 | [
"def",
"asset",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_asset_resource_type",
"_asset_resource_type",
"=",
"class_obj",
"return",
"class_obj"
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | file_asset | Decorator to annotate the FileAsset class. Registers the decorated class
as the FileAsset known type. | sdk/python/lib/pulumi/runtime/known_types.py | def file_asset(class_obj: type) -> type:
"""
Decorator to annotate the FileAsset class. Registers the decorated class
as the FileAsset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _file_asset_resource_type
_file_asset_resource_type = class_obj
ret... | def file_asset(class_obj: type) -> type:
"""
Decorator to annotate the FileAsset class. Registers the decorated class
as the FileAsset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _file_asset_resource_type
_file_asset_resource_type = class_obj
ret... | [
"Decorator",
"to",
"annotate",
"the",
"FileAsset",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"FileAsset",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L77-L85 | [
"def",
"file_asset",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_file_asset_resource_type",
"_file_asset_resource_type",
"=",
"class_obj",
"return",... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | string_asset | Decorator to annotate the StringAsset class. Registers the decorated class
as the StringAsset known type. | sdk/python/lib/pulumi/runtime/known_types.py | def string_asset(class_obj: type) -> type:
"""
Decorator to annotate the StringAsset class. Registers the decorated class
as the StringAsset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _string_asset_resource_type
_string_asset_resource_type = class_o... | def string_asset(class_obj: type) -> type:
"""
Decorator to annotate the StringAsset class. Registers the decorated class
as the StringAsset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _string_asset_resource_type
_string_asset_resource_type = class_o... | [
"Decorator",
"to",
"annotate",
"the",
"StringAsset",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"StringAsset",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L88-L96 | [
"def",
"string_asset",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_string_asset_resource_type",
"_string_asset_resource_type",
"=",
"class_obj",
"re... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | remote_asset | Decorator to annotate the RemoteAsset class. Registers the decorated class
as the RemoteAsset known type. | sdk/python/lib/pulumi/runtime/known_types.py | def remote_asset(class_obj: type) -> type:
"""
Decorator to annotate the RemoteAsset class. Registers the decorated class
as the RemoteAsset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _remote_asset_resource_type
_remote_asset_resource_type = class_o... | def remote_asset(class_obj: type) -> type:
"""
Decorator to annotate the RemoteAsset class. Registers the decorated class
as the RemoteAsset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _remote_asset_resource_type
_remote_asset_resource_type = class_o... | [
"Decorator",
"to",
"annotate",
"the",
"RemoteAsset",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"RemoteAsset",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L99-L107 | [
"def",
"remote_asset",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_remote_asset_resource_type",
"_remote_asset_resource_type",
"=",
"class_obj",
"re... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | archive | Decorator to annotate the Archive class. Registers the decorated class
as the Archive known type. | sdk/python/lib/pulumi/runtime/known_types.py | def archive(class_obj: type) -> type:
"""
Decorator to annotate the Archive class. Registers the decorated class
as the Archive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _archive_resource_type
_archive_resource_type = class_obj
return class_obj | def archive(class_obj: type) -> type:
"""
Decorator to annotate the Archive class. Registers the decorated class
as the Archive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _archive_resource_type
_archive_resource_type = class_obj
return class_obj | [
"Decorator",
"to",
"annotate",
"the",
"Archive",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"Archive",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L110-L118 | [
"def",
"archive",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_archive_resource_type",
"_archive_resource_type",
"=",
"class_obj",
"return",
"class... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | asset_archive | Decorator to annotate the AssetArchive class. Registers the decorated class
as the AssetArchive known type. | sdk/python/lib/pulumi/runtime/known_types.py | def asset_archive(class_obj: type) -> type:
"""
Decorator to annotate the AssetArchive class. Registers the decorated class
as the AssetArchive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _asset_archive_resource_type
_asset_archive_resource_type = cl... | def asset_archive(class_obj: type) -> type:
"""
Decorator to annotate the AssetArchive class. Registers the decorated class
as the AssetArchive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _asset_archive_resource_type
_asset_archive_resource_type = cl... | [
"Decorator",
"to",
"annotate",
"the",
"AssetArchive",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"AssetArchive",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L121-L129 | [
"def",
"asset_archive",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_asset_archive_resource_type",
"_asset_archive_resource_type",
"=",
"class_obj",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | file_archive | Decorator to annotate the FileArchive class. Registers the decorated class
as the FileArchive known type. | sdk/python/lib/pulumi/runtime/known_types.py | def file_archive(class_obj: type) -> type:
"""
Decorator to annotate the FileArchive class. Registers the decorated class
as the FileArchive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _file_archive_resource_type
_file_archive_resource_type = class_o... | def file_archive(class_obj: type) -> type:
"""
Decorator to annotate the FileArchive class. Registers the decorated class
as the FileArchive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _file_archive_resource_type
_file_archive_resource_type = class_o... | [
"Decorator",
"to",
"annotate",
"the",
"FileArchive",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"FileArchive",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L132-L140 | [
"def",
"file_archive",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_file_archive_resource_type",
"_file_archive_resource_type",
"=",
"class_obj",
"re... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | remote_archive | Decorator to annotate the RemoteArchive class. Registers the decorated class
as the RemoteArchive known type. | sdk/python/lib/pulumi/runtime/known_types.py | def remote_archive(class_obj: type) -> type:
"""
Decorator to annotate the RemoteArchive class. Registers the decorated class
as the RemoteArchive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _remote_archive_resource_type
_remote_archive_resource_type... | def remote_archive(class_obj: type) -> type:
"""
Decorator to annotate the RemoteArchive class. Registers the decorated class
as the RemoteArchive known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _remote_archive_resource_type
_remote_archive_resource_type... | [
"Decorator",
"to",
"annotate",
"the",
"RemoteArchive",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"RemoteArchive",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L143-L151 | [
"def",
"remote_archive",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_remote_archive_resource_type",
"_remote_archive_resource_type",
"=",
"class_obj",... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | custom_resource | Decorator to annotate the CustomResource class. Registers the decorated class
as the CustomResource known type. | sdk/python/lib/pulumi/runtime/known_types.py | def custom_resource(class_obj: type) -> type:
"""
Decorator to annotate the CustomResource class. Registers the decorated class
as the CustomResource known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _custom_resource_type
_custom_resource_type = class_obj
... | def custom_resource(class_obj: type) -> type:
"""
Decorator to annotate the CustomResource class. Registers the decorated class
as the CustomResource known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
global _custom_resource_type
_custom_resource_type = class_obj
... | [
"Decorator",
"to",
"annotate",
"the",
"CustomResource",
"class",
".",
"Registers",
"the",
"decorated",
"class",
"as",
"the",
"CustomResource",
"known",
"type",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L154-L162 | [
"def",
"custom_resource",
"(",
"class_obj",
":",
"type",
")",
"->",
"type",
":",
"assert",
"isinstance",
"(",
"class_obj",
",",
"type",
")",
",",
"\"class_obj is not a Class\"",
"global",
"_custom_resource_type",
"_custom_resource_type",
"=",
"class_obj",
"return",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | debug | Logs a message to the Pulumi CLI's debug channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resource: If provided, associate this message with the given resource in the Pulumi CLI.
:param Optional[int] stre... | sdk/python/lib/pulumi/log.py | def debug(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None) -> None:
"""
Logs a message to the Pulumi CLI's debug channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resou... | def debug(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None) -> None:
"""
Logs a message to the Pulumi CLI's debug channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resou... | [
"Logs",
"a",
"message",
"to",
"the",
"Pulumi",
"CLI",
"s",
"debug",
"channel",
"associating",
"it",
"with",
"a",
"resource",
"and",
"stream_id",
"if",
"provided",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L29-L42 | [
"def",
"debug",
"(",
"msg",
":",
"str",
",",
"resource",
":",
"Optional",
"[",
"'Resource'",
"]",
"=",
"None",
",",
"stream_id",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"None",
":",
"engine",
"=",
"get_engine",
"(",
")",
"if",
"en... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | info | Logs a message to the Pulumi CLI's info channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resource: If provided, associate this message with the given resource in the Pulumi CLI.
:param Optional[int] strea... | sdk/python/lib/pulumi/log.py | def info(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None) -> None:
"""
Logs a message to the Pulumi CLI's info channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resourc... | def info(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None) -> None:
"""
Logs a message to the Pulumi CLI's info channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resourc... | [
"Logs",
"a",
"message",
"to",
"the",
"Pulumi",
"CLI",
"s",
"info",
"channel",
"associating",
"it",
"with",
"a",
"resource",
"and",
"stream_id",
"if",
"provided",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L45-L58 | [
"def",
"info",
"(",
"msg",
":",
"str",
",",
"resource",
":",
"Optional",
"[",
"'Resource'",
"]",
"=",
"None",
",",
"stream_id",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"None",
":",
"engine",
"=",
"get_engine",
"(",
")",
"if",
"eng... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | warn | Logs a message to the Pulumi CLI's warning channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resource: If provided, associate this message with the given resource in the Pulumi CLI.
:param Optional[int] st... | sdk/python/lib/pulumi/log.py | def warn(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None) -> None:
"""
Logs a message to the Pulumi CLI's warning channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] reso... | def warn(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None) -> None:
"""
Logs a message to the Pulumi CLI's warning channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] reso... | [
"Logs",
"a",
"message",
"to",
"the",
"Pulumi",
"CLI",
"s",
"warning",
"channel",
"associating",
"it",
"with",
"a",
"resource",
"and",
"stream_id",
"if",
"provided",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L61-L74 | [
"def",
"warn",
"(",
"msg",
":",
"str",
",",
"resource",
":",
"Optional",
"[",
"'Resource'",
"]",
"=",
"None",
",",
"stream_id",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"None",
":",
"engine",
"=",
"get_engine",
"(",
")",
"if",
"eng... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | error | Logs a message to the Pulumi CLI's error channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resource: If provided, associate this message with the given resource in the Pulumi CLI.
:param Optional[int] stre... | sdk/python/lib/pulumi/log.py | def error(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None):
"""
Logs a message to the Pulumi CLI's error channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resource: If ... | def error(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None):
"""
Logs a message to the Pulumi CLI's error channel, associating it with a resource
and stream_id if provided.
:param str msg: The message to send to the Pulumi CLI.
:param Optional[Resource] resource: If ... | [
"Logs",
"a",
"message",
"to",
"the",
"Pulumi",
"CLI",
"s",
"error",
"channel",
"associating",
"it",
"with",
"a",
"resource",
"and",
"stream_id",
"if",
"provided",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L77-L90 | [
"def",
"error",
"(",
"msg",
":",
"str",
",",
"resource",
":",
"Optional",
"[",
"'Resource'",
"]",
"=",
"None",
",",
"stream_id",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
":",
"engine",
"=",
"get_engine",
"(",
")",
"if",
"engine",
"is",
"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | get_config_env | Returns the environment map that will be used for config checking when variables aren't set. | sdk/python/lib/pulumi/runtime/config.py | def get_config_env() -> Dict[str, Any]:
"""
Returns the environment map that will be used for config checking when variables aren't set.
"""
if 'PULUMI_CONFIG' in os.environ:
env_config = os.environ['PULUMI_CONFIG']
return json.loads(env_config)
return dict() | def get_config_env() -> Dict[str, Any]:
"""
Returns the environment map that will be used for config checking when variables aren't set.
"""
if 'PULUMI_CONFIG' in os.environ:
env_config = os.environ['PULUMI_CONFIG']
return json.loads(env_config)
return dict() | [
"Returns",
"the",
"environment",
"map",
"that",
"will",
"be",
"used",
"for",
"config",
"checking",
"when",
"variables",
"aren",
"t",
"set",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L34-L41 | [
"def",
"get_config_env",
"(",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"'PULUMI_CONFIG'",
"in",
"os",
".",
"environ",
":",
"env_config",
"=",
"os",
".",
"environ",
"[",
"'PULUMI_CONFIG'",
"]",
"return",
"json",
".",
"loads",
"(",
"env... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | get_config_env_key | Returns a scrubbed environment variable key, PULUMI_CONFIG_<k>, that can be used for
setting explicit varaibles. This is unlike PULUMI_CONFIG which is just a JSON-serialized bag. | sdk/python/lib/pulumi/runtime/config.py | def get_config_env_key(k: str) -> str:
"""
Returns a scrubbed environment variable key, PULUMI_CONFIG_<k>, that can be used for
setting explicit varaibles. This is unlike PULUMI_CONFIG which is just a JSON-serialized bag.
"""
env_key = ''
for c in k:
if c == '_' or 'A' <= c <= 'Z' or '0... | def get_config_env_key(k: str) -> str:
"""
Returns a scrubbed environment variable key, PULUMI_CONFIG_<k>, that can be used for
setting explicit varaibles. This is unlike PULUMI_CONFIG which is just a JSON-serialized bag.
"""
env_key = ''
for c in k:
if c == '_' or 'A' <= c <= 'Z' or '0... | [
"Returns",
"a",
"scrubbed",
"environment",
"variable",
"key",
"PULUMI_CONFIG_<k",
">",
"that",
"can",
"be",
"used",
"for",
"setting",
"explicit",
"varaibles",
".",
"This",
"is",
"unlike",
"PULUMI_CONFIG",
"which",
"is",
"just",
"a",
"JSON",
"-",
"serialized",
... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L44-L57 | [
"def",
"get_config_env_key",
"(",
"k",
":",
"str",
")",
"->",
"str",
":",
"env_key",
"=",
"''",
"for",
"c",
"in",
"k",
":",
"if",
"c",
"==",
"'_'",
"or",
"'A'",
"<=",
"c",
"<=",
"'Z'",
"or",
"'0'",
"<=",
"c",
"<=",
"'9'",
":",
"env_key",
"+=",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | get_config | Returns a configuration variable's value or None if it is unset. | sdk/python/lib/pulumi/runtime/config.py | def get_config(k: str) -> Any:
"""
Returns a configuration variable's value or None if it is unset.
"""
# If the config has been set explicitly, use it.
if k in list(CONFIG.keys()):
return CONFIG[k]
# If there is a specific PULUMI_CONFIG_<k> environment variable, use it.
env_key = g... | def get_config(k: str) -> Any:
"""
Returns a configuration variable's value or None if it is unset.
"""
# If the config has been set explicitly, use it.
if k in list(CONFIG.keys()):
return CONFIG[k]
# If there is a specific PULUMI_CONFIG_<k> environment variable, use it.
env_key = g... | [
"Returns",
"a",
"configuration",
"variable",
"s",
"value",
"or",
"None",
"if",
"it",
"is",
"unset",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L60-L78 | [
"def",
"get_config",
"(",
"k",
":",
"str",
")",
"->",
"Any",
":",
"# If the config has been set explicitly, use it.",
"if",
"k",
"in",
"list",
"(",
"CONFIG",
".",
"keys",
"(",
")",
")",
":",
"return",
"CONFIG",
"[",
"k",
"]",
"# If there is a specific PULUMI_C... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | run_in_stack | Run the given function inside of a new stack resource. This ensures that any stack export calls will end
up as output properties on the resulting stack component in the checkpoint file. This is meant for internal
runtime use only and is used by the Python SDK entrypoint program. | sdk/python/lib/pulumi/runtime/stack.py | async def run_in_stack(func: Callable):
"""
Run the given function inside of a new stack resource. This ensures that any stack export calls will end
up as output properties on the resulting stack component in the checkpoint file. This is meant for internal
runtime use only and is used by the Python SD... | async def run_in_stack(func: Callable):
"""
Run the given function inside of a new stack resource. This ensures that any stack export calls will end
up as output properties on the resulting stack component in the checkpoint file. This is meant for internal
runtime use only and is used by the Python SD... | [
"Run",
"the",
"given",
"function",
"inside",
"of",
"a",
"new",
"stack",
"resource",
".",
"This",
"ensures",
"that",
"any",
"stack",
"export",
"calls",
"will",
"end",
"up",
"as",
"output",
"properties",
"on",
"the",
"resulting",
"stack",
"component",
"in",
... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/stack.py#L27-L70 | [
"async",
"def",
"run_in_stack",
"(",
"func",
":",
"Callable",
")",
":",
"try",
":",
"Stack",
"(",
"func",
")",
"# If an exception occurred when doing an RPC, this await will propegate the exception",
"# to the main thread.",
"await",
"RPC_MANAGER",
".",
"unhandled_exeception"... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Stack.output | Export a stack output with a given name and value. | sdk/python/lib/pulumi/runtime/stack.py | def output(self, name: str, value: Any):
"""
Export a stack output with a given name and value.
"""
self.outputs[name] = value | def output(self, name: str, value: Any):
"""
Export a stack output with a given name and value.
"""
self.outputs[name] = value | [
"Export",
"a",
"stack",
"output",
"with",
"a",
"given",
"name",
"and",
"value",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/stack.py#L98-L102 | [
"def",
"output",
"(",
"self",
",",
"name",
":",
"str",
",",
"value",
":",
"Any",
")",
":",
"self",
".",
"outputs",
"[",
"name",
"]",
"=",
"value"
] | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | invoke | invoke dynamically invokes the function, tok, which is offered by a provider plugin. The inputs
can be a bag of computed values (Ts or Awaitable[T]s), and the result is a Awaitable[Any] that
resolves when the invoke finishes. | sdk/python/lib/pulumi/runtime/invoke.py | def invoke(tok: str, props: Inputs, opts: InvokeOptions = None) -> Awaitable[Any]:
"""
invoke dynamically invokes the function, tok, which is offered by a provider plugin. The inputs
can be a bag of computed values (Ts or Awaitable[T]s), and the result is a Awaitable[Any] that
resolves when the invoke ... | def invoke(tok: str, props: Inputs, opts: InvokeOptions = None) -> Awaitable[Any]:
"""
invoke dynamically invokes the function, tok, which is offered by a provider plugin. The inputs
can be a bag of computed values (Ts or Awaitable[T]s), and the result is a Awaitable[Any] that
resolves when the invoke ... | [
"invoke",
"dynamically",
"invokes",
"the",
"function",
"tok",
"which",
"is",
"offered",
"by",
"a",
"provider",
"plugin",
".",
"The",
"inputs",
"can",
"be",
"a",
"bag",
"of",
"computed",
"values",
"(",
"Ts",
"or",
"Awaitable",
"[",
"T",
"]",
"s",
")",
"... | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/invoke.py#L28-L86 | [
"def",
"invoke",
"(",
"tok",
":",
"str",
",",
"props",
":",
"Inputs",
",",
"opts",
":",
"InvokeOptions",
"=",
"None",
")",
"->",
"Awaitable",
"[",
"Any",
"]",
":",
"log",
".",
"debug",
"(",
"f\"Invoking function: tok={tok}\"",
")",
"if",
"opts",
"is",
... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | export | Exports a named stack output.
:param str name: The name to assign to this output.
:param Any value: The value of this output. | sdk/python/lib/pulumi/resource.py | def export(name: str, value: Any):
"""
Exports a named stack output.
:param str name: The name to assign to this output.
:param Any value: The value of this output.
"""
stack = get_root_resource()
if stack is not None:
stack.output(name, value) | def export(name: str, value: Any):
"""
Exports a named stack output.
:param str name: The name to assign to this output.
:param Any value: The value of this output.
"""
stack = get_root_resource()
if stack is not None:
stack.output(name, value) | [
"Exports",
"a",
"named",
"stack",
"output",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/resource.py#L321-L330 | [
"def",
"export",
"(",
"name",
":",
"str",
",",
"value",
":",
"Any",
")",
":",
"stack",
"=",
"get_root_resource",
"(",
")",
"if",
"stack",
"is",
"not",
"None",
":",
"stack",
".",
"output",
"(",
"name",
",",
"value",
")"
] | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Resource.get_provider | Fetches the provider for the given module member, if this resource has been provided a specific
provider for the given module member.
Returns None if no provider was provided.
:param str module_member: The requested module member.
:return: The :class:`ProviderResource` associated with ... | sdk/python/lib/pulumi/resource.py | def get_provider(self, module_member: str) -> Optional['ProviderResource']:
"""
Fetches the provider for the given module member, if this resource has been provided a specific
provider for the given module member.
Returns None if no provider was provided.
:param str module_memb... | def get_provider(self, module_member: str) -> Optional['ProviderResource']:
"""
Fetches the provider for the given module member, if this resource has been provided a specific
provider for the given module member.
Returns None if no provider was provided.
:param str module_memb... | [
"Fetches",
"the",
"provider",
"for",
"the",
"given",
"module",
"member",
"if",
"this",
"resource",
"has",
"been",
"provided",
"a",
"specific",
"provider",
"for",
"the",
"given",
"module",
"member",
"."
] | pulumi/pulumi | python | https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/resource.py#L215-L231 | [
"def",
"get_provider",
"(",
"self",
",",
"module_member",
":",
"str",
")",
"->",
"Optional",
"[",
"'ProviderResource'",
"]",
":",
"components",
"=",
"module_member",
".",
"split",
"(",
"\":\"",
")",
"if",
"len",
"(",
"components",
")",
"!=",
"3",
":",
"r... | 95d51efe6ab9a533838b6d83aa240b5f912e72aa |
train | Engine.add_event_handler | Add an event handler to be executed when the specified event is fired.
Args:
event_name: An event to attach the handler to. Valid events are from :class:`~ignite.engine.Events`
or any `event_name` added by :meth:`~ignite.engine.Engine.register_events`.
handler (callable)... | ignite/engine/engine.py | def add_event_handler(self, event_name, handler, *args, **kwargs):
"""Add an event handler to be executed when the specified event is fired.
Args:
event_name: An event to attach the handler to. Valid events are from :class:`~ignite.engine.Events`
or any `event_name` added by... | def add_event_handler(self, event_name, handler, *args, **kwargs):
"""Add an event handler to be executed when the specified event is fired.
Args:
event_name: An event to attach the handler to. Valid events are from :class:`~ignite.engine.Events`
or any `event_name` added by... | [
"Add",
"an",
"event",
"handler",
"to",
"be",
"executed",
"when",
"the",
"specified",
"event",
"is",
"fired",
"."
] | pytorch/ignite | python | https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L122-L159 | [
"def",
"add_event_handler",
"(",
"self",
",",
"event_name",
",",
"handler",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"event_name",
"not",
"in",
"self",
".",
"_allowed_events",
":",
"self",
".",
"_logger",
".",
"error",
"(",
"\"attempt t... | a96bd07cb58822cfb39fd81765135712f1db41ca |
train | Engine.has_event_handler | Check if the specified event has the specified handler.
Args:
handler (callable): the callable event handler.
event_name: The event the handler attached to. Set this
to ``None`` to search all events. | ignite/engine/engine.py | def has_event_handler(self, handler, event_name=None):
"""Check if the specified event has the specified handler.
Args:
handler (callable): the callable event handler.
event_name: The event the handler attached to. Set this
to ``None`` to search all events.
... | def has_event_handler(self, handler, event_name=None):
"""Check if the specified event has the specified handler.
Args:
handler (callable): the callable event handler.
event_name: The event the handler attached to. Set this
to ``None`` to search all events.
... | [
"Check",
"if",
"the",
"specified",
"event",
"has",
"the",
"specified",
"handler",
"."
] | pytorch/ignite | python | https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L161-L179 | [
"def",
"has_event_handler",
"(",
"self",
",",
"handler",
",",
"event_name",
"=",
"None",
")",
":",
"if",
"event_name",
"is",
"not",
"None",
":",
"if",
"event_name",
"not",
"in",
"self",
".",
"_event_handlers",
":",
"return",
"False",
"events",
"=",
"[",
... | a96bd07cb58822cfb39fd81765135712f1db41ca |
train | Engine.remove_event_handler | Remove event handler `handler` from registered handlers of the engine
Args:
handler (callable): the callable event handler that should be removed
event_name: The event the handler attached to. | ignite/engine/engine.py | def remove_event_handler(self, handler, event_name):
"""Remove event handler `handler` from registered handlers of the engine
Args:
handler (callable): the callable event handler that should be removed
event_name: The event the handler attached to.
"""
if event_... | def remove_event_handler(self, handler, event_name):
"""Remove event handler `handler` from registered handlers of the engine
Args:
handler (callable): the callable event handler that should be removed
event_name: The event the handler attached to.
"""
if event_... | [
"Remove",
"event",
"handler",
"handler",
"from",
"registered",
"handlers",
"of",
"the",
"engine"
] | pytorch/ignite | python | https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L181-L196 | [
"def",
"remove_event_handler",
"(",
"self",
",",
"handler",
",",
"event_name",
")",
":",
"if",
"event_name",
"not",
"in",
"self",
".",
"_event_handlers",
":",
"raise",
"ValueError",
"(",
"\"Input event name '{}' does not exist\"",
".",
"format",
"(",
"event_name",
... | a96bd07cb58822cfb39fd81765135712f1db41ca |
train | Engine.on | Decorator shortcut for add_event_handler.
Args:
event_name: An event to attach the handler to. Valid events are from :class:`~ignite.engine.Events` or
any `event_name` added by :meth:`~ignite.engine.Engine.register_events`.
*args: optional args to be passed to `handler`.... | ignite/engine/engine.py | def on(self, event_name, *args, **kwargs):
"""Decorator shortcut for add_event_handler.
Args:
event_name: An event to attach the handler to. Valid events are from :class:`~ignite.engine.Events` or
any `event_name` added by :meth:`~ignite.engine.Engine.register_events`.
... | def on(self, event_name, *args, **kwargs):
"""Decorator shortcut for add_event_handler.
Args:
event_name: An event to attach the handler to. Valid events are from :class:`~ignite.engine.Events` or
any `event_name` added by :meth:`~ignite.engine.Engine.register_events`.
... | [
"Decorator",
"shortcut",
"for",
"add_event_handler",
"."
] | pytorch/ignite | python | https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L224-L237 | [
"def",
"on",
"(",
"self",
",",
"event_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_event_handler",
"(",
"event_name",
",",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")... | a96bd07cb58822cfb39fd81765135712f1db41ca |
train | Engine._fire_event | Execute all the handlers associated with given event.
This method executes all handlers associated with the event
`event_name`. Optional positional and keyword arguments can be used to
pass arguments to **all** handlers added with this event. These
aguments updates arguments passed usin... | ignite/engine/engine.py | def _fire_event(self, event_name, *event_args, **event_kwargs):
"""Execute all the handlers associated with given event.
This method executes all handlers associated with the event
`event_name`. Optional positional and keyword arguments can be used to
pass arguments to **all** handlers ... | def _fire_event(self, event_name, *event_args, **event_kwargs):
"""Execute all the handlers associated with given event.
This method executes all handlers associated with the event
`event_name`. Optional positional and keyword arguments can be used to
pass arguments to **all** handlers ... | [
"Execute",
"all",
"the",
"handlers",
"associated",
"with",
"given",
"event",
"."
] | pytorch/ignite | python | https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L239-L259 | [
"def",
"_fire_event",
"(",
"self",
",",
"event_name",
",",
"*",
"event_args",
",",
"*",
"*",
"event_kwargs",
")",
":",
"if",
"event_name",
"in",
"self",
".",
"_allowed_events",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"firing handlers for event %s \""... | a96bd07cb58822cfb39fd81765135712f1db41ca |
train | Engine.run | Runs the process_function over the passed data.
Args:
data (Iterable): Collection of batches allowing repeated iteration (e.g., list or `DataLoader`).
max_epochs (int, optional): max epochs to run for (default: 1).
Returns:
State: output state. | ignite/engine/engine.py | def run(self, data, max_epochs=1):
"""Runs the process_function over the passed data.
Args:
data (Iterable): Collection of batches allowing repeated iteration (e.g., list or `DataLoader`).
max_epochs (int, optional): max epochs to run for (default: 1).
Returns:
... | def run(self, data, max_epochs=1):
"""Runs the process_function over the passed data.
Args:
data (Iterable): Collection of batches allowing repeated iteration (e.g., list or `DataLoader`).
max_epochs (int, optional): max epochs to run for (default: 1).
Returns:
... | [
"Runs",
"the",
"process_function",
"over",
"the",
"passed",
"data",
"."
] | pytorch/ignite | python | https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L326-L361 | [
"def",
"run",
"(",
"self",
",",
"data",
",",
"max_epochs",
"=",
"1",
")",
":",
"self",
".",
"state",
"=",
"State",
"(",
"dataloader",
"=",
"data",
",",
"epoch",
"=",
"0",
",",
"max_epochs",
"=",
"max_epochs",
",",
"metrics",
"=",
"{",
"}",
")",
"... | a96bd07cb58822cfb39fd81765135712f1db41ca |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.