Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SameDiff Pooling3D op serialized/deserializes as wrong type #8095

Closed
rnett opened this issue Aug 15, 2019 · 0 comments
Closed

SameDiff Pooling3D op serialized/deserializes as wrong type #8095

rnett opened this issue Aug 15, 2019 · 0 comments
Assignees
Milestone

Comments

@rnett
Copy link
Contributor

rnett commented Aug 15, 2019

The Pooling3D op is used by SDCNN.avgPooling and maxPooling, with the mode set as a config option. However, when these are serialized and deserialized, they turn into AvgPooling3D and MaxPooling3D ops respectively.

To reproduce:

@Test
public void pooling3DSerialization(){
    SameDiff sd = SameDiff.create();

    SDVariable x = sd.placeHolder("x", DataType.FLOAT, 1, 28, 28);
    SDVariable o = sd.cnn.maxPooling3d("pool", x, Pooling3DConfig.builder().build());

    ByteBuffer bbSerialized = sd.asFlatBuffers();

    SameDiff deserialized;
    try{
        deserialized = SameDiff.fromFlatBuffers(bbSerialized);
    } catch (IOException e){
        throw new RuntimeException("IOException deserializing from FlatBuffers", e);
    }
    assertEquals(
            sd.getVariableOutputFunction("pool").getClass(),
            deserialized.getVariableOutputFunction("pool").getClass());
}

@Test
public void pooling3DSerialization2(){
    SameDiff sd = SameDiff.create();

    SDVariable x = sd.placeHolder("x", DataType.FLOAT, 1, 28, 28);
    SDVariable o = sd.cnn.avgPooling3d("pool", x, Pooling3DConfig.builder().build());

    ByteBuffer bbSerialized = sd.asFlatBuffers();

    SameDiff deserialized;
    try{
        deserialized = SameDiff.fromFlatBuffers(bbSerialized);
    } catch (IOException e){
        throw new RuntimeException("IOException deserializing from FlatBuffers", e);
    }
    assertEquals(
            sd.getVariableOutputFunction("pool").getClass(),
            deserialized.getVariableOutputFunction("pool").getClass());
}
@AlexDBlack AlexDBlack added this to the 1.0.0-beta5 milestone Aug 16, 2019
@AlexDBlack AlexDBlack self-assigned this Aug 23, 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

No branches or pull requests

2 participants