x2a_plus_xb_plus_c: add the three terms together.If you see an error saying InvalidArgumentError: Matrix size-incompatible, please check the order of the matrix multiplication to make sure that the matrix dimensions line up.The steps are broken down for clarity, but you can also perform this calculation in fewer lines if you prefer. The following section performs the multiplication x^2 a + xb + c. self.c: create a tensor using tf.Variable, and set the parameters initial_value and trainable.This expects a tuple, and remember that a tuple (9,) includes a comma. shape: This will be a vector equal to the number of units.c_init_val: Set this by calling the tf.zeros_initializer that you just instantiated, and set the shape and dtype.c_init: set this to tf.zeros_initializer.Self.a: create a tensor using tf.Variable, setting the initial_value and set trainable to True.ī_init, b_init_val, and self.b: these will be set in the same way that you implemented a_init, a_init_val and self.a This is because you'll be matrix multiplying x^2 * a, so the dimensions should be compatible.The shape of a should have its row dimension equal to the last dimension of input_shape, and its column dimension equal to the number of units in the layer.a_init_val: Use the random_normal_initializer() that you just created and invoke it, setting the shape and dtype.a_init: set this to tensorflow's random_normal_initializer().Either way, you'll want to set self.a, self.b and self.c. If you prefer to use fewer lines to implement it, feel free to do so. The following are suggested steps for writing your code. To get the tensorflow object associated with the string, please use tf.()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |