code: import tensorflow as tf
  import numpy as np
  import sys
  import os
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
  sys.path.append(BASE_DIR)
  sys.path.append(os.path.join(BASE_DIR, '../utils'))
  import tf_util
  
  def input_transform_net(point_cloud, is_training, bn_decay=None, K=3):
      """ Input (XYZ) Transform Net, input is BxNx3 gray image
          Return:
              Transformation matrix of size 3xK """
      batch_size = point_cloud.get_shape()[0].value
      num_point = point_cloud.get_shape()[1].value
      num_channels = point_cloud.get_shape()[2].value
  
      input_image = tf.expand_dims(point_cloud, -1)
      net = tf_util.conv2d(input_image, 64, [1,num_channels],
                           padding='VALID', stride=[1,1],
                           bn=True, is_training=is_training,
                           scope='tconv1', bn_decay=bn_decay)
      net = tf_util.conv2d(net, 128, [1,1],
                           padding='VALID', stride=[1,1],
                           bn=True, is_training=is_training,
                           scope='tconv2', bn_decay=bn_decay)
      net = tf_util.conv2d(net, 1024, [1,1],
                           padding='VALID', stride=[1,1],
                           bn=True, is_training=is_training,
                           scope='tconv3', bn_decay=bn_decay)
      net = tf_util.max_pool2d(net, [num_point,1],
                               padding='VALID', scope='tmaxpool')
  
      net = tf.reshape(net, [batch_size, -1])
      net = tf_util.fully_connected(net, 512, bn=True, is_training=is_training,
                                    scope='tfc1', bn_decay=bn_decay)
      net = tf_util.fully_connected(net, 256, bn=True, is_training=is_training,
                                    scope='tfc2', bn_decay=bn_decay)
  
      with tf.variable_scope('transform_XYZ') as sc:
          weights = tf.get_variable('weights', [256, num_channels*K],
                                    initializer=tf.constant_initializer(0.0),
                                    dtype=tf.float32)
          # biases = tf.get_variable('biases', [num_channels*K],
          #                          initializer=tf.constant_initializer(0.0),
          #                          dtype=tf.float32)
          # biases += tf.constant([1,0,0,0,1,0,0,0,1], dtype=tf.float32)
          transform = tf.matmul(net, weights)
          # transform = tf.nn.bias_add(transform, biases)
  
      transform = tf.reshape(transform, [batch_size, num_channels, K])
      return transform
  
  
  def feature_transform_net(inputs, is_training, bn_decay=None, K=64):
      """ Feature Transform Net, input is BxNx1xK
          Return:
              Transformation matrix of size KxK """
      batch_size = inputs.get_shape()[0].value
      num_point = inputs.get_shape()[1].value
  
      net = tf_util.conv2d(inputs, 64, [1,1],
                           padding='VALID', stride=[1,1],
                           bn=True, is_training=is_training,
                           scope='tconv1', bn_decay=bn_decay)
      net = tf_util.conv2d(net, 128, [1,1],
                           padding='VALID', stride=[1,1],
                           bn=True, is_training=is_training,
                           scope='tconv2', bn_decay=bn_decay)
      net = tf_util.conv2d(net, 1024, [1,1],
                           padding='VALID', stride=[1,1],
                           bn=True, is_training=is_training,
                           scope='tconv3', bn_decay=bn_decay)
      net = tf_util.max_pool2d(net, [num_point,1],
                               padding='VALID', scope='tmaxpool')
  
      net = tf.reshape(net, [batch_size, -1])
      net = tf_util.fully_connected(net, 512, bn=True, is_training=is_training,
                                    scope='tfc1', bn_decay=bn_decay)
      net = tf_util.fully_connected(net, 256, bn=True, is_training=is_training,
                                    scope='tfc2', bn_decay=bn_decay)
  
      with tf.variable_scope('transform_feat') as sc:
          weights = tf.get_variable('weights', [256, K*K],
                                    initializer=tf.constant_initializer(0.0),
                                    dtype=tf.float32)
          biases = tf.get_variable('biases', [K*K],
                                   initializer=tf.constant_initializer(0.0),
                                   dtype=tf.float32)
          biases += tf.constant(np.eye(K).flatten(), dtype=tf.float32)
          transform = tf.matmul(net, weights)
          transform = tf.nn.bias_add(transform, biases)
  
      transform = tf.reshape(transform, [batch_size, K, K])
      return transform
  
