keras.layers.StringLookup throws an error when calling on a torch.Tensor or a numpy array (although, both are supposed to be valid backends?)

Colab example: https://colab.research.google.com/drive/1MYcIsJJuiPcvykC8ifOyE4vQk6aAo2UQ

Am I missing something here, or torch support didn't reach here yet?

Comment From: dhantule

Hi @DLumi, thanks for reporting this.

The StringLookup layer uses tensorflow internally, it relies on tensorflow operations and expects tf.tensors. Using tf.tensor or a np.array works fine with tensorflow backend but using torch.tensoror np.arrayraises a Value Error with torch backend in this gist. We'll look into this and update you.

Comment From: VarunS1997

One could convert the torch tensor into a TF tensor as part of the StringLookup, and then convert back as output. If you'd like, we're open to contributions on this, @DLumi

Comment From: DLumi

@VarunS1997 correct me if I'm wrong, but if the package is multi-backend, it means it should be able to run itself on just one backend completely fine. So the way I see it, the function should have equivalents for torch and jax without relying on tensorflow at all. Or it needs to be axed entirely.