code
stringlengths
3
6.57k
np.diag(cosine_similarity(student_logits, teacher_logits)
print ("Average cosine similarity for these samples: ", np.mean(similarities)
mean_squared_error(student_logits, teacher_logits)
print ("Average mean squared error for these samples: ", mse_error)
np.array(batch_counts)
np.array(batch_n_dropped)
np.array(batch_route_prob)
print('SWITCH BEHAVIOUR:')
print('Counts Shape: \n', switch_counts.shape)
print('Counts: \n', switch_counts)
print('N_dropped: \n', switch_n_dropped)
print('Route Prob: \n', switch_route_prob)
torch.Tensor([np.mean(similarities)
generate_random_params(params)
choice(params[param])
word_embedding_compression(word_embedding_module, d_model)
word_embedding_module (type torch.Embedding)
PCA(n_components = d_model)
pca.fit_transform(word_embedding_matrix.detach()
cpu()
numpy()
torch.from_numpy(compressed_word_embedding_matrix)
torch.nn.parameter.Parameter(compressed_word_embedding_matrix)
argparse.ArgumentParser()
parser.add_argument('-p2', "--path", help="path to input video")
parser.add_argument('-p1', "--spath", help="path where the images should be stored")
parser.add_argument('-n', "--num", help="number from which image label naming starts", type=int)
parser.parse_args()
cv2.VideoCapture(args.path)
print(args.num, args.path, args.spath)
cap.read()
cv2.imwrite(path+str(num)
print(path+str(num)
__init__(self, **kw)
super()
__init__(**kw)
init_justs(self, justs)
sum(x)
zip(self.justs, os)
calc_just(self, justs)
information (joint angle, speed, and torque)
_update_base_state(base_state, values)
preallocate_episode_proto(episode_proto, max_num_steps)
range(max_num_steps)
episode_proto.state_action.add()
range(NUM_MOTORS)
step_log.motor_states.add()
_update_base_state(step_log.base_position, [0, 0, 0])
_update_base_state(step_log.base_orientation, [0, 0, 0])
_update_base_state(step_log.base_angular_vel, [0, 0, 0])
update_episode_proto(episode_proto, minitaur, action, step)
preallocated (len(episode_proto.state_action)
len(episode_proto.state_action)
format(step, max_num_steps)
minitaur.IsObservationValid()
minitaur.GetTimeSinceReset()
int(time_in_seconds)
int((time_in_seconds - int(time_in_seconds)
minitaur.GetMotorAngles()
minitaur.GetMotorVelocities()
minitaur.GetMotorTorques()
range(minitaur.num_motors)
_update_base_state(step_log.base_position, minitaur.GetBasePosition()
_update_base_state(step_log.base_orientation, minitaur.GetBaseRollPitchYaw()
minitaur.GetBaseRollPitchYawRate()
MinitaurLogging(object)
__init__(self, log_path=None)
TODO(jietan)
save_episode(self, episode_proto)
tf.gfile.Exists(self._log_path)
tf.gfile.MakeDirs(self._log_path)
time.time()
datetime.datetime.fromtimestamp(ts)
format(time_stamp)
tf.gfile.Open(log_path, "w")
f.write(episode_proto.SerializeToString()
restore_episode(self, log_path)
tf.gfile.Open(log_path)
f.read()
minitaur_logging_pb2.MinitaurEpisode()
episode_proto.ParseFromString(content)
TestAreas(TestCase)
test_empty_file_gives_no_areas(self)
Popolo({})
len(popolo.areas)
test_single_area_with_name(self)
Popolo({"areas": [EXAMPLE_AREA]})
len(popolo.areas)
test_area_id(self)
Popolo({"areas": [EXAMPLE_AREA]})
test_area_type(self)
Popolo({"areas": [EXAMPLE_AREA]})
test_area_identifiers(self)
Popolo({"areas": [EXAMPLE_AREA]})
test_area_other_names(self)
Popolo({"areas": [EXAMPLE_AREA]})
test_area_wikidata(self)
Popolo({"areas": [EXAMPLE_AREA]})
test_area_repr(self)
Popolo({"areas": [EXAMPLE_AREA]})