com.linkedin.dagli.dag.PositionPlaceholder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
DAG-oriented machine learning framework for bug-resistant, readable, efficient, maintainable and trivially deployable models in Java and other JVM languages
package com.linkedin.dagli.dag;
import com.linkedin.dagli.math.hashing.DoubleXorShift;
import com.linkedin.dagli.placeholder.Placeholder;
/**
* Placeholder used to help determine whether two DAGs are functionally identical.
*
* Ordinarily, placeholders have handle-equality (approximately the same as reference equality); positional placeholders
* are instead equal is their "positions" (i.e. the index of the input they correspond to in the encompassing DAG) are
* equal.
*
* @param the type of result produced by the placeholder
*/
class PositionPlaceholder extends Placeholder {
private static final long serialVersionUID = 1L;
private final int _position;
PositionPlaceholder(int position) {
_position = position;
}
@Override
protected boolean computeEqualsUnsafe(Placeholder other) {
return other instanceof PositionPlaceholder && _position == ((PositionPlaceholder) other)._position;
}
@Override
protected int computeHashCode() {
return (int) DoubleXorShift.hash(_position, PositionPlaceholder.class.hashCode());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy