Skip to content

Instantly share code, notes, and snippets.

@Crazz-Zaac
Created February 26, 2021 02:43
Show Gist options
  • Save Crazz-Zaac/a53af27a3e1c6f951ccb1a0da45a58fa to your computer and use it in GitHub Desktop.
Save Crazz-Zaac/a53af27a3e1c6f951ccb1a0da45a58fa to your computer and use it in GitHub Desktop.
Computing style matrix
# Style matrix is also called gram matrix. For our simplicity, we define it as gram matrix
def gram_matrix(A):
"""
Argument:
A -- matrix of shape (n_C, n_H*n_W)
Returns:
GA -- Gram matrix of A, of shape (n_C, n_C)
"""
### START CODE HERE ### (≈1 line)
GA = tf.matmul(A, tf.transpose(A))
### END CODE HERE ###
return GA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment