<code>repeated .tensorflow.KernelDef.AttrConstraint constraint = 3;</code>
767281
public org.tensorflow.framework.KernelDef.AttrConstraint getConstraint(int index) {
    return constraint_.get(index);
  }
473326
protected void checkConstraint(final Optional<Graph> graph, final IRI type, final RDFSyntax syntax) {
        graph.ifPresent(g -> {
            final List<ConstraintViolation> violations = constraintServices.stream().parallel()
                .flatMap(svc -> svc.constrainedBy(type, g)).collect(toList());
            if (!violations.isEmpty()) {
                final ResponseBuilder err = status(CONFLICT);
                violations.forEach(v -> err.link(v.getConstraint().getIRIString(), LDP.constrainedBy.getIRIString()));
                final StreamingOutput stream = new StreamingOutput() {
                    @Override
                    public void write(final OutputStream out) throws IOException {
                        getServices().getIOService().write(violations.stream().flatMap(v2 -> v2.getTriples().stream()),
                                out, syntax);
                    }
                };
                throw new ClientErrorException(err.entity(stream).build());
            }
        });
    }
587401
@Override
	protected Constraint[] createInternalConstraints(Variable from, Variable to) {
		this.xConstraint.setFrom(((RectangularCuboidRegion)from).getInternalVariables()[0]);
		this.xConstraint.setTo(((RectangularCuboidRegion)to).getInternalVariables()[0]);
		this.yConstraint.setFrom(((RectangularCuboidRegion)from).getInternalVariables()[1]);
		this.yConstraint.setTo(((RectangularCuboidRegion)to).getInternalVariables()[1]);
		this.zConstraint.setFrom(((RectangularCuboidRegion)from).getInternalVariables()[2]);
		this.zConstraint.setTo(((RectangularCuboidRegion)to).getInternalVariables()[2]);
		//xConstraint should not be processed by Y and Z solver		
		xConstraint.skipSolver(((MultiVariable)from).getInternalConstraintSolvers()[1], ((MultiVariable)from).getInternalConstraintSolvers()[2]);
		//yConstraint should not be processed by X and Z solver 
		yConstraint.skipSolver(((MultiVariable)from).getInternalConstraintSolvers()[0], ((MultiVariable)from).getInternalConstraintSolvers()[2]);
		//zConstraint should not be processed by X and Y solver 
		zConstraint.skipSolver(((MultiVariable)from).getInternalConstraintSolvers()[0], ((MultiVariable)from).getInternalConstraintSolvers()[1]);
		return new Constraint[] {this.xConstraint, this.yConstraint, this.zConstraint};
	}
180932
public org.tensorflow.framework.OpDef.ArgDefOrBuilder getInputArgOrBuilder(
      int index) {
    return inputArg_.get(index);
  }
1327229
public void addConstraint(Constraint constraint) {
        if ( ConstraintType.ALPHA.equals(constraint.getType())) {
            this.addAlphaConstraint( (AlphaNodeFieldConstraint) constraint );
        } else if ( ConstraintType.BETA.equals(constraint.getType())) {
            this.addBetaConstraint( (BetaNodeFieldConstraint) constraint );
        } else {
            throw new RuntimeException( "Constraint type MUST be known in advance.");
        }
    }
1204878
@Override
    public List<Fence> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
          @SuppressWarnings("unchecked")
          List<VM> vms = (List<VM>) params[0].transform(this, t, args.get(0));
          @SuppressWarnings("unchecked")
          List<Node> ns = (List<Node>) params[1].transform(this, t, args.get(1));
            return vms != null && ns != null ? Fence.newFence(vms, ns) : Collections.emptyList();
        }
        return Collections.emptyList();
    }
