示例#1
0
def client_recv( sock, label=None ):
    import time
    time_start = time.time()

    response = nn_format.recv(sock)
    data_list = nn_format.bytestr_to_list(response)

    if label is None: return data_list

    global time_recv
    if label in time_recv:
        time_recv[label].append(time.time()-time_start)
    else:
        time_recv[label] = [time.time()-time_start]
    return data_list
示例#2
0
def client_recv(sock):
    response = nn_format.recv(sock)
    data_list = nn_format.bytestr_to_list(response)
    return data_list
示例#3
0
def recv_as_tensor(sock, shape):
    import torch
    import nn_format
    return torch.Tensor(nn_format.bytestr_to_list(
        nn_format.recv(sock))).view(shape)