MCPcopy Create free account
hub / github.com/YeWR/EfficientZero / renormalize

Function renormalize

core/model.py:134–143  ·  view source on GitHub ↗
(tensor, first_dim=1)

Source from the content-addressed store, hash-verified

132
133
134def renormalize(tensor, first_dim=1):
135 # normalize the tensor (states)
136 if first_dim < 0:
137 first_dim = len(tensor.shape) + first_dim
138 flat_tensor = tensor.view(*tensor.shape[:first_dim], -1)
139 max = torch.max(flat_tensor, first_dim, keepdim=True).values
140 min = torch.min(flat_tensor, first_dim, keepdim=True).values
141 flat_tensor = (flat_tensor - min) / (max - min)
142
143 return flat_tensor.view(*tensor.shape)

Callers 2

representationMethod · 0.90
dynamicsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected