Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added atrous_conv1d and 3d. Refactored 2d. #7545

Merged
merged 6 commits into from
May 2, 2017

Commits on Feb 16, 2017

  1. Added atrous_conv1d and 3d. Refactored 2d.

    This commit makes following changes:
    * deleted most atrous_conv2d code to reuse existing tf.nn.convolution function
    * added atrous_conv1d and atrous_conv3d with similar API as atrous_conv2d
    * Added support for variable rate per dimension, e.g. for atrous_conv2d
      rate=2, or rate=[2,1] does different things. Former is equal to
      rate=[2,2]. rate_i determines dilation_rate in dimension i.
    * added strides support with same API as in tf.nn.convolution function
    
    This commit makes more code deletions then additions. However
    documentation per function makes it appear large.
    
    Test Plan:
    
    Some simple tests to verify I haven't screwed something up:
    
    ```
    A = np.array([1, 2, 3, 4, 5, 6], dtype=np.float32).reshape(1, 6, 1)
    print(A)
    
    kernel = np.array([100, 10, 1], dtype=np.float32).reshape(3, 1, 1)
    
    with tf.Session() as sess:
        print(sess.run(tf.nn.atrous_conv1d(A, kernel, padding='SAME', rate=[2])))
    ```
    
    ```
    B = np.arange(16, dtype=np.float32).reshape(1, 4, 4, 1)
    kernel = np.array([1000, 100, 10, 1.0], dtype=np.float32).reshape(2, 2, 1, 1)
    
    with tf.Session() as sess:
        a = sess.run(tf.nn.convolution(B, kernel, padding='SAME', dilation_rate=np.array([2, 2])))
        b = sess.run(tf.nn.atrous_conv2d(B, kernel, rate=2, padding='SAME'))
        print(np.allclose(a, b))
        print(a)
        print(b)
    ```
    
    ```
    C = np.arange(4**3, dtype=np.float32).reshape(1, 4, 4, 4, 1)
    kernel = (10**np.arange(8, 0, -1, dtype=np.float32)).reshape(2, 2, 2, 1, 1)
    
    with tf.Session() as sess:
        a = sess.run(tf.nn.conv3d(C, kernel, strides=[1, 1,1,1,1], padding='SAME'))
        b = sess.run(tf.nn.atrous_conv3d(C, kernel, rate=1, padding='SAME'))
        print(np.allclose(a, b))
        print(a)
        print(b)
    ```
    
    Also running atrous_conv2d unit tests to verify backward compatibility.
    nmiculinic committed Feb 16, 2017
    Configuration menu
    Copy the full SHA
    6e11066 View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2017

  1. Configuration menu
    Copy the full SHA
    6d182be View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2017

  1. Implemented suggestions.

    Deleted atrous_conv1d and atrous_conv3d.
    Added note in documentation for atrous_conv2d that convolution should be
    used instead.
    nmiculinic committed Apr 7, 2017
    1 Configuration menu
    Copy the full SHA
    2c08ba7 View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2017

  1. Configuration menu
    Copy the full SHA
    bd8fef2 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2017

  1. Configuration menu
    Copy the full SHA
    443ae29 View commit details
    Browse the repository at this point in the history

Commits on May 1, 2017

  1. Fix undefined strides

    Vijay Vasudevan committed May 1, 2017
    Configuration menu
    Copy the full SHA
    2cd78a9 View commit details
    Browse the repository at this point in the history