| 74 | |
| 75 | |
| 76 | def make_attr(attr_type, value): |
| 77 | if attr_type == pywrap_tensorflow.TF_ATTR_TYPE: |
| 78 | return dtypes.as_dtype(value) |
| 79 | elif attr_type == [pywrap_tensorflow.TF_ATTR_TYPE]: |
| 80 | return [dtypes.as_dtype(v) for v in value] |
| 81 | elif attr_type == pywrap_tensorflow.TF_ATTR_SHAPE: |
| 82 | return tensor_shape.as_shape(value).as_proto() |
| 83 | elif attr_type == [pywrap_tensorflow.TF_ATTR_SHAPE]: |
| 84 | return [tensor_shape.as_shape(v).as_proto() for v in value] |
| 85 | elif isinstance(value, str): |
| 86 | return value.encode() |
| 87 | return value |
| 88 | |
| 89 | |
| 90 | class _MockOp(object): |