| 384 | aggregation=aggregation), setattr |
| 385 | |
| 386 | def _recreate_constant(self, proto): |
| 387 | tensor_proto = self._operation_attributes[proto.operation]["value"].tensor |
| 388 | ndarray = tensor_util.MakeNdarray(tensor_proto) |
| 389 | if dtypes.as_dtype(tensor_proto.dtype) == dtypes.string: |
| 390 | with ops.device("CPU"): |
| 391 | imported_constant = constant_op.constant(ndarray) |
| 392 | else: |
| 393 | imported_constant = constant_op.constant(ndarray) |
| 394 | return imported_constant, setattr |
| 395 | |
| 396 | def _recreate_resource(self, proto): |
| 397 | return _RestoredResource(device=proto.device), setattr |