Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated instances of np.int were replaced with np.int32 #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utime/models/utime.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def crop_nodes_to_match(self, node1, node2):

if np.any(s1 != s2):
self.n_crops += 1
c = (s1 - s2).astype(np.int)
c = (s1 - s2).astype(np.int32)
cr = np.array([c // 2, c // 2]).flatten()
cr[self.n_crops % 2] += c % 2
cropped_node1 = Cropping2D([list(cr), [0, 0]])(node1)
Expand Down
2 changes: 1 addition & 1 deletion utime/sequences/base_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def get_class_counts(self):
An ndarray of class counts across all stored SleepStudy objects
Shape [self.n_classes], dtype np.int
"""
counts = np.zeros(shape=[self.n_classes], dtype=np.int)
counts = np.zeros(shape=[self.n_classes], dtype=np.int32)
for im in self.dataset_queue:
count_dict = im.get_class_counts(as_dict=True)
for cls, count in count_dict.items():
Expand Down
2 changes: 1 addition & 1 deletion utime/sequences/multi_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def total_periods(self):

def get_class_counts(self):
""" Returns the sum of class counts over all sequences """
counts = np.zeros(shape=[self.sequences[0].n_classes], dtype=np.int)
counts = np.zeros(shape=[self.sequences[0].n_classes], dtype=np.int32)
for seq in self.sequences:
counts += seq.get_class_counts()
return counts
Expand Down
6 changes: 3 additions & 3 deletions utime/utils/conv_arithmetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def output_features(in_filter_size, padding, kernel_size, stride=1, dim=2):
stride],
dim=dim)

return np.floor((in_filter_size + (2*padding) - kernel_size)/stride).astype(np.int) + 1
return np.floor((in_filter_size + (2*padding) - kernel_size)/stride).astype(np.int32) + 1


def output_feature_distance(input_feature_distance, stride, dim=2):
Expand Down Expand Up @@ -82,9 +82,9 @@ def compute_receptive_fields(layers, verbose=False):

# Get potential dilation rates
try:
dilation = np.array(layer.dilation_rate).astype(np.int)
dilation = np.array(layer.dilation_rate).astype(np.int32)
except AttributeError:
dilation = np.ones(shape=[dim], dtype=np.int)
dilation = np.ones(shape=[dim], dtype=np.int32)
if hasattr(layer, "dilations"):
assert (dilation == 1).all()
dilation = np.array(layer.dilations)
Expand Down
2 changes: 1 addition & 1 deletion utime/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_free_gpus(max_allowed_mem_usage=400):
try:
# Get list of GPUs
gpu_list = check_output(["nvidia-smi", "-L"], universal_newlines=True)
gpu_ids = np.array(re.findall(r"GPU[ ]+(\d+)", gpu_list), dtype=np.int)
gpu_ids = np.array(re.findall(r"GPU[ ]+(\d+)", gpu_list), dtype=np.int32)

# Query memory usage stats from nvidia-smi
output = check_output(["nvidia-smi", "-q", "-d", "MEMORY"], universal_newlines=True)
Expand Down