Setting input shape for an NLP task in R(Rstudio) using keras 1D convolution layer, when it expects 3 dimensional input (a tensor)
The input layer was producing a 2d tensor, whereas 1d convolutional layer expects a 3d tensor as input. A good explanation of as to why keras expects it and how should you reshape your 2d input to 3d can be found in this answer.

I used Keras R API function k_reshape( 2d_tensor, (list_of_new_dims)) --> k_reshape(input_layer, list(nrow(train_matrix), num_of_feature_vectors, 1).

nrow(train_matrix) - the total number of rows in my matrix (no of samples)

num_of_feature_vectors - total number of columns in matrix (total number of features)

1 - i want a 3d tensor with only 1 element at z axis, therefore z axis is initialised to 1