How do I transform my data into tensors?

I just got the error that Inputs to a layer should be tensors for Keras.

However, in the tidymodels documentation, I was unable to find a step_* function that transforms the data into tensors.

Is there such a function, or do I have to develop my own recipe function? tidymodels - Create your own recipe step function

So what I tried was

df |> 
  mutate(across(-yy, as_tensor))

But gives error

Error in `vec_size()`:
! `x` must be a vector, not a <tensorflow.tensor/tensorflow.python.framework.ops.EagerTensor/tensorflow.python.framework.ops._EagerTensorBase/tensorflow.python.framework.ops.Tensor/tensorflow.python.client._pywrap_tf_session.PyTensor/tensorflow.python.types.internal.NativeObject/tensorflow.python.types.core.Symbol/tensorflow.python.types.core.Value/tensorflow.python.types.core.Tensor/python.builtin.object> object.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.