681363
function setConstraints(oType, oConstraints) {
		var vIsDigitSequence, vMaxLength, vNullable;

		oType.oConstraints = undefined;
		if (oConstraints) {
			vMaxLength = oConstraints.maxLength;
			if (typeof vMaxLength === "string") {
				vMaxLength = parseInt(vMaxLength);
			}
			if (typeof vMaxLength === "number" && !isNaN(vMaxLength) && vMaxLength > 0) {
				oType.oConstraints = {maxLength : vMaxLength };
			} else if (vMaxLength !== undefined) {
				Log.warning("Illegal maxLength: " + oConstraints.maxLength, null, oType.getName());
			}
			vIsDigitSequence = oConstraints.isDigitSequence;
			if (vIsDigitSequence === true || vIsDigitSequence === "true") {
				oType.oConstraints = oType.oConstraints || {};
				oType.oConstraints.isDigitSequence = true;
			} else if (vIsDigitSequence !== undefined && vIsDigitSequence !== false
					&& vIsDigitSequence !== "false") {
				Log.warning("Illegal isDigitSequence: " + vIsDigitSequence, null, oType.getName());
			}

			vNullable = oConstraints.nullable;
			if (vNullable === false || vNullable === "false") {
				oType.oConstraints = oType.oConstraints || {};
				oType.oConstraints.nullable = false;
			} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
				Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
			}
		}
	}
326428
public INDArray ndArrayFromTensor(TF_Tensor tensor) {
        int rank = TF_NumDims(tensor);

        int[] ndShape;
        if (rank == 0) {
            // scalar
            ndShape = new int[] { 1 };
        } else {
            ndShape = new int[rank];
            for (int i = 0; i < ndShape.length; i++) {
                ndShape[i] = (int) TF_Dim(tensor,i);
            }
        }

        int tfType = TF_TensorType(tensor);
        DataType nd4jType = typeFor(tfType);

        int length = ArrayUtil.prod(ndShape);
        INDArray array;
        if (nd4jType == DataType.UTF8) {
            String[] strings = new String[length];
            BytePointer data = new BytePointer(TF_TensorData(tensor)).capacity(TF_TensorByteSize(tensor));
            BytePointer str = new BytePointer((Pointer)null);
            SizeTPointer size = new SizeTPointer(1);
            TF_Status status = TF_NewStatus();
            for (int i = 0; i < length; i++) {
                long offset = data.position(8 * i).getLong();
                TF_StringDecode(data.position(8 * length + offset), data.capacity() - data.position(), str, size, status);
                if (TF_GetCode(status) != TF_OK) {
                    throw new IllegalStateException("ERROR: Unable to convert tensor " + TF_Message(status).getString());
                }
                strings[i] = str.position(0).capacity(size.get()).getString();
            }
            TF_DeleteStatus(status);
            array = Nd4j.create(strings);
        } else {
            Pointer pointer = TF_TensorData(tensor).capacity(length);
            Indexer indexer = indexerForType(nd4jType,pointer);
            DataBuffer d = Nd4j.createBuffer(indexer.pointer(),nd4jType,length,indexer);
            array = Nd4j.create(d,ndShape);
        }
        Nd4j.getAffinityManager().tagLocation(array, AffinityManager.Location.HOST);
        return array;
    }
256744
public void addBetaConstraint(BetaNodeFieldConstraint constraint) {
        if ( constraint != null ) {
            BetaNodeFieldConstraint[] tmp = this.betaConstraints;
            this.betaConstraints = new BetaNodeFieldConstraint[tmp.length + 1];
            System.arraycopy( tmp,
                              0,
                              this.betaConstraints,
                              0,
                              tmp.length );
            this.betaConstraints[this.betaConstraints.length - 1] = constraint;
            this.updateRequiredDeclarations( constraint );
            this.setType( Constraint.ConstraintType.BETA );
        }
    }
683321
@Override
    public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
            @SuppressWarnings("unchecked")
            List<VM> s = (List<VM>) params[0].transform(this, t, args.get(0));
            return s != null ? Sleeping.newSleeping(s) : Collections.emptyList();
        }
        return Collections.emptyList();
    }
741843
private static double getBiasL2RegularizationFromConfig(Map<String, Object> layerConfig,
                                                            boolean enforceTrainingConfig,
                                                            KerasLayerConfiguration conf)
            throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
        Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
        if (innerConfig.containsKey(conf.getLAYER_FIELD_B_REGULARIZER())) {
            Map<String, Object> regularizerConfig =
                    (Map<String, Object>) innerConfig.get(conf.getLAYER_FIELD_B_REGULARIZER());
            if (regularizerConfig != null && regularizerConfig.containsKey(conf.getREGULARIZATION_TYPE_L2()))
                throw new UnsupportedKerasConfigurationException("L2 regularization for bias parameter not supported");
        }
        return 0.0;
    }
