Questions tagged [tensorflow-layers]
14 questions
6
votes
2 answers
How to use tf.contrib.model_pruning on MNIST?
I'm struggling to use Tensorflow's pruning library and haven't found many helpful examples so I'm looking for help to prune a simple model trained on the MNIST dataset. If anyone can either help fix my attempt or provide an example of how to use…

Eric Page
- 131
- 10
3
votes
2 answers
Keras custom layer not returning weights, unlike normal layer
I am trying to get weights of the layer. It seems to work properly when keras layer is used and the input is connected to it.
However, while wrapping it into my custom layer, that does not work anymore. Is that a bug or what am I missing?
Edit:…

beginh
- 1,133
- 3
- 26
- 36
3
votes
3 answers
How to use TensorBoard and summary operations with the tf.layers module
I have followed the TensorFlow Layers tutorial to create a CNN for MNIST digit classification using TensorFlow's tf.layers module. Now I'm trying to learn how to use TensorBoard from TensorBoard: Visualizing Learning. Perhaps this tutorial hasn't…

erobertc
- 644
- 1
- 9
- 20
2
votes
1 answer
Tensorflow fails to create Autograph out a working piece of code
OS Platform and Distribution:ubuntu 20.04
TensorFlow version:2.1.0
Python version:3.7.6
I wanted to write a simple layer that would work on the output of tf.experiment.make_csv_dataset and i could use to impute the missing values in numeric dtypes…

figs_and_nuts
- 4,870
- 2
- 31
- 56
2
votes
1 answer
Select specific features in a Tensorflow 1 layer
I followed this tutorial and used the ipynb notebook from the Github page to generate deepdream images in Google Colaboratory. The tutorial uses the Inception5h network. 12 layers in this model are commonly used for generating images.
Each layer…

omewalt
- 23
- 4
2
votes
1 answer
How to save Tf.contrib model pruning?
I have built a model and I am successfully able to prune it using tf.contrib's model pruning module with default params and sparsity as 90%, but the problem is when I run the model it still takes the same amount of execution time as of the original…

Avinash Rai
- 171
- 6
2
votes
2 answers
Alternative to arg_scope when using tf.layers
I'm rewriting tf.contrib.slim.nets.inception_v3 using tf.layers. Unfortunately the new tf.layers module does not work with arg_scope, as it does not have the necessary decorators. Is there better mechanism in place that I should use to set default…

Piotr Czapla
- 25,734
- 24
- 99
- 122
1
vote
1 answer
Are there alternatives to constant_initializer when assigning weights in tf.contrib.layers
I want to pass weights to tensorflow.contrib.layers.conv2d.
The layers have the parameter weights_initializer. When passing the tensor via weights_initializer=tf.constant_initializer(tensor), the tensor is additionally added as a node to the graph,…

YuKa
- 45
- 5
1
vote
1 answer
Tensorflow convolution layers have strange artefacts
Could anyone explain me what I'm doing wrong that my tensorboard graphs have additional groups when I use tf.layers.conv1d ?
For sake of simplicity I've created one tf.name_scope 'conv_block1' that contains: conv1d -> max_pool -> batch_norm, yet my…

Piotr Czapla
- 25,734
- 24
- 99
- 122
0
votes
0 answers
Problems with saving custom model for TF serving
I defined simple custom model:
import tensorflow as tf
class CustomModule(tf.keras.layers.Layer):
def __init__(self):
super(CustomModule, self).__init__()
self.v = tf.Variable(1.)
def call(self, x):
print('Tracing with', x)
…

Alex
- 21
- 3
0
votes
0 answers
Is there a way to add preprocessing functions into a ScaNN model?
I have a ScaNN object and I am capable of loading data and building it. I can also save the model and extract it to my python environment, but I need to give a tf.Tensor variable as the input. If I want to call my model through RestAPI, I need to…
0
votes
0 answers
Logits from Multi-Input Model arch. to single Tensorflow sigmoid from entropy loss function
I have implemented the vast majority of a multi-input model, and I am struggling in the last few steps of defining a single loss function for 2 incoming logit tensors.
Lets say I have the following:
logits_cnn = tf.layers.dense(input1) # shape is…

js_55
- 177
- 1
- 1
- 9
0
votes
1 answer
Loading a keras model into tfjs causes input shape mismatch
I made a model in Keras and saved it as a tfjs model. I imported it to my js project successfully. I am, however, unable to use the model in my JS code because of an input shape error.
Keras model:
# Python
model =…

Macavitycode
- 3
- 4
0
votes
0 answers
Easy way to set pre-trained weights in tensorflow?
Is there an easy way to set pretrained weights to a tensorflow layer? (w/o keras)
In keras it's easy as model.set_weights(...) or layer.set_weights(...) - but I'm breaking my head around this for more than a day in tf, and can't seem to find…

Maverick Meerkat
- 5,737
- 3
- 47
- 66