Skip to content

Instantly share code, notes, and snippets.

@galenseilis
Created October 16, 2022 17:04
Show Gist options
  • Select an option

  • Save galenseilis/fdc422afef3bfc50d13196fbd6ebf999 to your computer and use it in GitHub Desktop.

Select an option

Save galenseilis/fdc422afef3bfc50d13196fbd6ebf999 to your computer and use it in GitHub Desktop.
A model which is nothing but a k-mode tensor of trainable parameters. Useful for making certain toy data sets.
class ParameterTensor(tf.keras.models.Model):
def __init__(self, shape):
super().__init__()
self.w = tf.random.normal(shape=shape)
self.w = tf.Variable(self.w, trainable=True)
def call(self, x=None):
return self.w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment