def freeze_slots(self, features):
    assert (not self._frozen), 'Already finalized'
    if self._config_run:
        raise ConfigRunError()
    self._sparse_v2opt = {}
    bias_config = self._get_bias_slot_configs()
    if bias_config:
        bias_weights = self._bias_embedding.weights
        for (i, opt) in enumerate(bias_config['optimizers']):
            for j in range(self._num_shards):
                self._sparse_v2opt[bias_weights[i][j]] = opt
    vec_config = self._get_vec_slot_configs()
    if vec_config:
        vec_weights = self._vec_embedding.weights
        for (i, opt) in enumerate(vec_config['optimizers']):
            for j in range(self._num_shards):
                self._sparse_v2opt[vec_weights[i][j]] = opt
        placeholders = []
        dims = []
        for (slot_id, _, _, _) in vec_config['slot_list']:
            fc = self._feature_column_v1s[slot_id]
            for sslice in fc.feature_slot.feature_slices:
                dims.append(sslice.len)
                placeholders.append(fc.get_vector(sslice))
        vec_split = tf.split(self._vec_tensor, dims, axis=1)
        ge.swap_ts(vec_split, placeholders)
    for slot in self._feature_slots.values():
        slot._frozen = True
    self._frozen = True
def freeze_slots(self, features):
    assert (not self._frozen), 'Already finalized'
    if self._config_run:
        raise ConfigRunError()
    self._sparse_v2opt = {}
    bias_config = self._get_bias_slot_configs()
    if bias_config:
        bias_weights = self._bias_embedding.weights
        for (i, opt) in enumerate(bias_config['optimizers']):
            for j in range(self._num_shards):
                self._sparse_v2opt[bias_weights[i][j]] = opt
    vec_config = self._get_vec_slot_configs()
    if vec_config:
        vec_weights = self._vec_embedding.weights
        for (i, opt) in enumerate(vec_config['optimizers']):
            for j in range(self._num_shards):
                self._sparse_v2opt[vec_weights[i][j]] = opt
        placeholders = []
        dims = []
        for (slot_id, _, _, _) in vec_config['slot_list']:
            fc = self._feature_column_v1s[slot_id]
            for sslice in fc.feature_slot.feature_slices:
                dims.append(sslice.len)
                placeholders.append(fc.get_vector(sslice))
        vec_split = tf.split(self._vec_tensor, dims, axis=1)
        ge.swap_ts(vec_split, placeholders)
    for slot in self._feature_slots.values():
        slot._frozen = True
    self._frozen = True