Skip to content

Commit

Permalink
Merge pull request #68 from kc-ml2/DEV/main
Browse files Browse the repository at this point in the history
update modeling.py in TorchMeent for vector modeling.
  • Loading branch information
yonghakim authored May 1, 2024
2 parents b60448f + f3a86f6 commit 1373042
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions meent/on_torch/modeler/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def __init__(self, period=None, *args, **kwargs):
self.ucell_info_list = None
self.period = period

self.film_layer = None

def film(self):
return []

@staticmethod
def rectangle_no_approximation(cx, cy, lx, ly, base):

Expand Down Expand Up @@ -546,8 +551,6 @@ def ellipse(self, cx, cy, lx, ly, n_index, angle=0, n_split_w=2, n_split_h=2, an
right_array.append(points_contour_rot[:, y_highest_index])
elif left_y < right_y:
left_array.append(points_contour_rot[:, y_highest_index])
else:
raise ValueError # TODO

for i in range(points_contour_rot.shape[1]//2):
left_array.append(points_contour_rot[:, (y_highest_index+i+1) % points_contour_rot.shape[1]])
Expand Down Expand Up @@ -690,9 +693,9 @@ def vector(self, layer_info, x64=True):
col_list.insert(index, bottom_right[1])

if not row_list or row_list[-1] != self.period[1]:
row_list.append(self.period[1].reshape(1))
row_list.append(self.period[1].reshape(1).type(datatype))
if not col_list or col_list[-1] != self.period[0]:
col_list.append(self.period[0].reshape(1))
col_list.append(self.period[0].reshape(1).type(datatype))

if row_list and row_list[0] == 0:
row_list = row_list[1:]
Expand Down Expand Up @@ -727,10 +730,13 @@ def vector(self, layer_info, x64=True):

def draw(self, layer_info_list):
ucell_info_list = []
self.film_layer = torch.zeros(len(layer_info_list))

for layer_info in layer_info_list:
for i, layer_info in enumerate(layer_info_list):
ucell_layer, x_list, y_list = self.vector(layer_info)
ucell_info_list.append([ucell_layer, x_list, y_list])
if len(x_list) == len(y_list) == 1:
self.film_layer[i] = 1
self.ucell_info_list = ucell_info_list
return ucell_info_list

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
setup(
name='meent',
version='0.9.9',
version='0.9.10',
url='https://github.com/kc-ml2/meent',
author='KC ML2',
author_email='yongha@kc-ml2.com',
Expand Down

0 comments on commit 1373042

Please sign in to comment.