Best pratice on using `tf.compat.v1.metrics.auc`? - tensorflow

I try to migrate my code from tf1.* to tf2, while in tf2 doc it says that tf.compat.v1.metrics.auc is deprecated because "The value of AUC returned by this may race with the update". This statement is vague to me. Does it mean that it can't be used in multithreading context? If not, in what situation can I use this function?

tf.compat.v1.metrics.auc has been moved under tf.keras.
As mentioned in the error message itself you can start using tf.keras.metrics.AUC in Tf2.
There are some changes in hyper parameters in the updated version, details with the example can be found in the above mentioned document.

Related

Tensorflow raw operations: Variable, VariableV2, VarhandleOp; What are the differences?

(I have read a similar question: https://www.tensorflow.org/guide/variables, but that does not answer it).
I see that variables in TF can be created with three different raw operations. I understand that Variable is deprecated and VariableV2 should be used. However somewhere I had read Variable gives back a variable by reference and that is considered outdated, while VarhandleOp gives back a resource-typed variable and that is to be used. With VariableV2 I am confused. Is it a new version of the old style Variable and hence still not considered up-to-date or it is actually a modern approach, just using the same old Variable interface (probably for compatibility reasons)? Maybe it is using something like VarhandleOp under the hood?
A related question: What is a "container" used in all the three a.m. operations? In all the documents I found, it only says that it is defaulted to "" and it is OK. But what is it?

Is local_variables_initializer really necessary?

In practice, isn't running global_variables_initializer enough to initialize model variables?
local_variables_initializer seems to be unnecessary and absent even in official and semi-official tensorflow example code. See for example:
https://github.com/dandelionmane/tf-dev-summit-tensorboard-tutorial
https://www.tensorflow.org/get_started/mnist/pros
In both cases only global_variables_initializer is used.
Am I missing something here? Is there any case where I should call local_variables_initializer explicitly?
local_variables_initializer is useful in particular for streaming metrics (e.g. tf.contrib.metrics.streaming_auc). As said in the doc of contrib.metrics:
Because the streaming metrics use local variables, the Initialization stage is performed by running the op returned by tf.local_variables_initializer().

Tensorflow Documentation

I am increasingly irritated and frustrated by the Tensorflow documentation. I searched on google for documentation regarding
tf.reshape
I'm getting directed to a generic page like here. I want to see the details of tf.reshape and not the entirety of the documentation.
Am I doing something wrong here?
Do not Google about Tensorflow documentation, use the TensorFlow Python reference documentation and ctrl + f
The probably fastest way is to use the Tf documentation is:
http://devdocs.io/tensorflow~python/
Just type tf.reshape and you are done.
which can be also used offline and automatically updates the docs.
edit: even typing only res shows you the documentation.
Update for posterity:
With the new TensorFlow, the website is now indexed with Google, and it should also soon be indexed by other search engines.
I would suggest you use the GitHub repo as your documentation instead. https://github.com/tensorflow/tensorflow/tree/master/tensorflow/g3doc/api_docs/python/functions_and_classes
For example tf.reshape is in a single Markdown file https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reshape.md
To search for the document you want, you could use the GitHub search under that functions_and_classes folder.
An example is
tf.reshape() path:tensorflow/g3doc/api_docs/python/functions_and_classes language:Markdown
https://github.com/tensorflow/tensorflow/search?utf8=✓&q=tf.reshape%28%29+path%3Atensorflow%2Fg3doc%2Fapi_docs%2Fpython%2Ffunctions_and_classes+language%3AMarkdown&type=Code
which search for tf.reshape() under the documentation folder.
I use the non-official Dash/Zeal docset for TensorFlow:
https://github.com/ppwwyyxx/dash-docset-tensorflow
It is a very convenient way of browsing the TensorFlow documentation offline and it solves the problem you are describing.
Is this what you are looking for? Using the search functionality of the browser helped me find it.
I suppose that you have installed tensorflow in your computer and that you know the name of function that you may want to use.
So if you use some Python IDE, I think you can directly jump to the declaration or definition of this function and see the usage and explanation. That is the same documentation as online (although for some functions it is not very clear).
You can use the url for tensorflow documentation and add what you want to search..
The base url is:
https://www.tensorflow.org/api_docs/python/tf/
You can add what_ever_you_want_to_search after the /
Since Tensorflow r1.1 a search on google for items like 'tf.shape' now lists the appropriate page at the top of the search results.
This didn't work back in r0.10 and r0.11, maybe because there were many markdown formatting issues in the Tensorflow docs themselves.
Since you tf is developing best way is to go through the tf API. And it's good if you can follow these slides in http://web.stanford.edu/class/cs20si/

Is there any good tutoria or reference for writing code with Magma?

Currently I am trying to use Magma to do matrix operation on GPU, however, I found few documents about it. The only thing I can refer to is its testing program and the online generated document(here), which is not convenient to use. And the user guide seems outdated.
If you look here, getri and potri are supported.

How to use CUTThread in CUDA

I am trying to run my own multi-gpu example, and I am following the NVIDIA's example. However, I cannot find where CUTThread is defined and then the compiler says:
error: ‘CUTThread’ was not declared in this scope
The short answer is 'dont use cutThread at all'. It comes from the SDK, not the toolkit, and it not intended for general use - NVIDIA don't document any of these function, nor do they guarantee that they either work, or won't change in definition or function from release to release. If you are interested in multiGPU computing, have a look at this answer to a very recent Stackoverflow question.