MCPcopy Create free account
hub / github.com/DragonisCV/RAM / forward

Method forward

ram/archs/vgg_arch.py:141–161  ·  view source on GitHub ↗

Forward function. Args: x (Tensor): Input tensor with shape (n, c, h, w). Returns: Tensor: Forward results.

(self, x)

Source from the content-addressed store, hash-verified

139 self.register_buffer('std', torch.Tensor([0.229, 0.224, 0.225]).view(1, 3, 1, 1))
140
141 def forward(self, x):
142 """Forward function.
143
144 Args:
145 x (Tensor): Input tensor with shape (n, c, h, w).
146
147 Returns:
148 Tensor: Forward results.
149 """
150 if self.range_norm:
151 x = (x + 1) / 2
152 if self.use_input_norm:
153 x = (x - self.mean) / self.std
154 output = {}
155
156 for key, layer in self.vgg_net._modules.items():
157 x = layer(x)
158 if key in self.layer_name_list:
159 output[key] = x.clone()
160
161 return output

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected