I have an input data set with 102 features and has a corresponding binary output. The output is either 0 or 1 depending on the 102 features.
Input:
tf.Tensor(
[-1.72999993e-01 -8.20000023e-02 3.38000000e-01 1.35000005e-01
...
0.00000000e+00 2.00000009e-03], shape=(102,), dtype=float64)
Output:
tf.Tensor([1], shape=(1,), dtype=int32)
I am trying to follow this custom training tutorial and have create this model as follows:
train_dataset = tf.data.Dataset.from_tensor_slices((train_x,tf.dtypes.cast(label_x, tf.int32)))
features, labels = next(iter(train_dataset))
model = tf.keras.Sequential([
tf.keras.layers.Dense(10, activation=tf.nn.relu, input_shape=(102,)), # input shape required
tf.keras.layers.Dense(10, activation=tf.nn.relu),
tf.keras.layers.Dense(1)
])
predictions = model(features)
However, when there is an error when I tried running it:
---------------------------------------------------------------------------
InvalidArgumentError Traceback (most recent call last)
<ipython-input-12-d7be7f733930> in <module>()
6 ])
7
----> 8 predictions = model(features)
7 frames
/usr/local/lib/python3.6/dist-packages/six.py in raise_from(value, from_value)
InvalidArgumentError: In[0] is not a matrix. Instead it has shape [102] [Op:MatMul]