Search in sources :

Example 1 with AttributeAdapter

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

the class Conv2D method attributeAdaptersForFunction.

@Override
public Map<String, Map<String, AttributeAdapter>> attributeAdaptersForFunction() {
    Map<String, Map<String, AttributeAdapter>> ret = new HashMap<>();
    Map<String, AttributeAdapter> tfMappings = new LinkedHashMap<>();
    val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(this);
    tfMappings.put("kh", new ConditionalFieldValueNDArrayShapeAdapter("NCHW", 2, 0, fields.get("dataFormat")));
    tfMappings.put("kw", new ConditionalFieldValueNDArrayShapeAdapter("NCHW", 3, 1, fields.get("dataFormat")));
    tfMappings.put("sy", new ConditionalFieldValueIntIndexArrayAdapter("NCHW", 2, 1, fields.get("dataFormat")));
    tfMappings.put("sx", new ConditionalFieldValueIntIndexArrayAdapter("NCHW", 3, 2, fields.get("dataFormat")));
    tfMappings.put("isSameMode", new StringEqualsAdapter("SAME"));
    tfMappings.put("isNHWC", new StringEqualsAdapter("NHWC"));
    Map<String, AttributeAdapter> onnxMappings = new HashMap<>();
    onnxMappings.put("kh", new SizeThresholdIntArrayIntIndexAdpater(0, 2, 0));
    onnxMappings.put("kw", new SizeThresholdIntArrayIntIndexAdpater(1, 2, 0));
    onnxMappings.put("dh", new SizeThresholdIntArrayIntIndexAdpater(0, 2, 0));
    onnxMappings.put("dw", new SizeThresholdIntArrayIntIndexAdpater(1, 2, 0));
    onnxMappings.put("sy", new SizeThresholdIntArrayIntIndexAdpater(0, 2, 0));
    onnxMappings.put("sx", new SizeThresholdIntArrayIntIndexAdpater(1, 2, 0));
    onnxMappings.put("isSameMode", new StringEqualsAdapter("SAME"));
    onnxMappings.put("isNHWC", new StringEqualsAdapter("NHWC"));
    ret.put(tensorflowName(), tfMappings);
    ret.put(onnxName(), onnxMappings);
    return ret;
}
Also used : lombok.val(lombok.val) ConditionalFieldValueNDArrayShapeAdapter(org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueNDArrayShapeAdapter) SizeThresholdIntArrayIntIndexAdpater(org.nd4j.imports.descriptors.properties.adapters.SizeThresholdIntArrayIntIndexAdpater) AttributeAdapter(org.nd4j.imports.descriptors.properties.AttributeAdapter) StringEqualsAdapter(org.nd4j.imports.descriptors.properties.adapters.StringEqualsAdapter) ConditionalFieldValueIntIndexArrayAdapter(org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueIntIndexArrayAdapter)

Example 2 with AttributeAdapter

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

the class Conv3D method attributeAdaptersForFunction.

@Override
public Map<String, Map<String, AttributeAdapter>> attributeAdaptersForFunction() {
    Map<String, Map<String, AttributeAdapter>> ret = new LinkedHashMap<>();
    Map<String, AttributeAdapter> tfAdapters = new LinkedHashMap<>();
    val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(this);
    tfAdapters.put("kT", new ConditionalFieldValueNDArrayShapeAdapter("NDHWC", 0, 2, fields.get("dataFormat")));
    tfAdapters.put("kH", new ConditionalFieldValueNDArrayShapeAdapter("NDHWC", 1, 3, fields.get("dataFormat")));
    tfAdapters.put("kW", new ConditionalFieldValueNDArrayShapeAdapter("NDHWC", 2, 4, fields.get("dataFormat")));
    tfAdapters.put("dT", new IntArrayIntIndexAdpater(1));
    tfAdapters.put("dH", new IntArrayIntIndexAdpater(2));
    tfAdapters.put("dW", new IntArrayIntIndexAdpater(3));
    tfAdapters.put("pT", new IntArrayIntIndexAdpater(1));
    tfAdapters.put("pH", new IntArrayIntIndexAdpater(2));
    tfAdapters.put("pW", new IntArrayIntIndexAdpater(3));
    tfAdapters.put("isValidMode", new StringEqualsAdapter("VALID"));
    tfAdapters.put("isNCDHW", new StringEqualsAdapter("NCDHW"));
    ret.put(tensorflowName(), tfAdapters);
    return ret;
}
Also used : lombok.val(lombok.val) ConditionalFieldValueNDArrayShapeAdapter(org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueNDArrayShapeAdapter) AttributeAdapter(org.nd4j.imports.descriptors.properties.AttributeAdapter) StringEqualsAdapter(org.nd4j.imports.descriptors.properties.adapters.StringEqualsAdapter) IntArrayIntIndexAdpater(org.nd4j.imports.descriptors.properties.adapters.IntArrayIntIndexAdpater)

Example 3 with AttributeAdapter

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

the class CumSum method attributeAdaptersForFunction.

