changed to array from tensor

This commit is contained in:
stuart committed 2025-12-09 17:41:01 +01:00
1 parent 98fa72b241
commit dfa5ab0849
2 files changed
+6 -4

No files matched your search

+4 -4
View File
@@ -1,15 +1,15 @@
from __future__ import annotations
from dataclasses import dataclass
import torch
import numpy as np
@dataclass(frozen=True)
class Embedding:
data: torch.Tensor
data: np.ndarray
def __post_init__(self):
if not isinstance(self.data, torch.Tensor):
raise TypeError(f"data must be a torch.Tensor, got {type(self.data)}")
if not isinstance(self.data, np.ndarray):
raise TypeError(f"data must be a numpy.ndarray, got {type(self.data)}")
def compare(self, other: Embedding) -> float:
"""
+2
View File
@@ -20,3 +20,5 @@ class Lexeme(ABC):
"""Embedding(s) associated with the lexeme."""
pass