(blob: Any)
| 109 | |
| 110 | |
| 111 | def _blob_to_vector(blob: Any) -> np.ndarray: |
| 112 | if blob is None: |
| 113 | return np.array([], dtype=np.float32) |
| 114 | if isinstance(blob, memoryview): |
| 115 | blob = blob.tobytes() |
| 116 | array = np.frombuffer(blob, dtype=np.float32) |
| 117 | norm = float(np.linalg.norm(array)) |
| 118 | if norm > 0: |
| 119 | array = array / norm |
| 120 | return array |
| 121 | |
| 122 | |
| 123 | def _node_embedding_text(node: Dict[str, Any]) -> str: |
no outgoing calls
no test coverage detected