Skip to content
Snippets Groups Projects
Commit ee8d22b6 authored by Luc Giffon's avatar Luc Giffon
Browse files

fix bug on init for fastfoodlayer class + add more tensorboard summary for...

fix bug on init for fastfoodlayer class + add more tensorboard summary for nystrom approximation class
parent 5bd8ad48
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ def build_hadamard(n_neurons):
class FastFoodLayer(tf.keras.layers.Layer):
def __init__(self, sigma, nbr_stack, trainable=True):
super().__init__(self)
super().__init__()
self.__sigma = sigma
self.__nbr_stack = nbr_stack
self.__trainable = trainable
......
......@@ -38,6 +38,7 @@ def nystrom_layer(input_x, input_subsample, kernel, W_matrix=None, output_dim=0,
h_conv_nystrom_subsample_flat = tf.reshape(input_subsample, [nystrom_sample_size, init_dim])
with tf.name_scope("kernel_vec"):
kernel_vector = kernel(h_conv_flat, h_conv_nystrom_subsample_flat, **kernel_params)
kernel_vector = tf.Print(kernel_vector, [kernel_vector[0]], "print op: ", summarize=10)
if output_dim != 0:
if W_matrix is None:
......@@ -52,6 +53,7 @@ def nystrom_layer(input_x, input_subsample, kernel, W_matrix=None, output_dim=0,
raise ValueError("Unknown type for w_matrix")
tf.summary.histogram("W_nystrom", W)
out_fc = tf.matmul(kernel_vector, W)
tf.summary.histogram("Kernel vector", out_fc)
else:
out_fc = kernel_vector
tf.summary.histogram("output_nystrom", out_fc)
......
import re
from os import walk
from os.path import isfile, join
if __name__ == "__main__":
path = "/home/luc/Resultats/Deepstrom/september_2018/deepfried_rel"
onlyfiles = []
for dirpath, dirnames, filenames in walk(path):
onlyfiles.extend([join(dirpath, f) for f in filenames if isfile(join(dirpath, f))])
pattern = "(.+)_stdout.txt"
compiled_re = re.compile(pattern)
errors = []
for f_name in onlyfiles:
if not compiled_re.match(f_name):
continue
with open(f_name, "r") as f:
str_f = f.read().strip()
if str_f == "":
f_name_split = f_name.split("_")
f_name_base = "_".join(f_name_split[:-1])
f_name_err = f_name_base + "_stderr.txt"
with open(f_name_err, 'r') as ferr:
str_ferr = ferr.read().strip()
errors.append(str_ferr)
with open(join(path, "errors.txt"), 'w') as f_out_err:
for err in errors:
f_out_err.write(err)
f_out_err.write("\n\n\n\n")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment