def _check_vector_update(self, tokens, new_embedding):
assert self._idx_to_vec is not None, '<STR_LIT>'<EOL>if not isinstance(tokens, (list, tuple)) or len(tokens) == <NUM_LIT:1>:<EOL><INDENT>assert isinstance(new_embedding, nd.NDArray) and len(new_embedding.shape) in [<NUM_LIT:1>, <NUM_LIT:2>],'<STR_LIT>'<EOL>if not isinstance(tokens, (list, tuple)):<EOL><INDENT>tokens = [tokens]<EOL><DEDENT>if len(new_embedding.shape) == <NUM_LIT:1>:<EOL><INDENT>new_embedding = new_embedding.expand_dims(<NUM_LIT:0>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>assert isinstance(new_embedding, nd.NDArray) and len(new_embedding.shape) == <NUM_LIT:2>,'<STR_LIT>'<EOL><DEDENT>if self._idx_to_vec is not None:<EOL><INDENT>assert new_embedding.shape == (len(tokens), self._idx_to_vec.shape[<NUM_LIT:1>]),'<STR_LIT>''<STR_LIT>''<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>assert new_embedding.shape[<NUM_LIT:0>] == len(tokens),'<STR_LIT>'<EOL><DEDENT>return tokens<EOL>
Check that tokens and embedding are in the format for __setitem__.