Search in sources :

Example 16 with PropertyMapping

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

the class Squeeze method mappingsForFunction.

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

Example 17 with PropertyMapping

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

the class ExpandDims method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    val axisMapping = PropertyMapping.builder().tfInputPosition(1).propertyNames(new String[] { "axis" }).build();
    Map<String, PropertyMapping> map = new HashMap<>();
    map.put("axis", axisMapping);
    ret.put(tensorflowName(), map);
    return ret;
}
Also used : lombok.val(lombok.val) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping)

Example 18 with PropertyMapping

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

the class Gather 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 broadcast = PropertyMapping.builder().onnxAttrName("broadcast").tfInputPosition(1).propertyNames(new String[] { "broadcast" }).build();
    map.put("broadcast", broadcast);
    ret.put(tensorflowNames()[0], map);
    ret.put(onnxName(), map);
    Map<String, PropertyMapping> map2 = new HashMap<>();
    val broadcast2 = PropertyMapping.builder().tfInputPosition(1).propertyNames(new String[] { "broadcast" }).build();
    map2.put("broadcast", broadcast2);
    val axis2 = PropertyMapping.builder().tfInputPosition(2).propertyNames(new String[] { "axis" }).build();
    map2.put("axis", axis2);
    ret.put("GatherV2", map2);
    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)

Example 19 with PropertyMapping

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

the class Dilation2D 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 sameMode = PropertyMapping.builder().tfAttrName("padding").propertyNames(new String[] { "isSameMode" }).build();
    val ratesMapping = PropertyMapping.builder().tfAttrName("rates").propertyNames(new String[] { "r0", "r1", "r2", "r3" }).build();
    val stridesMapping = PropertyMapping.builder().tfAttrName("strides").propertyNames(new String[] { "s0", "s1", "s2", "s3" }).build();
    map.put("isSameMode", sameMode);
    map.put("r0", ratesMapping);
    map.put("r1", ratesMapping);
    map.put("r2", ratesMapping);
    map.put("r3", ratesMapping);
    map.put("s0", stridesMapping);
    map.put("s1", stridesMapping);
    map.put("s2", stridesMapping);
    map.put("s3", stridesMapping);
    try {
        ret.put(onnxName(), map);
    } catch (NoOpNameFoundException e) {
    // ignore, we dont care about onnx for this set of ops
    }
    try {
        ret.put(tensorflowName(), map);
    } catch (NoOpNameFoundException e) {
        throw new RuntimeException(e);
    }
    return ret;
}
Also used : lombok.val(lombok.val) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping) NoOpNameFoundException(org.nd4j.imports.NoOpNameFoundException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 20 with PropertyMapping

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

the class Concat method mappingsForFunction.

@Override
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
    Map<String, Map<String, PropertyMapping>> ret = new HashMap<>();
    Map<String, PropertyMapping> concatMap = new HashMap<>();
    val concatDimProps = PropertyMapping.builder().tfInputPosition(0).onnxAttrName("axis").build();
    concatMap.put("concatDimension", concatDimProps);
    Map<String, PropertyMapping> concatV2Map = new HashMap<>();
    val concat2DimProps = PropertyMapping.builder().tfInputPosition(-1).onnxAttrName("axis").build();
    concatV2Map.put("concatDimension", concat2DimProps);
    // note that onnx is already covered here
    ret.put(tensorflowNames()[0], concatMap);
    ret.put(tensorflowNames()[1], concatV2Map);
    return ret;
}
Also used : lombok.val(lombok.val) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) PropertyMapping(org.nd4j.imports.descriptors.properties.PropertyMapping) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) 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