Dataset Viewer
Auto-converted to Parquet Duplicate
seed
stringlengths
25
1.88k
seed_api
stringlengths
14
102
index
int64
0
1.05k
import tensorflow as tf def resnet_block(x, block_name='ResBlock', channel_nr=64, scale = 1, pad='SAME'): tmp = conv3d(x, kernel_size=3, filters=channel_nr, padding=pad, activation=None, use_bias=False, initialization=None) tmp = tf.keras.layers.LeakyReLU(alpha=0.2)(tmp) tmp = conv3d(tmp, kernel_siz...
tensorflow.keras.layers.LeakyReLU
0
import tensorflow as tf image = self._do_cutout(image, w, h, cutout_size) return (image, clazz) (images, classes) = _prepare(images, classes) dataset = tf.data.Dataset.from_tensor_slices((images, classes)).repeat() if is_train: dataset = dataset.apply(t...
tensorflow.data.experimental.map_and_batch
1
import tensorflow as tf eval_spec = tf.estimator.EvalSpec(read_dataset('valid.csv', tf.estimator.ModeKeys.EVAL, 512), steps = None, exporters = export...
tensorflow.estimator.train_and_evaluate
2
from tensorflow.python import debug as tf_debug hooks = [] if FLAGS.use_hvd: hooks.append(hvd.BroadcastGlobalVariablesHook(0)) if hvd.rank() == -1: #if debug, set 0 CLIDebugHook = tf_debug.LocalCLIDebugHook(ui_type='readline') CLIDebugHook.add_tensor_filter("has_inf_or_nan", tf_debug.has_inf_...
tensorflow.python.debug.LocalCLIDebugHook
3
from tensorflow.python.ops import image_ops from tensorflow.python.client import session from tensorflow.python.framework import dtypes from tensorflow.python.ops import array_ops from tensorflow.python.ops import image_ops from tensorflow.python.ops import io_ops from tensorflow.python.ops import parsing_ops from ten...
tensorflow.python.ops.image_ops.resize_bilinear
4
from tensorflow.keras.layers import Dense, Conv2D, MaxPool2D, Flatten # Block 1 conv1a = Conv2D(padding="same", filters=RNN_SIZE//8, kernel_size=[8, 8], strides=4, data_format='channels_last', kernel_initializer=w_init,activation=tf.nn.relu)(self.inputs) conv1b = Conv2D(padding="same", filters=RNN_SIZE//...
tensorflow.keras.layers.Conv2D
5
import tensorflow as tf if reduce_fn is None: scalar = args[i][0] else: scalar = reduce_fn(args[i]) with tf.contrib.summary.record_summaries_every_n_global_steps( 100, global_step=step): tf.contrib.summary.scalar(prefix + name, scalar, ste...
tensorflow.contrib.summary.record_summaries_every_n_global_steps
6
import tensorflow as tf indices = tf.stack((batch_nums, step_nums, passage_word_idx), axis=2) # shape (batch_size, passage_length, 3) indices = tf.reshape(indices, [-1, 3]) #[batch_size * passage_length, 3] indices = tf.cast(indices, tf.int64) shape = [batch_size, passa...
tensorflow.sparse_reduce_sum
7
import tensorflow as tf self.qnode = qnode dtype = tf.float32 if tf.keras.backend.floatx() == tf.float32 else tf.float64
tensorflow.keras.backend.floatx
8
from tensorflow.contrib.learn.python.learn.graph_actions import train self._check_inputs(features, targets) train_op, loss_op = self._get_train_ops(features, targets) return train( graph=g,
tensorflow.contrib.learn.python.learn.graph_actions.train
9
import tensorflow as tf encoder_state = tuple(encoder_state[-1] for _ in range(num_layers)) decoder_cell = attention(encoder_out, seq_lens) dense_layer = tf.layers.Dense(n_mels * resampled)
tensorflow.layers.Dense
10
from tensorflow.python.ops import check_ops raise ValueError("%s.ndims=%d is not 0 (scalar)" % (x.name, x.get_shape().ndims)) if x_value_static < 0: raise ValueError("%s.value=%d cannot be negative" % (x.name, x_value_static)) return x i...
tensorflow.python.ops.check_ops.assert_rank
11
import tensorflow as tf [layer_input[0]['observation'], layer_input[1]], axis=1) return tf.keras.layers.Lambda(f)
tensorflow.keras.layers.Lambda
12
from tensorflow.contrib import losses with ops.control_dependencies([check_shape_op]): target = array_ops.reshape( target, shape=[array_ops.shape(target)[0], 1]) return losses.hinge_loss(logits, target) super(_BinarySvmTargetColumn, self).__init__(
tensorflow.contrib.losses.hinge_loss
13
import tensorflow as tf A tuple of possible batch sizes """ for device in device_lib.list_local_devices(): if tf.DeviceSpec.from_string(device.name).device_type == "GPU": if "K20" in device.physical_device_desc: return (16,) if "P100" in device.physical_device_desc: ...
tensorflow.DeviceSpec.from_string
14
import tensorflow as tf # In this example, we limit mnist data Xtr, Ytr = mnist.train.next_batch(5000) #5000 for training (nn candidates) Xte, Yte = mnist.test.next_batch(200) #200 for testing # tf Graph Input xtr = tf.placeholder("float", [None, 784]) xte = tf.placeholder("float", [784]) # Nearest Neighbor calcu...
tensorflow.negative
15
import tensorflow as tf if extra_inputs is None: extra_inputs = tuple() last_loss = f_loss(*(tuple(inputs) + extra_inputs)) start_time = time.time() dataset = BatchDataset(inputs, self._batch_size, ext...
tensorflow.compat.v1.get_default_session
16
from tensorflow.python.ops import variables yield def _setupDense(self, is_distributed, dtype): with self._maybeWithDevice("/job:ps" if is_distributed else None): var0 = variables.Variable([[0.0, 1.0], [2.0, 3.0]], dtype=dtype) var1 = variables.Variable([4.0, 5.0], dtype=dtype) with self._...
tensorflow.python.ops.variables.Variable
17
import tensorflow as tf """Checks that `perm` is valid.""" with tf.name_scope(name, 'maybe_validate_perm', [perm]): assertions = [] if not perm.dtype.is_integer: raise TypeError('`perm` must be integer type') msg = '`perm` must be a vector.' if perm.shape.ndims is not None: if perm.sha...
tensorflow.get_static_value
18
import tensorflow as tf assert len(all_vars) == len(all_perturbed_vars) perturb_ops = [] for var, perturbed_var in zip(all_vars, all_perturbed_vars): if param_noise_filter_func(perturbed_var): # Perturb this variable. operation = tf.assign(perturbed_v...
tensorflow.group
19
from tensorflow.python.ops import array_ops array_ops.size(tensor.shape) + dim, [1]) else: expand_dims = [dim] expanded_shape = array_ops.concat( 0, (array_ops.slice(tensor.shape, [0], expand_dims), [1], array_ops.slice(tensor.shape, expand_dims, [-1])), ...
tensorflow.python.ops.array_ops.slice
20
import tensorflow as tf def load_agent_ckpt(ckpt_dir, tf_agent, global_step=None): if global_step is None: global_step = tf.compat.v1.train.get_or_create_global_step() train_checkpointer = common.Checkpointer( ckpt_dir=ckpt_dir, agent=tf_agent, global_step=global_step) train_checkpointer.initialize_o...
tensorflow.compat.v1.train.get_or_create_global_step
21
from tensorflow.contrib.layers.python.layers.layers import _build_variable_getter, _add_variable_to_collections conv_dims: Optional convolution dimensionality, when set it would use the corresponding convolution (e.g. 2 for Conv 2D, 3 for Conv 3D, ..). When leaved to None it would select the convolutio...
tensorflow.contrib.layers.python.layers.layers._build_variable_getter
22
import tensorflow as tf with tf.device("/device:CPU:0"): ds = tf.data.Dataset.from_tensors(tensors).repeat() return tfe.Iterator(ds) self._benchmark_eager_train( "eager_train_dataset_with_defun", make_iterator, device_and_data_format(), defun=True) ...
tensorflow.enable_eager_execution
23
import tensorflow as tf "MSE": mse, "eval_loss": loss,} elif task_name == "cola": def metric_fn(per_example_loss, label_ids, logits, is_real_example): """Compute Matthew's correlations for STS-B.""" predictions = tf.argmax(logits, axis=-1, output_type=tf.int32) ...
tensorflow.metrics.true_negatives
24
import tensorflow as tf except AttributeError: deconv = tf.nn.deconv2d(input_, w, output_shape=output_shape,
tensorflow.nn.deconv2d
25
from tensorflow.contrib.eager.python.examples.revnet import blocks_test self.assertEqual(len(g2_all.shape), 1) degree = blocks_test.compute_degree(g1_all, g2_all) self.assertLessEqual(degree, 1e0)
tensorflow.contrib.eager.python.examples.revnet.blocks_test.compute_degree
26
import tensorflow as tf # loss and optimizer self.loss = tf.reduce_mean(tf.square(tf.subtract(self.value_estimate, self.target))) self.optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate)
tensorflow.subtract
27
import tensorflow as tf feed_previous=tf.constant(True)) sess.run([tf.global_variables_initializer()]) tf.get_variable_scope().reuse_variables() d1, _ = tf.nn.seq2seq.embedding_attention_seq2seq( enc_inp, dec_inp, cell, num_encoder_symbols=2, num_decoder_sy...
tensorflow.nn.seq2seq.embedding_attention_seq2seq
28
import tensorflow as tf dep_idxs = tf.tile(tf.expand_dims(dep_org_idx, 1), [1, sl_head, 1]) head_idxs = tf.tile(tf.expand_dims(head_org_idx, 2), [1, 1, sl_dep]) if direction is None: direct_mask = tf.not_equal(head_idxs, dep_idxs) # [bs, slh, sld] else: if direction == 'forward': ...
tensorflow.less
29
from tensorflow.python.ops import math_ops tf_index = math_ops.argmin(math_ops.abs(specificities - specificity), 0) tf_index = math_ops.cast(tf_index, dtypes.int32) # Now, we have the implicit threshold, so compute the sensitivity: return math_ops.div(tp[tf_index], tp...
tensorflow.python.ops.math_ops.div
30
import tensorflow as tf self.validateMoments([10**5], -5.0, 1.0, 2.0, np.infty) def testSmallStddev(self): self.validateKolmogorovSmirnov([10**5], 0.0, 0.1, 0.05, 0.10) class ParameterizedTruncatedNormalGpuTest(ParameterizedTruncatedNormalTest): _use_gpu = True # Benchmarking code def parameterized_vs...
tensorflow.OptimizerOptions
31
from tensorflow.contrib.learn.python.learn.graph_actions import evaluate global_step = contrib_framework.create_global_step(g) features, targets = input_fn() self._check_inputs(features, targets) eval_dict = self._get_eval_ops(features, targets, metrics or s...
tensorflow.contrib.learn.python.learn.graph_actions.evaluate
32
from tensorflow.contrib.learn.python.learn import ops from tensorflow.python.platform import test class OpsTest(test.TestCase): """Ops tests.""" def test_softmax_classifier(self): with self.cached_session() as session: features = array_ops.placeholder(dtypes.float32, [None, 3]) labels = array_op...
tensorflow.contrib.learn.python.learn.ops.softmax_classifier
33
import tensorflow as tf hparams, tf.estimator.ModeKeys.TRAIN ) try: num_target_frames = hparams.video_num_target_frames except AttributeError: num_target_frames = 1 target_value_shape_suffix = [num_target_frames] if distributional_size > 1: target_value_shape_suffix = [num_target_frames, di...
tensorflow.zeros
34
from tensorflow.python.framework import ops auc = compute_auc(tp, fn, tn, fp, 'value') update_op = compute_auc( tp_update_op, fn_update_op, tn_update_op, fp_update_op, 'update_op') if metrics_collections: ops.add_to_collections(metrics_collections, auc) if updates_collections: ops...
tensorflow.python.framework.ops.add_to_collections
35
from tensorflow.python.ops import logging_ops as logging def after_create_session(self, session, _): assert self._init_op.graph == ops.get_default_graph() assert self._is_initialized_op.graph == self._init_op.graph while True: try: if session.run(self._is_initialized_op): break ...
tensorflow.python.ops.logging_ops.info
36
import tensorflow as tf for i in range(0, config.num_clones): with tf.name_scope(config.clone_scope(i)) as clone_scope: clone_device = config.clone_device(i) with tf.device(clone_device): with tf.variable_scope(tf.get_variable_scope(), ...
tensorflow.get_variable_scope
37
from tensorflow.python.ops import array_ops # Use static shape if known. num_predictions = predictions_2d.get_shape().as_list()[0] # Otherwise use dynamic shape. if num_predictions is None: num_predictions = array_ops.shape(predictions_2d)[0] thresh_tiled = array_ops.tile( array_ops.expand_dims(a...
tensorflow.python.ops.array_ops.constant
38
import tensorflow as tf def validation_mapper(byte): image = tf.image.decode_jpeg( tf.reshape(byte, shape=[]), 3, **JPEG_OPT) image = resize_shortest_edge(image, tf.shape(image), 256) image = center_crop(image, 224) image = tf.reverse(image, axis=[2]) # to BGR ...
tensorflow.reverse
39
from tensorflow.contrib.eager.python import tfe """Trains model on train_data using optimizer.""" tf.train.get_or_create_global_step() def model_loss(labels, chars, sequence_length): predictions = model((chars, sequence_length), training=True) loss_value = loss(labels, predictions) tf.contrib.summa...
tensorflow.contrib.eager.python.tfe.Iterator
40
from tensorflow.core.util.event_pb2 import SessionLog logging.info("Saving checkpoints for %d into %s.", step, self._save_path) self._last_saved_time = time.time() self._last_saved_step = step if self._saver is None: self._scaffold.saver.save(session, self._save_path, global_step=step) else: ...
tensorflow.core.util.event_pb2.SessionLog
41
from tensorflow.contrib.slim.python.slim.data import tfexample_decoder shape=[1], dtype=dtypes.int64, default_value=array_ops.zeros( [1], dtype=dtypes.int64)) } items_to_handlers = { 'image': tfexample_decoder.Image(), 'label': tfexample_deco...
tensorflow.contrib.slim.python.slim.data.tfexample_decoder.Image
42
import tensorflow as tf Returns: a tensor with shape [N, M] representing pairwise iou scores. """ intersections = pairwise_intersection(boxlist1, boxlist2) areas1 = area(boxlist1) areas2 = area(boxlist2) unions = ( tf.expand_dims(areas1, 1) + tf.expand_dims(areas2, 0) - intersecti...
tensorflow.expand_dims
43
from tensorflow.python.ops import math_ops def compute_recall(true_positives, false_negatives, name): return math_ops.select( math_ops.greater(true_positives + false_negatives, 0), math_ops.div(true_positives, true_positives + false_negatives),
tensorflow.python.ops.math_ops.greater
44
import tensorflow as tf counts.update(_split_string(line)) alphabet = [k for (k, _) in counts.most_common(max_size)] alphabet.sort() return np.asarray(alphabet, dtype=np.object) chars, = tf.py_func(_unique_chars, [filename], [tf.string]) char_to_id = tf.contrib.lookup.i...
tensorflow.contrib.lookup.index_table_from_tensor
45
import tensorflow as tf soft_placement = True util.auto_parallel(metagraph, m) with tf.Graph().as_default(): tf.train.import_meta_graph(metagraph) for model in models.values(): model.import_ops() sv = tf.train.Supervisor(logdir=FLAGS.save_path) config_proto = tf.ConfigProto(allow_s...
tensorflow.train.Supervisor
46
import tensorflow as tf sync_lp_time = stop - start print(f"Got {len(sync_lp_observations)} observations in {sync_lp_time:.2f}s") # %% [markdown] # ## Comparison # To compare outcomes of sync and async runs, let's plot their respective regrets side by side, and print out the running time. For this toy problem we exp...
tensorflow.argmin
47
import tensorflow as tf hparams = imagetransformer_latent_tiny() hparams.mode = tf.estimator.ModeKeys.TRAIN block_dim = int(hparams.hidden_size // hparams.num_blocks) block_v_size = 2**(hparams.bottleneck_bits / (hparams.num_residuals * hparams.num_blocks)) block_v_size = int...
tensorflow.uniform_unit_scaling_initializer
48
from tensorflow.python.ops import math_ops tuple. """ predictions, labels = tensor_util.remove_squeezable_dimensions( predictions, labels) predictions.get_shape().assert_is_compatible_with(labels.get_shape()) radial_diffs = math_ops.mul(predictions, labels) radial_diffs = math_ops.reduce_sum(radi...
tensorflow.python.ops.math_ops.sub
49
from tensorflow.contrib.rnn.python.ops import lstm_ops (config_name, self._GetConfigDesc(config))) def benchmarkTfRNNLSTMBlockCellTraining(self): test_configs = self._GetTestConfig() for config_name, config in test_configs.items(): num_layers = config["num_layers"] num_...
tensorflow.contrib.rnn.python.ops.lstm_ops.LSTMBlockCell
50
from tensorflow.python.training import checkpoint_utils # decrease with training. summary_file = glob.glob(os.path.join(config.logdir, "events.out.*"))[0] events = summary_test_util.events_from_file(summary_file) train_losses = [event.summary.value[0].simple_value for event in events ...
tensorflow.python.training.checkpoint_utils.list_variables
51
import tensorflow as tf logits = tf.log([1.0 - self._relabel_prob, self._relabel_prob]) mask = tf.squeeze( tf.random.categorical( logits[None], num_samples=self._sample_batch_size))
tensorflow.random.categorical
52
import tensorflow.contrib.eager as tfe dataset = random_dataset() if defun: model.call = tfe.defun(model.call) with tf.device(device()):
tensorflow.contrib.eager.defun
53
from tensorflow.python.ops import gen_nn_ops name: A name for the operation (optional). Returns: A 1-D `Tensor` of length `batch_size` of the same type as `logits` with the softmax cross entropy loss. """ # The second output tensor contains the gradients. We use it in # _CrossEntropyGrad() in nn_...
tensorflow.python.ops.gen_nn_ops._softmax_cross_entropy_with_logits
54
from tensorflow.contrib.learn.python.learn.estimators import head as head_lib config=config, params={ "head": head_lib._regression_head( # pylint: disable=protected-access label_dimension=label_dimension, weight_column_name=weight_col...
tensorflow.contrib.learn.python.learn.estimators.head._regression_head
55
import tensorflow as tf input_shape = [batch_size, image_size, image_size, input_nchan] images = tf.truncated_normal( input_shape, dtype=input_data_type, stddev=1e-1, name='synthetic_images') labels = tf.random_uniform( [batch_size], minval=1, maxval=...
tensorflow.contrib.framework.local_variable
56
import tensorflow as tf else: graph_def.ParseFromString(f.read()) with graph.as_default(): tf.import_graph_def(graph_def, name='') tf.io.write_graph(graph_def, '/tmp/', 'optimized_graph.pb',as_text=False) return graph
tensorflow.io.write_graph
57
from tensorflow.python.ops import gen_math_ops \\\\(y = |x|\\\\). See [`tf.complex_abs()`](#tf_complex_abs) to compute the absolute value of a complex number. Args: x: A `Tensor` of type `float`, `double`, `int32`, or `int64`. name: A name for the operation (optional). Returns: A `Tensor` the...
tensorflow.python.ops.gen_math_ops.complex_abs
58
from tensorflow.python.framework import ops if not inputs or not isinstance(inputs, (list, tuple)): raise ValueError("inputs must be a list of at least one Tensor with the " "same dtype and shape") inputs = ops.convert_n_to_tensor_or_indexed_slices(inputs) if not all(isinstance...
tensorflow.python.framework.ops.convert_n_to_tensor_or_indexed_slices
59
import tensorflow as tf import numpy as np import tvm from tvm import relay from tvm.contrib import graph_runtime from tvm.relay.testing.config import ctx_list import keras import tensorflow as tf from tensorflow import keras as tf_keras # prevent Keras from using up all gpu memory if tf.executing_eagerly(): gpus...
tensorflow.config.list_physical_devices
60
import tensorflow as tf rl_advantage = rl_reward - rl_baseline rl_empirical_loss = -tf.stop_gradient(rl_advantage) * log_prob rl_entropy_loss = -rl_entropy_regularization * rl_entropy enable_rl_optimizer = tf.cast( tf.greater_equal(target_global_step, FLAGS.first_pretrain_steps), tf.float32) rl...
tensorflow.train.piecewise_constant
61
import tensorflow as tf tf.add_to_collection(self._initial_state_name, state_tuple.c) tf.add_to_collection(self._initial_state_name, state_tuple.h) for state_tuple in self._final_state: tf.add_to_collection(self._final_state_name, state_tuple.c) tf.add_to_collect...
tensorflow.contrib.rnn.LSTMStateTuple
62
import tensorflow as tf # optimizer & gradients optimizer_base = tf.train.MomentumOptimizer(lrn_rate, FLAGS.momentum) if not FLAGS.enbl_multi_gpu: optimizer = optimizer_base else: optimizer = mgw.DistributedOptimizer(optimizer_base) grads_origin = optimizer....
tensorflow.summary.merge_all
63
import tensorflow as tf self.Z = tf.placeholder(tf.float32, (None, None, fourier_window_size // 2 + 1)) batch_size = tf.shape(self.X)[0] seq_lens = tf.count_nonzero(tf.reduce_sum(self.decoder_inputs, -1), 1, dtype=tf.int32) + 1 def cells(reuse=False): return tf.contrib.rnn...
tensorflow.contrib.seq2seq.LuongAttention
64
import tensorflow as tf # train the model using Adam def train(self, sess, generator, learning_rate=.001, training_iters=50000, batch_size=64, display_step=10,weight_save_step=100, save_weights_path= None, generator_function= None, training_weights_path = None): ...
tensorflow.clip_by_norm
65
from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined gradient_multipliers=( dnn_linear_combined._extract_embedding_lr_multipliers( # pylint: disable=protected-access
tensorflow.contrib.learn.python.learn.estimators.dnn_linear_combined._extract_embedding_lr_multipliers
66
import tensorflow as tf # strides = np.asarray(self.pool_strides) # strides[1:] *= len(self.ff_conv_k) # kernels = np.asarray(self.pooling_kernel) # kernels[1:] *= len(self.ff_conv_k) # return tf.layers.conv3d_transpose( # inputs=x, ...
tensorflow.nn.conv3d_transpose
67
import tensorflow as tf env_floor=0) for i in range(N_WORKER)] # 觀察者 # workers.append(Worker(envpath='./ObstacleTower/obstacletower.exe', # wid=N_WORKER + 1, # retro=False, # realtime_mode=True, # ...
tensorflow.train.Coordinator
68
import tensorflow as tf total_loss, learning_rate, num_train_steps, num_warmup_steps, use_tpu, optimizer) output_spec = contrib_tpu.TPUEstimatorSpec( mode=mode, loss=total_loss, train_op=train_op, scaffold_fn=scaffold_fn) elif mode == tf.estimator....
tensorflow.metrics.mean
69
import tensorflow as tf shape = control_flow_ops.with_dependencies([rank_assertions[i]], tf.shape(image))
tensorflow.shape
70
import tensorflow as tf def clip_logits(logits, config): logits_clip = getattr(config, "logits_clip", 0.) if logits_clip > 0: min_logit = tf.reduce_min(logits) return tf.minimum(logits - min_logit, logits_clip) else:
tensorflow.reduce_min
71
import tensorflow as tf loss = tf.maximum(0.0, (tgt_larg - tgt_small) - (pred_larg - pred_small)) loss = tf.reduce_mean(loss) return loss def contra_step_lossV3(pred, tgt, margin=1.0): # Step-wise contrastive loss pred1, pred2 = tf.split(pred, 2, axis=0) tgt1, tgt2 = tf.split(tgt, 2, axis=0...
tensorflow.where
72
from tensorflow.python.training import training_ops def __init__(self, learning_rate, use_locking=False, name="GradientDescent"): """Construct a new gradient descent optimizer. Args: learning_rate: A Tensor or a floating point value. The learning rate to use. use_locking: If True use lo...
tensorflow.python.training.training_ops.apply_gradient_descent
73
from tensorflow.python.client import device_lib def main(_): if not FLAGS.data_path: raise ValueError("Must set --data_path to PTB data directory") gpus = [ x.name for x in device_lib.list_local_devices() if x.device_type == "GPU" ] if FLAGS.num_gpus > len(gpus): raise ValueError( "Your...
tensorflow.python.client.device_lib.list_local_devices
74
import tensorflow as tf try: if not tf.io.gfile.exists(a.crop_dir): tf.io.gfile.makedirs(a.crop_dir) except Exception as e:
tensorflow.io.gfile.makedirs
75
import tensorflow as tf # execute at test time return tf.nn.batch_normalization(x, pop_mean, pop_var, beta, gamma, epsilon) return tf.cond(train, func1, func2) def average_gradients(tower_grads):
tensorflow.cond
76
from tensorflow.python.ops import nn_ops w_c: [1,1, attention_vec_size] coverage: [batch_size, passage_len] ''' with variable_scope.variable_scope("Attention"): # Equation (11) in the paper state_features = linear(decoder_state, attention_vec_size, True) # [batch...
tensorflow.python.ops.nn_ops.softmax
77
from tensorflow.python.ops import math_ops def _log_prob(self, x): x = control_flow_ops.with_dependencies([check_ops.assert_positive(x)] if self.validate_args else [], x) return (self.alpha * math_ops.log(self.beta) - math_ops.lgamma(self.alpha) - ...
tensorflow.python.ops.math_ops.log
78
import tensorflow as tf 'fast_rcnn_box_loss', tf.reduce_mean(fast_rcnn_box_loss), step=global_step) if params['include_mask']: tf.contrib.summary.scalar( 'mask_loss', tf.reduce_mean(mask_loss), step=global_step) tf.contrib.summary....
tensorflow.contrib.summary.all_summary_ops
79
from tensorflow.python.framework import tensor_util if input_shape.ndims is None: return [tensor_shape.unknown_shape()] elif input_shape.ndims <= 1: return [tensor_shape.scalar()] dimension = tensor_util.ConstantValue(op.inputs[1]) if dimension is None: return [tensor_shape.unknown_shape(ndims=inp...
tensorflow.python.framework.tensor_util.ConstantValue
80
import tensorflow as tf out = tf.matmul(l1, self.w2)+self.b2 return out def test_inference(self,images): images=tf.cast(images,tf.float32)/255.0 l1 = tf.matmul(images, self.w1)+self.b1 l1=tf.nn.relu(l1) out = tf.matmul(l1, self.w2)+self.b2
tensorflow.cast
81
import tensorflow as tf cols[3] / height, cols[2] / width], axis=1) # add batch dimension (assume batch_size==1) #assert image.get_shape()[0] == 1 boxes = tf.expand_dims(boxes, dim=0) image = tf.image.draw_bounding_boxes(image, boxes) ...
tensorflow.nn.zero_fraction
82
import tensorflow as tf hparams["type"] = "natural_exp_decay" hparams["kwargs"] = { "decay_steps": 1, "decay_rate": 0.5 } ned_lr_decay_fn = opt.get_learning_rate_decay_fn(hparams) ned_lr = ned_lr_decay_fn(learning_rate=1., global_step=global_step) ...
tensorflow.train.natural_exp_decay
83
from tensorflow.python.training import summary_io # TODO(mdan): This line looks redundant. if self._summary_writer is None: self._summary_writer = summary_io.SummaryWriter(estimator.model_dir)
tensorflow.python.training.summary_io.SummaryWriter
84
import tensorflow as tf centroids_mask = None centroids, lookup = get_unique(weights) num_centroids = tf.size(centroids) if self.preserve_sparsity: sparsity_mask = tf.math.divide_no_nan(weights, weights) zero_idx = tf.argmin(tf.abs(centroids), axis=-1) centroids_mask = 1.0 - tf.one_h...
tensorflow.math.divide_no_nan
85
from tensorflow.python.ops import array_ops array_ops.expand_dims(array_ops.constant(thresholds), [1]), array_ops.pack([1, num_predictions])) # Tile the predictions after thresholding them across different thresholds. pred_is_pos = math_ops.greater( array_ops.tile(array_ops.transpose(predictions...
tensorflow.python.ops.array_ops.tile
86
import tensorflow as tf def _create_model(self, train_triples): # Count unique items to determine embedding matrix sizes entity_cnt = len(set(train_triples[:,0]).union(train_triples[:,2])) rel_cnt = len(set(train_triples[:,1])) init_sd = 1.0 / np.sqrt(self.embedding_size) ...
tensorflow.truncated_normal
87
from tensorflow.contrib.eager.python.examples.spinn import data logdir=os.path.join(self._temp_data_dir, "logdir"), inference_sentences=("( foo ( bar . ) )", None)) with self.assertRaises(ValueError): spinn.train_or_infer_spinn(embed, word2index, None, None, None, config) def testTrainSpin...
tensorflow.contrib.eager.python.examples.spinn.data.load_word_vectors
88
import tensorflow as tf name='logits_rl_w', initializer=tf.initializers.zeros(),
tensorflow.initializers.zeros
89
from tensorflow.contrib.framework import deprecated def _at_k_name(name, k=None, class_id=None): if k is not None: name = '%s_at_%d' % (name, k) else: name = '%s_at_k' % (name) if class_id is not None: name = '%s_class%d' % (name, class_id) return name @deprecated('2016-11-08', 'Please use `stre...
tensorflow.contrib.framework.deprecated
90
import tensorflow as tf tf.logging.info("removing {}".format(src_ckpt)) tf.gfile.Remove(src_ckpt)
tensorflow.gfile.Remove
91
from tensorflow.python.platform import tf_logging as logging def every_n_step_begin(self, step): super(NanLoss, self).every_n_step_begin(step) return [self._loss_tensor] def every_n_step_end(self, step, outputs): super(NanLoss, self).every_n_step_end(step, outputs) if np.isnan(_extract_output(out...
tensorflow.python.platform.tf_logging.error
92
import tensorflow as tf save_dir = self._TestDir("abs_paths") abs_path = os.path.join(save_dir, "model-0") ckpt = tf.train.generate_checkpoint_state_proto(save_dir, abs_path) self.assertEqual(ckpt.model_checkpoint_path, abs_path) self.assertTrue(os.path.isabs(ckpt.model_checkpoint_path)) self.a...
tensorflow.train.generate_checkpoint_state_proto
93
import tensorflow as tf self.mu = self.mu * action_bound[1]; self.sigma = self.sigma + 1e-4 # get action from distribution self.normal_dist = tf.contrib.distributions.Normal(self.mu, self.sigma) self.action = tf.squeeze(self.normal_dist.sample(1),axis=0); ...
tensorflow.train.AdamOptimizer
94
import tensorflow as tf self.assertTrue(os.path.isabs(ckpt.model_checkpoint_path)) self.assertEqual( len(ckpt.all_model_checkpoint_paths), len(paths) if paths else 1) self.assertEqual(ckpt.all_model_checkpoint_paths[-1], abs_path) def testUpdateCheckpointState(self): save_dir = self....
tensorflow.train.update_checkpoint_state
95
import tensorflow as tf self._train_op = optimizer.apply_gradients( zip(grads, tvars), global_step=tf.contrib.framework.get_or_create_global_step())
tensorflow.contrib.framework.get_or_create_global_step
96
import tensorflow as tf Returns ------- A tensor. """ if axis < 0: dims = get_ndim(tensors[0]) if dims: axis = axis % dims else: axis = 0 try: return tf.concat_v2([x for x in tensors], axis) except AttributeError: return tf.concat(axis=axis, values=[x for x in tensors]) ...
tensorflow.concat_v2
97
from tensorflow.contrib.layers.python.layers import utils def build_no_ops(): return (tf.no_op(), tf.no_op()) # Only make the ops if we know that `is_training=True`, or the value of # `is_training` is unknown. is_training_const = utils.constant_value(is_training) if is_training_const is Non...
tensorflow.contrib.layers.python.layers.utils.constant_value
98
from tensorflow.python.framework import ops default_name = _at_k_name('false_negative', k, class_id=class_id) with ops.name_scope(name, default_name, (predictions_idx, labels)) as scope:
tensorflow.python.framework.ops.name_scope
99
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
3