Convert an onnx type to the proper nd4j type
@param dataType the data type to convert
@return the nd4j type for the onnx type
559267
public DataType nd4jTypeFromOnnxType(OnnxProto3.TensorProto.DataType dataType) {
        switch (dataType) {
            case DOUBLE: return DataType.DOUBLE;
            case FLOAT: return DataType.FLOAT;
            case FLOAT16: return DataType.HALF;
            case INT32:
            case INT64: return DataType.INT;
            default: return DataType.UNKNOWN;
        }
    }
242434
def get_np_dtype(nd4j_dtype):
    
    mapping = {
        'double': np.float64,
        'float': np.float32,
        'half': np.float16
    }
    np_dtype = mapping.get(nd4j_dtype)
    if not np_dtype:
        raise Exception('Invalid nd4j data type : ' + nd4j_dtype)
    return np_dtype
1090460
public <T> T convertFrom(final Type type, final byte[] bytes) {
        if (bytes == null) return null;
        return convertFrom(type, new String(bytes, StandardCharsets.UTF_8));
    }
542975
@Override
	public JavaType getJavaType(final int jdbcType, final String jdbcTypeName) {
		JDBCType type = null;
		try {
			type = JDBCType.valueOf(jdbcType);
		} catch (IllegalArgumentException ex) {
			type = JDBCType.OTHER;
		}
		return getJavaType(type, jdbcTypeName);
	}
1266527
public static EquivalentFragmentSet dataType(VarProperty varProperty, Variable resourceType, AttributeType.DataType<?> dataType) {
        return new AutoValue_DataTypeFragmentSet(varProperty, resourceType, dataType);
    }
802596
public static Type toValueType(Type type) {
	if (type == Types.BYTE) return Types.BYTE_VALUE;
	if (type == Types.BOOLEAN) return Types.BOOLEAN_VALUE;
	if (type == Types.CHARACTER) return Types.CHAR;
	if (type == Types.DOUBLE) return Types.DOUBLE_VALUE;
	if (type == Types.FLOAT) return Types.FLOAT_VALUE;
	if (type == Types.INTEGER) return Types.INT_VALUE;
	if (type == Types.LONG) return Types.LONG_VALUE;
	if (type == Types.SHORT) return Types.SHORT_VALUE;

	return type;
    }
758935
public static Object convert(String dataType, Object record){
		if(record == null){return null;}
		if(dataType.equals(UUID)){
			return java.util.UUID.fromString(record.toString());
		}
		//TODO: add a lot of else if here for the other data types
		else{
			return record;
		}
	}
745142
private List<Object> convertType(DataType type, byte[] data)
   {
      List<Object> result = new ArrayList<Object>();
      int index = 0;

      while (index < data.length)
      {
         switch (type)
         {
            case STRING:
            {
               String value = MPPUtility.getUnicodeString(data, index);
               result.add(value);
               index += ((value.length() + 1) * 2);
               break;
            }

            case CURRENCY:
            {
               Double value = Double.valueOf(MPPUtility.getDouble(data, index) / 100);
               result.add(value);
               index += 8;
               break;
            }

            case NUMERIC:
            {
               Double value = Double.valueOf(MPPUtility.getDouble(data, index));
               result.add(value);
               index += 8;
               break;
            }

            case DATE:
            {
               Date value = MPPUtility.getTimestamp(data, index);
               result.add(value);
               index += 4;
               break;

            }

            case DURATION:
            {
               TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, index + 4), m_properties.getDefaultDurationUnits());
               Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(data, index), units);
               result.add(value);
               index += 6;
               break;
            }

            case BOOLEAN:
            {
               Boolean value = Boolean.valueOf(MPPUtility.getShort(data, index) == 1);
               result.add(value);
               index += 2;
               break;
            }

            default:
            {
               index = data.length;
               break;
            }
         }
      }

      return result;
   }
488032
private JSType getJSType(Node n) {
    JSType jsType = n.getJSType();
    if (jsType == null) {
      // TODO(nicksantos): This branch indicates a compiler bug, not worthy of
      // halting the compilation but we should log this and analyze to track
      // down why it happens. This is not critical and will be resolved over
      // time as the type checker is extended.
      return getNativeType(UNKNOWN_TYPE);
    } else {
      return jsType;
    }
  }
493844
public JaversType getJaversType(Type javaType) {
        argumentIsNotNull(javaType);

        if (javaType == Object.class) {
            return OBJECT_TYPE;
        }

        return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j)));
    }
652594
public <R> R getData(TypeToken<R> dataType) {
        return GSON.fromJson(data, dataType.getType());
    }
771146
public static Type toType(Class type, boolean axistype) throws PageException {
	if (axistype) type = ((ConfigImpl) ThreadLocalPageContext.getConfig()).getWSHandler().toWSTypeClass(type);
	return Type.getType(type);
    }
1237467
public DataPoint type(Type type) {
        if (this.type != type) {
            this.type = type;
            switch (type) {
            case AVERAGE:
            case SUM:
                this.value = 0;
                break;
            case MAXIMUM:
                this.value = Long.MIN_VALUE;
                break;
            case MINIMUM:
                this.value = Long.MAX_VALUE;
                break;
            default:
                this.value = 0;
                break;
            }
            this.numPoints = 0;
        }
        return this;
    }
506823
public static DataType getDataType(Object v) {
        //NOTE: DO NOT CHANGE THE ORDER OF THE IFS!!!
        if(DataType.BOOLEAN.isInstance(v)) {
            return DataType.BOOLEAN;
        }
        else if(DataType.ORDINAL.isInstance(v)) {
            return DataType.ORDINAL;
        }
        else if(DataType.NUMERICAL.isInstance(v)) {
            return DataType.NUMERICAL;
        }
        else if(DataType.CATEGORICAL.isInstance(v)) {
            return DataType.CATEGORICAL;
        }
        else {
            //We will reach this point ONLY if the value is null. 
            //This is because the last enum value in the loop is Categorical which uses the Object class.
            return null; 
        }
    }
772058
def fromType(datatype):
        
        if issubclass(datatype, GPBaseType):
            return GPBaseType._get_type_by_name("GPMultiValue:%s" % 
                                                datatype.__name__)
        else:
            return GPBaseType._get_type_by_name("GPMultiValue:%s" % 
                                                str(datatype))
1052710
protected synchronized HierarchicalType getDataType(String type) {
        HierarchicalType dataType = typeInstances.get(type);
        //todo: are there still cases where type can be null?
        if (dataType == null) {
            dataType = createDataType(type);
            typeInstances.put(type, dataType);
        }
        return dataType;
    }
65542
public static TypeConverter converterForType(Class type)
    {
        for (TypeConverter converter : converters)
        {
            if (converter.canConvertTo( type )) return converter;
        }

        return null;
    }