Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Pass compute_dirns as keyword instead of positional argument #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dft_ccas.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2016 Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -23,15 +23,15 @@
and computes the cca similarity between them. The results are exact
when the dataset over which correlations are computed is translation invariant.

However, due to the strided nature of convolutional and pooling layers, image
However, due to the strided nature of convolutional and pooling layers, image
datasets are close to translation invariant, and very good results can still
be achieved without taking correlations over a translation invariant dataset.

See https://arxiv.org/abs/1706.05806 for details.

This function can also be used to compute cca similarity between conv
layers and fully connected layers (or neurons). We may want to compare
similarity between convolutional feature maps at a layer and a particular class.
similarity between convolutional feature maps at a layer and a particular class.
Again assuming
translation invariance of the original dataset, the fourier_ccas function can
be used for this (reshaping the vector to be (dataset_size, 1, 1, 1)), and will
Expand Down Expand Up @@ -143,7 +143,7 @@ def fourier_ccas(conv_acts1, conv_acts2, return_coefs=False,
for i in xrange(height):
for j in xrange(width):
results_dict = cca_core.get_cca_similarity(
fft_acts1[:, i, j, :].T, fft_acts2[:, i, j, :].T, compute_dirns,
fft_acts1[:, i, j, :].T, fft_acts2[:, i, j, :].T, compute_dirns=compute_dirns,
verbose=verbose)

# apply inverse FFT to get coefficients and directions if specified
Expand Down