| 312 | def test_datastructures(self): |
| 313 | |
| 314 | class HasDatastructures(util.Checkpoint): |
| 315 | |
| 316 | def __init__(self): |
| 317 | self.a = [1.] |
| 318 | self.a.append(variables.Variable(2.)) |
| 319 | self.b = {"a": variables.Variable(3.)} |
| 320 | |
| 321 | @def_function.function(input_signature=[tensor_spec.TensorSpec( |
| 322 | shape=None, dtype=dtypes.float32)]) |
| 323 | def add(self, x): |
| 324 | return x + math_ops.add_n(self.a) + self.b["a"] |
| 325 | |
| 326 | to_save = HasDatastructures() |
| 327 | to_save.add(constant_op.constant(1.)) |
no outgoing calls