(self, a, threshold=0.0)
| 3183 | return a |
| 3184 | |
| 3185 | def eliminate_zeros(self, a, threshold=0.0): |
| 3186 | if self.issparse(a): |
| 3187 | values = a.values |
| 3188 | if threshold > 0: |
| 3189 | mask = self.abs(values) <= threshold |
| 3190 | else: |
| 3191 | mask = values == 0 |
| 3192 | return tf.sparse.retain(a, ~mask) |
| 3193 | else: |
| 3194 | if threshold > 0: |
| 3195 | a = tnp.where(self.abs(a) > threshold, a, 0.0) |
| 3196 | return a |
| 3197 | |
| 3198 | def todense(self, a): |
| 3199 | if self.issparse(a): |