MCPcopy Create free account
hub / github.com/LAMDA-CL/CVPR22-Fact / update_fc_avg

Method update_fc_avg

models/fact/Network.py:145–154  ·  view source on GitHub ↗
(self,data,label,class_list)

Source from the content-addressed store, hash-verified

143 self.update_fc_ft(new_fc,data,label,session)
144
145 def update_fc_avg(self,data,label,class_list):
146 new_fc=[]
147 for class_index in class_list:
148 data_index=(label==class_index).nonzero().squeeze(-1)
149 embedding=data[data_index]
150 proto=embedding.mean(0)
151 new_fc.append(proto)
152 self.fc.weight.data[class_index]=proto
153 new_fc=torch.stack(new_fc,dim=0)
154 return new_fc
155
156 def get_logits(self,x,fc):
157 if 'dot' in self.args.new_mode:

Callers 1

update_fcMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected