title: Initializing and using a tf.placeholder(tf.string), feeding a value to it and converting it back to a string when necessary
body: <p>I am having trouble implementing a model in tensorflow.
  I want to program a model that predicts the polarity of a sentiment. To do this I first have to train the model. This is where an error occurs. </p>
  
  <p>I use three variables: sentence (or sentiment), target (the word in the sentence on which the polarity applies) and the polarity itself. The first two variables are strings and the polarity is a vector ([1,0,0] when positive, [0,0,1] when negative).</p>
  
  <p>To make these variables I use tf.placeholder(tf.string). When I run the model I get the following error: "You must feed a value for placeholder tensor 'Placeholder_1' with dtype string"</p>
  
  <p>I also think I have an issue when I want to do operations on the sentence variable: I need to split the sentence in its words, but since sentence is a placeholder, I first have to convert it back to a string. </p>
  
  <p>The input of the model are three vectors: sVec (a vector of all sentences as strings), tVec (a vector of all targets as strings) and pVec (a vector of all polarities as vectors)</p>
  
  <p>I have been dealing with this error for quite some time now, so any help is appreciated. Below you find the code. Thanks in advance. </p>
  
  <pre><code>polarity = tf.placeholder(tf.float32, shape=[1, c_cardi])#label
  sentence = tf.placeholder(tf.string)  #inputdata
  target = tf.placeholder(tf.string)
  
  def multilayer_perceptron(mi, target, weights, biases):
      # This method works correctly
  
  
  def modelA(sentence, target):
      # The error might refer to this:
      sess2 = tf.Session()
      sentence = sess2.run(sentence) # I need to get the value of the tensor here
      sess2.close()
      words = sentence.split()
      # Code goes on, no error here
      return prediction
  
  
  def trainModelA(sVec, tVec, pVec):
      prediction = modelA(sentence, target)
      cost_function = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=prediction, labels=polarity))
      optimizer = tf.train.GradientDescentOptimizer(0.01).minimize(cost_function)
  
      with tf.Session() as sess:
          sess.run(tf.global_variables_initializer())
          for epoch in range(epochs):
              # The error might refer to this part
              sess.run(optimizer, feed_dict={sentence:sVec, target: tVec, polarity:pVec})
              # Code goes on
  
  trainModelA(sVec, tVec, pVec)
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>It seems to me that the error occurs at the line: sentence = sess2.run(sentence). Because I run modelA(sentence, target), I have sentence as an input but this has not yet been filled with a value. However, this seemed the way to go so I still don't not what is going on.</p>