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

Before Change


    def call(self, inputs):
        inputs = nest.flatten(inputs)[0]
        outputs = []
        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)
        outputs = tf.concat(outputs, axis=-1)
        outputs.set_shape(inputs.shape)
        return outputs

After Change


        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: 3

Non-data size: 6

Instances


Project Name: keras-team/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: keras-team/keras
Commit Name: c9642571c23004a10e8bca1a5b1446af399f80db
Time: 2016-02-16
Author: francois.chollet@gmail.com
File Name: keras/callbacks.py
Class Name: History
Method Name: on_batch_end


Project Name: NifTK/NiftyNet
Commit Name: 453269872f7e4dc9a6dc81a1c758ffc365cfc312
Time: 2017-05-22
Author: wenqi.li@ucl.ac.uk
File Name: utilities/constraints_classes.py
Class Name: ConstraintSearch
Method Name: create_list_from_constraint