SYMBOL INDEX (3665 symbols across 506 files)
FILE: examples/pytorch/data_parallel_tutorial.py
class RandomDataset (line 70) | class RandomDataset(Dataset):
method __init__ (line 72) | def __init__(self, size, length):
method __getitem__ (line 76) | def __getitem__(self, index):
method __len__ (line 79) | def __len__(self):
class Model (line 99) | class Model(nn.Module):
method __init__ (line 102) | def __init__(self, input_size, output_size):
method forward (line 106) | def forward(self, input):
FILE: examples/pytorch/sentiment/model.py
class SimpleGRU (line 33) | class SimpleGRU(nn.Module):
method __init__ (line 34) | def __init__(self, vocab_size, embedding_dim, n_hidden, n_out):
method forward (line 41) | def forward(self, seq, lengths, gpu=True):
method init_hidden (line 61) | def init_hidden(self, batch_size, gpu):
FILE: examples/pytorch/sentiment/train.py
function indexer (line 52) | def indexer(s):
class VectorizeData (line 59) | class VectorizeData(Dataset):
method __init__ (line 60) | def __init__(self, df_path, maxlen=10):
method __len__ (line 71) | def __len__(self):
method __getitem__ (line 74) | def __getitem__(self, idx):
method pad_data (line 80) | def pad_data(self, s):
function sort_batch (line 96) | def sort_batch(X, y, lengths):
function fit (line 102) | def fit(model, train_dl, val_dl, loss_fn, opt, epochs=3):
function main (line 161) | def main(_):
FILE: examples/tf/eager/dynamic_dense.py
class Layer (line 25) | class Layer(keras.layers.Layer):
method __init__ (line 26) | def __init__(self):
method call (line 30) | def call(self, x):
class Model (line 36) | class Model(keras.Model):
method __init__ (line 37) | def __init__(self):
method call (line 49) | def call(self, x):
FILE: examples/tf/eager/rnn_ptb.py
class RNN (line 44) | class RNN(tf.keras.Model):
method __init__ (line 50) | def __init__(self, hidden_dim, num_layers, keep_ratio):
method call (line 58) | def call(self, input_seq, training):
class Embedding (line 78) | class Embedding(layers.Layer):
method __init__ (line 81) | def __init__(self, vocab_size, embedding_dim, **kwargs):
method build (line 86) | def build(self, _):
method call (line 94) | def call(self, x):
class PTBModel (line 99) | class PTBModel(tf.keras.Model):
method __init__ (line 110) | def __init__(self,
method call (line 134) | def call(self, input_seq, training):
function clip_gradients (line 150) | def clip_gradients(grads_and_vars, clip_ratio):
function loss_fn (line 156) | def loss_fn(model, inputs, targets, training):
function _divide_into_batches (line 164) | def _divide_into_batches(data, batch_size):
function _get_batch (line 172) | def _get_batch(data, i, seq_len):
function evaluate (line 179) | def evaluate(model, data):
function train (line 195) | def train(model, optimizer, train_data, sequence_length, clip_ratio):
class Datasets (line 217) | class Datasets(object):
method __init__ (line 220) | def __init__(self, path):
method vocab_size (line 235) | def vocab_size(self):
method add (line 238) | def add(self, word):
method tokenize (line 243) | def tokenize(self, path):
function small_model (line 266) | def small_model(use_cudnn_rnn):
function large_model (line 277) | def large_model(use_cudnn_rnn):
function test_model (line 288) | def test_model(use_cudnn_rnn):
function main (line 299) | def main(_):
FILE: official/benchmark/benchmark_uploader.py
class BigQueryUploader (line 34) | class BigQueryUploader(object):
method __init__ (line 37) | def __init__(self, gcp_project=None, credentials=None):
method upload_benchmark_run_json (line 53) | def upload_benchmark_run_json(
method upload_benchmark_metric_json (line 69) | def upload_benchmark_metric_json(
method upload_benchmark_run_file (line 87) | def upload_benchmark_run_file(
method upload_metric_file (line 105) | def upload_metric_file(
method _upload_json (line 127) | def _upload_json(self, dataset_name, table_name, json_list):
FILE: official/benchmark/benchmark_uploader_main.py
function main (line 38) | def main(_):
FILE: official/benchmark/benchmark_uploader_test.py
class BigQueryUploaderTest (line 40) | class BigQueryUploaderTest(tf.test.TestCase):
method setUp (line 43) | def setUp(self, mock_bigquery):
method tearDown (line 63) | def tearDown(self):
method test_upload_benchmark_run_json (line 66) | def test_upload_benchmark_run_json(self):
method test_upload_benchmark_metric_json (line 73) | def test_upload_benchmark_metric_json(self):
method test_upload_benchmark_run_file (line 87) | def test_upload_benchmark_run_file(self):
method test_upload_metric_file (line 94) | def test_upload_metric_file(self):
FILE: official/boosted_trees/data_download.py
function _download_higgs_data_and_save_npz (line 34) | def _download_higgs_data_and_save_npz(data_dir):
function main (line 65) | def main(unused_argv):
function define_data_download_flags (line 71) | def define_data_download_flags():
FILE: official/boosted_trees/train_higgs.py
function read_higgs_data (line 48) | def read_higgs_data(data_dir, train_start, train_count, eval_start, eval...
function make_inputs_from_np_arrays (line 77) | def make_inputs_from_np_arrays(features_np, label_np):
function make_eval_inputs_from_np_arrays (line 134) | def make_eval_inputs_from_np_arrays(features_np, label_np):
function _make_csv_serving_input_receiver_fn (line 153) | def _make_csv_serving_input_receiver_fn(column_names, column_defaults):
function train_boosted_trees (line 178) | def train_boosted_trees(flags_obj):
function main (line 240) | def main(_):
function define_train_higgs_flags (line 244) | def define_train_higgs_flags():
FILE: official/boosted_trees/train_higgs_test.py
class BaseTest (line 36) | class BaseTest(tf.test.TestCase):
method setUpClass (line 40) | def setUpClass(cls): # pylint: disable=invalid-name
method setUp (line 44) | def setUp(self):
method test_read_higgs_data (line 56) | def test_read_higgs_data(self):
method test_make_inputs_from_np_arrays (line 71) | def test_make_inputs_from_np_arrays(self):
method test_end_to_end (line 118) | def test_end_to_end(self):
method test_end_to_end_with_export (line 134) | def test_end_to_end_with_export(self):
FILE: official/mnist/dataset.py
function read32 (line 30) | def read32(bytestream):
function check_image_file_header (line 36) | def check_image_file_header(filename):
function check_labels_file_header (line 52) | def check_labels_file_header(filename):
function download (line 62) | def download(directory, filename):
function dataset (line 81) | def dataset(directory, images_file, labels_file):
function train (line 109) | def train(directory):
function test (line 115) | def test(directory):
FILE: official/mnist/mnist.py
function create_model (line 33) | def create_model(data_format):
function define_mnist_flags (line 89) | def define_mnist_flags():
function model_fn (line 99) | def model_fn(features, labels, mode, params):
function validate_batch_size_for_multi_gpu (line 155) | def validate_batch_size_for_multi_gpu(batch_size):
function run_mnist (line 185) | def run_mnist(flags_obj):
function main (line 257) | def main(_):
FILE: official/mnist/mnist_eager.py
function loss (line 44) | def loss(logits, labels):
function compute_accuracy (line 50) | def compute_accuracy(logits, labels):
function train (line 58) | def train(model, optimizer, dataset, step_counter, log_interval=None):
function test (line 82) | def test(model, dataset):
function run_mnist_eager (line 100) | def run_mnist_eager(flags_obj):
function define_mnist_eager_flags (line 168) | def define_mnist_eager_flags():
function main (line 200) | def main(_):
FILE: official/mnist/mnist_eager_test.py
function device (line 27) | def device():
function data_format (line 31) | def data_format():
function random_dataset (line 35) | def random_dataset():
function train (line 42) | def train(defun=False):
function evaluate (line 53) | def evaluate(defun=False):
class MNISTTest (line 62) | class MNISTTest(tf.test.TestCase):
method test_train (line 65) | def test_train(self):
method test_evaluate (line 68) | def test_evaluate(self):
method test_train_with_defun (line 71) | def test_train_with_defun(self):
method test_evaluate_with_defun (line 74) | def test_evaluate_with_defun(self):
FILE: official/mnist/mnist_test.py
function dummy_input_fn (line 29) | def dummy_input_fn():
function make_estimator (line 35) | def make_estimator():
class Tests (line 45) | class Tests(tf.test.TestCase):
method test_mnist (line 48) | def test_mnist(self):
method mnist_model_fn_helper (line 67) | def mnist_model_fn_helper(self, mode, multi_gpu=False):
method test_mnist_model_fn_train_mode (line 94) | def test_mnist_model_fn_train_mode(self):
method test_mnist_model_fn_train_mode_multi_gpu (line 97) | def test_mnist_model_fn_train_mode_multi_gpu(self):
method test_mnist_model_fn_eval_mode (line 100) | def test_mnist_model_fn_eval_mode(self):
method test_mnist_model_fn_predict_mode (line 103) | def test_mnist_model_fn_predict_mode(self):
class Benchmarks (line 107) | class Benchmarks(tf.test.Benchmark):
method benchmark_train_step_time (line 110) | def benchmark_train_step_time(self):
FILE: official/mnist/mnist_tpu.py
function metric_fn (line 75) | def metric_fn(labels, logits):
function model_fn (line 81) | def model_fn(features, labels, mode, params):
function train_input_fn (line 114) | def train_input_fn(params):
function eval_input_fn (line 128) | def eval_input_fn(params):
function main (line 137) | def main(argv):
FILE: official/recommendation/data_download.py
function _print_ratings_description (line 59) | def _print_ratings_description(ratings):
function process_movielens (line 74) | def process_movielens(ratings, sort=True):
function load_movielens_1_million (line 92) | def load_movielens_1_million(file_name, sort=True):
function load_movielens_20_million (line 116) | def load_movielens_20_million(file_name, sort=True):
function load_file_to_df (line 144) | def load_file_to_df(file_name, sort=True):
function generate_train_eval_data (line 168) | def generate_train_eval_data(df, original_users, original_items):
function parse_file_to_csv (line 232) | def parse_file_to_csv(data_dir, dataset_name):
function make_dir (line 301) | def make_dir(file_dir):
function main (line 307) | def main(_):
function define_data_download_flags (line 346) | def define_data_download_flags():
FILE: official/recommendation/dataset.py
class NCFDataSet (line 30) | class NCFDataSet(object):
method __init__ (line 33) | def __init__(self, train_data, num_users, num_items, num_negatives,
function load_data (line 58) | def load_data(file_name):
function data_preprocessing (line 70) | def data_preprocessing(train_fname, test_fname, test_neg_fname, num_nega...
function generate_train_dataset (line 130) | def generate_train_dataset(train_data, num_items, num_negatives):
function input_fn (line 161) | def input_fn(training, batch_size, ncf_dataset, repeat=1):
FILE: official/recommendation/dataset_test.py
class DatasetTest (line 36) | class DatasetTest(tf.test.TestCase):
method test_load_data (line 38) | def test_load_data(self):
method test_data_preprocessing (line 48) | def test_data_preprocessing(self):
method test_generate_train_dataset (line 76) | def test_generate_train_dataset(self):
FILE: official/recommendation/ncf_main.py
function evaluate_model (line 49) | def evaluate_model(estimator, batch_size, num_gpus, ncf_dataset):
function convert_keras_to_estimator (line 138) | def convert_keras_to_estimator(keras_model, num_gpus, model_dir):
function per_device_batch_size (line 169) | def per_device_batch_size(batch_size, num_gpus):
function main (line 200) | def main(_):
function define_ncf_flags (line 282) | def define_ncf_flags():
FILE: official/recommendation/neumf_model.py
class NeuMF (line 42) | class NeuMF(tf.keras.models.Model):
method __init__ (line 45) | def __init__(self, num_users, num_items, mf_dim, model_layers, batch_s...
FILE: official/resnet/cifar10_download_and_extract.py
function main (line 39) | def main(_):
FILE: official/resnet/cifar10_main.py
function get_filenames (line 51) | def get_filenames(is_training, data_dir):
function parse_record (line 68) | def parse_record(raw_record, is_training):
function preprocess_image (line 91) | def preprocess_image(image, is_training):
function input_fn (line 109) | def input_fn(is_training, data_dir, batch_size, num_epochs=1):
function get_synth_input_fn (line 130) | def get_synth_input_fn():
class Cifar10Model (line 138) | class Cifar10Model(resnet_model.Model):
method __init__ (line 141) | def __init__(self, resnet_size, data_format=None, num_classes=_NUM_CLA...
function cifar10_model_fn (line 182) | def cifar10_model_fn(features, labels, mode, params):
function define_cifar_flags (line 220) | def define_cifar_flags():
function run_cifar (line 231) | def run_cifar(flags_obj):
function main (line 245) | def main(_):
FILE: official/resnet/cifar10_test.py
class BaseTest (line 36) | class BaseTest(tf.test.TestCase):
method setUpClass (line 41) | def setUpClass(cls): # pylint: disable=invalid-name
method tearDown (line 45) | def tearDown(self):
method test_dataset_input_fn (line 49) | def test_dataset_input_fn(self):
method cifar10_model_fn_helper (line 79) | def cifar10_model_fn_helper(self, mode, resnet_version, dtype):
method test_cifar10_model_fn_train_mode_v1 (line 113) | def test_cifar10_model_fn_train_mode_v1(self):
method test_cifar10_model_fn_trainmode__v2 (line 117) | def test_cifar10_model_fn_trainmode__v2(self):
method test_cifar10_model_fn_eval_mode_v1 (line 121) | def test_cifar10_model_fn_eval_mode_v1(self):
method test_cifar10_model_fn_eval_mode_v2 (line 125) | def test_cifar10_model_fn_eval_mode_v2(self):
method test_cifar10_model_fn_predict_mode_v1 (line 129) | def test_cifar10_model_fn_predict_mode_v1(self):
method test_cifar10_model_fn_predict_mode_v2 (line 133) | def test_cifar10_model_fn_predict_mode_v2(self):
method _test_cifar10model_shape (line 137) | def _test_cifar10model_shape(self, resnet_version):
method test_cifar10model_shape_v1 (line 149) | def test_cifar10model_shape_v1(self):
method test_cifar10model_shape_v2 (line 152) | def test_cifar10model_shape_v2(self):
method test_cifar10_end_to_end_synthetic_v1 (line 155) | def test_cifar10_end_to_end_synthetic_v1(self):
method test_cifar10_end_to_end_synthetic_v2 (line 161) | def test_cifar10_end_to_end_synthetic_v2(self):
method test_flag_restriction (line 167) | def test_flag_restriction(self):
FILE: official/resnet/imagenet_main.py
function get_filenames (line 49) | def get_filenames(is_training, data_dir):
function _parse_example_proto (line 61) | def _parse_example_proto(example_serialized):
function parse_record (line 131) | def parse_record(raw_record, is_training):
function input_fn (line 158) | def input_fn(is_training, data_dir, batch_size, num_epochs=1):
function get_synth_input_fn (line 191) | def get_synth_input_fn():
class ImagenetModel (line 199) | class ImagenetModel(resnet_model.Model):
method __init__ (line 202) | def __init__(self, resnet_size, data_format=None, num_classes=_NUM_CLA...
function _get_block_sizes (line 244) | def _get_block_sizes(resnet_size):
function imagenet_model_fn (line 278) | def imagenet_model_fn(features, labels, mode, params):
function define_imagenet_flags (line 302) | def define_imagenet_flags():
function run_imagenet (line 309) | def run_imagenet(flags_obj):
function main (line 323) | def main(_):
FILE: official/resnet/imagenet_preprocessing.py
function _decode_crop_and_flip (line 51) | def _decode_crop_and_flip(image_buffer, bbox, num_channels):
function _central_crop (line 100) | def _central_crop(image, crop_height, crop_width):
function _mean_image_subtraction (line 122) | def _mean_image_subtraction(image, means, num_channels):
function _smallest_size_at_least (line 156) | def _smallest_size_at_least(height, width, resize_min):
function _aspect_preserving_resize (line 187) | def _aspect_preserving_resize(image, resize_min):
function _resize_image (line 206) | def _resize_image(image, height, width):
function preprocess_image (line 226) | def preprocess_image(image_buffer, bbox, output_height, output_width,
FILE: official/resnet/imagenet_test.py
class BaseTest (line 33) | class BaseTest(tf.test.TestCase):
method setUpClass (line 36) | def setUpClass(cls): # pylint: disable=invalid-name
method tearDown (line 40) | def tearDown(self):
method _tensor_shapes_helper (line 44) | def _tensor_shapes_helper(self, resnet_size, resnet_version, dtype, wi...
method tensor_shapes_helper (line 98) | def tensor_shapes_helper(self, resnet_size, resnet_version, with_gpu=F...
method test_tensor_shapes_resnet_18_v1 (line 106) | def test_tensor_shapes_resnet_18_v1(self):
method test_tensor_shapes_resnet_18_v2 (line 109) | def test_tensor_shapes_resnet_18_v2(self):
method test_tensor_shapes_resnet_34_v1 (line 112) | def test_tensor_shapes_resnet_34_v1(self):
method test_tensor_shapes_resnet_34_v2 (line 115) | def test_tensor_shapes_resnet_34_v2(self):
method test_tensor_shapes_resnet_50_v1 (line 118) | def test_tensor_shapes_resnet_50_v1(self):
method test_tensor_shapes_resnet_50_v2 (line 121) | def test_tensor_shapes_resnet_50_v2(self):
method test_tensor_shapes_resnet_101_v1 (line 124) | def test_tensor_shapes_resnet_101_v1(self):
method test_tensor_shapes_resnet_101_v2 (line 127) | def test_tensor_shapes_resnet_101_v2(self):
method test_tensor_shapes_resnet_152_v1 (line 130) | def test_tensor_shapes_resnet_152_v1(self):
method test_tensor_shapes_resnet_152_v2 (line 133) | def test_tensor_shapes_resnet_152_v2(self):
method test_tensor_shapes_resnet_200_v1 (line 136) | def test_tensor_shapes_resnet_200_v1(self):
method test_tensor_shapes_resnet_200_v2 (line 139) | def test_tensor_shapes_resnet_200_v2(self):
method test_tensor_shapes_resnet_18_with_gpu_v1 (line 143) | def test_tensor_shapes_resnet_18_with_gpu_v1(self):
method test_tensor_shapes_resnet_18_with_gpu_v2 (line 147) | def test_tensor_shapes_resnet_18_with_gpu_v2(self):
method test_tensor_shapes_resnet_34_with_gpu_v1 (line 151) | def test_tensor_shapes_resnet_34_with_gpu_v1(self):
method test_tensor_shapes_resnet_34_with_gpu_v2 (line 155) | def test_tensor_shapes_resnet_34_with_gpu_v2(self):
method test_tensor_shapes_resnet_50_with_gpu_v1 (line 159) | def test_tensor_shapes_resnet_50_with_gpu_v1(self):
method test_tensor_shapes_resnet_50_with_gpu_v2 (line 163) | def test_tensor_shapes_resnet_50_with_gpu_v2(self):
method test_tensor_shapes_resnet_101_with_gpu_v1 (line 167) | def test_tensor_shapes_resnet_101_with_gpu_v1(self):
method test_tensor_shapes_resnet_101_with_gpu_v2 (line 171) | def test_tensor_shapes_resnet_101_with_gpu_v2(self):
method test_tensor_shapes_resnet_152_with_gpu_v1 (line 175) | def test_tensor_shapes_resnet_152_with_gpu_v1(self):
method test_tensor_shapes_resnet_152_with_gpu_v2 (line 179) | def test_tensor_shapes_resnet_152_with_gpu_v2(self):
method test_tensor_shapes_resnet_200_with_gpu_v1 (line 183) | def test_tensor_shapes_resnet_200_with_gpu_v1(self):
method test_tensor_shapes_resnet_200_with_gpu_v2 (line 187) | def test_tensor_shapes_resnet_200_with_gpu_v2(self):
method resnet_model_fn_helper (line 190) | def resnet_model_fn_helper(self, mode, resnet_version, dtype):
method test_resnet_model_fn_train_mode_v1 (line 227) | def test_resnet_model_fn_train_mode_v1(self):
method test_resnet_model_fn_train_mode_v2 (line 231) | def test_resnet_model_fn_train_mode_v2(self):
method test_resnet_model_fn_eval_mode_v1 (line 235) | def test_resnet_model_fn_eval_mode_v1(self):
method test_resnet_model_fn_eval_mode_v2 (line 239) | def test_resnet_model_fn_eval_mode_v2(self):
method test_resnet_model_fn_predict_mode_v1 (line 243) | def test_resnet_model_fn_predict_mode_v1(self):
method test_resnet_model_fn_predict_mode_v2 (line 247) | def test_resnet_model_fn_predict_mode_v2(self):
method _test_imagenetmodel_shape (line 251) | def _test_imagenetmodel_shape(self, resnet_version):
method test_imagenetmodel_shape_v1 (line 264) | def test_imagenetmodel_shape_v1(self):
method test_imagenetmodel_shape_v2 (line 267) | def test_imagenetmodel_shape_v2(self):
method test_imagenet_end_to_end_synthetic_v1 (line 270) | def test_imagenet_end_to_end_synthetic_v1(self):
method test_imagenet_end_to_end_synthetic_v2 (line 276) | def test_imagenet_end_to_end_synthetic_v2(self):
method test_imagenet_end_to_end_synthetic_v1_tiny (line 282) | def test_imagenet_end_to_end_synthetic_v1_tiny(self):
method test_imagenet_end_to_end_synthetic_v2_tiny (line 288) | def test_imagenet_end_to_end_synthetic_v2_tiny(self):
method test_imagenet_end_to_end_synthetic_v1_huge (line 294) | def test_imagenet_end_to_end_synthetic_v1_huge(self):
method test_imagenet_end_to_end_synthetic_v2_huge (line 300) | def test_imagenet_end_to_end_synthetic_v2_huge(self):
method test_flag_restriction (line 306) | def test_flag_restriction(self):
FILE: official/resnet/layer_test.py
class BaseTest (line 63) | class BaseTest(reference_data.BaseTest):
method test_name (line 67) | def test_name(self):
method _batch_norm_ops (line 70) | def _batch_norm_ops(self, test=False):
method make_projection (line 88) | def make_projection(self, filters_out, strides, data_format):
method _resnet_block_ops (line 105) | def _resnet_block_ops(self, test, batch_size, bottleneck, projection,
method test_batch_norm (line 169) | def test_batch_norm(self):
method test_block_0 (line 172) | def test_block_0(self):
method test_block_1 (line 175) | def test_block_1(self):
method test_block_2 (line 178) | def test_block_2(self):
method test_block_3 (line 181) | def test_block_3(self):
method test_block_4 (line 184) | def test_block_4(self):
method test_block_5 (line 187) | def test_block_5(self):
method test_block_6 (line 190) | def test_block_6(self):
method test_block_7 (line 193) | def test_block_7(self):
method regenerate (line 196) | def regenerate(self):
FILE: official/resnet/resnet_model.py
function batch_norm (line 47) | def batch_norm(inputs, training, data_format):
function fixed_padding (line 57) | def fixed_padding(inputs, kernel_size, data_format):
function conv2d_fixed_padding (line 84) | def conv2d_fixed_padding(inputs, filters, kernel_size, strides, data_for...
function _building_block_v1 (line 101) | def _building_block_v1(inputs, filters, training, projection_shortcut, s...
function _building_block_v2 (line 148) | def _building_block_v2(inputs, filters, training, projection_shortcut, s...
function _bottleneck_block_v1 (line 194) | def _bottleneck_block_v1(inputs, filters, training, projection_shortcut,
function _bottleneck_block_v2 (line 249) | def _bottleneck_block_v2(inputs, filters, training, projection_shortcut,
function block_layer (line 309) | def block_layer(inputs, filters, bottleneck, block_fn, blocks, strides,
class Model (line 350) | class Model(object):
method __init__ (line 353) | def __init__(self, resnet_size, bottleneck, num_classes, num_filters,
method _custom_dtype_getter (line 429) | def _custom_dtype_getter(self, getter, name, shape=None, dtype=DEFAULT...
method _model_variable_scope (line 470) | def _model_variable_scope(self):
method __call__ (line 483) | def __call__(self, inputs, training):
FILE: official/resnet/resnet_run_loop.py
function process_record_dataset (line 44) | def process_record_dataset(dataset, is_training, batch_size, shuffle_buf...
function get_synth_input_fn (line 96) | def get_synth_input_fn(height, width, num_channels, num_classes):
function learning_rate_with_decay (line 124) | def learning_rate_with_decay(
function resnet_model_fn (line 159) | def resnet_model_fn(features, labels, mode, model_class,
function per_device_batch_size (line 306) | def per_device_batch_size(batch_size, num_gpus):
function resnet_main (line 337) | def resnet_main(
function define_resnet_flags (line 452) | def define_resnet_flags(resnet_size_choices=None):
FILE: official/transformer/compute_bleu.py
class UnicodeRegex (line 40) | class UnicodeRegex(object):
method __init__ (line 43) | def __init__(self):
method property_chars (line 49) | def property_chars(self, prefix):
function bleu_tokenize (line 57) | def bleu_tokenize(string):
function bleu_wrapper (line 87) | def bleu_wrapper(ref_filename, hyp_filename, case_sensitive=False):
function main (line 103) | def main(unused_argv):
function define_compute_bleu_flags (line 113) | def define_compute_bleu_flags():
FILE: official/transformer/compute_bleu_test.py
class ComputeBleuTest (line 25) | class ComputeBleuTest(unittest.TestCase):
method _create_temp_file (line 27) | def _create_temp_file(self, text):
method test_bleu_same (line 33) | def test_bleu_same(self):
method test_bleu_same_different_case (line 42) | def test_bleu_same_different_case(self):
method test_bleu_different (line 50) | def test_bleu_different(self):
method test_bleu_tokenize (line 58) | def test_bleu_tokenize(self):
FILE: official/transformer/data_download.py
function find_file (line 88) | def find_file(path, filename, max_depth=5):
function get_raw_files (line 104) | def get_raw_files(raw_dir, data_source):
function download_report_hook (line 132) | def download_report_hook(count, block_size, total_size):
function download_from_url (line 144) | def download_from_url(path, url):
function download_and_extract (line 171) | def download_and_extract(path, url, input_filename, target_filename):
function txt_line_iterator (line 212) | def txt_line_iterator(path):
function compile_files (line 219) | def compile_files(raw_dir, raw_files, tag):
function write_file (line 250) | def write_file(writer, filename):
function encode_and_save_files (line 260) | def encode_and_save_files(
function shard_filename (line 310) | def shard_filename(path, tag, shard_num, total_shards):
function shuffle_records (line 316) | def shuffle_records(fname):
function dict_to_example (line 343) | def dict_to_example(dictionary):
function all_exist (line 351) | def all_exist(filepaths):
function make_dir (line 359) | def make_dir(path):
function main (line 365) | def main(unused_argv):
function define_data_download_flags (line 400) | def define_data_download_flags():
FILE: official/transformer/model/attention_layer.py
class Attention (line 24) | class Attention(tf.layers.Layer):
method __init__ (line 27) | def __init__(self, hidden_size, num_heads, attention_dropout, train):
method split_heads (line 46) | def split_heads(self, x):
method combine_heads (line 71) | def combine_heads(self, x):
method call (line 86) | def call(self, x, y, bias, cache=None):
class SelfAttention (line 144) | class SelfAttention(Attention):
method call (line 147) | def call(self, x, bias, cache=None):
FILE: official/transformer/model/beam_search.py
class _StateKeys (line 28) | class _StateKeys(object):
class SequenceBeamSearch (line 59) | class SequenceBeamSearch(object):
method __init__ (line 62) | def __init__(self, symbols_to_logits_fn, vocab_size, batch_size,
method search (line 72) | def search(self, initial_ids, initial_cache):
method _create_initial_state (line 96) | def _create_initial_state(self, initial_ids, initial_cache):
method _continue_search (line 164) | def _continue_search(self, state):
method _search_step (line 210) | def _search_step(self, state):
method _grow_alive_seq (line 242) | def _grow_alive_seq(self, state):
method _get_new_alive_state (line 304) | def _get_new_alive_state(self, new_seq, new_log_probs, new_cache):
method _get_new_finished_state (line 334) | def _get_new_finished_state(self, state, new_seq, new_log_probs):
function sequence_beam_search (line 386) | def sequence_beam_search(
function _log_prob_from_logits (line 419) | def _log_prob_from_logits(logits):
function _length_normalization (line 423) | def _length_normalization(alpha, length):
function _expand_to_beam_size (line 428) | def _expand_to_beam_size(tensor, beam_size):
function _shape_list (line 445) | def _shape_list(tensor):
function _get_shape_keep_last_dim (line 458) | def _get_shape_keep_last_dim(tensor):
function _flatten_beam_dim (line 470) | def _flatten_beam_dim(tensor):
function _unflatten_beam_dim (line 485) | def _unflatten_beam_dim(tensor, batch_size, beam_size):
function _gather_beams (line 501) | def _gather_beams(nested, beam_indices, batch_size, new_beam_size):
function _gather_topk_beams (line 538) | def _gather_topk_beams(nested, score_or_log_prob, batch_size, beam_size):
FILE: official/transformer/model/beam_search_test.py
class BeamSearchHelperTests (line 26) | class BeamSearchHelperTests(tf.test.TestCase):
method test_expand_to_beam_size (line 28) | def test_expand_to_beam_size(self):
method test_shape_list (line 35) | def test_shape_list(self):
method test_get_shape_keep_last_dim (line 44) | def test_get_shape_keep_last_dim(self):
method test_flatten_beam_dim (line 51) | def test_flatten_beam_dim(self):
method test_unflatten_beam_dim (line 58) | def test_unflatten_beam_dim(self):
method test_gather_beams (line 65) | def test_gather_beams(self):
method test_gather_topk_beams (line 85) | def test_gather_topk_beams(self):
FILE: official/transformer/model/embedding_layer.py
class EmbeddingSharedWeights (line 26) | class EmbeddingSharedWeights(tf.layers.Layer):
method __init__ (line 29) | def __init__(self, vocab_size, hidden_size):
method build (line 34) | def build(self, _):
method call (line 45) | def call(self, x):
method linear (line 69) | def linear(self, x):
FILE: official/transformer/model/ffn_layer.py
class FeedFowardNetwork (line 24) | class FeedFowardNetwork(tf.layers.Layer):
method __init__ (line 27) | def __init__(self, hidden_size, filter_size, relu_dropout, train):
method call (line 39) | def call(self, x, padding=None):
FILE: official/transformer/model/model_params.py
class TransformerBaseParams (line 18) | class TransformerBaseParams(object):
class TransformerBigParams (line 54) | class TransformerBigParams(TransformerBaseParams):
FILE: official/transformer/model/model_utils.py
function get_position_encoding (line 28) | def get_position_encoding(
function get_decoder_self_attention_bias (line 57) | def get_decoder_self_attention_bias(length):
function get_padding (line 77) | def get_padding(x, padding_value=0):
function get_padding_bias (line 92) | def get_padding_bias(x):
FILE: official/transformer/model/model_utils_test.py
class ModelUtilsTest (line 28) | class ModelUtilsTest(tf.test.TestCase):
method test_get_padding (line 30) | def test_get_padding(self):
method test_get_padding_bias (line 39) | def test_get_padding_bias(self):
method test_get_decoder_self_attention_bias (line 53) | def test_get_decoder_self_attention_bias(self):
FILE: official/transformer/model/transformer.py
class Transformer (line 37) | class Transformer(object):
method __init__ (line 48) | def __init__(self, params, train):
method __call__ (line 64) | def __call__(self, inputs, targets=None):
method encode (line 100) | def encode(self, inputs, attention_bias):
method decode (line 128) | def decode(self, targets, encoder_outputs, attention_bias):
method _get_symbols_to_logits_fn (line 166) | def _get_symbols_to_logits_fn(self, max_decode_length):
method predict (line 205) | def predict(self, encoder_outputs, encoder_decoder_attention_bias):
class LayerNormalization (line 245) | class LayerNormalization(tf.layers.Layer):
method __init__ (line 248) | def __init__(self, hidden_size):
method build (line 252) | def build(self, _):
method call (line 259) | def call(self, x, epsilon=1e-6):
class PrePostProcessingWrapper (line 266) | class PrePostProcessingWrapper(object):
method __init__ (line 269) | def __init__(self, layer, params, train):
method __call__ (line 277) | def __call__(self, x, *args, **kwargs):
class EncoderStack (line 290) | class EncoderStack(tf.layers.Layer):
method __init__ (line 299) | def __init__(self, params, train):
method call (line 316) | def call(self, encoder_inputs, attention_bias, inputs_padding):
class DecoderStack (line 343) | class DecoderStack(tf.layers.Layer):
method __init__ (line 354) | def __init__(self, params, train):
method call (line 372) | def call(self, decoder_inputs, encoder_outputs, decoder_self_attention...
FILE: official/transformer/transformer_main.py
function model_fn (line 64) | def model_fn(features, labels, mode, params):
function get_learning_rate (line 103) | def get_learning_rate(learning_rate, hidden_size, learning_rate_warmup_s...
function get_train_op (line 125) | def get_train_op(loss, params):
function translate_and_compute_bleu (line 155) | def translate_and_compute_bleu(estimator, subtokenizer, bleu_source, ble...
function get_global_step (line 172) | def get_global_step(estimator):
function evaluate_and_log_bleu (line 177) | def evaluate_and_log_bleu(estimator, bleu_source, bleu_ref, vocab_file_p...
function train_schedule (line 189) | def train_schedule(
function define_transformer_flags (line 315) | def define_transformer_flags():
function run_transformer (line 407) | def run_transformer(flags_obj):
function main (line 463) | def main(_):
FILE: official/transformer/translate.py
function _get_sorted_inputs (line 41) | def _get_sorted_inputs(filename):
function _encode_and_add_eos (line 67) | def _encode_and_add_eos(line, subtokenizer):
function _trim_and_decode (line 72) | def _trim_and_decode(ids, subtokenizer):
function translate_file (line 81) | def translate_file(
function translate_text (line 141) | def translate_text(estimator, subtokenizer, txt):
function main (line 156) | def main(unused_argv):
function define_translate_flags (line 197) | def define_translate_flags():
FILE: official/transformer/utils/dataset.py
function _load_records (line 70) | def _load_records(filename):
function _parse_example (line 75) | def _parse_example(serialized_example):
function _filter_max_length (line 87) | def _filter_max_length(example, max_length=256):
function _get_example_length (line 93) | def _get_example_length(example):
function _create_min_max_boundaries (line 99) | def _create_min_max_boundaries(
function _batch_examples (line 131) | def _batch_examples(dataset, batch_size, max_length):
function _read_and_batch_from_files (line 192) | def _read_and_batch_from_files(
function train_input_fn (line 237) | def train_input_fn(params):
function eval_input_fn (line 245) | def eval_input_fn(params):
FILE: official/transformer/utils/metrics.py
function _pad_tensors_to_same_length (line 39) | def _pad_tensors_to_same_length(x, y):
function padded_cross_entropy_loss (line 52) | def padded_cross_entropy_loss(logits, labels, smoothing, vocab_size):
function _convert_to_eval_metric (line 90) | def _convert_to_eval_metric(metric_fn):
function get_eval_metrics (line 112) | def get_eval_metrics(logits, labels, params):
function padded_accuracy (line 133) | def padded_accuracy(logits, labels):
function padded_accuracy_topk (line 143) | def padded_accuracy_topk(logits, labels, k):
function padded_accuracy_top5 (line 159) | def padded_accuracy_top5(logits, labels):
function padded_sequence_accuracy (line 163) | def padded_sequence_accuracy(logits, labels):
function padded_neg_log_perplexity (line 176) | def padded_neg_log_perplexity(logits, labels, vocab_size):
function bleu_score (line 182) | def bleu_score(logits, labels):
function _get_ngrams_with_counter (line 202) | def _get_ngrams_with_counter(segment, max_order):
function compute_bleu (line 222) | def compute_bleu(reference_corpus, translation_corpus, max_order=4,
function rouge_2_fscore (line 288) | def rouge_2_fscore(logits, labels):
function _get_ngrams (line 307) | def _get_ngrams(n, text):
function rouge_n (line 325) | def rouge_n(eval_sentences, ref_sentences, n=2):
function rouge_l_fscore (line 365) | def rouge_l_fscore(predictions, labels):
function rouge_l_sentence_level (line 384) | def rouge_l_sentence_level(eval_sentences, ref_sentences):
function _len_lcs (line 418) | def _len_lcs(x, y):
function _lcs (line 435) | def _lcs(x, y):
function _f_lcs (line 462) | def _f_lcs(llcs, m, n):
FILE: official/transformer/utils/tokenizer.py
class Subtokenizer (line 61) | class Subtokenizer(object):
method __init__ (line 64) | def __init__(self, vocab_file, reserved_tokens=None):
method init_from_files (line 84) | def init_from_files(
method encode (line 123) | def encode(self, raw_string, add_eos=False):
method _token_to_subtoken_ids (line 133) | def _token_to_subtoken_ids(self, token):
method decode (line 148) | def decode(self, subtokens):
method _subtoken_ids_to_tokens (line 164) | def _subtoken_ids_to_tokens(self, subtokens):
function _save_vocab_file (line 180) | def _save_vocab_file(vocab_file, subtoken_list):
function _load_vocab_file (line 187) | def _load_vocab_file(vocab_file, reserved_tokens=None):
function _native_to_unicode (line 203) | def _native_to_unicode(s):
function _unicode_to_native (line 211) | def _unicode_to_native(s):
function _split_string_to_tokens (line 219) | def _split_string_to_tokens(text):
function _join_tokens_to_string (line 238) | def _join_tokens_to_string(tokens):
function _escape_token (line 249) | def _escape_token(token, alphabet):
function _unescape_token (line 270) | def _unescape_token(token):
function _count_tokens (line 325) | def _count_tokens(files, file_byte_limit=1e6):
function _list_to_index_dict (line 362) | def _list_to_index_dict(lst):
function _split_token_to_subtokens (line 367) | def _split_token_to_subtokens(token, subtoken_dict, max_subtoken_length):
function _generate_subtokens_with_target_vocab_size (line 389) | def _generate_subtokens_with_target_vocab_size(
function _generate_alphabet_dict (line 433) | def _generate_alphabet_dict(iterable, reserved_tokens=None):
function _count_and_gen_subtokens (line 443) | def _count_and_gen_subtokens(
function _filter_and_bucket_subtokens (line 476) | def _filter_and_bucket_subtokens(subtoken_counts, min_count):
function _gen_new_subtoken_list (line 497) | def _gen_new_subtoken_list(
function _generate_subtokens (line 569) | def _generate_subtokens(
FILE: official/transformer/utils/tokenizer_test.py
class SubtokenizerTest (line 26) | class SubtokenizerTest(unittest.TestCase):
method _init_subtokenizer (line 28) | def _init_subtokenizer(self, vocab_list):
method test_encode (line 36) | def test_encode(self):
method test_decode (line 43) | def test_decode(self):
method test_subtoken_ids_to_tokens (line 50) | def test_subtoken_ids_to_tokens(self):
class StringHelperTest (line 58) | class StringHelperTest(unittest.TestCase):
method test_split_string_to_tokens (line 60) | def test_split_string_to_tokens(self):
method test_join_tokens_to_string (line 66) | def test_join_tokens_to_string(self):
method test_escape_token (line 72) | def test_escape_token(self):
method test_unescape_token (line 79) | def test_unescape_token(self):
method test_list_to_index_dict (line 86) | def test_list_to_index_dict(self):
method test_split_token_to_subtokens (line 92) | def test_split_token_to_subtokens(self):
method test_generate_alphabet_dict (line 101) | def test_generate_alphabet_dict(self):
method test_count_and_gen_subtokens (line 117) | def test_count_and_gen_subtokens(self):
method test_filter_and_bucket_subtokens (line 131) | def test_filter_and_bucket_subtokens(self):
method test_gen_new_subtoken_list (line 145) | def test_gen_new_subtoken_list(self):
method test_generate_subtokens (line 164) | def test_generate_subtokens(self):
FILE: official/utils/export/export.py
function build_tensor_serving_input_receiver_fn (line 24) | def build_tensor_serving_input_receiver_fn(shape, dtype=tf.float32,
FILE: official/utils/export/export_test.py
class ExportUtilsTest (line 26) | class ExportUtilsTest(tf.test.TestCase):
method test_build_tensor_serving_input_receiver_fn (line 29) | def test_build_tensor_serving_input_receiver_fn(self):
method test_build_tensor_serving_input_receiver_fn_batch_dtype (line 44) | def test_build_tensor_serving_input_receiver_fn_batch_dtype(self):
FILE: official/utils/flags/_base.py
function define_base (line 28) | def define_base(data_dir=True, model_dir=True, train_epochs=True,
function get_num_gpus (line 133) | def get_num_gpus(flags_obj):
FILE: official/utils/flags/_benchmark.py
function define_benchmark (line 26) | def define_benchmark(benchmark_log_dir=True, bigquery_uploader=True):
FILE: official/utils/flags/_misc.py
function define_image (line 26) | def define_image(data_format=True):
FILE: official/utils/flags/_performance.py
function get_tf_dtype (line 36) | def get_tf_dtype(flags_obj):
function get_loss_scale (line 40) | def get_loss_scale(flags_obj):
function define_performance (line 46) | def define_performance(num_parallel_calls=True, inter_op=True, intra_op=...
FILE: official/utils/flags/core.py
function set_defaults (line 37) | def set_defaults(**kwargs):
function parse_flags (line 42) | def parse_flags(argv=None):
function register_key_flags_in_core (line 48) | def register_key_flags_in_core(f):
FILE: official/utils/flags/flags_test.py
function define_flags (line 24) | def define_flags():
class BaseTester (line 31) | class BaseTester(unittest.TestCase):
method setUpClass (line 34) | def setUpClass(cls):
method test_default_setting (line 38) | def test_default_setting(self):
method test_benchmark_setting (line 61) | def test_benchmark_setting(self):
method test_booleans (line 74) | def test_booleans(self):
method test_parse_dtype_info (line 83) | def test_parse_dtype_info(self):
FILE: official/utils/logs/hooks.py
class ExamplesPerSecondHook (line 28) | class ExamplesPerSecondHook(tf.train.SessionRunHook):
method __init__ (line 37) | def __init__(self,
method begin (line 77) | def begin(self):
method before_run (line 84) | def before_run(self, run_context): # pylint: disable=unused-argument
method after_run (line 95) | def after_run(self, run_context, run_values): # pylint: disable=unuse...
FILE: official/utils/logs/hooks_helper.py
function get_train_hooks (line 38) | def get_train_hooks(name_list, **kwargs):
function get_logging_tensor_hook (line 68) | def get_logging_tensor_hook(every_n_iter=100, tensors_to_log=None, **kwa...
function get_profiler_hook (line 90) | def get_profiler_hook(save_steps=1000, **kwargs): # pylint: disable=unu...
function get_examples_per_second_hook (line 104) | def get_examples_per_second_hook(every_n_steps=100,
function get_logging_metric_hook (line 127) | def get_logging_metric_hook(tensors_to_log=None,
FILE: official/utils/logs/hooks_helper_test.py
class BaseTest (line 29) | class BaseTest(unittest.TestCase):
method test_raise_in_non_list_names (line 31) | def test_raise_in_non_list_names(self):
method test_raise_in_invalid_names (line 36) | def test_raise_in_invalid_names(self):
method validate_train_hook_name (line 41) | def validate_train_hook_name(self,
method test_get_train_hooks_logging_tensor_hook (line 51) | def test_get_train_hooks_logging_tensor_hook(self):
method test_get_train_hooks_profiler_hook (line 54) | def test_get_train_hooks_profiler_hook(self):
method test_get_train_hooks_examples_per_second_hook (line 57) | def test_get_train_hooks_examples_per_second_hook(self):
method test_get_logging_metric_hook (line 61) | def test_get_logging_metric_hook(self):
FILE: official/utils/logs/hooks_test.py
class ExamplesPerSecondHookTest (line 32) | class ExamplesPerSecondHookTest(tf.test.TestCase):
method setUp (line 45) | def setUp(self):
method test_raise_in_both_secs_and_steps (line 55) | def test_raise_in_both_secs_and_steps(self):
method test_raise_in_none_secs_and_steps (line 63) | def test_raise_in_none_secs_and_steps(self):
method _validate_log_every_n_steps (line 71) | def _validate_log_every_n_steps(self, every_n_steps, warm_steps):
method test_examples_per_sec_every_1_steps (line 109) | def test_examples_per_sec_every_1_steps(self):
method test_examples_per_sec_every_5_steps (line 113) | def test_examples_per_sec_every_5_steps(self):
method test_examples_per_sec_every_1_steps_with_warm_steps (line 117) | def test_examples_per_sec_every_1_steps_with_warm_steps(self):
method test_examples_per_sec_every_5_steps_with_warm_steps (line 121) | def test_examples_per_sec_every_5_steps_with_warm_steps(self):
method _validate_log_every_n_secs (line 125) | def _validate_log_every_n_secs(self, every_n_secs):
method test_examples_per_sec_every_1_secs (line 146) | def test_examples_per_sec_every_1_secs(self):
method test_examples_per_sec_every_5_secs (line 150) | def test_examples_per_sec_every_5_secs(self):
method _assert_metrics (line 154) | def _assert_metrics(self):
FILE: official/utils/logs/logger.py
function config_benchmark_logger (line 49) | def config_benchmark_logger(flag_obj=None):
function get_benchmark_logger (line 80) | def get_benchmark_logger():
class BaseBenchmarkLogger (line 86) | class BaseBenchmarkLogger(object):
method log_evaluation_result (line 89) | def log_evaluation_result(self, eval_results):
method log_metric (line 108) | def log_metric(self, name, value, unit=None, global_step=None, extras=...
method log_run_info (line 126) | def log_run_info(self, model_name, dataset_name, run_params):
class BenchmarkFileLogger (line 131) | class BenchmarkFileLogger(BaseBenchmarkLogger):
method __init__ (line 134) | def __init__(self, logging_dir):
method log_metric (line 140) | def log_metric(self, name, value, unit=None, global_step=None, extras=...
method log_run_info (line 165) | def log_run_info(self, model_name, dataset_name, run_params):
class BenchmarkBigQueryLogger (line 188) | class BenchmarkBigQueryLogger(BaseBenchmarkLogger):
method __init__ (line 191) | def __init__(self,
method log_metric (line 204) | def log_metric(self, name, value, unit=None, global_step=None, extras=...
method log_run_info (line 228) | def log_run_info(self, model_name, dataset_name, run_params):
function _gather_run_info (line 251) | def _gather_run_info(model_name, dataset_name, run_params):
function _process_metric_to_json (line 268) | def _process_metric_to_json(
function _collect_tensorflow_info (line 287) | def _collect_tensorflow_info(run_info):
function _collect_run_params (line 292) | def _collect_run_params(run_info, run_params):
function _collect_tensorflow_environment_variables (line 308) | def _collect_tensorflow_environment_variables(run_info):
function _collect_cpu_info (line 316) | def _collect_cpu_info(run_info):
function _collect_gpu_info (line 336) | def _collect_gpu_info(run_info):
function _collect_memory_info (line 354) | def _collect_memory_info(run_info):
function _parse_gpu_model (line 366) | def _parse_gpu_model(physical_device_desc):
function _convert_to_json_dict (line 375) | def _convert_to_json_dict(input_dict):
FILE: official/utils/logs/logger_test.py
class BenchmarkLoggerTest (line 41) | class BenchmarkLoggerTest(tf.test.TestCase):
method setUpClass (line 44) | def setUpClass(cls): # pylint: disable=invalid-name
method test_get_default_benchmark_logger (line 48) | def test_get_default_benchmark_logger(self):
method test_config_base_benchmark_logger (line 53) | def test_config_base_benchmark_logger(self):
method test_config_benchmark_file_logger (line 59) | def test_config_benchmark_file_logger(self):
method test_config_benchmark_bigquery_logger (line 69) | def test_config_benchmark_bigquery_logger(self):
class BaseBenchmarkLoggerTest (line 76) | class BaseBenchmarkLoggerTest(tf.test.TestCase):
method setUp (line 78) | def setUp(self):
method tearDown (line 89) | def tearDown(self):
method test_log_metric (line 93) | def test_log_metric(self):
class BenchmarkFileLoggerTest (line 101) | class BenchmarkFileLoggerTest(tf.test.TestCase):
method setUp (line 103) | def setUp(self):
method tearDown (line 111) | def tearDown(self):
method test_create_logging_dir (line 117) | def test_create_logging_dir(self):
method test_log_metric (line 124) | def test_log_metric(self):
method test_log_multiple_metrics (line 139) | def test_log_multiple_metrics(self):
method test_log_non_number_value (line 162) | def test_log_non_number_value(self):
method test_log_evaluation_result (line 171) | def test_log_evaluation_result(self):
method test_log_evaluation_result_with_invalid_type (line 194) | def test_log_evaluation_result_with_invalid_type(self):
method test_collect_tensorflow_info (line 203) | def test_collect_tensorflow_info(self):
method test_collect_run_params (line 210) | def test_collect_run_params(self):
method test_collect_tensorflow_environment_variables (line 236) | def test_collect_tensorflow_environment_variables(self):
method test_collect_gpu_info (line 252) | def test_collect_gpu_info(self):
method test_collect_memory_info (line 257) | def test_collect_memory_info(self):
class BenchmarkBigQueryLoggerTest (line 265) | class BenchmarkBigQueryLoggerTest(tf.test.TestCase):
method setUp (line 267) | def setUp(self):
method tearDown (line 280) | def tearDown(self):
method test_log_metric (line 286) | def test_log_metric(self):
FILE: official/utils/logs/metric_hook.py
class LoggingMetricHook (line 24) | class LoggingMetricHook(tf.train.LoggingTensorHook):
method __init__ (line 36) | def __init__(self, tensors, metric_logger=None,
method begin (line 69) | def begin(self):
method after_run (line 79) | def after_run(self, unused_run_context, run_values):
method end (line 87) | def end(self, session):
method _log_metric (line 92) | def _log_metric(self, tensor_values):
FILE: official/utils/logs/metric_hook_test.py
class LoggingMetricHookTest (line 31) | class LoggingMetricHookTest(tf.test.TestCase):
method setUp (line 34) | def setUp(self):
method tearDown (line 40) | def tearDown(self):
method test_illegal_args (line 44) | def test_illegal_args(self):
method test_print_at_end_only (line 57) | def test_print_at_end_only(self):
method test_global_step_not_found (line 80) | def test_global_step_not_found(self):
method test_log_tensors (line 90) | def test_log_tensors(self):
method _validate_print_every_n_steps (line 120) | def _validate_print_every_n_steps(self, sess, at_end):
method test_print_every_n_steps (line 155) | def test_print_every_n_steps(self):
method test_print_every_n_steps_and_end (line 162) | def test_print_every_n_steps_and_end(self):
method _validate_print_every_n_secs (line 169) | def _validate_print_every_n_secs(self, sess, at_end):
method test_print_every_n_secs (line 201) | def test_print_every_n_secs(self):
method test_print_every_n_secs_and_end (line 208) | def test_print_every_n_secs_and_end(self):
FILE: official/utils/misc/model_helpers.py
function past_stop_threshold (line 26) | def past_stop_threshold(stop_threshold, eval_metric):
FILE: official/utils/misc/model_helpers_test.py
class PastStopThresholdTest (line 26) | class PastStopThresholdTest(tf.test.TestCase):
method test_past_stop_threshold (line 29) | def test_past_stop_threshold(self):
method test_past_stop_threshold_none_false (line 39) | def test_past_stop_threshold_none_false(self):
method test_past_stop_threshold_not_number (line 47) | def test_past_stop_threshold_not_number(self):
FILE: official/utils/testing/integration.py
function run_synthetic (line 32) | def run_synthetic(main, tmp_root, extra_flags=None, synth=True, max_trai...
FILE: official/utils/testing/mock_lib.py
class MockBenchmarkLogger (line 23) | class MockBenchmarkLogger(object):
method __init__ (line 26) | def __init__(self):
method log_metric (line 29) | def log_metric(self, name, value, unit=None, global_step=None,
FILE: official/utils/testing/reference_data.py
class BaseTest (line 62) | class BaseTest(tf.test.TestCase):
method regenerate (line 65) | def regenerate(self):
method test_name (line 70) | def test_name(self):
method data_root (line 75) | def data_root(self):
method name_to_seed (line 87) | def name_to_seed(name):
method common_tensor_properties (line 105) | def common_tensor_properties(input_array):
method default_correctness_function (line 126) | def default_correctness_function(self, *args):
method _construct_and_save_reference_files (line 145) | def _construct_and_save_reference_files(
method _evaluate_test_case (line 200) | def _evaluate_test_case(self, name, graph, ops_to_eval, correctness_fu...
method _save_or_test_ops (line 269) | def _save_or_test_ops(self, name, graph, ops_to_eval=None, test=True,
class ReferenceDataActionParser (line 310) | class ReferenceDataActionParser(argparse.ArgumentParser):
method __init__ (line 313) | def __init__(self):
function main (line 323) | def main(argv, test_class):
FILE: official/utils/testing/reference_data_test.py
class GoldenBaseTest (line 38) | class GoldenBaseTest(reference_data.BaseTest):
method test_name (line 42) | def test_name(self):
method _uniform_random_ops (line 45) | def _uniform_random_ops(self, test=False, wrong_name=False, wrong_shap...
method _dense_ops (line 84) | def _dense_ops(self, test=False):
method test_uniform_random (line 102) | def test_uniform_random(self):
method test_tensor_name_error (line 105) | def test_tensor_name_error(self):
method test_tensor_shape_error (line 109) | def test_tensor_shape_error(self):
method test_bad_seed (line 115) | def test_bad_seed(self):
method test_incorrectness_function (line 120) | def test_incorrectness_function(self):
method test_dense (line 124) | def test_dense(self):
method regenerate (line 127) | def regenerate(self):
FILE: official/wide_deep/data_download.py
function _download_and_clean_file (line 41) | def _download_and_clean_file(filename, url):
function main (line 58) | def main(_):
FILE: official/wide_deep/wide_deep.py
function define_wide_deep_flags (line 52) | def define_wide_deep_flags():
function build_model_columns (line 71) | def build_model_columns():
function build_estimator (line 141) | def build_estimator(model_dir, model_type):
function input_fn (line 171) | def input_fn(data_file, num_epochs, shuffle, batch_size):
function export_model (line 199) | def export_model(model, model_type, export_dir):
function run_wide_deep (line 220) | def run_wide_deep(flags_obj):
function main (line 282) | def main(_):
FILE: official/wide_deep/wide_deep_test.py
class BaseTest (line 48) | class BaseTest(tf.test.TestCase):
method setUpClass (line 52) | def setUpClass(cls): # pylint: disable=invalid-name
method setUp (line 56) | def setUp(self):
method test_input_fn (line 71) | def test_input_fn(self):
method build_and_test_estimator (line 92) | def build_and_test_estimator(self, model_type):
method test_wide_deep_estimator_training (line 121) | def test_wide_deep_estimator_training(self):
method test_end_to_end_wide (line 124) | def test_end_to_end_wide(self):
method test_end_to_end_deep (line 132) | def test_end_to_end_deep(self):
method test_end_to_end_wide_deep (line 140) | def test_end_to_end_wide_deep(self):
FILE: projects/ai2018/binary/algos/loss.py
function calc_loss (line 29) | def calc_loss(y, y_, weights, training=False):
function calc_hier_loss (line 80) | def calc_hier_loss(y, y_, weights):
function calc_hier_neu_loss (line 93) | def calc_hier_neu_loss(y, y_, weights):
function calc_add_binary_loss (line 114) | def calc_add_binary_loss(y, y_, cids, weights):
function calc_binary_loss (line 124) | def calc_binary_loss(y, y_, cid, weights):
function calc_regression_loss (line 129) | def calc_regression_loss(y, y_, weights):
function calc_add_binaries_loss (line 133) | def calc_add_binaries_loss(y, y_, cid, weights):
function calc_binaries_only_loss (line 142) | def calc_binaries_only_loss(y, y_, cid, weights):
function criterion (line 155) | def criterion(model, x, y, training=False):
FILE: projects/ai2018/binary/algos/model.py
class ModelBase (line 38) | class ModelBase(melt.Model):
method __init__ (line 39) | def __init__(self, embedding=None, lm_model=False, use_text_encoder=Tr...
method unk_aug (line 134) | def unk_aug(self, x, x_mask=None, training=False):
class BiLanguageModel (line 167) | class BiLanguageModel(ModelBase):
method __init__ (line 168) | def __init__(self, embedding=None, lm_model=True):
method call (line 171) | def call(self, input, training=False):
class RNet (line 174) | class RNet(ModelBase):
method __init__ (line 175) | def __init__(self, embedding=None, lm_model=False):
method call (line 202) | def call(self, input, training=False):
class RNetV2 (line 270) | class RNetV2(RNet):
method __init__ (line 271) | def __init__(self, embedding=None, lm_model=False):
method call (line 301) | def call(self, input, training=False):
class RNetV3 (line 364) | class RNetV3(RNet):
method __init__ (line 365) | def __init__(self, embedding=None):
class RNetV4 (line 391) | class RNetV4(RNet):
method __init__ (line 392) | def __init__(self, embedding=None):
class MReader (line 418) | class MReader(ModelBase):
method __init__ (line 419) | def __init__(self, embedding=None):
method call (line 451) | def call(self, input, training=False):
class Transformer (line 505) | class Transformer(ModelBase):
method __init__ (line 506) | def __init__(self, embedding=None):
method restore (line 550) | def restore(self):
method call (line 566) | def call(self, input, training=False):
FILE: projects/ai2018/binary/algos/weights.py
function no_weights (line 28) | def no_weights():
function get_pos (line 31) | def get_pos(aspect):
function parse_weights (line 63) | def parse_weights():
function get_weights (line 82) | def get_weights(aspect, attr_index=None):
FILE: projects/ai2018/binary/dataset.py
class Dataset (line 34) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 35) | def __init__(self, subset='train'):
method parser (line 38) | def parser(self, example):
FILE: projects/ai2018/binary/evaluate.py
function init (line 58) | def init():
function calc_loss (line 69) | def calc_loss(labels, predicts):
function calc_auc (line 80) | def calc_auc(labels, predicts):
function evaluate (line 90) | def evaluate(labels, predicts):
FILE: projects/ai2018/binary/prepare/gen-records.py
function get_mode (line 84) | def get_mode(path):
function build_features (line 110) | def build_features(index):
function main (line 211) | def main(_):
FILE: projects/ai2018/binary/prepare/text2ids.py
function text2ids (line 31) | def text2ids(text, preprocess=True, return_words=False):
FILE: projects/ai2018/binary/read-records.py
function deal (line 52) | def deal(dataset, infos):
function main (line 64) | def main(_):
FILE: projects/ai2018/binary/torch-train.py
function main (line 38) | def main(_):
FILE: projects/ai2018/binary/torch_algos/loss.py
class Criterion (line 30) | class Criterion(object):
method __init__ (line 31) | def __init__(self):
method forward (line 34) | def forward(self, model, x, y, training=False):
FILE: projects/ai2018/binary/torch_algos/model.py
class ModelBase (line 35) | class ModelBase(nn.Module):
method __init__ (line 36) | def __init__(self, embedding=None, lm_model=False):
method unk_aug (line 108) | def unk_aug(self, x, x_mask=None):
class BiLanguageModel (line 128) | class BiLanguageModel(ModelBase):
method __init__ (line 129) | def __init__(self, embedding=None):
class RNet (line 134) | class RNet(ModelBase):
method __init__ (line 135) | def __init__(self, embedding=None):
method forward (line 181) | def forward(self, input, training=False):
class MReader (line 215) | class MReader(ModelBase):
method __init__ (line 216) | def __init__(self, embedding=None):
method forward (line 270) | def forward(self, input, training=False):
FILE: projects/ai2018/reader/algos/baseline.py
class Model (line 30) | class Model(melt.Model):
method __init__ (line 31) | def __init__(self):
method call (line 57) | def call(self, input, training=False):
class Model2 (line 85) | class Model2(melt.Model):
method __init__ (line 89) | def __init__(self):
method call (line 114) | def call(self, input, training=False):
FILE: projects/ai2018/reader/algos/loss.py
function criterion (line 29) | def criterion(model, x, y, training=False):
FILE: projects/ai2018/reader/algos/m_reader.py
class MnemonicReaderV4 (line 31) | class MnemonicReaderV4(melt.Model):
method __init__ (line 32) | def __init__(self):
method call (line 122) | def call(self, input, training=False):
class MnemonicReader (line 244) | class MnemonicReader(melt.Model):
method __init__ (line 245) | def __init__(self):
method call (line 334) | def call(self, input, training=False):
class MnemonicReaderV2 (line 464) | class MnemonicReaderV2(melt.Model):
method __init__ (line 465) | def __init__(self):
method call (line 544) | def call(self, input, training=False):
class MnemonicReaderV1 (line 658) | class MnemonicReaderV1(melt.Model):
method __init__ (line 659) | def __init__(self):
method call (line 738) | def call(self, input, training=False):
FILE: projects/ai2018/reader/algos/qcatt.py
class QCAttention (line 30) | class QCAttention(melt.Model):
method __init__ (line 31) | def __init__(self):
method call (line 57) | def call(self, input, training=False):
FILE: projects/ai2018/reader/algos/rnet.py
class RNet (line 31) | class RNet(melt.Model):
method __init__ (line 32) | def __init__(self):
method call (line 99) | def call(self, input, training=False):
FILE: projects/ai2018/reader/dataset.py
class Dataset (line 33) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 34) | def __init__(self, subset='train'):
method parser (line 47) | def parser(self, example):
FILE: projects/ai2018/reader/ensemble/ensemble-infer.py
function parse (line 26) | def parse(input):
FILE: projects/ai2018/reader/ensemble/ensemble-valid.py
function parse (line 26) | def parse(input):
FILE: projects/ai2018/reader/ensemble/ensemble.py
function parse (line 38) | def parse(input):
function blend_weights (line 41) | def blend_weights(weights, norm_factor=0.1):
function main (line 52) | def main(_):
FILE: projects/ai2018/reader/evaluate.py
function init (line 44) | def init():
function calc_acc (line 89) | def calc_acc(labels, predicts, ids, model_path):
function calc_loss (line 121) | def calc_loss(labels, predicts, ids, model_path=None):
function evaluate (line 155) | def evaluate(labels, predicts, ids=None, model_path=None):
function write (line 170) | def write(id, label, predict, out, out2=None, is_infer=False):
function valid_write (line 191) | def valid_write(id, label, predict, out):
function infer_write (line 194) | def infer_write(id, predict, out, out_debug):
FILE: projects/ai2018/reader/infer.py
function main (line 44) | def main(_):
FILE: projects/ai2018/reader/prepare.v1/gen-records.py
function get_mode (line 49) | def get_mode(path):
function is_negative (line 61) | def is_negative(candidate):
function sort_alternatives (line 69) | def sort_alternatives(alternatives, query):
function build_features (line 196) | def build_features(file_):
function main (line 308) | def main(_):
FILE: projects/ai2018/reader/prepare.v1/gen-seg.py
function seg (line 41) | def seg(text):
FILE: projects/ai2018/reader/prepare.v1/merge-emb.py
function main (line 37) | def main(_):
FILE: projects/ai2018/reader/prepare.v1/text2ids.py
function text2ids (line 32) | def text2ids(text):
FILE: projects/ai2018/reader/prepare/gen-records.py
function get_mode (line 54) | def get_mode(path):
function is_negative (line 66) | def is_negative(candidate):
function sort_alternatives (line 74) | def sort_alternatives(alternatives, query):
function get_char_ids (line 201) | def get_char_ids(words):
function get_pos_ids (line 226) | def get_pos_ids(pos):
function build_features (line 235) | def build_features(file_):
function main (line 420) | def main(_):
FILE: projects/ai2018/reader/prepare/gen-seg.py
function seg (line 42) | def seg(text):
FILE: projects/ai2018/reader/prepare/merge-emb.py
function main (line 41) | def main(_):
FILE: projects/ai2018/reader/prepare/pre-seg.py
function seg_ (line 61) | def seg_(text):
function seg (line 85) | def seg(m, out):
FILE: projects/ai2018/reader/read-records.py
function deal (line 48) | def deal(dataset, infos):
function main (line 60) | def main(_):
FILE: projects/ai2018/reader/tools/ensemble-infer.py
function parse (line 26) | def parse(input):
FILE: projects/ai2018/reader/tools/ensemble-valid.py
function parse (line 26) | def parse(input):
FILE: projects/ai2018/reader/torch-train.py
function get_num_finetune_words (line 37) | def get_num_finetune_words():
function freeze_embedding (line 44) | def freeze_embedding(self, grad_input, grad_output):
function freeze_char_embedding (line 48) | def freeze_char_embedding(self, grad_input, grad_output):
function main (line 51) | def main(_):
FILE: projects/ai2018/reader/torch_algos/baseline/baseline.py
class Bow (line 21) | class Bow(nn.Module):
method __init__ (line 22) | def __init__(self):
method forward (line 43) | def forward(self, input, training=False):
class Gru (line 55) | class Gru(nn.Module):
method __init__ (line 56) | def __init__(self):
method forward (line 110) | def forward(self, input, training=False):
class MwAN (line 153) | class MwAN(nn.Module):
method __init__ (line 154) | def __init__(self):
method initiation (line 205) | def initiation(self):
method forward (line 212) | def forward(self, x, training=False):
function criterion (line 281) | def criterion(model, x, y, training=False):
FILE: projects/ai2018/reader/torch_algos/loss.py
function criterion (line 27) | def criterion(model, x, y):
FILE: projects/ai2018/reader/torch_algos/m_reader.py
function get_mask (line 46) | def get_mask(x):
class MnemonicReaderV3 (line 54) | class MnemonicReaderV3(nn.Module):
method __init__ (line 57) | def __init__(self, args=None):
method forward (line 136) | def forward(self, inputs):
class MnemonicReader (line 188) | class MnemonicReader(nn.Module):
method __init__ (line 191) | def __init__(self, args=None):
method forward (line 272) | def forward(self, inputs):
class MnemonicReaderV1 (line 356) | class MnemonicReaderV1(nn.Module):
method __init__ (line 359) | def __init__(self, args=None):
method forward (line 422) | def forward(self, inputs):
FILE: projects/ai2018/reader/torch_algos/model.py
class ModelBase (line 43) | class ModelBase(nn.Module):
method __init__ (line 44) | def __init__(self, embedding=None, lm_model=False):
function get_mask (line 97) | def get_mask(x):
class MReader (line 104) | class MReader(ModelBase):
method __init__ (line 105) | def __init__(self, embedding=None):
method forward (line 161) | def forward(self, inputs):
FILE: projects/ai2018/reader/torch_algos/rnet.py
class Rnet (line 40) | class Rnet(nn.Module):
method __init__ (line 43) | def __init__(self, args=None):
method forward (line 131) | def forward(self, inputs):
FILE: projects/ai2018/reader/train.py
function main (line 38) | def main(_):
FILE: projects/ai2018/sentiment/algos/loss.py
function calc_loss (line 29) | def calc_loss(y, y_, weights, training=False):
function calc_hier_loss (line 80) | def calc_hier_loss(y, y_, weights):
function calc_hier_neu_loss (line 93) | def calc_hier_neu_loss(y, y_, weights):
function calc_add_binary_loss (line 114) | def calc_add_binary_loss(y, y_, cids, weights):
function calc_binary_loss (line 124) | def calc_binary_loss(y, y_, cid, weights):
function calc_regression_loss (line 129) | def calc_regression_loss(y, y_, weights):
function calc_add_binaries_loss (line 133) | def calc_add_binaries_loss(y, y_, cid, weights):
function calc_binaries_only_loss (line 142) | def calc_binaries_only_loss(y, y_, cid, weights):
function criterion (line 155) | def criterion(y, y_):
FILE: projects/ai2018/sentiment/algos/model.py
class ModelBase (line 39) | class ModelBase(melt.Model):
method __init__ (line 40) | def __init__(self, embedding=None, lm_model=False, use_text_encoder=Tr...
method unk_aug (line 135) | def unk_aug(self, x, x_mask=None, training=False):
class BiLanguageModel (line 168) | class BiLanguageModel(ModelBase):
method __init__ (line 169) | def __init__(self, embedding=None, lm_model=True):
method call (line 172) | def call(self, input, training=False):
class RNet (line 175) | class RNet(ModelBase):
method __init__ (line 176) | def __init__(self, embedding=None, lm_model=False):
method call (line 203) | def call(self, input, training=False):
class RNetV2 (line 271) | class RNetV2(RNet):
method __init__ (line 272) | def __init__(self, embedding=None, lm_model=False):
method call (line 302) | def call(self, input, training=False):
class RNetV3 (line 365) | class RNetV3(RNet):
method __init__ (line 366) | def __init__(self, embedding=None):
class RNetV4 (line 392) | class RNetV4(RNet):
method __init__ (line 393) | def __init__(self, embedding=None):
class MReader (line 419) | class MReader(ModelBase):
method __init__ (line 420) | def __init__(self, embedding=None):
method call (line 452) | def call(self, input, training=False):
class Transformer (line 506) | class Transformer(ModelBase):
method __init__ (line 507) | def __init__(self, embedding=None):
method restore (line 551) | def restore(self):
method call (line 567) | def call(self, input, training=False):
FILE: projects/ai2018/sentiment/algos/weights.py
function no_weights (line 28) | def no_weights():
function get_pos (line 31) | def get_pos(aspect):
function parse_weights (line 63) | def parse_weights():
function get_weights (line 82) | def get_weights(aspect, attr_index=None):
FILE: projects/ai2018/sentiment/analysis/analyze.py
function parse (line 70) | def parse(l):
FILE: projects/ai2018/sentiment/analysis/beam_f.py
function beam_f (line 5) | def beam_f(N, weights, y,
function seed_beam_f (line 157) | def seed_beam_f(N, weights, y,
FILE: projects/ai2018/sentiment/analysis/beam_f_utils.py
function compute_biconcave_obj (line 4) | def compute_biconcave_obj(C, u, reg):
function compute_u (line 29) | def compute_u(C, eps):
function eval_classifier (line 57) | def eval_classifier(prob_estimates, G, X, y):
function eval_conf (line 80) | def eval_conf(C): # updated to use f-score
function compute_conf_grad (line 111) | def compute_conf_grad(C, u, eps, reg): # updated to use f-score
function predict_labels (line 143) | def predict_labels(G, eta):
function compute_conf (line 171) | def compute_conf(G, eta, true_labels):
function compute_rand_conf (line 207) | def compute_rand_conf(classifiers, classifier_weights, eta, true_labels):
FILE: projects/ai2018/sentiment/analysis/correlations-filter.py
function calc_correlation (line 78) | def calc_correlation(x, y, method):
FILE: projects/ai2018/sentiment/analysis/correlations.py
function plot_confusion_matrix (line 41) | def plot_confusion_matrix(cm, classes,
function calc_correlation (line 150) | def calc_correlation(x, y, method):
FILE: projects/ai2018/sentiment/dataset.py
class Dataset (line 35) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 36) | def __init__(self, subset='train'):
method parse (line 57) | def parse(self, example):
method num_examples_per_epoch (line 136) | def num_examples_per_epoch(self, mode):
FILE: projects/ai2018/sentiment/ensemble/ensemble-cv-parallel.py
function parse (line 67) | def parse(l):
function calc_f1 (line 75) | def calc_f1(labels, predicts):
function calc_f1s (line 84) | def calc_f1s(labels, predicts):
function calc_losses (line 91) | def calc_losses(labels, predicts):
function calc_loss (line 98) | def calc_loss(labels, predicts):
function calc_aucs (line 105) | def calc_aucs(labels, predicts):
function calc_f1_alls (line 117) | def calc_f1_alls(labels, predicts):
function to_predict (line 175) | def to_predict(logits, weights=None, is_single=False, adjust=True):
function blend_weights (line 211) | def blend_weights(weights, norm_facotr):
function get_counts (line 226) | def get_counts(probs):
function adjust_probs (line 233) | def adjust_probs(probs, labels):
function grid_search_class_factors (line 251) | def grid_search_class_factors(probs, labels, weights, num_grids=10):
function main (line 287) | def main(_):
FILE: projects/ai2018/sentiment/ensemble/ensemble-cv-v1.py
function parse (line 65) | def parse(l):
function calc_f1 (line 73) | def calc_f1(labels, predicts):
function calc_f1s (line 82) | def calc_f1s(labels, predicts):
function calc_losses (line 89) | def calc_losses(labels, predicts):
function calc_aucs (line 96) | def calc_aucs(labels, predicts):
function calc_f1_alls (line 108) | def calc_f1_alls(labels, predicts):
function to_predict (line 165) | def to_predict(logits, weights=None, is_single=False, adjust=True):
function blend_weights (line 201) | def blend_weights(weights, norm_facotr):
function get_counts (line 216) | def get_counts(probs):
function adjust_probs (line 223) | def adjust_probs(probs, labels):
function grid_search_class_factors (line 243) | def grid_search_class_factors(probs, labels, weights, num_grids=10):
function main (line 280) | def main(_):
FILE: projects/ai2018/sentiment/ensemble/ensemble-cv.py
function parse (line 70) | def parse(l):
function calc_f1 (line 78) | def calc_f1(labels, predicts):
function calc_f1s (line 87) | def calc_f1s(labels, predicts):
function calc_losses (line 94) | def calc_losses(labels, predicts):
function calc_loss (line 101) | def calc_loss(labels, predicts):
function calc_aucs (line 108) | def calc_aucs(labels, predicts):
function calc_f1_alls (line 120) | def calc_f1_alls(labels, predicts):
function to_predict (line 181) | def to_predict(logits, weights=None, is_single=False, adjust=True):
function blend_byrank (line 217) | def blend_byrank(weights, norm_facotr):
function blend_byweight (line 235) | def blend_byweight(weights, norm_facotr):
function blend (line 254) | def blend(weights, norm_factor):
function get_counts (line 262) | def get_counts(probs):
function adjust_probs (line 269) | def adjust_probs(probs, labels):
function grid_search_class_factors (line 287) | def grid_search_class_factors(probs, labels, weights, num_grids=10):
function get_distribution (line 323) | def get_distribution(predicts):
function print_confusion_matrix (line 330) | def print_confusion_matrix(labels, predicts):
function main (line 335) | def main(_):
FILE: projects/ai2018/sentiment/ensemble/ensemble-hillclimb.py
function parse (line 67) | def parse(l):
function calc_f1 (line 75) | def calc_f1(labels, predicts):
function calc_f1s (line 84) | def calc_f1s(labels, predicts):
function calc_losses (line 91) | def calc_losses(labels, predicts):
function calc_aucs (line 98) | def calc_aucs(labels, predicts):
function calc_f1_alls (line 110) | def calc_f1_alls(labels, predicts):
function to_predict (line 155) | def to_predict(logits, weights=None, is_single=False, adjust=True):
function to_one_predict (line 191) | def to_one_predict(logits, label, weights=None, is_single=False, adjust=...
function blend_weights (line 225) | def blend_weights(weights, norm_facotr):
function grid_search_class_factors (line 241) | def grid_search_class_factors(probs, labels, weights, num_grids=10):
function init_hillclimb (line 277) | def init_hillclimb():
function score_ensemble (line 296) | def score_ensemble(ensemble, label):
function find_best_improvement (line 318) | def find_best_improvement(ensemble, label):
function climb (line 347) | def climb(best_ensemble, best_score, best_loss, valid_score, valid_loss):
function get_optimal_weights (line 356) | def get_optimal_weights(best_ensemble):
function main (line 365) | def main(_):
FILE: projects/ai2018/sentiment/ensemble/ensemble-infer.py
function parse (line 28) | def parse(l):
function to_predict (line 31) | def to_predict(logits):
FILE: projects/ai2018/sentiment/ensemble/ensemble-v1.py
function parse (line 65) | def parse(l):
function calc_f1 (line 73) | def calc_f1(labels, predicts):
function calc_f1s (line 82) | def calc_f1s(labels, predicts):
function calc_losses (line 89) | def calc_losses(labels, predicts):
function calc_aucs (line 96) | def calc_aucs(labels, predicts):
function calc_f1_alls (line 108) | def calc_f1_alls(labels, predicts):
function to_predict (line 152) | def to_predict(logits, weights=None, is_single=False, adjust=True):
function blend_weights (line 188) | def blend_weights(weights, norm_facotr):
function get_counts (line 203) | def get_counts(probs):
function adjust_probs (line 210) | def adjust_probs(probs, labels):
function grid_search_class_factors (line 224) | def grid_search_class_factors(probs, labels, weights, num_grids=10):
function main (line 253) | def main(_):
FILE: projects/ai2018/sentiment/ensemble/ensemble.py
function parse (line 62) | def parse(l):
function calc_f1 (line 70) | def calc_f1(labels, predicts):
function calc_f1s (line 79) | def calc_f1s(labels, predicts):
function calc_loss (line 86) | def calc_loss(labels, predicts):
function calc_losses (line 93) | def calc_losses(labels, predicts):
function calc_aucs (line 100) | def calc_aucs(labels, predicts):
function calc_f1_alls (line 112) | def calc_f1_alls(labels, predicts):
function to_predict (line 169) | def to_predict(logits, weights=None, is_single=False, adjust=True):
function blend_weights (line 205) | def blend_weights(weights, norm_facotr):
function get_counts (line 220) | def get_counts(probs):
function adjust_probs (line 227) | def adjust_probs(probs, labels):
function grid_search_class_factors (line 244) | def grid_search_class_factors(probs, labels, weights, num_grids=10):
function main (line 280) | def main(_):
FILE: projects/ai2018/sentiment/ensemble/gen-train.py
function parse (line 34) | def parse(l):
FILE: projects/ai2018/sentiment/ensemble/hillclimb-ensembling.py
function init_hillclimb (line 10) | def init_hillclimb():
function score_ensemble (line 23) | def score_ensemble(ensemble, label):
function find_best_improvement (line 37) | def find_best_improvement(ensemble, label):
function climb (line 57) | def climb(best_ensemble, best_score):
function get_optimal_weights (line 66) | def get_optimal_weights(best_ensemble):
function get_optimal_blend (line 77) | def get_optimal_blend(optimal_weights):
function get_sub_file (line 89) | def get_sub_file(num):
FILE: projects/ai2018/sentiment/ensemble/lgb-adjust.py
function parse (line 48) | def parse(l):
function is_ok (line 122) | def is_ok(factor):
FILE: projects/ai2018/sentiment/ensemble/lgb-cv.py
function evaluate_macroF1_lgb (line 123) | def evaluate_macroF1_lgb(truth, predictions):
function learning_rate_power_0997 (line 131) | def learning_rate_power_0997(current_iter):
function learning_rate_power_0997 (line 202) | def learning_rate_power_0997(current_iter):
FILE: projects/ai2018/sentiment/evaluate.py
function load_class_weights (line 66) | def load_class_weights():
function init (line 87) | def init():
function regression_to_class (line 141) | def regression_to_class(predict):
function to_class (line 151) | def to_class(predicts, thre=0.5):
function calc_f1 (line 168) | def calc_f1(labels, predicts, model_path=None, name = 'f1'):
function calc_loss (line 219) | def calc_loss(labels, predicts, model_path=None):
function calc_auc (line 249) | def calc_auc(labels, predicts, model_path=None):
function evaluate (line 286) | def evaluate(labels, predicts, ids=None, model_path=None):
function write (line 337) | def write(ids, labels, predicts, ofile, ofile2=None, is_infer=False):
function valid_write (line 379) | def valid_write(ids, labels, predicts, ofile):
function infer_write (line 382) | def infer_write(ids, predicts, ofile, ofile2):
function evaluate_file (line 386) | def evaluate_file(file):
FILE: projects/ai2018/sentiment/infer.py
function main (line 44) | def main(_):
FILE: projects/ai2018/sentiment/lm-train.py
function main (line 36) | def main(_):
FILE: projects/ai2018/sentiment/lm_dataset.py
class Dataset (line 35) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 36) | def __init__(self, subset='train'):
method parser (line 57) | def parser(self, example):
FILE: projects/ai2018/sentiment/prepare.test/filter.py
function filter_duplicate_space (line 26) | def filter_duplicate_space(text):
function filter (line 41) | def filter(x):
FILE: projects/ai2018/sentiment/prepare.test/gen-canyin.py
function main (line 71) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/gen-dianping.py
function score2class (line 53) | def score2class(score):
function main (line 88) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/gen-lm-records.py
function build_features (line 60) | def build_features(file_):
function main (line 140) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/gen-records.py
function get_mode (line 82) | def get_mode(path):
function build_features (line 106) | def build_features(index):
function main (line 257) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/gen-trans.py
function main (line 58) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/merge-emb.py
function main (line 41) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/pre-mix-seg-v1.py
function seg (line 39) | def seg(id, text, out):
function main (line 44) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/pre-mix-seg.py
function seg (line 47) | def seg(id, text, out, counter):
function main (line 67) | def main(_):
FILE: projects/ai2018/sentiment/prepare.test/pre-seg-bert.py
function seg (line 42) | def seg(id, text, out):
FILE: projects/ai2018/sentiment/prepare.test/pre-seg.py
function seg (line 58) | def seg(id, text, out, type):
FILE: projects/ai2018/sentiment/prepare.test/text2ids.py
function text2ids (line 31) | def text2ids(text, preprocess=True, return_words=False):
FILE: projects/ai2018/sentiment/prepare.testb/filter.py
function filter_duplicate_space (line 26) | def filter_duplicate_space(text):
function filter (line 41) | def filter(x):
FILE: projects/ai2018/sentiment/prepare.testb/gen-canyin.py
function main (line 71) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/gen-dianping.py
function score2class (line 53) | def score2class(score):
function main (line 88) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/gen-lm-records.py
function build_features (line 60) | def build_features(file_):
function main (line 140) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/gen-records.py
function get_mode (line 82) | def get_mode(path):
function build_features (line 106) | def build_features(index):
function main (line 256) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/gen-trans.py
function main (line 58) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/merge-emb.py
function main (line 41) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/pre-mix-seg-v1.py
function seg (line 39) | def seg(id, text, out):
function main (line 44) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/pre-mix-seg.py
function seg (line 47) | def seg(id, text, out, counter):
function main (line 67) | def main(_):
FILE: projects/ai2018/sentiment/prepare.testb/pre-seg-bert.py
function seg (line 42) | def seg(id, text, out):
FILE: projects/ai2018/sentiment/prepare.testb/pre-seg.py
function seg (line 58) | def seg(id, text, out, type):
FILE: projects/ai2018/sentiment/prepare.testb/text2ids.py
function text2ids (line 31) | def text2ids(text, preprocess=True, return_words=False):
FILE: projects/ai2018/sentiment/prepare.v1/filter.py
function filter (line 26) | def filter(x):
FILE: projects/ai2018/sentiment/prepare.v1/gen-canyin.py
function main (line 71) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v1/gen-char-seg-canyin.py
function seg (line 43) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-char-seg-dianping.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-char-seg-train.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-char-seg.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-dianping.py
function score2class (line 53) | def score2class(score):
function main (line 88) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v1/gen-mix-seg-canyin.py
function seg (line 49) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-mix-seg-dianping.py
function seg (line 49) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-records.py
function get_mode (line 56) | def get_mode(path):
function build_features (line 78) | def build_features(index):
function main (line 158) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v1/gen-seg-canyin.py
function seg (line 43) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-seg-dianping.py
function seg (line 49) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-seg-train.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v1/gen-trans.py
function main (line 58) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v1/merge-emb.py
function main (line 37) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v1/text2ids.py
function text2ids (line 30) | def text2ids(text):
FILE: projects/ai2018/sentiment/prepare.v2/filter.py
function filter_duplicate (line 26) | def filter_duplicate(text):
function filter (line 29) | def filter(x):
FILE: projects/ai2018/sentiment/prepare.v2/gen-canyin.py
function main (line 71) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v2/gen-char-seg-canyin.py
function seg (line 43) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-char-seg-dianping.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-char-seg-train.py
function seg (line 43) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-char-seg.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-dianping.py
function score2class (line 53) | def score2class(score):
function main (line 88) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v2/gen-mix-seg-canyin.py
function seg (line 51) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-mix-seg-dianping.py
function seg (line 52) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-mix-seg-train.py
function seg (line 52) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-records.py
function get_mode (line 66) | def get_mode(path):
function build_features (line 88) | def build_features(index):
function main (line 208) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v2/gen-seg-canyin.py
function seg (line 43) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-seg-dianping.py
function seg (line 49) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-seg-train.py
function seg (line 42) | def seg(text, out):
FILE: projects/ai2018/sentiment/prepare.v2/gen-trans.py
function main (line 58) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v2/merge-emb.py
function main (line 37) | def main(_):
FILE: projects/ai2018/sentiment/prepare.v2/text2ids.py
function text2ids (line 31) | def text2ids(text, return_words=False):
FILE: projects/ai2018/sentiment/prepare/filter.py
function filter_duplicate_space (line 26) | def filter_duplicate_space(text):
function filter (line 41) | def filter(x):
FILE: projects/ai2018/sentiment/prepare/gen-canyin.py
function main (line 71) | def main(_):
FILE: projects/ai2018/sentiment/prepare/gen-dianping.py
function score2class (line 53) | def score2class(score):
function main (line 88) | def main(_):
FILE: projects/ai2018/sentiment/prepare/gen-lm-records.py
function build_features (line 60) | def build_features(file_):
function main (line 141) | def main(_):
FILE: projects/ai2018/sentiment/prepare/gen-records.py
function get_mode (line 84) | def get_mode(path):
function build_features (line 110) | def build_features(index):
function main (line 285) | def main(_):
FILE: projects/ai2018/sentiment/prepare/gen-trans.py
function main (line 58) | def main(_):
FILE: projects/ai2018/sentiment/prepare/merge-emb.py
function main (line 41) | def main(_):
FILE: projects/ai2018/sentiment/prepare/pre-mix-seg-v1.py
function seg (line 39) | def seg(id, text, out):
function main (line 44) | def main(_):
FILE: projects/ai2018/sentiment/prepare/pre-mix-seg.py
function seg (line 47) | def seg(id, text, out, counter):
function main (line 67) | def main(_):
FILE: projects/ai2018/sentiment/prepare/pre-seg-bert.py
function seg (line 42) | def seg(id, text, out):
FILE: projects/ai2018/sentiment/prepare/pre-seg.py
function seg (line 58) | def seg(id, text, out, type):
FILE: projects/ai2018/sentiment/prepare/text2ids.py
function text2ids (line 31) | def text2ids(text, preprocess=True, return_words=False):
FILE: projects/ai2018/sentiment/read-records.py
function deal (line 51) | def deal(dataset, infos):
function main (line 63) | def main(_):
FILE: projects/ai2018/sentiment/tools/check-emb.py
function sim (line 38) | def sim(x, y):
function main (line 48) | def main(_):
FILE: projects/ai2018/sentiment/tools/find-best-epoch.py
function parse (line 29) | def parse(x, key='adjusted_f1'):
function deal (line 48) | def deal(line):
FILE: projects/ai2018/sentiment/tools/rename-variables-finetune.py
function rename (line 22) | def rename(checkpoint_dir, dry_run):
function main (line 52) | def main(argv):
FILE: projects/ai2018/sentiment/tools/seg2corpus.py
function main (line 33) | def main(_):
FILE: projects/ai2018/sentiment/torch-infer.py
function convert (line 47) | def convert(content):
function predict (line 66) | def predict(content):
function encode (line 89) | def encode(content, aspect=-2):
function sim (line 97) | def sim(content1, content2, aspect=-2):
function main (line 103) | def main(_):
FILE: projects/ai2018/sentiment/torch-lm-train.py
function main (line 36) | def main(_):
FILE: projects/ai2018/sentiment/torch-sim.py
function convert (line 47) | def convert(content):
function predict (line 66) | def predict(content):
function encode (line 89) | def encode(content):
function sim (line 96) | def sim(content1, content2):
function main (line 102) | def main(_):
FILE: projects/ai2018/sentiment/torch-train.py
function get_num_finetune_words (line 36) | def get_num_finetune_words():
function freeze_embedding (line 42) | def freeze_embedding(self, grad_input, grad_output):
function freeze_char_embedding (line 46) | def freeze_char_embedding(self, grad_input, grad_output):
function main (line 49) | def main(_):
FILE: projects/ai2018/sentiment/torch_algos/loss.py
class Criterion (line 33) | class Criterion(object):
method __init__ (line 34) | def __init__(self, class_weights=None):
method calc_soft_label_loss (line 47) | def calc_soft_label_loss(self, y_, y, num_classes):
method forward (line 55) | def forward(self, model, x, y, training=False):
FILE: projects/ai2018/sentiment/torch_algos/model.py
class ModelBase (line 37) | class ModelBase(nn.Module):
method __init__ (line 38) | def __init__(self, embedding=None, lm_model=False):
method unk_aug (line 127) | def unk_aug(self, x, x_mask=None):
class BiLanguageModel (line 147) | class BiLanguageModel(ModelBase):
method __init__ (line 148) | def __init__(self, embedding=None):
class RNet (line 153) | class RNet(ModelBase):
method __init__ (line 154) | def __init__(self, embedding=None):
method forward (line 200) | def forward(self, input, training=False):
class MReader (line 238) | class MReader(ModelBase):
method __init__ (line 239) | def __init__(self, embedding=None):
method forward (line 293) | def forward(self, input, training=False):
class Fastai (line 354) | class Fastai(ModelBase):
method __init__ (line 355) | def __init__(self, embedding=None):
method forward (line 367) | def forward(self, input, training=False):
FILE: projects/ai2018/sentiment/train.py
function main (line 37) | def main(_):
FILE: projects/common/lm/algos/loss.py
function loss_fn (line 20) | def loss_fn(model, inputs, targets, training=False):
FILE: projects/common/lm/algos/model.py
class PTBModel (line 31) | class PTBModel(tf.keras.Model):
method __init__ (line 39) | def __init__(self,
method call (line 64) | def call(self, input_seq, training=False):
FILE: projects/common/lm/dataset.py
class Dataset (line 35) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 36) | def __init__(self, subset='train'):
method make_batch (line 46) | def make_batch(self, batch_size, filenames, bptt=None, **kwargs):
method num_examples_per_epoch (line 147) | def num_examples_per_epoch(self, mode):
FILE: projects/common/lm/prepare/to-ids.py
function main (line 32) | def main(_):
FILE: projects/common/lm/read-records.py
function main (line 31) | def main(_):
FILE: projects/common/lm/train.py
function main (line 38) | def main(_):
FILE: projects/feed/rank/tf/err/torch-only-train.py
function main (line 34) | def main(_):
FILE: projects/feed/rank/tf/evaluate.py
function evaluate (line 23) | def evaluate(y, y_):
function valid_write (line 29) | def valid_write(ids, labels, predicts, out):
FILE: projects/feed/rank/tf/gen-records.py
function get_out_file (line 36) | def get_out_file(infile):
function build_features (line 42) | def build_features(infile):
function main (line 70) | def main(_):
FILE: projects/feed/rank/tf/loss.py
function binary_crossentropy_with_ranking (line 22) | def binary_crossentropy_with_ranking(y_true, y_pred):
FILE: projects/feed/rank/tf/model.py
class Wide (line 31) | class Wide(keras.Model):
method __init__ (line 32) | def __init__(self):
method call (line 39) | def call(self, input):
class Deep (line 52) | class Deep(keras.Model):
method __init__ (line 53) | def __init__(self):
method call (line 87) | def call(self, input, training=False):
class WideDeep (line 128) | class WideDeep(keras.Model):
method __init__ (line 129) | def __init__(self):
method call (line 136) | def call(self, input, training=False):
FILE: projects/feed/rank/tf/pyt/dataset.py
class TextDataset (line 28) | class TextDataset(Dataset):
method __init__ (line 29) | def __init__(self, filename, td):
method __getitem__ (line 34) | def __getitem__(self, idx):
method __len__ (line 44) | def __len__(self):
function get_dataset (line 47) | def get_dataset(files, td):
FILE: projects/feed/rank/tf/pyt/model.py
class Wide (line 31) | class Wide(nn.Module):
method __init__ (line 32) | def __init__(self):
method forward (line 41) | def forward(self, input):
class Deep (line 57) | class Deep(nn.Module):
method __init__ (line 58) | def __init__(self):
method forward (line 82) | def forward(self, input):
class WideDeep (line 128) | class WideDeep(nn.Module):
method __init__ (line 129) | def __init__(self):
method forward (line 136) | def forward(self, input):
FILE: projects/feed/rank/tf/read-test.py
function main (line 27) | def main(_):
FILE: projects/feed/rank/tf/read-test2.py
function main (line 31) | def main(_):
FILE: projects/feed/rank/tf/read-test3.py
function main (line 34) | def main(_):
FILE: projects/feed/rank/tf/text_dataset.py
class Dataset (line 28) | class Dataset(melt.Dataset):
method __init__ (line 29) | def __init__(self, subset='train'):
method load_feature_files (line 47) | def load_feature_files(self):
method get_feat (line 68) | def get_feat(self, fields):
method parse_line (line 86) | def parse_line(self, line):
method parse_line2 (line 95) | def parse_line2(self, line):
method line_parse_ (line 104) | def line_parse_(self, line):
method parse_batch (line 117) | def parse_batch(self, feat_list, batch_size):
method batch_parse_ (line 154) | def batch_parse_(self, line, batch_size):
method parse (line 170) | def parse(self, line, batch_size):
FILE: projects/feed/rank/tf/tfrecord_dataset.py
class Dataset (line 27) | class Dataset(melt.Dataset):
method __init__ (line 28) | def __init__(self, subset='valid'):
method parse (line 33) | def parse(self, example):
FILE: projects/feed/rank/tf/torch-hvd-train.py
function train (line 55) | def train(epoch, model, loss_fn, train_loader, optimizer):
function metric_average (line 77) | def metric_average(val, name):
function test (line 83) | def test(model, loss_fn, test_loader):
function main (line 105) | def main(_):
FILE: projects/feed/rank/tf/torch-only-train-hvd.py
function main (line 45) | def main(_):
FILE: projects/feed/rank/tf/torch-only-train.py
function main (line 43) | def main(_):
FILE: projects/feed/rank/tf/torch-train.py
function main (line 34) | def main(_):
FILE: projects/feed/rank/tf/train.py
function main (line 28) | def main(_):
FILE: projects/kaggle/blindness/keras/dataset.py
class Dataset (line 31) | class Dataset(Sequence):
method __init__ (line 33) | def __init__(self, image_filenames, labels,
method __len__ (line 44) | def __len__(self):
method __getitem__ (line 47) | def __getitem__(self, idx):
method on_epoch_end (line 55) | def on_epoch_end(self):
method mix_up (line 61) | def mix_up(self, x, y):
method train_generate (line 72) | def train_generate(self, batch_x, batch_y):
method get_images (line 90) | def get_images(self, indexes):
method valid_generate (line 104) | def valid_generate(self, batch_x, batch_y):
FILE: projects/kaggle/blindness/keras/evaluate.py
function gen_confusion (line 36) | def gen_confusion(y_true, y_pred, info=''):
function to_str (line 47) | def to_str(scores):
class Evaluator (line 50) | class Evaluator(Callback):
method __init__ (line 51) | def __init__(self,
method on_epoch_end (line 68) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/keras/evaluate2.py
class QWKEvaluation (line 25) | class QWKEvaluation(Callback):
method __init__ (line 26) | def __init__(self, validation_data=(), interval=1):
method on_epoch_end (line 33) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/keras/fake-infer.py
function hack_lb (line 21) | def hack_lb(test_preds):
FILE: projects/kaggle/blindness/keras/folds.py
function get_train_valid (line 20) | def get_train_valid(x, y, fold=0, num_folds=5, random_state=2019):
FILE: projects/kaggle/blindness/keras/infer.py
class Predictor (line 33) | class Predictor():
method __init__ (line 34) | def __init__(self, model, batch_size, predict_fn=None):
method _predict (line 41) | def _predict(self):
method add (line 49) | def add(self, x):
method predict (line 54) | def predict(self):
function hack_lb (line 59) | def hack_lb(test_preds):
function main (line 70) | def main(_):
FILE: projects/kaggle/blindness/keras/loss.py
function earth_mover_loss (line 30) | def earth_mover_loss(y_true, y_pred):
function kappa_loss (line 38) | def kappa_loss(y_true, y_pred, y_pow=2, eps=1e-12, N=5, bsize=32, name='...
function get_loss (line 75) | def get_loss(loss_type=None):
FILE: projects/kaggle/blindness/keras/lr.py
class WarmUpLearningRateScheduler (line 27) | class WarmUpLearningRateScheduler(keras.callbacks.Callback):
method __init__ (line 31) | def __init__(self, warmup_batches, init_lr, verbose=0):
method on_batch_end (line 49) | def on_batch_end(self, batch, logs=None):
method on_batch_begin (line 54) | def on_batch_begin(self, batch, logs=None):
function cosine_decay_with_warmup (line 62) | def cosine_decay_with_warmup(global_step,
class WarmUpCosineDecayScheduler (line 116) | class WarmUpCosineDecayScheduler(keras.callbacks.Callback):
method __init__ (line 120) | def __init__(self,
method on_batch_end (line 153) | def on_batch_end(self, batch, logs=None):
method on_batch_begin (line 158) | def on_batch_begin(self, batch, logs=None):
FILE: projects/kaggle/blindness/keras/model.py
function create_model (line 29) | def create_model(input_shape, n_out, loss_type=''):
FILE: projects/kaggle/blindness/keras/train.py
function to_regression (line 53) | def to_regression(y):
function to_regression2 (line 58) | def to_regression2(y):
function to_ordinal (line 64) | def to_ordinal(y):
function to_ordinal2 (line 74) | def to_ordinal2(y):
function trans_y (line 79) | def trans_y(y, loss_type):
function main (line 92) | def main(_):
FILE: projects/kaggle/blindness/keras/train2.py
function get_num_gpus (line 43) | def get_num_gpus():
function main (line 54) | def main(_):
FILE: projects/kaggle/blindness/keras/util.py
function get_num_gpus (line 18) | def get_num_gpus():
FILE: projects/kaggle/blindness/keras2/evaluate.py
class QWKEvaluation (line 25) | class QWKEvaluation(Callback):
method __init__ (line 26) | def __init__(self, validation_data=(), batch_size=64, interval=1):
method on_epoch_end (line 34) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/keras2/model.py
function create_model (line 25) | def create_model(input_shape, n_out):
FILE: projects/kaggle/blindness/keras2/train.py
function get_num_gpus (line 46) | def get_num_gpus():
function get_dataset (line 57) | def get_dataset(subset, use_distortion=None):
function main (line 65) | def main(_):
FILE: projects/kaggle/blindness/keras2tf/dataset.py
class Dataset (line 26) | class Dataset(Sequence):
method __init__ (line 28) | def __init__(self, image_filenames, labels,
method __len__ (line 39) | def __len__(self):
method __getitem__ (line 42) | def __getitem__(self, idx):
method on_epoch_end (line 50) | def on_epoch_end(self):
method mix_up (line 56) | def mix_up(self, x, y):
method train_generate (line 67) | def train_generate(self, batch_x, batch_y):
method valid_generate (line 81) | def valid_generate(self, batch_x, batch_y):
FILE: projects/kaggle/blindness/keras2tf/evaluate.py
class QWKEvaluation (line 25) | class QWKEvaluation(Callback):
method __init__ (line 26) | def __init__(self, validation_data=(), batch_size=64, interval=1):
method on_epoch_end (line 34) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/keras2tf/model.py
function create_model (line 26) | def create_model(input_shape, n_out):
FILE: projects/kaggle/blindness/keras2tf/train.py
function get_num_gpus (line 44) | def get_num_gpus():
function main (line 55) | def main(_):
FILE: projects/kaggle/blindness/keras3/bak/evaluate.py
class QWKEvaluation (line 25) | class QWKEvaluation(Callback):
method __init__ (line 26) | def __init__(self, validation_data=(), batch_size=64, interval=1):
method on_epoch_end (line 34) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/keras3/dataset.py
class Dataset (line 31) | class Dataset(Sequence):
method __init__ (line 33) | def __init__(self, image_filenames, labels,
method __len__ (line 45) | def __len__(self):
method __getitem__ (line 48) | def __getitem__(self, idx):
method on_epoch_end (line 56) | def on_epoch_end(self):
method mix_up (line 62) | def mix_up(self, x, y):
method train_generate (line 73) | def train_generate(self, batch_x, batch_y):
method get_images (line 91) | def get_images(self, indexes):
method valid_generate (line 105) | def valid_generate(self, batch_x, batch_y):
FILE: projects/kaggle/blindness/keras3/evaluate.py
class QWKEvaluation (line 25) | class QWKEvaluation(Callback):
method __init__ (line 26) | def __init__(self, validation_data=(), batch_size=64, interval=1):
method on_epoch_end (line 34) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/keras3/model.py
function create_model (line 26) | def create_model(input_shape, n_out):
FILE: projects/kaggle/blindness/keras3/train.py
function get_num_gpus (line 43) | def get_num_gpus():
function main (line 54) | def main(_):
FILE: projects/kaggle/blindness/other/keras_baseline.py
function display_samples (line 95) | def display_samples(df, columns=4, rows=3):
class My_Generator (line 202) | class My_Generator(Sequence):
method __init__ (line 204) | def __init__(self, image_filenames, labels,
method __len__ (line 215) | def __len__(self):
method __getitem__ (line 218) | def __getitem__(self, idx):
method on_epoch_end (line 226) | def on_epoch_end(self):
method mix_up (line 232) | def mix_up(self, x, y):
method train_generate (line 243) | def train_generate(self, batch_x, batch_y):
method valid_generate (line 257) | def valid_generate(self, batch_x, batch_y):
function create_model (line 271) | def create_model(input_shape, n_out):
function kappa_loss (line 319) | def kappa_loss(y_true, y_pred, y_pow=2, eps=1e-12, N=5, bsize=32, name='...
class QWKEvaluation (line 361) | class QWKEvaluation(Callback):
method __init__ (line 362) | def __init__(self, validation_data=(), batch_size=64, interval=1):
method on_epoch_end (line 370) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/blindness/other/training-mobilenet-v2-in-4-min.py
function pad_and_resize (line 26) | def pad_and_resize(image_path, pad=True, desired_size=224):
function build_model (line 51) | def build_model():
FILE: projects/kaggle/blindness/prepare/gen-records.py
function convert_to_tfrecord (line 44) | def convert_to_tfrecord(input_files, output_file):
function main (line 67) | def main(data_dir):
FILE: projects/kaggle/blindness/tf/dataset.py
class DataSet (line 34) | class DataSet(object):
method __init__ (line 36) | def __init__(self, data_dir, subset='train', use_distortion=True):
method get_filenames (line 41) | def get_filenames(self):
method parser (line 47) | def parser(self, serialized_example):
method make_batch (line 84) | def make_batch(self, batch_size, filenames=None, repeat=None, initiali...
method preprocess (line 116) | def preprocess(self, image):
method num_examples_per_epoch (line 146) | def num_examples_per_epoch(subset='train'):
FILE: projects/kaggle/blindness/tf/evaluate.py
function evaluate (line 24) | def evaluate(labels, logits, ids=None):
function write (line 39) | def write(ids, labels, logits, ofile):
function valid_write (line 50) | def valid_write(ids, labels, logits, ofile):
function infer_write (line 53) | def infer_write(ids, logits, ofile):
FILE: projects/kaggle/blindness/tf/loss.py
function criterion (line 20) | def criterion(model, x, y, training=False):
FILE: projects/kaggle/blindness/tf/model.py
class BaseModel (line 26) | class BaseModel(model_base.ResNet):
method __init__ (line 28) | def __init__(self,
method init_predict (line 46) | def init_predict(self, input_data_format='channels_last'):
method forward_pass (line 58) | def forward_pass(self, x, input_data_format='channels_last'):
method predict (line 101) | def predict(self, x=None, input_data_format='channels_last'):
class Model (line 115) | class Model(tf.keras.Model):
method __init__ (line 116) | def __init__(self):
method call (line 134) | def call(self, x, input_data_format='channels_last', training=False):
FILE: projects/kaggle/blindness/tf/model_base.py
class ResNet (line 29) | class ResNet(object):
method __init__ (line 32) | def __init__(self, training, data_format, batch_norm_decay, batch_norm...
method forward_pass (line 46) | def forward_pass(self, x):
method _residual_v1 (line 50) | def _residual_v1(self,
method _residual_v2 (line 83) | def _residual_v2(self,
method _bottleneck_residual_v2 (line 120) | def _bottleneck_residual_v2(self,
method _conv (line 156) | def _conv(self, x, kernel_size, filters, strides, is_atrous=False):
method _batch_norm (line 178) | def _batch_norm(self, x):
method _relu (line 193) | def _relu(self, x):
method _fully_connected (line 196) | def _fully_connected(self, x, out_dim):
method _avg_pool (line 203) | def _avg_pool(self, x, pool_size, stride):
method _global_avg_pool (line 211) | def _global_avg_pool(self, x):
FILE: projects/kaggle/blindness/tf/train.py
function get_dataset (line 35) | def get_dataset(subset):
function main (line 44) | def main(_):
FILE: projects/kaggle/blindness/tf2/dataset.py
class DataSet (line 34) | class DataSet(object):
method __init__ (line 36) | def __init__(self, data_dir, subset='train', use_distortion=True):
method get_filenames (line 41) | def get_filenames(self):
method parser (line 47) | def parser(self, serialized_example):
method make_batch (line 87) | def make_batch(self, batch_size, filenames=None, repeat=None, initiali...
method preprocess (line 121) | def preprocess(self, image):
method num_examples_per_epoch (line 151) | def num_examples_per_epoch(subset='train'):
FILE: projects/kaggle/blindness/tf2/evaluate.py
function evaluate (line 24) | def evaluate(labels, logits, ids=None):
function write (line 39) | def write(ids, labels, logits, ofile):
function valid_write (line 50) | def valid_write(ids, labels, logits, ofile):
function infer_write (line 53) | def infer_write(ids, logits, ofile):
FILE: projects/kaggle/blindness/tf2/loss.py
function criterion (line 20) | def criterion(model, x, y, training=False):
FILE: projects/kaggle/blindness/tf2/model.py
function create_model (line 37) | def create_model(input_shape, n_out):
class Model (line 61) | class Model(tf.keras.Model):
method __init__ (line 62) | def __init__(self):
method call (line 71) | def call(self, x, training=False):
FILE: projects/kaggle/blindness/tf2/train.py
function get_dataset (line 41) | def get_dataset(subset):
function main (line 49) | def main(_):
FILE: projects/kaggle/cifar10/baseline/keras/KerasT-master/4layerCNN.py
function base_model (line 89) | def base_model():
FILE: projects/kaggle/cifar10/baseline/keras/KerasT-master/6layerCNN.py
function base_model (line 81) | def base_model():
FILE: projects/kaggle/cifar10/baseline/keras/hands-on-deep-learning-master/cifar_image_classification/helpers.py
function load_cifar10 (line 8) | def load_cifar10(filepath="/public/cifar/cifar10.h5"):
function array_2d_to_image (line 29) | def array_2d_to_image(array, autorescale=True):
function model_summary (line 37) | def model_summary(model):
class NeptuneCallback (line 55) | class NeptuneCallback(Callback):
method __init__ (line 56) | def __init__(self, x_test, y_test, images_per_epoch=-1):
method on_epoch_end (line 62) | def on_epoch_end(self, epoch, logs={}):
FILE: projects/kaggle/cifar10/baseline/keras/simple/cifar10.py
function loadData (line 44) | def loadData(path='train'):
function loadTrainValid (line 62) | def loadTrainValid(path='train'):
function loadTest (line 88) | def loadTest(path='test'):
function preprocess (line 105) | def preprocess(trainData, trainLabels=None):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10.py
function load_pickle (line 36) | def load_pickle(f):
function load_CIFAR_batch (line 44) | def load_CIFAR_batch(filename):
function load_CIFAR10 (line 54) | def load_CIFAR10(ROOT):
function get_CIFAR10_data (line 69) | def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=1...
class CifarNet (line 104) | class CifarNet():
method __init__ (line 105) | def __init__(self):
method forward (line 124) | def forward(self, X, y, is_training):
method run (line 182) | def run(self, session, loss_val, Xd, yd,
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/cifar10.py
class Cifar10DataSet (line 28) | class Cifar10DataSet(object):
method __init__ (line 34) | def __init__(self, data_dir, subset='train', use_distortion=True):
method get_filenames (line 39) | def get_filenames(self):
method parser (line 45) | def parser(self, serialized_example):
method make_batch (line 71) | def make_batch(self, batch_size, repeat=None):
method preprocess (line 107) | def preprocess(self, image):
method num_examples_per_epoch (line 121) | def num_examples_per_epoch(subset='train'):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/cifar10_main.py
function get_model_fn (line 47) | def get_model_fn(num_gpus, variable_strategy, num_workers):
function _tower_fn (line 212) | def _tower_fn(is_training, weight_decay, feature, label, data_format,
function input_fn (line 259) | def input_fn(data_dir,
function get_experiment_fn (line 301) | def get_experiment_fn(data_dir,
function main (line 371) | def main(job_dir, data_dir, num_gpus, variable_strategy,
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/cifar10_model.py
class ResNetCifar10 (line 26) | class ResNetCifar10(model_base.ResNet):
method __init__ (line 29) | def __init__(self,
method init_predict (line 47) | def init_predict(self, input_data_format='channels_last'):
method forward_pass (line 59) | def forward_pass(self, x, input_data_format='channels_last'):
method predict (line 102) | def predict(self, x=None, input_data_format='channels_last'):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/cifar10_multi_gpu_train.py
function tower_loss (line 65) | def tower_loss(scope, images, labels):
function average_gradients (line 101) | def average_gradients(tower_grads):
function train (line 139) | def train():
function main (line 268) | def main(argv=None): # pylint: disable=unused-argument
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/cifar10_utils.py
class RunConfig (line 17) | class RunConfig(tf.contrib.learn.RunConfig):
method uid (line 18) | def uid(self, whitelist=None):
class ExamplesPerSecondHook (line 51) | class ExamplesPerSecondHook(session_run_hook.SessionRunHook):
method __init__ (line 60) | def __init__(
method begin (line 83) | def begin(self):
method before_run (line 89) | def before_run(self, run_context): # pylint: disable=unused-argument
method after_run (line 92) | def after_run(self, run_context, run_values):
function local_device_setter (line 112) | def local_device_setter(num_devices=1,
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/evaluator.py
function write (line 39) | def write(ids, predicts, model_path, labels=None, images=None, suffix='v...
function evaluate (line 67) | def evaluate(eval_ops, iterator, model_path=None, sess=None):
function inference (line 120) | def inference(ops, iterator, model_path=None, sess=None):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/generate_cifar10_tfrecords.py
function _int64_feature (line 58) | def _int64_feature(value):
function _bytes_feature (line 62) | def _bytes_feature(value):
function convert_to_tfrecord (line 65) | def convert_to_tfrecord(input_files, output_file):
function main (line 86) | def main(data_dir):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/model_base.py
class ResNet (line 29) | class ResNet(object):
method __init__ (line 32) | def __init__(self, is_training, data_format, batch_norm_decay, batch_n...
method forward_pass (line 46) | def forward_pass(self, x):
method _residual_v1 (line 50) | def _residual_v1(self,
method _residual_v2 (line 83) | def _residual_v2(self,
method _bottleneck_residual_v2 (line 120) | def _bottleneck_residual_v2(self,
method _conv (line 156) | def _conv(self, x, kernel_size, filters, strides, is_atrous=False):
method _batch_norm (line 178) | def _batch_norm(self, x):
method _relu (line 193) | def _relu(self, x):
method _fully_connected (line 196) | def _fully_connected(self, x, out_dim):
method _avg_pool (line 203) | def _avg_pool(self, x, pool_size, stride):
method _global_avg_pool (line 211) | def _global_avg_pool(self, x):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator.v1/train.py
function tower_loss (line 39) | def tower_loss(model, feature, label):
function main (line 68) | def main(_):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/cifar10.py
class Cifar10DataSet (line 28) | class Cifar10DataSet(object):
method __init__ (line 34) | def __init__(self, data_dir, subset='train', use_distortion=True):
method get_filenames (line 39) | def get_filenames(self):
method parser (line 45) | def parser(self, serialized_example):
method make_batch (line 71) | def make_batch(self, batch_size, repeat=None):
method preprocess (line 103) | def preprocess(self, image):
method num_examples_per_epoch (line 117) | def num_examples_per_epoch(subset='train'):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/cifar10_main.py
function get_model_fn (line 47) | def get_model_fn(num_gpus, variable_strategy, num_workers):
function _tower_fn (line 212) | def _tower_fn(is_training, weight_decay, feature, label, data_format,
function input_fn (line 259) | def input_fn(data_dir,
function get_experiment_fn (line 301) | def get_experiment_fn(data_dir,
function main (line 371) | def main(job_dir, data_dir, num_gpus, variable_strategy,
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/cifar10_model.py
class ResNetCifar10 (line 26) | class ResNetCifar10(model_base.ResNet):
method __init__ (line 29) | def __init__(self,
method init_predict (line 47) | def init_predict(self, input_data_format='channels_last'):
method forward_pass (line 59) | def forward_pass(self, x, input_data_format='channels_last'):
method predict (line 102) | def predict(self, x=None, input_data_format='channels_last'):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/cifar10_multi_gpu_train.py
function tower_loss (line 65) | def tower_loss(scope, images, labels):
function average_gradients (line 101) | def average_gradients(tower_grads):
function train (line 139) | def train():
function main (line 268) | def main(argv=None): # pylint: disable=unused-argument
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/cifar10_utils.py
class RunConfig (line 17) | class RunConfig(tf.contrib.learn.RunConfig):
method uid (line 18) | def uid(self, whitelist=None):
class ExamplesPerSecondHook (line 51) | class ExamplesPerSecondHook(session_run_hook.SessionRunHook):
method __init__ (line 60) | def __init__(
method begin (line 83) | def begin(self):
method before_run (line 89) | def before_run(self, run_context): # pylint: disable=unused-argument
method after_run (line 92) | def after_run(self, run_context, run_values):
function local_device_setter (line 112) | def local_device_setter(num_devices=1,
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/evaluator.py
function write (line 39) | def write(ids, predicts, model_path, labels=None, images=None, suffix='v...
function evaluate (line 67) | def evaluate(eval_ops, iterator, num_steps, num_examples, model_path=Non...
function inference (line 122) | def inference(ops, iterator, num_steps, num_examples, model_path=None, n...
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/generate_cifar10_tfrecords.py
function _int64_feature (line 58) | def _int64_feature(value):
function _bytes_feature (line 62) | def _bytes_feature(value):
function convert_to_tfrecord (line 65) | def convert_to_tfrecord(input_files, output_file):
function main (line 86) | def main(data_dir):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/model_base.py
class ResNet (line 29) | class ResNet(object):
method __init__ (line 32) | def __init__(self, is_training, data_format, batch_norm_decay, batch_n...
method forward_pass (line 46) | def forward_pass(self, x):
method _residual_v1 (line 50) | def _residual_v1(self,
method _residual_v2 (line 83) | def _residual_v2(self,
method _bottleneck_residual_v2 (line 120) | def _bottleneck_residual_v2(self,
method _conv (line 156) | def _conv(self, x, kernel_size, filters, strides, is_atrous=False):
method _batch_norm (line 178) | def _batch_norm(self, x):
method _relu (line 193) | def _relu(self, x):
method _fully_connected (line 196) | def _fully_connected(self, x, out_dim):
method _avg_pool (line 203) | def _avg_pool(self, x, pool_size, stride):
method _global_avg_pool (line 211) | def _global_avg_pool(self, x):
FILE: projects/kaggle/cifar10/baseline/tf/cifar10_estimator/train.py
function tower_loss (line 40) | def tower_loss(model, feature, label):
function main (line 69) | def main(_):
FILE: projects/kaggle/cifar10/tf/cifar10.py
class Cifar10DataSet (line 34) | class Cifar10DataSet(object):
method __init__ (line 40) | def __init__(self, data_dir, subset='train', use_distortion=True):
method get_filenames (line 45) | def get_filenames(self):
method parser (line 51) | def parser(self, serialized_example):
method make_batch (line 80) | def make_batch(self, batch_size, filenames=None, repeat=None, initiali...
method preprocess (line 112) | def preprocess(self, image):
method num_examples_per_epoch (line 133) | def num_examples_per_epoch(subset='train'):
FILE: projects/kaggle/cifar10/tf/cifar10_model.py
class ResNetCifar10 (line 26) | class ResNetCifar10(model_base.ResNet):
method __init__ (line 29) | def __init__(self,
method init_predict (line 47) | def init_predict(self, input_data_format='channels_last'):
method forward_pass (line 59) | def forward_pass(self, x, input_data_format='channels_last'):
method predict (line 102) | def predict(self, x=None, input_data_format='channels_last'):
class Model (line 116) | class Model(tf.keras.Model):
method __init__ (line 117) | def __init__(self):
method call (line 135) | def call(self, x, input_data_format='channels_last', training=False):
FILE: projects/kaggle/cifar10/tf/evaluate.py
function evaluate (line 26) | def evaluate(labels, logits, ids=None):
function write (line 39) | def write(ids, labels, logits, ofile):
function valid_write (line 50) | def valid_write(ids, labels, logits, ofile):
function infer_write (line 53) | def infer_write(ids, logits, ofile):
FILE: projects/kaggle/cifar10/tf/evaluator.py
function write (line 39) | def write(ids, predicts, model_path, labels=None, images=None, suffix='v...
function evaluate (line 67) | def evaluate(eval_ops, iterator, num_steps, num_examples, model_path=Non...
function inference (line 121) | def inference(ops, iterator, num_steps, num_examples, model_path=None, n...
FILE: projects/kaggle/cifar10/tf/loss.py
function criterion (line 20) | def criterion(model, x, y, training=False):
FILE: projects/kaggle/cifar10/tf/model_base.py
class ResNet (line 29) | class ResNet(object):
method __init__ (line 32) | def __init__(self, training, data_format, batch_norm_decay, batch_norm...
method forward_pass (line 46) | def forward_pass(self, x):
method _residual_v1 (line 50) | def _residual_v1(self,
method _residual_v2 (line 83) | def _residual_v2(self,
method _bottleneck_residual_v2 (line 120) | def _bottleneck_residual_v2(self,
method _conv (line 156) | def _conv(self, x, kernel_size, filters, strides, is_atrous=False):
method _batch_norm (line 178) | def _batch_norm(self, x):
method _relu (line 193) | def _relu(self, x):
method _fully_connected (line 196) | def _fully_connected(self, x, out_dim):
method _avg_pool (line 203) | def _avg_pool(self, x, pool_size, stride):
method _global_avg_pool (line 211) | def _global_avg_pool(self, x):
FILE: projects/kaggle/cifar10/tf/train.py
function tower_loss (line 39) | def tower_loss(model, feature, label):
function main (line 68) | def main(_):
FILE: projects/kaggle/cifar10/tf/train2.py
function get_dataset (line 35) | def get_dataset(subset):
function main (line 44) | def main(_):
FILE: projects/kaggle/toxic/algos/model.py
class MyModel (line 31) | class MyModel(keras.Model):
method __init__ (line 32) | def __init__(self):
method call (line 42) | def call(self, x):
class Model (line 45) | class Model(keras.Model):
method __init__ (line 46) | def __init__(self):
method call (line 81) | def call(self, x, training=False):
function criterion (line 100) | def criterion(model, x, y, training=False):
FILE: projects/kaggle/toxic/dataset.py
class Dataset (line 36) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 37) | def __init__(self, subset='train'):
method parser (line 40) | def parser(self, example):
FILE: projects/kaggle/toxic/evaluate.py
function calc_auc (line 21) | def calc_auc(labels, predicts):
FILE: projects/kaggle/toxic/prepare/count-unks.py
function run (line 24) | def run(input):
FILE: projects/kaggle/toxic/prepare/extend-table.py
function process (line 25) | def process(x):
FILE: projects/kaggle/toxic/prepare/gen-correction.py
function get_en_token (line 32) | def get_en_token(token):
function run (line 40) | def run(file_):
FILE: projects/kaggle/toxic/prepare/gen-en-lang-prob.py
function run (line 23) | def run(file_):
FILE: projects/kaggle/toxic/prepare/gen-lang.py
function run (line 28) | def run(file_):
FILE: projects/kaggle/toxic/prepare/gen-records-parse.py
function get_id (line 79) | def get_id(word, vocab):
function get_char_id (line 85) | def get_char_id(ch, vocab):
function get_ngram_id (line 90) | def get_ngram_id(ngram, vocab):
function get_mode (line 96) | def get_mode():
function get_fold (line 105) | def get_fold(ids, index):
function build_features (line 127) | def build_features(index):
function main (line 308) | def main(_):
FILE: projects/kaggle/toxic/prepare/gen-records.py
function get_id (line 56) | def get_id(word, vocab):
function get_char_id (line 62) | def get_char_id(ch, vocab):
function build_features (line 67) | def build_features(index):
function main (line 157) | def main(_):
FILE: projects/kaggle/toxic/prepare/gen-sentences-csv.py
function run (line 24) | def run():
FILE: projects/kaggle/toxic/prepare/gen-sentences.py
function run (line 25) | def run(index):
FILE: projects/kaggle/toxic/prepare/gen-tokens.py
function tokenize (line 66) | def tokenize(index):
function run (line 79) | def run(input):
function main (line 93) | def main(_):
FILE: projects/kaggle/toxic/prepare/gen-vocab-parse.py
function tokenize (line 90) | def tokenize(index):
function run (line 151) | def run(input, count=1):
function main (line 248) | def main(_):
FILE: projects/kaggle/toxic/prepare/gen-vocab.py
function tokenize (line 63) | def tokenize(index):
function run (line 76) | def run(input, count=1):
function main (line 103) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-2emb.py
function main (line 36) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-charemb.py
function main (line 31) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-emb.py
function main (line 35) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-glove.py
function main (line 36) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-ngram-emb.py
function main (line 40) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-word-ngram-emb.py
function main (line 37) | def main(_):
FILE: projects/kaggle/toxic/prepare/merge-wordemb.py
function main (line 31) | def main(_):
FILE: projects/kaggle/toxic/prepare/preprocess.py
function normalize (line 26) | def normalize(text):
function glove_twitter_preprocess (line 87) | def glove_twitter_preprocess(text):
FILE: projects/kaggle/toxic/prepare/test-tokenize.py
function tokenize (line 20) | def tokenize(text):
FILE: projects/kaggle/toxic/prepare/test-tokenize2.py
function tokenize (line 20) | def tokenize(text):
FILE: projects/kaggle/toxic/prepare/test-tokenize3.py
function tokenize (line 20) | def tokenize(text):
FILE: projects/kaggle/toxic/prepare/test-tokenize4.py
function tokenize (line 20) | def tokenize(text):
FILE: projects/kaggle/toxic/prepare/test-tokenize5.py
function tokenize (line 20) | def tokenize(text):
FILE: projects/kaggle/toxic/prepare/tokenize-corpus.py
function tokenize (line 23) | def tokenize(file_):
FILE: projects/kaggle/toxic/prepare/tokenizer-v2.py
function init (line 57) | def init(vocab_path='/home/gezi/data/glove/glove-vocab.txt'):
function dict_has (line 78) | def dict_has(word):
function has (line 84) | def has(word):
function en_filter (line 91) | def en_filter(token):
function can_split (line 128) | def can_split(w1, w2):
function try_split (line 131) | def try_split(token):
function is_toxic (line 168) | def is_toxic(word):
function maybe_toxic (line 171) | def maybe_toxic(word):
function get_token_len (line 177) | def get_token_len(token):
function is_en (line 183) | def is_en(token):
function get_attr (line 189) | def get_attr(token,
function tokenize (line 202) | def tokenize(text):
function full_tokenize (line 278) | def full_tokenize(text):
FILE: projects/kaggle/toxic/prepare/tokenizer-v3.py
function init (line 58) | def init(vocab_path='/home/gezi/data/glove/glove-vocab.txt'):
function dict_has (line 79) | def dict_has(word):
function has (line 85) | def has(word):
function en_filter (line 93) | def en_filter(token):
function can_split (line 130) | def can_split(w1, w2):
function try_split (line 133) | def try_split(token):
function is_toxic (line 170) | def is_toxic(word):
function get_token_len (line 182) | def get_token_len(token):
function is_en (line 188) | def is_en(token):
function get_attr (line 194) | def get_attr(token,
function tokenize (line 207) | def tokenize(text):
function full_tokenize (line 291) | def full_tokenize(text):
FILE: projects/kaggle/toxic/prepare/tokenizer.py
function init (line 66) | def init(vocab_path='/home/gezi/data/glove/glove-vocab.txt'):
function dict_has (line 90) | def dict_has(word):
function has (line 96) | def has(word):
function en_filter (line 104) | def en_filter(token):
function can_split (line 141) | def can_split(w1, w2):
function try_split (line 144) | def try_split(token):
function is_toxic (line 189) | def is_toxic(word):
function get_token_len (line 201) | def get_token_len(token):
function is_en (line 206) | def is_en(token):
function get_lemma (line 215) | def get_lemma(token):
function get_attr (line 230) | def get_attr(token,
function try_correct_toxic (line 246) | def try_correct_toxic(token):
function star_inside (line 264) | def star_inside(word):
function tokenize (line 270) | def tokenize(text, lemmatization=False):
function full_tokenize (line 371) | def full_tokenize(text, lemmatization=False):
FILE: projects/kaggle/toxic/prepare/toxic_words.py
function get_toxic_words (line 32) | def get_toxic_words():
FILE: projects/kaggle/toxic/read-records.py
function main (line 40) | def main(_):
FILE: projects/kaggle/toxic/train.py
function main (line 35) | def main(_):
FILE: tests/sample-balance/dataset.py
class Dataset (line 32) | class Dataset(melt.tfrecords.Dataset):
method __init__ (line 33) | def __init__(self, subset='train'):
method parser (line 51) | def parser(self, example):
FILE: tests/sample-balance/read-records.py
function main (line 46) | def main(_):
FILE: third/bert/create_pretraining_data.py
class TrainingInstance (line 67) | class TrainingInstance(object):
method __init__ (line 70) | def __init__(self, tokens, segment_ids, masked_lm_positions, masked_lm...
method __str__ (line 78) | def __str__(self):
method __repr__ (line 91) | def __repr__(self):
function write_instance_to_example_files (line 95) | def write_instance_to_example_files(instances, tokenizer, max_seq_length,
function create_int_feature (line 168) | def create_int_feature(values):
function create_float_feature (line 173) | def create_float_feature(values):
function create_training_instances (line 178) | def create_training_instances(input_files, tokenizer, max_seq_length,
function create_instances_from_document (line 229) | def create_instances_from_document(
function create_masked_lm_predictions (line 344) | def create_masked_lm_predictions(tokens, masked_lm_prob,
function truncate_seq_pair (line 399) | def truncate_seq_pair(tokens_a, tokens_b, max_num_tokens, rng):
function main (line 417) | def main(_):
FILE: third/bert/extract_features.py
class InputExample (line 81) | class InputExample(object):
method __init__ (line 83) | def __init__(self, unique_id, text_a, text_b):
class InputFeatures (line 89) | class InputFeatures(object):
method __init__ (line 92) | def __init__(self, unique_id, tokens, input_ids, input_mask, input_typ...
function input_fn_builder (line 100) | def input_fn_builder(features, seq_length):
function model_fn_builder (line 148) | def model_fn_builder(bert_config, init_checkpoint, layer_indexes, use_tpu,
function convert_examples_to_features (line 201) | def convert_examples_to_features(examples, seq_length, tokenizer):
function _truncate_seq_pair (line 292) | def _truncate_seq_pair(tokens_a, tokens_b, max_length):
function read_examples (line 309) | def read_examples(input_file):
function main (line 333) | def main(_):
FILE: third/bert/modeling.py
class BertConfig (line 32) | class BertConfig(object):
method __init__ (line 35) | def __init__(self,
method from_dict (line 84) | def from_dict(cls, json_object):
method from_json_file (line 92) | def from_json_file(cls, json_file):
method to_dict (line 98) | def to_dict(self):
method to_json_string (line 103) | def to_json_string(self):
class BertModel (line 108) | class BertModel(object):
method __init__ (line 132) | def __init__(self,
method get_pooled_output (line 238) | def get_pooled_output(self):
method get_sequence_output (line 241) | def get_sequence_output(self):
method get_all_encoder_layers (line 250) | def get_all_encoder_layers(self):
method get_embedding_output (line 253) | def get_embedding_output(self):
method get_embedding_table (line 264) | def get_embedding_table(self):
function gelu (line 268) | def gelu(input_tensor):
function get_activation (line 284) | def get_activation(activation_string):
function get_assigment_map_from_checkpoint (line 321) | def get_assigment_map_from_checkpoint(tvars, init_checkpoint):
function dropout (line 348) | def dropout(input_tensor, dropout_prob):
function layer_norm (line 366) | def layer_norm(input_tensor, name=None):
function layer_norm_and_dropout (line 372) | def layer_norm_and_dropout(input_tensor, dropout_prob, name=None):
function create_initializer (line 379) | def create_initializer(initializer_range=0.02):
function embedding_lookup (line 384) | def embedding_lookup(input_ids,
function embedding_postprocessor (line 471) | def embedding_postprocessor(input_tensor,
function create_attention_mask_from_input_mask (line 576) | def create_attention_mask_from_input_mask(from_tensor, to_mask):
function attention_layer (line 610) | def attention_layer(from_tensor,
function transformer_model (line 806) | def transformer_model(input_tensor,
function get_shape_list (line 947) | def get_shape_list(tensor, expected_rank=None, name=None):
function reshape_to_matrix (line 984) | def reshape_to_matrix(input_tensor):
function reshape_from_matrix (line 998) | def reshape_from_matrix(output_tensor, orig_shape_list):
function assert_rank (line 1011) | def assert_rank(tensor, expected_rank, name=None):
FILE: third/bert/modeling_test.py
class BertModelTest (line 29) | class BertModelTest(tf.test.TestCase):
class BertModelTester (line 31) | class BertModelTester(object):
method __init__ (line 33) | def __init__(self,
method create_model (line 71) | def create_model(self):
method check_output (line 114) | def check_output(self, result):
method test_default (line 126) | def test_default(self):
method test_config_to_json_string (line 129) | def test_config_to_json_string(self):
method run_tester (line 135) | def run_tester(self, tester):
method ids_tensor (line 147) | def ids_tensor(cls, shape, vocab_size, rng=None, name=None):
method assert_all_tensors_reachable (line 162) | def assert_all_tensors_reachable(self, sess, outputs):
method get_unreachable_ops (line 193) | def get_unreachable_ops(cls, graph, outputs):
method flatten_recursive (line 256) | def flatten_recursive(cls, item):
FILE: third/bert/optimization.py
function create_optimizer (line 25) | def create_optimizer(loss, init_lr, num_train_steps, num_warmup_steps, m...
class AdamWeightDecayOptimizer (line 90) | class AdamWeightDecayOptimizer(tf.train.Optimizer):
method __init__ (line 93) | def __init__(self,
method apply_gradients (line 111) | def apply_gradients(self, grads_and_vars, global_step=None, name=None):
method _do_use_weight_decay (line 162) | def _do_use_weight_decay(self, param_name):
method _get_variable_name (line 172) | def _get_variable_name(self, param_name):
FILE: third/bert/optimization_test.py
class OptimizationTest (line 23) | class OptimizationTest(tf.test.TestCase):
method test_adam (line 25) | def test_adam(self):
FILE: third/bert/run_classifier.py
class InputExample (line 121) | class InputExample(object):
method __init__ (line 124) | def __init__(self, guid, text_a, text_b=None, label=None):
class InputFeatures (line 142) | class InputFeatures(object):
method __init__ (line 145) | def __init__(self, input_ids, input_mask, segment_ids, label_id):
class DataProcessor (line 152) | class DataProcessor(object):
method get_train_examples (line 155) | def get_train_examples(self, data_dir):
method get_dev_examples (line 159) | def get_dev_examples(self, data_dir):
method get_labels (line 163) | def get_labels(self):
method _read_tsv (line 168) | def _read_tsv(cls, input_file, quotechar=None):
class XnliProcessor (line 178) | class XnliProcessor(DataProcessor):
method __init__ (line 181) | def __init__(self):
method get_train_examples (line 184) | def get_train_examples(self, data_dir):
method get_dev_examples (line 203) | def get_dev_examples(self, data_dir):
method get_labels (line 221) | def get_labels(self):
class MnliProcessor (line 226) | class MnliProcessor(DataProcessor):
method get_train_examples (line 229) | def get_train_examples(self, data_dir):
method get_dev_examples (line 234) | def get_dev_examples(self, data_dir):
method get_labels (line 240) | def get_labels(self):
method _create_examples (line 244) | def _create_examples(self, lines, set_type):
class MrpcProcessor (line 259) | class MrpcProcessor(DataProcessor):
method get_train_examples (line 262) | def get_train_examples(self, data_dir):
method get_dev_examples (line 267) | def get_dev_examples(self, data_dir):
method get_labels (line 272) | def get_labels(self):
method _create_examples (line 276) | def _create_examples(self, lines, set_type):
class ColaProcessor (line 291) | class ColaProcessor(DataProcessor):
method get_train_examples (line 294) | def get_train_examples(self, data_dir):
method get_dev_examples (line 299) | def get_dev_examples(self, data_dir):
method get_labels (line 304) | def get_labels(self):
method _create_examples (line 308) | def _create_examples(self, lines, set_type):
function convert_examples_to_features (line 320) | def convert_examples_to_features(examples, label_list, max_seq_length,
function _truncate_seq_pair (line 427) | def _truncate_seq_pair(tokens_a, tokens_b, max_length):
function create_model (line 444) | def create_model(bert_config, is_training, input_ids, input_mask, segmen...
function model_fn_builder (line 488) | def model_fn_builder(bert_config, num_labels, init_checkpoint, learning_...
function input_fn_builder (line 572) | def input_fn_builder(input_file, seq_length, is_training, drop_remainder):
function main (line 618) | def main(_):
FILE: third/bert/run_pretraining.py
function model_fn_builder (line 109) | def model_fn_builder(bert_config, init_checkpoint, learning_rate,
function get_masked_lm_output (line 241) | def get_masked_lm_output(bert_config, input_tensor, output_weights, posi...
function get_next_sentence_output (line 286) | def get_next_sentence_output(bert_config, input_tensor, labels):
function gather_indexes (line 309) | def gather_indexes(sequence_tensor, positions):
function input_fn_builder (line 325) | def input_fn_builder(input_files,
function _decode_record (line 392) | def _decode_record(record, name_to_features):
function main (line 407) | def main(_):
FILE: third/bert/run_squad.py
class SquadExample (line 149) | class SquadExample(object):
method __init__ (line 152) | def __init__(self,
method __str__ (line 166) | def __str__(self):
method __repr__ (line 169) | def __repr__(self):
class InputFeatures (line 182) | class InputFeatures(object):
method __init__ (line 185) | def __init__(self,
function read_squad_examples (line 210) | def read_squad_examples(input_file, is_training):
function convert_examples_to_features (line 279) | def convert_examples_to_features(examples, tokenizer, max_seq_length,
function _improve_answer_span (line 433) | def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer,
function _check_is_max_context (line 470) | def _check_is_max_context(doc_spans, cur_span_index, position):
function create_model (line 507) | def create_model(bert_config, is_training, input_ids, input_mask, segmen...
function model_fn_builder (line 547) | def model_fn_builder(bert_config, init_checkpoint, learning_rate,
function input_fn_builder (line 645) | def input_fn_builder(input_file, seq_length, is_training, drop_remainder):
function write_predictions (line 699) | def write_predictions(all_examples, all_features, all_results, n_best_size,
function get_final_text (line 833) | def get_final_text(pred_text, orig_text, do_lower_case):
function _get_best_indexes (line 929) | def _get_best_indexes(logits, n_best_size):
function _compute_softmax (line 941) | def _compute_softmax(scores):
class FeatureWriter (line 964) | class FeatureWriter(object):
method __init__ (line 967) | def __init__(self, filename, is_training):
method process_feature (line 973) | def process_feature(self, feature):
method close (line 995) | def close(self):
function validate_flags_or_throw (line 999) | def validate_flags_or_throw(bert_config):
function main (line 1025) | def main(_):
FILE: third/bert/tokenization.py
function convert_to_unicode (line 27) | def convert_to_unicode(text):
function printable_text (line 47) | def printable_text(text):
function load_vocab (line 70) | def load_vocab(vocab_file):
function convert_tokens_to_ids (line 85) | def convert_tokens_to_ids(vocab, tokens):
function whitespace_tokenize (line 93) | def whitespace_tokenize(text):
class FullTokenizer (line 102) | class FullTokenizer(object):
method __init__ (line 105) | def __init__(self, vocab_file, do_lower_case=True):
method tokenize (line 110) | def tokenize(self, text):
method convert_tokens_to_ids (line 118) | def convert_tokens_to_ids(self, tokens):
class BasicTokenizer (line 122) | class BasicTokenizer(object):
method __init__ (line 125) | def __init__(self, do_lower_case=True):
method tokenize (line 133) | def tokenize(self, text):
method _run_strip_accents (line 157) | def _run_strip_accents(self, text):
method _run_split_on_punc (line 168) | def _run_split_on_punc(self, text):
method _tokenize_chinese_chars (line 188) | def _tokenize_chinese_chars(self, text):
method _is_chinese_char (line 201) | def _is_chinese_char(self, cp):
method _clean_text (line 223) | def _clean_text(self, text):
class WordpieceTokenizer (line 237) | class WordpieceTokenizer(object):
method __init__ (line 240) | def __init__(self, vocab, unk_token="[UNK]", max_input_chars_per_word=...
method tokenize (line 245) | def tokenize(self, text):
function _is_whitespace (line 299) | def _is_whitespace(char):
function _is_control (line 311) | def _is_control(char):
function _is_punctuation (line 323) | def _is_punctuation(char):
FILE: third/bert/tokenization_test.py
class TokenizationTest (line 26) | class TokenizationTest(tf.test.TestCase):
method test_full_tokenizer (line 28) | def test_full_tokenizer(self):
method test_chinese (line 47) | def test_chinese(self):
method test_basic_tokenizer_lower (line 54) | def test_basic_tokenizer_lower(self):
method test_basic_tokenizer_no_lower (line 62) | def test_basic_tokenizer_no_lower(self):
method test_wordpiece_tokenizer (line 69) | def test_wordpiece_tokenizer(self):
method test_convert_tokens_to_ids (line 89) | def test_convert_tokens_to_ids(self):
method test_is_whitespace (line 103) | def test_is_whitespace(self):
method test_is_control (line 113) | def test_is_control(self):
method test_is_punctuation (line 121) | def test_is_punctuation(self):
FILE: utils/gezi/avg_score.py
class AvgScore (line 15) | class AvgScore():
method __init__ (line 20) | def __init__(self):
method reset (line 23) | def reset(self):
method add (line 28) | def add(self, score):
method avg_score (line 39) | def avg_score(self):
FILE: utils/gezi/bigdata_util.py
function init (line 36) | def init():
function get_handle (line 42) | def get_handle():
function fullpath (line 46) | def fullpath(path):
function glob (line 49) | def glob(file_pattern):
function hdfs_listdir (line 65) | def hdfs_listdir(dir):
function list_files (line 74) | def list_files(input):
function is_remote_path (line 88) | def is_remote_path(path):
FILE: utils/gezi/bleu.py
function normalize (line 44) | def normalize(s):
function count_ngrams (line 63) | def count_ngrams(words, n=4):
function cook_refs (line 71) | def cook_refs(refs, n=4):
function cook_test (line 84) | def cook_test(test, (reflens, refmaxcounts), n=4):
function score_cooked (line 114) | def score_cooked(allcomps, n=4):
function score_set (line 133) | def score_set(set, testid, refids, n=4):
FILE: utils/gezi/gezi_util.py
function gprint (line 9) | def gprint(convert2utf8, *content):
function uprint (line 15) | def uprint(*content):
function toutf8 (line 18) | def toutf8(content):
function togbk (line 21) | def togbk(content):
function now_time (line 25) | def now_time():
function get_timestr (line 28) | def get_timestr(stamp):
function get_datestr (line 36) | def get_datestr(stamp):
function pretty_print (line 44) | def pretty_print(df):
function print_list (line 54) | def print_list(l, sep='|'):
function get_words (line 59) | def get_words(l, ngram, sep = '\x01'):
function get_ngram_words (line 68) | def get_ngram_words(l, ngram, sep = '\x01'):
function get_skipn_bigram (line 79) | def get_skipn_bigram(l, n, sep = '\x01'):
function get_skipn_bigram (line 88) | def get_skipn_bigram(l, li, n, sep = '\x01'):
function get_skip_bigram (line 95) | def get_skip_bigram(l, li, n, sep = '\x01'):
function h2o (line 99) | def h2o(x):
function h2o2 (line 107) | def h2o2(x):
function json2obj (line 115) | def json2obj(s):
function json2obj2 (line 122) | def json2obj2(s):
function jsonfile2obj (line 129) | def jsonfile2obj(path):
function jsonfile2obj2 (line 132) | def jsonfile2obj2(path):
function xmlfile2obj (line 135) | def xmlfile2obj(path):
function xmlfile2obj2 (line 143) | def xmlfile2obj2(path):
function dict2map (line 158) | def dict2map(dict_, map_):
function map2dict (line 162) | def map2dict(map_):
function list2vec (line 168) | def list2vec(list_, vec_):
function list2vector (line 172) | def list2vector(list_, vec_):
function vec2list (line 176) | def vec2list(vec_):
function vector2list (line 182) | def vector2list(vec_):
function get_filepaths (line 188) | def get_filepaths(directory):
function get_num_lines (line 206) | def get_num_lines(file):
FILE: utils/gezi/hash.py
function hash_str (line 21) | def hash_str(input):
function fasttext_hash (line 29) | def fasttext_hash(word):
FILE: utils/gezi/libgezi_util.py
function to_simplify_ (line 27) | def to_simplify_(sentence):
function to_simplify (line 39) | def to_simplify(sentence):
function normalize_ (line 67) | def normalize_(sentence, to_lower=True, to_simplify=True, to_half=True):
function normalize (line 79) | def normalize(sentence, to_lower=True, to_simplify=True, to_half=True):
function get_single_cns (line 110) | def get_single_cns(text):
function is_single_cn (line 113) | def is_single_cn(word):
function get_single_chars (line 117) | def get_single_chars(text):
function get_single_cns (line 122) | def get_single_cns(text):
function is_cn (line 144) | def is_cn(word):
function is_single_cn (line 149) | def is_single_cn(word):
function get_single_chars (line 152) | def get_single_chars(text):
FILE: utils/gezi/melt/logging.py
function set_hvd (line 48) | def set_hvd(hvd_):
function info (line 52) | def info(*args):
function info2 (line 56) | def info2(*args):
function fatal (line 60) | def fatal(*args):
function error (line 64) | def error(*args):
function debug (line 68) | def debug(*args):
function warn (line 72) | def warn(*args):
function warning (line 76) | def warning(*args):
class ElapsedFormatter (line 83) | class ElapsedFormatter():
method __init__ (line 84) | def __init__(self):
method format (line 87) | def format(self, record):
function _get_handler (line 96) | def _get_handler(file, formatter, split=True, split_bytime=False, mode =...
function set_dir (line 113) | def set_dir(path, file='log.html', logtostderr=True, logtofile=True, spl...
function init (line 147) | def init(path, file='log.html', logtostderr=True, logtofile=True, split=...
function vlog (line 151) | def vlog(level, msg, *args, **kwargs):
function get_verbosity (line 154) | def get_verbosity():
function set_verbosity (line 158) | def set_verbosity(verbosity):
function get_logging_file (line 162) | def get_logging_file():
FILE: utils/gezi/melt/tfrecords.py
class Writer (line 19) | class Writer(object):
method __init__ (line 20) | def __init__(self, file, buffer_size=None):
method __del__ (line 28) | def __del__(self):
method __enter__ (line 32) | def __enter__(self):
method __exit__ (line 35) | def __exit__(self, exc_type, exc_value, traceback):
method close (line 39) | def close(self):
method finalize (line 46) | def finalize(self):
method write (line 49) | def write(self, example):
method size (line 61) | def size(self):
FILE: utils/gezi/melt/util.py
function int_feature (line 19) | def int_feature(value):
function int64_feature (line 25) | def int64_feature(value):
function bytes_feature (line 31) | def bytes_feature(value):
function float_feature (line 40) | def float_feature(value):
function int64_feature_list (line 53) | def int64_feature_list(values):
function bytes_feature_list (line 58) | def bytes_feature_list(values):
function float_feature_list (line 63) | def float_feature_list(values):
FILE: utils/gezi/metrics/bleu/bleu.py
class Bleu (line 14) | class Bleu:
method __init__ (line 15) | def __init__(self, n=4):
method compute_score (line 21) | def compute_score(self, gts, res):
method method (line 47) | def method(self):
FILE: utils/gezi/metrics/bleu/bleu_scorer.py
function precook (line 23) | def precook(s, n=4, out=False):
function cook_refs (line 35) | def cook_refs(refs, eff=None, n=4): ## lhuang: oracle will call with "av...
function cook_test (line 60) | def cook_test(test, l, eff=None, n=4):
class BleuScorer (line 85) | class BleuScorer(object):
method copy (line 92) | def copy(self):
method __init__ (line 100) | def __init__(self, test=None, refs=None, n=4, special_reflen=None):
method cook_append (line 109) | def cook_append(self, test, refs):
method ratio (line 122) | def ratio(self, option=None):
method score_ratio (line 126) | def score_ratio(self, option=None):
method score_ratio_str (line 130) | def score_ratio_str(self, option=None):
method reflen (line 133) | def reflen(self, option=None):
method testlen (line 137) | def testlen(self, option=None):
method retest (line 141) | def retest(self, new_test):
method rescore (line 152) | def rescore(self, new_test):
method size (line 157) | def size(self):
method __iadd__ (line 161) | def __iadd__(self, other):
method compatible (line 175) | def compatible(self, other):
method single_reflen (line 178) | def single_reflen(self, option="average"):
method _single_reflen (line 181) | def _single_reflen(self, reflens, option=None, testlen=None):
method recompute_score (line 194) | def recompute_score(self, option=None, verbose=0):
method compute_score (line 198) | def compute_score(self, option=None, verbose=0):
FILE: utils/gezi/metrics/cider/cider.py
class Cider (line 23) | class Cider:
method __init__ (line 28) | def __init__(self, test=None, refs=None, n=4, sigma=6.0, document_freq...
method compute_score (line 47) | def compute_score(self, gts, res):
method method (line 78) | def method(self):
FILE: utils/gezi/metrics/cider/cider_scorer.py
function precook (line 12) | def precook(s, n=4, out=False):
function cook_refs (line 29) | def cook_refs(refs, n=4): ## lhuang: oracle will call with "average"
function cook_test (line 39) | def cook_test(test, n=4):
class CiderScorer (line 48) | class CiderScorer(object):
method copy (line 52) | def copy(self):
method __init__ (line 59) | def __init__(self, test=None, refs=None, n=4, sigma=6.0,
method cook_append (line 70) | def cook_append(self, test, refs):
method size (line 80) | def size(self):
method __iadd__ (line 84) | def __iadd__(self, other):
method compute_doc_freq (line 95) | def compute_doc_freq(self):
method compute_cider (line 109) | def compute_cider(self):
method compute_score (line 187) | def compute_score(self, option=None, verbose=0):
FILE: utils/gezi/metrics/ciderD/ciderD.py
class CiderD (line 13) | class CiderD:
method __init__ (line 18) | def __init__(self, n=4, sigma=6.0, df="corpus"):
method compute_score (line 26) | def compute_score(self, gts, res):
method method (line 52) | def method(self):
FILE: utils/gezi/metrics/ciderD/ciderD_scorer.py
function precook (line 13) | def precook(s, n=4, out=False):
function cook_refs (line 30) | def cook_refs(refs, n=4): ## lhuang: oracle will call with "average"
function cook_test (line 40) | def cook_test(test, n=4):
class CiderScorer (line 49) | class CiderScorer(object):
method copy (line 53) | def copy(self):
method __init__ (line 60) | def __init__(self, test=None, refs=None, n=4, sigma=6.0):
method cook_append (line 70) | def cook_append(self, test, refs):
method size (line 80) | def size(self):
method __iadd__ (line 84) | def __iadd__(self, other):
method compute_doc_freq (line 95) | def compute_doc_freq(self):
method compute_cider (line 108) | def compute_cider(self, df_mode):
method compute_score (line 189) | def compute_score(self, df_mode, option=None, verbose=0):
FILE: utils/gezi/metrics/correlation/correlation.py
function lcc (line 19) | def lcc(trues, predicts):
function srocc (line 28) | def srocc(trues, predicts):
FILE: utils/gezi/metrics/eval.py
class COCOEvalCap (line 8) | class COCOEvalCap:
method __init__ (line 9) | def __init__(self, coco, cocoRes):
method evaluate (line 17) | def evaluate(self):
method setEval (line 62) | def setEval(self, score, method):
method setImgToEvalImgs (line 65) | def setImgToEvalImgs(self, scores, imgIds, method):
method setEvalImgs (line 72) | def setEvalImgs(self):
FILE: utils/gezi/metrics/meteor/meteor.py
class Meteor (line 15) | class Meteor:
method __init__ (line 17) | def __init__(self):
method compute_score (line 28) | def compute_score(self, gts, res):
method method (line 48) | def method(self):
method _stat (line 51) | def _stat(self, hypothesis_str, reference_list):
method _score (line 58) | def _score(self, hypothesis_str, reference_list):
method __del__ (line 75) | def __del__(self):
FILE: utils/gezi/metrics/new_cider/cider.py
class Cider (line 15) | class Cider:
method __init__ (line 20) | def __init__(self, n=4, df='corpus', num_docs=30000):
method compute_score (line 26) | def compute_score(self, gts, res):
method method (line 55) | def method(self):
FILE: utils/gezi/metrics/new_cider/cider_scorer.py
function precook (line 12) | def precook(s, n=4, out=False):
function cook_refs (line 29) | def cook_refs(refs, n=4): ## lhuang: oracle will call with "average"
function cook_test (line 39) | def cook_test(test, n=4):
class CiderScorer (line 48) | class CiderScorer(object):
method copy (line 52) | def copy(self):
method __init__ (line 59) | def __init__(self, test=None, refs=None, n=4, sigma=6.0, num_imgs=3000...
method cook_append (line 71) | def cook_append(self, test, refs):
method size (line 81) | def size(self):
method __iadd__ (line 85) | def __iadd__(self, other):
method compute_doc_freq (line 96) | def compute_doc_freq(self):
method compute_cider (line 109) | def compute_cider(self, df_mode="corpus"):
method compute_score (line 188) | def compute_score(self, df_mode, option=None, verbose=0):
FILE: utils/gezi/metrics/rouge/rouge.py
function my_lcs (line 13) | def my_lcs(string, sub):
class Rouge (line 36) | class Rouge():
method __init__ (line 41) | def __init__(self):
method calc_score (line 45) | def calc_score(self, candidate, refs):
method compute_score (line 77) | def compute_score(self, gts, res):
method method (line 104) | def method(self):
FILE: utils/gezi/metrics/tokenizer/ptbtokenizer.py
class PTBTokenizer (line 24) | class PTBTokenizer:
method tokenize (line 27) | def tokenize(self, captions_for_image):
FILE: utils/gezi/ngram.py
function get_ngrams (line 29) | def get_ngrams(input, minn=3, maxn=3, start='<', end='>'):
function get_ngrams_hash (line 42) | def get_ngrams_hash(input, buckets, minn=3, maxn=6, start='<', end='>', ...
function fasttext_ids (line 48) | def fasttext_ids(word, vocab, buckets, minn=3, maxn=6, start='<', end='>'):
FILE: utils/gezi/pydict.py
class Pydict (line 11) | class Pydict :
method __init__ (line 12) | def __init__(self,path_dm) :
method search (line 19) | def search(self,query,option):
method close (line 27) | def close(self) :
FILE: utils/gezi/rank_metrics.py
function mean_reciprocal_rank (line 12) | def mean_reciprocal_rank(rs):
function r_precision (line 35) | def r_precision(r):
function precision_at_k (line 60) | def precision_at_k(r, k):
function recall_at_k (line 88) | def recall_at_k(r, k):
function average_precision (line 93) | def average_precision(r):
function mean_average_precision (line 115) | def mean_average_precision(rs):
function dcg_at_k (line 133) | def dcg_at_k(r, k, method=1):
function ndcg_at_k (line 172) | def ndcg_at_k(r, k, method=1):
class RankMetrics (line 204) | class RankMetrics():
method __init__ (line 205) | def __init__(self):
method add (line 224) | def add(self, labels):
method finalize (line 241) | def finalize(self):
method get_metrics (line 245) | def get_metrics(self):
method get_names (line 250) | def get_names(self):
class RecallMetrics (line 253) | class RecallMetrics():
method __init__ (line 254) | def __init__(self):
method add (line 265) | def add(self, labels):
method finalize (line 274) | def finalize(self):
method get_metrics (line 278) | def get_metrics(self):
method get_names (line 283) | def get_names(self):
FILE: utils/gezi/segment.py
function segment_gbk_char (line 33) | def segment_gbk_char(text, cn_only=False):
function segment_utf8_char (line 69) | def segment_utf8_char(text, cn_only=False):
function segment_utf8_pinyin (line 96) | def segment_utf8_pinyin(text, cn_only=False):
function segment_utf8_pinyin2 (line 105) | def segment_utf8_pinyin2(text, cn_only=False):
function segment_en (line 115) | def segment_en(text):
function filter_quota (line 119) | def filter_quota(text):
function tokenize (line 129) | def tokenize(text):
function init_spacy_full (line 148) | def init_spacy_full():
function doc (line 156) | def doc(text):
function tokenize_filter_empty (line 171) | def tokenize_filter_empty(text):
function init_stanford_nlp (line 199) | def init_stanford_nlp(path='/home/gezi/soft/stanford-corenlp', lang='zh'):
function remove_duplicate (line 214) | def remove_duplicate(text):
function cut (line 236) | def cut(text, type='word'):
function is_emoji_en (line 250) | def is_emoji_en(word):
function hack_emoji (line 256) | def hack_emoji(l):
function hack_emoji2 (line 270) | def hack_emoji2(l):
function merge_expression (line 299) | def merge_expression(l):
function merge_expression2 (line 318) | def merge_expression2(l):
function init_bseg (line 338) | def init_bseg(use_pos=False, use_ner=False):
function to_gbk (line 355) | def to_gbk(text):
function to_utf8 (line 358) | def to_utf8(text):
function init_sp (line 363) | def init_sp(path=None):
function word_cut (line 374) | def word_cut(text):
function pos_cut (line 424) | def pos_cut(text):
function ner_cut (line 479) | def ner_cut(text):
class JiebaSegmentor (line 552) | class JiebaSegmentor(object):
method __init__ (line 553) | def __init__(self):
method segment_basic_single (line 556) | def segment_basic_single(self, text):
method segment_basic_single_all (line 562) | def segment_basic_single_all(self, text):
method segment_full_single (line 568) | def segment_full_single(self, text):
method Segment (line 574) | def Segment(self, text, method='basic'):
class BSegmentor (line 674) | class BSegmentor(object):
method __init__ (line 675) | def __init__(self, data='./data/wordseg', conf='./conf/scw.conf'):
method segment_nodupe_noseq (line 680) | def segment_nodupe_noseq(self, text):
method Segment_nodupe_noseq (line 692) | def Segment_nodupe_noseq(self, text):
method segment_nodupe (line 695) | def segment_nodupe(self, text):
method Segment_nodupe (line 702) | def Segment_nodupe(self, text):
method segment (line 706) | def segment(self, text):
method segment_seq_all (line 729) | def segment_seq_all(self, text):
method segment_phrase (line 746) | def segment_phrase(self, text):
method segment_basic (line 749) | def segment_basic(self, text):
method segment_phrase_single (line 752) | def segment_phrase_single(self, text):
method segment_phrase_single_all (line 757) | def segment_phrase_single_all(self, text):
method segment_basic_single (line 762) | def segment_basic_single(self, text):
method segment_basic_single_all (line 767) | def segment_basic_single_all(self, text):
method segment_phrase_single_all (line 772) | def segment_phrase_single_all(self, text):
method segment_merge_newword_single (line 777) | def segment_merge_newword_single(self, text):
method Segment (line 782) | def Segment(self, text, method='default'):
function segments (line 865) | def segments(texts, segmentor):
function segments_multiprocess (line 884) | def segments_multiprocess(texts, segmentor):
FILE: utils/gezi/summary.py
class SummaryWriter (line 32) | class SummaryWriter(object):
method __init__ (line 34) | def __init__(self, log_dir):
method scalar (line 38) | def scalar(self, tag, value, step):
method image (line 44) | def image(self, tag, images, step, texts=None, bytes_input=False):
method history (line 88) | def history(self, tag, values, step, bins=1000):
FILE: utils/gezi/test/test_ngrams.py
function ngrams (line 23) | def ngrams(word, minn=3, maxn=3):
FILE: utils/gezi/timer.py
class Timer (line 22) | class Timer():
method __init__ (line 23) | def __init__(self, info='', print_before=False):
method elapsed (line 29) | def elapsed(self):
method elapsed_ms (line 35) | def elapsed_ms(self):
method print (line 39) | def print(self):
method print_elapsed (line 45) | def print_elapsed(self):
FILE: utils/gezi/topn.py
class TopN (line 20) | class TopN(object):
method __init__ (line 23) | def __init__(self, n, reverse=True):
method size (line 28) | def size(self):
method push (line 32) | def push(self, x):
method extract (line 40) | def extract(self, sort=False):
method reset (line 59) | def reset(self):
FILE: utils/gezi/util.py
function is_cn (line 31) | def is_cn(word):
function break_sentence (line 34) | def break_sentence(sentence, max_sent_len, additional=5):
function add_start_end (line 54) | def add_start_end(w, start='', end=''):
function str2scores (line 57) | def str2scores(l):
function get_unmodify_minutes (line 65) | def get_unmodify_minutes(file_):
function extract_emojis (line 85) | def extract_emojis(content):
function remove_emojis (line 91) | def remove_emojis(sentence):
function is_emoji (line 97) | def is_emoji(w):
function dict2namedtuple (line 101) | def dict2namedtuple(thedict, name):
function csv (line 116) | def csv(s):
function get_weights (line 121) | def get_weights(weights):
function probs_entropy (line 130) | def probs_entropy(probs):
function dist (line 135) | def dist(x,y):
function cosine (line 138) | def cosine(a, b):
function softmax (line 143) | def softmax(x, axis=-1):
function sigmoid (line 151) | def sigmoid(x):
function load_image_into_numpy_array (line 155) | def load_image_into_numpy_array(image):
function dirname (line 161) | def dirname(input):
function non_empty (line 170) | def non_empty(file):
function merge_dicts (line 173) | def merge_dicts(*dict_args):
function norm (line 184) | def norm(text):
function loggest_match (line 187) | def loggest_match(cns, vocab, encode_unk=False, unk_vocab_size=None, voc...
function loggest_match_seg (line 202) | def loggest_match_seg(word, vocab, encode_unk=False):
function index (line 213) | def index(l, val):
function to_pascal_name (line 219) | def to_pascal_name(name):
function to_gnu_name (line 224) | def to_gnu_name(name):
function pascal2gnu (line 229) | def pascal2gnu(name):
function gnu2pascal (line 243) | def gnu2pascal(name):
function is_gbk_luanma (line 265) | def is_gbk_luanma(text):
function gen_sum_list (line 268) | def gen_sum_list(l):
function add_one (line 274) | def add_one(d, word):
function pretty_floats (line 280) | def pretty_floats(values):
function get_singles (line 287) | def get_singles(l):
function is_single (line 293) | def is_single(item):
function iterable (line 296) | def iterable(item):
function is_list_or_tuple (line 303) | def is_list_or_tuple(item):
function get_value_name_list (line 306) | def get_value_name_list(values, names):
function batches (line 310) | def batches(l, batch_size):
function pad (line 320) | def pad(l, maxlen, mark=0):
function nppad (line 329) | def nppad(l, maxlen):
function try_mkdir (line 335) | def try_mkdir(dir):
function get_dir (line 340) | def get_dir(path):
function dedupe_list (line 346) | def dedupe_list(l):
function parallel_run (line 358) | def parallel_run(target, args_list, num_threads):
function multithreads_run (line 369) | def multithreads_run(target, args_list):
function is_glob_pattern (line 382) | def is_glob_pattern(input):
function file_is_empty (line 385) | def file_is_empty(path):
function list_files (line 388) | def list_files(inputs):
function sorted_ls (line 408) | def sorted_ls(path, time_descending=True):
function list_models (line 412) | def list_models(model_dir, time_descending=True):
function save_conf (line 421) | def save_conf(con):
function write_to_txt (line 432) | def write_to_txt(data, file):
function read_int_from (line 436) | def read_int_from(file, default_value=None):
function read_float_from (line 439) | def read_float_from(file, default_value=None):
function read_str_from (line 442) | def read_str_from(file, default_value=None):
function img_html (line 445) | def img_html(img):
function text_html (line 448) | def text_html(text):
function thtml (line 451) | def thtml(text):
function hprint (line 455) | def hprint(content):
function imgprint (line 458) | def imgprint(img):
function unison_shuffle (line 462) | def unison_shuffle(a, b):
function finalize_feature (line 477) | def finalize_feature(fe, mode='w', outfile='./feature_name.txt', sep='\n'):
function write_feature_names (line 486) | def write_feature_names(names, mode='a', outfile='./feature_name.txt', s...
function get_feature_names (line 491) | def get_feature_names(file_):
function read_feature_names (line 500) | def read_feature_names(file_):
function get_feature_names_dict (line 509) | def get_feature_names_dict(file_):
function read_feature_names_dict (line 520) | def read_feature_names_dict(file_):
function update_sparse_feature (line 531) | def update_sparse_feature(feature, num_pre_features):
function merge_sparse_feature (line 536) | def merge_sparse_feature(fe1, fe2, num_fe1):
function edit_distance (line 546) | def edit_distance(first,second):
function save_json (line 569) | def save_json(obj, filename):
function load_json (line 575) | def load_json(filename):
function read_json (line 582) | def read_json(filename):
function strip_suffix (line 585) | def strip_suffix(s, suf):
function log (line 590) | def log(text, array):
function log_full (line 604) | def log_full(text, array):
function env_has (line 611) | def env_has(name):
function env_get (line 614) | def env_get(name):
function env_set (line 620) | def env_set(name, val=1):
function has_env (line 623) | def has_env(name):
function get_env (line 626) | def get_env(name):
function set_env (line 632) | def set_env(name, val=1):
function env_val (line 635) | def env_val(name, default=None):
function use_matplotlib (line 638) | def use_matplotlib(backend='Agg'):
function decode (line 642) | def decode(bytes_list):
function get_fold (line 651) | def get_fold(total, num_folds, index):
function is_fold (line 663) | def is_fold(input, fold):
function to_list (line 674) | def to_list(item):
function repeat (line 679) | def repeat(iter):
FILE: utils/gezi/vocabulary.py
class Vocabulary (line 31) | class Vocabulary(object):
method __init__ (line 34) | def __init__(self,
method is_special (line 158) | def is_special(self, word):
method word_to_id (line 161) | def word_to_id(self, word):
method id (line 171) | def id(self, word):
method id_to_word (line 181) | def id_to_word(self, word_id):
method key (line 188) | def key(self, word_id):
method count (line 195) | def count(self, word_id):
method count_word (line 201) | def count_word(self, word):
method size (line 207) | def size(self):
method start_id (line 210) | def start_id(self):
method end_id (line 213) | def end_id(self):
method unk_id (line 216) | def unk_id(self):
method has (line 220) | def has(self, word):
method add (line 223) | def add(self, word):
method words (line 229) | def words(self):
FILE: utils/gezi/word_counter.py
class WordCounter (line 18) | class WordCounter(object):
method __init__ (line 19) | def __init__(self,
method add (line 32) | def add(self, word, count=1):
method save (line 36) | def save(self, filename, most_common=None, min_count=None):
FILE: utils/gezi/zhtools/chconv.py
function default_error_handler (line 11478) | def default_error_handler(char, e):
function empty_error_handler (line 11482) | def empty_error_handler(char, e):
function null_error_handler (line 11486) | def null_error_handler(char, e):
function raise_error_handler (line 11490) | def raise_error_handler(char, e):
function converter (line 11494) | def converter(text, table, errors=None):
class ConverterTest (line 11521) | class ConverterTest(unittest.TestCase):
method toU (line 11522) | def toU(self, s):
method testSimpTrad (line 11525) | def testSimpTrad(self):
method testSimpKanji (line 11535) | def testSimpKanji(self):
method testTradKanji (line 11541) | def testTradKanji(self):
FILE: utils/gezi/zhtools/langconv.py
class Node (line 46) | class Node(object):
method __init__ (line 47) | def __init__(self, from_word, to_word=None, is_tail=True,
method is_original_long_word (line 61) | def is_original_long_word(self):
method is_follow (line 64) | def is_follow(self, chars):
method __str__ (line 67) | def __str__(self):
class ConvertMap (line 73) | class ConvertMap(object):
method __init__ (line 74) | def __init__(self, name, mapping=None):
method set_convert_map (line 80) | def set_convert_map(self, mapping):
method __getitem__ (line 97) | def __getitem__(self, k):
method __contains__ (line 104) | def __contains__(self, k):
method __len__ (line 107) | def __len__(self):
class StatesMachineException (line 110) | class StatesMachineException(Exception): pass
class StatesMachine (line 112) | class StatesMachine(object):
method __init__ (line 113) | def __init__(self):
method clone (line 119) | def clone(self, pool):
method feed (line 125) | def feed(self, char, map):
method __len__ (line 180) | def __len__(self):
method __str__ (line 183) | def __str__(self):
class Converter (line 188) | class Converter(object):
method __init__ (line 189) | def __init__(self, to_encoding):
method feed (line 194) | def feed(self, char):
method _clean (line 211) | def _clean(self):
method start (line 218) | def start(self):
method end (line 222) | def end(self):
method convert (line 227) | def convert(self, string):
method get_result (line 234) | def get_result(self):
function registery (line 238) | def registery(name, mapping):
function run (line 247) | def run():
FILE: utils/gezi/zhtools/test_langconv.py
class ConvertMapTest (line 8) | class ConvertMapTest(TestCase):
method test_map (line 9) | def test_map(self):
class ConverterModelTest (line 23) | class ConverterModelTest(TestCase):
method test_1 (line 24) | def test_1(self):
method test_2 (line 34) | def test_2(self):
method test_3 (line 42) | def test_3(self):
method test_4 (line 54) | def test_4(self):
method test_5 (line 66) | def test_5(self):
method test_6 (line 76) | def test_6(self):
method test_7 (line 90) | def test_7(self):
method test_8 (line 103) | def test_8(self):
method test_9 (line 118) | def test_9(self):
method test_10 (line 130) | def test_10(self):
class ConverterTest (line 141) | class ConverterTest(TestCase):
method assertConvert (line 142) | def assertConvert(self, name, string, converted):
method assertST (line 149) | def assertST(self, trad, simp):
method test_zh1 (line 156) | def test_zh1(self):
method test_zh2 (line 164) | def test_zh2(self):
method test_zh3 (line 168) | def test_zh3(self):
method test_zh4 (line 174) | def test_zh4(self):
FILE: utils/gezi/zhtools/xpinyin.py
class Pinyin (line 23) | class Pinyin(object):
method __init__ (line 47) | def __init__(self):
method py2hz (line 59) | def py2hz(self, pinyin):
method get_pinyin (line 71) | def get_pinyin(self, chars='', splitter='', tone=False):
method get_initials (line 84) | def get_initials(self, char=''):
class PinyinTestCase (line 93) | class PinyinTestCase(unittest.TestCase):
method setUp (line 94) | def setUp(self):
method to_unicode (line 101) | def to_unicode(self, s):
method test_get_pinyin (line 106) | def test_get_pinyin(self): ## test method names begin 'test*'
method test_get_initials (line 115) | def test_get_initials(self):
method test_py2hz (line 120) | def test_py2hz(self):
FILE: utils/lele/apps/train.py
function to_torch (line 37) | def to_torch(x, y=None):
function train (line 44) | def train(model,
FILE: utils/lele/fastai/core.py
function num_cpus (line 41) | def num_cpus()->int:
function is_listy (line 48) | def is_listy(x:Any)->bool: return isinstance(x, (tuple,list))
function is_tuple (line 49) | def is_tuple(x:Any)->bool: return isinstance(x, tuple)
function noop (line 50) | def noop(x): return x
function to_int (line 52) | def to_int(b):
function ifnone (line 56) | def ifnone(a:Any,b:Any)->Any:
function uniqueify (line 60) | def uniqueify(x:Series) -> List[Any]: return list(OrderedDict.fromkeys(x...
function idx_dict (line 61) | def idx_dict(a): return {v:k for k,v in enumerate(a)}
function find_classes (line 63) | def find_classes(folder:Path)->FilePathList:
function arrays_split (line 70) | def arrays_split(mask:NPArrayMask, *arrs:NPArrayableList)->SplitArrayList:
function random_split (line 75) | def random_split(valid_pct:float, *arrs:NPArrayableList)->SplitArrayList:
function listify (line 80) | def listify(p:OptListOrItem=None, q:OptListOrItem=None):
function camel2snake (line 91) | def camel2snake(name:str)->str:
function even_mults (line 95) | def even_mults(start:float, stop:float, n:int)->np.ndarray:
function extract_kwargs (line 101) | def extract_kwargs(names:Collection[str], kwargs:KWArgs):
function partition (line 110) | def partition(a:Collection, sz:int) -> List[Collection]:
function partition_by_cores (line 114) | def partition_by_cores(a:Collection, n_cpus:int) -> List[Collection]:
function get_chunk_length (line 118) | def get_chunk_length(data:Union[PathOrStr, DataFrame, pd.io.parsers.Text...
function get_total_length (line 128) | def get_total_length(csv_name:PathOrStr, chunksize:int) -> int:
function maybe_copy (line 135) | def maybe_copy(old_fnames:Collection[PathOrStr], new_fnames:Collection[P...
function series2cat (line 142) | def series2cat(df:DataFrame, *col_names):
class ItemBase (line 146) | class ItemBase():
method device (line 150) | def device(self): pass
method data (line 153) | def data(self): pass
function download_url (line 155) | def download_url(url:str, dest:str, overwrite:bool=False)->None:
function range_of (line 171) | def range_of(x): return list(range(len(x)))
function arange_of (line 172) | def arange_of(x): return np.arange(len(x))
FILE: utils/lele/fastai/layers.py
class Lambda (line 8) | class Lambda(nn.Module):
method __init__ (line 10) | def __init__(self, func:LambdaFunc):
method forward (line 15) | def forward(self, x): return self.func(x)
function ResizeBatch (line 17) | def ResizeBatch(*size:int) -> Tensor:
function Flatten (line 21) | def Flatten()->Tensor:
function PoolFlatten (line 25) | def PoolFlatten()->nn.Sequential:
function bn_drop_lin (line 29) | def bn_drop_lin(n_in:int, n_out:int, bn:bool=True, p:float=0., actn:Opti...
function conv2d (line 37) | def conv2d(ni:int, nf:int, ks:int=3, stride:int=1, padding:int=None, bia...
function conv_layer (line 42) | def conv_layer(ni:int, nf:int, ks:int=3, stride:int=1)->nn.Sequential:
function conv2d_relu (line 49) | def conv2d_relu(ni:int, nf:int, ks:int=3, stride:int=1, padding:int=None...
function conv2d_trans (line 57) | def conv2d_trans(ni:int, nf:int, ks:int=2, stride:int=2, padding:int=0) ...
class AdaptiveConcatPool2d (line 61) | class AdaptiveConcatPool2d(nn.Module):
method __init__ (line 63) | def __init__(self, sz:Optional[int]=None):
method forward (line 68) | def forward(self, x): return torch.cat([self.mp(x), self.ap(x)], 1)
class Debugger (line 70) | class Debugger(nn.Module):
method forward (line 72) | def forward(self,x:Tensor) -> Tensor:
class StdUpsample (line 76) | class StdUpsample(nn.Module):
method __init__ (line 78) | def __init__(self, n_in:int, n_out:int):
method forward (line 83) | def forward(self, x:Tensor) -> Tensor:
function std_upsample_head (line 86) | def std_upsample_head(c, *nfs:Collection[int]) -> Model:
class CrossEntropyFlat (line 94) | class CrossEntropyFlat(nn.CrossEntropyLoss):
method forward (line 96) | def forward(self, input:Tensor, target:Tensor) -> Rank0Tensor:
function simple_cnn (line 100) | def simple_cnn(actns:Collection[int], kernel_szs:Collection[int]=None,
function trunc_normal_ (line 111) | def trunc_normal_(x:Tensor, mean:float=0., std:float=1.) -> Tensor:
function get_embedding (line 116) | def get_embedding(ni:int,nf:int) -> Model:
FILE: utils/lele/fastai/text/models.py
function dropout_mask (line 9) | def dropout_mask(x:Tensor, sz:Collection[int], p:float):
class RNNDropout (line 13) | class RNNDropout(nn.Module):
method __init__ (line 16) | def __init__(self, p:float=0.5):
method forward (line 20) | def forward(self, x:Tensor) -> Tensor:
class WeightDropout (line 25) | class WeightDropout(nn.Module):
method __init__ (line 28) | def __init__(self, module:Model, weight_p:float, layer_names:Collectio...
method _setweights (line 36) | def _setweights(self):
method forward (line 42) | def forward(self, *args:ArgStar):
method reset (line 49) | def reset(self):
class EmbeddingDropout (line 55) | class EmbeddingDropout(nn.Module):
method __init__ (line 58) | def __init__(self, emb:Model, embed_p:float):
method forward (line 64) | def forward(self, words:LongTensor, scale:Optional[float]=None) -> Ten...
function _repackage_var (line 74) | def _repackage_var(h:Tensors) -> Tensors:
class RNNCore (line 78) | class RNNCore(nn.Module):
method __init__ (line 83) | def __init__(self, vocab_sz:int, emb_sz:int, n_hid:int, n_layers:int, ...
method forward (line 109) | def forward(self, input:LongTensor) -> Tuple[Tensor,Tensor]:
method _one_hidden (line 125) | def _one_hidden(self, l:int) -> Tensor:
method reset (line 130) | def reset(self):
class LinearDecoder (line 137) | class LinearDecoder(nn.Module):
method __init__ (line 142) | def __init__(self, n_out:int, n_hid:int, output_p:float, tie_encoder:M...
method forward (line 150) | def forward(self, input:Tuple[Tensor,Tensor]) -> Tuple[Tensor,Tensor,T...
class SequentialRNN (line 156) | class SequentialRNN(nn.Sequential):
method reset (line 158) | def reset(self):
class MultiBatchRNNCore (line 162) | class MultiBatchRNNCore(RNNCore):
method __init__ (line 165) | def __init__(self, bptt:int, max_seq:int, *args, **kwargs):
method concat (line 169) | def concat(self, arrs:Collection[Tensor]) -> Tensor:
method forward (line 173) | def forward(self, input:LongTensor) -> Tuple[Tensor,Tensor]:
class PoolingLinearClassifier (line 184) | class PoolingLinearClassifier(nn.Module):
method __init__ (line 187) | def __init__(self, layers:Collection[int], drops:Collection[float]):
method pool (line 195) | def pool(self, x:Tensor, bs:int, is_max:bool):
method forward (line 200) | def forward(self, input:Tuple[Tensor,Tensor]) -> Tuple[Tensor,Tensor,T...
function get_language_model (line 210) | def get_language_model(vocab_sz:int, emb_sz:int, n_hid:int, n_layers:int...
function get_rnn_classifier (line 219) | def get_rnn_classifier(bptt:int, max_seq:int, n_class:int, vocab_sz:int,...
function classifier (line 233) | def classifier(vocab_size, n_class, bptt:int=70, max_len:int=70*20, emb_...
FILE: utils/lele/fastai/text/qrnn/forget_mult.py
class CPUForgetMult (line 76) | class CPUForgetMult(torch.nn.Module):
method __init__ (line 77) | def __init__(self):
method forward (line 80) | def forward(self, f, x, hidden_init=None):
class GPUForgetMult (line 96) | class GPUForgetMult(torch.autograd.Function):
method __init__ (line 99) | def __init__(self):
method compile (line 102) | def compile(self):
method forward (line 122) | def forward(self, f, x, hidden_init=None):
method backward (line 138) | def backward(self, grad_h):
class ForgetMult (line 158) | class ForgetMult(torch.nn.Module):
method __init__ (line 171) | def __init__(self):
method forward (line 174) | def forward(self, f, x, hidden_init=None, use_cuda=True):
FILE: utils/lele/fastai/text/qrnn/qrnn.py
class QRNNLayer (line 11) | class QRNNLayer(nn.Module):
method __init__ (line 32) | def __init__(self, input_size, hidden_size=None, save_prev_x=False, zo...
method reset (line 48) | def reset(self):
method forward (line 52) | def forward(self, X, hidden=None):
class QRNN (line 114) | class QRNN(torch.nn.Module):
method __init__ (line 137) | def __init__(self, input_size, hidden_size,
method reset (line 156) | def reset(self):
method forward (line 160) | def forward(self, input, hidden=None):
FILE: utils/lele/fastai/torch_core.py
function to_data (line 65) | def to_data(b:ItemsList):
function to_device (line 70) | def to_device(b:Tensors, device:torch.device):
function data_collate (line 76) | def data_collate(batch:ItemsList)->Tensor:
function requires_grad (line 80) | def requires_grad(m:nn.Module, b:Optional[bool]=None)->Optional[bool]:
function trainable_params (line 87) | def trainable_params(m:nn.Module)->ParamList:
function children (line 92) | def children(m:nn.Module)->ModuleList:
function num_children (line 96) | def num_children(m:nn.Module)->int:
function range_children (line 100) | def range_children(m:nn.Module)->Iterator[int]:
function first_layer (line 105) | def first_layer(m:nn.Module)->nn.Module:
function split_model_idx (line 109) | def split_model_idx(model:nn.Module, idxs:Collection[int])->ModuleList:
function split_model (line 116) | def split_model(model:nn.Module, splits:Collection[Union[Model,ModuleLis...
function split_bn_bias (line 127) | def split_bn_bias(layer_groups:ModuleList)->ModuleList:
function set_bn_eval (line 138) | def set_bn_eval(m:nn.Module)->None:
function to_half (line 145) | def to_half(b:Collection[Tensor])->Collection[Tensor]:
function bn2float (line 149) | def bn2float(module:nn.Module)->nn.Module:
function model2half (line 155) | def model2half(model:nn.Module)->nn.Module:
function cond_init (line 159) | def cond_init(m:nn.Module, init_func:LayerFunc):
function apply_leaf (line 165) | def apply_leaf(m:nn.Module, f:LayerFunc):
function apply_init (line 171) | def apply_init(m, init_func:LayerFunc):
function in_channels (line 175) | def in_channels(m:Model) -> List[int]:
function calc_loss (line 181) | def calc_loss(y_pred:Tensor, y_true:Tensor, loss_class:type=nn.CrossEntr...
function to_np (line 187) | def to_np(x): return x.cpu().numpy()
function model_type (line 189) | def model_type(dtype):
function np2model_tensor (line 194) | def np2model_tensor(a):
function show_install (line 200) | def show_install(show_nvidia_smi:bool=False):
function trange_of (line 287) | def trange_of(x): return torch.arange(len(x))
FILE: utils/lele/layers/classify_layer.py
class SoftmaxLayer (line 11) | class SoftmaxLayer(nn.Module):
method __init__ (line 13) | def __init__(self, output_dim, n_class):
method forward (line 23) | def forward(self, x, y):
class SampledSoftmaxLayer (line 34) | class SampledSoftmaxLayer(nn.Module):
method __init__ (line 38) | def __init__(self, output_dim, n_class, n_samples, use_cuda):
method forward (line 66) | def forward(self, x, y):
method update_embedding_matrix (line 87) | def update_embedding_matrix(self):
method update_negative_samples (line 106) | def update_negative_samples(self, word_inp, chars_inp, mask):
class CNNSoftmaxLayer (line 135) | class CNNSoftmaxLayer(nn.Module):
method __init__ (line 136) | def __init__(self, token_embedder, output_dim, n_class, n_samples, cor...
method forward (line 158) | def forward(self, x, y):
method update_embedding_matrix (line 179) | def update_embedding_matrix(self):
method update_negative_samples (line 213) | def update_negative_samples(self, word_inp, chars_inp, mask):
FILE: utils/lele/layers/elmo.py
class ElmobiLm (line 18) | class ElmobiLm(_EncoderBase):
method __init__ (line 19) | def __init__(self, config, use_cuda=False):
method forward (line 65) | def forward(self, inputs, mask):
method _lstm_forward (line 105) | def _lstm_forward(self,
FILE: utils/lele/layers/elmo/classify_layer.py
class SoftmaxLayer (line 11) | class SoftmaxLayer(nn.Module):
method __init__ (line 13) | def __init__(self, output_dim, n_class):
method forward (line 23) | def forward(self, x, y):
class SampledSoftmaxLayer (line 34) | class SampledSoftmaxLayer(nn.Module):
method __init__ (line 38) | def __init__(self, output_dim, n_class, n_samples, use_cuda):
method forward (line 66) | def forward(self, x, y):
method update_embedding_matrix (line 87) | def update_embedding_matrix(self):
method update_negative_samples (line 106) | def update_negative_samples(self, word_inp, chars_inp, mask):
class CNNSoftmaxLayer (line 135) | class CNNSoftmaxLayer(nn.Module):
method __init__ (line 136) | def __init__(self, token_embedder, output_dim, n_class, n_samples, cor...
method forward (line 158) | def forward(self, x, y):
method update_embedding_matrix (line 179) | def update_embedding_matrix(self):
method update_negative_samples (line 213) | def update_negative_samples(self, word_inp, chars_inp, mask):
FILE: utils/lele/layers/elmo/elmo.py
class ElmobiLm (line 18) | class ElmobiLm(_EncoderBase):
method __init__ (line 19) | def __init__(self, config, use_cuda=False):
method forward (line 65) | def forward(self, inputs, mask):
method _lstm_forward (line 105) | def _lstm_forward(self,
FILE: utils/lele/layers/elmo/embedding_layer.py
class EmbeddingLayer (line 10) | class EmbeddingLayer(nn.Module):
method __init__ (line 11) | def __init__(self, n_d, word2id, embs=None, fix_emb=True, oov='',...
method forward (line 48) | def forward(self, input_):
FILE: utils/lele/layers/elmo/encoder_base.py
class _EncoderBase (line 16) | class _EncoderBase(torch.nn.Module):
method __init__ (line 27) | def __init__(self, stateful: bool = False) -> None:
method sort_and_run_forward (line 32) | def sort_and_run_forward(self,
method _get_initial_states (line 115) | def _get_initial_states(self,
method _update_states (line 199) | def _update_states(self,
method reset_states (line 278) | def reset_states(self):
FILE: utils/lele/layers/elmo/highway.py
class Highway (line 12) | class Highway(torch.nn.Module):
method __init__ (line 30) | def __init__(self,
method forward (line 47) | def forward(self, inputs: torch.Tensor) -> torch.Tensor: # pylint: di...
FILE: utils/lele/layers/elmo/lstm.py
class LstmbiLm (line 11) | class LstmbiLm(nn.Module):
method __init__ (line 12) | def __init__(self, config, use_cuda=False):
method forward (line 25) | def forward(self, inputs):
FILE: utils/lele/layers/elmo/lstm_cell_with_projection.py
class LstmCellWithProjection (line 13) | class LstmCellWithProjection(torch.nn.Module):
method __init__ (line 53) | def __init__(self,
method reset_parameters (line 80) | def reset_parameters(self):
method forward (line 90) | def forward(self, # pylint: disable=arguments-differ
FILE: utils/lele/layers/elmo/token_embedder.py
class LstmTokenEmbedder (line 12) | class LstmTokenEmbedder(nn.Module):
method __init__ (line 13) | def __init__(self, config, word_emb_layer, char_emb_layer, use_cuda=Fa...
method forward (line 31) | def forward(self, word_inp, chars_inp, shape):
class ConvTokenEmbedder (line 50) | class ConvTokenEmbedder(nn.Module):
method __init__ (line 51) | def __init__(self, config, word_emb_layer, char_emb_layer, use_cuda):
method forward (line 89) | def forward(self, word_inp, chars_inp, shape):
FILE: utils/lele/layers/elmo/util.py
function get_lengths_from_binary_sequence_mask (line 12) | def get_lengths_from_binary_sequence_mask(mask: torch.Tensor):
function sort_batch_by_length (line 29) | def sort_batch_by_length(tensor: torch.autograd.Variable,
function get_final_encoder_states (line 72) | def get_final_encoder_states(encoder_outputs: torch.Tensor,
function get_dropout_mask (line 104) | def get_dropout_mask(dropout_probability: float, tensor_for_masking: tor...
function block_orthogonal (line 127) | def block_orthogonal(tensor: torch.Tensor,
FILE: utils/lele/layers/embedding_layer.py
class EmbeddingLayer (line 10) | class EmbeddingLayer(nn.Module):
method __init__ (line 11) | def __init__(self, n_d, word2id, embs=None, fix_emb=True, oov='',...
method forward (line 48) | def forward(self, input_):
FILE: utils/lele/layers/encoder_base.py
class _EncoderBase (line 16) | class _EncoderBase(torch.nn.Module):
method __init__ (line 27) | def __init__(self, stateful: bool = False) -> None:
method sort_and_run_forward (line 32) | def sort_and_run_forward(self,
method _get_initial_states (line 115) | def _get_initial_states(self,
method _update_states (line 199) | def _update_states(self,
method reset_states (line 278) | def reset_states(self):
FILE: utils/lele/layers/highway.py
class Highway (line 12) | class Highway(torch.nn.Module):
method __init__ (line 30) | def __init__(self,
method forward (line 47) | def forward(self, inputs: torch.Tensor) -> torch.Tensor: # pylint: di...
FILE: utils/lele/layers/layers.py
class CudnnRnn (line 25) | class CudnnRnn(nn.Module):
method __init__ (line 35) | def __init__(self, input_size, hidden_size, num_layers,
method forward (line 66) | def forward(self, x, x_mask, fw_masks=None, bw_masks=None):
class StackedBRNN (line 149) | class StackedBRNN(nn.Module):
method __init__ (line 157) | def __init__(self, input_size, hidden_size, num_layers,
method forward (line 179) | def forward(self, x, x_mask):
method _forward_unpadded (line 203) | def _forward_unpadded(self, x, x_mask):
method _forward_padded (line 246) | def _forward_padded(self, x, x_mask):
class FeedForwardNetwork (line 322) | class FeedForwardNetwork(nn.Module):
method __init__ (line 323) | def __init__(self, input_size, hidden_size, output_size, dropout_rate=0):
method forward (line 329) | def forward(self, x):
class PointerNetwork (line 335) | class PointerNetwork(nn.Module):
method __init__ (line 336) | def __init__(self, x_size, y_size, hidden_size, dropout_rate=0, cell_t...
method init_hiddens (line 346) | def init_hiddens(self, y, y_mask):
method pointer (line 351) | def pointer(self, x, state, x_mask):
method forward (line 370) | def forward(self, x, y, x_mask, y_mask):
class MemoryAnsPointer (line 378) | class MemoryAnsPointer(nn.Module):
method __init__ (line 379) | def __init__(self, x_size, y_size, hidden_size, hop=1, dropout_rate=0,...
method forward (line 395) | def forward(self, x, y, x_mask, y_mask):
class SeqAttnMatch (line 435) | class SeqAttnMatch(nn.Module):
method __init__ (line 442) | def __init__(self, input_size, identity=False):
method forward (line 449) | def forward(self, x, y, y_mask):
class DotAttention (line 483) | class DotAttention(nn.Module):
method __init__ (line 490) | def __init__(self,
method forward (line 516) | def forward(self, x, y, y_mask):
class SelfAttnMatch (line 562) | class SelfAttnMatch(nn.Module):
method __init__ (line 569) | def __init__(self, input_size, identity=False, diag=True):
method forward (line 577) | def forward(self, x, x_mask):
class BilinearSeqAttn (line 613) | class BilinearSeqAttn(nn.Module):
method __init__ (line 621) | def __init__(self, x_size, y_size, identity=False, normalize=True):
method forward (line 631) | def forward(self, x, y, x_mask):
class LinearSeqAttn (line 655) | class LinearSeqAttn(nn.Module):
method __init__ (line 661) | def __init__(self, input_size):
method forward (line 665) | def forward(self, x, x_mask):
class NonLinearSeqAttn (line 679) | class NonLinearSeqAttn(nn.Module):
method __init__ (line 685) | def __init__(self, input_size, hidden_size=128):
method forward (line 689) | def forward(self, x, x_mask):
class MaxPooling (line 702) | class MaxPooling(nn.Module):
method forward (line 703) | def forward(self, x, x_mask):
class SumPooling (line 715) | class SumPooling(nn.Module):
method forward (line 716) | def forward(self, x, x_mask):
class TopKPooling (line 726) | class TopKPooling(nn.Module):
method __init__ (line 727) | def __init__(self, top_k=2):
method forward (line 731) | def forward(self, x, x_mask):
class LastPooling (line 744) | class LastPooling(nn.Module):
method __init__ (line 745) | def __init__(self):
method forward (line 748) | def forward(self, x, x_mask):
class LinearSeqAttnPooling (line 755) | class LinearSeqAttnPooling(nn.Module):
method __init__ (line 761) | def __init__(self, input_size):
method forward (line 765) | def forward(self, x, x_mask):
class LinearSeqAttnPoolings (line 782) | class LinearSeqAttnPoolings(nn.Module):
method __init__ (line 788) | def __init__(self, input_size, num_poolings):
method forward (line 793) | def forward(self, x, x_mask):
class NonLinearSeqAttnPooling (line 812) | class NonLinearSeqAttnPooling(nn.Module):
method __init__ (line 818) | def __init__(self, input_size, hidden_size=128):
method forward (line 822) | def forward(self, x, x_mask):
class NonLinearSeqAttnPoolings (line 836) | class NonLinearSeqAttnPoolings(nn.Module):
method __init__ (line 842) | def __init__(self, input_size, num_poolings, hidden_size=128):
method forward (line 847) | def forward(self, x, x_mask):
class Pooling (line 863) | class Pooling(nn.Module):
method __init__ (line 864) | def __init__(self,
method forward (line 906) | def forward(self, x, mask=None, calc_word_scores=False):
class Poolings (line 918) | class Poolings(nn.Module):
method __init__ (line 919) | def __init__(self,
method forward (line 965) | def forward(self, x, mask=None, calc_word_scores=False):
class Linears (line 981) | class Linears(nn.Module):
method __init__ (line 982) | def __init__(self,
method forward (line 991) | def forward(self, x):
class Gate (line 1005) | class Gate(nn.Module):
method __init__ (line 1010) | def __init__(self, input_size, dropout_rate=0.):
method forward (line 1015) | def forward(self, x):
class SFU (line 1030) | class SFU(nn.Module):
method __init__ (line 1035) | def __init__(self, input_size, fusion_size, dropout_rate=0.):
method forward (line 1041) | def forward(self, x, fusions):
class SFUCombiner (line 1050) | class SFUCombiner(nn.Module):
method __init__ (line 1055) | def __init__(self, input_size, fusion_size, dropout_rate=0.):
method forward (line 1061) | def forward(self, x, y):
function uniform_weights (line 1076) | def uniform_weights(x, x_mask):
function weighted_avg (line 1093) | def weighted_avg(x, weights):
FILE: utils/lele/layers/lstm.py
class LstmbiLm (line 11) | class LstmbiLm(nn.Module):
method __init__ (line 12) | def __init__(self, config, use_cuda=False):
method forward (line 25) | def forward(self, inputs):
FILE: utils/lele/layers/lstm_cell_with_projection.py
class LstmCellWithProjection (line 13) | class LstmCellWithProjection(torch.nn.Module):
method __init__ (line 53) | def __init__(self,
method reset_parameters (line 80) | def reset_parameters(self):
method forward (line 90) | def forward(self, # pylint: disable=arguments-differ
FILE: utils/lele/layers/token_embedder.py
class LstmTokenEmbedder (line 12) | class LstmTokenEmbedder(nn.Module):
method __init__ (line 13) | def __init__(self, config, word_emb_layer, char_emb_layer, use_cuda=Fa...
method forward (line 31) | def forward(self, word_inp, chars_inp, shape):
class ConvTokenEmbedder (line 50) | class ConvTokenEmbedder(nn.Module):
method __init__ (line 51) | def __init__(self, config, word_emb_layer, char_emb_layer, use_cuda):
method forward (line 89) | def forward(self, word_inp, chars_inp, shape):
FILE: utils/lele/layers/transformer/transformer.py
function clones (line 27) | def clones(module, N):
class Encoder (line 31) | class Encoder(nn.Module):
method __init__ (line 33) | def __init__(self, layer, N):
method forward (line 38) | def forward(self, x, mask):
class LayerNorm (line 44) | class LayerNorm(nn.Module):
method __init__ (line 46) | def __init__(self, features, eps=1e-6):
method forward (line 52) | def forward(self, x):
class SublayerConnection (line 57) | class SublayerConnection(nn.Module):
method __init__ (line 62) | def __init__(self, size, dropout):
method forward (line 67) | def forward(self, x, sublayer):
class EncoderLayer (line 72) | class EncoderLayer(nn.Module):
method __init__ (line 74) | def __init__(self, size, self_attn, feed_forward, dropout):
method forward (line 81) | def forward(self, x, mask):
function attention (line 88) | def attention(query, key, value, mask=None, dropout=None):
class MultiHeadedAttention (line 103) | class MultiHeadedAttention(nn.Module):
method __init__ (line 104) | def __init__(self, h, d_model, dropout=0.1):
method forward (line 115) | def forward(self, query, key, value, mask=None):
class PositionwiseFeedForward (line 136) | class PositionwiseFeedForward(nn.Module):
method __init__ (line 138) | def __init__(self, d_model, d_ff, dropout=0.1):
method forward (line 144) | def forward(self, x):
class Embeddings (line 147) | class Embeddings(nn.Module):
method __init__ (line 148) | def __init__(self, d_model, vocab):
method forward (line 153) | def forward(self, x):
class PositionalEncoding (line 157) | class PositionalEncoding(nn.Module):
method __init__ (line 159) | def __init__(self, d_model, dropout, max_len=5000):
method forward (line 176) | def forward(self, x):
function make_model (line 182) | def make_model(src_vocab, tgt_vocab, N=6,
function get_encoder (line 205) | def get_encoder(src_vocab, N=6,
FILE: utils/lele/layers/util.py
function get_lengths_from_binary_sequence_mask (line 12) | def get_lengths_from_binary_sequence_mask(mask: torch.Tensor):
function sort_batch_by_length (line 29) | def sort_batch_by_length(tensor: torch.autograd.Variable,
function get_final_encoder_states (line 72) | def get_final_encoder_states(encoder_outputs: torch.Tensor,
function get_dropout_mask (line 104) | def get_dropout_mask(dropout_probability: float, tensor_for_masking: tor...
function block_orthogonal (line 127) | def block_orthogonal(tensor: torch.Tensor,
FILE: utils/lele/losses/losses.py
class BiLMCriterion (line 20) | class BiLMCriterion(object):
method __init__ (line 21) | def __init__(self):
method forward (line 24) | def forward(self, model, x, y, training=False):
FILE: utils/lele/ops/ops.py
function reverse_padded_sequence (line 19) | def reverse_padded_sequence(inputs, lengths, batch_first=False):
function tile (line 52) | def tile(a, dim, n_tile):
FILE: utils/lele/training/optimizers.py
class NoamOpt (line 24) | class NoamOpt:
method __init__ (line 26) | def __init__(self, model_size, factor, warmup, optimizer):
method step (line 35) | def step(self):
method rate (line 44) | def rate(self, step = None):
method zero_grad (line 52) | def zero_grad(self):
method state_dict (line 55) | def state_dict(self):
method load_state_dict (line 58) | def load_state_dict(self, x):
function get_std_opt (line 61) | def get_std_opt(model):
function lr_poly (line 65) | def lr_poly(base_lr, iter, max_iter, end_learning_rate, power):
class BertOpt (line 68) | class BertOpt:
method __init__ (line 70) | def __init__(self, lr, min_lr, num_train_steps, warmup, optimizer):
method step (line 81) | def step(self):
method rate (line 90) | def rate(self, step = None):
method zero_grad (line 104) | def zero_grad(self):
method state_dict (line 107) | def state_dict(self):
method load_state_dict (line 110) | def load_state_dict(self, x):
FILE: utils/lele/util.py
function adjust_lrs (line 29) | def adjust_lrs(x, ratio=None, name='learning_rate_weights'):
function load (line 41) | def load(model, path):
function clones (line 69) | def clones(module, N):
function torch_ (line 80) | def torch_(x):
function to_torch (line 95) | def to_torch(x, y=None):
function pad_tensor (line 110) | def pad_tensor(vec, pad, dim):
class PadCollate2 (line 124) | class PadCollate2:
method __init__ (line 130) | def __init__(self, dim=0):
method pad_collate (line 137) | def pad_collate(self, batch):
method __call__ (line 156) | def __call__(self, batch):
class PadCollate (line 159) | class PadCollate:
method __init__ (line 165) | def __init__(self, dim=0):
method pad_collate (line 172) | def pad_collate(self, batch):
method __call__ (line 191) | def __call__(self, batch):
class DictPadCollate2 (line 194) | class DictPadCollate2:
method __init__ (line 200) | def __init__(self, dim=0):
method pad_collate (line 207) | def pad_collate(self, batch):
method __call__ (line 249) | def __call__(self, batch):
class DictPadCollate (line 252) | class DictPadCollate:
method __init__ (line 258) | def __init__(self, dim=0):
method pad_collate (line 265) | def pad_collate(self, batch):
method __call__ (line 296) | def __call__(self, batch):
FILE: utils/melt/apps/image_processing.py
function init (line 24) | def init(image_model_name=None, feature_name=None, num_classes=None, pre...
FILE: utils/melt/apps/read.py
function sparse_inputs (line 31) | def sparse_inputs(files, decode, batch_size=64):
function inputs (line 41) | def inputs(files, decode, batch_size=64):
FILE: utils/melt/apps/train.py
function init (line 303) | def init():
function get_global_scope (line 648) | def get_global_scope():
function gen_learning_rate (line 654) | def gen_learning_rate(num_steps_per_epoch=None):
function train_flow (line 757) | def train_flow(ops,
function evaluate (line 1091) | def evaluate(ops, iterator, num_steps, num_examples, eval_fn,
function inference (line 1203) | def inference(ops, iterator, num_steps, num_examples,
function train (line 1290) | def train(model,
function get_train (line 1572) | def get_train():
function get_fit (line 1576) | def get_fit():
FILE: utils/melt/cnn/cnn.py
class ConvNet (line 31) | class ConvNet(object):
method __init__ (line 32) | def __init__(self, num_layers, num_filters,
method encode (line 45) | def encode(self, seq, seq_len=None, output_method='all'):
class ConvNet2 (line 93) | class ConvNet2(object):
method __init__ (line 94) | def __init__(self, num_layers, num_units, keep_prob=1.0, is_train=None...
method encode (line 102) | def encode(self, seq, seq_len=None, output_method='all'):
FILE: utils/melt/cnn/conv2d.py
function encode (line 26) | def encode(word_vectors, seq_len=None, output_method='all'):
FILE: utils/melt/cnn/qanet.py
function glu (line 51) | def glu(x):
function noam_norm (line 56) | def noam_norm(x, epsilon=1.0, scope=None, reuse=None):
function layer_norm_compute_python (line 63) | def layer_norm_compute_python(x, epsilon, scale, bias):
function layer_norm (line 70) | def layer_norm(x, filters=None, epsilon=1e-6, scope=None, reuse=None):
function highway (line 84) | def highway(x, size = None, activation = None,
function layer_dropout (line 100) | def layer_dropout(inputs, residual, dropout):
function residual_block (line 104) | def residual_block(inputs, num_blocks, num_conv_layers, kernel_size, mas...
function conv_block (line 124) | def conv_block(inputs, num_conv_layers, kernel_size, num_filters,
function self_attention_block (line 142) | def self_attention_block(inputs, num_filters, seq_len, mask = None, num_...
function multihead_attention (line 164) | def multihead_attention(queries, units, num_heads,
function conv (line 194) | def conv(inputs, output_size, bias = None, activation = None, kernel_siz...
function mask_logits (line 224) | def mask_logits(inputs, mask, mask_value = -1e30):
function depthwise_separable_convolution (line 228) | def depthwise_separable_convolution(inputs, kernel_size, num_filters,
function split_last_dimension (line 257) | def split_last_dimension(x, n):
function dot_product_attention (line 273) | def dot_product_attention(q,
function combine_last_two_dimensions (line 312) | def combine_last_two_dimensions(x):
function add_timing_signal_1d (line 326) | def add_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4):
function get_timing_signal_1d (line 353) | def get_timing_signal_1d(length, channels, min_timescale=1.0, max_timesc...
function ndim (line 390) | def ndim(x):
function dot (line 417) | def dot(x, y):
function batch_dot (line 459) | def batch_dot(x, y, axes=None):
function optimized_trilinear_for_attention (line 517) | def optimized_trilinear_for_attention(args, c_maxlen, q_maxlen, input_ke...
function trilinear (line 559) | def trilinear(args,
function flatten (line 573) | def flatten(tensor, keep):
function reconstruct (line 581) | def reconstruct(tensor, ref, keep):
function _linear (line 594) | def _linear(args,
function total_params (line 655) | def total_params():
class QANet (line 666) | class QANet(object):
method __init__ (line 667) | def __init__(self,
method encode (line 698) | def encode(self, inputs, seq_len=None, output_method='all'):
FILE: utils/melt/eager/train.py
function torch_ (line 51) | def torch_(x):
function to_torch (line 71) | def to_torch(x, y=None):
function evaluate (line 95) | def evaluate(model, dataset, eval_fn, model_path=None,
function inference (line 214) | def inference(model, dataset, model_path,
function load_torch_model (line 319) | def load_torch_model(model, path):
function horovod_torch_deal_optimizer (line 341) | def horovod_torch_deal_optimizer(optimizer, model):
function get_torch_optimizer (line 348) | def get_torch_optimizer(optimizer, model, num_steps_per_epoch=None, para...
function train (line 385) | def train(model,
FILE: utils/melt/eager/util.py
function grad (line 27) | def grad(model, x, y, loss_fn):
function clip_gradients (line 38) | def clip_gradients(grads_and_vars, clip_ratio):
function restore (line 43) | def restore(model, ckpt_dir=None):
FILE: utils/melt/encoder/embedding_layer.py
class EmbeddingSharedWeights (line 26) | class EmbeddingSharedWeights(tf.layers.Layer):
method __init__ (line 29) | def __init__(self, vocab_size=1, hidden_size=128, embedding=None):
method build (line 36) | def build(self, _):
method call (line 50) | def call(self, x):
method linear (line 74) | def linear(self, x):
FILE: utils/melt/encoder/transformer.py
class Transformer (line 38) | class Transformer(object):
method __init__ (line 49) | def __init__(self, params, embedding, train):
method __call__ (line 63) | def __call__(self, inputs):
method encode (line 94) | def encode(self, inputs, attention_bias):
method decode (line 122) | def decode(self, targets, encoder_outputs, attention_bias):
method _get_symbols_to_logits_fn (line 160) | def _get_symbols_to_logits_fn(self, max_decode_length):
method predict (line 199) | def predict(self, encoder_outputs, encoder_decoder_attention_bias):
class LayerNormalization (line 239) | class LayerNormalization(tf.layers.Layer):
method __init__ (line 242) | def __init__(self, hidden_size):
method build (line 246) | def build(self, _):
method call (line 253) | def call(self, x, epsilon=1e-6):
class PrePostProcessingWrapper (line 260) | class PrePostProcessingWrapper(object):
method __init__ (line 263) | def __init__(self, layer, params, train):
method __call__ (line 271) | def __call__(self, x, *args, **kwargs):
class EncoderStack (line 284) | class EncoderStack(tf.layers.Layer):
method __init__ (line 293) | def __init__(self, params, train):
method call (line 310) | def call(self, encoder_inputs, attention_bias, inputs_padding):
class DecoderStack (line 337) | class DecoderStack(tf.layers.Layer):
method __init__ (line 348) | def __init__(self, params, train):
method call (line 366) | def call(self, decoder_inputs, encoder_outputs, decoder_self_attention...
FILE: utils/melt/flow/flow.py
function tf_flow (line 43) | def tf_flow(process_once, model_dir=None, num_steps=None, sess=None):
function _get_model_path (line 100) | def _get_model_path(model_dir, save_model=False):
function _get_checkpoint_path (line 120) | def _get_checkpoint_path(checkpoint_path, step=None, num_steps_per_epoch...
function tf_train_flow (line 125) | def tf_train_flow(train_once_fn,
function tf_test_flow (line 574) | def tf_test_flow(test_once, model_dir='./model',
FILE: utils/melt/flow/test.py
function test_flow (line 23) | def test_flow(ops, names=None, gen_feed_dict_fn=None, deal_results_fn=No...
FILE: utils/melt/flow/train.py
function simple_train_flow (line 38) | def simple_train_flow(ops,
function train_flow (line 88) | def train_flow(ops,
FILE: utils/melt/flow/train_once.py
function train_once (line 45) | def train_once(sess,
FILE: utils/melt/image/image_decoder.py
class ImageDecoder (line 16) | class ImageDecoder(object):
method __init__ (line 19) | def __init__(self):
method decode_jpeg (line 36) | def decode_jpeg(self, encoded_jpeg):
method decode (line 44) | def decode(self, encoded, image_format='jpeg'):
FILE: utils/melt/image/image_embedding.py
function inception_v3 (line 30) | def inception_v3(images,
FILE: utils/melt/image/image_model.py
class ImageModel (line 32) | class ImageModel(object):
method __init__ (line 33) | def __init__(self,
method _build_graph (line 102) | def _build_graph(self, model_name, height, width, num_classes=None, im...
method _build_graph2 (line 111) | def _build_graph2(self, model_name, height, width, image_format=None):
method process (line 120) | def process(self, images):
method process2 (line 129) | def process2(self, images):
method gen_logits (line 138) | def gen_logits(self, images):
method classify (line 147) | def classify(self, images):
method multi_classify (line 156) | def multi_classify(self, images):
method logits (line 165) | def logits(self, images):
method top_k (line 174) | def top_k(self, images):
method gen_feature (line 183) | def gen_feature(self, images):
method gen_features (line 186) | def gen_features(self, images):
FILE: utils/melt/image/image_processing.py
function read_image (line 58) | def read_image(image_path):
function get_imagenet_from_checkpoint (line 65) | def get_imagenet_from_checkpoint(checkpoint_path):
function get_net_from_checkpoint (line 92) | def get_net_from_checkpoint(checkpoint):
function create_image_model_init_fn (line 112) | def create_image_model_init_fn(image_model_name, image_checkpoint_file,
function distort_image (line 164) | def distort_image(image, distort_color=True):
function decode_image (line 270) | def decode_image(contents, channels=3, image_format='jpeg', dtype=None):
function process_image (line 285) | def process_image(encoded_image,
function create_image2feature_fn (line 359) | def create_image2feature_fn(name='InceptionV3'):
function get_features_name (line 490) | def get_features_name(image_model_name):
function get_num_features (line 493) | def get_num_features(image_model_name):
function get_feature_dim (line 496) | def get_feature_dim(image_model_name):
function OpenimageV2PreprocessImage (line 499) | def OpenimageV2PreprocessImage(image, network='resnet_v1_101', image_siz...
function create_image2feature_slim_fn (line 518) | def create_image2feature_slim_fn(name=None,
FILE: utils/melt/inference/predictor.py
function get_model_dir_and_path (line 32) | def get_model_dir_and_path(model_dir, model_name=None):
function get_tensor_from_key (line 47) | def get_tensor_from_key(key, graph, index=-1):
class Predictor (line 73) | class Predictor(object):
method __init__ (line 74) | def __init__(self, model_dir=None, meta_graph=None, model_name=None,
method inference (line 104) | def inference(self, key, feed_dict=None, index=-1):
method predict (line 116) | def predict(self, key, feed_dict=None, index=-1):
method run (line 119) | def run(self, key, feed_dict=None):
method restore (line 122) | def restore(self, model_dir, meta_graph=None, model_name=None, random_...
method load_graph (line 163) | def load_graph(self, frozen_graph_file, frozen_graph_name='prefix', fr...
class SimplePredictor (line 194) | class SimplePredictor(object):
method __init__ (line 195) | def __init__(self,
method inference (line 222) | def inference(self, input, key=None, index=None, feed=None):
class SimPredictor (line 239) | class SimPredictor(object):
method __init__ (line 240) | def __init__(self,
method inference (line 264) | def inference(self, ltext, rtext=None, key=None, index=None, lfeed=Non...
method predict (line 292) | def predict(self, ltext, rtext=None, key=None, index=None):
method elementwise_predict (line 295) | def elementwise_predict(self, ltexts, rtexts, expand_left=True):
method onebyone_predict (line 312) | def onebyone_predict(self, ltexts, rtexts_list):
method bulk_predict (line 321) | def bulk_predict(self, ltexts, rtexts_list, buffer_size=50):
method top_k (line 363) | def top_k(self, ltext, rtext, k=1, key=None):
class RerankSimPredictor (line 386) | class RerankSimPredictor(object):
method __init__ (line 387) | def __init__(self, model_dir, exact_model_dir, num_rerank=100,
method inference (line 400) | def inference(self, ltext, rtext, ratio=1.):
method predict (line 419) | def predict(self, ltext, rtext, ratio=1.):
method top_k (line 423) | def top_k(self, ltext, rtext, k=1, ratio=1., sorted=True):
class WordsImportancePredictor (line 464) | class WordsImportancePredictor(object):
method __init__ (line 465) | def __init__(self, model_dir, key=None, feed=None, index=0, sess=None):
method inference (line 481) | def inference(self, inputs):
method predict (line 485) | def predict(self, inputs):
class TextPredictor (line 488) | class TextPredictor(object):
method __init__ (line 489) | def __init__(self,
method _get_text_len (line 528) | def _get_text_len(self, text):
method _get_texts_len (line 536) | def _get_texts_len(self, texts):
method inference (line 540) | def inference(self, inputs, text_key=None, score_key=None, index=None):
method predict (line 569) | def predict(self, ltext, rtext, index=-1):
method elementwise_predict (line 572) | def elementwise_predict(self, ltexts, rtexts):
method bulk_predict (line 575) | def bulk_predict(self, ltexts, rtexts):
method predict_text (line 578) | def predict_text(self, inputs, text_key=None, score_key=None, index=No...
method predict_full_text (line 581) | def predict_full_text(self, inputs, index=None):
class EnsembleTextPredictor (line 584) | class EnsembleTextPredictor(object):
method __init__ (line 590) | def __init__(self,
method inference (line 655) | def inference(self, inputs):
method predict (line 679) | def predict(self, inputs):
method predict_text (line 682) | def predict_text(self, inputs):
FILE: utils/melt/inference/predictor_base.py
function get_tensor_from_key (line 22) | def get_tensor_from_key(key, index=-1):
class PredictorBase (line 32) | class PredictorBase(object):
method __init__ (line 34) | def __init__(self, sess=None):
method load (line 41) | def load(self, model_dir, var_list=None, model_name=None, sess = None):
method restore_from_graph (line 54) | def restore_from_graph(self):
method restore (line 57) | def restore(self, model_dir, model_name=None, sess=None):
method run (line 81) | def run(self, key, feed_dict=None):
method inference (line 84) | def inference(self, key, feed_dict=None, index=-1):
method elementwise_predict (line 96) | def elementwise_predict(self, ltexts, rtexts):
FILE: utils/melt/layers/cnn/cnn.py
class ConvNet (line 39) | class ConvNet(melt.Model):
method __init__ (line 40) | def __init__(self,
method call (line 61) | def call(self, seq, seq_len=None, masks=None,
FILE: utils/melt/layers/cnn/convnet.py
class ConvNet (line 39) | class ConvNet(melt.Model):
method __init__ (line 40) | def __init__(self,
method call (line 61) | def call(self, seq, seq_len=None, masks=None,
FILE: utils/melt/layers/cnn/qanet.py
function glu (line 57) | def glu(x):
function noam_norm (line 62) | def noam_norm(x, epsilon=1.0, scope=None, reuse=None):
function layer_norm_compute_python (line 69) | def layer_norm_compute_python(x, epsilon, scale, bias):
function layer_norm (line 76) | def layer_norm(x, filters=None, epsilon=1e-6, scope=None, reuse=None):
function highway (line 90) | def highway(x, size = None, activation = None,
function layer_dropout (line 106) | def layer_dropout(inputs, residual, dropout):
function residual_block (line 110) | def residual_block(inputs, num_blocks, num_layers, kernel_size, mask = N...
function conv_block (line 130) | def conv_block(inputs, num_layers, kernel_size, num_filters,
function self_attention_block (line 148) | def self_attention_block(inputs, num_filters, seq_len, mask = None, num_...
function multihead_attention (line 170) | def multihead_attention(queries, units, num_heads,
function conv (line 200) | def conv(inputs, output_size, bias = None, activation = None, kernel_siz...
function mask_logits (line 230) | def mask_logits(inputs, mask, mask_value = -1e30):
function depthwise_separable_convolution (line 234) | def depthwise_separable_convolution(inputs, kernel_size, num_filters,
function split_last_dimension (line 263) | def split_last_dimension(x, n):
function dot_product_attention (line 279) | def dot_product_attention(q,
function combine_last_two_dimensions (line 318) | def combine_last_two_dimensions(x):
function add_timing_signal_1d (line 332) | def add_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4):
function get_timing_signal_1d (line 359) | def get_timing_signal_1d(length, channels, min_timescale=1.0, max_timesc...
function ndim (line 396) | def ndim(x):
function dot (line 423) | def dot(x, y):
function batch_dot (line 465) | def batch_dot(x, y, axes=None):
function optimized_trilinear_for_attention (line 523) | def optimized_trilinear_for_attention(args, c_maxlen, q_maxlen, input_ke...
function trilinear (line 565) | def trilinear(args,
function flatten (line 579) | def flatten(tensor, keep):
function reconstruct (line 587) | def reconstruct(tensor, ref, keep):
function _linear (line 600) | def _linear(args,
function total_params (line 661) | def total_params():
class QANet (line 673) | class QANet(keras.Model):
method __init__ (line 674) | def __init__(self,
method call (line 698) | def call(self, inputs, seq_len=None, masks=None, output_method='all', ...
FILE: utils/melt/layers/layers.py
class FeedForwardNetwork (line 60) | class FeedForwardNetwork(keras.Model):
method __init__ (line 61) | def __init__(self, hidden_size, output_size, keep_prob=1.):
method call (line 67) | def call(self, x, training=False):
class MaxPooling (line 73) | class MaxPooling(Layer):
method call (line 74) | def call(self, outputs, sequence_length=None, axis=1, reduce_func=tf.r...
class SumPooling (line 77) | class SumPooling(Layer):
method call (line 78) | def call(self, outputs, sequence_length=None, axis=1, reduce_func=tf.r...
class MaxPooling2 (line 81) | class MaxPooling2(Layer):
method call (line 82) | def call(self, outputs, sequence_length, sequence_length2, axis=1, red...
class MeanPooling (line 85) | class MeanPooling(Layer):
method call (line 86) | def call(self, outputs, sequence_length=None, axis=1):
class FirstPooling (line 89) | class FirstPooling(Layer):
method call (line 90) | def call(self, outputs, sequence_length=None, axis=1):
class LastPooling (line 93) | class LastPooling(Layer):
method call (line 94) | def call(self, outputs, sequence_length=None, axis=1):
class HierEncode (line 97) | class HierEncode(Layer):
method call (line 98) | def call(self, outputs, sequence_length=None, window_size=3, axis=1):
class TopKPooling (line 101) | class TopKPooling(Layer):
method __init__ (line 102) | def __init__(self,
method call (line 108) | def call(self, outputs, sequence_length=None, axis=1):
class TopKMeanPooling (line 112) | class TopKMeanPooling(Layer):
method __init__ (line 113) | def __init__(self,
method call (line 120) | def call(self, outputs, sequence_length=None, axis=1):
class TopKWeightedMeanPooling (line 126) | class TopKWeightedMeanPooling(Layer):
method __init__ (line 127) | def __init__(self,
method call (line 141) | def call(self, outputs, sequence_length=None, axis=1):
class TopKAttentionPooling (line 146) | class TopKAttentionPooling(keras.Model):
method __init__ (line 147) | def __init__(self,
method call (line 155) | def call(self, outputs, sequence_length=None, axis=1):
class AttentionPooling (line 163) | class AttentionPooling(keras.Model):
method __init__ (line 164) | def __init__(self,
method call (line 178) | def call(self, outputs, sequence_length=None, axis=1):
class LinearAttentionPooling (line 192) | class LinearAttentionPooling(keras.Model):
method __init__ (line 193) | def __init__(self,
method call (line 198) | def call(self, x, sequence_length=None, axis=1):
class NonLinearAttentionPooling (line 208) | class NonLinearAttentionPooling(keras.Model):
method __init__ (line 209) | def __init__(self,
method call (line 215) | def call(self, x, sequence_length=None, axis=1):
class Pooling (line 225) | class Pooling(keras.Model):
method __init__ (line 226) | def __init__(self,
method call (line 274) | def call(self, outputs, sequence_length=None, axis=1, calc_word_scores...
class DynamicDense (line 284) | class DynamicDense(keras.Model):
method __init__ (line 285) | def __init__(self,
method call (line 297) | def call(self, x):
class Embedding (line 303) | class Embedding(keras.layers.Layer):
method __init__ (line 304) | def __init__(self, height, width, name='init_fw'):
method call (line 314) | def call(self, x=None):
class Mlp (line 320) | class Mlp(Layer):
method __init__ (line 321) | def __init__(self,
method call (line 336) | def call(self, x, training=False):
class Dropout (line 343) | class Dropout(keras.layers.Layer):
method __init__ (line 344) | def __init__(self, rate, noise_shape=None, seed=None, **kwargs):
method call (line 350) | def call(self, x, training=False):
class Gate (line 364) | class Gate(keras.Model):
method __init__ (line 365) | def __init__(self,
method call (line 372) | def call(self, x, y, training=False):
class SemanticFusion (line 383) | class SemanticFusion(keras.Model):
method __init__ (line 384) | def __init__(self,
method call (line 391) | def call(self, x, fusions, training=False):
class SemanticFusionCombine (line 404) | class SemanticFusionCombine(keras.Model):
method __init__ (line 405) | def __init__(self,
method call (line 413) | def call(self, x, y, training=False):
class DotAttention (line 424) | class DotAttention(keras.Model):
method __init__ (line 425) | def __init__(self,
method call (line 447) | def call(self, inputs, memory, mask, self_match=False, training=False):
class BiDAFAttention (line 488) | class BiDAFAttention(keras.Model):
method __init__ (line 489) | def __init__(self,
method call (line 511) | def call(self, inputs, memory, inputs_mask, memory_mask, training=False):
class SeqAttnMatch (line 558) | class SeqAttnMatch(melt.Model):
method __init__ (line 564) | def __init__(self,
method call (line 582) | def call(self, x, y, mask, training=False):
class SelfAttnMatch (line 617) | class SelfAttnMatch(melt.Model):
method __init__ (line 623) | def __init__(self,
method call (line 649) | def call(self, x, mask, training=False):
class LayerNorm (line 690) | class LayerNorm(keras.layers.Layer):
method __init__ (line 691) | def __init__(self,
method call (line 698) | def call(self, x, training=False):
FILE: utils/melt/layers/optimizers.py
function average_gradients (line 63) | def average_gradients(tower_grads):
function optimize_loss (line 122) | def optimize_loss(losses,
function _clip_gradients_by_norm (line 430) | def _clip_gradients_by_norm(grads_and_vars, clip_gradients):
function _add_scaled_noise_to_gradients (line 438) | def _add_scaled_noise_to_gradients(grads_and_vars, gradient_noise_scale):
function _multiply_gradients (line 455) | def _multiply_gradients(grads_and_vars, gradient_multipliers):
FILE: utils/melt/layers/rnn/rnn.py
class InitStates (line 35) | class InitStates(Layer):
method __init__ (line 36) | def __init__(self, num_layers, num_units, name='init_fw'):
method call (line 45) | def call(self, layer, batch_size=None):
class CudnnRnn (line 55) | class CudnnRnn(keras.Model):
method __init__ (line 56) | def __init__(self,
method set_dropout_mask (line 195) | def set_dropout_mask(self, mask_fw, mask_bw):
method set_init_states (line 199) | def set_init_states(self, init_fw, init_bw):
method reset_init_states (line 203) | def reset_init_states(self):
method call (line 213) | def call(self,
class CudnnRnn2 (line 341) | class CudnnRnn2(CudnnRnn):
method __init__ (line 342) | def __init__(self,
method call (line 346) | def call(self,
FILE: utils/melt/losses/losses.py
function reduce_loss (line 19) | def reduce_loss(loss_matrix, combiner='mean'):
function contrastive (line 34) | def contrastive(pos_score, neg_scores, margin=1.0, use_square=True, comb...
function triplet (line 47) | def triplet(pos_score, neg_scores, margin=1.0, combiner='mean', name=Non...
function cross_entropy (line 54) | def cross_entropy(scores, combiner='mean', name=None):
function hinge (line 74) | def hinge(pos_score, neg_score, margin=0.1, combiner='mean', name=None):
function pairwise_cross (line 82) | def pairwise_cross(pos_score, neg_score, combiner='mean', name=None):
function pairwise_exp (line 92) | def pairwise_exp(pos_score, neg_score, theta=1., combiner='mean', name=...
function roc_auc_score (line 101) | def roc_auc_score(y_pred, y_true):
function getClassWeights (line 135) | def getClassWeights(Y, mu=0.5):
function u_statistic_loss (line 145) | def u_statistic_loss(y_true, y_pred, gamma=0.2, p=3.0):
function SoftAUC_loss (line 168) | def SoftAUC_loss(y_true, y_pred):
function SVMrank_loss (line 177) | def SVMrank_loss(y_true, y_pred):
function exp_loss (line 190) | def exp_loss(y_true, y_pred):
function art_loss (line 194) | def art_loss(y_true, y_pred):
function roc_auc_scores (line 198) | def roc_auc_scores(y_pred, y_true):
function focal_loss (line 212) | def focal_loss(target_tensor, prediction_tensor, weights=None, alpha=0.2...
function earth_mover_loss (line 246) | def earth_mover_loss(y_true, y_pred):
function bilm_loss (line 253) | def bilm_loss(model, x, y, training=False):
FILE: utils/melt/metrics/rank_metrics.py
function precision_at_k (line 8) | def precision_at_k(py_x, y, k=1, name=None):
FILE: utils/melt/models/mlp.py
function forward (line 45) | def forward(inputs,
FILE: utils/melt/ops/nn_impl.py
function _sum_rows (line 20) | def _sum_rows(x):
function compute_sampled_ids_and_logits (line 32) | def compute_sampled_ids_and_logits(weights,
FILE: utils/melt/ops/ops.py
function greater_then_set (line 54) | def greater_then_set(x, thre, val):
function matmul (line 60) | def matmul(X, w):
function mlp_forward (line 76) | def mlp_forward(input, hidden, hidden_bais, out, out_bias, activation=tf...
function mlp_forward_nobias (line 82) | def mlp_forward_nobias(input, hidden, out, activation=tf.nn.relu, name=N...
function element_wise_dot (line 87) | def element_wise_dot(a, b, keep_dims=True, name=None):
function element_wise_cosine_nonorm (line 91) | def element_wise_cosine_nonorm(a, b, keep_dims=True, name=None):
function element_wise_cosine (line 96) | def element_wise_cosine(a, b, a_normed=False, b_normed=False, nonorm=Fal...
function dot (line 111) | def dot(a, b, name=None):
function cosine_nonorm (line 116) | def cosine_nonorm(a, b, name=None):
function cosine (line 121) | def cosine(a, b, a_normed=False, b_normed=False, nonorm=False, name=None):
function reduce_mean (line 135) | def reduce_mean(input_tensor, reduction_indices=None, keep_dims=False):
function masked_reduce_mean (line 142) | def masked_reduce_mean(input_tensor, reduction_indices=None, keep_dims=...
function reduce_mean_with_mask (line 152) | def reduce_mean_with_mask(input_tensor, mask, reduction_indices=None, ke...
function embedding_lookup (line 156) | def embedding_lookup(emb, index, reduction_indices=None, combiner='mean'...
function embedding_lookup_mean (line 167) | def embedding_lookup_mean(emb, index, reduction_indices=None, name=None):
function embedding_lookup_sum (line 172) | def embedding_lookup_sum(emb, index, reduction_indices=None, name=None):
function masked_embedding_lookup (line 177) | def masked_embedding_lookup(emb, index, reduction_indices=None, combiner...
function masked_embedding_lookup_mean (line 185) | def masked_embedding_lookup_mean(emb, index, reduction_indices=None, exc...
function masked_embedding_lookup_sum (line 200) | def masked_embedding_lookup_sum(emb, index, reduction_indices=None, excl...
function wrapped_embedding_lookup (line 214) | def wrapped_embedding_lookup(emb, index, reduction_indices=None, combine...
function batch_embedding_lookup_reduce (line 224) | def batch_embedding_lookup_reduce(emb, index, combiner='mean', name=None):
function batch_embedding_lookup_mean (line 239) | def batch_embedding_lookup_mean(emb, index, name=None):
function batch_embedding_lookup_sum (line 245) | def batch_embedding_lookup_sum(emb, index, name=None):
function batch_masked_embedding_lookup_reduce (line 251) | def batch_masked_embedding_lookup_reduce(emb, index, combiner='mean', ex...
function batch_masked_embedding_lookup_and_reduce (line 259) | def batch_masked_embedding_lookup_and_reduce(emb, index, combiner='mean'...
function batch_masked_embedding_lookup_mean (line 267) | def batch_masked_embedding_lookup_mean(emb, index, exclude_zero_index=Tr...
function batch_masked_embedding_lookup_sum (line 289) | def batch_masked_embedding_lookup_sum(emb, index, exclude_zero_index=Tru...
function batch_masked_embedding_lookup (line 304) | def batch_masked_embedding_lookup(emb, index, exclude_zero_index=True, n...
function batch_wrapped_embedding_lookup (line 319) | def batch_wrapped_embedding_lookup(emb, index, combiner='mean', use_mask...
function mask2d (line 325) | def mask2d(emb):
function length (line 329) | def length(x, dim=1):
function length2 (line 333) | def length2(x, dim=1):
function full_length (line 339) | def full_length(x):
function dynamic_append (line 343) | def dynamic_append(x, value=1):
function dynamic_append_with_mask (line 352) | def dynamic_append_with_mask(x, mask, value=1):
function dynamic_append_with_length (line 361) | def dynamic_append_with_length(x, length, value=1):
function dynamic_append_with_length_float32 (line 371) | def dynamic_append_with_length_float32(x, length, value=1):
function static_append (line 381) | def static_append(x, value=1):
function static_append_with_mask (line 390) | def static_append_with_mask(x, mask, value=1):
function static_append_with_length (line 399) | def static_append_with_length(x, length, value=1):
function first_nrows (line 407) | def first_nrows(x, n):
function exclude_last_col (line 411) | def exclude_last_col(x):
function dynamic_exclude_last_col (line 422) | def dynamic_exclude_last_col(x):
function gather2d (line 434) | def gather2d(x, idx):
function dynamic_gather2d (line 459) | def dynamic_gather2d(x, idx):
function subtract_by_diff (line 466) | def subtract_by_diff(x, y):
function _align_col_padding2d (line 500) | def _align_col_padding2d(x, y):
function align_col_padding2d (line 510) | def align_col_padding2d(x, y):
function make_batch_compat (line 519) | def make_batch_compat(sequence):
function last_relevant (line 525) | def last_relevant(output, length):
function dynamic_last_relevant (line 548) | def dynamic_last_relevant(output, length):
function dynamic_last (line 572) | def dynamic_last(output):
function static_last (line 590) | def static_last(output):
function gather_cols (line 594) | def gather_cols(params, indices, name=None):
function batch_matmul_embedding (line 632) | def batch_matmul_embedding(x, emb, keep_dims=False):
function constants (line 644) | def constants(value, shape, dtype=dtypes.float32, name=None):
function constants_like (line 676) | def constants_like(tensor, value, dtype=None, name=None, optimize=True):
function sparse_softmax_cross_entropy (line 714) | def sparse_softmax_cross_entropy(x, y):
function softmax_cross_entropy (line 717) | def softmax_cross_entropy(x, y):
function sigmoid_cross_entropy (line 720) | def sigmoid_cross_entropy(x, y):
function reduce_loss (line 729) | def reduce_loss(loss_matrix, combiner='mean'):
function hinge_loss (line 735) | def hinge_loss(pos_score, neg_score, margin=0.1, combiner='mean', name=N...
function cross_entropy_loss (line 741) | def cross_entropy_loss(scores, num_negs=1, combiner='mean', name=None):
function hinge_cross_loss (line 753) | def hinge_cross_loss(pos_score, neg_score, combiner='mean', name=None):
function last_dimension (line 762) | def last_dimension(x):
function first_dimension (line 765) | def first_dimension(x):
function dimension (line 768) | def dimension(x, index):
function batch_values_to_indices (line 783) | def batch_values_to_indices(index_matrix):
function to_nd_indices (line 792) | def to_nd_indices(index_matrix):
function nhot (line 802) | def nhot(x, max_dim):
function dense (line 805) | def dense(inputs, kernel, bias=None, activation=None):
function sequence_equal (line 823) | def sequence_equal(x, y):
function get_batch_size (line 826) | def get_batch_size(x):
function get_shape (line 830) | def get_shape(x, dim):
function get_dims (line 833) | def get_dims(x):
function get_weighted_outputs (line 836) | def get_weighted_outputs(outputs, sequence_length):
function max_pooling (line 844) | def max_pooling(outputs, sequence_length=None, axis=1, reduce_func=tf.re...
function max_pooling2 (line 853) | def max_pooling2(outputs, sequence_length, sequence_length2, axis=1, red...
function top_k_pooling (line 864) | def top_k_pooling(outputs, top_k, sequence_length=None, axis=1):
function argtopk_pooling (line 879) | def argtopk_pooling(outputs, top_k, sequence_length=None, axis=1):
function argmax_pooling (line 884) | def argmax_pooling(outputs, sequence_length, axis=1):
function mean_pooling (line 887) | def mean_pooling(outputs, sequence_length=None, axis=1):
function sum_pooling (line 894) | def sum_pooling(outputs, sequence_length=None, axis=1):
function hier_encode (line 903) | def hier_encode(outputs, sequence_length, window_size=3, axis=1):
function hier_pooling (line 917) | def hier_pooling(outputs, sequence_length, window_size=3, axis=1):
function argmax_importance (line 933) | def argmax_importance(argmax_values, shape):
function maxpooling_importance (line 943) | def maxpooling_importance(outputs, sequence_length=None, axis=1):
function topkpooling_importance (line 947) | def topkpooling_importance(outputs, top_k, sequence_length=None, axis=1):
function slim_batch (line 953) | def slim_batch(sequence, sequence_length=None, dim=1):
function slim_batch2 (line 964) | def slim_batch2(sequence, sequence_length=None, dim=1):
function dropout (line 976) | def dropout(args, keep_prob, training, mode="recurrent"):
function masked_softmax (line 990) | def masked_softmax(values, lengths):
function softmax_mask (line 1000) | def softmax_mask(val, mask):
function get_words_importance (line 1004) | def get_words_importance(outputs=None, sequence_length=None, top_k=None,...
function unsorted_segment_sum_emb (line 1019) | def unsorted_segment_sum_emb(data, segment_ids, num_segments):
FILE: utils/melt/ops/sparse_ops.py
function sparse_tensor_to_dense (line 16) | def sparse_tensor_to_dense(input_tensor, maxlen=0):
FILE: utils/melt/rnn/rnn.py
class EncodeMethod (line 29) | class EncodeMethod:
function is_bidirectional (line 37) | def is_bidirectional(method):
class OutputMethod (line 43) | class OutputMethod:
class NativeGru (line 58) | class NativeGru:
method __init__ (line 59) | def __init__(self,
method set_dropout_mask (line 83) | def set_dropout_mask(self, mask_fw, mask_bw):
method set_init_states (line 87) | def set_init_states(self, init_fw, init_bw):
method reset_init_states (line 91) | def reset_init_states(self):
method encode (line 95) | def encode(self, inputs, seq_len, emb=None, concat_layers=True, output...
method __call__ (line 155) | def __call__(self, inputs, seq_len, emb=None, concat_layers=True, outp...
class CudnnRnn (line 159) | class CudnnRnn:
method __init__ (line 160) | def __init__(self,
method set_dropout_mask (line 203) | def set_dropout_mask(self, mask_fw, mask_bw):
method set_init_states (line 207) | def set_init_states(self, init_fw, init_bw):
method reset_init_states (line 211) | def reset_init_states(self):
method encode (line 215) | def encode(self, inputs, seq_len, emb=None, concat_layers=True, output...
method __call__ (line 288) | def __call__(self, inputs, seq_len, emb=None, concat_layers=True, outp...
class CudnnGru (line 292) | class CudnnGru:
method __init__ (line 293) | def __init__(self,
method set_dropout_mask (line 318) | def set_dropout_mask(self, mask_fw, mask_bw):
method set_init_states (line 322) | def set_init_states(self, init_fw, init_bw):
method reset_init_states (line 326) | def reset_init_states(self):
method encode (line 330) | def encode(self, inputs, seq_len, emb=None, concat_layers=True, output...
method __call__ (line 403) | def __call__(self, inputs, seq_len, emb=None, concat_layers=True, outp...
class NullEncoder (line 410) | class NullEncoder():
method encode (line 411) | def encode(self, inputs, sequence_length, output_method='all'):
function encode_outputs (line 421) | def encode_outputs(outputs, sequence_length=None,
function forward_encode (line 468) | def forward_encode(cell, inputs, sequence_length, initial_state=None, dt...
function backward_encode (line 479) | def backward_encode(cell, inputs, sequence_length, initial_state=None, d...
function stack_bidirectional_dynamic_rnn (line 492) | def stack_bidirectional_dynamic_rnn(cells_fw,
function bidirectional_encode (line 611) | def bidirectional_encode(cell_fw,
function encode (line 686) | def encode(cell,
FILE: utils/melt/seq2seq/attention_decoder_fn.py
function attention_decoder_fn_train (line 45) | def attention_decoder_fn_train(encoder_state,
function attention_decoder_fn_inference (line 179) | def attention_decoder_fn_inference(output_fn,
function prepare_attention (line 371) | def prepare_attention(attention_states,
function init_attention (line 412) | def init_attention(encoder_state):
function _create_attention_construct_fn (line 438) | def _create_attention_construct_fn(name, num_units, attention_score_fn, ...
function _attn_add_fun (line 472) | def _attn_add_fun(v, keys, query):
function _attn_mul_fun (line 478) | def _attn_mul_fun(keys, query):
function _create_attention_score_fn (line 482) | def _create_attention_score_fn(name,
FILE: utils/melt/seq2seq/attention_wrapper.py
class AttentionMechanism (line 64) | class AttentionMechanism(object):
function _prepare_memory (line 68) | def _prepare_memory(memory, memory_sequence_length, check_inner_dims_def...
function _maybe_mask_score (line 126) | def _maybe_mask_score(score, memory_sequence_length, score_mask_value):
class _BaseAttentionMechanism (line 138) | class _BaseAttentionMechanism(AttentionMechanism):
method __init__ (line 146) | def __init__(self,
method memory_layer (line 212) | def memory_layer(self):
method query_layer (line 216) | def query_layer(self):
method values (line 220) | def values(self):
method keys (line 224) | def keys(self):
method batch_size (line 228) | def batch_size(self):
method alignments_size (line 232) | def alignments_size(self):
method initial_alignments (line 235) | def initial_alignments(self, batch_size, dtype):
class LuongAttention (line 255) | class LuongAttention(_BaseAttentionMechanism):
method __init__ (line 272) | def __init__(self,
method __call__ (line 318) | def __call__(self, query, previous_alignments):
class BahdanauAttention (line 378) | class BahdanauAttention(_BaseAttentionMechanism):
method __init__ (line 400) | def __init__(self,
method __call__ (line 445) | def __call__(self, query, previous_alignments):
class CoverageBahdanauAttention (line 491) | class CoverageBahdanauAttention(_BaseAttentionMechanism):
method __init__ (line 513) | def __init__(self,
method __call__ (line 561) | def __call__(self, query, coverage):
class CoverageV2BahdanauAttention (line 608) | class CoverageV2BahdanauAttention(_BaseAttentionMechanism):
method __init__ (line 630) | def __init__(self,
method __call__ (line 684) | def __call__(self, query, coverage, pre_alignment):
class AttentionWrapperState (line 734) | class AttentionWrapperState(
method clone (line 751) | def clone(self, **kwargs):
function hardmax (line 772) | def hardmax(logits, name=None):
class AttentionWrapper (line 795) | class AttentionWrapper(rnn_cell_impl.RNNCell):
method __init__ (line 799) | def __init__(self,
method output_size (line 901) | def output_size(self):
method state_size (line 910) | def state_size(self):
method zero_state (line 918) | def zero_state(self, batch_size, dtype):
method call (line 953) | def call(self, inputs, state):
class PointerAttentionWrapperState (line 1067) | class PointerAttentionWrapperState(
method clone (line 1084) | def clone(self, **kwargs):
class PointerAttentionWrapper (line 1104) | class PointerAttentionWrapper(rnn_cell_impl.RNNCell):
method __init__ (line 1108) | def __init__(self,
method output_size (line 1214) | def output_size(self):
method state_size (line 1223) | def state_size(self):
method zero_state (line 1232) | def zero_state(self, batch_size, dtype):
method call (line 1268) | def call(self, inputs, state):
class ShowTellAttentionWrapperState (line 1409) | class ShowTellAttentionWrapperState(
method clone (line 1426) | def clone(self, **kwargs):
class ShowTellAttentionWrapper (line 1446) | class ShowTellAttentionWrapper(rnn_cell_impl.RNNCell):
method __init__ (line 1450) | def __init__(self,
method output_size (line 1556) | def output_size(self):
method state_size (line 1565) | def state_size(self):
method zero_state (line 1575) | def zero_state(self, batch_size, dtype):
method call (line 1613) | def call(self, inputs, state):
class TwoLayersAttentionWrapperState (line 1739) | class TwoLayersAttentionWrapperState(
method clone (line 1757) | def clone(self, **kwargs):
class TwoLayersAttentionWrapper (line 1777) | class TwoLayersAttentionWrapper(rnn_cell_impl.RNNCell):
method __init__ (line 1781) | def __init__(self,
method output_size (line 1887) | def output_size(self):
method state_size (line 1896) | def state_size(self):
method zero_state (line 1907) | def zero_state(self, batch_size, dtype):
method call (line 1950) | def call(self, inputs, state):
class CoverageAttentionWrapperState (line 2128) | class CoverageAttentionWrapperState(
method clone (line 2145) | def clone(self, **kwargs):
class CoverageAttentionWrapper (line 2169) | class CoverageAttentionWrapper(rnn_cell_impl.RNNCell):
method __init__ (line 2173) | def __init__(self,
method output_size (line 2275) | def output_size(self):
method state_size (line 2284) | def state_size(self):
method zero_state (line 2293) | def zero_state(self, batch_size, dtype):
method call (line 2330) | def call(self, inputs, state):
FILE: utils/melt/seq2seq/basic_decoder.py
class BasicDecoderOutput (line 44) | class BasicDecoderOutput(
class BasicDecoder (line 49) | class BasicDecoder(decoder.Decoder):
method __init__ (line 52) | def __init__(self, cell, helper, initial_state, vocab_size=None, outpu...
method batch_size (line 91) | def batch_size(self):
method output_size (line 95) | def output_size(self):
method output_dtype (line 101) | def output_dtype(self):
method initialize (line 106) | def initialize(self, name=None):
method step (line 117) | def step(self, time, inputs, state, name=None):
class BasicTrainingDecoder (line 150) | class BasicTrainingDecoder(decoder.Decoder):
method __init__ (line 153) | def __init__(self, cell, helper, initial_state, vocab_size=None, outpu...
method batch_size (line 191) | def batch_size(self):
method output_size (line 195) | def output_size(self):
method output_dtype (line 199) | def output_dtype(self):
method initialize (line 202) | def initialize(self, name=None):
method step (line 213) | def step(self, time, inputs, state, name=None):
FILE: utils/melt/seq2seq/beam_decoder.py
function rnn_decoder (line 31) | def rnn_decoder(decoder_inputs, initial_state, cell, loop_function=None,
class BeamDecoderOutputs (line 76) | class BeamDecoderOutputs(
method clone (line 79) | def clone(self, **kwargs):
class BeamDecoderState (line 82) | class BeamDecoderState(
method clone (line 85) | def clone(self, **kwargs):
function beam_decode (line 88) | def beam_decode(input, max_words, initial_state, cell, loop_function, sc...
class BeamDecoder (line 186) | class BeamDecoder():
method __init__ (line 187) | def __init__(self, input, max_steps, initial_state, beam_size=7, done_...
method calc_topn (line 234) | def calc_topn(self):
method take_step (line 280) | def take_step(self, i, prev, state):
FILE: utils/melt/seq2seq/beam_decoder_fn.py
function beam_decoder_fn_inference (line 36) | def beam_decoder_fn_inference(output_fn, first_input, encoder_state,
FILE: utils/melt/seq2seq/beam_search.py
class BeamSearchState (line 24) | class BeamSearchState(object):
method __init__ (line 27) | def __init__(self, words, state, logprob, score, logprobs, alignments_...
method __cmp__ (line 46) | def __cmp__(self, other):
method __lt__ (line 57) | def __lt__(self, other):
method __eq__ (line 62) | def __eq__(self, other):
function beam_search (line 67) | def beam_search(init_states,
FILE: utils/melt/seq2seq/beam_search_decoder.py
class BeamSearchDecoderState (line 50) | class BeamSearchDecoderState(
class BeamSearchDecoderOutput (line 56) | class BeamSearchDecoderOutput(
class FinalBeamSearchDecoderOutput (line 62) | class FinalBeamSearchDecoderOutput(
function _tile_batch (line 76) | def _tile_batch(t, multiplier):
function tile_batch (line 95) | def tile_batch(t, multiplier, name=None):
function _check_maybe (line 123) | def _check_maybe(t):
class BeamSearchDecoder (line 132) | class BeamSearchDecoder(decoder.Decoder):
method __init__ (line 167) | def __init__(self,
method batch_size (line 231) | def batch_size(self):
method _rnn_output_size (line 234) | def _rnn_output_size(self):
method output_size (line 255) | def output_size(self):
method output_dtype (line 263) | def output_dtype(self):
method initialize (line 273) | def initialize(self, name=None):
method finalize (line 295) | def finalize(self, outputs, final_state, sequence_lengths):
method _merge_batch_beams (line 317) | def _merge_batch_beams(self, t, s=None):
method _split_batch_beams (line 346) | def _split_batch_beams(self, t, s=None):
method _maybe_split_batch_beams (line 386) | def _maybe_split_batch_beams(self, t, s):
method _maybe_merge_batch_beams (line 410) | def _maybe_merge_batch_beams(self, t, s):
method step (line 433) | def step(self, time, inputs, state, name=None):
function _beam_search_step (line 486) | def _beam_search_step(time, logits, next_cell_state, beam_state, batch_s...
function _get_scores (line 634) | def _get_scores(log_probs, sequence_lengths, length_penalty_weight):
function _length_penalty (line 651) | def _length_penalty(sequence_lengths, penalty_factor):
function _mask_probs (line 671) | def _mask_probs(probs, eos_token, finished):
function _maybe_tensor_gather_helper (line 707) | def _maybe_tensor_gather_helper(gather_indices, gather_from, batch_size,
function _tensor_gather_helper (line 743) | def _tensor_gather_helper(gather_indices, gather_from, batch_size,
FILE: utils/melt/seq2seq/decoder.py
class Decoder (line 45) | class Decoder(object):
method batch_size (line 60) | def batch_size(self):
method output_size (line 65) | def output_size(self):
method output_dtype (line 70) | def output_dtype(self):
method initialize (line 75) | def initialize(self, name=None):
method step (line 90) | def step(self, time, inputs, state, name=None):
method finalize (line 110) | def finalize(self, outputs, final_state, sequence_lengths):
function _create_zero_outputs (line 114) | def _create_zero_outputs(size, dtype, batch_size):
function dynamic_decode (line 130) | def dynamic_decode(decoder,
FILE: utils/melt/seq2seq/decoder_fn.py
function greedy_decoder_fn_inference (line 33) | def greedy_decoder_fn_inference(output_fn, first_input, encoder_state,
FILE: utils/melt/seq2seq/exp/beam_decoder.py
function rnn_decoder (line 31) | def rnn_decoder(decoder_inputs, initial_state, cell, loop_function=None,
class BeamDecoderOutputs (line 76) | class BeamDecoderOutputs(
method clone (line 79) | def clone(self, **kwargs):
function beam_decode (line 82) | def beam_decode(input, max_words, initial_state, cell, loop_function, sc...
class BeamDecoder (line 177) | class BeamDecoder():
method __init__ (line 178) | def __init__(self, input, max_steps, initial_state, beam_size=7, done_...
method calc_topn (line 218) | def calc_topn(self):
method _get_aligments (line 254) | def _get_aligments(self, state):
method take_step (line 259) | def take_step(self, i, prev, state):
FILE: utils/melt/seq2seq/helper.py
function _unstack_ta (line 57) | def _unstack_ta(inp):
class Helper (line 64) | class Helper(object):
method batch_size (line 71) | def batch_size(self):
method initialize (line 79) | def initialize(self, name=None):
method sample (line 84) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 89) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class CustomHelper (line 94) | class CustomHelper(Helper):
method __init__ (line 97) | def __init__(self, initialize_fn, sample_fn, next_inputs_fn):
method batch_size (line 114) | def batch_size(self):
method initialize (line 119) | def initialize(self, name=None):
method sample (line 126) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 131) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class TrainingHelper (line 138) | class TrainingHelper(Helper):
method __init__ (line 144) | def __init__(self, inputs, sequence_length, time_major=False, name=None):
method batch_size (line 176) | def batch_size(self):
method initialize (line 179) | def initialize(self, name=None):
method sample (line 188) | def sample(self, time, outputs, name=None, **unused_kwargs):
method next_inputs (line 194) | def next_inputs(self, time, outputs, state, name=None, **unused_kwargs):
class ScheduledEmbeddingTrainingHelper (line 209) | class ScheduledEmbeddingTrainingHelper(TrainingHelper):
method __init__ (line 216) | def __init__(self, inputs, sequence_length, embedding, sampling_probab...
method initialize (line 258) | def initialize(self, name=None):
method sample (line 261) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 274) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class ScheduledOutputTrainingHelper (line 311) | class ScheduledOutputTrainingHelper(TrainingHelper):
method __init__ (line 317) | def __init__(self, inputs, sequence_length, sampling_probability,
method initialize (line 382) | def initialize(self, name=None):
method sample (line 385) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 393) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class GreedyEmbeddingHelper (line 452) | class GreedyEmbeddingHelper(Helper):
method __init__ (line 459) | def __init__(self, embedding, first_input, end_token):
method batch_size (line 485) | def batch_size(self):
method initialize (line 488) | def initialize(self, name=None):
method sample (line 492) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 503) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class LogProbsGreedyEmbeddingHelper (line 515) | class LogProbsGreedyEmbeddingHelper(Helper):
method __init__ (line 522) | def __init__(self, embedding, first_input, end_token, need_softmax=True):
method batch_size (line 549) | def batch_size(self):
method initialize (line 552) | def initialize(self, name=None):
method sample (line 556) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 576) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class MultinomialEmbeddingHelper (line 589) | class MultinomialEmbeddingHelper(Helper):
method __init__ (line 596) | def __init__(self, embedding, first_input, end_token, need_softmax=True):
method batch_size (line 624) | def batch_size(self):
method initialize (line 627) | def initialize(self, name=None):
method sample (line 631) | def sample(self, time, outputs, state, name=None):
method next_inputs (line 657) | def next_inputs(self, time, outputs, state, sample_ids, name=None):
class LoopHelper (line 670) | class LoopHelper(Helper):
method __init__ (line 676) | def __init__(self, inputs, sequence_length, time_major=False, name=None):
method batch_size (line 708) | def batch_size(self):
method initialize (line 711) | def initialize(self, name=None):
method sample (line 720) | def sample(self, time, outputs, name=None, **unused_kwargs):
method next_inputs (line 724) | def next_inputs(self, time, outputs, state, name=None, **unused_kwargs):
FILE: utils/melt/seq2seq/legacy/beam_decoder.py
function rnn_decoder (line 31) | def rnn_decoder(decoder_inputs, initial_state, cell, loop_function=None,
class BeamDecoderOutputs (line 76) | class BeamDecoderOutputs(
method clone (line 79) | def clone(self, **kwargs):
function beam_decode (line 82) | def beam_decode(input, max_words, initial_state, cell, loop_function, sc...
class BeamDecoder (line 177) | class BeamDecoder():
method __init__ (line 178) | def __init__(self, input, max_steps, initial_state, beam_size=7, done_...
method calc_topn (line 218) | def calc_topn(self):
method _get_aligments (line 254) | def _get_aligments(self, state):
method take_step (line 259) | def take_step(self, i, prev, state):
FILE: utils/melt/seq2seq/legacy/beam_search_decoder.py
class BeamSearchDecoderState (line 50) | class BeamSearchDecoderState(
class BeamSearchDecoderOutput (line 56) | class BeamSearchDecoderOutput(
class FinalBeamSearchDecoderOutput (line 62) | class FinalBeamSearchDecoderOutput(
function tile_batch (line 76) | def tile_batch(t, multiplier, name=None):
class BeamSearchDecoder (line 114) | class BeamSearchDecoder(decoder.Decoder):
method __init__ (line 117) | def __init__(self,
method batch_size (line 180) | def batch_size(self):
method output_size (line 184) | def output_size(self):
method output_dtype (line 192) | def output_dtype(self):
method initialize (line 202) | def initialize(self, name=None):
method finalize (line 224) | def finalize(self, outputs, final_state, sequence_lengths):
method _merge_batch_beams (line 246) | def _merge_batch_beams(self, t, s=None):
method _split_batch_beams (line 278) | def _split_batch_beams(self, t, s=None):
method _maybe_split_batch_beams (line 321) | def _maybe_split_batch_beams(self, t, s):
method _maybe_merge_batch_beams (line 351) | def _maybe_merge_batch_beams(self, t, s):
method step (line 380) | def step(self, time, inputs, state, name=None):
function _beam_search_step (line 432) | def _beam_search_step(time, logits, beam_state, batch_size, beam_width,
function _get_scores (line 556) | def _get_scores(log_probs, sequence_lengths, length_penalty_weight):
function _length_penalty (line 573) | def _length_penalty(sequence_lengths, penalty_factor):
function _mask_probs (line 593) | def _mask_probs(probs, eos_token, finished):
function _tensor_gather_helper (line 629) | def _tensor_gather_helper(gather_indices, gather_from, range_input, rang...
FILE: utils/melt/seq2seq/logprobs_decoder.py
class LogProbsDecoderOutput (line 48) | class LogProbsDecoderOutput(
class LogProbsDecoderState (line 56) | class LogProbsDecoderState(
class LogProbsDecoder (line 60) | class LogProbsDecoder(decoder.Decoder):
method __init__ (line 63) | def __init__(self, cell, helper, initial_state, vocab_size=None, outpu...
method batch_size (line 102) | def batch_size(self):
method output_size (line 106) | def output_size(self):
method output_dtype (line 113) | def output_dtype(self):
method initialize (line 131) | def initialize(self, name=None):
method step (line 147) | def step(self, time, inputs, state, name=None):
FILE: utils/melt/seq2seq/loss.py
function sequence_loss_by_example (line 33) | def sequence_loss_by_example(logits, targets, weights,
function sequence_loss (line 104) | def sequence_loss(logits,
function exact_predict_loss (line 145) | def exact_predict_loss(logits, targets, mask, num_steps,
function sigmoid_loss (line 216) | def sigmoid_loss(logits, targets, mask, num_steps, vocab_size,
function gen_sampled_softmax_loss_function (line 252) | def gen_sampled_softmax_loss_function(num_sampled, vocab_size,
FILE: utils/melt/seq2seq/official/beam_search_decoder.py
class BeamSearchDecoderState (line 50) | class BeamSearchDecoderState(
class BeamSearchDecoderOutput (line 56) | class BeamSearchDecoderOutput(
class FinalBeamSearchDecoderOutput (line 62) | class FinalBeamSearchDecoderOutput(
function _tile_batch (line 76) | def _tile_batch(t, multiplier):
function tile_batch (line 95) | def tile_batch(t, multiplier, name=None):
function _check_maybe (line 123) | def _check_maybe(t):
class BeamSearchDecoder (line 132) | class BeamSearchDecoder(decoder.Decoder):
method __init__ (line 167) | def __init__(self,
method batch_size (line 234) | def batch_size(self):
method _rnn_output_size (line 237) | def _rnn_output_size(self):
method output_size (line 256) | def output_size(self):
method output_dtype (line 264) | def output_dtype(self):
method initialize (line 274) | def initialize(self, name=None):
method finalize (line 296) | def finalize(self, outputs, final_state, sequence_lengths):
method _merge_batch_beams (line 318) | def _merge_batch_beams(self, t, s=None):
method _split_batch_beams (line 347) | def _split_batch_beams(self, t, s=None):
method _maybe_split_batch_beams (line 387) | def _maybe_split_batch_beams(self, t, s):
method _maybe_merge_batch_beams (line 411) | def _maybe_merge_batch_beams(self, t, s):
method step (line 434) | def step(self, time, inputs, state, name=None):
function _beam_search_step (line 487) | def _beam_search_step(time, logits, next_cell_state, beam_state, batch_s...
function _get_scores (line 635) | def _get_scores(log_probs, sequence_lengths, length_penalty_weight):
function _length_penalty (line 652) | def _length_penalty(sequence_lengths, penalty_factor):
function _mask_probs (line 672) | def _mask_probs(probs, eos_token, finished):
function _maybe_tensor_gather_helper (line 708) | def _maybe_tensor_gather_helper(gather_indices, gather_from, batch_size,
function _tensor_gather_helper (line 744) | def _tensor_gather_helper(gather_indices, gather_from, batch_size,
FILE: utils/melt/seq2seq/seq2seq.py
function dynamic_rnn_decoder (line 35) | def dynamic_rnn_decoder(cell, decoder_fn, inputs=None, sequence_length=N...
FILE: utils/melt/slim2/base_nets_factory.py
function get_base_network_fn (line 72) | def get_base_network_fn(name, weight_decay=0.0):
FILE: utils/melt/slim2/layers.py
function mlp (line 22) | def mlp(inputs,
function fully_connected (line 57) | def fully_connected(inputs,
FILE: utils/melt/tfrecords/dataset.py
class Dataset (line 31) | class Dataset(object):
method __init__ (line 32) | def __init__(self,
method get_filenames (line 48) | def get_filenames(self, subset=None):
method parser (line 63) | def parser(self, example):
method adjust (line 66) | def adjust(self, result):
method make_batch (line 69) | def make_batch(self,
method num_examples_per_epoch (line 156) | def num_examples_per_epoch(subset, dir=None):
FILE: utils/melt/tfrecords/dataset_decode.py
function padded_batch (line 29) | def padded_batch(d, batch_size, padded_shapes=None):
function inputs (line 35) | def inputs(files,
FILE: utils/melt/tfrecords/decode_then_shuffle.py
function _read_decode (line 23) | def _read_decode(filename_queue, decode_fn, thread_id=0):
function inputs (line 37) | def inputs(files, decode_fn, batch_size=64,
FILE: utils/melt/tfrecords/libsvm_decode.py
function decode (line 18) | def decode(batch_serialized_examples, label_type=tf.int64, index_type=tf...
FILE: utils/melt/tfrecords/shuffle_then_decode.py
function _read (line 22) | def _read(filename_queue):
function inputs (line 27) | def inputs(files, decode_fn, batch_size=64,
FILE: utils/melt/tfrecords/write.py
class Writer (line 19) | class Writer(object):
method __init__ (line 20) | def __init__(self, file, buffer_size=None):
method __del__ (line 34) | def __del__(self):
method __enter__ (line 38) | def __enter__(self):
method __exit__ (line 41) | def __exit__(self, exc_type, exc_value, traceback):
method close (line 45) | def close(self):
method finalize (line 52) | def finalize(self):
method write (line 55) | def write(self, example):
method size (line 67) | def size(self):
class MultiOutWriter (line 71) | class MultiOutWriter(object):
method __init__ (line 75) | def __init__(self, dir, name='train', max_lines=50000):
method __del__ (line 83) | def __del__(self):
method __enter__ (line 87) | def __enter__(self):
method __exit__ (line 90) | def __exit__(self, exc_type, exc_value, traceback):
method get_tfrecord (line 94) | def get_tfrecord(self):
method write (line 98) | def write(self, example):
class RandomSplitWriter (line 108) | class RandomSplitWriter(object):
method __init__ (line 112) | def __init__(self, train_file, test_file, train_ratio=0.8):
method __enter__ (line 117) | def __enter__(self):
method __del__ (line 120) | def __del__(self):
method __exit__ (line 124) | def __exit__(self, exc_type, exc_value, traceback):
method close (line 128) | def close(self):
method write (line 132) | def write(example):
class RandomSplitMultiOutWriter (line 136) | class RandomSplitMultiOutWriter(object):
method __init__ (line 140) | def __init__(self, train_dir, test_dir, train_name='train', test_name=...
method __enter__ (line 145) | def __enter__(self):
method __del__ (line 148) | def __del__(self):
method __exit__ (line 152) | def __exit__(self, exc_type, exc_value, traceback):
method close (line 156) | def close(self):
method write (line 160) | def write(self, example):
FILE: utils/melt/tools/count-records.py
function deal_file (line 31) | def deal_file(file):
function main (line 41) | def main(_):
FILE: utils/melt/tools/delete-old-models.py
function list_models (line 21) | def list_models(model_dir, time_descending=True):
FILE: utils/melt/tools/rename-variables.py
function rename (line 22) | def rename(checkpoint_dir, replace_from, replace_to, add_prefix, dry_run):
function main (line 50) | def main(argv):
FILE: utils/melt/tools/reset-model-top-scope.py
function reset_model_top_scope (line 45) | def reset_model_top_scope():
function main (line 81) | def main(unused_args):
FILE: utils/melt/torch/train.py
function torch_ (line 37) | def torch_(x):
function to_torch (line 65) | def to_torch(x, y=None):
function train (line 77) | def train(Dataset,
FILE: utils/melt/training/adamax.py
class AdaMaxOptimizer (line 32) | class AdaMaxOptimizer(adam.AdamOptimizer):
method __init__ (line 40) | def __init__(self, learning_rate=0.001, beta1=0.9, beta2=0.999, epsilo...
method _get_beta_accumulators (line 89) | def _get_beta_accumulators(self):
method _create_slots (line 96) | def _create_slots(self, var_list):
method _apply_dense (line 111) | def _apply_dense(self, grad, var):
method _resource_apply_dense (line 124) | def _resource_apply_dense(self, grad, var):
method _apply_sparse_shared (line 137) | def _apply_sparse_shared(self, grad, var, indices,
method _apply_sparse (line 164) | def _apply_sparse(self, grad, var):
method _resource_scatter_update (line 172) | def _resource_scatter_update(self, x, i, v):
method _resource_apply_sparse (line 178) | def _resource_apply_sparse(self, grad, var, indices):
method _finish (line 183) | def _finish(self, update_ops, name_scope):
FILE: utils/melt/training/bert/optimization.py
function create_optimizer (line 24) | def create_optimizer(global_step, init_lr, num_train_steps, num_warmup_s...
class AdamWeightDecayOptimizer (line 72) | class AdamWeightDecayOptimizer(tf.train.Optimizer):
method __init__ (line 76) | def __init__(self,
method apply_gradients (line 94) | def apply_gradients(self, grads_and_vars, global_step=None, name=None):
method _do_use_weight_decay (line 149) | def _do_use_weight_decay(self, param_name):
method _get_variable_name (line 159) | def _get_variable_name(self, param_name):
FILE: utils/melt/training/learning_rate_decay.py
function exponential_decay (line 20) | def exponential_decay(learning_rate, global_step, decay_steps, decay_rate,
function piecewise_constant (line 95) | def piecewise_constant(x, boundaries, values, name=None):
FILE: utils/melt/util.py
function create_restore_fn (line 36) | def create_restore_fn(checkpoint, model_name, restore_model_name):
class Model (line 64) | class Model(keras.Model):
method __init__ (line 65) | def __init__(self,
method train (line 72) | def train(self):
method eval (line 75) | def eval(self):
function exists_model (line 81) | def exists_model(model_dir):
function adjust_lrs (line 87) | def adjust_lrs(x, ratio=None, name='learning_rate_weights'):
function adjust_weights (line 95) | def adjust_weights(x, ratio=None, name='learning_rate_weights'):
function try_convert_images (line 103) | def try_convert_images(images):
function freeze_graph (line 110) | def freeze_graph(sess, model_path, global_step=None, output_collection_n...
function is_raw_image (line 167) | def is_raw_image(image_features):
function set_learning_rate (line 171) | def set_learning_rate(lr, sess=None, name='learning_rate'):
function multiply_learning_rate (line 176) | def multiply_learning_rate(lr, sess=None, name='learning_rate'):
function init_uninitialized_variables (line 182) | def init_uninitialized_variables(sess, list_of_variables = None):
function get_global_step (line 191) | def get_global_step(model_dir, num_steps_per_epoch, fix_step=True):
function checkpoint_exists (line 214) | def checkpoint_exists(checkpoint_path):
function get_checkpoint_varnames (line 218) | def get_checkpoint_varnames(model_dir):
function varname_in_checkpoint (line 234) | def varname_in_checkpoint(varname_part, model_dir, mode='in'):
function has_image_model (line 256) | def has_image_model(model_dir, image_model_name):
function try_add_to_collection (line 259) | def try_add_to_collection(name, op):
function remove_from_collection (line 263) | def remove_from_collection(key):
function rename_from_collection (line 269) | def rename_from_collection(key, to_key, index=0, scope=None):
function initialize_uninitialized_vars (line 276) | def initialize_uninitialized_vars(sess):
function get_session (line 325) | def get_session(log_device_placement=False, allow_soft_placement=True, d...
function gen_session (line 366) | def gen_session(graph=None, log_device_placement=False, allow_soft_place...
function get_optimizer (line 395) | def get_optimizer(name):
function gen_train_op (line 411) | def gen_train_op(loss, learning_rate, optimizer=tf.train.AdagradOptimizer):
function gen_train_op_byname (line 415) | def gen_train_op_byname(loss, learning_rate, name='adagrad'):
function tower (line 460) | def tower(loss_function, num_gpus=1, training=True, name=''):
function _split_batch (line 499) | def _split_batch(batch_datas, batch_size, num_shards, training=True):
function split_batch (line 527) | def split_batch(batch_datas, batch_size, num_shards, training=True):
function get_available_gpus (line 567) | def get_available_gpus():
function get_num_gpus_specific (line 574) | def get_num_gpus_specific():
function get_num_gpus (line 585) | def get_num_gpus():
function is_cudnn_cell (line 591) | def is_cudnn_cell(cell):
function create_rnn_cell (line 616) | def create_rnn_cell(num_units, is_training=True, initializer=None, forge...
function unpack_cell (line 679) | def unpack_cell(cell):
function show_precision_at_k (line 688) | def show_precision_at_k(result, k=1):
function print_results (line 697) | def print_results(results, names=None):
function logging_results (line 712) | def logging_results(results, names, tag=''):\
function parse_results (line 716) | def parse_results(results, names=None):
function value_name_list_str (line 732) | def value_name_list_str(results, names=None):
function latest_checkpoint (line 763) | def latest_checkpoint(model_dir):
function get_model_dir_and_path (line 766) | def get_model_dir_and_path(model_dir, model_name=None):
function get_model_dir (line 778) | def get_model_dir(model_dir, model_name=None):
function get_model_path (line 790) | def get_model_path(model_dir, model_name=None):
function recent_checkpoint (line 810) | def recent_checkpoint(model_dir, latest=False):
function checkpoint_exists_in (line 814) | def checkpoint_exists_in(model_dir):
function get_model_step (line 828) | def get_model_step(model_path):
function get_model_epoch (line 831) | def get_model_epoch(model_path):
function get_model_epoch_from_dir (line 837) | def get_model_epoch_from_dir(model_dir):
function get_model_step_from_dir (line 844) | def get_model_step_from_dir(model_dir):
function save_model (line 848) | def save_model(sess, model_dir, step):
function restore (line 852) | def restore(sess, model_dir, var_list=None, model_name=None):
function restore_from_path (line 867) | def restore_from_path(sess, model_path, var_list=None):
function restore_scope_from_path (line 878) | def restore_scope_from_path(sess, model_path, scope):
function load (line 887) | def load(model_dir, model_name=None):
function load_from_path (line 898) | def load_from_path(model_path):
function list_models (line 909) | def list_models(model_dir, time_descending=True):
function variables_with_scope (line 918) | def variables_with_scope(scope):
function npdtype2tfdtype (line 924) | def npdtype2tfdtype(data_npy):
function load_constant (line 935) | def load_constant(data_npy, sess=None, trainable=False,
function load_constant_cpu (line 985) | def load_constant_cpu(data_npy, sess=None, trainable=False,
function reuse_variables (line 995) | def reuse_variables():
function int_feature (line 1003) | def int_feature(value):
function int64_feature (line 1008) | def int64_feature(value):
function bytes_feature (line 1013) | def bytes_feature(value):
function float_feature (line 1021) | def float_feature(value):
function int64_feature_list (line 1033) | def int64_feature_list(values):
function bytes_feature_list (line 1037) | def bytes_feature_list(values):
function float_feature_list (line 1041) | def float_feature_list(values):
function get_num_records_single (line 1045) | def get_num_records_single(tf_record_file):
function get_num_records (line 1048) | def get_num_records(files):
function get_num_records_print (line 1053) | def get_num_records_print(files):
function load_num_records (line 1067) | def load_num_records(input):
function get_num_records_from_dir (line 1072) | def get_num_records_from_dir(dir_):
function monitor_train_vars (line 1088) | def monitor_train_vars(collections=None):
class MonitorKeys (line 1092) | class MonitorKeys():
function monitor_gradients_from_loss (line 1097) | def monitor_gradients_from_loss(loss, collections=[MonitorKeys.TRAIN]):
function histogram_summary (line 1106) | def histogram_summary(name, tensor):
function scalar_summary (line 1109) | def scalar_summary(name, tensor):
function monitor_embedding (line 1112) | def monitor_embedding(emb, vocab, vocab_size):
function visualize_embedding (line 1128) | def visualize_embedding(emb, vocab_txt='vocab.txt'):
function get_summary_ops (line 1141) | def get_summary_ops():
function print_summary_ops (line 1144) | def print_summary_ops():
function print_global_varaiables (line 1150) | def print_global_varaiables(sope=None):
function print_varaiables (line 1154) | def print_varaiables(key, sope=None):
function get_global_int (line 1158) | def get_global_int(key, val=0):
function get_global_float (line 1163) | def get_global_float(key, val=0.):
function get_global_str (line 1168) | def get_global_str(key):
function get_global (line 1174) | def get_global(key):
function step (line 1178) | def step():
function epoch (line 1181) | def epoch():
function batch_size (line 1184) | def batch_size():
function num_gpus (line 1187) | def num_gpus():
function loss (line 1190) | def loss():
function train_loss (line 1198) | def train_loss():
function eval_loss (line 1201) | def eval_loss():
function duration (line 1204) | def duration():
function set_global (line 1207) | def set_global(key, value):
function add_global (line 1210) | def add_global(key, value):
function default_names (line 1220) | def default_names(length):
function adjust_names (line 1228) | def adjust_names(ops, names):
function add_summarys (line 1248) | def add_summarys(summary, values, names, suffix='', prefix=''):
function add_summary (line 1258) | def add_summary(summary, value, name, suffix='', prefix=''):
function pad_weights (line 1272) | def pad_weights(text, weights, start_id=None, end_id=None, end_weight=1.0):
function pad (line 1276) | def pad(text, start_id=None, end_id=None, weights=None, end_weight=1.0):
class GpuHanler (line 1319) | class GpuHanler(object):
method __init__ (line 1320) | def __init__(self, num_gpus=None):
method next_device (line 1323) | def next_device(self):
function count_records (line 1333) | def count_records(files):
function sparse2dense (line 1354) | def sparse2dense(features, key=None):
class GlobalStep (line 1368) | class GlobalStep():
method __init__ (line 1369) | def __init__(self, step):
method assign (line 1372) | def assign(self, step):
method assign_add (line 1375) | def assign_add(self, step):
method numpy (line 1378) | def numpy(self):
method value (line 1381) | def value(self):
class LearningRate (line 1384) | class LearningRate():
method __init__ (line 1385) | def __init__(self, lr):
method assign (line 1388) | def assign(self, lr):
method numpy (line 1391) | def numpy(self):
method value (line 1394) | def value(self):
method __mul__ (line 1397) | def __mul__(self, scalar):
FILE: utils/melt/utils/embsim.py
function zero_first_row (line 19) | def zero_first_row(emb):
class EmbeddingSim (line 24) | class EmbeddingSim:
method __init__ (line 25) | def __init__(self, emb=None, fixed_emb=None,
method sum_emb (line 57) | def sum_emb(self, ids):
method to_feature (line 63) | def to_feature(self, ids):
method sim (line 66) | def sim(self, left_ids, right_ids):
method top_sim (line 74) | def top_sim(self, left_ids, right_ids, topn=50, sorted=True):
method all_score (line 81) | def all_score(self, ids):
method nearby (line 87) | def nearby(self, ids, topn=50, sorted=True):
method fixed_sim (line 95) | def fixed_sim(self, left_ids, right_ids):
method fixed_right_sim (line 100) | def fixed_right_sim(self, left_ids):
method fixed_all_score (line 105) | def fixed_all_score(self, ids):
method fixed_nearyby (line 109) | def fixed_nearyby(self, ids, topn=50, sorted=True):
method fixed_right_all_score (line 113) | def fixed_right_all_score(self, ids):
method fixed_right_nearyby (line 117) | def fixed_right_nearyby(self, ids, topn=50, sorted=True):
method dum_fixed_emb (line 121) | def dum_fixed_emb(self, ids, ofile):
method dum_emb (line 125) | def dum_emb(self, ofile):
FILE: utils/melt/utils/logging.py
function set_hvd (line 49) | def set_hvd(hvd_):
function info (line 53) | def info(*args):
function info2 (line 57) | def info2(*args):
function fatal (line 61) | def fatal(*args):
function error (line 65) | def error(*args):
function debug (line 69) | def debug(*args):
function warn (line 73) | def warn(*args):
function warning (line 77) | def warning(*args):
class ElapsedFormatter (line 84) | class ElapsedFormatter():
method __init__ (line 85) | def __init__(self):
method format (line 88) | def format(self, record):
function _get_handler (line 97) | def _get_handler(file, formatter, split=True, split_bytime=False, mode =...
function set_dir (line 114) | def set_dir(path, file='log.html', logtostderr=True, logtofile=True, spl...
function init (line 148) | def init(path, file='log.html', logtostderr=True, logtofile=True, split=...
function vlog (line 152) | def vlog(level, msg, *args, **kwargs):
function get_verbosity (line 155) | def get_verbosity():
function set_verbosity (line 159) | def set_verbosity(verbosity):
function get_logging_file (line 163) | def get_logging_file():
FILE: utils/melt/utils/summary.py
class SummaryWriter (line 32) | class SummaryWriter(object):
method __init__ (line 34) | def __init__(self, log_dir):
method scalar_summary (line 38) | def scalar_summary(self, tag, value, step):
method image_summary (line 44) | def image_summary(self, tag, images, step, texts=None):
method history_summary (line 77) | def history_summary(self, tag, values, step, bins=1000):
FILE: utils/melt/utils/weight_decay.py
class WeightDecay (line 34) | class WeightDecay(object):
method __init__ (line 35) | def __init__(self,
method add (line 92) | def add(self, score):
class WeightsDecay (line 154) | class WeightsDecay(object):
method __init__ (line 155) | def __init__(self,
method add (line 218) | def add(self, scores):
FILE: utils/melt/variable/variable.py
function init_weights (line 17) | def init_weights(shape, stddev=0.01, name=None):
function init_weights_truncated (line 20) | def init_weights_truncated(shape, stddev=1.0, name=None):
function init_weights_random (line 23) | def init_weights_random(shape, stddev=1.0, name=None):
function init_weights_uniform (line 26) | def init_weights_uniform(shape, minval=0, maxval=None, name=None):
function init_bias (line 29) | def init_bias(shape, val=0.1, name=None):
function get_weights (line 38) | def get_weights(name, shape, minval=-0.08, maxval=0.08, trainable=True):
function get_weights_truncated (line 41) | def get_weights_truncated(name, shape, stddev=1.0, trainable=True):
function get_weights_random (line 44) | def get_weights_random(name, shape, stddev=1.0, trainable=True):
function get_weights_normal (line 47) | def get_weights_normal(name, shape, stddev=1.0, trainable=True):
function get_weights_uniform (line 50) | def get_weights_uniform(name, shape, minval=0, maxval=None, trainable=Tr...
function get_bias (line 53) | def get_bias(name, shape, val=0.1, trainable=True):
FILE: wenzheng/embedding.py
class Embedding (line 74) | class Embedding(layers.Layer):
method __init__ (line 77) | def __init__(self, vocab_size, embedding_dim=None, embedding=None,
method build (line 97) | def build(self, _):
method call (line 126) | def call(self, x):
function get_embedding (line 136) | def get_embedding(name='emb', height=None, emb_dim=None, trainable=True):
function get_embedding_cpu (line 162) | def get_embedding_cpu(name='emb', height=None, emb_dim=None, trainable=T...
function get_or_restore_embedding (line 166) | def get_or_restore_embedding(name='emb', embedding_file=None, trainable=...
function get_or_restore_embedding_cpu (line 212) | def get_or_restore_embedding_cpu(name='emb', embedding_file=None, traina...
function get_position_embedding (line 216) | def get_position_embedding(name='pos_emb', height=None):
function get_position_embedding_cpu (line 224) | def get_position_embedding_cpu(name='pos_emb', height=None):
function get_or_restore_char_embedding_cpu (line 229) | def get_or_restore_char_embedding_cpu(name='char_emb', embedding_file=No...
function get_or_restore_char_embedding (line 233) | def get_or_restore_char_embedding(name='char_emb', embedding_file=None, ...
function get_or_restore_ngram_embedding_cpu (line 242) | def get_or_restore_ngram_embedding_cpu(name='ngram_emb', embedding_file=...
function get_or_restore_ngram_embedding (line 246) | def get_or_restore_ngram_embedding(name='ngram_emb', embedding_file=None...
function get_or_restore_pinyin_embedding_cpu (line 255) | def get_or_restore_pinyin_embedding_cpu(name='pinyin_emb', embedding_fil...
function get_or_restore_pinyin_embedding (line 259) | def get_or_restore_pinyin_embedding(name='pinyin_emb', embedding_file=No...
FILE: wenzheng/encoder.py
class Encoder (line 38) | class Encoder(melt.Model):
method __init__ (line 39) | def __init__(self, type='gru', keep_prob=None):
method call (line 106) | def call(self, seq, seq_len, mask_fws=None, mask_bws=None, training=Fa...
class TextEncoder (line 123) | class TextEncoder(melt.Model):
method __init__ (line 133) | def __init__(self,
method call (line 302) | def call(self, input, c_len=None, max_c_len=None, training=False):
class BertEncoder (line 346) | class BertEncoder(melt.Model):
method __init__ (line 348) | def __init__(self, embedding=None):
method restore (line 384) | def restore(self):
method call (line 400) | def call(self, input, c_len=None, max_c_len=None, training=False):
FILE: wenzheng/pyt/embedding.py
function get_embedding (line 26) | def get_embedding(vocab_size,
FILE: wenzheng/pyt/encoder.py
class TextEncoder (line 27) | class TextEncoder(nn.Module):
method __init__ (line 37) | def __init__(self,
method get_mask (line 185) | def get_mask(self, x):
method forward (line 194) | def forward(self, input, mask=None, training=False):
FILE: wenzheng/utils/ids2text.py
function init (line 35) | def init(vocab_path=None):
function ids2words (line 42) | def ids2words(text_ids, print_end=True):
function ids2text (line 66) | def ids2text(text_ids, sep=' ', print_end=True):
function idslist2texts (line 69) | def idslist2texts(text_ids_list, sep=' ', print_end=True):
function translate (line 73) | def translate(text_ids):
function translates (line 76) | def translates(text_ids_list):
function start_id (line 79) | def start_id():
function end_id (line 82) | def end_id():
function unk_id (line 85) | def unk_id():
FILE: wenzheng/utils/text2ids.py
function init (line 47) | def init(vocab_path=None, append=None):
function get_id (line 55) | def get_id(word, unk_vocab_size=None):
function words2ids (line 62) | def words2ids(words, feed_single=True, allow_all_zero=False,
function text2ids (line 150) | def text2ids(text, seg_method='basic', feed_single=True, allow_all_zero=...
function ids2words (line 190) | def ids2words(text_ids, print_end=True):
function text2segtext (line 214) | def text2segtext(text, seg_method='basic', feed_single=True, allow_all_z...
function texts2segtexts (line 217) | def texts2segtexts(texts, seg_method='basic', feed_single=True, allow_al...
function segment (line 220) | def segment(text, seg_method='basic'):
function texts2ids (line 223) | def texts2ids(texts, seg_method='basic', feed_single=True, allow_all_zer...
function start_id (line 226) | def start_id():
function end_id (line 229) | def end_id():
function unk_id (line 232) | def unk_id():
function ids2words (line 237) | def ids2words(text_ids, print_end=True):
function ids2text (line 262) | def ids2text(text_ids, sep=' ', print_end=True):
function idslist2texts (line 265) | def idslist2texts(text_ids_list, sep=' ', print_end=True):
function translate (line 269) | def translate(text_ids):
function translates (line 272) | def translates(text_ids_list):
function start_id (line 275) | def start_id():
function end_id (line 278) | def end_id():
function unk_id (line 281) | def unk_id():
FILE: wenzheng/utils/vocabulary.py
function get_vocab (line 48) | def get_vocab():
function get_vocab_size (line 52) | def get_vocab_size():
function end_id (line 56) | def end_id():
function start_id (line 60) | def start_id():
function go_id (line 64) | def go_id():
function init (line 68) | def init(vocab_path_=None, append=None):