DarrenZhang01 / TensorFlow_GSoC

Neural Tangents for TensorFlow 2.x.
https://summerofcode.withgoogle.com/projects/#5090780143681536
Apache License 2.0
2 stars 0 forks source link

`assertEqual` Does not Support Trax `ndarray` in the Updated Neural Tangents Test Case #9

Closed DarrenZhang01 closed 4 years ago

DarrenZhang01 commented 4 years ago
    self.assertEqual(x_dict[field.name], y_dict[field.name])
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py", line 912, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py", line 902, in _baseAssertEqual
    if not first == second:
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trax/tf_numpy/numpy_impl/arrays.py", line 172, in __bool__
    return self.__nonzero__()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trax/tf_numpy/numpy_impl/arrays.py", line 169, in __nonzero__
    return bool(self.data)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 884, in __bool__
    return bool(self._numpy())
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
DarrenZhang01 commented 4 years ago

Solved in https://github.com/DarrenZhang01/TensorFlow_GSoC/commit/3b096971e983b05487f3480f62d94a92cbf3b4af