41c99fbf385a8c875fb6181ce7301e4bc218535b,autokeras/keras_layers.py,CategoricalEncoding,call,#CategoricalEncoding#Any#,58

Before Change


        for index in range(len(self.encoding)):
            col = tf.slice(inputs, [0, index], [-1, 1])
            if self.encoding[index] in [INT, ONE_HOT]:
                col = self.tables[str(index)].lookup(col)
                col = tf.cast(col, tf.float32)
            else:
                col = tf.strings.to_number(col, tf.float32)
            outputs.append(col)

After Change



    def call(self, inputs):
        input_nodes = nest.flatten(inputs)[0]
        split_inputs = tf.split(input_nodes, [1] * len(self.encoding), axis=-1)
        output_nodes = []
        for input_node, encoding_layer in zip(split_inputs, self.encoding_layers):
            if encoding_layer is None:
                output_nodes.append(tf.strings.to_number(input_node, tf.float32))
            else:
                output_nodes.append(tf.cast(encoding_layer(input_node), tf.float32))
        return tf.keras.layers.Concatenate()(output_nodes)

    def adapt(self, data):
        for index, encoding_layer in enumerate(self.encoding_layers):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: jhfjhfj1/autokeras
Commit Name: 41c99fbf385a8c875fb6181ce7301e4bc218535b
Time: 2020-04-18
Author: jhfjhfj1@gmail.com
File Name: autokeras/keras_layers.py
Class Name: CategoricalEncoding
Method Name: call


Project Name: google/language-resources
Commit Name: d27dc7e0e3f76b021e5cff2d63466c415d4b3f74
Time: 2017-11-12
Author: mjansche@google.com
File Name: utils/icu_util.py
Class Name:
Method Name: TestRulesInteractively


Project Name: HyperGAN/HyperGAN
Commit Name: 447b80b6ac30f5f0efe3d7f8d543bfb04fca7029
Time: 2018-02-26
Author: mikkel@255bits.com
File Name: examples/common.py
Class Name: Custom2DGenerator
Method Name: create