MCPcopy Create free account
hub / github.com/PolymathicAI/AstroCLIP / preprocess

Method preprocess

astroclip/models/specformer.py:119–126  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

117 return torch.stack([self._mask_seq(el) for el in x])
118
119 def preprocess(self, x):
120 std, mean = x.std(1, keepdim=True).clip_(0.2), x.mean(1, keepdim=True)
121 x = (x - mean) / std
122 x = self._slice(x)
123 x = F.pad(x, pad=(2, 0, 1, 0), mode="constant", value=0)
124 x[:, 0, 0] = (mean.squeeze() - 2) / 2
125 x[:, 0, 1] = (std.squeeze() - 2) / 8
126 return x
127
128 def _reset_parameters_datapt(self):
129 # not scaling the initial embeddngs.

Callers 3

forwardMethod · 0.95
training_stepMethod · 0.95
validation_stepMethod · 0.95

Calls 1

_sliceMethod · 0.95

Tested by

no test coverage detected