Python utils.logSumExp() Examples
The following are 30
code examples of utils.logSumExp().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
utils
, or try the search function
.
Example #1
Source File: rebar.py From models with Apache License 2.0 | 5 votes |
def _create_network(self): logF = self._create_loss() self.optimizerLoss = tf.reduce_mean(self.optimizerLoss) # Setup optimizer grads_and_vars = self.optimizer_class.compute_gradients(self.optimizerLoss) self._create_train_op(grads_and_vars) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #2
Source File: rebar.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _create_network(self): logF = self._create_loss() self.optimizerLoss = tf.reduce_mean(self.optimizerLoss) # Setup optimizer grads_and_vars = self.optimizer_class.compute_gradients(self.optimizerLoss) self._create_train_op(grads_and_vars) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #3
Source File: rebar.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #4
Source File: rebar.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #5
Source File: rebar.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #6
Source File: rebar.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective = self._create_loss() # Create additional updates for control variates and temperature eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV'))) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #7
Source File: rebar.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective, variance_objective_grad = self._create_loss() eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV')) + [(variance_objective_grad, self.pre_temperature_variable)]) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #8
Source File: rebar.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_network(self): logF = self._create_loss() self.optimizerLoss = tf.reduce_mean(self.optimizerLoss) # Setup optimizer grads_and_vars = self.optimizer_class.compute_gradients(self.optimizerLoss) self._create_train_op(grads_and_vars) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #9
Source File: rebar.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #10
Source File: rebar.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #11
Source File: rebar.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #12
Source File: rebar.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective = self._create_loss() # Create additional updates for control variates and temperature eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV'))) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #13
Source File: rebar.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective, variance_objective_grad = self._create_loss() eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV')) + [(variance_objective_grad, self.pre_temperature_variable)]) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #14
Source File: rebar.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective, variance_objective_grad = self._create_loss() eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV')) + [(variance_objective_grad, self.pre_temperature_variable)]) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #15
Source File: rebar.py From models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #16
Source File: rebar.py From models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #17
Source File: rebar.py From models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #18
Source File: rebar.py From models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective = self._create_loss() # Create additional updates for control variates and temperature eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV'))) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #19
Source File: rebar.py From models with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective, variance_objective_grad = self._create_loss() eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV')) + [(variance_objective_grad, self.pre_temperature_variable)]) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #20
Source File: rebar.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_network(self): logF = self._create_loss() self.optimizerLoss = tf.reduce_mean(self.optimizerLoss) # Setup optimizer grads_and_vars = self.optimizer_class.compute_gradients(self.optimizerLoss) self._create_train_op(grads_and_vars) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #21
Source File: rebar.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #22
Source File: rebar.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #23
Source File: rebar.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #24
Source File: rebar.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective = self._create_loss() # Create additional updates for control variates and temperature eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV'))) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #25
Source File: rebar.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective, variance_objective_grad = self._create_loss() eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV')) + [(variance_objective_grad, self.pre_temperature_variable)]) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #26
Source File: unit.py From NeuralFactorGraph with MIT License | 5 votes |
def assertEqualMarginals(self, graph, all_sequences, sent_likelihood): """ Check factor/variable marginals are approximately equal to marginals obtained from brute force inference """ # Check variable marginals threshold = 0.01 eq = True denom = -float('inf') maxDiff = -float('inf') for s, sequence in enumerate(all_sequences): denom = utils.logSumExp(sent_likelihood[s], denom) # Iterate over all timesteps for t in range(graph.T): for tag in self.model.uniqueTags: tagBeliefs = graph.getVarByTimestepnTag(t, tag.idx).belief.cpu().data.numpy() for labelIdx in range(tag.size()): num = -float('inf') for s, sequence in enumerate(all_sequences): if sequence[t][tag.idx]==labelIdx: num = utils.logSumExp(sent_likelihood[s], num) # Check difference # maxDiff = max(maxDiff, np.max(np.abs(tagBeliefs[labelIdx]- np.exp(num-denom)))) tagLogProb = np.exp(num-denom) maxDiff = max(maxDiff, np.max(np.abs(np.exp(tagBeliefs[labelIdx]) - tagLogProb))) if maxDiff > threshold: eq = False if not eq: print("Marginals not equal. Max difference of %f" %maxDiff) else: print("Passed unit test!") sys.exit(0)
Example #27
Source File: rebar.py From yolo_v2 with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #28
Source File: rebar.py From yolo_v2 with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #29
Source File: rebar.py From yolo_v2 with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads = self._create_loss() self._create_train_op(loss_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))
Example #30
Source File: rebar.py From yolo_v2 with Apache License 2.0 | 5 votes |
def _create_network(self): logF, loss_grads, variance_objective = self._create_loss() # Create additional updates for control variates and temperature eta_grads = (self.optimizer_class.compute_gradients(variance_objective, var_list=tf.get_collection('CV'))) self._create_train_op(loss_grads, eta_grads) # Create IWAE lower bound for evaluation self.logF = self._reshape(logF) self.iwae = tf.reduce_mean(U.logSumExp(self.logF, axis=1) - tf.log(tf.to_float(self.n_samples)))