Skip to content

Commit

Permalink
fix upsample shape infer bug (#8105)
Browse files Browse the repository at this point in the history
* fix upsample shape infer bug

* add more example

* fix eager free tensor bug when in job

* fix nearest2d bug

* fix upsample nearest1d shape infer bug

* restruct upsample op

* change all float scale to double

* Fix upsample shape infer bug continue (#8159)

* fix_upsample_shape_infer_bug

* fix 5 nearest

* add 5 nearest test

* fix 5 nearest test

* fix 1 linear

* fix 4 bilinear

* fix 4 bicubic

* modify bicubic 2d file name

* fix 5 trilinear

* fix exception info

* fix exception info

* fix bug

* modify interpolate

* change float to double

* rm useless SI64ArrayAttr: in OneFlowUserOps

* rm useless import in cpp

* update

* add judge for output_size

* update oneflow/oneflow/core/autograd/gradient_funcs/upsample.cpp

* add grad in td

* test failed

* fix small failed case in upsample

* solve test error

* change float to double

* align to fix_upsample_shape_infer_bug

* align to fix_upsample_shape_infer_bug

Co-authored-by: BBuf <1182563586@qq.com>

* fix comment

* fix test bug

* fix comment

* fix jiebao commnet

* fix comment

* fix commnet

* all scale to double

* auto format by CI

* fix clang tidy bug

* fix clang tidy warning

* relax speed test

* simplify test case

* fix bug

Co-authored-by: Shanshan Zhong <62104945+zhongshsh@users.noreply.github.com>
Co-authored-by: ZZK <42901638+MARD1NO@users.noreply.github.com>
Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored May 21, 2022
1 parent f67cca5 commit 0afc09f
Show file tree
Hide file tree
Showing 21 changed files with 733 additions and 330 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ jobs:
with:
collect-path: ${{ env.FLOW_VISION_SRC }}/benchmark
container-name: ${{ env.TEST_CONTAINER_NAME }}
unknown-threshold: 15
error-threshold: 20
unknown-threshold: 30
error-threshold: 40
- name: Remove automerge
if: ${{ failure() && contains(matrix.runs-on, 'self-hosted') && cancelled() == false && contains(github.event.pull_request.labels.*.name, 'automerge') }}
uses: actions/github-script@v4
Expand Down
2 changes: 0 additions & 2 deletions oneflow/core/autograd/gradient_funcs/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ limitations under the License.
*/
#include "oneflow/core/common/container_util.h"
#include "oneflow/core/framework/op_expr_grad_function.h"
#include "oneflow/core/common/container_util.h"
#include "oneflow/core/functional/functional.h"
#include "oneflow/core/common/container_util.h"

namespace oneflow {
namespace one {
Expand Down
154 changes: 93 additions & 61 deletions oneflow/core/autograd/gradient_funcs/upsample.cpp

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions oneflow/core/functional/functional_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1298,94 +1298,94 @@

- name: "upsample"
signature:
'Tensor (Tensor x, Float height_scale, Float width_scale, Bool align_corners,
'Tensor (Tensor x, Double height_scale, Double width_scale, Bool align_corners,
String interpolation, String data_format="channels_first") => Upsample'
bind_python: True

- name: "upsample_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float height_scale, Float width_scale, Bool align_corners,
'Tensor (Tensor dy, Tensor x, Double height_scale, Double width_scale, Bool align_corners,
String data_format, String interpolation) => UpsampleGrad'
bind_python: False

- name: "upsample_linear_1d"
signature: 'Tensor (Tensor x, Float scale_factor, Bool align_corners,
signature: 'Tensor (Tensor x, Double scale_factor=0.0, Bool align_corners=False, Int64List[1] output_size=None,
String data_format="channels_first") => UpsampleLinear1D'
bind_python: True

- name: "upsample_linear_1d_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float scale_factor, Bool align_corners,
'Tensor (Tensor dy, Tensor x, Double scale_factor=0.0, Bool align_corners=False, Int64List[1] output_size=None,
String data_format="channels_first") => UpsampleLinear1DGrad'
bind_python: False

- name: "upsample_nearest_1d"
signature: 'Tensor (Tensor x, Float scale_factor,
signature: 'Tensor (Tensor x, Double scale_factor=0.0, Int64List[1] output_size=None,
String data_format="channels_first") => UpsampleNearest1D'
bind_python: True

