Why return type of nn::Cloneable<Derived> is Module instead of Derived?


(李睿昕) #1

I got a class:

class A : public torch::nn::Cloneable<A>

I just want to clone my class like

shared_ptr<A> clone_a = a->clone();

but found that i have to write

shared_ptr<torch::nn::Module> clone_a = a->clone();