Search in sources :

Example 26 with PropertyMapping

use of org.nd4j.imports.descriptors.properties.PropertyMapping in project nd4j by deeplearning4j.

the class DeConv2D method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    Map<String, PropertyMapping> map = new HashMap<>();
    val strideMapping = PropertyMapping.builder().tfAttrName("strides").onnxAttrName("strides").build();
    val kernelMapping = PropertyMapping.builder().propertyNames(new String[] { "kh", "kw" }).tfInputPosition(1).onnxAttrName("kernel_shape").build();
    val dilationMapping = PropertyMapping.builder().onnxAttrName("dilations").propertyNames(new String[] { "dw", "dh" }).tfAttrName("rates").build();
    val sameMode = PropertyMapping.builder().onnxAttrName("auto_pad").propertyNames(new String[] { "isSameMode" }).tfAttrName("padding").build();
    val paddingWidthHeight = PropertyMapping.builder().onnxAttrName("padding").propertyNames(new String[] { "ph", "pw" }).build();
    map.put("sx", strideMapping);
    map.put("sy", strideMapping);
    map.put("kh", kernelMapping);
    map.put("kw", kernelMapping);
    map.put("dw", dilationMapping);
    map.put("dh", dilationMapping);
    map.put("isSameMode", sameMode);
    map.put("ph", paddingWidthHeight);
    map.put("pw", paddingWidthHeight);
    ret.put(onnxName(), map);
    ret.put(tensorflowName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 27 with PropertyMapping

use of org.nd4j.imports.descriptors.properties.PropertyMapping in project nd4j by deeplearning4j.

the class DepthToSpace method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    Map<String, PropertyMapping> attrs = new LinkedHashMap<>();
    val blockSize = PropertyMapping.builder().tfAttrName("block_size").propertyNames(new String[] { "blockSize" }).build();
    attrs.put("blockSize", blockSize);
    val dataFormatMapping = PropertyMapping.builder().tfAttrName("data_format").propertyNames(new String[] { "dataFormat" }).build();
    attrs.put("dataFormat", dataFormatMapping);
    ret.put(tensorflowName(), attrs);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 28 with PropertyMapping

use of org.nd4j.imports.descriptors.properties.PropertyMapping in project nd4j by deeplearning4j.

the class FullConv3D method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    Map<String, PropertyMapping> map = new HashMap<>();
    val strideMapping = PropertyMapping.builder().tfAttrName("strides").onnxAttrName("strides").propertyNames(new String[] { "dT", "dW", "dH" }).build();
    val dilationMapping = PropertyMapping.builder().onnxAttrName("dilations").propertyNames(new String[] { "dilationT", "dilationH", "dilationW" }).tfAttrName("rates").build();
    val sameMode = PropertyMapping.builder().onnxAttrName("auto_pad").propertyNames(new String[] { "isSameMode" }).tfAttrName("padding").build();
    val paddingWidthHeight = PropertyMapping.builder().onnxAttrName("padding").propertyNames(new String[] { "pT", "pW", "pH" }).build();
    val dataFormat = PropertyMapping.builder().onnxAttrName("data_format").tfAttrName("data_format").propertyNames(new String[] { "dataFormat" }).build();
    val outputPadding = PropertyMapping.builder().propertyNames(new String[] { "aT", "aH", "aW" }).build();
    val biasUsed = PropertyMapping.builder().propertyNames(new String[] { "biasUsed" }).build();
    for (val propertyMapping : new PropertyMapping[] { strideMapping, dilationMapping, sameMode, paddingWidthHeight, dataFormat, outputPadding, biasUsed }) {
        for (val keys : propertyMapping.getPropertyNames()) map.put(keys, propertyMapping);
    }
    ret.put(onnxName(), map);
    ret.put(tensorflowName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 29 with PropertyMapping

use of org.nd4j.imports.descriptors.properties.PropertyMapping in project nd4j by deeplearning4j.

the class LocalResponseNormalization method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    val depthMapping = PropertyMapping.builder().tfAttrName("depth_radius").propertyNames(new String[] { "depth" }).onnxAttrName("size").build();
    val alphaMapping = PropertyMapping.builder().tfAttrName("alpha").onnxAttrName("alpha").propertyNames(new String[] { "alpha" }).build();
    val betaMapping = PropertyMapping.builder().tfAttrName("beta").onnxAttrName("beta").propertyNames(new String[] { "beta" }).build();
    val biasMapping = PropertyMapping.builder().tfAttrName("bias").onnxAttrName("bias").propertyNames(new String[] { "bias" }).build();
    Map<String, PropertyMapping> map = new HashMap<>();
    map.put("depth", depthMapping);
    map.put("alpha", alphaMapping);
    map.put("beta", betaMapping);
    map.put("bias", biasMapping);
    ret.put(tensorflowName(), map);
    ret.put(onnxName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 30 with PropertyMapping

use of org.nd4j.imports.descriptors.properties.PropertyMapping in project nd4j by deeplearning4j.

the class DepthwiseConv2D method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    Map<String, PropertyMapping> map = new HashMap<>();
    val strideMapping = PropertyMapping.builder().tfAttrName("strides").onnxAttrName("strides").propertyNames(new String[] { "sx", "sy" }).build();
    val kernelMappingH = PropertyMapping.builder().propertyNames(new String[] { "kh" }).tfInputPosition(1).shapePosition(0).onnxAttrName("kernel_shape").build();
    val kernelMappingW = PropertyMapping.builder().propertyNames(new String[] { "kw" }).tfInputPosition(1).shapePosition(1).onnxAttrName("kernel_shape").build();
    val dilationMapping = PropertyMapping.builder().onnxAttrName("dilations").propertyNames(new String[] { "dw", "dh" }).tfAttrName("rates").build();
    val dataFormat = PropertyMapping.builder().onnxAttrName("data_format").tfAttrName("data_format").propertyNames(new String[] { "dataFormat" }).build();
    val nhwc = PropertyMapping.builder().onnxAttrName("data_format").tfAttrName("data_format").propertyNames(new String[] { "isNHWC" }).build();
    val sameMode = PropertyMapping.builder().onnxAttrName("auto_pad").propertyNames(new String[] { "isSameMode" }).tfAttrName("padding").build();
    val paddingWidthHeight = PropertyMapping.builder().onnxAttrName("padding").propertyNames(new String[] { "ph", "pw" }).build();
    map.put("sx", strideMapping);
    map.put("sy", strideMapping);
    map.put("kh", kernelMappingH);
    map.put("kw", kernelMappingW);
    map.put("dw", dilationMapping);
    map.put("dh", dilationMapping);
    map.put("isSameMode", sameMode);
    map.put("ph", paddingWidthHeight);
    map.put("pw", paddingWidthHeight);
    map.put("dataFormat", dataFormat);
    map.put("isNHWC", nhwc);
    try {
        ret.put(onnxName(), map);
    } catch (NoOpNameFoundException e) {
    // ignore
    }
    try {
        ret.put(tensorflowName(), map);
    } catch (NoOpNameFoundException e) {
    // ignore
    }
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping) NoOpNameFoundException(org.nd4j.imports.NoOpNameFoundException)

Aggregations

lombok.val (lombok.val)36 PropertyMapping (org.nd4j.imports.descriptors.properties.PropertyMapping)36 HashMap (java.util.HashMap)13 Map (java.util.Map)13 LinkedHashMap (java.util.LinkedHashMap)8 NoOpNameFoundException (org.nd4j.imports.NoOpNameFoundException)5