vector icon indicating copy to clipboard operation
vector copied to clipboard

TensorFlow backend

Open henryiii opened this issue 5 years ago • 6 comments

Work on TensorFlow backend.

henryiii avatar Feb 14 '20 13:02 henryiii

So finally TF also makes a step into the right direction by having essentially a (limited) numpy API available as well. TF and PyTorch should therefore have basically the same implementation and may differ from numpy as the former do not allow(TF)/highly discourage(PyTorch) the usage of inplace operations (or assignments to an existing tensor like in Numpy).

The question is somewhat about numpy (and numba): do we expect to have inplace operations in the numpy implementation actually? If not TF, PyTorch and np can be implemented in one way, otherwise TF and PyTorch may need a separate, yet common to both, implementation.

TF does not support the ufuncs though, this would result in a numpy array being returned. It just supports a np.* interface

jonas-eschle avatar Nov 05 '20 22:11 jonas-eschle

Great! I think the current plan is to avoid in-place operations. Possibly there could be some room for it in the future, but not something we will target in version 1, and maybe never, since the best way to optimize may be to use numba/tf/pytorch.

I'm doing some quick work for the Princeton flowmeter project, then I'll finish a fairly large commit including more functionality and updates.

henryiii avatar Nov 05 '20 22:11 henryiii

(I'm following the Uproot/awkward deadlines, so an initial release is targeting Dec 1)

henryiii avatar Nov 05 '20 22:11 henryiii

Great, that's good to hear!Looking forward to it; I'll gladly add the PyTorch/TF backends then

jonas-eschle avatar Nov 05 '20 22:11 jonas-eschle

Yep, looking forward to seeing what you have been preparing there :-).

eduardo-rodrigues avatar Nov 06 '20 07:11 eduardo-rodrigues

The Protocol in src/vector/protocols/lorentz.py should help with this, as well as the parametrized tests in tests/test_simple_param.py (static link, will likely rename soon).

henryiii avatar Dec 15 '20 04:12 henryiii