@Override
public Map<String, Map<String, AttributeAdapter>> attributeAdaptersForFunction() {
    Map<String, Map<String, AttributeAdapter>> ret = new HashMap<>();
    Map<String, AttributeAdapter> tfMappings = new LinkedHashMap<>();
    tfMappings.put("exclusive", new BooleanAdapter());
    tfMappings.put("reverse", new BooleanAdapter());
    ret.put(tensorflowName(), tfMappings);
    return ret;
}
Also used : AttributeAdapter(org.nd4j.imports.descriptors.properties.AttributeAdapter) BooleanAdapter(org.nd4j.imports.descriptors.properties.adapters.BooleanAdapter)

Example 4 with AttributeAdapter

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

the class Conv1D method attributeAdaptersForFunction.

@Override
public Map<String, Map<String, AttributeAdapter>> attributeAdaptersForFunction() {
    Map<String, Map<String, AttributeAdapter>> ret = new HashMap<>();
    Map<String, AttributeAdapter> tfMappings = new LinkedHashMap<>();
    val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(this);
    tfMappings.put("kh", new ConditionalFieldValueNDArrayShapeAdapter("NCHW", 2, 0, fields.get("dataFormat")));
    tfMappings.put("kw", new ConditionalFieldValueNDArrayShapeAdapter("NCHW", 3, 1, fields.get("dataFormat")));
    tfMappings.put("sy", new ConditionalFieldValueIntIndexArrayAdapter("NCHW", 2, 1, fields.get("dataFormat")));
    tfMappings.put("sx", new ConditionalFieldValueIntIndexArrayAdapter("NCHW", 3, 2, fields.get("dataFormat")));
    tfMappings.put("isSameMode", new StringEqualsAdapter("SAME"));
    tfMappings.put("isNHWC", new StringEqualsAdapter("NHWC"));
    Map<String, AttributeAdapter> onnxMappings = new HashMap<>();
    onnxMappings.put("kh", new SizeThresholdIntArrayIntIndexAdpater(0, 2, 0));
    onnxMappings.put("kw", new SizeThresholdIntArrayIntIndexAdpater(1, 2, 0));
    onnxMappings.put("dh", new SizeThresholdIntArrayIntIndexAdpater(0, 2, 0));
    onnxMappings.put("dw", new SizeThresholdIntArrayIntIndexAdpater(1, 2, 0));
    onnxMappings.put("sy", new SizeThresholdIntArrayIntIndexAdpater(0, 2, 0));
    onnxMappings.put("sx", new SizeThresholdIntArrayIntIndexAdpater(1, 2, 0));
    onnxMappings.put("isSameMode", new StringEqualsAdapter("SAME"));
    onnxMappings.put("isNHWC", new StringEqualsAdapter("NHWC"));
    ret.put(tensorflowName(), tfMappings);
    ret.put(onnxName(), onnxMappings);
    return ret;
}
Also used : lombok.val(lombok.val) ConditionalFieldValueNDArrayShapeAdapter(org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueNDArrayShapeAdapter) SizeThresholdIntArrayIntIndexAdpater(org.nd4j.imports.descriptors.properties.adapters.SizeThresholdIntArrayIntIndexAdpater) AttributeAdapter(org.nd4j.imports.descriptors.properties.AttributeAdapter) StringEqualsAdapter(org.nd4j.imports.descriptors.properties.adapters.StringEqualsAdapter) ConditionalFieldValueIntIndexArrayAdapter(org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueIntIndexArrayAdapter)

Example 5 with AttributeAdapter

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

the class CumProd method attributeAdaptersForFunction.

@Override
public Map<String, Map<String, AttributeAdapter>> attributeAdaptersForFunction() {
    Map<String, Map<String, AttributeAdapter>> ret = new HashMap<>();
    Map<String, AttributeAdapter> tfMappings = new LinkedHashMap<>();
    tfMappings.put("exclusive", new BooleanAdapter());
    tfMappings.put("reverse", new BooleanAdapter());
    ret.put(tensorflowName(), tfMappings);
    return ret;
}
Also used : AttributeAdapter(org.nd4j.imports.descriptors.properties.AttributeAdapter) BooleanAdapter(org.nd4j.imports.descriptors.properties.adapters.BooleanAdapter)

Aggregations

AttributeAdapter (org.nd4j.imports.descriptors.properties.AttributeAdapter)11 lombok.val (lombok.val)8 ConditionalFieldValueNDArrayShapeAdapter (org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueNDArrayShapeAdapter)4 StringEqualsAdapter (org.nd4j.imports.descriptors.properties.adapters.StringEqualsAdapter)4 ConditionalFieldValueIntIndexArrayAdapter (org.nd4j.imports.descriptors.properties.adapters.ConditionalFieldValueIntIndexArrayAdapter)3 SizeThresholdIntArrayIntIndexAdpater (org.nd4j.imports.descriptors.properties.adapters.SizeThresholdIntArrayIntIndexAdpater)3 BooleanAdapter (org.nd4j.imports.descriptors.properties.adapters.BooleanAdapter)2 IntArrayIntIndexAdpater (org.nd4j.imports.descriptors.properties.adapters.IntArrayIntIndexAdpater)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 NoOpNameFoundException (org.nd4j.imports.NoOpNameFoundException)1 DataTypeAdapter (org.nd4j.imports.descriptors.properties.adapters.DataTypeAdapter)1 INDArray (org.nd4j.linalg.api.ndarray.INDArray)1