def render(self, is_lock): bimpy.indent(10) bimpy.text('- Plane') bimpy.same_line() bimpy_tools.help_marker( 'generate with random points\n' \ '* plane random: random on whole plane\n' \ '* balanced random: balanced positive and negative samples' ) bimpy.push_item_width(140) if bimpy.begin_combo('strategy##plane_random_generator', self._select_strategy): for item in self._strategy_list: is_selected = bimpy.Bool(self._select_strategy == item) if bimpy.selectable(item, is_selected) and not is_lock: self._select_strategy = item if is_selected.value: bimpy.set_item_default_focus() bimpy.end_combo() bimpy.pop_item_width() bimpy.unindent(10)
def render(self, is_lock): bimpy.indent(10) bimpy.text('- Linear layer init') bimpy.same_line() bimpy_tools.help_marker( 'Initializer used in torch.nn.Linear, use Kaiming uniform') bimpy.push_item_width(120) flags = bimpy.InputTextFlags.EnterReturnsTrue if is_lock: flags |= bimpy.InputTextFlags.ReadOnly if bimpy.input_float('a##sgd_optimizer', self._a, flags=flags): self._a.value = max(0.0, self._a.value) if bimpy.begin_combo('mode##linear_layer_init', self._select_mode): for item in self._mode_list: is_selected = bimpy.Bool(self._select_mode == item) if bimpy.selectable(item, is_selected) and not is_lock: self._select_mode = item if is_selected.value: bimpy.set_item_default_focus() bimpy.end_combo() if bimpy.begin_combo('nonlinearity##linear_layer_init', self._select_nonlinearity): for item in self._nonlinearity_list: is_selected = bimpy.Bool(self._select_nonlinearity == item) if bimpy.selectable(item, is_selected) and not is_lock: self._select_nonlinearity = item if is_selected.value: bimpy.set_item_default_focus() bimpy.end_combo() bimpy.pop_item_width() bimpy.unindent(10)
def render(self, is_lock): bimpy.set_next_tree_node_open(True, bimpy.Condition.FirstUseEver) if not bimpy.tree_node('optimizer##optimizer_component'): return if bimpy.begin_combo('select##optimizer_component', self._select_optimizer): for item in self._optimizer_list: is_selected = bimpy.Bool(self._select_optimizer == item) if bimpy.selectable(item, is_selected) and not is_lock: self._select_optimizer = item if is_selected.value: bimpy.set_item_default_focus() bimpy.end_combo() self._optimizer_map[self._select_optimizer].render(is_lock) bimpy.tree_pop()
def render(self, is_lock): bimpy.indent(10) bimpy.text('- MSE loss') bimpy.same_line() bimpy_tools.help_marker('torch.nn.MSELoss') bimpy.push_item_width(120) if bimpy.begin_combo('reduction##mse_loss_fn', self._select_redution): for item in self._reduction_list: is_selected = bimpy.Bool(self._select_redution == item) if bimpy.selectable(item, is_selected) and not is_lock: self._select_redution = item if is_selected.value: bimpy.set_item_default_focus() bimpy.end_combo() bimpy.pop_item_width() bimpy.unindent(10)
def render(self, is_lock): bimpy.indent(10) bimpy.text('- Raw Point') bimpy.same_line() bimpy_tools.help_marker('generate with raw points') bimpy.push_item_width(120) if bimpy.begin_combo('strategy##raw_point_generator', self._select_strategy): for item in self._strategy_list: is_selected = bimpy.Bool(self._select_strategy == item) if bimpy.selectable(item, is_selected) and not is_lock: self._select_strategy = item if is_selected.value: bimpy.set_item_default_focus() bimpy.end_combo() bimpy.pop_item_width() bimpy.unindent(10)
bimpy.text(server.context()) pass except Exception as e: bimpy.text(str(e)) bimpy.begin("Client") if bimpy.begin_combo("Source", sel_str): lst = syphonpy.ServerDirectory.servers() for k in lst: if bimpy.selectable(k.name + " : " + k.app_name): client = syphonpy.SyphonClient(k) sel_str = k.name + " : " + k.app_name bimpy.end_combo() _tex = 0 if client: # _tex = glGenTextures(1) img = client.new_frame_image() # glBindTexture(GL_TEXTURE_2D, _tex) # print(img) pass if img and img.texture_size().width and img.texture_size().height: # # try: # arbTexture = glGenTextures(1) #