Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/16038
  
    (I am in the UK, but let's keep the discussion online here)
    
    OK, I had assumed that `Vectors.zeros` makes a sparse vector. It does not; 
it makes a dense vector. If it were sparse, then it would be tiny to serialize. 
Hence I didn't understand this to be the issue, and though you were saying that 
another copy of a dense representation was accidentally in the closure.
    
    However, this means there's a more direct solution without changing or 
adding to the public API: pass a sparse vector (of zeroes) as the zero value. 
It looks like this should work, even be a little faster on the first pass when 
the gradient is 0. If for some reason something doesn't like the sparse vector, 
it's easy enough to call `.toDense` such that it's only expanded once and not 
on the driver.
    
    In that case, I would not make the change in this PR, and change 
https://github.com/apache/spark/pull/16037 to make the initial vector sparse 
only.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to