- name: "upsample_nearest_1d_grad"
signature: 'Tensor (Tensor dy, Tensor x, Float scale_factor,
signature: 'Tensor (Tensor dy, Tensor x, Double scale_factor=0.0, Int64List[1] output_size=None,
String data_format="channels_first") => UpsampleNearest1DGrad'
bind_python: False

- name: "upsample_nearest_2d"
signature: 'Tensor (Tensor x, Float height_scale, Float width_scale,
signature: 'Tensor (Tensor x, Double height_scale=0.0, Double width_scale=0.0, Int64List[2] output_size=None,
String data_format="channels_first") => UpsampleNearest2D'
bind_python: True

- name: "upsample_nearest_2d_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float height_scale, Float width_scale,
'Tensor (Tensor dy, Tensor x, Double height_scale=0.0, Double width_scale=0.0, Int64List[2] output_size=None,
String data_format="channels_first") => UpsampleNearest2DGrad'
bind_python: False

- name: "upsample_bilinear_2d"
signature:
'Tensor (Tensor x, Float height_scale, Float width_scale, Bool align_corners,
'Tensor (Tensor x, Double height_scale=0.0, Double width_scale=0.0, Bool align_corners=False, Int64List[2] output_size=None,
String data_format="channels_first") => UpsampleBilinear2D'
bind_python: True

- name: "upsample_bilinear_2d_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float height_scale, Float width_scale, Bool align_corners,
'Tensor (Tensor dy, Tensor x, Double height_scale=0.0, Double width_scale=0.0, Bool align_corners=False, Int64List[2] output_size=None,
String data_format="channels_first") => UpsampleBilinear2DGrad'
bind_python: False

- name: "upsample_bicubic_2d"
signature:
'Tensor (Tensor x, Float height_scale, Float width_scale, Bool align_corners,
'Tensor (Tensor x, Double height_scale=0.0, Double width_scale=0.0, Bool align_corners=False, Int64List[2] output_size=None,
String data_format="channels_first") => UpsampleBicubic2D'
bind_python: True

- name: "upsample_bicubic_2d_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float height_scale, Float width_scale, Bool align_corners,
'Tensor (Tensor dy, Tensor x, Double height_scale=0.0, Double width_scale=0.0, Bool align_corners=False, Int64List[2] output_size=None,
String data_format="channels_first") => UpsampleBicubic2DGrad'
bind_python: False

- name: "upsample_nearest_3d"
signature:
'Tensor (Tensor x, Float depth_scale, Float height_scale, Float width_scale,
'Tensor (Tensor x, Double depth_scale=0.0, Double height_scale=0.0, Double width_scale=0.0, Int64List[3] output_size=None,
String data_format="channels_first") => UpsampleNearest3D'
bind_python: True

- name: "upsample_nearest_3d_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float depth_scale, Float height_scale, Float width_scale,
'Tensor (Tensor dy, Tensor x, Double depth_scale=0.0, Double height_scale=0.0, Double width_scale=0.0, Int64List[3] output_size=None,
String data_format="channels_first") => UpsampleNearest3DGrad'
bind_python: False

- name: "upsample_trilinear_3d"
signature:
'Tensor (Tensor x, Float depth_scale, Float height_scale, Float width_scale,
Bool align_corners, String data_format="channels_first") => UpsampleTrilinear3D'
'Tensor (Tensor x, Double depth_scale=0.0, Double height_scale=0.0, Double width_scale=0.0, Bool align_corners=False,
Int64List[3] output_size=None, String data_format="channels_first") => UpsampleTrilinear3D'
bind_python: True

- name: "upsample_trilinear_3d_grad"
signature:
'Tensor (Tensor dy, Tensor x, Float depth_scale, Float height_scale, Float width_scale,
Bool align_corners, String data_format="channels_first") => UpsampleTrilinear3DGrad'
'Tensor (Tensor dy, Tensor x, Double depth_scale=0.0, Double height_scale=0.0, Double width_scale=0.0,
Bool align_corners=False, Int64List[3] output_size=None, String data_format="channels_first") => UpsampleTrilinear3DGrad'
bind_python: False

- name: "abs"
Expand Down
Loading

0 comments on commit 0afc09f

Please sign in to comment.