1317550
public BetaConstraints createBetaNodeConstraint(final BuildContext context,
                                                    final List<BetaNodeFieldConstraint> list,
                                                    final boolean disableIndexing) {
        BetaConstraints constraints;
        switch ( list.size() ) {
            case 0 :
                constraints = EmptyBetaConstraints.getInstance();
                break;
            case 1 :
                constraints = new SingleBetaConstraints( list.get( 0 ),
                                                         context.getKnowledgeBase().getConfiguration(),
                                                         disableIndexing );
                break;
            case 2 :
                constraints = new DoubleBetaConstraints( list.toArray( new BetaNodeFieldConstraint[list.size()] ),
                                                         context.getKnowledgeBase().getConfiguration(),
                                                         disableIndexing );
                break;
            case 3 :
                constraints = new TripleBetaConstraints( list.toArray( new BetaNodeFieldConstraint[list.size()] ),
                                                         context.getKnowledgeBase().getConfiguration(),
                                                         disableIndexing );
                break;
            case 4 :
                constraints = new QuadroupleBetaConstraints( list.toArray( new BetaNodeFieldConstraint[list.size()] ),
                                                             context.getKnowledgeBase().getConfiguration(),
                                                             disableIndexing );
                break;
            default :
                constraints = new DefaultBetaConstraints( list.toArray( new BetaNodeFieldConstraint[list.size()] ),
                                                          context.getKnowledgeBase().getConfiguration(),
                                                          disableIndexing );
        }
        return constraints;
    }
1054315
function Constraint (i0, i1) {
  this.i0 = i0
  this.i1 = i1

  this.restLength = vec3.distance(position[i0], position[i1])
}
204780
public void addAlphaConstraint(AlphaNodeFieldConstraint constraint) {
        if ( constraint != null ) {
            AlphaNodeFieldConstraint[] tmp = this.alphaConstraints;
            this.alphaConstraints = new AlphaNodeFieldConstraint[tmp.length + 1];
            System.arraycopy( tmp,
                              0,
                              this.alphaConstraints,
                              0,
                              tmp.length );
            this.alphaConstraints[this.alphaConstraints.length - 1] = constraint;
            this.updateRequiredDeclarations( constraint );
        }
    }
212996
def batch_norm(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs, {'epsilon': 'eps',
                                                               'is_test': 'fix_gamma'})
    new_attrs = translation_utils._remove_attributes(new_attrs,
                                                     ['spatial', 'consumed_inputs'])
    # Disable cuDNN BN only if epsilon from model is < than minimum cuDNN eps (1e-5)
    cudnn_min_eps = 1e-5
    cudnn_off = 0 if attrs.get('epsilon', cudnn_min_eps) >= cudnn_min_eps else 1
    new_attrs = translation_utils._add_extra_attributes(new_attrs, {'cudnn_off': cudnn_off})

    # in test mode "fix_gamma" should be unset.
    new_attrs['fix_gamma'] = not attrs.get('is_test', 1)
    return 'BatchNorm', new_attrs, inputs
1144996
def xors_constraint(v=1):
    
    assert v in [0,1], "v must be 0 or 1 instead of %s" % v.__repr__()
    model, x, y, z = _init()
    r = True
    model.addConsXor([x,y,z], r)
    model.addCons(x==v)
    _optimize("Standard XOR (as boolean)", model)
1144710
@Override
    public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
            @SuppressWarnings("unchecked")
            Collection<Collection<VM>> vs = (Collection<Collection<VM>>) params[0].transform(this, t, args.get(0));
            @SuppressWarnings("unchecked")
            Collection<Collection<Node>> ps = (Collection<Collection<Node>>) params[1].transform(this, t, args.get(1));
            return vs != null && ps != null ? Collections.singletonList(new SplitAmong(vs, ps, false)) : Collections.emptyList();
        }
        return Collections.emptyList();
    }