Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Another issue with _vjpConv2DBackpropInput #332

@sjaz24

Description

@sjaz24

After fixing issue #329, I've encountered another issue during backpropagation that results in the following type of error:

Fatal error: Incompatible shapes: [1,32,32,64] vs. [4,4,32,64]: file /Users/stephenjohnson/Projects/Conv2dTransposeTest/.build/checkouts/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift, line 299
Illegal instruction: 4

It took me a while to track down, but I believe it is because conv2DBackpropInput has differentiable order of wrt: (x, filter)

/// TensorFlow builtin conv2d gradient helper for the input.
@differentiable(wrt: (x, filter), vjp: _vjpConv2DBackpropInput)
@usableFromInline
func conv2DBackpropInput<Scalar: TensorFlowFloatingPoint>(

but _vjpConv2DBackpropInput is returning a tuple where conv2DBackpropFilter call is the first tuple item and the conv2D call is the second tuple item.

return (value, { v in
    (conv2DBackpropFilter(x, input: v, filterSizes: shape, strides: strides,
                          padding: padding, dilations: dilations),
     conv2D(v, filter: filter, strides: strides, padding: padding, dilations: dilations))

When I switch them around, everything appears to work fine. I'm going to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions