<jupyter_start><jupyter_text>Cropping2D **[convolutional.Cropping2D.0] cropping ((1,1),(1,1)) on 3x5x4 input, data_format='channels_last'**<jupyter_code>data_in_shape = (3, 5, 4)
L = Cropping2D(cropping=((1,1),(1, 1)), data_format='channels_last')

layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)

# set weights to random (use seed for reproducibility)
np.random.seed(250)
data_in = 2 * np.random.random(data_in_shape) - 1
result = model.predict(np.array([data_in]))
data_out_shape = result[0].shape
data_in_formatted = format_decimal(data_in.ravel().tolist())
data_out_formatted = format_decimal(result[0].ravel().tolist())
print('')
print('in shape:', data_in_shape)
print('in:', data_in_formatted)
print('out shape:', data_out_shape)
print('out:', data_out_formatted)

DATA['convolutional.Cropping2D.0'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}<jupyter_output>in shape: (3, 5, 4)
in: [-0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.170854, -0.139788, -0.710674, 0.406968, 0.705926, -0.094137, -0.793497, -0.040684, 0.522292, 0.490496, -0.651771, 0.293113, -0.580922, -0.396436, 0.864522, -0.411659, 0.317379, 0.771844, 0.507235, 0.067782, 0.922641, -0.944205, 0.383713, -0.380187, -0.875176, 0.799314, -0.681818, -0.761323, 0.768315, -0.298568, -0.611688, -0.768656, 0.525693]
out shape: (1, 3, 4)
out: [0.162138, 0.565201, -0.492094, 0.170854, -0.139788, -0.710674, 0.406968, 0.705926, -0.094137, -0.793497, -0.040684, 0.522292]<jupyter_text>**[convolutional.Cropping2D.1] cropping ((1,1),(1,1)) on 3x5x4 input, data_format='channels_first'**<jupyter_code>data_in_shape = (3, 5, 4)
L = Cropping2D(cropping=((1,1),(1,1)), data_format='channels_first')

layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)

# set weights to random (use seed for reproducibility)
np.random.seed(251)
data_in = 2 * np.random.random(data_in_shape) - 1
result = model.predict(np.array([data_in]))
data_out_shape = result[0].shape
data_in_formatted = format_decimal(data_in.ravel().tolist())
data_out_formatted = format_decimal(result[0].ravel().tolist())
print('')
print('in shape:', data_in_shape)
print('in:', data_in_formatted)
print('out shape:', data_out_shape)
print('out:', data_out_formatted)

DATA['convolutional.Cropping2D.1'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}<jupyter_output>in shape: (3, 5, 4)
in: [0.275222, -0.793967, -0.468107, -0.841484, -0.295362, 0.78175, 0.068787, -0.261747, -0.625733, -0.042907, 0.861141, 0.85267, 0.956439, 0.717838, -0.99869, -0.963008, 0.013277, -0.180306, 0.832137, -0.385252, -0.524308, 0.659706, -0.905127, 0.526292, 0.832569, 0.084455, 0.23838, -0.046178, -0.735871, 0.776883, -0.394643, 0.498903, 0.029584, -0.17332, 0.628159, 0.445074, 0.638899, 0.597286, -0.055729, -0.825457, -0.675992, 0.931468, 0.666841, 0.624388, -0.412075, 0.716772, -0.053248, -0.0025, -0.743212, 0.967964, -0.259998, -0.14653, -0.823771, -0.506749, -0.94293, -0.452047, -0.492538, 0.733182, -0.219022, -0.514951]
out shape: (3, 3, 2)
out: [0.78175, 0.068787, -0.042907, 0.861141, 0.717838, -0.99869, 0.084455, 0.23838, 0.776883, -0.394643, -0.17332, 0.628159, 0.716772, -0.053248, 0.967964, -0.259998, -0.506749, -0.94293]<jupyter_text>**[convolutional.Cropping2D.2] cropping ((4,2),(3,1)) on 8x7x6 input, data_format='channels_last'**<jupyter_code>data_in_shape = (8, 7, 6)
L = Cropping2D(cropping=((4,2),(3,1)), data_format='channels_last')

layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)

# set weights to random (use seed for reproducibility)
np.random.seed(252)
data_in = 2 * np.random.random(data_in_shape) - 1
result = model.predict(np.array([data_in]))
data_out_shape = result[0].shape
data_in_formatted = format_decimal(data_in.ravel().tolist())
data_out_formatted = format_decimal(result[0].ravel().tolist())
print('')
print('in shape:', data_in_shape)
print('in:', data_in_formatted)
print('out shape:', data_out_shape)
print('out:', data_out_formatted)

