parameters: (self, params, placedb, data_collections, pin_pos_op,
                     device)
return_statement: return build_wirelength_op
docstring: @brief compute half-perimeter wirelength
          @param params parameters
          @param placedb placement database
          @param data_collections a collection of all data and variables required for constructing the ops
          @param pin_pos_op the op to compute pin locations according to cell locations
          @param device cpu or cuda
function: def build_hpwl(self, params, placedb, data_collections, pin_pos_op,
                     device):
          """
          @brief compute half-perimeter wirelength
          @param params parameters
          @param placedb placement database
          @param data_collections a collection of all data and variables required for constructing the ops
          @param pin_pos_op the op to compute pin locations according to cell locations
          @param device cpu or cuda
          """
  
          wirelength_for_pin_op = hpwl.HPWL(
              flat_netpin=data_collections.flat_net2pin_map,
              netpin_start=data_collections.flat_net2pin_start_map,
              pin2net_map=data_collections.pin2net_map,
              net_weights=data_collections.net_weights,
              net_mask=data_collections.net_mask_all,
              algorithm='net-by-net')
  
          # wirelength for position
          def build_wirelength_op(pos):
              return wirelength_for_pin_op(pin_pos_op(pos))
  
          return build_wirelength_op
function_tokens: def build_hpwl ( self , params , placedb , data_collections , pin_pos_op , device ) : wirelength_for_pin_op = hpwl . HPWL ( flat_netpin = data_collections . flat_net2pin_map , netpin_start = data_collections . flat_net2pin_start_map , pin2net_map = data_collections . pin2net_map , net_weights = data_collections . net_weights , net_mask = data_collections . net_mask_all , algorithm = 'net-by-net' ) # wirelength for position def build_wirelength_op ( pos ) : return wirelength_for_pin_op ( pin_pos_op ( pos ) ) return build_wirelength_op