Uploaded image for project: ' Swift for TensorFlow'
  1. Swift for TensorFlow
  2. TF-494

Conform `Array.DifferentiableView` to `CustomStringConvertible`

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Done
    • Component/s: Stdlib
    • Labels:

      Description

      Array.DifferentiableView should conform to CustomStringConvertible, forwarding the description of the underlying base array.


      Example program:

      func foo(_ x: [Float], _ y: [Float]) -> Float {
          let concatenated = x + y
          return concatenated[0] * concatenated[1] *
                 concatenated[2] * concatenated[3]
      }
      let x: [Float] = [1, 2]
      let y: [Float] = [4, 5]
      let (dx, dy) = gradient(at: x, y, in: foo)
      print(dx)
      print(dy)
      

      Currently, this prints:

      DifferentiableView(_base: [40.0, 20.0])
      DifferentiableView(_base: [10.0, 8.0])
      

      Ideally, it should print:

      [40.0, 20.0]
      [10.0, 8.0]
      

        Attachments

          Activity

            People

            Assignee:
            bartchr808 Bart Chrzaszcz
            Reporter:
            danzheng Dan Zheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: