Commit ad6379a9 authored by peastman's avatar peastman
Browse files

Ensure index arrays have type int32

parent d1dd37e6
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ def cumulative_sum_minus_last(l, offset=0):
  l: list
    List of integers. Typically small counts.
  """
  return np.delete(np.insert(np.cumsum(l), 0, 0), -1) + offset
  return np.delete(np.insert(np.cumsum(l, dtype=np.int32), 0, 0), -1) + offset


def cumulative_sum(l, offset=0):
@@ -96,7 +96,7 @@ class ConvMol(object):
    ]

    # Convert to numpy array
    self.deg_block_indices = np.array(deg_block_indices)
    self.deg_block_indices = np.array(deg_block_indices, dtype=np.int32)

  def get_atoms_with_deg(self, deg):
    """Retrieves atom_features with the specific degree"""
@@ -157,7 +157,7 @@ class ConvMol(object):
      to_cat = [self.canon_adj_list[i] for i in indices]
      if len(to_cat) > 0:
        adj_list = np.vstack([self.canon_adj_list[i] for i in indices])
        self.deg_adj_lists[deg - self.min_deg] = adj_list
        self.deg_adj_lists[deg - self.min_deg] = adj_list.astype(np.int32)

      else:
        self.deg_adj_lists[deg - self.min_deg] = np.zeros(
@@ -333,7 +333,7 @@ class ConvMol(object):
        for deg in range(min_deg, max_deg + 1)
    ]

    # Update the old adjcency lists with the new atom indices and then combine
    # Update the old adjacency lists with the new atom indices and then combine
    # all together
    for deg in range(min_deg, max_deg + 1):
      row = 0  # Initialize counter