# Tag Info

## Hot answers tagged tensorflow

3

Looking at the training epochs, it seems to me you set a patience parameter that is too short. Please consider removing early stopping at all, for a model trained on 1500 observations only. Early stopping comes useful for particularly heavy models, but in this you shouldn't need it. I think the size of each mini-batch is very small. That would make gradient ...

2

You could always write two functions (one with the decorator and one without) and call whichever suits you... For example @tf.function() def graph_function() # This function will operate in graph mode ... def eager_function() # This function will operate in eager mode ... if tf.executing_eagerly() my_function = eager_function else: ...

2

Honestly there is no intuitive way to understand why NCE loss will work without deeply understanding its math. To understand the math, you should read the original paper. The reason why NCE loss will work is because NCE approximates maximum likelihood estimation (MLE) when the ratio of noise to real data $k$ increases. The TensorFlow implementation works ...

2

Your initial statements are correct. Epoch is one-single pass over the full training set. Most people use the word Batch as the number of samples used for one update of the weights. (The back-propagation process calculates the gradients for every single sample in the batch, but the weights update is performed a single time for the mean of the gradients ...

1

I tried the code you posted the following way: from keras import Model from keras.applications import VGG19 import keras.backend as K class Vgg19Loss: def __init__(self): pass @staticmethod def define_loss_model(high_resolution_shape): model_vgg19 = VGG19(False, 'imagenet', input_shape=high_resolution_shape) model_vgg19....

1

Technically, any Word2vec is based on an encoder-decoder Neural Network architecture with a hidden layer that learns the word embedding. In theory it is perfectly feasible to implement a "deeper" word2vec model in TensorFlow. You are going to find some practical problems, though. Word vectors are super long (for a small corpus, we are in the order to ...

1

Typically, neural nets are trained using the backpropagation algorithm. The algorithm searches for optimal weights by making small adjustments in the direction opposite the gradient. Computing the gradient requires a differentiable loss function, so you cannot train a network with backpropagation if your loss function is not differentiable. However, there ...

1

Here's another Keras code snippet similar to Mark.F's answer but with the split in the reverse direction (starting with an initial input and splitting into two output branches, each with their own softmax). from keras.layers import Dense, Input, Softmax, Concatenate, concatenate from keras.models import Model, Sequential import numpy as np input_layer = ...

1

Using the keras functional API will get you what you need. I'm assuming that you are currently using the standard keras sequential model API, which is simpler but also restricts you to a single pipeline. When using the functional API, you do need to keep track of inputs and outputs, instead of just defining layers. For the example in your question: from ...

1

You need to specify the seed in the initializer, e.g: from keras.initializers import RandomUniform seed = 0 model.add(Dense(64, kernel_initializer = RandomUniform(minval = -0.05, maxval = 0.05, seed = seed)))

1

TensorFlow allows for custom gradient functions with tf.custom_gradient. You could write a decorator that would return specific gradient values for specific values of x. The loss function would not need to be evaluated.

1

CUDNN and Tensorflow require a GPU which has a compute capacity of 3.0 at least: not only the CUDA version must take account of this CC, but also these both programs. Indeed: https://stackoverflow.com/questions/38542763/how-can-i-make-tensorflow-run-on-a-gpu-with-capability-2-0/38543201#38543201

1

Not sure if you figured this out, but I've been looking into it recently, and this is what I've found: Is the 'normal' LSTM assisted by GPU? is the normal LSTM supposed to be faster running on GPU or CPU? Like @pcko1 said, LSTM is assisted by GPU if you have tensorflow-gpu installed, but it does not necessarily run faster on a GPU. In my case, it ...

1

I stumbled across this problem in sublime text 3 after getting a file from a coworker. I solved the problem by reopening the file with a different encoding (from utf-8 to western (iso 8859-15)). Here's the code in utf-8: And here's the code in iso 8859-15: I deleted all these strange chars, and I used the save with encoding feature to save my file.

1

The reason it can save computation time is because your network would already be able to extract generic features from your dataset. The network will not have to learn extracting generic features from scratch. A neural network works by abstracting and transforming information in steps. In the initial layers, the features extracted are pretty generic, and ...

Only top voted, non community-wiki answers of a minimum length are eligible