Best Python code snippet using lisa_python
dl_layers_test.py
Source:dl_layers_test.py  
...3import numpy as np4from hyperts.tests import skip_if_not_tf5@skip_if_not_tf6class Test_DL_Layers():7    def import_package(self):8        import tensorflow as tf9        from hyperts.framework.dl import layers10        return tf, layers11    def test_multicolembedding_layers(self):12        tf, layers = self.import_package()13        data = np.random.randint(100, size=(4, 3, 2))14        model = tf.keras.Sequential()15        model.add(layers.MultiColEmbedding(input_dims=[100, 100], output_dims=[4, 4]))16        output = model.predict(data)17        assert output.shape == (4, 3, 8)18    def test_weightedattention_layers(self):19        tf, layers = self.import_package()20        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2421        output = layers.WeightedAttention(timesteps=3)(data)22        assert output.shape == (4, 3, 2)23    def test_feedforwardattention_layers(self):24        tf, layers = self.import_package()25        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2426        output1 = layers.FeedForwardAttention(return_sequences=True)(data)27        output2 = layers.FeedForwardAttention(return_sequences=False)(data)28        assert output1.shape == (4, 3, 2)29        assert output2.shape == (4, 2)30    def test_autoregressive_layers(self):31        tf, layers = self.import_package()32        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2433        output = layers.AutoRegressive(order=1, nb_variables=2)(data)34        assert output.shape == (4, 2)35    def test_highway_layers(self):36        tf, layers = self.import_package()37        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2438        output = layers.Highway(nb_variables=2)(data)39        assert output.shape == (4, 2)40    def test_time2vec_layers(self):41        tf, layers = self.import_package()42        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2443        output = layers.Time2Vec(kernel_size=2)(data)44        assert output.shape == (4, 3, 4)45    def test_revin_layers(self):46        tf, layers = self.import_package()47        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2448        revin = layers.RevInstanceNormalization()49        output1 = revin(data, mode='norm')50        output2 = revin(output1, mode='denorm')51        assert output1.shape == (4, 3, 2)52        assert output2.shape == (4, 3, 2)53    def test_identify_layers(self):54        tf, layers = self.import_package()55        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2456        output = layers.Identity()(data)57        assert output.shape == (4, 3, 2)58    def test_shortcut_layers(self):59        tf, layers = self.import_package()60        data = tf.reshape(tf.range(0, 24), shape=(4, 3, 2)) / 2461        output = layers.Shortcut(filters=8)(data)62        assert output.shape == (4, 3, 8)63    def test_inceptionblock(self):64        tf, layers = self.import_package()65        data = tf.random.normal(shape=(4, 8, 2))66        kernel_size_list = (1, 2, 3, 5, 12)67        kernel_size_list = list(filter(lambda x: x < 8, kernel_size_list))68        output = layers.InceptionBlock(filters=8,69                                       kernel_size_list=kernel_size_list,70                                       bottleneck_size=8)(data)...conditional_functions.py
Source:conditional_functions.py  
1"""Java function implementations for conditional opperations."""2from ..java_function import ExistingJavaFunction3ATOTI_OPERATOR_PACKAGE = "io.atoti.udaf.operators"4EQ_FUNCTION = ExistingJavaFunction(5    "ConditionalOperator.eq",6    import_package=ATOTI_OPERATOR_PACKAGE,7)8NEQ_FUNCTION = ExistingJavaFunction(9    "ConditionalOperator.neq",10    import_package=ATOTI_OPERATOR_PACKAGE,11)12GT_FUNCTION = ExistingJavaFunction(13    "ConditionalOperator.gt",14    import_package=ATOTI_OPERATOR_PACKAGE,15)16GTE_FUNCTION = ExistingJavaFunction(17    "ConditionalOperator.gte",18    import_package=ATOTI_OPERATOR_PACKAGE,19)20LT_FUNCTION = ExistingJavaFunction(21    "ConditionalOperator.lt",22    import_package=ATOTI_OPERATOR_PACKAGE,23)24LTE_FUNCTION = ExistingJavaFunction(25    "ConditionalOperator.lte",26    import_package=ATOTI_OPERATOR_PACKAGE,...import.py
Source:import.py  
1import import_package.bar2import import_package.foo3import import_package.baz as baz_alias4from import_package.qux import Qux5from import_package.quux import Quux as Xuuq6from import_package import sub_package7baz_alias ## type baz8import_package ## type import_package9sub_package ## type sub_package10import_package.foo ## type foo11import_package.bar ## type bar12x1 = baz_alias13x2 = import_package.bar14x1 ## type baz15x2 ## type bar16x = baz_alias.Baz()17x ## type Baz18print x.path()19q = Qux()20q ## type Qux21aq = Xuuq()...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
