repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
yahoo/TensorFlowOnSpark
examples/imagenet/inception/image_processing.py
eval_image
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...
python
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", ")", ":", "with", "tf", ".", "name_scope", "(", "values", "=", "[", "image", ",", "height", ",", "width", "]", ",", "name", "=", "scope", ",", "default_name", ...
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.
[ "Prepare", "one", "image", "for", "evaluation", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L279-L301
train
Prepare one image for evaluation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/image_processing.py
image_preprocessing
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...
python
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", ")", ":", "if", "bbox", "is", "None", ":", "raise", "ValueError", "(", "'Please supply a bounding box.'", ")", "image", "=", "decode_jpeg", "(", "image_bu...
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 ...
[ "Decode", "and", "preprocess", "one", "image", "for", "evaluation", "or", "training", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L304-L336
train
Decode and preprocess one image for evaluation or training.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/image_processing.py
parse_example_proto
def parse_example_proto(example_serialized): """Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields: image/height: 4...
python
def parse_example_proto(example_serialized): """Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields: image/height: 4...
[ "def", "parse_example_proto", "(", "example_serialized", ")", ":", "# Dense features in Example proto.", "feature_map", "=", "{", "'image/encoded'", ":", "tf", ".", "FixedLenFeature", "(", "[", "]", ",", "dtype", "=", "tf", ".", "string", ",", "default_value", "="...
Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields: image/height: 462 image/width: 581 image/colorspace: 'RGB...
[ "Parses", "an", "Example", "proto", "containing", "a", "training", "example", "of", "an", "image", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L339-L407
train
Parses an example proto containing a training example of an image.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/image_processing.py
batch_inputs
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 ...
python
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", ")", ":", "with", "tf", ".", "name_scope", "(", "'batch_processing'", ")", ":", "data_files", "=", "dataset", "....
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...
[ "Contruct", "batches", "of", "training", "or", "evaluation", "examples", "from", "the", "image", "dataset", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/image_processing.py#L410-L513
train
Contruct batches of training or evaluation examples from the image dataset.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
scripts/spark_ec2.py
setup_external_libs
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...
python
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", ")", ":", "PYPI_URL_PREFIX", "=", "\"https://pypi.python.org/packages/source\"", "SPARK_EC2_LIB_DIR", "=", "os", ".", "path", ".", "join", "(", "SPARK_EC2_DIR", ",", "\"lib\"", ")", "if", "not", "os", ".", "path", ".", ...
Download external libraries from PyPI to SPARK_EC2_DIR/lib/ and prepend them to our PATH.
[ "Download", "external", "libraries", "from", "PyPI", "to", "SPARK_EC2_DIR", "/", "lib", "/", "and", "prepend", "them", "to", "our", "PATH", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L111-L151
train
Setup the external libraries that spark - ec2 needs from PyPI to our PATH.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
scripts/spark_ec2.py
get_existing_cluster
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...
python
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", ")", ":", "print", "(", "\"Searching for existing cluster {c} in region {r}...\"", ".", "format", "(", "c", "=", "cluster_name", ",", "r", "=", "opts", ...
Get the EC2 instances in an existing cluster if available. Returns a tuple of lists of EC2 instance objects for the masters and slaves.
[ "Get", "the", "EC2", "instances", "in", "an", "existing", "cluster", "if", "available", ".", "Returns", "a", "tuple", "of", "lists", "of", "EC2", "instance", "objects", "for", "the", "masters", "and", "slaves", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L757-L792
train
Get the EC2 instances in an existing cluster if available.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
scripts/spark_ec2.py
is_ssh_available
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...
python
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", ")", ":", "s", "=", "subprocess", ".", "Popen", "(", "ssh_command", "(", "opts", ")", "+", "[", "'-t'", ",", "'-t'", ",", "'-o'", ",", "'ConnectTimeout=3'", ",", ...
Check if SSH is available on a host.
[ "Check", "if", "SSH", "is", "available", "on", "a", "host", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L882-L907
train
Check if SSH is available on a host.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
scripts/spark_ec2.py
is_cluster_ssh_available
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: ...
python
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", ")", ":", "for", "i", "in", "cluster_instances", ":", "dns_name", "=", "get_dns_name", "(", "i", ",", "opts", ".", "private_ips", ")", "if", "not", "is_ssh_available", "(", "host", "=", ...
Check if SSH is available on all the instances in a cluster.
[ "Check", "if", "SSH", "is", "available", "on", "all", "the", "instances", "in", "a", "cluster", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L910-L919
train
Check if SSH is available on all the instances in a cluster.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
scripts/spark_ec2.py
wait_for_cluster_state
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 ...
python
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", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\"Waiting for cluster to enter '{s}' state.\"", ".", "format", "(", "s", "=", "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...
[ "Wait", "for", "all", "the", "instances", "in", "the", "cluster", "to", "reach", "a", "designated", "state", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/scripts/spark_ec2.py#L922-L973
train
Wait for all the instances in the cluster to reach a specified state.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/imagenet_data.py
ImagenetData.download_message
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...
python
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", ")", ":", "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 ...
Instruction to download and extract the tarball from Flowers website.
[ "Instruction", "to", "download", "and", "extract", "the", "tarball", "from", "Flowers", "website", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/imagenet_data.py#L44-L59
train
Instruction to download and extract the tarball from Flowers website.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/wide_deep/wide_deep_run_loop.py
define_wide_deep_flags
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, ...
python
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", "(", ")", ":", "flags_core", ".", "define_base", "(", ")", "flags_core", ".", "define_benchmark", "(", ")", "flags_core", ".", "define_performance", "(", "num_parallel_calls", "=", "False", ",", "inter_op", "=", "True", ",", "int...
Add supervised learning flags, as well as wide-deep model type.
[ "Add", "supervised", "learning", "flags", "as", "well", "as", "wide", "-", "deep", "model", "type", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/wide_deep_run_loop.py#L37-L54
train
Add supervised learning flags as well as wide - deep model type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/wide_deep/wide_deep_run_loop.py
export_model
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...
python
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", ")", ":", "wide_columns", ",", "deep_columns", "=", "model_column_fn", "(", ")", "if", "model_type", "==", "'wide'", ":", "columns", "=", "wide_columns", "elif", ...
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.
[ "Export", "to", "SavedModel", "format", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/wide_deep_run_loop.py#L57-L77
train
Exports the given Estimator object to SavedModel format.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/wide_deep/wide_deep_run_loop.py
run_loop
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, ...
python
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", ")", ":", "model_helpers", ".", "apply_clean", "(", "flags", ...
Define training loop.
[ "Define", "training", "loop", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/wide_deep_run_loop.py#L80-L131
train
Define training loop.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/inception_train.py
_tower_loss
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...
python
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", ")", ":", "# 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 ...
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...
[ "Calculate", "the", "total", "loss", "on", "a", "single", "tower", "running", "the", "ImageNet", "model", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_train.py#L82-L140
train
Calculate the total loss on a single tower running the ImageNet model.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/inception_train.py
train
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', [], ...
python
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", ")", ":", "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...
Train on dataset for a number of steps.
[ "Train", "on", "dataset", "for", "a", "number", "of", "steps", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/inception_train.py#L181-L357
train
Train on dataset for a number of steps.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
batch_norm
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...
python
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...
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...
[ "Adds", "a", "Batch", "Normalization", "layer", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L43-L132
train
Adds a Batch Normalization layer to the graph.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
_two_element_tuple
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 ...
python
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", ")", ":", "if", "isinstance", "(", "int_or_tuple", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "len", "(", "int_or_tuple", ")", "!=", "2", ":", "raise", "ValueError", "(", "'Must be a list with 2 ele...
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_...
[ "Converts", "int_or_tuple", "to", "height", "width", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L135-L163
train
Converts a single integer or tuple to height width.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
conv2d
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, ...
python
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", ",", "weigh...
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: ...
[ "Adds", "a", "2D", "convolution", "followed", "by", "an", "optional", "batch_norm", "layer", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L167-L246
train
Adds a convolution followed by a batch_norm layer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
fc
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...
python
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", "=", ...
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...
[ "Adds", "a", "fully", "connected", "layer", "followed", "by", "an", "optional", "batch_norm", "layer", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L250-L317
train
Adds a fully connected layer followed by a batch_norm layer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
one_hot_encoding
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, '...
python
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", ")", ":", "with", "tf", ".", "name_scope", "(", "scope", ",", "'OneHotEncoding'", ",", "[", "labels", "]", ")", ":", "batch_size", "=", "labels", ".", "get_shape", "...
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.
[ "Transform", "numeric", "labels", "into", "onehot_labels", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L320-L338
train
Transform numeric labels into one hot encoding.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
max_pool
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...
python
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", ")", ":", "with", "tf", ".", "name_scope", "(", "scope", ",", "'MaxPool'", ",", "[", "inputs", "]", ")", ":", ...
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...
[ "Adds", "a", "Max", "Pooling", "layer", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L342-L370
train
Adds a Max Pooling layer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
dropout
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 ...
python
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", ")", ":", "if", "is_training", "and", "keep_prob", ">", "0", ":", "with", "tf", ".", "name_scope", "(", "scope", ",", "'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:...
[ "Returns", "a", "dropout", "layer", "applied", "to", "the", "input", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L404-L421
train
Returns a dropout layer applied to the input tensor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
flatten
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...
python
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", ")", ":", "if", "len", "(", "inputs", ".", "get_shape", "(", ")", ")", "<", "2", ":", "raise", "ValueError", "(", "'Inputs must be have a least 2 dimensions'", ")", "dims", "=", "inputs", ".", "...
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 ...
[ "Flattens", "the", "input", "while", "maintaining", "the", "batch_size", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L424-L443
train
Flattens the input while maintaining the batch_size.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yahoo/TensorFlowOnSpark
examples/imagenet/inception/slim/ops.py
repeat_op
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 ...
python
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", ")", ":", "scope", "=", "kwargs", ".", "pop", "(", "'scope'", ",", "None", ")", "with", "tf", ".", "variable_scope", "(", "scope", ",", "'R...
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...
[ "Build", "a", "sequential", "Tower", "starting", "from", "inputs", "by", "using", "an", "op", "repeatedly", "." ]
5e4b6c185ab722fd0104ede0377e1149ea8d6f7c
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/slim/ops.py#L446-L473
train
Builds a sequential Tower starting from inputs by using an op repeatedly.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc_manager.py
RPCManager.do_rpc
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...
python
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", "]", "]", ":", "async", "def", "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...
[ "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"...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc_manager.py#L49-L87
train
Wraps a given RPC function by producing an asyncio function that returns the result of the RPC.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/resource.py
register_resource
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....
python
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'", "]", ")", ":", "log", ".", "...
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...
[ "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", ...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/resource.py#L123-L234
train
Register a new resource object with the given type t and name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/settings.py
configure
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 ...
python
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", ")", ":", "if", "not", "settings", "or", "not", "isinstance", "(", "settings", ",", "Settings", ")", ":", "raise", "TypeError", "(", "'Settings is expected to be non-None and of type Settings'", ")", "global", ...
Configure sets the current ambient settings bag to the one given.
[ "Configure", "sets", "the", "current", "ambient", "settings", "bag", "to", "the", "one", "given", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L70-L77
train
Configure the current ambient settings bag to the one given.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/settings.py
get_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
python
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", "]", ":", "project", "=", "SETTINGS", ".", "project", "if", "not", "project", ":", "require_test_mode_enabled", "(", ")", "raise", "RunError", "(", "'Missing project name; for test mode, please set PULUMI...
Returns the current project name.
[ "Returns", "the", "current", "project", "name", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L107-L115
train
Returns the current project name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/settings.py
get_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
python
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", "]", ":", "stack", "=", "SETTINGS", ".", "stack", "if", "not", "stack", ":", "require_test_mode_enabled", "(", ")", "raise", "RunError", "(", "'Missing stack name; for test mode, please set PULUMI_NODEJS_ST...
Returns the current stack name.
[ "Returns", "the", "current", "stack", "name", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L125-L133
train
Returns the current stack name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/settings.py
get_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
python
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", "]", ":", "monitor", "=", "SETTINGS", ".", "monitor", "if", "not", "monitor", ":", "require_test_mode_enabled", "(", ")", "return", "monitor" ]
Returns the current resource monitoring service client for RPC communications.
[ "Returns", "the", "current", "resource", "monitoring", "service", "client", "for", "RPC", "communications", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L143-L150
train
Returns the current resource monitoring service client for RPC communications.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc.py
serialize_properties
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...
python
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", ...
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.
[ "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",...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L46-L70
train
Serializes the properties of the input bag into a Protobuf structure.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc.py
serialize_property
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...
python
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", ")", "->", "...
Serializes a single Input into a form suitable for remoting to the engine, awaiting any futures required to do so.
[ "Serializes", "a", "single", "Input", "into", "a", "form", "suitable", "for", "remoting", "to", "the", "engine", "awaiting", "any", "futures", "required", "to", "do", "so", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L74-L159
train
Serializes a single Input into a form suitable for remoting to the engine awaiting any futures required to do so.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc.py
deserialize_properties
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/...
python
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", ":", "# 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", "#"...
Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal Python types.
[ "Deserializes", "a", "protobuf", "struct_pb2", ".", "Struct", "into", "a", "Python", "dictionary", "containing", "normal", "Python", "types", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L162-L203
train
Deserializes a protobuf struct_pb2. Struct into a Python dictionary containing normal structures.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc.py
deserialize_property
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...
python
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", ":", "if", "value", "==", "UNKNOWN", ":", "return", "None", "# ListValues are projected to lists", "if", "isinstance", "(", "value", ",", "struct_pb2", ".", "ListValue", ")", ":", "retu...
Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic Python values.
[ "Deserializes", "a", "single", "protobuf", "value", "(", "either", "Struct", "or", "ListValue", ")", "into", "idiomatic", "Python", "values", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L206-L223
train
Deserializes a single protobuf value into idiomatic Python values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc.py
translate_output_properties
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...
python
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", ":", "if", "isinstance", "(", "output", ",", "dict", ")", ":", "return", "{", "res", ".", "translate_output_property", "(", "k", ")", ":", "...
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...
[ "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", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L274-L292
train
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.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/rpc.py
resolve_outputs_due_to_exception
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: ...
python
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", ")", ":", "for", "key", ",", "resolve", "in", "resolvers", ".", "items", "(", ")", ":", "log", ".", "debug", "(", ...
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.
[ "Resolves", "all", "outputs", "with", "resolvers", "exceptionally", "using", "the", "given", "exception", "as", "the", "reason", "why", "the", "resolver", "has", "failed", "to", "resolve", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/rpc.py#L363-L373
train
Resolves all outputs with resolvers exceptionally using the given exception as the reason why the resolver has failed to resolve.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.get
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] ""...
python
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", "]", ":", "return", "get_config", "(", "self", ".", "full_key", "(", "key", ")", ")" ]
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", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L50-L58
train
Returns an optional configuration value by its key or None if it doesn t exist.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.get_bool
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. ...
python
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", "]", ":", "v", "=", "self", ".", "get", "(", "key", ")", "if", "v", "is", "None", ":", "return", "None", "if", "v", "in", "[", "'true'", ",", "'True'", ...
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...
[ "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...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L60-L77
train
Returns an optional configuration value as a bool by its key or None if it doesn t exist.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.get_int
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...
python
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", "]", ":", "v", "=", "self", ".", "get", "(", "key", ")", "if", "v", "is", "None", ":", "return", "None", "try", ":", "return", "int", "(", "v", ")", "ex...
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. ...
[ "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...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L79-L95
train
Returns an optional configuration value as an int by its key.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.get_float
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. ...
python
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", "]", ":", "v", "=", "self", ".", "get", "(", "key", ")", "if", "v", "is", "None", ":", "return", "None", "try", ":", "return", "float", "(", "v", ")",...
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...
[ "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...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L97-L113
train
Returns an optional configuration value as a float by its key.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.require
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...
python
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", ":", "v", "=", "self", ".", "get", "(", "key", ")", "if", "v", "is", "None", ":", "raise", "ConfigMissingError", "(", "self", ".", "full_key", "(", "key", ")", ")", "return"...
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.
[ "Returns", "a", "configuration", "value", "by", "its", "given", "key", ".", "If", "it", "doesn", "t", "exist", "an", "error", "is", "thrown", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L115-L127
train
Returns a configuration value by its given key.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.require_bool
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...
python
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", ":", "v", "=", "self", ".", "get_bool", "(", "key", ")", "if", "v", "is", "None", ":", "raise", "ConfigMissingError", "(", "self", ".", "full_key", "(", "key", ")", ")",...
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:...
[ "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", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L129-L143
train
Returns a configuration value as a legal bool by its given key.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.require_int
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...
python
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", ":", "v", "=", "self", ".", "get_int", "(", "key", ")", "if", "v", "is", "None", ":", "raise", "ConfigMissingError", "(", "self", ".", "full_key", "(", "key", ")", ")", ...
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...
[ "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", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L145-L159
train
Returns a configuration value as an int by its given key.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.require_float
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...
python
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", ":", "v", "=", "self", ".", "get_float", "(", "key", ")", "if", "v", "is", "None", ":", "raise", "ConfigMissingError", "(", "self", ".", "full_key", "(", "key", ")", "...
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...
[ "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", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L161-L175
train
Returns a configuration value as a float by its given key.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
asset
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
python
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", ":", "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.
[ "Decorator", "to", "annotate", "the", "Asset", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "Asset", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L66-L74
train
Decorator to annotate the Asset class. Registers the decorated class as the Asset known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
file_asset
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...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_file_asset_resource_type", "_file_asset_resource_type", "=", "class_obj", "return",...
Decorator to annotate the FileAsset class. Registers the decorated class as the FileAsset known type.
[ "Decorator", "to", "annotate", "the", "FileAsset", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "FileAsset", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L77-L85
train
Decorator to annotate the FileAsset class. Registers the decorated class as the FileAsset known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
string_asset
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...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_string_asset_resource_type", "_string_asset_resource_type", "=", "class_obj", "re...
Decorator to annotate the StringAsset class. Registers the decorated class as the StringAsset known type.
[ "Decorator", "to", "annotate", "the", "StringAsset", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "StringAsset", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L88-L96
train
Decorator to annotate the StringAsset class. Registers the decorated class as the StringAsset known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
remote_asset
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...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_remote_asset_resource_type", "_remote_asset_resource_type", "=", "class_obj", "re...
Decorator to annotate the RemoteAsset class. Registers the decorated class as the RemoteAsset known type.
[ "Decorator", "to", "annotate", "the", "RemoteAsset", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "RemoteAsset", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L99-L107
train
Decorator to annotate the RemoteAsset class. Registers the decorated class as the RemoteAsset known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
archive
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
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_archive_resource_type", "_archive_resource_type", "=", "class_obj", "return", "class...
Decorator to annotate the Archive class. Registers the decorated class as the Archive known type.
[ "Decorator", "to", "annotate", "the", "Archive", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "Archive", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L110-L118
train
Decorator to annotate the Archive class. Registers the decorated class as the Archive known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
asset_archive
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...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_asset_archive_resource_type", "_asset_archive_resource_type", "=", "class_obj", ...
Decorator to annotate the AssetArchive class. Registers the decorated class as the AssetArchive known type.
[ "Decorator", "to", "annotate", "the", "AssetArchive", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "AssetArchive", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L121-L129
train
Decorator to annotate the AssetArchive class. Registers the decorated class as the AssetArchive known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
file_archive
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...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_file_archive_resource_type", "_file_archive_resource_type", "=", "class_obj", "re...
Decorator to annotate the FileArchive class. Registers the decorated class as the FileArchive known type.
[ "Decorator", "to", "annotate", "the", "FileArchive", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "FileArchive", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L132-L140
train
Decorator to annotate the FileArchive class. Registers the decorated class as the FileArchive known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
remote_archive
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...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_remote_archive_resource_type", "_remote_archive_resource_type", "=", "class_obj",...
Decorator to annotate the RemoteArchive class. Registers the decorated class as the RemoteArchive known type.
[ "Decorator", "to", "annotate", "the", "RemoteArchive", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "RemoteArchive", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L143-L151
train
Decorator to annotate the RemoteArchive class. Registers the decorated class as the RemoteArchive known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/known_types.py
custom_resource
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 ...
python
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", ":", "assert", "isinstance", "(", "class_obj", ",", "type", ")", ",", "\"class_obj is not a Class\"", "global", "_custom_resource_type", "_custom_resource_type", "=", "class_obj", "return", ...
Decorator to annotate the CustomResource class. Registers the decorated class as the CustomResource known type.
[ "Decorator", "to", "annotate", "the", "CustomResource", "class", ".", "Registers", "the", "decorated", "class", "as", "the", "CustomResource", "known", "type", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/known_types.py#L154-L162
train
Decorator to annotate the CustomResource class. Registers the decorated class as the CustomResource known type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/log.py
debug
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...
python
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", ":", "engine", "=", "get_engine", "(", ")", "if", "en...
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...
[ "Logs", "a", "message", "to", "the", "Pulumi", "CLI", "s", "debug", "channel", "associating", "it", "with", "a", "resource", "and", "stream_id", "if", "provided", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L29-L42
train
Logs a message to the Pulumi CLI s debug channel associating it with a resource and stream_id.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/log.py
info
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...
python
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", ":", "engine", "=", "get_engine", "(", ")", "if", "eng...
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...
[ "Logs", "a", "message", "to", "the", "Pulumi", "CLI", "s", "info", "channel", "associating", "it", "with", "a", "resource", "and", "stream_id", "if", "provided", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L45-L58
train
Logs a message to the Pulumi CLI s info channel associating it with a resource and stream_id.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/log.py
warn
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...
python
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", ":", "engine", "=", "get_engine", "(", ")", "if", "eng...
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...
[ "Logs", "a", "message", "to", "the", "Pulumi", "CLI", "s", "warning", "channel", "associating", "it", "with", "a", "resource", "and", "stream_id", "if", "provided", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L61-L74
train
Logs a message to the Pulumi CLI s warning channel associating it with a resource and stream_id.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/log.py
error
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 ...
python
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", ")", ":", "engine", "=", "get_engine", "(", ")", "if", "engine", "is", "...
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...
[ "Logs", "a", "message", "to", "the", "Pulumi", "CLI", "s", "error", "channel", "associating", "it", "with", "a", "resource", "and", "stream_id", "if", "provided", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/log.py#L77-L90
train
Logs a message to the Pulumi CLI s error channel.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/config.py
get_config_env
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()
python
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", "]", ":", "if", "'PULUMI_CONFIG'", "in", "os", ".", "environ", ":", "env_config", "=", "os", ".", "environ", "[", "'PULUMI_CONFIG'", "]", "return", "json", ".", "loads", "(", "env...
Returns the environment map that will be used for config checking when variables aren't set.
[ "Returns", "the", "environment", "map", "that", "will", "be", "used", "for", "config", "checking", "when", "variables", "aren", "t", "set", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L34-L41
train
Returns the environment map that will be used for config checking when variables aren t set.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/config.py
get_config_env_key
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...
python
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", ":", "env_key", "=", "''", "for", "c", "in", "k", ":", "if", "c", "==", "'_'", "or", "'A'", "<=", "c", "<=", "'Z'", "or", "'0'", "<=", "c", "<=", "'9'", ":", "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.
[ "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", ...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L44-L57
train
Returns a scrubbed environment variable key PULUMI_CONFIG_<k > that can be used for the explicit varaibles.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/config.py
get_config
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...
python
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", ":", "# 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...
Returns a configuration variable's value or None if it is unset.
[ "Returns", "a", "configuration", "variable", "s", "value", "or", "None", "if", "it", "is", "unset", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L60-L78
train
Returns a configuration variable s value or None if it is unset.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/stack.py
run_in_stack
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...
python
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", ")", ":", "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"...
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.
[ "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", ...
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/stack.py#L27-L70
train
Run the given function inside of a new stack resource.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/runtime/stack.py
Stack.output
def output(self, name: str, value: Any): """ Export a stack output with a given name and value. """ self.outputs[name] = value
python
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", ")", ":", "self", ".", "outputs", "[", "name", "]", "=", "value" ]
Export a stack output with a given name and value.
[ "Export", "a", "stack", "output", "with", "a", "given", "name", "and", "value", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/stack.py#L98-L102
train
Exports a stack output with a given name and value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/resource.py
export
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)
python
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", ")", ":", "stack", "=", "get_root_resource", "(", ")", "if", "stack", "is", "not", "None", ":", "stack", ".", "output", "(", "name", ",", "value", ")" ]
Exports a named stack output. :param str name: The name to assign to this output. :param Any value: The value of this output.
[ "Exports", "a", "named", "stack", "output", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/resource.py#L321-L330
train
Exports a named stack output.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pulumi/pulumi
sdk/python/lib/pulumi/resource.py
Resource.get_provider
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...
python
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'", "]", ":", "components", "=", "module_member", ".", "split", "(", "\":\"", ")", "if", "len", "(", "components", ")", "!=", "3", ":", "r...
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 ...
[ "Fetches", "the", "provider", "for", "the", "given", "module", "member", "if", "this", "resource", "has", "been", "provided", "a", "specific", "provider", "for", "the", "given", "module", "member", "." ]
95d51efe6ab9a533838b6d83aa240b5f912e72aa
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/resource.py#L215-L231
train
Retrieves the provider for the given module member.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/engine.py
Engine.add_event_handler
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...
python
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", ")", ":", "if", "event_name", "not", "in", "self", ".", "_allowed_events", ":", "self", ".", "_logger", ".", "error", "(", "\"attempt t...
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)...
[ "Add", "an", "event", "handler", "to", "be", "executed", "when", "the", "specified", "event", "is", "fired", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L122-L159
train
Add an event handler to be executed when the specified event is fired.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/engine.py
Engine.has_event_handler
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. ...
python
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", ")", ":", "if", "event_name", "is", "not", "None", ":", "if", "event_name", "not", "in", "self", ".", "_event_handlers", ":", "return", "False", "events", "=", "[", ...
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", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L161-L179
train
Checks if the specified event has the specified handler.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/engine.py
Engine.remove_event_handler
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_...
python
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", ")", ":", "if", "event_name", "not", "in", "self", ".", "_event_handlers", ":", "raise", "ValueError", "(", "\"Input event name '{}' does not exist\"", ".", "format", "(", "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.
[ "Remove", "event", "handler", "handler", "from", "registered", "handlers", "of", "the", "engine" ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L181-L196
train
Removes the given event handler from the list of event handlers that are attached to the given event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/engine.py
Engine.on
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`. ...
python
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", ")", ":", "def", "decorator", "(", "f", ")", ":", "self", ".", "add_event_handler", "(", "event_name", ",", "f", ",", "*", "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`. *args: optional args to be passed to `handler`....
[ "Decorator", "shortcut", "for", "add_event_handler", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L224-L237
train
Decorator for adding an event handler to the internal event store.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/engine.py
Engine._fire_event
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 ...
python
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", ")", ":", "if", "event_name", "in", "self", ".", "_allowed_events", ":", "self", ".", "_logger", ".", "debug", "(", "\"firing handlers for event %s \""...
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...
[ "Execute", "all", "the", "handlers", "associated", "with", "given", "event", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L239-L259
train
Execute all the handlers associated with the event_name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/engine.py
Engine.run
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: ...
python
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", ")", ":", "self", ".", "state", "=", "State", "(", "dataloader", "=", "data", ",", "epoch", "=", "0", ",", "max_epochs", "=", "max_epochs", ",", "metrics", "=", "{", "}", ")", "...
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.
[ "Runs", "the", "process_function", "over", "the", "passed", "data", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/engine.py#L326-L361
train
Runs the process_function over the passed data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/metrics/confusion_matrix.py
IoU
def IoU(cm, ignore_index=None): """Calculates Intersection over Union Args: cm (ConfusionMatrix): instance of confusion matrix metric ignore_index (int, optional): index to ignore, e.g. background index Returns: MetricsLambda Examples: .. code-block:: python trai...
python
def IoU(cm, ignore_index=None): """Calculates Intersection over Union Args: cm (ConfusionMatrix): instance of confusion matrix metric ignore_index (int, optional): index to ignore, e.g. background index Returns: MetricsLambda Examples: .. code-block:: python trai...
[ "def", "IoU", "(", "cm", ",", "ignore_index", "=", "None", ")", ":", "if", "not", "isinstance", "(", "cm", ",", "ConfusionMatrix", ")", ":", "raise", "TypeError", "(", "\"Argument cm should be instance of ConfusionMatrix, but given {}\"", ".", "format", "(", "type...
Calculates Intersection over Union Args: cm (ConfusionMatrix): instance of confusion matrix metric ignore_index (int, optional): index to ignore, e.g. background index Returns: MetricsLambda Examples: .. code-block:: python train_evaluator = ... cm = Confusi...
[ "Calculates", "Intersection", "over", "Union" ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/metrics/confusion_matrix.py#L105-L150
train
Calculates Intersection over Union containing IoU.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/metrics/confusion_matrix.py
cmAccuracy
def cmAccuracy(cm): """ Calculates accuracy using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric Returns: MetricsLambda """ # Increase floating point precision cm = cm.type(torch.float64) return cm.diag()....
python
def cmAccuracy(cm): """ Calculates accuracy using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric Returns: MetricsLambda """ # Increase floating point precision cm = cm.type(torch.float64) return cm.diag()....
[ "def", "cmAccuracy", "(", "cm", ")", ":", "# Increase floating point precision", "cm", "=", "cm", ".", "type", "(", "torch", ".", "float64", ")", "return", "cm", ".", "diag", "(", ")", ".", "sum", "(", ")", "/", "(", "cm", ".", "sum", "(", ")", "+"...
Calculates accuracy using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric Returns: MetricsLambda
[ "Calculates", "accuracy", "using", ":", "class", ":", "~ignite", ".", "metrics", ".", "ConfusionMatrix", "metric", ".", "Args", ":", "cm", "(", "ConfusionMatrix", ")", ":", "instance", "of", "confusion", "matrix", "metric" ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/metrics/confusion_matrix.py#L180-L191
train
Calculates the accuracy using a confusion matrix metric.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/metrics/confusion_matrix.py
cmPrecision
def cmPrecision(cm, average=True): """ Calculates precision using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric average (bool, optional): if True metric value is averaged over all classes Returns: MetricsLambda ...
python
def cmPrecision(cm, average=True): """ Calculates precision using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric average (bool, optional): if True metric value is averaged over all classes Returns: MetricsLambda ...
[ "def", "cmPrecision", "(", "cm", ",", "average", "=", "True", ")", ":", "# Increase floating point precision", "cm", "=", "cm", ".", "type", "(", "torch", ".", "float64", ")", "precision", "=", "cm", ".", "diag", "(", ")", "/", "(", "cm", ".", "sum", ...
Calculates precision using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric average (bool, optional): if True metric value is averaged over all classes Returns: MetricsLambda
[ "Calculates", "precision", "using", ":", "class", ":", "~ignite", ".", "metrics", ".", "ConfusionMatrix", "metric", ".", "Args", ":", "cm", "(", "ConfusionMatrix", ")", ":", "instance", "of", "confusion", "matrix", "metric", "average", "(", "bool", "optional",...
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/metrics/confusion_matrix.py#L194-L209
train
Calculates the precision of a confusion matrix using a floating point precision.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/metrics/confusion_matrix.py
cmRecall
def cmRecall(cm, average=True): """ Calculates recall using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric average (bool, optional): if True metric value is averaged over all classes Returns: MetricsLambda """ ...
python
def cmRecall(cm, average=True): """ Calculates recall using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric average (bool, optional): if True metric value is averaged over all classes Returns: MetricsLambda """ ...
[ "def", "cmRecall", "(", "cm", ",", "average", "=", "True", ")", ":", "# Increase floating point precision", "cm", "=", "cm", ".", "type", "(", "torch", ".", "float64", ")", "recall", "=", "cm", ".", "diag", "(", ")", "/", "(", "cm", ".", "sum", "(", ...
Calculates recall using :class:`~ignite.metrics.ConfusionMatrix` metric. Args: cm (ConfusionMatrix): instance of confusion matrix metric average (bool, optional): if True metric value is averaged over all classes Returns: MetricsLambda
[ "Calculates", "recall", "using", ":", "class", ":", "~ignite", ".", "metrics", ".", "ConfusionMatrix", "metric", ".", "Args", ":", "cm", "(", "ConfusionMatrix", ")", ":", "instance", "of", "confusion", "matrix", "metric", "average", "(", "bool", "optional", ...
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/metrics/confusion_matrix.py#L212-L227
train
Calculates recall using confusion matrix metric.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/utils.py
convert_tensor
def convert_tensor(input_, device=None, non_blocking=False): """Move tensors to relevant device.""" def _func(tensor): return tensor.to(device=device, non_blocking=non_blocking) if device else tensor return apply_to_tensor(input_, _func)
python
def convert_tensor(input_, device=None, non_blocking=False): """Move tensors to relevant device.""" def _func(tensor): return tensor.to(device=device, non_blocking=non_blocking) if device else tensor return apply_to_tensor(input_, _func)
[ "def", "convert_tensor", "(", "input_", ",", "device", "=", "None", ",", "non_blocking", "=", "False", ")", ":", "def", "_func", "(", "tensor", ")", ":", "return", "tensor", ".", "to", "(", "device", "=", "device", ",", "non_blocking", "=", "non_blocking...
Move tensors to relevant device.
[ "Move", "tensors", "to", "relevant", "device", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/utils.py#L14-L19
train
Move tensors to relevant device.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/utils.py
apply_to_type
def apply_to_type(input_, input_type, func): """Apply a function on a object of `input_type` or mapping, or sequence of objects of `input_type`. """ if isinstance(input_, input_type): return func(input_) elif isinstance(input_, string_classes): return input_ elif isinstance(input_, c...
python
def apply_to_type(input_, input_type, func): """Apply a function on a object of `input_type` or mapping, or sequence of objects of `input_type`. """ if isinstance(input_, input_type): return func(input_) elif isinstance(input_, string_classes): return input_ elif isinstance(input_, c...
[ "def", "apply_to_type", "(", "input_", ",", "input_type", ",", "func", ")", ":", "if", "isinstance", "(", "input_", ",", "input_type", ")", ":", "return", "func", "(", "input_", ")", "elif", "isinstance", "(", "input_", ",", "string_classes", ")", ":", "...
Apply a function on a object of `input_type` or mapping, or sequence of objects of `input_type`.
[ "Apply", "a", "function", "on", "a", "object", "of", "input_type", "or", "mapping", "or", "sequence", "of", "objects", "of", "input_type", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/utils.py#L28-L41
train
Apply a function on a object of input_type or mapping or sequence of objects of input_type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/utils.py
to_onehot
def to_onehot(indices, num_classes): """Convert a tensor of indices of any shape `(N, ...)` to a tensor of one-hot indicators of shape `(N, num_classes, ...)`. """ onehot = torch.zeros(indices.shape[0], num_classes, *indices.shape[1:], device=indices.device) return onehot.scatter_(1, indices.unsquee...
python
def to_onehot(indices, num_classes): """Convert a tensor of indices of any shape `(N, ...)` to a tensor of one-hot indicators of shape `(N, num_classes, ...)`. """ onehot = torch.zeros(indices.shape[0], num_classes, *indices.shape[1:], device=indices.device) return onehot.scatter_(1, indices.unsquee...
[ "def", "to_onehot", "(", "indices", ",", "num_classes", ")", ":", "onehot", "=", "torch", ".", "zeros", "(", "indices", ".", "shape", "[", "0", "]", ",", "num_classes", ",", "*", "indices", ".", "shape", "[", "1", ":", "]", ",", "device", "=", "ind...
Convert a tensor of indices of any shape `(N, ...)` to a tensor of one-hot indicators of shape `(N, num_classes, ...)`.
[ "Convert", "a", "tensor", "of", "indices", "of", "any", "shape", "(", "N", "...", ")", "to", "a", "tensor", "of", "one", "-", "hot", "indicators", "of", "shape", "(", "N", "num_classes", "...", ")", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/utils.py#L44-L49
train
Convert a tensor of indices of any shape ( N num_classes... ) to a tensor of one - hot indicators of shape num_classes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/tqdm_logger.py
ProgressBar.attach
def attach(self, engine, metric_names=None, output_transform=None, event_name=Events.ITERATION_COMPLETED, closing_event_name=Events.EPOCH_COMPLETED): """ Attaches the progress bar to an engine object. Args: engine (Engine): engine object. me...
python
def attach(self, engine, metric_names=None, output_transform=None, event_name=Events.ITERATION_COMPLETED, closing_event_name=Events.EPOCH_COMPLETED): """ Attaches the progress bar to an engine object. Args: engine (Engine): engine object. me...
[ "def", "attach", "(", "self", ",", "engine", ",", "metric_names", "=", "None", ",", "output_transform", "=", "None", ",", "event_name", "=", "Events", ".", "ITERATION_COMPLETED", ",", "closing_event_name", "=", "Events", ".", "EPOCH_COMPLETED", ")", ":", "desc...
Attaches the progress bar to an engine object. Args: engine (Engine): engine object. metric_names (list, optional): list of the metrics names to log as the bar progresses output_transform (callable, optional): a function to select what you want to print from the engine's ...
[ "Attaches", "the", "progress", "bar", "to", "an", "engine", "object", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/tqdm_logger.py#L137-L167
train
Attaches the progress bar to an engine object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/engines/tbptt.py
create_supervised_tbptt_trainer
def create_supervised_tbptt_trainer( model, optimizer, loss_fn, tbtt_step, dim=0, device=None, non_blocking=False, prepare_batch=_prepare_batch ): """Create a trainer for truncated backprop through time supervised models. Training recurrent model on long sequences is computation...
python
def create_supervised_tbptt_trainer( model, optimizer, loss_fn, tbtt_step, dim=0, device=None, non_blocking=False, prepare_batch=_prepare_batch ): """Create a trainer for truncated backprop through time supervised models. Training recurrent model on long sequences is computation...
[ "def", "create_supervised_tbptt_trainer", "(", "model", ",", "optimizer", ",", "loss_fn", ",", "tbtt_step", ",", "dim", "=", "0", ",", "device", "=", "None", ",", "non_blocking", "=", "False", ",", "prepare_batch", "=", "_prepare_batch", ")", ":", "if", "dev...
Create a trainer for truncated backprop through time supervised models. Training recurrent model on long sequences is computationally intensive as it requires to process the whole sequence before getting a gradient. However, when the training loss is computed over many outputs (`X to many <https://karp...
[ "Create", "a", "trainer", "for", "truncated", "backprop", "through", "time", "supervised", "models", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/engines/tbptt.py#L31-L109
train
Create a supervised TBTT trainer for truncated backpropagation through time supervised models.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/__init__.py
_prepare_batch
def _prepare_batch(batch, device=None, non_blocking=False): """Prepare batch for training: pass to a device with options. """ x, y = batch return (convert_tensor(x, device=device, non_blocking=non_blocking), convert_tensor(y, device=device, non_blocking=non_blocking))
python
def _prepare_batch(batch, device=None, non_blocking=False): """Prepare batch for training: pass to a device with options. """ x, y = batch return (convert_tensor(x, device=device, non_blocking=non_blocking), convert_tensor(y, device=device, non_blocking=non_blocking))
[ "def", "_prepare_batch", "(", "batch", ",", "device", "=", "None", ",", "non_blocking", "=", "False", ")", ":", "x", ",", "y", "=", "batch", "return", "(", "convert_tensor", "(", "x", ",", "device", "=", "device", ",", "non_blocking", "=", "non_blocking"...
Prepare batch for training: pass to a device with options.
[ "Prepare", "batch", "for", "training", ":", "pass", "to", "a", "device", "with", "options", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/__init__.py#L7-L13
train
Prepare batch for training.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/__init__.py
create_supervised_trainer
def create_supervised_trainer(model, optimizer, loss_fn, device=None, non_blocking=False, prepare_batch=_prepare_batch, output_transform=lambda x, y, y_pred, loss: loss.item()): """ Factory function for creating a trainer ...
python
def create_supervised_trainer(model, optimizer, loss_fn, device=None, non_blocking=False, prepare_batch=_prepare_batch, output_transform=lambda x, y, y_pred, loss: loss.item()): """ Factory function for creating a trainer ...
[ "def", "create_supervised_trainer", "(", "model", ",", "optimizer", ",", "loss_fn", ",", "device", "=", "None", ",", "non_blocking", "=", "False", ",", "prepare_batch", "=", "_prepare_batch", ",", "output_transform", "=", "lambda", "x", ",", "y", ",", "y_pred"...
Factory function for creating a trainer for supervised models. Args: model (`torch.nn.Module`): the model to train. optimizer (`torch.optim.Optimizer`): the optimizer to use. loss_fn (torch.nn loss function): the loss function to use. device (str, optional): device type specificatio...
[ "Factory", "function", "for", "creating", "a", "trainer", "for", "supervised", "models", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/__init__.py#L16-L55
train
Factory function for creating a trainer for supervised models.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/engine/__init__.py
create_supervised_evaluator
def create_supervised_evaluator(model, metrics=None, device=None, non_blocking=False, prepare_batch=_prepare_batch, output_transform=lambda x, y, y_pred: (y_pred, y,)): """ Factory function for creating an evaluator ...
python
def create_supervised_evaluator(model, metrics=None, device=None, non_blocking=False, prepare_batch=_prepare_batch, output_transform=lambda x, y, y_pred: (y_pred, y,)): """ Factory function for creating an evaluator ...
[ "def", "create_supervised_evaluator", "(", "model", ",", "metrics", "=", "None", ",", "device", "=", "None", ",", "non_blocking", "=", "False", ",", "prepare_batch", "=", "_prepare_batch", ",", "output_transform", "=", "lambda", "x", ",", "y", ",", "y_pred", ...
Factory function for creating an evaluator for supervised models. Args: model (`torch.nn.Module`): the model to train. metrics (dict of str - :class:`~ignite.metrics.Metric`): a map of metric names to Metrics. device (str, optional): device type specification (default: None). Ap...
[ "Factory", "function", "for", "creating", "an", "evaluator", "for", "supervised", "models", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/engine/__init__.py#L58-L101
train
Factory function for creating an evaluator engine for supervised models.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/param_scheduler.py
create_lr_scheduler_with_warmup
def create_lr_scheduler_with_warmup(lr_scheduler, warmup_start_value, warmup_end_value, warmup_duration, save_history=False, output_simulated_values=None): """ Helper method to create a LR scheduler with a linear warm-up. Args: ...
python
def create_lr_scheduler_with_warmup(lr_scheduler, warmup_start_value, warmup_end_value, warmup_duration, save_history=False, output_simulated_values=None): """ Helper method to create a LR scheduler with a linear warm-up. Args: ...
[ "def", "create_lr_scheduler_with_warmup", "(", "lr_scheduler", ",", "warmup_start_value", ",", "warmup_end_value", ",", "warmup_duration", ",", "save_history", "=", "False", ",", "output_simulated_values", "=", "None", ")", ":", "if", "not", "isinstance", "(", "lr_sch...
Helper method to create a LR scheduler with a linear warm-up. Args: lr_scheduler (ParamScheduler or subclass of `torch.optim.lr_scheduler._LRScheduler`): LR scheduler after the warm-up. warmup_start_value (float): LR start value of the warm-up phase. warmup_end_value (float): LR...
[ "Helper", "method", "to", "create", "a", "LR", "scheduler", "with", "a", "linear", "warm", "-", "up", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/param_scheduler.py#L501-L565
train
Helper method to create a new LR scheduler with a linear warm - up.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/param_scheduler.py
ParamScheduler.simulate_values
def simulate_values(cls, num_events, **scheduler_kwargs): """Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. **scheduler_kwargs : parameter scheduler configuration kwargs. Returns: ...
python
def simulate_values(cls, num_events, **scheduler_kwargs): """Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. **scheduler_kwargs : parameter scheduler configuration kwargs. Returns: ...
[ "def", "simulate_values", "(", "cls", ",", "num_events", ",", "*", "*", "scheduler_kwargs", ")", ":", "keys_to_remove", "=", "[", "'optimizer'", ",", "'save_history'", "]", "for", "key", "in", "keys_to_remove", ":", "if", "key", "in", "scheduler_kwargs", ":", ...
Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. **scheduler_kwargs : parameter scheduler configuration kwargs. Returns: list of pairs: [event_index, value] Examples: .. c...
[ "Method", "to", "simulate", "scheduled", "values", "during", "num_events", "events", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/param_scheduler.py#L75-L108
train
Method to simulate scheduled values during num_events events.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/param_scheduler.py
CosineAnnealingScheduler.get_param
def get_param(self): """Method to get current optimizer's parameter value """ cycle_progress = self.event_index / self.cycle_size return self.start_value + ((self.end_value - self.start_value) / 2) * (1 - math.cos(math.pi * cycle_progress))
python
def get_param(self): """Method to get current optimizer's parameter value """ cycle_progress = self.event_index / self.cycle_size return self.start_value + ((self.end_value - self.start_value) / 2) * (1 - math.cos(math.pi * cycle_progress))
[ "def", "get_param", "(", "self", ")", ":", "cycle_progress", "=", "self", ".", "event_index", "/", "self", ".", "cycle_size", "return", "self", ".", "start_value", "+", "(", "(", "self", ".", "end_value", "-", "self", ".", "start_value", ")", "/", "2", ...
Method to get current optimizer's parameter value
[ "Method", "to", "get", "current", "optimizer", "s", "parameter", "value" ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/param_scheduler.py#L274-L278
train
Method to get current optimizer s parameter value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/param_scheduler.py
ConcatScheduler.simulate_values
def simulate_values(cls, num_events, schedulers, durations, param_names=None, **kwargs): """Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. schedulers (list of ParamScheduler): list of parameter schedu...
python
def simulate_values(cls, num_events, schedulers, durations, param_names=None, **kwargs): """Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. schedulers (list of ParamScheduler): list of parameter schedu...
[ "def", "simulate_values", "(", "cls", ",", "num_events", ",", "schedulers", ",", "durations", ",", "param_names", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "param_names", "is", "not", "None", "and", "not", "isinstance", "(", "param_names", ",",...
Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. schedulers (list of ParamScheduler): list of parameter schedulers. durations (list of int): list of number of events that lasts a parameter scheduler...
[ "Method", "to", "simulate", "scheduled", "values", "during", "num_events", "events", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/param_scheduler.py#L379-L408
train
Method to simulate scheduled values during num_events events.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/param_scheduler.py
LRScheduler.get_param
def get_param(self): """Method to get current optimizer's parameter value """ lr_list = self.lr_scheduler.get_lr() if len(lr_list) > 1: raise ValueError("Optimizer passed to lr_scheduler should have a single param group, " "but currently there are...
python
def get_param(self): """Method to get current optimizer's parameter value """ lr_list = self.lr_scheduler.get_lr() if len(lr_list) > 1: raise ValueError("Optimizer passed to lr_scheduler should have a single param group, " "but currently there are...
[ "def", "get_param", "(", "self", ")", ":", "lr_list", "=", "self", ".", "lr_scheduler", ".", "get_lr", "(", ")", "if", "len", "(", "lr_list", ")", ">", "1", ":", "raise", "ValueError", "(", "\"Optimizer passed to lr_scheduler should have a single param group, \"",...
Method to get current optimizer's parameter value
[ "Method", "to", "get", "current", "optimizer", "s", "parameter", "value" ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/param_scheduler.py#L450-L457
train
Method to get current optimizer s parameter value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/param_scheduler.py
LRScheduler.simulate_values
def simulate_values(cls, num_events, lr_scheduler, **kwargs): """Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. lr_scheduler (subclass of `torch.optim.lr_scheduler._LRScheduler`): lr_scheduler object ...
python
def simulate_values(cls, num_events, lr_scheduler, **kwargs): """Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. lr_scheduler (subclass of `torch.optim.lr_scheduler._LRScheduler`): lr_scheduler object ...
[ "def", "simulate_values", "(", "cls", ",", "num_events", ",", "lr_scheduler", ",", "*", "*", "kwargs", ")", ":", "# This scheduler uses `torch.optim.lr_scheduler._LRScheduler` which", "# should be replicated in order to simulate LR values and", "# not perturb original scheduler.", ...
Method to simulate scheduled values during num_events events. Args: num_events (int): number of events during the simulation. lr_scheduler (subclass of `torch.optim.lr_scheduler._LRScheduler`): lr_scheduler object to wrap. Returns: list of pairs: [event_index, value...
[ "Method", "to", "simulate", "scheduled", "values", "during", "num_events", "events", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/param_scheduler.py#L460-L481
train
Method to simulate scheduled values during num_events events.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
examples/gan/dcgan.py
check_manual_seed
def check_manual_seed(seed): """ If manual seed is not specified, choose a random one and communicate it to the user. """ seed = seed or random.randint(1, 10000) random.seed(seed) torch.manual_seed(seed) print('Using manual seed: {seed}'.format(seed=seed))
python
def check_manual_seed(seed): """ If manual seed is not specified, choose a random one and communicate it to the user. """ seed = seed or random.randint(1, 10000) random.seed(seed) torch.manual_seed(seed) print('Using manual seed: {seed}'.format(seed=seed))
[ "def", "check_manual_seed", "(", "seed", ")", ":", "seed", "=", "seed", "or", "random", ".", "randint", "(", "1", ",", "10000", ")", "random", ".", "seed", "(", "seed", ")", "torch", ".", "manual_seed", "(", "seed", ")", "print", "(", "'Using manual se...
If manual seed is not specified, choose a random one and communicate it to the user.
[ "If", "manual", "seed", "is", "not", "specified", "choose", "a", "random", "one", "and", "communicate", "it", "to", "the", "user", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/examples/gan/dcgan.py#L146-L155
train
Check if manual seed is specified and communicate it to the user.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/base_logger.py
BaseLogger.attach
def attach(self, engine, log_handler, event_name): """Attach the logger to the engine and execute `log_handler` function at `event_name` events. Args: engine (Engine): engine object. log_handler (callable): a logging handler to execute event_name: event to attach the...
python
def attach(self, engine, log_handler, event_name): """Attach the logger to the engine and execute `log_handler` function at `event_name` events. Args: engine (Engine): engine object. log_handler (callable): a logging handler to execute event_name: event to attach the...
[ "def", "attach", "(", "self", ",", "engine", ",", "log_handler", ",", "event_name", ")", ":", "if", "event_name", "not", "in", "State", ".", "event_to_attr", ":", "raise", "RuntimeError", "(", "\"Unknown event name '{}'\"", ".", "format", "(", "event_name", ")...
Attach the logger to the engine and execute `log_handler` function at `event_name` events. Args: engine (Engine): engine object. log_handler (callable): a logging handler to execute event_name: event to attach the logging handler to. Valid events are from :class:`~ignite.eng...
[ "Attach", "the", "logger", "to", "the", "engine", "and", "execute", "log_handler", "function", "at", "event_name", "events", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/base_logger.py#L16-L29
train
Attach the logger to the engine and execute log_handler function at event_name events.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/base_logger.py
BaseOutputHandler._setup_output_metrics
def _setup_output_metrics(self, engine): """Helper method to setup metrics to log """ metrics = {} if self.metric_names is not None: for name in self.metric_names: if name not in engine.state.metrics: warnings.warn("Provided metric name '{}...
python
def _setup_output_metrics(self, engine): """Helper method to setup metrics to log """ metrics = {} if self.metric_names is not None: for name in self.metric_names: if name not in engine.state.metrics: warnings.warn("Provided metric name '{}...
[ "def", "_setup_output_metrics", "(", "self", ",", "engine", ")", ":", "metrics", "=", "{", "}", "if", "self", ".", "metric_names", "is", "not", "None", ":", "for", "name", "in", "self", ".", "metric_names", ":", "if", "name", "not", "in", "engine", "."...
Helper method to setup metrics to log
[ "Helper", "method", "to", "setup", "metrics", "to", "log" ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/base_logger.py#L89-L108
train
Helper method to setup metrics to log
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/handlers/timing.py
Timer.attach
def attach(self, engine, start=Events.STARTED, pause=Events.COMPLETED, resume=None, step=None): """ Register callbacks to control the timer. Args: engine (Engine): Engine that this timer will be attached to. start (Events): Event which should star...
python
def attach(self, engine, start=Events.STARTED, pause=Events.COMPLETED, resume=None, step=None): """ Register callbacks to control the timer. Args: engine (Engine): Engine that this timer will be attached to. start (Events): Event which should star...
[ "def", "attach", "(", "self", ",", "engine", ",", "start", "=", "Events", ".", "STARTED", ",", "pause", "=", "Events", ".", "COMPLETED", ",", "resume", "=", "None", ",", "step", "=", "None", ")", ":", "engine", ".", "add_event_handler", "(", "start", ...
Register callbacks to control the timer. Args: engine (Engine): Engine that this timer will be attached to. start (Events): Event which should start (reset) the timer. pause (Events): Event which should pause the timer. ...
[ "Register", "callbacks", "to", "control", "the", "timer", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/handlers/timing.py#L87-L116
train
Attaches callbacks to control the timer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/contrib/handlers/visdom_logger.py
_BaseVisDrawer.add_scalar
def add_scalar(self, logger, k, v, event_name, global_step): """ Helper method to log a scalar with VisdomLogger. Args: logger (VisdomLogger): visdom logger k (str): scalar name which is used to set window title and y-axis label v (int or float): scalar value...
python
def add_scalar(self, logger, k, v, event_name, global_step): """ Helper method to log a scalar with VisdomLogger. Args: logger (VisdomLogger): visdom logger k (str): scalar name which is used to set window title and y-axis label v (int or float): scalar value...
[ "def", "add_scalar", "(", "self", ",", "logger", ",", "k", ",", "v", ",", "event_name", ",", "global_step", ")", ":", "if", "k", "not", "in", "self", ".", "windows", ":", "self", ".", "windows", "[", "k", "]", "=", "{", "'win'", ":", "None", ",",...
Helper method to log a scalar with VisdomLogger. Args: logger (VisdomLogger): visdom logger k (str): scalar name which is used to set window title and y-axis label v (int or float): scalar value, y-axis value event_name: Event name which is used to setup x-axis l...
[ "Helper", "method", "to", "log", "a", "scalar", "with", "VisdomLogger", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/contrib/handlers/visdom_logger.py#L21-L60
train
Adds a scalar to the hierarchy of windows.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pytorch/ignite
ignite/_utils.py
_to_hours_mins_secs
def _to_hours_mins_secs(time_taken): """Convert seconds to hours, mins, and seconds.""" mins, secs = divmod(time_taken, 60) hours, mins = divmod(mins, 60) return hours, mins, secs
python
def _to_hours_mins_secs(time_taken): """Convert seconds to hours, mins, and seconds.""" mins, secs = divmod(time_taken, 60) hours, mins = divmod(mins, 60) return hours, mins, secs
[ "def", "_to_hours_mins_secs", "(", "time_taken", ")", ":", "mins", ",", "secs", "=", "divmod", "(", "time_taken", ",", "60", ")", "hours", ",", "mins", "=", "divmod", "(", "mins", ",", "60", ")", "return", "hours", ",", "mins", ",", "secs" ]
Convert seconds to hours, mins, and seconds.
[ "Convert", "seconds", "to", "hours", "mins", "and", "seconds", "." ]
a96bd07cb58822cfb39fd81765135712f1db41ca
https://github.com/pytorch/ignite/blob/a96bd07cb58822cfb39fd81765135712f1db41ca/ignite/_utils.py#L6-L10
train
Convert seconds to hours mins and seconds.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coursera-dl/coursera-dl
coursera/commandline.py
parse_args
def parse_args(args=None): """ Parse the arguments/options passed to the program on the command line. """ parse_kwargs = { "description": 'Download Coursera.org lecture material and resources.' } conf_file_path = os.path.join(os.getcwd(), LOCAL_CONF_FILE_NAME) if os.path.isfile(co...
python
def parse_args(args=None): """ Parse the arguments/options passed to the program on the command line. """ parse_kwargs = { "description": 'Download Coursera.org lecture material and resources.' } conf_file_path = os.path.join(os.getcwd(), LOCAL_CONF_FILE_NAME) if os.path.isfile(co...
[ "def", "parse_args", "(", "args", "=", "None", ")", ":", "parse_kwargs", "=", "{", "\"description\"", ":", "'Download Coursera.org lecture material and resources.'", "}", "conf_file_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ...
Parse the arguments/options passed to the program on the command line.
[ "Parse", "the", "arguments", "/", "options", "passed", "to", "the", "program", "on", "the", "command", "line", "." ]
9b434bcf3c4011bf3181429fe674633ae5fb7d4d
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/commandline.py#L33-L504
train
Parse the command line arguments and return a new object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coursera-dl/coursera-dl
coursera/utils.py
random_string
def random_string(length): """ Return a pseudo-random string of specified length. """ valid_chars = string_ascii_letters + string_digits return ''.join(random.choice(valid_chars) for i in range(length))
python
def random_string(length): """ Return a pseudo-random string of specified length. """ valid_chars = string_ascii_letters + string_digits return ''.join(random.choice(valid_chars) for i in range(length))
[ "def", "random_string", "(", "length", ")", ":", "valid_chars", "=", "string_ascii_letters", "+", "string_digits", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "valid_chars", ")", "for", "i", "in", "range", "(", "length", ")", ")" ]
Return a pseudo-random string of specified length.
[ "Return", "a", "pseudo", "-", "random", "string", "of", "specified", "length", "." ]
9b434bcf3c4011bf3181429fe674633ae5fb7d4d
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/utils.py#L81-L87
train
Return a pseudo - random string of specified length.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coursera-dl/coursera-dl
coursera/utils.py
clean_filename
def clean_filename(s, minimal_change=False): """ Sanitize a string to be used as a filename. If minimal_change is set to true, then we only strip the bare minimum of characters that are problematic for filesystems (namely, ':', '/' and '\x00', '\n'). """ # First, deal with URL encoded stri...
python
def clean_filename(s, minimal_change=False): """ Sanitize a string to be used as a filename. If minimal_change is set to true, then we only strip the bare minimum of characters that are problematic for filesystems (namely, ':', '/' and '\x00', '\n'). """ # First, deal with URL encoded stri...
[ "def", "clean_filename", "(", "s", ",", "minimal_change", "=", "False", ")", ":", "# First, deal with URL encoded strings", "h", "=", "html_parser", ".", "HTMLParser", "(", ")", "s", "=", "h", ".", "unescape", "(", "s", ")", "s", "=", "unquote_plus", "(", ...
Sanitize a string to be used as a filename. If minimal_change is set to true, then we only strip the bare minimum of characters that are problematic for filesystems (namely, ':', '/' and '\x00', '\n').
[ "Sanitize", "a", "string", "to", "be", "used", "as", "a", "filename", "." ]
9b434bcf3c4011bf3181429fe674633ae5fb7d4d
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/utils.py#L107-L148
train
Sanitize a string to be used as a filename.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coursera-dl/coursera-dl
coursera/utils.py
normalize_path
def normalize_path(path): """ Normalizes path on Windows OS. This means prepending <backslash><backslash>?<backslash> to the path to get access to Win32 device namespace instead of Win32 file namespace. See https://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx#maxpath @param path:...
python
def normalize_path(path): """ Normalizes path on Windows OS. This means prepending <backslash><backslash>?<backslash> to the path to get access to Win32 device namespace instead of Win32 file namespace. See https://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx#maxpath @param path:...
[ "def", "normalize_path", "(", "path", ")", ":", "if", "sys", ".", "platform", "!=", "'win32'", ":", "return", "path", "if", "path", ".", "startswith", "(", "WINDOWS_UNC_PREFIX", ")", ":", "return", "path", "return", "WINDOWS_UNC_PREFIX", "+", "os", ".", "p...
Normalizes path on Windows OS. This means prepending <backslash><backslash>?<backslash> to the path to get access to Win32 device namespace instead of Win32 file namespace. See https://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx#maxpath @param path: Path to normalize. @type path: st...
[ "Normalizes", "path", "on", "Windows", "OS", ".", "This", "means", "prepending", "<backslash", ">", "<backslash", ">", "?<backslash", ">", "to", "the", "path", "to", "get", "access", "to", "Win32", "device", "namespace", "instead", "of", "Win32", "file", "na...
9b434bcf3c4011bf3181429fe674633ae5fb7d4d
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/utils.py#L151-L170
train
Normalizes path on Windows OS.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coursera-dl/coursera-dl
coursera/utils.py
get_anchor_format
def get_anchor_format(a): """ Extract the resource file-type format from the anchor. """ # (. or format=) then (file_extension) then (? or $) # e.g. "...format=txt" or "...download.mp4?..." fmt = re.search(r"(?:\.|format=)(\w+)(?:\?.*)?$", a) return fmt.group(1) if fmt else None
python
def get_anchor_format(a): """ Extract the resource file-type format from the anchor. """ # (. or format=) then (file_extension) then (? or $) # e.g. "...format=txt" or "...download.mp4?..." fmt = re.search(r"(?:\.|format=)(\w+)(?:\?.*)?$", a) return fmt.group(1) if fmt else None
[ "def", "get_anchor_format", "(", "a", ")", ":", "# (. or format=) then (file_extension) then (? or $)", "# e.g. \"...format=txt\" or \"...download.mp4?...\"", "fmt", "=", "re", ".", "search", "(", "r\"(?:\\.|format=)(\\w+)(?:\\?.*)?$\"", ",", "a", ")", "return", "fmt", ".", ...
Extract the resource file-type format from the anchor.
[ "Extract", "the", "resource", "file", "-", "type", "format", "from", "the", "anchor", "." ]
9b434bcf3c4011bf3181429fe674633ae5fb7d4d
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/utils.py#L173-L181
train
Extract the resource file - type format from the anchor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coursera-dl/coursera-dl
coursera/utils.py
clean_url
def clean_url(url): """ Remove params, query and fragment parts from URL so that `os.path.basename` and `os.path.splitext` can work correctly. @param url: URL to clean. @type url: str @return: Cleaned URL. @rtype: str """ parsed = urlparse(url.strip()) reconstructed = ParseResu...
python
def clean_url(url): """ Remove params, query and fragment parts from URL so that `os.path.basename` and `os.path.splitext` can work correctly. @param url: URL to clean. @type url: str @return: Cleaned URL. @rtype: str """ parsed = urlparse(url.strip()) reconstructed = ParseResu...
[ "def", "clean_url", "(", "url", ")", ":", "parsed", "=", "urlparse", "(", "url", ".", "strip", "(", ")", ")", "reconstructed", "=", "ParseResult", "(", "parsed", ".", "scheme", ",", "parsed", ".", "netloc", ",", "parsed", ".", "path", ",", "params", ...
Remove params, query and fragment parts from URL so that `os.path.basename` and `os.path.splitext` can work correctly. @param url: URL to clean. @type url: str @return: Cleaned URL. @rtype: str
[ "Remove", "params", "query", "and", "fragment", "parts", "from", "URL", "so", "that", "os", ".", "path", ".", "basename", "and", "os", ".", "path", ".", "splitext", "can", "work", "correctly", "." ]
9b434bcf3c4011bf3181429fe674633ae5fb7d4d
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/utils.py#L198-L213
train
Clean a URL to be used in a URL - based URL parser.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...