<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 GlobalAveragePooling3D
[pooling.GlobalAveragePooling3D.0] input 6x6x3x4, data_format='channels_last'
Step1:  [pooling.GlobalAveragePooling3D.1] input 3x6x6x3, data_format='channels_first'
Step2:  [pooling.GlobalAveragePooling3D.2] input 5x3x2x1, data_format='channels_last'
Step3:  export for Keras.js tests
<ASSISTANT_TASK:>
Python Code:
data_in_shape = (6, 6, 3, 4)
L = GlobalAveragePooling3D(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(270)
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['pooling.GlobalAveragePooling3D.0'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}
Explanation: GlobalAveragePooling3D
[pooling.GlobalAveragePooling3D.0] input 6x6x3x4, data_format='channels_last'
End of explanation
data_in_shape = (3, 6, 6, 3)
L = GlobalAveragePooling3D(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(271)
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['pooling.GlobalAveragePooling3D.1'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}
Explanation: [pooling.GlobalAveragePooling3D.1] input 3x6x6x3, data_format='channels_first'
End of explanation
data_in_shape = (5, 3, 2, 1)
L = GlobalAveragePooling3D(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(272)
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['pooling.GlobalAveragePooling3D.2'] = {
    'input': {'data': data_in_formatted, 'shape': data_in_shape},
    'expected': {'data': data_out_formatted, 'shape': data_out_shape}
}
Explanation: [pooling.GlobalAveragePooling3D.2] input 5x3x2x1, data_format='channels_last'
End of explanation
print(json.dumps(DATA))
Explanation: export for Keras.js tests
End of explanation
<END_TASK>