This issue comes from a Codex global repository scan.
Problem
Batch.num_graphs calls self.ptr.numel(), but this NumPy batch implementation stores ptr as a NumPy array:
|
@property |
|
def num_graphs(self) -> int: |
|
"""Returns the number of graphs in the batch.""" |
|
if self.__num_graphs__ is not None: |
|
return self.__num_graphs__ |
|
elif self.ptr is not None: |
|
return self.ptr.numel() - 1 |
|
elif self.batch is not None: |
|
return int(self.batch.max()) + 1 |
NumPy arrays do not have .numel(), so Batch(ptr=np.array([0, 2, 5])).num_graphs raises AttributeError.
Suggested fix
Use a NumPy/Python length API, for example:
This issue comes from a Codex global repository scan.
Problem
Batch.num_graphscallsself.ptr.numel(), but this NumPy batch implementation storesptras a NumPy array:dftio/dftio/data/batch_np.py
Lines 275 to 283 in c9d128f
NumPy arrays do not have
.numel(), soBatch(ptr=np.array([0, 2, 5])).num_graphsraisesAttributeError.Suggested fix
Use a NumPy/Python length API, for example: