MCPcopy Create free account
hub / github.com/CSAILVision/gandissect / generateFeaturesLocal

Method generateFeaturesLocal

client/ts/api/GanterAPI.ts:280–325  ·  view source on GitHub ↗
(project: string,
                          ids: number[],
                          layers: string[],
                          masks: API_FeatureMask[],
                          ablations: AblationUpload[] = [])

Source from the content-addressed store, hash-verified

278
279
280 generateFeaturesLocal(project: string,
281 ids: number[],
282 layers: string[],
283 masks: API_FeatureMask[],
284 ablations: AblationUpload[] = []): Promise<API_genFeatures> {
285 /*
286 project = feat_req['project']
287 ids = feat_req['ids']
288 masks = feat_req.get('masks', None)
289 layers = feat_req.get('layers', None)
290 ablations = feat_req.get('ablations', [])
291 */
292
293
294 // const ids = imasks.map(d => d.id);
295 // const masks = imasks.map(d => ({
296 // shape: [],
297 // bitbounds: [],
298 // bitstring: d.mask
299 // }));
300
301 masks.forEach(mask => {
302 if (mask.bitstring == null) {
303 const bb = mask.bitbounds;
304 const bits = (bb[2] - bb[0]) * (bb[3] - bb[1]);
305 mask.bitstring = '1'.repeat(bits);
306 }
307 });
308
309
310 return d3.json(this.baseURL + '/api/features', {
311 method: "POST",
312 body: JSON.stringify({
313 ablations,
314 project,
315 ids,
316 masks,
317 layers
318 }),
319 headers: {
320 "Content-type": "application/json; charset=UTF-8"
321 }
322 });
323
324
325 }
326
327}
328

Callers 1

ganclient.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected