model returning a tensor with values 0 occasionally with no schange in input

13 views
Skip to first unread message

champion of wits

unread,
Sep 1, 2020, 3:50:40 AM9/1/20
to TensorFlow Community Testing
Hi
I was trying to build  a simple auto encoder , while executing the following code snippet i was getting either a full zero filled array , or proper output despite not changing the code.
I have tested this code on my local system and google co laboratory ,both returning same issue

code snippet:

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import scipy
import numpy as np
import cv2
tf.compat.v1.enable_eager_execution()

def generate_data_set():
     l = []
     for i in range(50):
         l.append([i,i+2,i+4])
     return np.asarray(l ,dtype = np.single )

m = generate_data_set()
#print(m)



model = keras.Sequential(
[
layers.Dense(9,activation = "relu" , name ="encode_1"),
layers.Dense(5,activation = "relu" , name ="encode_2"),
layers.Dense(1,activation = "relu" , name ="shorty"),
layers.Dense(5,activation = "relu" , name = "decode_2"),
layers.Dense(9,activation = "relu" , name = "decode_1"),
layers.Dense(3,name = "out"),
]
)

x = tf.ones((3,3))
y = model(x)

print(y.numpy())

Screenshot from 2020-09-01 13-11-33.png
Screenshot from 2020-09-01 13-11-45.png
Reply all
Reply to author
Forward
0 new messages