eaplatanios / tensorflow_scala

TensorFlow API for the Scala Programming Language
http://platanios.org/tensorflow_scala/
Apache License 2.0
936 stars 96 forks source link

Class Tensor is not Serializable #89

Closed lucataglia closed 6 years ago

lucataglia commented 6 years ago
class Tensor private[Tensor](private[api] var nativeHandle: Long)
    extends TensorLike
        with Closeable
        with ProtoSerializable {

This is the signature of the Tensor class. Unfortunately for my application I need that Tensor extend also Serializable. Any chance that you can add that interface to you class ?

eaplatanios commented 6 years ago

@lucaRadicalbit I'll do that this weekend. It's actually an omission. I plan to make ProtoSerializable extend Serializable. :)

eaplatanios commented 6 years ago

@lucaRadicalbit In what context are you using tensors that requires them to extend Serializable?

lucataglia commented 6 years ago

@eaplatanios Because we are using a distributed system that need to send the tensors along the cluster and the tensors need to be serializable. I don't know why during the last few days the problem I had regarding the lack of the Serializable interface is gone. So if it's a problem for you API you can avoid to put that interface on your class for the moment. If I have the same problem in the future I'll write to you

eaplatanios commented 6 years ago

@lucaRadicalbit It's not a problem per se, but I was wondering what serialization framework you're using. I thought that Protobuf serialization support should be ok and you can explicitly provide the serializer and deserializer methods to the framework. I'm not sure what's the best way to implement the Serializable interface. It could be done using Protobuf, but for your use case, it might be better to just pass along the memory representation of the tensor directly. How are you handling serialization currently?

eaplatanios commented 6 years ago

@lucaRadicalbit Let me know if you have any updates on this, otherwise I'll go ahead and close it for now.