software.amazon.awssdk.services.sagemaker.model.TargetPlatform Maven / Gradle / Ivy
Show all versions of sagemaker Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.sagemaker.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains information about a target platform that you want your model to run on, such as OS, architecture, and
* accelerators. It is an alternative of TargetDevice
.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TargetPlatform implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField OS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Os")
.getter(getter(TargetPlatform::osAsString)).setter(setter(Builder::os))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Os").build()).build();
private static final SdkField ARCH_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arch")
.getter(getter(TargetPlatform::archAsString)).setter(setter(Builder::arch))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arch").build()).build();
private static final SdkField ACCELERATOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Accelerator").getter(getter(TargetPlatform::acceleratorAsString)).setter(setter(Builder::accelerator))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Accelerator").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OS_FIELD, ARCH_FIELD,
ACCELERATOR_FIELD));
private static final long serialVersionUID = 1L;
private final String os;
private final String arch;
private final String accelerator;
private TargetPlatform(BuilderImpl builder) {
this.os = builder.os;
this.arch = builder.arch;
this.accelerator = builder.accelerator;
}
/**
*
* Specifies a target platform OS.
*
*
* -
*
* LINUX
: Linux-based operating systems.
*
*
* -
*
* ANDROID
: Android operating systems. Android API level can be specified using the
* ANDROID_PLATFORM
compiler option. For example,
* "CompilerOptions": {'ANDROID_PLATFORM': 28}
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #os} will return
* {@link TargetPlatformOs#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #osAsString}.
*
*
* @return Specifies a target platform OS.
*
* -
*
* LINUX
: Linux-based operating systems.
*
*
* -
*
* ANDROID
: Android operating systems. Android API level can be specified using the
* ANDROID_PLATFORM
compiler option. For example,
* "CompilerOptions": {'ANDROID_PLATFORM': 28}
*
*
* @see TargetPlatformOs
*/
public final TargetPlatformOs os() {
return TargetPlatformOs.fromValue(os);
}
/**
*
* Specifies a target platform OS.
*
*
* -
*
* LINUX
: Linux-based operating systems.
*
*
* -
*
* ANDROID
: Android operating systems. Android API level can be specified using the
* ANDROID_PLATFORM
compiler option. For example,
* "CompilerOptions": {'ANDROID_PLATFORM': 28}
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #os} will return
* {@link TargetPlatformOs#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #osAsString}.
*
*
* @return Specifies a target platform OS.
*
* -
*
* LINUX
: Linux-based operating systems.
*
*
* -
*
* ANDROID
: Android operating systems. Android API level can be specified using the
* ANDROID_PLATFORM
compiler option. For example,
* "CompilerOptions": {'ANDROID_PLATFORM': 28}
*
*
* @see TargetPlatformOs
*/
public final String osAsString() {
return os;
}
/**
*
* Specifies a target platform architecture.
*
*
* -
*
* X86_64
: 64-bit version of the x86 instruction set.
*
*
* -
*
* X86
: 32-bit version of the x86 instruction set.
*
*
* -
*
* ARM64
: ARMv8 64-bit CPU.
*
*
* -
*
* ARM_EABIHF
: ARMv7 32-bit, Hard Float.
*
*
* -
*
* ARM_EABI
: ARMv7 32-bit, Soft Float. Used by Android 32-bit ARM platform.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #arch} will return
* {@link TargetPlatformArch#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #archAsString}.
*
*
* @return Specifies a target platform architecture.
*
* -
*
* X86_64
: 64-bit version of the x86 instruction set.
*
*
* -
*
* X86
: 32-bit version of the x86 instruction set.
*
*
* -
*
* ARM64
: ARMv8 64-bit CPU.
*
*
* -
*
* ARM_EABIHF
: ARMv7 32-bit, Hard Float.
*
*
* -
*
* ARM_EABI
: ARMv7 32-bit, Soft Float. Used by Android 32-bit ARM platform.
*
*
* @see TargetPlatformArch
*/
public final TargetPlatformArch arch() {
return TargetPlatformArch.fromValue(arch);
}
/**
*
* Specifies a target platform architecture.
*
*
* -
*
* X86_64
: 64-bit version of the x86 instruction set.
*
*
* -
*
* X86
: 32-bit version of the x86 instruction set.
*
*
* -
*
* ARM64
: ARMv8 64-bit CPU.
*
*
* -
*
* ARM_EABIHF
: ARMv7 32-bit, Hard Float.
*
*
* -
*
* ARM_EABI
: ARMv7 32-bit, Soft Float. Used by Android 32-bit ARM platform.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #arch} will return
* {@link TargetPlatformArch#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #archAsString}.
*
*
* @return Specifies a target platform architecture.
*
* -
*
* X86_64
: 64-bit version of the x86 instruction set.
*
*
* -
*
* X86
: 32-bit version of the x86 instruction set.
*
*
* -
*
* ARM64
: ARMv8 64-bit CPU.
*
*
* -
*
* ARM_EABIHF
: ARMv7 32-bit, Hard Float.
*
*
* -
*
* ARM_EABI
: ARMv7 32-bit, Soft Float. Used by Android 32-bit ARM platform.
*
*
* @see TargetPlatformArch
*/
public final String archAsString() {
return arch;
}
/**
*
* Specifies a target platform accelerator (optional).
*
*
* -
*
* NVIDIA
: Nvidia graphics processing unit. It also requires gpu-code
,
* trt-ver
, cuda-ver
compiler options
*
*
* -
*
* MALI
: ARM Mali graphics processor
*
*
* -
*
* INTEL_GRAPHICS
: Integrated Intel graphics
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #accelerator} will
* return {@link TargetPlatformAccelerator#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #acceleratorAsString}.
*
*
* @return Specifies a target platform accelerator (optional).
*
* -
*
* NVIDIA
: Nvidia graphics processing unit. It also requires gpu-code
,
* trt-ver
, cuda-ver
compiler options
*
*
* -
*
* MALI
: ARM Mali graphics processor
*
*
* -
*
* INTEL_GRAPHICS
: Integrated Intel graphics
*
*
* @see TargetPlatformAccelerator
*/
public final TargetPlatformAccelerator accelerator() {
return TargetPlatformAccelerator.fromValue(accelerator);
}
/**
*
* Specifies a target platform accelerator (optional).
*
*
* -
*
* NVIDIA
: Nvidia graphics processing unit. It also requires gpu-code
,
* trt-ver
, cuda-ver
compiler options
*
*
* -
*
* MALI
: ARM Mali graphics processor
*
*
* -
*
* INTEL_GRAPHICS
: Integrated Intel graphics
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #accelerator} will
* return {@link TargetPlatformAccelerator#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #acceleratorAsString}.
*
*
* @return Specifies a target platform accelerator (optional).
*
* -
*
* NVIDIA
: Nvidia graphics processing unit. It also requires gpu-code
,
* trt-ver
, cuda-ver
compiler options
*
*
* -
*
* MALI
: ARM Mali graphics processor
*
*
* -
*
* INTEL_GRAPHICS
: Integrated Intel graphics
*
*
* @see TargetPlatformAccelerator
*/
public final String acceleratorAsString() {
return accelerator;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(osAsString());
hashCode = 31 * hashCode + Objects.hashCode(archAsString());
hashCode = 31 * hashCode + Objects.hashCode(acceleratorAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TargetPlatform)) {
return false;
}
TargetPlatform other = (TargetPlatform) obj;
return Objects.equals(osAsString(), other.osAsString()) && Objects.equals(archAsString(), other.archAsString())
&& Objects.equals(acceleratorAsString(), other.acceleratorAsString());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("TargetPlatform").add("Os", osAsString()).add("Arch", archAsString())
.add("Accelerator", acceleratorAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Os":
return Optional.ofNullable(clazz.cast(osAsString()));
case "Arch":
return Optional.ofNullable(clazz.cast(archAsString()));
case "Accelerator":
return Optional.ofNullable(clazz.cast(acceleratorAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function