Created
May 23, 2020 03:08
-
-
Save cedricconol/098f8f51fd00ade42de09f26761f8e0b to your computer and use it in GitHub Desktop.
Linear regression TF2 init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleLinearRegression: | |
def __init__(self, initializer='random'): | |
if initializer=='ones': | |
self.var = 1. | |
elif initializer=='zeros': | |
self.var = 0. | |
elif initializer=='random': | |
self.var = tf.random.uniform(shape=[], minval=0., maxval=1.) | |
self.m = tf.Variable(1., shape=tf.TensorShape(None)) | |
self.b = tf.Variable(self.var) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment