foscat 2025.6.3__py3-none-any.whl → 2025.7.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
foscat/BkBase.py CHANGED
@@ -360,6 +360,9 @@ class BackendBase:
360
360
  # ---------------------------------------------−---------
361
361
  # -- BACKEND DEFINITION --
362
362
  # ---------------------------------------------−---------
363
+ def bk_len(self,S):
364
+ raise NotImplementedError("This is an abstract class.")
365
+
363
366
  def bk_SparseTensor(self, indice, w, dense_shape=[]):
364
367
  raise NotImplementedError("This is an abstract class.")
365
368
 
foscat/BkNumpy.py CHANGED
@@ -49,6 +49,11 @@ class BkNumpy(BackendBase.BackendBase):
49
49
  # ---------------------------------------------−---------
50
50
  # -- BACKEND DEFINITION --
51
51
  # ---------------------------------------------−---------
52
+ def bk_len(self,S):
53
+ if S is None:
54
+ return 0
55
+ return S.size
56
+
52
57
  def bk_SparseTensor(self, indice, w, dense_shape=[]):
53
58
  return self.scipy.sparse.coo_matrix(
54
59
  (w, (indice[:, 0], indice[:, 1])), shape=dense_shape
foscat/BkTensorflow.py CHANGED
@@ -89,6 +89,11 @@ class BkTensorflow(BackendBase.BackendBase):
89
89
  # ---------------------------------------------−---------
90
90
  # -- BACKEND DEFINITION --
91
91
  # ---------------------------------------------−---------
92
+ def bk_len(self,S):
93
+ if S is None:
94
+ return 0
95
+ return tf.size(S)
96
+
92
97
  def bk_SparseTensor(self, indice, w, dense_shape=[]):
93
98
  return self.backend.SparseTensor(indice, w, dense_shape=dense_shape)
94
99
 
foscat/BkTorch.py CHANGED
@@ -148,6 +148,11 @@ class BkTorch(BackendBase.BackendBase):
148
148
  # ---------------------------------------------−---------
149
149
  # -- BACKEND DEFINITION --
150
150
  # ---------------------------------------------−---------
151
+ def bk_len(self,S):
152
+ if S is None:
153
+ return 0
154
+ return S.numel()
155
+
151
156
  def bk_SparseTensor(self, indice, w, dense_shape=[]):
152
157
  return self.backend.sparse_coo_tensor(indice.T, w, dense_shape).to_sparse_csr().to(self.torch_device)
153
158