I am new to Tensorflow and am currently working on Tensorflow2. I'm still having a hard time writing code, because I don't have the possibility to debug.
I already tried to get further with the line:
tf.executing_eagerly()
and
tf.print()
but this is only a small help compared to the "normal" debugging in python.
Is there a better possibility to debug the code and to view the content of variables?
The only thing I currently get is this view, but that doesn't give me any insight into the actual variables either:
Rather than using tf.print, use the normal Python's print if you are eagerly executing. You will be able to see the contents of the variables.
Related
I don't have a specific problem at the moment, but it keeps coming up that I have a bug in my loss function and the error printouts are not sufficient to localize the problem to a specific line of code. For example expected 'int32' but got 'float32' or something like that. Is there a way to know which line of code in the loss function is the source of the problem?
I'll note that sometimes the error comes during compilation, in which case print statements have been helpful. But I have not identified a way to find the problem (outside of guessing or commenting out sections) if it happens only during training, since printouts are not displayed.
You can use one of following option to debug custom loss function or any other deep learning works.
tf.print
tfbdg
TensorBoard debugger
I am new to LLVM backend. What I am trying to do is inserting several register loading and storing between different instructions. So I create a machine function pass to do this job. When I disable the optimisation via -O0, everything works fine.
However, when I enable the optimisation, I found that the code has been optimised in a wrong way. For example, some labels of -O0 code has been kept.
For example it still keeps jl label1; while label1 is not exist in -O3 code.
I am trying to figure out a way to bypass it. My thought is that maybe we can decide the execution order of Machine Function Pass and I could then run my Pass at the very end. Or maybe there is other ways bypass it?
I have been searching it for a while, but I didn't find anything useful.
Thanks for your kind helps !
I would like to write a presolved problem into a file. Is there any way to do it?
write problem does not do it for me, it gives me the original problem that I read with SCIP.
The context is that I am working on SAT problems. The presolving phase of SCIP reduces the number of constraints and variables of the problem, effectively making the problem a little smaller. I would like to take a look at the presolved problem and compare it with the original problem and make some observations.
Yes, it is very easy, just use write transproblem.
The SCIP interactive shell also tells you all the possible commands that you can use, e.g. if you just type write in the SCIP shell, you see all available write commands
I want to find my mistake in GAMS model. I don't have any errors , but my model doesn't work well
Is there any debugging tools in GAMS ?( like debugger tools in other software, e.g MATLAB)
Best
Unfortunately, I have not come across any.
If you have no errors in GAMS, it rather points to a modelling problem rather than a GAMS one. GAMS is like any other programming/modelling software, what you put in is what you get out. However, there are some commands and some intuitive ways you can find out the problem with your model:
One common way is by using the display and $stop commands. If you have loops within your GAMS code, it is best to track the progress of the loop by displaying some key variables either to your .lst file or using put utility (also a nice tool). I use the put utility, and write the code to display key variables at each point of my code to identify where things may have gone wrong.
The $stop command terminates your GAMS code at the line in which it is written.
Hope this helps.
It may be a basic question, but how can I view the log of the solver after the model is optimized. I came across the option to hide the outputs by specifying model.hideOutput(). Is there an option to show the outputs (by default, I don't see any output log. I am using Spyder IDE).
Printing the SCIP output is activated by default in PySCIPOpt. As you already wrote, you would have to manually disable it by calling hideOutput(). Have you tried running your code in a terminal outside of Spyder? Is the model even solved, so did you check whether there is a solution in the end?
To complete the other answer: if your PySCIPOpt model has been created by third-party code, it is possible the output has been turned off upstream.
You can still call model.hideOutput(False) -- see the documentation of hideOutput().