empty_onehot=np.zeros(output_dim[3])
/Ǚ. Iterate through all tasks, positions
for task_index in range(output_dim[0]):
for sample_index in range(output_dim[1]):
print("task:"+str(task_index)+" sample:"+str(sample_index))
//fill in wild type logit values into an array of dim (task,sequence_length,num_bases)
wt_logit_for_task_sample=wild_type_logits[task_index][sample_index]
After Change
Xtmp=np.array(np.expand_dims(X[sample_index],axis=0))
Xtmp[0][0][base_pos]=cur_base
//get the logit of Xtmp
Xtmp_logit=np.squeeze(preact_function(Xtmp),axis=0)
mutants_expanded[sample_index][0][base_pos][base_letter]=Xtmp_logit[task_index]
//subtract wt_expanded from mutants_expanded
ism_vals=mutants_expanded-wt_expanded
//For each position subtract the mean ISM score for that position from each of the 4 values