Skip to content

Conversation

@ezyang
Copy link
Contributor

@ezyang ezyang commented Sep 4, 2018

This PR adds a hooks interface for registering types for complex
scalar types, and a sample implementation of the hook in
test_cpp_extensions.

The hook registration is patterned off of the existing CUDA hooks.

Signed-off-by: Edward Z. Yang [email protected]

CC @Roger-luo

Copy link
Collaborator

@ssnl ssnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed offline. In future patch(s), we will

  1. Support ATen/native the tensor factory functions for complex numbers. Need to port 5~10 functions, e.g., resize_.
  2. Default register our own bare bones complex type. Test that we can swap type pointers in when loading the complex extension.

@ezyang
Copy link
Contributor Author

ezyang commented Sep 4, 2018

@pytorchbot retest this please

1 similar comment
@ezyang
Copy link
Contributor Author

ezyang commented Sep 4, 2018

@pytorchbot retest this please

@ssnl
Copy link
Collaborator

ssnl commented Sep 4, 2018

errors look legit:


16:56:19 /tmp/torch_extensions/complex_registration_extension/main.cpp:29:64: error: expected class-name before '{' token
16:56:19          struct CPUComplexFloatType : public at::CPUTypeDefault {
16:56:19                                                                 ^
16:56:19 /tmp/torch_extensions/complex_registration_extension/main.cpp:34:22: error: 'at::ScalarType at::CPUComplexFloatType::scalarType() const' marked override, but does not override
16:56:19            ScalarType scalarType() const override;
16:56:19                       ^
16:56:19 /tmp/torch_extensions/complex_registration_extension/main.cpp:35:19: error: 'at::Backend at::CPUComplexFloatType::backend() const' marked override, but does not override
16:56:19            Backend backend() const override;
16:56:19                    ^
16:56:19 /tmp/torch_extensions/complex_registration_extension/main.cpp:36:24: error: 'const char* at::CPUComplexFloatType::toString() const' marked override, but does not override
16:56:19            const char * toString() const override;
16:56:19                         ^
16:56:19 /tmp/torch_extensions/complex_registration_extension/main.cpp:37:18: error: 'size_t at::CPUComplexFloatType::elementSizeInBytes() const' marked override, but does not override
16:56:19            size_t elementSizeInBytes() const override;
...

@gchanan
Copy link
Contributor

gchanan commented Sep 4, 2018

does it make sense to call it data_type instead of scalar_t? That's the c10 concept right?

@ezyang
Copy link
Contributor Author

ezyang commented Sep 4, 2018

@gchanan Yeah. We should probably do a global search replaced of scalar_t to data_t.

@Roger-luo
Copy link

@ezyang I had an old issue for renaming real and a python script for auto-renaming that might be helpful.

#4575

@ezyang
Copy link
Contributor Author

ezyang commented Sep 4, 2018

@Roger-luo The fix is landed on master :)

This PR adds a hooks interface for registering types for complex
scalar types, and a sample implementation of the hook in
test_cpp_extensions.

The hook registration is patterned off of the existing CUDA hooks.

Signed-off-by: Edward Z. Yang <[email protected]>
Signed-off-by: Edward Z. Yang <[email protected]>
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ezyang
Copy link
Contributor Author

ezyang commented Sep 5, 2018

@pytorchbot retest this please

Signed-off-by: Edward Z. Yang <[email protected]>
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Sep 5, 2018
Summary:
This PR adds a hooks interface for registering types for complex
scalar types, and a sample implementation of the hook in
test_cpp_extensions.

The hook registration is patterned off of the existing CUDA hooks.

Signed-off-by: Edward Z. Yang <[email protected]>

CC The controller you requested could not be found.
Pull Request resolved: pytorch/pytorch#11216

Differential Revision: D9654840

Pulled By: ezyang

fbshipit-source-id: 7b97646280d584f8ed6e14ee10a4abcd04cf2987
petrex pushed a commit to petrex/pytorch that referenced this pull request Sep 5, 2018
resolve conflict in data parallel model
* master: (201 commits)
  Add cost inference to ConvGradient and WeightedSum operators (pytorch#10744)
  Move collapse dims into a single place (pytorch#11272)
  Fix some more warnings (pytorch#11257)
  Fix the batchnorm onnx exporting when affine=False
  Improve error message to include return types too (pytorch#11245)
  Check doxygen output in travis (pytorch#11124)
  Accept more numpy scalars as doubles (pytorch#9659)
  Fixed log message (pytorch#10874)
  Fix to distribution.__repr__ with lazy attributes (pytorch#11263)
  Add import export step to end to end tests
  Add complex hooks for out of tree complex implementation. (pytorch#11216)
  Unify opt flag for cmake codegen (pytorch#11227)
  nomnigraph - fix memory error in NN subgraph matchOp (pytorch#11127)
  Port PackedSequences functions to C++ (pytorch#11224)
  Treat numerical differences as warnings instead of errors when tracing (pytorch#11246)
  add a Float16UniformFill (pytorch#11123)
  Implement torch.tensordot (pytorch#10025)
  keep net type info when generating model complete net (pytorch#11032)
  Get rid of some uses of type() (pytorch#11215)
  Reorganize methods in Type, add CPUTypeDefault/CUDATypeDefault (pytorch#11205)
  ...
PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Sep 11, 2018
)

Summary:
This PR adds a hooks interface for registering types for complex
scalar types, and a sample implementation of the hook in
test_cpp_extensions.

The hook registration is patterned off of the existing CUDA hooks.

Signed-off-by: Edward Z. Yang <[email protected]>

CC The controller you requested could not be found.
Pull Request resolved: pytorch#11216

Differential Revision: D9654840

Pulled By: ezyang

fbshipit-source-id: 7b97646280d584f8ed6e14ee10a4abcd04cf2987
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants