From 2eb13d63b15a8ac908d6fa324c7f3d19141ca570 Mon Sep 17 00:00:00 2001 From: natanielruiz <nataniel777@hotmail.com> Date: 星期六, 12 八月 2017 08:57:15 +0800 Subject: [PATCH] Temperature softmax and 10 shape PCA regression. --- code/utils.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/code/utils.py b/code/utils.py index 09a47a8..01710b2 100644 --- a/code/utils.py +++ b/code/utils.py @@ -7,6 +7,11 @@ import math from math import cos, sin +def softmax_temperature(tensor, temperature): + result = torch.exp(tensor / temperature) + result = torch.div(result, torch.sum(result, 1).unsqueeze(1).expand_as(result)) + return result + def get_pose_params_from_mat(mat_path): # This functions gets the pose parameters from the .mat # Annotations that come with the 300W_LP dataset. -- Gitblit v1.8.0