def test_crop_type3_infer_neg2(self): graph = self._create_graph_type3() crop_node = Node(graph, 'crop_node') crop_node['axis'] = None Crop.infer(crop_node) self.assertIsNone(crop_node.out_node().shape)
def test_crop_type2_infer_neg1(self): graph = self._create_graph_type2() crop_node = Node(graph, 'crop_node') crop_node['dim'] = int64_array([1, 2, 3]) Crop.infer(crop_node) self.assertIsNone(crop_node.out_node().shape)
def test_crop_type3_infer_neg4(self): graph = self._create_graph_type3() crop_node = Node(graph, 'crop_node') crop_input2 = Node(graph, 'crop_input2') crop_input2.shape = int64_array([1, 4, 423, 563]) with self.assertRaisesRegex(Error, "The crop for dimension is out of bounds.*"): Crop.infer(crop_node)
def test_crop_type3_infer_neg1(self): graph = self._create_graph_type3() crop_node = Node(graph, 'crop_node') crop_input2 = Node(graph, 'crop_input2') crop_input2.shape = None with self.assertRaisesRegex(Error, "Not all input shapes were defined.*"): Crop.infer(crop_node)
def test_crop_type2_infer_neg2(self): graph = self._create_graph_type2() crop_node = Node(graph, 'crop_node') crop_node['dim'] = None crop_node['crop_begin'] = None with self.assertRaisesRegex(Error, "Crop node crop_node should have either.*"): Crop.infer(crop_node)
def test_crop_type3_infer_neg4(self): graph = self._create_graph_type3() crop_node = Node(graph, 'crop_node') crop_input2 = Node(graph, 'crop_input2') crop_input2.shape = int64_array([1, 4, 423, 563]) Crop.infer(crop_node) self.assertIsNone(crop_node.out_node().shape)
def test_crop_type2_infer_neg2(self): graph = self._create_graph_type2() crop_node = Node(graph, 'crop_node') crop_node['dim'] = None crop_node['crop_begin'] = None Crop.infer(crop_node) self.assertIsNone(crop_node.out_node().shape)
def test_crop_type2_infer(self): graph = self._create_graph_type2() crop_node = Node(graph, 'crop_node') Crop.infer(crop_node) exp_shape = int64_array([1, 3, 100, 150]) res_shape = graph.node['crop_output']['shape'] self.assertTrue(np.array_equal(exp_shape, res_shape), 'shapes do not match expected: {} and given: {}'.format(exp_shape, res_shape))