# Path: ldif/util/line_util.py
# def line_to_image(line_parameters, height, width, falloff=2.0):
# def fractional_vector_projection(e0, e1, p, falloff=2.0):
# def rotate_about_point(angle_of_rotation, point, to_rotate):
# def union_of_line_drawings(lines):
# def network_line_parameters_to_line(line_parameters, height, width):
# 
# Path: ldif/util/net_util.py
# def twin_inference(inference_fun, observation, element_count,
#                    flat_element_length, model_config):
# def get_normalizer_and_mode(model_config):
# def conv_layer(inputs, depth, model_config):
# def maxpool2x2_layer(inputs):
# def down_layer(inputs, depth, model_config):
# def up_layer(inputs, spatial_dims, depth, model_config):
# def encode(inputs,
#            model_config,
#            conv_layer_depths,
#            fc_layer_depths,
#            name='Encoder'):
# def inputs_to_feature_vector(inputs, feature_length, model_config):
# def decode(z,
#            model_config,
#            spatial_dims,
#            fc_layer_depths,
#            conv_layer_depths,
#            output_dim,
#            name='Decoder'):
# def residual_layer(inputs, num_outputs, model_config):


import tensorflow as tf
from ldif.util import line_util
from ldif.util import net_util
        inputs=output,
        num_outputs=line_embedding_size,
        activation_fn=None,
        normalizer_fn=None)
    current_image = line_util.network_line_parameters_to_line(
        line_parameters, height, width)
    current_image = 2.0 * current_image - 1.0
    if partial_images:
      current_image = tf.minimum(partial_images[-1], current_image)
    partial_images.append(current_image)

    if reencode_partial_outputs and i < number_of_lines - 1:
      encoded_partial_output, _, _ = net_util.encode(
          current_image,
          model_config,
          conv_layer_depths=conv_layer_depths,
          fc_layer_depths=[encoded_image_length],
          name='OutputReencoder')
  return partial_images


def bag_of_lines_transcoder(inputs, model_config):
  """A model that outputs K lines all at once to replicate a target shape."""
  batch_size = model_config.hparams.bs
  height = model_config.hparams.h
  width = model_config.hparams.w
  conv_layer_depths = [16, 32, 64, 128, 128]
  number_of_lines = 4
  line_embedding_size = 5
  embedding_size = line_embedding_size * number_of_lines

# Path: ldif/util/line_util.py
# def line_to_image(line_parameters, height, width, falloff=2.0):
# def fractional_vector_projection(e0, e1, p, falloff=2.0):
# def rotate_about_point(angle_of_rotation, point, to_rotate):
# def union_of_line_drawings(lines):
# def network_line_parameters_to_line(line_parameters, height, width):
# 
# Path: ldif/util/net_util.py
# def twin_inference(inference_fun, observation, element_count,
#                    flat_element_length, model_config):
# def get_normalizer_and_mode(model_config):
# def conv_layer(inputs, depth, model_config):
# def maxpool2x2_layer(inputs):
# def down_layer(inputs, depth, model_config):
# def up_layer(inputs, spatial_dims, depth, model_config):
# def encode(inputs,
#            model_config,
#            conv_layer_depths,
#            fc_layer_depths,
#            name='Encoder'):
# def inputs_to_feature_vector(inputs, feature_length, model_config):
# def decode(z,
#            model_config,
#            spatial_dims,
#            fc_layer_depths,
#            conv_layer_depths,
#            output_dim,
#            name='Decoder'):
# def residual_layer(inputs, num_outputs, model_config):


# Path: ldif/nets/linenet.py
import tensorflow as tf
from ldif.util import line_util
from ldif.util import net_util

        inputs=output,
        num_outputs=line_embedding_size,
        activation_fn=None,
        normalizer_fn=None)
    current_image = line_util.network_line_parameters_to_line(
        line_parameters, height, width)
    current_image = 2.0 * current_image - 1.0
    if partial_images:
      current_image = tf.minimum(partial_images[-1], current_image)
    partial_images.append(current_image)

    if reencode_partial_outputs and i < number_of_lines - 1:
      encoded_partial_output, _, _ = net_util.encode(
          current_image,
          model_config,
          conv_layer_depths=conv_layer_depths,
          fc_layer_depths=[encoded_image_length],
          name='OutputReencoder')
  return partial_images


def bag_of_lines_transcoder(inputs, model_config):
  """A model that outputs K lines all at once to replicate a target shape."""
  batch_size = model_config.hparams.bs
  height = model_config.hparams.h
  width = model_config.hparams.w
  conv_layer_depths = [16, 32, 64, 128, 128]
  number_of_lines = 4
  line_embedding_size = 5
  embedding_size = line_embedding_size * number_of_lines

  z, _, _ = net_util.encode(