-
Notifications
You must be signed in to change notification settings - Fork 950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 approvals obtained (waiting on @jgartman)
src/tensor.ts, line 1190 at r1 (raw file):
} depthToSpace(this: Tensor4D, blockSize: number, dataFormat: 'NHwC'|'NCHW'):
capital w?
src/kernels/webgl/depth_to_space_gpu.ts, line 1 at r1 (raw file):
import {GPGPUProgram} from './gpgpu_math';
license at the top here
src/kernels/webgl/depth_to_space_gpu.ts, line 26 at r1 (raw file):
int offset_h = int(mod(float(h), float(${blockSize}))); int in_w = w / ${blockSize}; int offset_w = int(mod(float(w), float(${blockSize})));
can you use imod?
src/ops/array_ops_test.ts, line 3539 at r1 (raw file):
}); it('tensor4d, input shape=[1, 4, 2, 2], blockSize=2, format=NCHW', () => {
Just curious, when I run this python code:
x = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], shape=[1, 4, 2, 2])
a = tf.depth_to_space(x, 2, 'NCHW')
print(a)
I get "InvalidArgumentError: Input depth dimension 2 should be divisible by: 4 [Op:DepthToSpace] name: NCHW"
Any idea what's going on there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 approvals obtained (waiting on @jgartman)
src/ops/array_ops_test.ts, line 3539 at r1 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
Just curious, when I run this python code:
x = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], shape=[1, 4, 2, 2]) a = tf.depth_to_space(x, 2, 'NCHW') print(a)
I get "InvalidArgumentError: Input depth dimension 2 should be divisible by: 4 [Op:DepthToSpace] name: NCHW"
Any idea what's going on there?
Can you try:
x = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], shape=[1, 4, 2, 2])
a = tf.depth_to_space(x, 2, data_format='NCHW')
print(a)
Otherwise it will use NCHW
as the name of the tensor and use the default data format which is NHWC
. I made the same mistake when I was testing and it took me a few minutes to realize what was going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 7 files at r2, 4 of 4 files at r3.
Reviewable status: 0 of 1 approvals obtained (waiting on @nsthorat)
Description
Adds depthToSpace to the library
tensorflow/tfjs#329
For repository owners only:
Please remember to apply all applicable tags to your pull request.
Tags: FEATURE, BREAKING, BUG, PERF, DEV, DOC, SECURITY
For more info see: https://github.com/tensorflow/tfjs/blob/master/DEVELOPMENT.md
This change is