MCPcopy Create free account

hub / github.com/cs230-stanford/cs230-code-examples / functions

Functions97 in github.com/cs230-stanford/cs230-code-examples

↓ 6 callersFunctionload_dataset_from_text
Create tf.data Instance from txt file Args: path_txt: (string) path containing one example per line vocab: (tf.lookuptable)
tensorflow/nlp/model/input_fn.py:6
↓ 6 callersFunctionupdate_vocab
Update word and tag vocabulary from dataset Args: txt_path: (string) path to file, one sentence per line vocab: (dict or Counter)
tensorflow/nlp/build_vocab.py:46
↓ 6 callersFunctionupdate_vocab
Update word and tag vocabulary from dataset Args: txt_path: (string) path to file, one sentence per line vocab: (dict or Counter)
pytorch/nlp/build_vocab.py:44
↓ 4 callersMethodsave
Saves parameters to json file
tensorflow/vision/model/utils.py:21
↓ 4 callersMethodupdate
Loads parameters from json file
tensorflow/nlp/model/utils.py:26
↓ 3 callersMethoddata_iterator
Returns a generator that yields batches data with labels. Batch size is params.batch_size. Expires after one pass over the data.
pytorch/nlp/model/data_loader.py:115
↓ 3 callersFunctioninput_fn
Input function for the SIGNS dataset. The filenames have format "{label}_IMG_{id}.jpg". For instance: "data_dir/2_IMG_4584.jpg". Args:
tensorflow/vision/model/input_fn.py:45
↓ 3 callersFunctioninput_fn
Input function for NER Args: mode: (string) 'train', 'eval' or any other mode you can think of At training, we shuff
tensorflow/nlp/model/input_fn.py:28
↓ 3 callersFunctionmodel_fn
Model function defining the graph operations. Args: mode: (string) can be 'train' or 'eval' inputs: (dict) contains the inputs of
tensorflow/vision/model/model_fn.py:50
↓ 3 callersFunctionmodel_fn
Model function defining the graph operations. Args: mode: (string) 'train', 'eval', etc. inputs: (dict) contains the inputs of th
tensorflow/nlp/model/model_fn.py:39
↓ 3 callersMethodsave
Saves parameters to json file
tensorflow/nlp/model/utils.py:21
↓ 3 callersMethodsave
(self, json_path)
pytorch/vision/utils.py:24
↓ 3 callersFunctionsave_dataset
Writes sentences.txt and labels.txt files in save_dir from dataset Args: dataset: ([(["a", "cat"], ["O", "O"]), ...]) save_dir: (
tensorflow/nlp/build_kaggle_dataset.py:38
↓ 3 callersFunctionsave_dataset
Writes sentences.txt and labels.txt files in save_dir from dataset Args: dataset: ([(["a", "cat"], ["O", "O"]), ...]) save_dir: (
pytorch/nlp/build_kaggle_dataset.py:38
↓ 3 callersFunctionsave_dict_to_json
Saves dict of floats in json file Args: d: (dict) of float-castable values (np.float, int, float, etc.) json_path: (string) path
tensorflow/vision/model/utils.py:67
↓ 3 callersFunctionsave_dict_to_json
Saves dict of floats in json file Args: d: (dict) of float-castable values (np.float, int, float, etc.) json_path: (string) path
tensorflow/nlp/model/utils.py:67
↓ 3 callersMethodupdate
Loads parameters from json file
pytorch/nlp/utils.py:29
↓ 2 callersFunctionevaluate
Evaluate the model on `num_steps` batches. Args: model: (torch.nn.Module) the neural network loss_fn: a function that takes batch
pytorch/vision/evaluate.py:23
↓ 2 callersFunctionevaluate
Evaluate the model on `num_steps` batches. Args: model: (torch.nn.Module) the neural network loss_fn: a function that takes batch
pytorch/nlp/evaluate.py:20
↓ 2 callersFunctionevaluate_sess
Train the model on `num_steps` batches. Args: sess: (tf.Session) current session model_spec: (dict) contains the graph operations
tensorflow/vision/model/evaluation.py:12
↓ 2 callersFunctionevaluate_sess
Train the model on `num_steps` batches. Args: sess: (tf.Session) current session model_spec: (dict) contains the graph operations
tensorflow/nlp/model/evaluation.py:12
↓ 2 callersMethodload_data
Loads the data for each type in types from data_dir. Args: types: (list) has one or more of 'train', 'val', 'test' depen
pytorch/nlp/model/data_loader.py:92
↓ 2 callersFunctionloss_fn
Compute the cross entropy loss given outputs and labels. Args: outputs: (Variable) dimension batch_size x 6 - output of the model
pytorch/vision/model/net.py:87
↓ 2 callersFunctionloss_fn
Compute the cross entropy loss given outputs from the model and labels for all tokens. Exclude loss terms for PADding tokens. Args:
pytorch/nlp/model/net.py:87
↓ 2 callersMethodsave
(self, json_path)
pytorch/nlp/utils.py:25
↓ 2 callersFunctionsave_vocab_to_txt_file
Writes one token per line, 0-based line id corresponds to the id of the token. Args: vocab: (iterable object) yields token txt_pa
tensorflow/nlp/build_vocab.py:23
↓ 2 callersFunctionsave_vocab_to_txt_file
Writes one token per line, 0-based line id corresponds to the id of the token. Args: vocab: (iterable object) yields token txt_pa
pytorch/nlp/build_vocab.py:20
↓ 2 callersFunctionset_logger
Sets the logger to log info in terminal and file `log_path`. In general, it is useful to have a logger so that every output to the terminal is sa
tensorflow/vision/model/utils.py:38
↓ 2 callersFunctionset_logger
Sets the logger to log info in terminal and file `log_path`. In general, it is useful to have a logger so that every output to the terminal is sa
tensorflow/nlp/model/utils.py:38
↓ 2 callersMethodupdate
Loads parameters from json file
pytorch/vision/utils.py:28
↓ 1 callersFunction_parse_function
Obtain the image from the filename (for both training and validation). The following operations are applied: - Decode the image from jpeg
tensorflow/vision/model/input_fn.py:6
↓ 1 callersFunctionaggregate_metrics
Aggregate the metrics of all experiments in folder `parent_dir`. Assumes that `parent_dir` contains multiple experiments, with their results stor
tensorflow/vision/synthesize_results.py:15
↓ 1 callersFunctionaggregate_metrics
Aggregate the metrics of all experiments in folder `parent_dir`. Assumes that `parent_dir` contains multiple experiments, with their results stor
tensorflow/nlp/synthesize_results.py:15
↓ 1 callersFunctionaggregate_metrics
Aggregate the metrics of all experiments in folder `parent_dir`. Assumes that `parent_dir` contains multiple experiments, with their results stor
pytorch/vision/synthesize_results.py:15
↓ 1 callersFunctionaggregate_metrics
Aggregate the metrics of all experiments in folder `parent_dir`. Assumes that `parent_dir` contains multiple experiments, with their results stor
pytorch/nlp/synthesize_results.py:15
↓ 1 callersFunctionbuild_model
Compute logits of the model (output distribution) Args: is_training: (bool) whether we are training or not inputs: (dict) contain
tensorflow/vision/model/model_fn.py:6
↓ 1 callersFunctionbuild_model
Compute logits of the model (output distribution) Args: mode: (string) 'train', 'eval', etc. inputs: (dict) contains the inputs o
tensorflow/nlp/model/model_fn.py:6
↓ 1 callersFunctionevaluate
Evaluate the model Args: model_spec: (dict) contains the graph operations or nodes needed for evaluation model_dir: (string) dire
tensorflow/vision/model/evaluation.py:50
↓ 1 callersFunctionevaluate
Evaluate the model Args: model_spec: (dict) contains the graph operations or nodes needed for evaluation model_dir: (string) dire
tensorflow/nlp/model/evaluation.py:50
↓ 1 callersFunctionlaunch_training_job
Launch training of the model with a set of hyperparameters in parent_dir/job_name Args: parent_dir: (string) directory containing config,
tensorflow/vision/search_hyperparams.py:19
↓ 1 callersFunctionlaunch_training_job
Launch training of the model with a set of hyperparameters in parent_dir/job_name Args: parent_dir: (string) directory containing config,
tensorflow/nlp/search_hyperparams.py:19
↓ 1 callersFunctionlaunch_training_job
Launch training of the model with a set of hyperparameters in parent_dir/job_name Args: model_dir: (string) directory containing config,
pytorch/vision/search_hyperparams.py:18
↓ 1 callersFunctionlaunch_training_job
Launch training of the model with a set of hyperparameters in parent_dir/job_name Args: model_dir: (string) directory containing config,
pytorch/nlp/search_hyperparams.py:18
↓ 1 callersFunctionload_dataset
Loads dataset into memory from csv file
tensorflow/nlp/build_kaggle_dataset.py:8
↓ 1 callersFunctionload_dataset
Loads dataset into memory from csv file
pytorch/nlp/build_kaggle_dataset.py:8
↓ 1 callersMethodload_sentences_labels
Loads sentences and labels from their corresponding files. Maps tokens and tags to their indices and stores them in the provided dict
pytorch/nlp/model/data_loader.py:53
↓ 1 callersFunctionmetrics_to_table
(metrics)
tensorflow/vision/synthesize_results.py:39
↓ 1 callersFunctionmetrics_to_table
(metrics)
tensorflow/nlp/synthesize_results.py:39
↓ 1 callersFunctionmetrics_to_table
(metrics)
pytorch/vision/synthesize_results.py:39
↓ 1 callersFunctionmetrics_to_table
(metrics)
pytorch/nlp/synthesize_results.py:39
↓ 1 callersFunctionresize_and_save
Resize the image contained in `filename` and save it to the `output_dir`
tensorflow/vision/build_dataset.py:35
↓ 1 callersFunctionresize_and_save
Resize the image contained in `filename` and save it to the `output_dir`
pytorch/vision/build_dataset.py:34
↓ 1 callersFunctionsave_dict_to_json
Saves dict to json file Args: d: (dict) json_path: (string) path to json file
tensorflow/nlp/build_vocab.py:34
↓ 1 callersFunctionsave_dict_to_json
Saves dict to json file Args: d: (dict) json_path: (string) path to json file
pytorch/nlp/build_vocab.py:32
↓ 1 callersFunctiontrain
Train the model on `num_steps` batches Args: model: (torch.nn.Module) the neural network optimizer: (torch.optim) optimizer for p
pytorch/vision/train.py:28
↓ 1 callersFunctiontrain
Train the model on `num_steps` batches Args: model: (torch.nn.Module) the neural network optimizer: (torch.optim) optimizer for p
pytorch/nlp/train.py:28
↓ 1 callersFunctiontrain_and_evaluate
Train the model and evaluate every epoch. Args: train_model_spec: (dict) contains the graph operations or nodes needed for training
tensorflow/vision/model/training.py:57
↓ 1 callersFunctiontrain_and_evaluate
Train the model and evaluate every epoch. Args: train_model_spec: (dict) contains the graph operations or nodes needed for training
tensorflow/nlp/model/training.py:57
↓ 1 callersFunctiontrain_and_evaluate
Train the model and evaluate every epoch. Args: model: (torch.nn.Module) the neural network train_dataloader: (DataLoader) a torc
pytorch/vision/train.py:96
↓ 1 callersFunctiontrain_and_evaluate
Train the model and evaluate every epoch. Args: model: (torch.nn.Module) the neural network train_data: (dict) training data with
pytorch/nlp/train.py:89
↓ 1 callersFunctiontrain_preprocess
Image preprocessing for training. Apply the following operations: - Horizontally flip the image with probability 1/2 - Apply rand
tensorflow/vision/model/input_fn.py:26
↓ 1 callersFunctiontrain_sess
Train the model on `num_steps` batches Args: sess: (tf.Session) current session model_spec: (dict) contains the graph operations
tensorflow/vision/model/training.py:13
↓ 1 callersFunctiontrain_sess
Train the model on `num_steps` batches Args: sess: (tf.Session) current session model_spec: (dict) contains the graph operations
tensorflow/nlp/model/training.py:13
↓ 1 callersMethodupdate
Loads parameters from json file
tensorflow/vision/model/utils.py:26
↓ 1 callersMethodupdate
(self, val)
pytorch/vision/utils.py:55
↓ 1 callersMethodupdate
(self, val)
pytorch/nlp/utils.py:57
Method__call__
(self)
pytorch/vision/utils.py:59
Method__call__
(self)
pytorch/nlp/utils.py:61
Method__getitem__
Fetch index idx image and labels from dataset. Perform transforms on image. Args: idx: (int) index in [0, 1, ..., size_o
pytorch/vision/model/data_loader.py:44
Method__init__
(self, json_path)
tensorflow/vision/model/utils.py:18
Method__init__
(self, json_path)
tensorflow/nlp/model/utils.py:18
Method__init__
(self, json_path)
pytorch/vision/utils.py:19
Method__init__
(self)
pytorch/vision/utils.py:51
Method__init__
We define an convolutional network that predicts the sign from an image. The components required are: - an embedding layer:
pytorch/vision/model/net.py:22
Method__init__
Store the filenames of the jpgs to use. Specifies transforms to apply on images. Args: data_dir: (string) directory cont
pytorch/vision/model/data_loader.py:26
Method__init__
(self, json_path)
pytorch/nlp/utils.py:20
Method__init__
(self)
pytorch/nlp/utils.py:53
Method__init__
We define an recurrent network that predicts the NER tags for each token in the sentence. The components required are: - an
pytorch/nlp/model/net.py:22
Method__init__
Loads dataset_params, vocabulary and tags. Ensure you have run `build_vocab.py` on data_dir before using this class. Args:
pytorch/nlp/model/data_loader.py:16
Method__len__
(self)
pytorch/vision/model/data_loader.py:40
Functionaccuracy
Compute the accuracy, given the outputs and labels for all images. Args: outputs: (np.ndarray) dimension batch_size x 6 - log softma
pytorch/vision/model/net.py:105
Functionaccuracy
Compute the accuracy, given the outputs and labels for all tokens. Exclude PADding terms. Args: outputs: (np.ndarray) dimension batc
pytorch/nlp/model/net.py:120
Methoddict
Gives dict-like access to Params instance by `params.dict['learning_rate']`
tensorflow/vision/model/utils.py:33
Methoddict
Gives dict-like access to Params instance by `params.dict['learning_rate']`
tensorflow/nlp/model/utils.py:33
Methoddict
Gives dict-like access to Params instance by `params.dict['learning_rate']
pytorch/vision/utils.py:35
Methoddict
Gives dict-like access to Params instance by `params.dict['learning_rate']
pytorch/nlp/utils.py:36
Functionfetch_dataloader
Fetches the DataLoader object for each type in types from data_dir. Args: types: (list) has one or more of 'train', 'val', 'test' de
pytorch/vision/model/data_loader.py:60
Methodforward
This function defines how we use the components of our network to operate on an input batch. Args: s: (Variable) contain
pytorch/vision/model/net.py:53
Methodforward
This function defines how we use the components of our network to operate on an input batch. Args: s: (Variable) contain
pytorch/nlp/model/net.py:47
Functionload_checkpoint
Loads model parameters (state_dict) from file_path. If optimizer is provided, loads state_dict of optimizer assuming it is present in checkpoint.
pytorch/vision/utils.py:125
Functionload_checkpoint
Loads model parameters (state_dict) from file_path. If optimizer is provided, loads state_dict of optimizer assuming it is present in checkpoint.
pytorch/nlp/utils.py:127
Functionsave_checkpoint
Saves model and training parameters at checkpoint + 'last.pth.tar'. If is_best==True, also saves checkpoint + 'best.pth.tar' Args: st
pytorch/vision/utils.py:105
Functionsave_checkpoint
Saves model and training parameters at checkpoint + 'last.pth.tar'. If is_best==True, also saves checkpoint + 'best.pth.tar' Args: st
pytorch/nlp/utils.py:107
Functionsave_dict_to_json
Saves dict of floats in json file Args: d: (dict) of float-castable values (np.float, int, float, etc.) json_path: (string) path
pytorch/vision/utils.py:92
Functionsave_dict_to_json
Saves dict of floats in json file Args: d: (dict) of float-castable values (np.float, int, float, etc.) json_path: (string) path
pytorch/nlp/utils.py:94
Functionset_logger
Set the logger to log info in terminal and file `log_path`. In general, it is useful to have a logger so that every output to the terminal is sav
pytorch/vision/utils.py:63
Functionset_logger
Set the logger to log info in terminal and file `log_path`. In general, it is useful to have a logger so that every output to the terminal is sav
pytorch/nlp/utils.py:65