Is it possible to make a trainable variable not trainable?

After looking at the documentation and the code, I was not able to find a way to remove a Variable from the TRAINABLE_VARIABLES. Here is what happens: The first time tf.get_variable(‘weights’, trainable=True) is called, the variable is added to the list of TRAINABLE_VARIABLES. The second time you call tf.get_variable(‘weights’, trainable=False), you get the same variable … Read more

Is there an easy way to get something like Keras model.summary in Tensorflow?

Looks like you can use Slim Example: import numpy as np from tensorflow.python.layers import base import tensorflow as tf import tensorflow.contrib.slim as slim x = np.zeros((1,4,4,3)) x_tf = tf.convert_to_tensor(x, np.float32) z_tf = tf.layers.conv2d(x_tf, filters=32, kernel_size=(3,3)) def model_summary(): model_vars = tf.trainable_variables() slim.model_analyzer.analyze_vars(model_vars, print_info=True) model_summary() Output: ——— Variables: name (type shape) [size] ——— conv2d/kernel:0 (float32_ref 3x3x3x32) [864, … Read more

TensorFlow: questions regarding tf.argmax() and tf.equal()

tf.argmax(input, axis=None, name=None, dimension=None) Returns the index with the largest value across axis of a tensor. input is a Tensor and axis describes which axis of the input Tensor to reduce across. For vectors, use axis = 0. For your specific case let’s use two arrays and demonstrate this pred = np.array([[31, 23, 4, 24, … Read more

keras tensorboard: plot train and validation scalars in a same figure

To handle the validation logs with a separate writer, you can write a custom callback that wraps around the original TensorBoard methods. import os import tensorflow as tf from keras.callbacks import TensorBoard class TrainValTensorBoard(TensorBoard): def __init__(self, log_dir=”./logs”, **kwargs): # Make the original `TensorBoard` log to a subdirectory ‘training’ training_log_dir = os.path.join(log_dir, ‘training’) super(TrainValTensorBoard, self).__init__(training_log_dir, **kwargs) … Read more

What’s the purpose of keras.backend.function()

I have the following understanding of this function keras.backend.function. I will explain it with the help of a code snippet from this. The part of code snippet is as follows final_conv_layer = get_output_layer(model, “conv5_3”) get_output = K.function([model.layers[0].input], [final_conv_layer.output, model.layers[-1].output]) [conv_outputs, predictions] = get_output([img]) In this code, there is a model from which conv5_3 layer is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)