+
Skip to content

Conversation

nkoppel
Copy link
Contributor

@nkoppel nkoppel commented Mar 18, 2023

Adds to_dtype method for tensors, and will add a TensorVisitor implementation to convert models between dtypes. "to_dtype" is implemented for most conversions between Units, using AsPrimitive on Cpu and macros on Cuda. Due to the large amount of generated code, compiling test_to_dtype adds around 3 seconds to compile times for both cuda and cpu on my machine.

Currently, to_dtype can not be used with OwnedTapes because Gradients can only hold data with a single dtype.

Closes #475.

Tasks:

  • Add TensorVisitor in nn
  • Documentation

@coreylowman coreylowman merged commit 0dafad7 into coreylowman:main Mar 21, 2023
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.

Add ToDtype trait for converting between dtypes

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载