Tensorflow: OneHot-encoding with variable sized length
This is how I solved the issue: The problem was that I was using someone else's code and the depth argument in tf.one_hot was derived from someTensor.get_shape().as_list()[1]. The problem here is that if the shape of someTensor is unknown, the argument is a Python-None which is not a valid argument for tf.one_hot. However, using tf.shape(someTensor)[1] solved that problem as it returns a Dimension with unknown shape instead of a Python-None. A Dimension with unknown shape is a valid depth-argument for tf.one_hot.
I need to onehot-encode some positions with TensorFlow.
However, the length of the input sequences (and therefore the depth-argument in tf.one_hot) is None as I work with variable sized inputs.
This throws the following error: 

"ValueError: Tried to convert 'depth' to a tensor and failed. Error: None values not supported.".

Is there a workaround for this?
I have already tried to set the depth to the correct sequence length before each individual call (through a variable that has some arbitrary initialization value) for a given sequence but as the computational graph is already built, the changes do not come into effect and the depth is stuck at the initialization value.