This repository has been archived by the owner on Jul 1, 2023. It is now read-only.
Eager Tensors should be placed on the device they are assigned #1103
Labels
bug
Something isn't working
The Tensor initializer lets you manually specify a device for placement. For example, you should be able to explicitly place a Tensor on the first CPU using the eager mode with the following:
This does not work for the
.TF_EAGER
backend. The Tensor will be created on the default accelerator, no matter what device is specified. If a GPU is present, trying to force a Tensor onto the CPU will not work.As a workaround, encapsulating eager Tensor operations in
withDevice(.cpu) { code here }
will force the eager Tensors within that closure to run on the first of the specified class of devices.For X10, this does work, and does allow for correct manual device placement. The eager-mode Tensors should be modified to support this in the same way as X10 Tensors.
This is an associated issue with #524 on tensorflow/swift.
The text was updated successfully, but these errors were encountered: