public CumProd(SameDiff sameDiff, SDVariable x, int... dimension) { super(null, sameDiff, new SDVariable[]{x}); this.sameDiff = sameDiff; this.dimensions = dimension; addArgs(); }
protected void addArgs() { addIArgument(exclusive ? 1 : 0, reverse ? 1 : 0); if (dimensions != null && dimensions.length > 0) addIArgument(dimensions); }
public SDVariable cumprod(SDVariable in, boolean exclusive, boolean reverse, int... dimensions) { return new CumProd(sameDiff(), in, exclusive, reverse, dimensions).outputVariables()[0]; }
@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; }
@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; }
public CumProd(SameDiff sameDiff, SDVariable x, boolean exclusive, boolean reverse, int... dimension) { super(null, sameDiff, new SDVariable[]{x}); this.sameDiff = sameDiff; this.dimensions = dimension; this.exclusive = exclusive; this.reverse = reverse; addArgs(); }
@Override public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String, AttrValue> attributesForNode, GraphDef graph) { TFGraphMapper.getInstance().initFunctionFromProperties(nodeDef.getOp(), this, attributesForNode, nodeDef, graph); addArgs(); }