code
stringlengths
3
6.57k
engine.detach()
engine.module.parameters()
cleanup()
debug(rank, world_size, tensor, dp, noise_multiplier=0, max_grad_norm=1e8)
setup_and_get_device(rank, world_size)
print(f"Rank: {rank},World size: {world_size}, local_rank: {local_rank}")
tensor.to(local_rank)
print(f"dp: {dp}")
print(tensor)
cleanup()
run_function(local_function, tensor, dp, noise_multiplier=0, max_grad_norm=1e8)
os.environ.get("SLURM_NTASKS")
int(os.environ.get("SLURM_NTASKS")
int(os.environ.get("SLURM_PROCID")
print(f"Running on a Slurm cluster with {world_size} tasks.")
local_function(rank, world_size, tensor, dp, noise_multiplier, max_grad_norm)
torch.cuda.device_count()
print(f"Spawning multiple processes on a local machine with {world_size} GPUs")
GradientComputationTest(unittest.TestCase)
test_connection(self)
torch.zeros(10, 10)
run_function(debug, tensor, dp=True)
test_gradient_noclip_zeronoise(self)
torch.zeros(10, 10)
torch.zeros(10, 10)
run_function(demo_basic, weight_dp, dp=True)
run_function(demo_basic, weight_nodp, dp=False)
self.assertTrue(torch.norm(weight_dp - weight_nodp)
test_ddp_hook(self)
torch.zeros(10, 10)
torch.zeros(10, 10)
torch.norm(weight_ddp_naive - weight_ddp_hook)
test_add_remove_ddp_hooks(self)
remove_hooks()
cv2.VideoCapture(0)
time.sleep(0.50)
print("Hello!")
text (grabbed, frame)
camera.read()
imutils.resize(frame, width=500)
cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.GaussianBlur(gray, (21, 21)
cv2.absdiff(firstFrame, gray)
cv2.threshold(frameDelta, 25, 255, cv2.THRESH_BINARY)
cv2.dilate(thresh, None, iterations=2)
cv2.findContours(thresh.copy()
cv2.contourArea(c)
text (x, y, w, h)
cv2.boundingRect(c)
cv2.rectangle(frame, (x, y)
cv2.putText(frame, "Room Status: {}".format(text)
cv2.putText(frame, datetime.datetime.now()
strftime("%A %d %B %Y %I:%M:%S%p")
cv2.imshow("Security Feed", frame)
cv2.imshow("Thresh", thresh)
cv2.imshow("Frame Delta", frameDelta)
cv2.waitKey(1)
ord("q")
camera.release()
cv2.destroyAllWindows()
Copyright (c)
distribution (the "License")
UnitTest_CloudGemFramework_ServiceClient_service_client(unittest.TestCase)
test_service_client_imports(self)
self.assertIsNotNone(cgf_service_client.Data)
self.assertIsNotNone(cgf_service_client.Path)
self.assertIsNotNone(cgf_service_client.HttpError)
self.assertIsNotNone(cgf_service_client.ClientError)
self.assertIsNotNone(cgf_service_client.NotFoundError)
self.assertIsNotNone(cgf_service_client.NotAllowedError)
self.assertIsNotNone(cgf_service_client.ServerError)
mock.patch('cgf_service_client.Path')
test_for_url(self, mock_Path)
cgf_service_client.for_url('http://example.com', A = 10, B = 20)
self.assertIs(client, mock_Path.return_value)
mock_Path.assert_called_once_with('http://example.com', A = 10, B = 20)
unittest.main()
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aspc.settings")
get_wsgi_application()
Flask(__name__)
CORS(app)
app.route('/', methods=['GET', 'POST'])
index()
get_answer(request)
jsonify({'ans': ans, 't1': t1, 't2': t2, 't3': t3})
render_template('index.html')
result(img)
img.reshape(1, 784)
img.astype(np.float32)
np.multiply(img, 1.0 / 255.0)
remote.execute("http://localhost:9001", img)
np.argmax(pred, axis=1)
str(np.argsort(-pp)
str(int(np.sort(-pp)
str(np.argsort(-pp)
str(int(np.sort(-pp)
str(np.argsort(-pp)
str(int(np.sort(-pp)
int(r)
get_answer(req)