This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param Number r The red color value | |
* @param Number g The green color value | |
* @param Number b The blue color value | |
* @return Array The HSL representation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from torch.optim.optimizer import Optimizer | |
# This version of Adam keeps an fp32 copy of the parameters and | |
# does all of the parameter updates in fp32, while still doing the | |
# forwards and backwards passes using fp16 (i.e. fp16 copies of the | |
# parameters and fp16 activations). | |
# | |
# Note that this calls .float().cuda() on the params such that it | |
# moves them to gpu 0--if you're using a different GPU or want to |