DATA['convolutional.Cropping2D.2'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}<jupyter_output>in shape: (8, 7, 6)
in: [-0.989173, -0.133618, -0.505338, 0.023259, 0.503982, -0.303769, -0.436321, 0.793911, 0.416102, 0.806405, -0.098342, -0.738022, -0.982676, 0.805073, 0.741244, -0.941634, -0.253526, -0.136544, -0.295772, 0.207565, -0.517246, -0.686963, -0.176235, -0.354111, -0.862411, -0.969822, 0.200074, 0.290718, -0.038623, 0.294839, 0.247968, 0.557946, -0.455596, 0.6624, 0.879529, -0.466772, 0.40423, 0.213794, 0.645662, -0.044634, -0.552595, 0.771242, -0.131944, -0.172725, 0.700856, -0.001994, 0.606737, -0.593306, 0.898062, -0.203771, 0.645788, 0.596358, -0.571654, -0.636819, -0.367376, -0.892607, -0.123297, 0.748404, -0.783012, 0.061963, -0.908546, -0.988517, 0.97308, 0.483845, 0.967956, 0.95863, 0.633963, -0.109138, -0.615821, -0.479821, 0.42827, 0.761351, 0.108265, -0.835679, -0.200177, 0.556308, -0.346135, -0.591775, 0.888818, 0.088756, 0.887542, 0.231398, -0.062874, 0.379803, 0.248259, -0.004909, -0.694836, 0.246241, 0.576698, 0.877474, 0.353439, 0.528707, 0.585634, -0.9[...]<jupyter_text>**[convolutional.Cropping2D.3] cropping ((4,2),(3,1)) on 8x7x6 input, data_format='channels_first'**<jupyter_code>data_in_shape = (8, 7, 6)
L = Cropping2D(cropping=((4,2),(3,1)), data_format='channels_first')

layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)

# set weights to random (use seed for reproducibility)
np.random.seed(253)
data_in = 2 * np.random.random(data_in_shape) - 1
result = model.predict(np.array([data_in]))
data_out_shape = result[0].shape
data_in_formatted = format_decimal(data_in.ravel().tolist())
data_out_formatted = format_decimal(result[0].ravel().tolist())
print('')
print('in shape:', data_in_shape)
print('in:', data_in_formatted)
print('out shape:', data_out_shape)
print('out:', data_out_formatted)

DATA['convolutional.Cropping2D.3'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}<jupyter_output>in shape: (8, 7, 6)
in: [-0.47588, 0.366985, 0.040173, 0.015578, -0.906159, 0.241982, -0.771299, -0.443554, -0.56404, -0.17751, 0.541277, -0.233327, 0.024369, 0.858275, 0.496191, 0.980574, -0.59522, 0.480899, 0.392553, -0.191718, 0.055121, 0.289836, -0.498339, 0.800408, 0.132679, -0.716649, 0.840092, -0.088837, -0.538209, -0.580887, -0.370128, -0.924933, -0.161736, -0.205619, 0.793729, -0.354472, 0.687519, 0.272041, -0.943352, -0.730959, -0.330419, -0.479307, 0.520387, 0.137906, 0.897598, 0.869815, 0.978562, 0.731387, 0.084559, 0.05709, -0.645057, 0.021524, -0.051466, -0.312923, 0.615681, -0.489544, -0.152496, 0.450475, 0.758223, 0.217489, 0.013859, 0.495027, 0.383425, -0.825141, 0.690579, 0.579147, 0.282404, 0.941596, -0.707396, -0.647516, 0.265602, 0.87606, 0.739125, 0.286697, 0.09401, 0.526318, -0.879911, 0.453206, -0.280944, 0.090286, 0.208239, 0.162421, -0.295482, -0.426305, 0.834307, 0.183841, -0.474458, -0.811003, -0.333046, 0.893681, -0.912594, -0.962315, -0.51711, -0.856975, [...]<jupyter_text>**[convolutional.Cropping2D.4] cropping (2,3) on 8x7x6 input, data_format='channels_last'**<jupyter_code>data_in_shape = (8, 7, 6)
L = Cropping2D(cropping=(2,3), data_format='channels_last')

layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)

# set weights to random (use seed for reproducibility)
np.random.seed(254)
data_in = 2 * np.random.random(data_in_shape) - 1
result = model.predict(np.array([data_in]))
data_out_shape = result[0].shape
data_in_formatted = format_decimal(data_in.ravel().tolist())
data_out_formatted = format_decimal(result[0].ravel().tolist())
print('')
print('in shape:', data_in_shape)
print('in:', data_in_formatted)
print('out shape:', data_out_shape)
print('out:', data_out_formatted)

