Esempio n. 1
0
 def send_watchpoint_hit(self):
     """Send watchpoint hit value."""
     tensors = [
         TensorProto(node_name='Default/TransData-op99', slot='0'),
         TensorProto(
             node_name='Default/optimizer-Momentum/ApplyMomentum-op25',
             slot='0')
     ]
     response = self.stub.SendWatchpointHits(self._generate_hits(tensors))
     assert response.status == EventReply.Status.OK
Esempio n. 2
0
 def generate_tensor(in_tensor=None):
     """Generate tensor message."""
     tensor_content = np.asarray([1, 2, 3, 4, 5, 6]).astype(np.float32).tobytes()
     tensors = [TensorProto(), TensorProto()]
     tensors[0].CopyFrom(in_tensor)
     tensors[0].data_type = DataType.DT_FLOAT32
     tensors[0].dims.extend([2, 3])
     tensors[1].CopyFrom(tensors[0])
     tensors[0].tensor_content = tensor_content[:12]
     tensors[1].tensor_content = tensor_content[12:]
     tensors[0].finished = 0
     tensors[1].finished = 1
     for sub_tensor in tensors:
         yield sub_tensor
 def get_tensors():
     """Get tensors."""
     tensor_content = np.asarray([1, 2, 3, 4, 5,
                                  6]).astype(np.float32).tobytes()
     tensor_pre = TensorProto(node_name='mock_node_name',
                              slot='0',
                              data_type=DataType.DT_FLOAT32,
                              dims=[2, 3],
                              tensor_content=tensor_content[:12],
                              finished=0)
     tensor_succ = TensorProto()
     tensor_succ.CopyFrom(tensor_pre)
     tensor_succ.tensor_content = tensor_content[12:]
     tensor_succ.finished = 1
     return [tensor_pre, tensor_succ]