e086b02bf4d19fbdcc751bfa876d03f2fcdaf375,tf_encrypted/tensor/prime.py,PrimeFactory,constant,#PrimeFactory#Any#,250

Before Change



    def constant(self, value) -> PrimeConstant:

        if isinstance(value, (tf.Tensor, np.ndarray)):
            return PrimeConstant(value, self)

        if isinstance(value, PrimeTensor):
            assert value.modulus == self.modulus, \
                "Incompatible modulus: {}, (expected {})".format(value.modulus, self.modulus)
            return PrimeConstant(value.value, self)

        raise TypeError("Don"t know how to handle {}".format(type(value)))

    def variable(self, initial_value) -> PrimeVariable:

After Change


    def constant(self, value) -> PrimeConstant:

        if isinstance(value, np.ndarray):
            constant = tf.constant(value, dtype=self.native_type)
            return PrimeConstant(constant, self)

        raise TypeError("Don"t know how to handle {}".format(type(value)))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: mortendahl/tf-encrypted
Commit Name: e086b02bf4d19fbdcc751bfa876d03f2fcdaf375
Time: 2019-01-10
Author: mortendahlcs@gmail.com
File Name: tf_encrypted/tensor/prime.py
Class Name: PrimeFactory
Method Name: constant


Project Name: mortendahl/tf-encrypted
Commit Name: e086b02bf4d19fbdcc751bfa876d03f2fcdaf375
Time: 2019-01-10
Author: mortendahlcs@gmail.com
File Name: tf_encrypted/tensor/int32.py
Class Name: Int32Factory
Method Name: constant


Project Name: mortendahl/tf-encrypted
Commit Name: e086b02bf4d19fbdcc751bfa876d03f2fcdaf375
Time: 2019-01-10
Author: mortendahlcs@gmail.com
File Name: tf_encrypted/tensor/int64.py
Class Name: Factory
Method Name: constant