






"""simple docstring"""
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
			import torch

if is_vision_available():
			from PIL import Image

			from transformers import PoolFormerImageProcessor


class _lowerCAmelCase						(    unittest.TestCase       ):







						def __init__(    self   ,				lowerCAmelCase_   ,				lowerCAmelCase_=7   ,				lowerCAmelCase_=3   ,				lowerCAmelCase_=3_0   ,				lowerCAmelCase_=4_0_0   ,				lowerCAmelCase_=True   ,				lowerCAmelCase_=None   ,				lowerCAmelCase_=0.9   ,				lowerCAmelCase_=None   ,				lowerCAmelCase_=True   ,				lowerCAmelCase_=[0.5, 0.5, 0.5]   ,				lowerCAmelCase_=[0.5, 0.5, 0.5]   ,				)		->							Dict:
										_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    size if size is not None else {'shortest_edge': 3_0}
										_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    crop_size if crop_size is not None else {'height': 3_0, 'width': 3_0}
										_SCREAMING_SNAKE_CASE   :		str       		=    parent
										_SCREAMING_SNAKE_CASE   :		int       		=    batch_size
										_SCREAMING_SNAKE_CASE   :		List[Any]       		=    num_channels
										_SCREAMING_SNAKE_CASE   :		str       		=    min_resolution
										_SCREAMING_SNAKE_CASE   :		Any       		=    max_resolution
										_SCREAMING_SNAKE_CASE   :		Dict       		=    do_resize_and_center_crop
										_SCREAMING_SNAKE_CASE   :		int       		=    size
										_SCREAMING_SNAKE_CASE   :		Any       		=    crop_pct
										_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    crop_size
										_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    do_normalize
										_SCREAMING_SNAKE_CASE   :		int       		=    image_mean
										_SCREAMING_SNAKE_CASE   :		Any       		=    image_std







						def 			A      (    self							)		->							Tuple:
										return {
										    "size": self.size,
										    "do_resize_and_center_crop": self.do_resize_and_center_crop,
										    "crop_pct": self.crop_pct,
										    "crop_size": self.crop_size,
										    "do_normalize": self.do_normalize,
										    "image_mean": self.image_mean,
										    "image_std": self.image_std,
										}







