error when input function called with shape (2,2) I am new to Tensorflow and machine learning. 

I am trying to use high level API from Tensorflow.

Please tell me what i am doing wrong. 

import tensorflow as tf
import numpy as np


features = np.array([[-1,-2],[1,2]],dtype='int32')
label = np.array([0,1],dtype='int32')

feature_columns = [tf.feature_column.numeric_column('features',shape=[2,2])]

model = tf.estimator.LinearClassifier(feature_columns=feature_columns,n_classes=2)

model.train(input_fn= tf.estimator.inputs.numpy_input_fn(x=features,y=label,shuffle=True))


I am getting an error

ValueError: features should be a dictionary of `Tensor`s. Given type: &lt;class 'tensorflow.python.framework.ops.Tensor'&gt;
x, y that goes in tf.estimator.inputs.numpy_input_fn() must be either an array or a dictionary of arrays. Quoting from the link (https://www.tensorflow.org/api_docs/python/tf/estimator/inputs/numpy_input_fn) - x: numpy array object or dict of numpy array objects. If an array, the array will be treated as a single feature. 

So in your case it is treating 'feature' as a single feature. You can try this:

x1 = np.array([-1,-2])

x2 = np.array([1,2])

features = {'x1': x1, 'x2': x2}