How to use test_same method in avocado

Best Python code snippet using avocado_python

downsample_test.py

Source:downsample_test.py Github

copy

Full Screen

...7import treeano8import treeano.nodes as tn9fX = theano.config.floatX10def test_pool_output_shape_2d():11 def test_same(input_shape, local_sizes, strides, pads, ignore_border):12 res = tn.downsample.pool_output_shape(13 input_shape,14 (2, 3),15 local_sizes,16 strides,17 pads,18 ignore_border,19 )20 from theano.tensor.signal.downsample import max_pool_2d21 ans = max_pool_2d(22 T.constant(np.random.randn(*input_shape).astype(fX)),23 ds=local_sizes,24 st=strides,25 ignore_border=ignore_border,26 padding=pads,27 ).shape.eval()28 print(ans, res)29 np.testing.assert_equal(ans, res)30 # tests w/ ignore border31 test_same((1, 1, 5, 6), (2, 3), (1, 1), (0, 0), True)32 test_same((1, 1, 5, 6), (2, 3), (2, 2), (0, 0), True)33 test_same((1, 1, 1, 1), (2, 3), (2, 2), (0, 0), True)34 test_same((1, 1, 5, 6), (2, 3), (1, 1), (0, 1), True)35 test_same((1, 1, 5, 6), (2, 3), (2, 2), (1, 0), True)36 test_same((1, 1, 1, 1), (2, 3), (2, 2), (1, 1), True)37 # tests w/o ignore border, and stride <= pool_size38 test_same((1, 1, 5, 6), (2, 3), (1, 1), (0, 0), False)39 test_same((1, 1, 5, 6), (2, 3), (2, 2), (0, 0), False)40 test_same((1, 1, 1, 1), (2, 3), (2, 2), (0, 0), False)41 # tests w/o ignore border, and stride > pool_size42 test_same((1, 1, 5, 6), (2, 3), (3, 3), (0, 0), False)43 test_same((1, 1, 5, 6), (2, 3), (3, 3), (0, 0), False)44 test_same((1, 1, 1, 1), (2, 3), (3, 3), (0, 0), False)45def test_pool_output_shape_3d():46 def test_same(input_shape, local_sizes, strides, pads, ignore_border, ans):47 res = tn.downsample.pool_output_shape(48 input_shape,49 (2, 3, 4),50 local_sizes,51 strides,52 pads,53 ignore_border,54 )55 print(ans, res)56 np.testing.assert_equal(ans, res)57 test_same((1, 1, 2, 2, 2), (2, 2, 2), (2, 2, 2), (0, 0, 0), False,58 ans=(1, 1, 1, 1, 1))59def test_pool_output_shape_custom_pool_2d_node():60 def test_same(input_shape, local_sizes, strides, pads, ignore_border):61 res = tn.downsample.pool_output_shape(62 input_shape,63 (2, 3),64 local_sizes,65 strides,66 pads,67 ignore_border,68 )69 # pool2d node assumes 0 padding70 assert pads == (0, 0)71 # pool2d node assumes ignoring border72 assert ignore_border73 network = tn.SequentialNode(74 "s",75 [tn.ConstantNode("c",76 value=np.random.randn(*input_shape).astype(fX)),77 tn.CustomPool2DNode("p",78 pool_function=T.mean,79 pool_size=local_sizes,80 stride=strides,81 )]82 ).network()83 ans = network["p"].get_vw("default").variable.shape.eval()84 print(ans, res)85 np.testing.assert_equal(ans, res)86 test_same((3, 4, 5, 6), (2, 3), (1, 1), (0, 0), True)87 test_same((3, 4, 5, 6), (2, 3), (2, 2), (0, 0), True)88 test_same((3, 4, 1, 1), (2, 3), (2, 2), (0, 0), True)89def test_feature_pool_node_serialization():90 tn.check_serialization(tn.FeaturePoolNode("a"))91def test_maxout_node_serialization():92 tn.check_serialization(tn.MaxoutNode("a"))93def test_custom_pool_2d_node_serialization():94 tn.check_serialization(tn.CustomPool2DNode("a"))95def test_mean_pool_2d_node_serialization():96 tn.check_serialization(tn.MeanPool2DNode("a"))97def test_global_pool_node_serialization():98 tn.check_serialization(tn.CustomGlobalPoolNode("a"))99def test_maxout_hyperparameters():100 nt.assert_equal(101 set(tn.FeaturePoolNode.hyperparameter_names),102 set(tn.MaxoutNode.hyperparameter_names + ("pool_function",)))...

Full Screen

Full Screen

6-max_integer_test.py

Source:6-max_integer_test.py Github

copy

Full Screen

...21 self.assertIs(list, list)22 def test_equal(self):23 self.assertEqual(max_integer([2, 2, 2, 2]), 2)24 self.assertEqual(max_integer([1, 1, 1, 1]), 1)25 def test_same(self):26 self.assertEqual(max_integer([2, 3, 1, 3]), 3)27 self.assertEqual(max_integer([1, 0.0, 0.5, 1]), 1)28 def test_same(self):29 self.assertEqual(max_integer([2, 3, 1, 3]), 3)30 self.assertEqual(max_integer([1, 0.0, 0.5, 1]), 1)31 def test_same(self):32 self.assertEqual(max_integer([2]), 2)33 self.assertEqual(max_integer([1]), 1)34 def test_same(self):35 self.assertEqual(max_integer([2]), 2)36 self.assertEqual(max_integer([1]), 1)37 def test_string(self):38 self.assertEqual(max_integer(['d', 'e', 'm']), 'm')39 def test_diferent(self):40 with self.assertRaises(TypeError):41 max_integer(['r', 5, 2])42 def test_n(self):43 with self.assertRaises(TypeError):44 max_integer([None, 4])45if __name__ == '__main__':...

Full Screen

Full Screen

manual.py

Source:manual.py Github

copy

Full Screen

...5import a.b.test_same6import b.test_same7from pathlib import Path8print(str(Path('a/test_same.py')), end=' ')9a.test_same.test_same(a.conftest.fixture_a.__wrapped__())10print('.')11print(str(Path('a/b/test_same.py')), end=' ')12a.b.test_same.test_same(a.conftest.fixture_a.__wrapped__(), a.b.conftest.fixture_a_b.__wrapped__())13print('.')14print(str(Path('b/test_same.py')), end=' ')15b.test_same.test_same(b.conftest.fixture_b.__wrapped__())...

Full Screen

Full Screen

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 avocado 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