Implement torch.einsum (fixes #1889) (#6307)

* start at generic trilinear

* Implement einsum (fixes #1889)

This provides a simple implementation of einsum. It is built on
top of the work for computing bilinear (#6110).
It uses a naive left-to-right resolution at the moment.
Autograd is able to differentiate by itself.
The obvious unsupported feature is taking diagonals (einsum('ii->i',(a,)).

* add tests and docs

* fix flake8

* clean diff

* rebase on current master to resolve conflicting String wrapping

* clean up after rebase

* better commentary in einsum and sumproduct_pair

* don't say fixme if it's fixed and rename num_outputs to num_output_dims

* adapt python wrapper to use std::string instead of String to avoid typedef at::String

* typos and some vector to array conversion

* fix accidental python<->python3 change

* really fix bad rebase
This commit is contained in:
Thomas Viehmann
2018-04-18 13:41:27 +02:00
committed by Francisco Massa
parent 187955b959
commit bd0cc7d364
9 changed files with 284 additions and 12 deletions

View File

@ -27,7 +27,7 @@ static std::unordered_map<std::string, ParameterType> type_map = {
{"optional<ScalarType>", ParameterType::SCALARTYPE},
{"Layout", ParameterType::LAYOUT},
{"Device", ParameterType::DEVICE},
{"String", ParameterType::STRING},
{"std::string", ParameterType::STRING},
};
FunctionParameter::FunctionParameter(const std::string& fmt, bool keyword_only)