You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
479 B

'''
Author: SJ2050
Date: 2021-10-26 13:44:25
LastEditTime: 2021-10-26 13:52:13
Version: v0.0.1
Description: Solution for homework 1.1.
Copyright © 2021 SJ2050
'''
import numpy as np
if __name__ == '__main__':
mat = np.array([[10, 34, 54, 23],
[31, 87, 53, 68],
[98, 49, 25, 11],
[84, 32, 67, 88]])
mat_padded = np.pad(mat, ((1, 1), (1, 1)), 'constant', constant_values=((0, 0), (0, 0)))
print(mat_padded)