I understand that we can write custom models and encapsulate it using tf.estimator. But I just can't seem to find any documentation with an example.
I know that you have to define your model inside a 'model_fn' but what exactly should I return from this function. Also am I supposed to put the the loss and the training step within the 'model_fn' or just the network. How should I modify the code give below to make it work with tf.estimator. Would really appreciate some help.
def test_model(features,labels):
X = tf.placeholder(tf.float32,shape=(None,1),name="Data_Input")
#Output
Y = tf.placeholder(tf.float32,shape=(None,1),name="Target_Labels")
W = tf.Variable(tf.random_normal([0],stddev=stddev0))
b = tf.Variable(tf.random_normal([0],stddev=stddev0))
Ypredict = W*X + b
return Ypredict
estimator = tf.estimator.Estimator(model_fn = test_model)