Skip to content
Merged
Show file tree
Hide file tree
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
61 changes: 61 additions & 0 deletions test/legacy_test/test_full_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

import numpy as np

import paddle
from paddle import _C_ops
from paddle.base import core


def test_api_with_place(data, np_data, value, place):
_C_ops.full_(data, data.shape, float(value), data.dtype, place)
np.testing.assert_array_equal(data, np_data)


class TestFull_(unittest.TestCase):
def setUp(self):
self.type = 'float32'
self.shape = [30, 10, 2]
self.value = 1.1
self.with_gpu = True if paddle.device.is_compiled_with_cuda() else False

def test_api(self):
data = paddle.rand(self.shape, dtype=self.type)
np_data = np.full(self.shape, self.value, dtype=self.type)
test_api_with_place(data, np_data, self.value, core.CPUPlace())
if self.with_gpu:
test_api_with_place(data, np_data, self.value, core.CUDAPlace(0))


class TestFP16Full_(TestFull_):
def setUp(self):
self.type = 'float16'
self.shape = [30, 10, 2]
self.value = 1.1
self.with_gpu = True if paddle.device.is_compiled_with_cuda() else False


class TestFP64Full_(TestFull_):
def setUp(self):
self.type = 'float64'
self.shape = [30, 10, 2]
self.value = 1.1
self.with_gpu = True if paddle.device.is_compiled_with_cuda() else False


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion third_party/zlib
Submodule zlib updated 95 files
+1 −0 .gitignore
+1 −1 CMakeLists.txt
+49 −6 ChangeLog
+177 −55 Makefile.in
+3 −3 README
+14 −7 adler32.c
+0 −215 as400/bndsrc
+0 −110 as400/compile.clp
+0 −115 as400/readme.txt
+24 −18 compress.c
+112 −22 configure
+2 −2 contrib/README.contrib
+3 −3 contrib/ada/zlib-streams.ads
+1 −1 contrib/ada/zlib-thin.ads
+33 −13 contrib/blast/blast.c
+11 −3 contrib/blast/blast.h
+1 −1 contrib/delphi/ZLib.pas
+1 −1 contrib/dotzlib/DotZLib/UnitTests.cs
+3 −3 contrib/infback9/inftree9.c
+1 −1 contrib/minizip/configure.ac
+4 −3 contrib/minizip/iowin32.c
+1 −1 contrib/minizip/unzip.c
+11 −11 contrib/minizip/zip.c
+2 −2 contrib/pascal/zlibpas.pas
+1 −1 contrib/puff/puff.c
+17 −4 contrib/vstudio/readme.txt
+4 −4 contrib/vstudio/vc10/zlib.rc
+11 −1 contrib/vstudio/vc10/zlibvc.def
+4 −4 contrib/vstudio/vc11/zlib.rc
+11 −1 contrib/vstudio/vc11/zlibvc.def
+316 −0 contrib/vstudio/vc12/miniunz.vcxproj
+313 −0 contrib/vstudio/vc12/minizip.vcxproj
+430 −0 contrib/vstudio/vc12/testzlib.vcxproj
+316 −0 contrib/vstudio/vc12/testzlibdll.vcxproj
+32 −0 contrib/vstudio/vc12/zlib.rc
+467 −0 contrib/vstudio/vc12/zlibstat.vcxproj
+153 −0 contrib/vstudio/vc12/zlibvc.def
+119 −0 contrib/vstudio/vc12/zlibvc.sln
+692 −0 contrib/vstudio/vc12/zlibvc.vcxproj
+316 −0 contrib/vstudio/vc14/miniunz.vcxproj
+313 −0 contrib/vstudio/vc14/minizip.vcxproj
+430 −0 contrib/vstudio/vc14/testzlib.vcxproj
+316 −0 contrib/vstudio/vc14/testzlibdll.vcxproj
+32 −0 contrib/vstudio/vc14/zlib.rc
+467 −0 contrib/vstudio/vc14/zlibstat.vcxproj
+153 −0 contrib/vstudio/vc14/zlibvc.def
+119 −0 contrib/vstudio/vc14/zlibvc.sln
+692 −0 contrib/vstudio/vc14/zlibvc.vcxproj
+4 −4 contrib/vstudio/vc9/zlib.rc
+11 −1 contrib/vstudio/vc9/zlibvc.def
+29 −12 crc32.c
+499 −303 deflate.c
+19 −16 deflate.h
+1 −1 examples/gun.c
+2 −2 examples/gzlog.c
+1 −1 examples/zran.c
+16 −7 gzguts.h
+17 −14 gzlib.c
+108 −48 gzread.c
+210 −122 gzwrite.c
+2 −2 infback.c
+34 −51 inffast.c
+86 −37 inflate.c
+7 −4 inflate.h
+12 −14 inftrees.c
+1 −1 msdos/Makefile.dj2
+1 −1 msdos/Makefile.emx
+1 −1 old/Makefile.emx
+1 −1 old/os2/Makefile.os2
+48 −0 os400/README400
+119 −0 os400/bndsrc
+366 −0 os400/make.sh
+83 −7 os400/zlib.inc
+5 −5 qnx/package.qpg
+9 −8 test/example.c
+9 −9 test/infcover.c
+6 −6 test/minigzip.c
+3 −3 treebuild.xml
+38 −61 trees.c
+66 −32 uncompr.c
+1 −1 win32/Makefile.gcc
+1 −1 win32/Makefile.msc
+3 −3 win32/README-WIN32.txt
+1 −1 win32/VisualC.txt
+94 −86 win32/zlib.def
+1 −1 win32/zlib1.rc
+32 −9 zconf.h
+32 −9 zconf.h.cmakein
+32 −9 zconf.h.in
+35 −37 zlib.3
+ zlib.3.pdf
+298 −154 zlib.h
+94 −83 zlib.map
+25 −24 zutil.c
+35 −17 zutil.h