How to use _create_sub method in localstack

Best Python code snippet using localstack_python

RetinaNetFilteredDetectionsReplacement.py

Source: RetinaNetFilteredDetectionsReplacement.py Github

copy

Full Screen

...33 equal to "caffe.PriorBoxParameter.CORNER" produces the same result as the post-processing in the original topology.34 """35 replacement_id = 'RetinaNetFilteredDetectionsReplacement'36 @staticmethod37 def _create_sub(graph: nx.MultiDiGraph, input_1: Node, port_1: int, input_2: Node, port_2: int):38 negate = Power(graph, dict(scale=-1, name=input_2.name + '/​negate_'))39 add = Eltwise(graph, dict(operation='sum', name=input_1.name + '/​add_'))40 out_node = add.create_node([(input_1, port_1), negate.create_node([(input_2, port_2)])])41 return out_node42 def output_edges_match(self, graph: nx.DiGraph, match: SubgraphMatch, new_sub_graph: dict):43 return {match.output_node(0)[0].id: new_sub_graph['detection_output_node'].id}44 def nodes_to_remove(self, graph: nx.MultiDiGraph, match: SubgraphMatch):45 new_nodes_to_remove = match.matched_nodes_names()46 new_nodes_to_remove.remove(match.single_input_node(0)[0].id)47 new_nodes_to_remove.remove(match.single_input_node(1)[0].id)48 new_nodes_to_remove.remove(match.single_input_node(2)[0].id)49 return new_nodes_to_remove50 def generate_sub_graph(self, graph: nx.MultiDiGraph, match: SubgraphMatch):51 reshape_classes_op = Reshape(graph, {'dim': np.array([0, -1])})52 reshape_classes_node = reshape_classes_op.create_node([match.single_input_node(1)[0]],53 dict(name='do_reshape_classes'))54 priors_node = match.single_input_node(2)[0]55 placeholder = [Node(graph, node_id) for node_id in graph.nodes() if Node(graph, node_id).op == 'Placeholder'][0]56 im_height = placeholder.shape[1]57 im_width = placeholder.shape[2]58 # scale prior boxes to the [0, 1] interval59 priors_scale_const_node = Const(graph, {'value': np.array([1 /​ im_width,60 1 /​ im_height,61 1 /​ im_width,62 1 /​ im_height])}).create_node([])63 priors_scale_node = Eltwise(graph, {'name': 'scale_priors', 'operation': 'mul'}).create_node(64 [priors_node, priors_scale_const_node])65 # calculate prior boxes widths and heights66 split_node = SplitV(graph, {'axis': 2, 'size_splits': [1, 1, 1, 1]}).create_node([priors_scale_node])67 priors_width_node = __class__._create_sub(graph, split_node, 2, split_node, 0)68 priors_height_node = __class__._create_sub(graph, split_node, 3, split_node, 1)69 # concat weights and heights into a single tensor and multiple with the box coordinates regression values70 concat_width_height_node = Concat(graph, {'name': 'concat_priors_width_height', 'axis': -1}).create_node(71 [priors_width_node, priors_height_node, priors_width_node, priors_height_node])72 applied_width_height_regressions_node = Eltwise(graph, {'name': 'final_regressions', 'operation': 'mul'}). \73 create_node([concat_width_height_node, match.single_input_node(0)[0]])74 # reshape to 2D tensor as Inference Engine Detection Output layer expects75 reshape_regression_op = Reshape(graph, {'dim': np.array([0, -1])})76 reshape_regression_node = reshape_regression_op.create_node([applied_width_height_regressions_node],77 {'name': 'reshape_regression'})78 detection_output_op = DetectionOutput(graph, match.custom_replacement_desc.custom_attributes)79 detection_output_op.attrs['old_infer'] = detection_output_op.attrs['infer']80 detection_output_op.attrs['infer'] = __class__.do_infer81 detection_output_node = detection_output_op.create_node(82 [reshape_regression_node, reshape_classes_node, priors_scale_node],...

Full Screen

Full Screen

menu.py

Source: menu.py Github

copy

Full Screen

...19 def _close_sub_janel(self):20 self.sub_window.destroy()21 self.sub_window = None22 self.sub_menu = None23 def _create_sub(self, text, function):24 if self.sub_window is not None:25 self.sub_window.lift()26 else:27 self.sub_window = front_page("200x200", self._close_sub_janel, self)28 self.sub_menu = SubMenu(text, function, self.sub_window)29 def _button_create(self):30 self._create_sub((31 "Create Room",32 "Name Player: ",33 "Name Room: ",34 "Password: "35 ), self.intergame.game_to_server.create_room)36 def _button_enter(self):37 self._create_sub((38 "Enter Room",39 "Name Player: ",40 "Id Room: ",41 "Password: "42 ), self.intergame.game_to_server.enter_room)43 def destroy(self):44 if self.sub_window is not None:45 self.sub_window.destroy()46 self.label = self.button_create = self.button_enter \47 = self.sub_window = self.sub_menu = None...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful