LeetCode: 1637 Widest Vetical Area Between Two Points Containing No Points 解題紀錄
題目
Given n
points
on a 2D plane where points[i] = [xi, yi]
, Return the widest vertical area between two points such that no points are inside the area.
Given n
points
on a 2D plane where points[i] = [xi, yi]
, Return the widest vertical area between two points such that no points are inside the area.
You are given an integer array prices
representing the prices of various chocolates in a store. You are also given a single integer money
, which represents your initial amount of money.
An image smoother is a filter of the size 3 x 3
that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it in the average (i.e., the average of the four cells in the red smoother).
IPython 是一個提供互動式運算的系統,可以在各種 shell 跟視覺化界面整合在一起;比方說我們可以透過終端機使用 ipython
(前題是這個模組有裝)、或是使用如 VS Code 和 PyCharm 這類的圖形化界面編輯器/IDE。
Given two strings s
and t
, return true
if t
is an anagram of s
, and false
otherwise.
You are given the array paths
, where paths[i] = [cityAi, cityBi]
means there exists a direct path going from cityAi
to cityBi
. Return the destination city, that is, the city without any path outgoing to another city.
You are given a 0-indexed m x n
binary matrix grid
.
A 0-indexed m x n
difference matrix diff
is created with the following procedure:
昨晚,我在改進一段將模型融合的程式碼時,由於個人設備資源不足,我採取分層合併的方法,一次只取一層的記憶體進行合併,以此減少系統同時保存的模型記憶體大小。然而,我發現模型雖然在 GPU 中的記憶體很容易被刪除、但是 CPU 中的記憶體被回收是十分不容易的。這涉及到了 Python 的資源回收器的設計。
Read More »[PyTorch] 將模型刪除後,釋放 GPU / CPU 的記憶體空間今天在閱讀 DreamBooth 訓練原始碼時,發現了 tempfile
這個模組;剛巧手邊又在做一個模型分層合併的的腳本改寫,頓時想到使用這個模組的話能夠讓程式碼優雅一些,便順手做了個紀錄。