def forward_tensor(self, x): # create diagonal matrices return tf.matrix_diag(tf.reshape(x, (-1, self.dim)))