diff --git a/skluc/main/tensorflow_/kernel_approximation/fastfood_layer.py b/skluc/main/tensorflow_/kernel_approximation/fastfood_layer.py index d657dd75000565c8bab25f8662d6f5784a4c8a28..488708040e4b4c2b15ab5961a50497fe43d61823 100644 --- a/skluc/main/tensorflow_/kernel_approximation/fastfood_layer.py +++ b/skluc/main/tensorflow_/kernel_approximation/fastfood_layer.py @@ -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 diff --git a/skluc/main/tensorflow_/kernel_approximation/nystrom_layer.py b/skluc/main/tensorflow_/kernel_approximation/nystrom_layer.py index 3ec4730ebbf2de3a5064572ed1a6bf8694ef9937..24c723777a5f241aacc0543016ac7055c6722631 100644 --- a/skluc/main/tensorflow_/kernel_approximation/nystrom_layer.py +++ b/skluc/main/tensorflow_/kernel_approximation/nystrom_layer.py @@ -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) diff --git a/skluc/main/tools/experiences/check_stderr.py b/skluc/main/tools/experiences/check_stderr.py new file mode 100644 index 0000000000000000000000000000000000000000..7acd9193dac9c1c2ed8b0e809d36b5f961fa396b --- /dev/null +++ b/skluc/main/tools/experiences/check_stderr.py @@ -0,0 +1,32 @@ +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