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

Periodic-boundary padding for tensors #57672

Open
Jverduzc opened this issue Sep 12, 2022 · 10 comments
Open

Periodic-boundary padding for tensors #57672

Jverduzc opened this issue Sep 12, 2022 · 10 comments
Labels
comp:ops OPs related issues stat:contribution welcome Status - Contributions welcome TF 2.10 type:feature Feature requests

Comments

@Jverduzc
Copy link

Jverduzc commented Sep 12, 2022

Click to expand!

Issue Type

Feature Request

Source

binary

Tensorflow Version

2.10

Custom Code

No

OS Platform and Distribution

No response

Mobile device

No response

Python version

3.9

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

This issue is to request a feature for padding with "wrap", narrowing down suggestions from Issue #956 (https://github.com/tensorflow/tensorflow/issues/956).

This mode of padding is included as an option in numpy.pad()
https://docs.scipy.org/doc/numpy/reference/generated/numpy.pad.html

It would be very beneficial for applications that require periodic boundary conditions, in particular for physics-based calculations.

Standalone code to reproduce the issue

# From the original issue:

import numpy
matrix = numpy.arange(25).reshape(5,5)
paddings = [[1,1],[1,1]]
# periodic boundary conditions
padded_matrix = numpy.pad(matrix, pad_width=paddings, mode='wrap')

Relevant log output

No response

@google-ml-butler google-ml-butler bot added the type:feature Feature requests label Sep 12, 2022
@sushreebarsa sushreebarsa added comp:ops OPs related issues TF 2.10 labels Sep 13, 2022
@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Sep 20, 2022
@cantonios
Copy link
Contributor

Just to confirm, we're talking specifically about tf.pad?

@Jverduzc
Copy link
Author

Yes, I want to use this operation in combination with the 'valid' padding. It would be great to have it implemented as an option in Conv2D or Conv3D if possible.

@cantonios
Copy link
Contributor

Those are two separate things. Adding an option to tf.pad is relatively straightforward. Adding to all convolutions is a whole other beast which requires changing our APIs - our current convolution API doesn't have separate padding and padding_mode options, it assumes we always pad with zeros and only controls the size.

@Jverduzc
Copy link
Author

I figured. This issue was implementing it with tf.pad() to do the padding operation separately from the convolution.

@Jverduzc
Copy link
Author

Following up on this issue of adding tf.pad() option for 'wrap' as available in np.pad()

@cantonios
Copy link
Contributor

Sounds fine to me if you'd like to add it as a new feature.

@cantonios cantonios added stat:contribution welcome Status - Contributions welcome and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Nov 28, 2022
@sachinprasadhs sachinprasadhs removed their assignment Dec 7, 2022
@madt2709
Copy link

madt2709 commented May 1, 2023

Hey, I'd like to pick this up if no one is working on this.

@Jverduzc
Copy link
Author

Jverduzc commented May 1, 2023

That would be awesome!

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Oct 29, 2023
@mattbahr
Copy link
Contributor

mattbahr commented Apr 2, 2024

I'd like to try picking up on this where @madt2709 left off if that's alright.

@google-ml-butler google-ml-butler bot removed the stale This label marks the issue/pr stale - to be closed automatically if no activity label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stat:contribution welcome Status - Contributions welcome TF 2.10 type:feature Feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants