MCPcopy Create free account
hub / github.com/tensorflow/models / call

Method call

official/projects/mae/modeling/vit.py:111–125  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

109 tf.ones_like(patch_embeds[..., 0]), 1024, normalize=False)
110
111 def call(self, inputs): # pytype: disable=signature-mismatch # overriding-parameter-count-checks
112 if isinstance(inputs, dict):
113 images = inputs.get('images', None)
114 patch_embeds = inputs.get('embeddings', None)
115 else:
116 raise ValueError('Unexpected inputs type to %s.' % self.__class__)
117 if images is not None:
118 patches = to_patch(images, self.patch_h, self.patch_w)
119 patch_embeds = self.to_embed(patches)
120 patch_shape = tf.shape(patch_embeds)
121 patch_embeds = self.add_position_embed(patch_embeds)
122 patch_embeds = tf.reshape(patch_embeds,
123 (patch_shape[0], -1, patch_shape[-1]))
124 patch_embeds = self.insert_cls(patch_embeds)
125 return self.encoder(patch_embeds)

Callers

nothing calls this directly

Calls 6

to_embedMethod · 0.95
add_position_embedMethod · 0.95
insert_clsMethod · 0.95
to_patchFunction · 0.85
encoderMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected