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

Method set_programs

physo/physym/vect_programs.py:600–615  ·  view source on GitHub ↗

Sets all programs in batch by appending tokens_idx step by step. Parameters ---------- tokens_idx : numpy.array of shape (batch_size, int <= max_time_step) of int Index of tokens making up programs in the library. If programs have different sh

(self, tokens_idx, forbid_inconsistent_units = False)

Source from the content-addressed store, hash-verified

598 return None
599
600 def set_programs (self, tokens_idx, forbid_inconsistent_units = False):
601 """
602 Sets all programs in batch by appending tokens_idx step by step.
603 Parameters
604 ----------
605 tokens_idx : numpy.array of shape (batch_size, int <= max_time_step) of int
606 Index of tokens making up programs in the library.
607 If programs have different shapes, tokens_idx must be a matrix of shape (batch_size, int <= max_time_step).
608 Tokens out of tree will be ignored.
609 forbid_inconsistent_units : bool
610 Passed to append method.
611 """
612 # Assertions will be handled by append.
613 max_size = tokens_idx.shape[1]
614 for i in range(max_size):
615 self.append(tokens_idx[:, i], forbid_inconsistent_units = forbid_inconsistent_units)
616
617 # -----------------------------------------------------------------------------------------------------------------
618 # ----------------------------------------------------- UNITS -----------------------------------------------------

Calls 1

appendMethod · 0.95