apis: tensorflow.nn.bias_add tensorflow.matmul numpy.eye tensorflow.reshape tensorflow.expand_dims tensorflow.constant_initializer tensorflow.variable_scope
api_extract: [(6, 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), False, 'import sys\n'), (5, 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), False, 'import os\n'), (7, 'os.path.join', 'os.path.join', (['BASE_DIR', '"""../utils"""'], {}), False, 'import os\n'), (18, 'tensorflow.expand_dims', 'tf.expand_dims', (['point_cloud', '(-1)'], {}), True, 'import tensorflow as tf\n'), (19, 'tf_util.conv2d', 'tf_util.conv2d', (['input_image', '(64)', '[1, num_channels]'], {'padding': '"""VALID"""', 'stride': '[1, 1]', 'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tconv1"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (23, 'tf_util.conv2d', 'tf_util.conv2d', (['net', '(128)', '[1, 1]'], {'padding': '"""VALID"""', 'stride': '[1, 1]', 'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tconv2"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (27, 'tf_util.conv2d', 'tf_util.conv2d', (['net', '(1024)', '[1, 1]'], {'padding': '"""VALID"""', 'stride': '[1, 1]', 'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tconv3"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (31, 'tf_util.max_pool2d', 'tf_util.max_pool2d', (['net', '[num_point, 1]'], {'padding': '"""VALID"""', 'scope': '"""tmaxpool"""'}), False, 'import tf_util\n'), (34, 'tensorflow.reshape', 'tf.reshape', (['net', '[batch_size, -1]'], {}), True, 'import tensorflow as tf\n'), (35, 'tf_util.fully_connected', 'tf_util.fully_connected', (['net', '(512)'], {'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tfc1"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (37, 'tf_util.fully_connected', 'tf_util.fully_connected', (['net', '(256)'], {'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tfc2"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (51, 'tensorflow.reshape', 'tf.reshape', (['transform', '[batch_size, num_channels, K]'], {}), True, 'import tensorflow as tf\n'), (62, 'tf_util.conv2d', 'tf_util.conv2d', (['inputs', '(64)', '[1, 1]'], {'padding': '"""VALID"""', 'stride': '[1, 1]', 'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tconv1"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (66, 'tf_util.conv2d', 'tf_util.conv2d', (['net', '(128)', '[1, 1]'], {'padding': '"""VALID"""', 'stride': '[1, 1]', 'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tconv2"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (70, 'tf_util.conv2d', 'tf_util.conv2d', (['net', '(1024)', '[1, 1]'], {'padding': '"""VALID"""', 'stride': '[1, 1]', 'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tconv3"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (74, 'tf_util.max_pool2d', 'tf_util.max_pool2d', (['net', '[num_point, 1]'], {'padding': '"""VALID"""', 'scope': '"""tmaxpool"""'}), False, 'import tf_util\n'), (77, 'tensorflow.reshape', 'tf.reshape', (['net', '[batch_size, -1]'], {}), True, 'import tensorflow as tf\n'), (78, 'tf_util.fully_connected', 'tf_util.fully_connected', (['net', '(512)'], {'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tfc1"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (80, 'tf_util.fully_connected', 'tf_util.fully_connected', (['net', '(256)'], {'bn': '(True)', 'is_training': 'is_training', 'scope': '"""tfc2"""', 'bn_decay': 'bn_decay'}), False, 'import tf_util\n'), (94, 'tensorflow.reshape', 'tf.reshape', (['transform', '[batch_size, K, K]'], {}), True, 'import tensorflow as tf\n'), (40, 'tensorflow.variable_scope', 'tf.variable_scope', (['"""transform_XYZ"""'], {}), True, 'import tensorflow as tf\n'), (48, 'tensorflow.matmul', 'tf.matmul', (['net', 'weights'], {}), True, 'import tensorflow as tf\n'), (83, 'tensorflow.variable_scope', 'tf.variable_scope', (['"""transform_feat"""'], {}), True, 'import tensorflow as tf\n'), (91, 'tensorflow.matmul', 'tf.matmul', (['net', 'weights'], {}), True, 'import tensorflow as tf\n'), (92, 'tensorflow.nn.bias_add', 'tf.nn.bias_add', (['transform', 'biases'], {}), True, 'import tensorflow as tf\n'), (42, 'tensorflow.constant_initializer', 'tf.constant_initializer', (['(0.0)'], {}), True, 'import tensorflow as tf\n'), (85, 'tensorflow.constant_initializer', 'tf.constant_initializer', (['(0.0)'], {}), True, 'import tensorflow as tf\n'), (88, 'tensorflow.constant_initializer', 'tf.constant_initializer', (['(0.0)'], {}), True, 'import tensorflow as tf\n'), (90, 'numpy.eye', 'np.eye', (['K'], {}), True, 'import numpy as np\n')]