@require_torch
@require_vision
class _lowerCAmelCase						(    __UpperCAmelCase   ,  unittest.TestCase       ):
						SCREAMING_SNAKE_CASE_:					Tuple 					=				PoolFormerImageProcessor if is_vision_available() else None







						def 			A      (    self							)		->							Any:
										_SCREAMING_SNAKE_CASE   :		List[Any]       		=    PoolFormerImageProcessingTester(self							)







						@property
						def 			A      (    self							)		->							Any:
										return self.image_processor_tester.prepare_image_processor_dict()







						def 			A      (    self							)		->							int:
										_SCREAMING_SNAKE_CASE   :		str       		=    self.image_processing_class(**self.image_processor_dict							)
										self.assertTrue(hasattr(lowerCAmelCase_   ,				'do_resize_and_center_crop'							)							)
										self.assertTrue(hasattr(lowerCAmelCase_   ,				'size'							)							)
										self.assertTrue(hasattr(lowerCAmelCase_   ,				'crop_pct'							)							)
										self.assertTrue(hasattr(lowerCAmelCase_   ,				'do_normalize'							)							)
										self.assertTrue(hasattr(lowerCAmelCase_   ,				'image_mean'							)							)
										self.assertTrue(hasattr(lowerCAmelCase_   ,				'image_std'							)							)







						def 			A      (    self							)		->							Optional[Any]:
										_SCREAMING_SNAKE_CASE   :		Tuple       		=    self.image_processing_class.from_dict(self.image_processor_dict							)
										self.assertEqual(image_processor.size   ,				{'shortest_edge': 3_0}							)
										self.assertEqual(image_processor.crop_size   ,				{'height': 3_0, 'width': 3_0}							)

										_SCREAMING_SNAKE_CASE   :		int       		=    self.image_processing_class.from_dict(self.image_processor_dict   ,				size=4_2   ,				crop_size=8_4							)
										self.assertEqual(image_processor.size   ,				{'shortest_edge': 4_2}							)
										self.assertEqual(image_processor.crop_size   ,				{'height': 8_4, 'width': 8_4}							)







						def 			A      (    self							)		->							Tuple:
										pass







						def 			A      (    self							)		->							Any:
										# Initialize image_processing
										_SCREAMING_SNAKE_CASE   :		int       		=    self.image_processing_class(**self.image_processor_dict							)
										# create random PIL images
										_SCREAMING_SNAKE_CASE   :		Tuple       		=    prepare_image_inputs(self.image_processor_tester   ,				equal_resolution=lowerCAmelCase_							)
										for image in image_inputs:
														self.assertIsInstance(lowerCAmelCase_   ,				Image.Image							)

										# Test not batched input
										_SCREAMING_SNAKE_CASE   :		List[str]       		=    image_processing(image_inputs[0]   ,				return_tensors='pt'							).pixel_values

										self.assertEqual(
										    encoded_images.shape   ,				(
										        1,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )   ,				)

										# Test batched
										_SCREAMING_SNAKE_CASE   :		str       		=    image_processing(lowerCAmelCase_   ,				return_tensors='pt'							).pixel_values
										self.assertEqual(
										    encoded_images.shape   ,				(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )   ,				)







						def 			A      (    self							)		->							str:
										# Initialize image_processing
										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    self.image_processing_class(**self.image_processor_dict							)
										# create random numpy tensors
										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    prepare_image_inputs(self.image_processor_tester   ,				equal_resolution=lowerCAmelCase_   ,				numpify=lowerCAmelCase_							)
										for image in image_inputs:
														self.assertIsInstance(lowerCAmelCase_   ,				np.ndarray							)

										# Test not batched input
										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    image_processing(image_inputs[0]   ,				return_tensors='pt'							).pixel_values
										self.assertEqual(
										    encoded_images.shape   ,				(
										        1,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )   ,				)

										# Test batched
										_SCREAMING_SNAKE_CASE   :		List[Any]       		=    image_processing(lowerCAmelCase_   ,				return_tensors='pt'							).pixel_values
										self.assertEqual(
										    encoded_images.shape   ,				(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )   ,				)







						def 			A      (    self							)		->							Any:
										# Initialize image_processing
										_SCREAMING_SNAKE_CASE   :		Dict       		=    self.image_processing_class(**self.image_processor_dict							)
										# create random PyTorch tensors
										_SCREAMING_SNAKE_CASE   :		Any       		=    prepare_image_inputs(self.image_processor_tester   ,				equal_resolution=lowerCAmelCase_   ,				torchify=lowerCAmelCase_							)
										for image in image_inputs:
														self.assertIsInstance(lowerCAmelCase_   ,				torch.Tensor							)

										# Test not batched input
										_SCREAMING_SNAKE_CASE   :		Any       		=    image_processing(image_inputs[0]   ,				return_tensors='pt'							).pixel_values
										self.assertEqual(
										    encoded_images.shape   ,				(
										        1,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )   ,				)

										# Test batched
										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    image_processing(lowerCAmelCase_   ,				return_tensors='pt'							).pixel_values
										self.assertEqual(
										    encoded_images.shape   ,				(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['height'],
										        self.image_processor_tester.crop_size['width'],
										    )   ,				)









"""simple docstring"""
import operator as op





def 				lowercase__		(					lowerCamelCase       ):
				_SCREAMING_SNAKE_CASE   :		int       		=    []
				_SCREAMING_SNAKE_CASE   :		Dict       		=    lambda lowerCamelCase,						lowerCamelCase       : int(x / y       )  # noqa: E731 integer division operation
				_SCREAMING_SNAKE_CASE   :		Tuple       		=    {
				    '^': op.pow,
				    '*': op.mul,
				    '/': div,
				    '+': op.add,
				    '-': op.sub,
				}  # operators & their respective operation

				# print table header
				print('Symbol'.center(8       ),						'Action'.center(12       ),						'Stack',						sep=' | '       )
				print('-' * (30 + len(lowerCamelCase       ))       )

				for x in post_fix:
								if x.isdigit():  # if x in digit
												stack.append(lowerCamelCase       )  # append x to stack
												# output in tabular format
												print(x.rjust(8       ),						('push(' + x + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | '       )
								else:
												_SCREAMING_SNAKE_CASE   :		int       		=    stack.pop()  # pop stack
												# output in tabular format
												print(''.rjust(8       ),						('pop(' + b + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | '       )

												_SCREAMING_SNAKE_CASE   :		Tuple       		=    stack.pop()  # pop stack
												# output in tabular format
												print(''.rjust(8       ),						('pop(' + a + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | '       )

												stack.append(
												    str(opr[x](int(lowerCamelCase       ),						int(lowerCamelCase       )       )       )       )  # evaluate the 2 values popped from stack & push result to stack
												# output in tabular format
												print(
												    x.rjust(8       ),						('push(' + a + x + b + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | ',						)

				return int(stack[0]       )


if __name__ == "__main__":
			lowerCAmelCase__    						=			input('\n\nEnter a Postfix Equation (space separated) = ').split(' ')
			print('\n\tResult = ', solve(Postfix))

