wala / ML

Eclipse Public License 2.0
24 stars 17 forks source link

Missing callbacks #92

Closed khatchad closed 7 months ago

khatchad commented 9 months ago

Missing Strategy.run()

Called here: https://github.com/mead-ml/mead-baseline/blob/5d7632bb151c2d09501ebf49f36ba8c4204df4c8/mead/api_examples/pretrain_discrim_tf.py#L414.

The callback function _replicated_train_step() is defined here: https://github.com/mead-ml/mead-baseline/blob/5d7632bb151c2d09501ebf49f36ba8c4204df4c8/mead/api_examples/pretrain_discrim_tf.py#L394-L405.

But, we don't see it in the call graph. The method reference should be: < PythonLoader, Lscript pretrain_discrim_tf.py/train/_replicated_train_step, do()LRoot; >. The call graph nodes: https://gist.github.com/khatchad/ab56e3be454103829275c7507999b7d1

Regression

There are some callbacks defined in tensorflow.xml, as well as others. I see the return values are specified, but I wonder if adding the callback summary will also consider the given function argument as invoked:

https://github.com/wala/ML/blob/1b1ffac127c0c8f48a11d2c661b71450c9d60ce9/com.ibm.wala.cast.python.ml/data/tensorflow.xml#L758-L766

https://github.com/wala/ML/blob/1b1ffac127c0c8f48a11d2c661b71450c9d60ce9/com.ibm.wala.cast.python.ml/data/tensorflow.xml#L778-L787

The ones there are for estimators (looks like there's two definitions). I wonder if we just need to add more for, e.g., TF2 APIs. I found these docs for the estimator.

khatchad commented 8 months ago

Actually, above, we can see that xx represents the passed function (arg0; but represented as a field?):

https://github.com/wala/ML/blob/1b1ffac127c0c8f48a11d2c661b71450c9d60ce9/com.ibm.wala.cast.python.ml/data/tensorflow.xml#L781

Then, a call is added to this function:

https://github.com/wala/ML/blob/1b1ffac127c0c8f48a11d2c661b71450c9d60ce9/com.ibm.wala.cast.python.ml/data/tensorflow.xml#L783

The first argument of the original function is passed:

https://github.com/wala/ML/blob/1b1ffac127c0c8f48a11d2c661b71450c9d60ce9/com.ibm.wala.cast.python.ml/data/tensorflow.xml#L782

khatchad commented 7 months ago

For experimental_distribute_datasets_from_function, that function:

Generates tf.distribute.DistributedValues from value_fn.

Tracking DistributedValues isn't currently supported.