Tensorflow puts out a lot of output in console, could you tell me what code in my program causes this output? Also, how do I suppress it?
....
Variable/Initializer/initial_value/7859, Variable/Initializer/initial_value/7860, Variable/Initializer/initial_value/7861, Variable/Initializer/initial_value/7862, Variable/Initializer/initial_value/7863, Variable/Initializer/initial_value/7864, Variable/Initializer/initial_value/7865, Variable/Initializer/initial_value/7866, Variable/Initializer/initial_value/7867, Variable/Initializer/initial_value/7868, Variable/Initializer/initial_value/7869, Variable/Initializer/initial_value/7870, Variable/Initializer/initial_value/7871, Variable/Initializer/initial_value/7872, Variable/Initializer/initial_value/7873, Variable/Initializer/initial_value/7874, Variable/Initializer/initial_value/7875, Variable/Initializer/initial_value/7876, Variable/Initializer/initial_value/7877, Variable/Initializer/initial_value/7878, Variable/Initializer/initial_value/7879, Variable/Initializer/initial_value/7880, Variable/Initializer/initial_value/7881, Variable/Initializer/initial_value/7882, Variable/Initializer/initial_value/7883, Variable/Initializer/initial_value/7884, Variable/Initializer/initial_value/7885, Variable/Initializer/initial_value/7886, Variable/Initializer/initial_value/7887, Variable/Initializer/initial_value/7888, Variable/Initializer/initial_value/7889, Variable/Initializer/initial_value/7890, Variable/Initializer/initial_value/7891, Variable/Initializer/initial_value/7892, Variable/Initializer/initial_value/7893, Variable/Initializer/initial_value/7894, Variable/Initializer/initial_value/7895, Variable/Initializer/initial_value/7896, Variable/Initializer/initial_value/7897, Variable/Initializer/initial_value/7898, Variable/Initializer/initial_value/7899, Variable/Initializer/initial_value/7900, Variable/Initializer/initial_value/7901, Variable/Initializer/initial_value/7902, Variable/Initializer/initial_value/7903, Variable/Initializer/initial_value/7904)' with input shapes: [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [6], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7],
[7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7],
[7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7],
[7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7], [7],.....
Here is my code
class LSTMmodel(tf.Module):
def __init__(self, arg_name=None):
super().__init__(name=arg_name)
self.__input = tf.Variable(initial_value=[0.0 for x in range(7)], dtype=tf.float32)
self.__input_reshaped = tf.reshape(self.__input, [1, 7, 1])
self.__network = tf.keras.layers.LSTM(units=7, input_shape=(7,1))
self.__output = tf.Variable(initial_value=[0.0 for x in range(7)], dtype=tf.float32)
self.__output = tf.reshape(self.__output, [1, 7, 1])
@tf.function
def networkTraining(self, arg_data_train, arg_labels, arg_learning_rate):
with tf.GradientTape() as t:
print('loc 1')
self.__input = tf.Variable(arg_data_train)
print('loc 2')
self.__input_reshaped = tf.reshape(self.__input, [1, 7, 1])
self.__output = self.__network(self.__input_reshaped)
print('loc 3')
loss = tf.nn.sigmoid_cross_entropy_with_logits(labels=arg_labels, logits=self.__output)
print('loc 4')
dw, db = t.gradient(loss, [self.w, self.b])
print('loc 5')
self.w.assign_sub(arg_learning_rate * dw)
self.b.assign_sub(arg_learning_rate * db)
@tf.function
def __call__(self, arg_input=[0 for x in range(7)]):
self.__input = tf.Variable(arg_input)
self.__output = self.__network(self.__input)
return self.__output
# some other code
#
#
#
modela.networkTraining(cgm ,labels, 0.4)
EDIT:
The 'Variable/Ini..../<a_number>' happens right before the print('loc 4')
# ###########################FULL-CODE
import pandas
import scipy.io as loader
import tensorflow as tf
import keras
import numpy
tf.get_logger().setLevel('INFO')
class LSTMmodel(tf.Module):
def __init__(self, arg_name=None):
super().__init__(name=arg_name)
self.__input = tf.Variable(initial_value=[0.0 for x in range(7)], dtype=tf.float32)
self.__input_reshaped = tf.reshape(self.__input, [1, 7, 1])
self.__network = tf.keras.layers.LSTM(units=7, input_shape=(7,1))
self.__output = tf.Variable(initial_value=[0.0 for x in range(7)], dtype=tf.float32)
self.__output = tf.reshape(self.__output, [1, 7, 1])
@tf.function
def networkTraining(self, arg_data_train, arg_labels, arg_learning_rate):
with tf.GradientTape() as t:
print('loc 1')
self.__input = tf.Variable(arg_data_train)
print('loc 2')
self.__input_reshaped = tf.reshape(self.__input, [1, 7, 1])
self.__output = self.__network(self.__input_reshaped)
print('loc 3')
loss = tf.nn.sigmoid_cross_entropy_with_logits(labels=arg_labels, logits=self.__output)
print('loc 4')
dw, db = t.gradient(loss, [self.w, self.b])
print('loc 5')
self.w.assign_sub(arg_learning_rate * dw)
self.b.assign_sub(arg_learning_rate * db)
@tf.function
def __call__(self, arg_input=[0 for x in range(7)]):
self.__input = tf.Variable(arg_input)
self.__output = self.__network(self.__input)
return self.__output
# tf.nn.sigmoid_cross_entropy_with_logits(labels=None, logits=None)
correct = numpy.load('save.npy')
# link for the .mat file for your convenience
# https://drive.google.com/file/d/1NOZOeRm1oLOU12p3J4-zw3RrPnJZvw4-/view?usp=sharing
insulin = loader.loadmat('InsulinGlucoseData2.mat')
also = pandas.read_csv('dates222.csv')
# print(type(insulin['numCGM'][0:5]))
# quit()
cgm = []
temp = []
labels = []
# print(insulin['numCGM'])
# print(insulin['actBolusDelivered'])
counter = also.shape[0] - 1
counta = 0
# print(len(insulin['numCGM']))
while counter >= 0:
if also['classification2'][counter] == 1:
cgm.append(insulin['numCGM'][0][counter:counter + 6])
labels.append([0, 0, 0, 0, 0, 0, 1])
counter = counter - 7
elif also['classification2'][counter] == 0:
counter = counter - 1
counta = counta + 1
temp.append(insulin['numCGM'][0][counter])
if counta == 7:
counta = 0
cgm.append(temp)
temp = []
labels.append([0, 0, 0, 0, 0, 0, 0])
if counter - 7 < 0: break
# print(counter)
# print(len(cgm[0]))
# quit()
modela = LSTMmodel(arg_name='ghajini_disease')
# print('------------------------------------------------')
# cgm = numpy.array(cgm, numpy.float32)
for each in labels:
for each_one in each:
each_one = float(each_one)
# print(len(labels))
# print('------------------------------------------------')
modela.networkTraining(cgm ,labels, 0.4)
out = modela(cgm)
print(out)
for each in out:
su = su + each[-1]
train_accuracy = su/sum(labels) * 100
test = modela(new)
EDIT:
I suspect that this problem is being caused in the line self.__input = tf.Variable(arg_data_train). arg_data_train is actually a python list of python lists. I still don't understand the console output though.