MCPcopy
hub / github.com/WassimTenachi/PhySO / fill_with_void

Method fill_with_void

physo/physym/vect_programs.py:1461–1498  ·  view source on GitHub ↗

Helper function that fills coords_dest with void invalid token. Parameters ---------- coords_dest : numpy.array of shape (2, ?) of int Coords where to fill with void, 0th array in batch dim and 1th array in time dim.

(self, coords_dest)

Source from the content-addressed store, hash-verified

1459 return None
1460
1461 def fill_with_void(self, coords_dest):
1462 """
1463 Helper function that fills coords_dest with void invalid token.
1464 Parameters
1465 ----------
1466 coords_dest : numpy.array of shape (2, ?) of int
1467 Coords where to fill with void, 0th array in batch dim and 1th array in time dim.
1468 """
1469
1470 # ------------ Index + non_positional properties ------------
1471 self.set_non_positional_from_idx (coords_dest = coords_dest, tokens_idx_src = self.invalid_idx)
1472
1473 # ------------ semi_positional properties ------------
1474 self.set_static_units_from_idx (coords_dest = coords_dest, tokens_idx_src = self.invalid_idx)
1475
1476 # ------------ Positional properties ------------
1477 # Must not be modified
1478 # self.tokens.pos
1479 # self.tokens.pos_batch
1480 # ---- Depth ----
1481 self.tokens.depth [tuple(coords_dest)] = Tok.INVALID_DEPTH # (?,) of int
1482 # ---- Family relationships ----
1483 # Token family relationships: family mask
1484 self.tokens.has_parent_mask [tuple(coords_dest)] = False # (?,) of bool
1485 self.tokens.has_siblings_mask [tuple(coords_dest)] = False # (?,) of bool
1486 self.tokens.has_children_mask [tuple(coords_dest)] = False # (?,) of bool
1487 self.tokens.has_ancestors_mask [tuple(coords_dest)] = False # (?,) of bool
1488 # Token family relationships: pos
1489 self.tokens.parent_pos [tuple(coords_dest)] = Tok.INVALID_POS # (?,) of int
1490 self.tokens.siblings_pos [tuple(coords_dest)] = Tok.INVALID_POS # (?,) of int
1491 self.tokens.children_pos [tuple(coords_dest)] = Tok.INVALID_POS # (?,) of int
1492 self.tokens.ancestors_pos [tuple(coords_dest)] = Tok.INVALID_POS # (?,) of int
1493 # Token family relationships: numbers
1494 self.tokens.n_siblings [tuple(coords_dest)] = 0 # (?,) of int
1495 self.tokens.n_children [tuple(coords_dest)] = 0 # (?,) of int
1496 self.tokens.n_ancestors [tuple(coords_dest)] = 0 # (?,) of int
1497
1498 return None
1499
1500 # -----------------------------------------------------------------------------------------------------------------
1501 # ------------------------------------------- UTILS : PROGRAM MANAGEMENT ------------------------------------------

Callers 1

move_dummiesMethod · 0.95

Calls 2

Tested by

no test coverage detected