DATA['convolutional.Cropping2D.4'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}<jupyter_output>in shape: (8, 7, 6)
in: [0.024124, 0.280236, -0.680013, -0.042458, -0.164273, 0.358409, 0.511014, -0.585272, -0.481578, 0.692702, 0.64189, -0.400252, -0.922248, -0.735105, -0.533918, 0.071402, 0.310474, 0.369868, 0.767931, -0.842066, -0.091189, 0.835301, -0.480484, 0.950819, -0.002131, 0.086491, -0.480947, 0.405572, -0.083803, -0.921447, -0.291545, 0.674087, -0.560444, 0.881432, 0.076544, 0.63549, -0.185686, -0.89067, 0.709257, -0.256164, -0.873627, 0.330906, -0.583426, -0.51286, 0.751485, 0.030077, -0.998662, 0.175588, 0.375807, -0.297778, -0.037149, -0.420746, -0.208204, 0.402424, -0.554688, -0.472029, 0.114337, 0.543154, -0.462202, -0.702131, -0.755152, 0.399132, -0.863878, 0.90242, -0.598578, 0.075729, -0.984584, -0.76995, -0.822436, 0.521519, -0.437606, 0.347583, 0.021953, 0.568181, 0.066634, 0.61829, -0.481882, 0.558214, 0.732847, -0.254362, 0.151457, 0.412434, -0.319702, -0.09085, 0.555778, 0.671859, -0.635198, 0.593103, -0.005002, -0.450857, 0.774167, -0.791044, -0.492777, -0.[...]<jupyter_text>**[convolutional.Cropping2D.5] cropping 4 on 8x7x6 input, data_format='channels_last'**<jupyter_code>data_in_shape = (8, 7, 6)
L = Cropping2D(cropping=1, data_format='channels_last')

layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)

# set weights to random (use seed for reproducibility)
np.random.seed(255)
data_in = 2 * np.random.random(data_in_shape) - 1
result = model.predict(np.array([data_in]))
data_out_shape = result[0].shape
data_in_formatted = format_decimal(data_in.ravel().tolist())
data_out_formatted = format_decimal(result[0].ravel().tolist())
print('')
print('in shape:', data_in_shape)
print('in:', data_in_formatted)
print('out shape:', data_out_shape)
print('out:', data_out_formatted)

DATA['convolutional.Cropping2D.5'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}<jupyter_output>in shape: (8, 7, 6)
in: [-0.072127, -0.553929, -0.355552, -0.936405, 0.556627, -0.482815, -0.225337, -0.640315, 0.023246, -0.638412, -0.797304, 0.284959, -0.569771, -0.685286, 0.002481, 0.398436, 0.11345, 0.416629, -0.526713, 0.962183, 0.021732, 0.922994, 0.07991, -0.164385, 0.461494, -0.982877, -0.142158, 0.175741, -0.124041, -0.875609, -0.528708, -0.911127, 0.782257, -0.509403, 0.573973, -0.151309, -0.895619, -0.721042, 0.483952, -0.745814, -0.588825, -0.154089, 0.423904, -0.262707, -0.517175, -0.535505, -0.266104, -0.46314, -0.216526, -0.864596, 0.841716, 0.402031, 0.873588, -0.457428, -0.348313, 0.910179, -0.408277, 0.734388, -0.024081, -0.550588, 0.293097, -0.542286, -0.269648, 0.213238, 0.514513, 0.266344, -0.112736, 0.845888, 0.188158, 0.728423, 0.754239, 0.909679, -0.298907, 0.890225, -0.176317, 0.710818, 0.522503, 0.564153, -0.742255, 0.183133, -0.478304, 0.306737, -0.556934, -0.411964, 0.641192, 0.868657, 0.52633, -0.519934, 0.997507, 0.516068, -0.557744, 0.956131, 0.239102,[...]<jupyter_text>export for Keras.js tests<jupyter_code>import os

filename = '../../../test/data/layers/convolutional/Cropping2D.json'
if not os.path.exists(os.path.dirname(filename)):
    os.makedirs(os.path.dirname(filename))
with open(filename, 'w') as f:
    json.dump(DATA, f)
print(json.dumps(DATA))<jupyter_output>{"convolutional.Cropping2D.0": {"input": {"data": [-0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.170854, -0.139788, -0.710674, 0.406968, 0.705926, -0.094137, -0.793497, -0.040684, 0.522292, 0.490496, -0.651771, 0.293113, -0.580922, -0.396436, 0.864522, -0.411659, 0.317379, 0.771844, 0.507235, 0.067782, 0.922641, -0.944205, 0.383713, -0.380187, -0.875176, 0.799314, -0.681818, -0.761323, 0.768315, -0.298568, -0.611688, -0.768656, 0.525693], "shape": [3, 5, 4]}, "expected": {"data": [0.162138, 0.565201, -0.492094, 0.170854, -0.139788, -0.710674, 0.406968, 0.705926, -0.094137, -0.793497, -0.040684, 0.522292], "shape": [1, 3, 4]}}, "convolutional.Cropping2D.1": {"input": {"data": [0.275222, -0.793967, -0.468107, -0.841484, -0.295362, 0.78175, 0.068787, -0.26[...]
{'fraction_non_alphanumeric': 0.20844266090446056, 'fraction_numerical': 0.3388640222256521, 'mean_word_length': 4.698768689533861, 'pattern_counts': {'":': 10, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '87689', 'license': 'MIT', 'n_tokens_mistral': 8717, 'n_tokens_neox': 6252, 'n_words': 1062, 'path': 'notebooks/layers/convolutional/Cropping2D.ipynb', 'repo_name': 'HimariO/keras-js', 'size': '12958'}