Search in sources :

Example 31 with PropertyMapping

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

the class SpaceToDepth 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 32 with PropertyMapping

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

the class Conv1D 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[] { "s" }).build();
    val kernelMapping = PropertyMapping.builder().propertyNames(new String[] { "k" }).tfInputPosition(1).shapePosition(0).onnxAttrName("kernel_shape").build();
    val paddingMapping = PropertyMapping.builder().onnxAttrName("padding").propertyNames(new String[] { "p" }).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();
    map.put("s", strideMapping);
    map.put("k", kernelMapping);
    map.put("p", paddingMapping);
    map.put("isSameMode", sameMode);
    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)

Example 33 with PropertyMapping

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

the class CumSum 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 exclusiveMapper = PropertyMapping.builder().tfAttrName("exclusive").propertyNames(new String[] { "exclusive" }).build();
    val reverseMapper = PropertyMapping.builder().tfAttrName("reverse").propertyNames(new String[] { "reverse" }).build();
    map.put("exclusive", exclusiveMapper);
    map.put("reverse", reverseMapper);
    ret.put(tensorflowName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 34 with PropertyMapping

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

the class Mmul 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 transposeA = PropertyMapping.builder().onnxAttrName("transA").tfAttrName("transpose_a").propertyNames(new String[] { "transposeA" }).build();
    val transposeB = PropertyMapping.builder().onnxAttrName("transB").tfAttrName("transpose_b").propertyNames(new String[] { "transposeB" }).build();
    map.put("transposeA", transposeA);
    map.put("transposeB", transposeB);
    ret.put(tensorflowName(), map);
    ret.put(onnxName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 35 with PropertyMapping

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

the class Slice 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 beginMapping = PropertyMapping.builder().tfInputPosition(1).propertyNames(new String[] { "begin" }).build();
    val size = PropertyMapping.builder().tfInputPosition(2).propertyNames(new String[] { "size" }).build();
    map.put("begin", beginMapping);
    map.put("size", size);
    ret.put(tensorflowName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) HashMap(java.util.HashMap) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping) HashMap(java.util.HashMap) Map(java.util.Map)

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