mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Summary: Documents the `AnyModule` class in the C++ API. Also changed the API to be friendlier by default. Calling `AnyModule::forward` used to return an `AnyModule::Value` which you had to call `.get<T>()` on to cast to a concrete type. I changed the name of that `forward` method to `any_forward` and instead made `forward` templated on a `ReturnType` template parameter which you can supply to do the `.get<T>` cast for you automatically. I default this parameter to `torch::Tensor` so that it can often be omitted. So where you used to have to write ```cpp any_module.forward(...).get<int>(); any_module.forward(...).get<torch::Tensor>(); ``` you now write ```cpp any_module.forward<int>(...); any_module.forward(...); ``` ebetica ezyang soumith Pull Request resolved: https://github.com/pytorch/pytorch/pull/11580 Differential Revision: D9798626 Pulled By: goldsborough fbshipit-source-id: 060b4ea28facaffc417f53b80b846a9dff9acb73 |
||
|---|---|---|
| .. | ||
| api | ||