Skip to content

Commit

Permalink
Added test from keras-team#457
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKane2001 authored and LukeWood committed Jun 24, 2022
1 parent 9036bd8 commit 309d266
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions keras_cv/layers/preprocessing/random_resized_crop_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 The KerasCV Authors
#
# 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
#
# https://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 tensorflow as tf

from keras_cv import core
from keras_cv.layers import preprocessing


class RandomResizedCropTest(tf.test.TestCase):
def test_preserves_output_shape(self):
image_shape = (4, 300, 300, 3)
image = tf.random.uniform(shape=image_shape) * 255.0

layer = preprocessing.RandomResizeCrop(area_factor=(0.3, 0.8))
output = layer(image)

self.assertEqual(image.shape, output.shape)
self.assertNotAllClose(image, output)

0 comments on commit 309d266

Please sign in to comment.