/// <summary>
        /// Create `TextureAsTensorData` from supplied `textures`
        /// </summary>
        /// <param name="textures">backing textures</param>
        /// <param name="interpretPixelAsChannels">interpret pixel as channels</param>
        /// <param name="flip">flip</param>
        /// <param name="depthAs">depth as</param>
        /// <param name="colorAs">color as</param>
        /// <param name="scale">multiplies `scale` to texture values</param>
        /// <param name="bias">substracts `bias` from texture values</param>
        /// <exception cref="ArgumentException">thrown if textures array is empty or texture types are different</exception>
        /// <exception cref="InvalidOperationException">thrown if unsupported texture type is supplied</exception>
        public TextureAsTensorData(Texture[] textures,
                                   Flip flip, InterpretDepthAs depthAs, InterpretColorAs colorAs, Vector4 scale, Vector4 bias,
                                   int interpretPixelAsChannels)
        {
            if (textures.Length < 1)
            {
                throw new ArgumentException("Textures array must be non empty");
            }

            if (interpretPixelAsChannels < 0)
            {
                interpretPixelAsChannels = TextureFormatUtils.FormatToChannelCount(textures[0]);

                // check that all textures have the same number of channels
                foreach (var tex in textures)
                {
                    if (interpretPixelAsChannels != TextureFormatUtils.FormatToChannelCount(tex))
                    {
                        throw new ArgumentException("All textures must have the same number of channels");
                    }
                }
            }

            m_InterpretPixelAsChannels = interpretPixelAsChannels;
            m_InterpretDepthAs         = depthAs;
            m_InterpretColorAs         = colorAs;
            m_Flip = flip;

            m_scale = scale;
            m_bias  = bias;

            var width  = textures[0].width;
            var height = textures[0].height;

            var totalDepth = 0;

            foreach (var tex in textures)
            {
                if (tex.width != width || tex.height != height)
                {
                    throw new ArgumentException("All textures must have the same width and height dimensions");
                }

                var tex2D  = tex as Texture2D;
                var texArr = tex as Texture2DArray;
                var tex3D  = tex as Texture3D;
                var rt     = tex as RenderTexture;
                if (tex2D)
                {
                    totalDepth += 1;
                }
                else if (texArr)
                {
                    totalDepth += texArr.depth;
                }
                else if (tex3D)
                {
                    totalDepth += tex3D.depth;
                }
                else if (rt)
                {
                    totalDepth += rt.volumeDepth;
                }
                else
                {
                    throw new InvalidOperationException("Unsupported texture type");
                }
            }

            m_Textures = textures;

            int batch    = 1;
            int channels = interpretPixelAsChannels;

            if (m_InterpretDepthAs == InterpretDepthAs.Batch)
            {
                batch *= totalDepth;
            }
            else if (m_InterpretDepthAs == InterpretDepthAs.Channels)
            {
                channels *= totalDepth;
            }

            m_Shape = new TensorShape(batch, height, width, channels);
        }
 /// <summary>
 /// Create `TextureAsTensorData` from supplied `textures`
 /// </summary>
 /// <param name="textures">backing textures</param>
 /// <param name="interpretPixelAsChannels">interpret pixel as channels</param>
 /// <param name="flip">flip</param>
 /// <param name="depthAs">depth as</param>
 /// <param name="colorAs">color as</param>
 /// <exception cref="ArgumentException">thrown if textures array is empty or texture types are different</exception>
 /// <exception cref="InvalidOperationException">thrown if unsupported texture type is supplied</exception>
 public TextureAsTensorData(Texture[] textures, int interpretPixelAsChannels = -1,
                            Flip flip = Flip.Y, InterpretDepthAs depthAs = InterpretDepthAs.Batch,
                            InterpretColorAs colorAs = InterpretColorAs.AverageMultipleChannels) :
     this(textures, flip, depthAs, colorAs, Vector4.one, Vector4.zero, interpretPixelAsChannels)
 {
 }